@sixb/core 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.js +41 -40
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/validation.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +1 -1
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +50 -3
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +2 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +7 -5
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +74 -50
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-routing.d.ts +5 -2
- package/dist/agents/model-routing.d.ts.map +1 -1
- package/dist/agents/queued-turn.d.ts +16 -0
- package/dist/agents/queued-turn.d.ts.map +1 -0
- package/dist/agents/request.d.ts +120 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-after-finish.d.ts +10 -0
- package/dist/agents/run-after-finish.d.ts.map +1 -1
- package/dist/agents/run-artifacts.d.ts +0 -38
- package/dist/agents/run-artifacts.d.ts.map +1 -1
- package/dist/agents/run-events.d.ts +10 -1
- package/dist/agents/run-events.d.ts.map +1 -1
- package/dist/agents/run-session-children.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 +14 -1
- package/dist/agents/run-session.d.ts.map +1 -1
- package/dist/agents/run-turn.d.ts +9 -1
- package/dist/agents/run-turn.d.ts.map +1 -1
- package/dist/agents/streams/index.d.ts +1 -1
- package/dist/agents/streams/index.d.ts.map +1 -1
- package/dist/agents/streams/index.js +1 -1
- package/dist/agents/streams/internal.d.ts +2 -1
- package/dist/agents/streams/internal.d.ts.map +1 -1
- package/dist/agents/streams/internal.js +22 -2
- package/dist/agents/streams/internal.js.map +1 -1
- package/dist/agents/streams/protocol.d.ts +53 -0
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/streams/steps.d.ts +24 -0
- package/dist/agents/streams/steps.d.ts.map +1 -0
- package/dist/agents/thread-access.d.ts +44 -2
- package/dist/agents/thread-access.d.ts.map +1 -1
- package/dist/agents/turn-answered.d.ts +7 -0
- package/dist/agents/turn-answered.d.ts.map +1 -0
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/artifacts/canvas-display.d.ts +3 -5
- package/dist/artifacts/canvas-display.d.ts.map +1 -1
- package/dist/artifacts/comments.d.ts +14 -3
- package/dist/artifacts/comments.d.ts.map +1 -1
- package/dist/artifacts/document-fill.d.ts +18 -0
- package/dist/artifacts/document-fill.d.ts.map +1 -0
- package/dist/artifacts/errors.d.ts +1 -1
- package/dist/artifacts/errors.d.ts.map +1 -1
- package/dist/artifacts/events.d.ts +3 -2
- package/dist/artifacts/events.d.ts.map +1 -1
- package/dist/artifacts/execution.d.ts +40 -4
- package/dist/artifacts/execution.d.ts.map +1 -1
- package/dist/artifacts/frames/assets.d.ts +8 -1
- package/dist/artifacts/frames/assets.d.ts.map +1 -1
- package/dist/artifacts/frames/document-data.d.ts +98 -0
- package/dist/artifacts/frames/document-data.d.ts.map +1 -0
- package/dist/artifacts/frames/entries.d.ts +12 -7
- package/dist/artifacts/frames/entries.d.ts.map +1 -1
- package/dist/artifacts/frames/index.d.ts +2 -1
- package/dist/artifacts/frames/index.d.ts.map +1 -1
- package/dist/artifacts/frames/index.js +22 -13
- package/dist/artifacts/frames/index.js.map +4 -4
- package/dist/artifacts/frames/kit.d.ts +15 -0
- package/dist/artifacts/frames/kit.d.ts.map +1 -1
- package/dist/artifacts/frames/protocol.d.ts +12 -1
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/runtime.d.ts +24 -4
- package/dist/artifacts/frames/runtime.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +3 -1
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +9 -3
- package/dist/artifacts/index.js.map +3 -3
- package/dist/artifacts/live/blocks.d.ts +62 -0
- package/dist/artifacts/live/blocks.d.ts.map +1 -0
- package/dist/artifacts/live/board.d.ts +6 -0
- package/dist/artifacts/live/board.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts +12 -0
- package/dist/artifacts/live/document.d.ts.map +1 -1
- package/dist/artifacts/live/index.d.ts +2 -0
- package/dist/artifacts/live/index.d.ts.map +1 -1
- package/dist/artifacts/live/index.js +148 -44
- package/dist/artifacts/live/index.js.map +3 -3
- package/dist/artifacts/live/page.d.ts +49 -0
- package/dist/artifacts/live/page.d.ts.map +1 -0
- package/dist/artifacts/live/protocol.d.ts +5 -0
- package/dist/artifacts/live/protocol.d.ts.map +1 -1
- package/dist/artifacts/live/server.d.ts +2 -2
- package/dist/artifacts/live/server.d.ts.map +1 -1
- package/dist/artifacts/live/server.js +29 -24
- package/dist/artifacts/live/server.js.map +1 -1
- package/dist/artifacts/live/state.d.ts +4 -1
- package/dist/artifacts/live/state.d.ts.map +1 -1
- package/dist/artifacts/outline.d.ts +16 -0
- package/dist/artifacts/outline.d.ts.map +1 -1
- package/dist/artifacts/paper.d.ts +22 -0
- package/dist/artifacts/paper.d.ts.map +1 -0
- package/dist/artifacts/pdf-job.d.ts +9 -0
- package/dist/artifacts/pdf-job.d.ts.map +1 -0
- package/dist/artifacts/publish/fields.d.ts +25 -0
- package/dist/artifacts/publish/fields.d.ts.map +1 -0
- package/dist/artifacts/publish/index.d.ts +2 -1
- package/dist/artifacts/publish/index.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +32 -23
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/merge.d.ts +7 -6
- package/dist/artifacts/publish/merge.d.ts.map +1 -1
- package/dist/artifacts/publish/pdf.d.ts +28 -0
- package/dist/artifacts/publish/pdf.d.ts.map +1 -0
- package/dist/artifacts/publish/previews.d.ts +12 -20
- package/dist/artifacts/publish/previews.d.ts.map +1 -1
- package/dist/artifacts/publish/publish.d.ts.map +1 -1
- package/dist/artifacts/publish/queries.d.ts +6 -1
- package/dist/artifacts/publish/queries.d.ts.map +1 -1
- package/dist/artifacts/publish/query-answers.d.ts +5 -2
- package/dist/artifacts/publish/query-answers.d.ts.map +1 -1
- package/dist/artifacts/publish/validate/document-html.d.ts +24 -0
- package/dist/artifacts/publish/validate/document-html.d.ts.map +1 -0
- package/dist/artifacts/publish/validate/document.d.ts +5 -3
- package/dist/artifacts/publish/validate/document.d.ts.map +1 -1
- package/dist/artifacts/queries.d.ts +16 -2
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/run-query.d.ts.map +1 -1
- package/dist/auth/index.js +6 -6
- package/dist/authorization/event-visibility.d.ts.map +1 -1
- package/dist/authorization/index.js +2 -2
- package/dist/blob-storage/index.js +1 -1
- package/dist/bootstrap/index.js +50 -48
- package/dist/bootstrap/index.js.map +2 -2
- package/dist/calendar.d.ts +55 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +19 -0
- package/dist/calendar.js.map +9 -0
- package/dist/{chunk-5a4a52tq.js → chunk-0pmpwn3g.js} +18 -2
- package/dist/chunk-0pmpwn3g.js.map +10 -0
- package/dist/{chunk-0k3r5kb3.js → chunk-394zjzjs.js} +20 -10
- package/dist/{chunk-0k3r5kb3.js.map → chunk-394zjzjs.js.map} +5 -5
- package/dist/{chunk-stmxh0hv.js → chunk-3neam1y5.js} +2 -2
- package/dist/{chunk-zeykm8my.js → chunk-3qtk0070.js} +16 -42
- package/dist/chunk-3qtk0070.js.map +14 -0
- package/dist/{chunk-p8pgnq8d.js → chunk-425ydk65.js} +5 -5
- package/dist/{chunk-p351afzm.js → chunk-5sswe5ej.js} +2 -2
- package/dist/{chunk-a6fjkcne.js → chunk-60662fyv.js} +54 -28
- package/dist/{chunk-a6fjkcne.js.map → chunk-60662fyv.js.map} +7 -6
- package/dist/{chunk-e0hnbb1m.js → chunk-61zptves.js} +1 -1
- package/dist/chunk-6hfbz4d0.js +98 -0
- package/dist/chunk-6hfbz4d0.js.map +10 -0
- package/dist/{chunk-3zagkr6w.js → chunk-7mhbs9yy.js} +4 -4
- package/dist/{chunk-3zagkr6w.js.map → chunk-7mhbs9yy.js.map} +1 -1
- package/dist/{chunk-gxwy4c3s.js → chunk-7r9mqpva.js} +570 -104
- package/dist/chunk-7r9mqpva.js.map +47 -0
- package/dist/{chunk-3014rfjz.js → chunk-88xeh6zx.js} +28 -8
- package/dist/{chunk-3014rfjz.js.map → chunk-88xeh6zx.js.map} +4 -4
- package/dist/{chunk-9nsjjd44.js → chunk-8tv3qd65.js} +2 -1
- package/dist/chunk-8tv3qd65.js.map +12 -0
- package/dist/chunk-90nqenq8.js +386 -0
- package/dist/chunk-90nqenq8.js.map +14 -0
- package/dist/{chunk-fe6r7yhg.js → chunk-92wrka15.js} +1 -1
- package/dist/{chunk-w1wq7gfr.js → chunk-9c9yknwt.js} +464 -29
- package/dist/{chunk-w1wq7gfr.js.map → chunk-9c9yknwt.js.map} +7 -7
- package/dist/{chunk-q9nkpr8k.js → chunk-9tpmfh3n.js} +1 -1
- package/dist/chunk-9wr3yajk.js.map +2 -2
- package/dist/{chunk-rtm1jq00.js → chunk-ats8y3d9.js} +1202 -246
- package/dist/{chunk-rtm1jq00.js.map → chunk-ats8y3d9.js.map} +16 -14
- package/dist/{chunk-td26wjr5.js → chunk-bcz9dxtf.js} +17 -47
- package/dist/chunk-bcz9dxtf.js.map +12 -0
- package/dist/chunk-bqr703h4.js +1799 -0
- package/dist/chunk-bqr703h4.js.map +13 -0
- package/dist/{chunk-sysnvjce.js → chunk-brhp9d97.js} +2 -2
- package/dist/{chunk-8a8k38tz.js → chunk-brybqw5k.js} +1 -1
- package/dist/{chunk-rsxb14an.js → chunk-bs1sd0e0.js} +12 -8
- package/dist/chunk-bs1sd0e0.js.map +18 -0
- package/dist/{chunk-eptrvnby.js → chunk-c29729me.js} +42 -3
- package/dist/chunk-c29729me.js.map +12 -0
- package/dist/{chunk-855w9nvw.js → chunk-cg7cygfj.js} +1 -1
- package/dist/chunk-dq3t5sr3.js +114 -0
- package/dist/chunk-dq3t5sr3.js.map +11 -0
- package/dist/{chunk-t24yktqr.js → chunk-dvgc56n2.js} +20 -4
- package/dist/{chunk-t24yktqr.js.map → chunk-dvgc56n2.js.map} +5 -5
- package/dist/{chunk-r2psmn42.js → chunk-eg6xqef7.js} +1 -1
- package/dist/{chunk-7kpqntgw.js → chunk-f05994as.js} +1 -1
- package/dist/{chunk-msyevpp3.js → chunk-fmgf9h5e.js} +38 -14
- package/dist/chunk-fmgf9h5e.js.map +22 -0
- package/dist/{chunk-b9qfh2ya.js → chunk-fzbhybya.js} +29 -2
- package/dist/chunk-fzbhybya.js.map +11 -0
- package/dist/{chunk-t0s7b3d1.js → chunk-gaj8djsw.js} +251 -6
- package/dist/chunk-gaj8djsw.js.map +13 -0
- package/dist/{chunk-2bn6813a.js → chunk-grt2j5vp.js} +2 -2
- package/dist/{chunk-s7xqfxs9.js → chunk-hkbks1xm.js} +3 -1
- package/dist/{chunk-s7xqfxs9.js.map → chunk-hkbks1xm.js.map} +3 -3
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-rtdrm592.js → chunk-htdzx40w.js} +2 -2
- package/dist/{chunk-bc3y6gff.js → chunk-jka26v8c.js} +1 -1
- package/dist/{chunk-yy914zfr.js → chunk-jt012fxq.js} +772 -98
- package/dist/chunk-jt012fxq.js.map +34 -0
- package/dist/{chunk-48c1z8nj.js → chunk-kft7mp7z.js} +28 -3
- package/dist/chunk-kft7mp7z.js.map +10 -0
- package/dist/chunk-mbwsgjn7.js +40 -0
- package/dist/chunk-mbwsgjn7.js.map +11 -0
- package/dist/{chunk-wa05txmk.js → chunk-n1hbwc6y.js} +51 -8
- package/dist/chunk-n1hbwc6y.js.map +12 -0
- package/dist/{chunk-n4zzaf6q.js → chunk-nxysqbt0.js} +4 -2
- package/dist/chunk-nxysqbt0.js.map +10 -0
- package/dist/{chunk-6ef4esq4.js → chunk-pqj8vff9.js} +4 -4
- package/dist/chunk-pvpq483h.js.map +2 -2
- package/dist/{chunk-mzx71snp.js → chunk-q7g9cqwt.js} +7 -2
- package/dist/{chunk-mzx71snp.js.map → chunk-q7g9cqwt.js.map} +3 -3
- package/dist/{chunk-n68vz95m.js → chunk-qbd282aa.js} +2 -2
- package/dist/{chunk-e91fmg6t.js → chunk-qsa7nw6f.js} +2 -1
- package/dist/{chunk-e91fmg6t.js.map → chunk-qsa7nw6f.js.map} +3 -3
- package/dist/{chunk-rsrc7vtw.js → chunk-s8xxef60.js} +240 -46
- package/dist/chunk-s8xxef60.js.map +50 -0
- package/dist/{chunk-r9rtavg9.js → chunk-t19wjmnc.js} +7 -7
- package/dist/{chunk-vzkxqf8h.js → chunk-tapdssb5.js} +50 -6
- package/dist/chunk-tapdssb5.js.map +23 -0
- package/dist/{chunk-dhkc9b23.js → chunk-v8a1qjzp.js} +1 -1
- package/dist/{chunk-hvbvq7p4.js → chunk-vs2s3p8n.js} +731 -10
- package/dist/chunk-vs2s3p8n.js.map +20 -0
- package/dist/chunk-vtjzwymr.js.map +2 -2
- package/dist/{chunk-8t2ynwg0.js → chunk-wzcjhv54.js} +31 -1
- package/dist/{chunk-8t2ynwg0.js.map → chunk-wzcjhv54.js.map} +3 -3
- package/dist/{chunk-8tqnsx3q.js → chunk-xavet0qs.js} +5 -3
- package/dist/{chunk-8tqnsx3q.js.map → chunk-xavet0qs.js.map} +3 -3
- package/dist/{chunk-8bns0y68.js → chunk-xf76csps.js} +5 -5
- package/dist/{chunk-cwdzcv37.js → chunk-xrmbhap8.js} +2 -2
- package/dist/{chunk-cwdzcv37.js.map → chunk-xrmbhap8.js.map} +2 -2
- package/dist/{chunk-f6ahf5gf.js → chunk-xxfj0rr2.js} +20 -5
- package/dist/chunk-xxfj0rr2.js.map +13 -0
- package/dist/{chunk-3hzhcfsv.js → chunk-y8fwm3z2.js} +2 -2
- package/dist/{chunk-3hzhcfsv.js.map → chunk-y8fwm3z2.js.map} +3 -3
- package/dist/{chunk-smnt672s.js → chunk-ygvay56w.js} +20 -4
- package/dist/chunk-ygvay56w.js.map +10 -0
- package/dist/{chunk-evj5jxz3.js → chunk-ykchk644.js} +63 -15
- package/dist/{chunk-evj5jxz3.js.map → chunk-ykchk644.js.map} +7 -7
- package/dist/{chunk-vepea5c3.js → chunk-ym1bqd98.js} +6 -6
- package/dist/{chunk-yv8hv4wq.js → chunk-z4jqb44a.js} +3 -1
- package/dist/chunk-z4jqb44a.js.map +10 -0
- package/dist/connectors/connection-handles.d.ts +9 -0
- package/dist/connectors/connection-handles.d.ts.map +1 -0
- package/dist/connectors/connections/authorizations.d.ts +9 -0
- package/dist/connectors/connections/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/capability.d.ts +11 -0
- package/dist/connectors/connections/capability.d.ts.map +1 -1
- package/dist/connectors/connections/events.d.ts +17 -0
- package/dist/connectors/connections/events.d.ts.map +1 -0
- package/dist/connectors/connections/internal.d.ts +2 -1
- package/dist/connectors/connections/internal.d.ts.map +1 -1
- package/dist/connectors/connections/internal.js +8 -4
- package/dist/connectors/connections/internal.js.map +1 -1
- package/dist/connectors/connections/runs.d.ts +3 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/service.d.ts +13 -1
- package/dist/connectors/connections/service.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts +14 -2
- 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 +5 -1
- package/dist/connectors/service.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +22 -1
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/write.js +1 -1
- package/dist/deploy/index.d.ts +1 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/internal.js +3 -2
- package/dist/deploy/internal.js.map +3 -3
- package/dist/deploy/services.d.ts.map +1 -1
- package/dist/deploy/types.d.ts +22 -2
- package/dist/deploy/types.d.ts.map +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 +8 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +3 -3
- package/dist/events/outbox-dispatcher.d.ts +7 -0
- package/dist/events/outbox-dispatcher.d.ts.map +1 -1
- package/dist/events/scope.d.ts +1 -0
- package/dist/events/scope.d.ts.map +1 -1
- package/dist/events/scope.js +1 -1
- package/dist/events/selectors/builder.d.ts +9 -1
- package/dist/events/selectors/builder.d.ts.map +1 -1
- package/dist/events/selectors/index.d.ts +2 -2
- package/dist/events/selectors/index.d.ts.map +1 -1
- package/dist/events/selectors/index.js +2 -2
- package/dist/events/selectors/predicate.d.ts.map +1 -1
- package/dist/events/selectors/types.d.ts +18 -3
- package/dist/events/selectors/types.d.ts.map +1 -1
- package/dist/events/types/artifacts.d.ts +7 -1
- package/dist/events/types/artifacts.d.ts.map +1 -1
- package/dist/events/types/connectors.d.ts +32 -0
- package/dist/events/types/connectors.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/syncs.d.ts +4 -0
- package/dist/events/types/syncs.d.ts.map +1 -1
- package/dist/execution/agent.js +43 -42
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorization.d.ts +5 -0
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +4 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -1
- package/dist/execution/object-reader-ontology.d.ts +3 -0
- package/dist/execution/object-reader-ontology.d.ts.map +1 -1
- package/dist/execution/primitive.js +41 -40
- package/dist/execution/primitive.js.map +1 -1
- package/dist/execution/request.d.ts +1 -1
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +39 -38
- package/dist/execution/request.js.map +3 -3
- package/dist/execution/scopes.d.ts +8 -0
- package/dist/execution/scopes.d.ts.map +1 -1
- package/dist/execution/script.d.ts +7 -0
- package/dist/execution/script.d.ts.map +1 -0
- package/dist/execution/types.d.ts +16 -1
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +13 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -70
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +1 -1
- package/dist/lineage/executors.d.ts +1 -1
- package/dist/lineage/executors.d.ts.map +1 -1
- package/dist/maintenance/index.js +2 -2
- package/dist/materialization/event-envelopes.d.ts +3 -3
- package/dist/materialization/event-envelopes.d.ts.map +1 -1
- package/dist/materialization/events.d.ts +6 -0
- package/dist/materialization/events.d.ts.map +1 -1
- package/dist/materialization/index.js +1 -1
- package/dist/materialization/model.d.ts +6 -0
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/index.js +24 -23
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts +2 -0
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts +1 -0
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/models/audio/runtime.d.ts.map +1 -1
- package/dist/models/audio/types.d.ts +19 -0
- package/dist/models/audio/types.d.ts.map +1 -1
- package/dist/models/execution/index.js +22 -21
- package/dist/models/execution/index.js.map +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/objects/index.js +41 -40
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/query/executor.d.ts +3 -1
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/explain.d.ts +3 -1
- package/dist/objects/query/explain.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +1 -1
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +21 -20
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/link-query-clearance.d.ts +3 -0
- package/dist/objects/query/link-query-clearance.d.ts.map +1 -1
- package/dist/objects/query/links.d.ts +1 -1
- package/dist/objects/query/links.d.ts.map +1 -1
- package/dist/objects/query/validate.d.ts +17 -0
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
- package/dist/ontology/index.js +3 -3
- package/dist/ontology/internal.js +3 -3
- package/dist/pipelines/index.js +27 -26
- package/dist/pipelines/index.js.map +1 -1
- package/dist/projections/builders.d.ts +7 -1
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/index.d.ts +1 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.js +22 -21
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/types.d.ts +10 -0
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +3 -2
- 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 +40 -13
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +13 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +47 -25
- package/dist/runtime/internal.js.map +4 -3
- package/dist/runtime/locale.d.ts +0 -2
- package/dist/runtime/locale.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +1 -1
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/script.d.ts +39 -0
- package/dist/runtime/script.d.ts.map +1 -0
- package/dist/runtime/sixb.d.ts +2 -2
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/sandboxes/auth.d.ts +26 -4
- package/dist/sandboxes/auth.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +3 -1
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +5 -5
- package/dist/schedules/builders.d.ts.map +1 -1
- package/dist/schedules/index.js +3 -3
- package/dist/schedules/runtime.d.ts.map +1 -1
- package/dist/schedules/validation.d.ts +2 -0
- package/dist/schedules/validation.d.ts.map +1 -1
- package/dist/security/view-conditions.d.ts.map +1 -1
- package/dist/shares/internal.js +19 -18
- package/dist/shares/internal.js.map +2 -2
- package/dist/storage/agents/errors.d.ts +1 -1
- package/dist/storage/agents/errors.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +43 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +2 -2
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +54 -11
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +41 -5
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +291 -3
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +3 -2
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +4 -3
- package/dist/storage/ai-cost/provider.js.map +1 -1
- package/dist/storage/ai-cost/types.d.ts +5 -1
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts +7 -1
- 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 +5 -2
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +41 -0
- package/dist/storage/artifacts/types.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +3 -3
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +1 -1
- package/dist/storage/executions/types.d.ts +6 -0
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +7 -7
- package/dist/storage/index.d.ts +4 -4
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +30 -25
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +1 -1
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +12 -10
- package/dist/storage/internal.js.map +2 -2
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts +2 -0
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/ontology/replacement-plans.d.ts +8 -0
- package/dist/storage/ontology/replacement-plans.d.ts.map +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/sync-runs/idempotency.d.ts.map +1 -1
- package/dist/storage/sync-runs/in-memory.d.ts +2 -1
- 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/types.d.ts +27 -2
- package/dist/storage/sync-runs/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +7 -7
- package/dist/syncs/accounts.d.ts +36 -0
- package/dist/syncs/accounts.d.ts.map +1 -0
- package/dist/syncs/builders.d.ts.map +1 -1
- package/dist/syncs/connections.d.ts +36 -0
- package/dist/syncs/connections.d.ts.map +1 -0
- package/dist/syncs/execution.d.ts +14 -4
- package/dist/syncs/execution.d.ts.map +1 -1
- package/dist/syncs/index.d.ts +2 -1
- package/dist/syncs/index.d.ts.map +1 -1
- package/dist/syncs/index.js +28 -27
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/request.d.ts +16 -2
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/syncs/run-dispatch.d.ts +14 -2
- package/dist/syncs/run-dispatch.d.ts.map +1 -1
- package/dist/testing/agent-approval-storage-contract.d.ts.map +1 -1
- package/dist/testing/agent-execution.d.ts +3 -0
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-inbox-storage-contract.d.ts +15 -0
- package/dist/testing/agent-inbox-storage-contract.d.ts.map +1 -0
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6589 -4627
- package/dist/testing/index.js.map +13 -12
- package/dist/testing/materializer-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.map +1 -1
- package/dist/webhooks/connections.d.ts +3 -4
- package/dist/webhooks/connections.d.ts.map +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/internal.js +22 -54
- package/dist/webhooks/internal.js.map +3 -3
- package/dist/webhooks/types.d.ts +2 -11
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workers/index.js +66 -13
- package/dist/workers/index.js.map +4 -4
- package/dist/workers/queue-worker.d.ts +5 -0
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workers/queued-run-dispatch.d.ts.map +1 -1
- package/dist/workers/worker.d.ts +8 -0
- package/dist/workers/worker.d.ts.map +1 -1
- package/dist/workflows/index.js +50 -48
- package/dist/workflows/index.js.map +1 -1
- package/package.json +12 -1
- package/src/actions/validation.ts +3 -1
- package/src/agents/README.md +6 -2
- package/src/agents/children.ts +6 -0
- package/src/agents/errors.ts +3 -0
- package/src/agents/execution.ts +331 -43
- package/src/agents/ids.ts +5 -0
- package/src/agents/index.ts +22 -4
- package/src/agents/model-routing.ts +25 -9
- package/src/agents/queued-turn.ts +46 -0
- package/src/agents/request.ts +1444 -210
- package/src/agents/run-after-finish.ts +259 -2
- package/src/agents/run-artifacts.ts +3 -93
- package/src/agents/run-events.ts +256 -34
- package/src/agents/run-session-children.ts +13 -2
- package/src/agents/run-session-http.ts +9 -2
- package/src/agents/run-session-serve.ts +2 -8
- package/src/agents/run-session.ts +142 -3
- package/src/agents/run-turn.ts +148 -23
- package/src/agents/streams/index.ts +3 -0
- package/src/agents/streams/internal.ts +12 -0
- package/src/agents/streams/protocol.ts +109 -1
- package/src/agents/streams/steps.ts +131 -0
- package/src/agents/thread-access.ts +57 -2
- package/src/agents/turn-answered.ts +31 -0
- package/src/agents/validation.ts +2 -0
- package/src/artifacts/canvas-display.ts +4 -6
- package/src/artifacts/comments.ts +70 -17
- package/src/artifacts/document-fill.ts +103 -0
- package/src/artifacts/errors.ts +2 -0
- package/src/artifacts/events.ts +4 -1
- package/src/artifacts/execution.ts +265 -31
- package/src/artifacts/frames/assets.ts +42 -7
- package/src/artifacts/frames/document-data.ts +353 -0
- package/src/artifacts/frames/entries.ts +22 -16
- package/src/artifacts/frames/grants.ts +2 -2
- package/src/artifacts/frames/index.ts +3 -0
- package/src/artifacts/frames/kit.ts +102 -0
- package/src/artifacts/frames/protocol.ts +12 -1
- package/src/artifacts/frames/runtime.ts +413 -6
- package/src/artifacts/index.ts +3 -0
- package/src/artifacts/live/blocks.ts +889 -0
- package/src/artifacts/live/board.ts +195 -42
- package/src/artifacts/live/document.ts +170 -5
- package/src/artifacts/live/index.ts +7 -0
- package/src/artifacts/live/page.ts +807 -0
- package/src/artifacts/live/protocol.ts +5 -0
- package/src/artifacts/live/server.ts +2 -2
- package/src/artifacts/live/state.ts +9 -4
- package/src/artifacts/outline.ts +17 -0
- package/src/artifacts/paper.ts +173 -0
- package/src/artifacts/pdf-job.ts +11 -0
- package/src/artifacts/publish/fields.ts +177 -0
- package/src/artifacts/publish/index.ts +6 -1
- package/src/artifacts/publish/merge.ts +28 -15
- package/src/artifacts/publish/pdf.ts +82 -0
- package/src/artifacts/publish/previews.ts +24 -34
- package/src/artifacts/publish/publish.ts +26 -3
- package/src/artifacts/publish/queries.ts +20 -4
- package/src/artifacts/publish/query-answers.ts +14 -3
- package/src/artifacts/publish/validate/document-html.ts +245 -0
- package/src/artifacts/publish/validate/document.ts +34 -3
- package/src/artifacts/queries.ts +59 -13
- package/src/artifacts/run-query.ts +5 -2
- package/src/authorization/event-visibility.ts +13 -0
- package/src/calendar.ts +195 -0
- package/src/connectors/connection-handles.ts +71 -0
- package/src/connectors/connections/authorizations.ts +50 -2
- package/src/connectors/connections/capability.ts +40 -0
- package/src/connectors/connections/events.ts +57 -0
- package/src/connectors/connections/internal.ts +3 -0
- package/src/connectors/connections/runs.ts +5 -0
- package/src/connectors/connections/service.ts +93 -6
- package/src/connectors/execution.ts +35 -8
- package/src/connectors/index.ts +3 -0
- package/src/connectors/service.ts +23 -0
- package/src/connectors/types.ts +29 -1
- package/src/deploy/index.ts +1 -0
- package/src/deploy/services.ts +1 -0
- package/src/deploy/types.ts +30 -2
- package/src/events/definitions.ts +14 -0
- package/src/events/execution.ts +51 -4
- package/src/events/index.ts +8 -0
- package/src/events/outbox-dispatcher.ts +12 -2
- package/src/events/scope.ts +3 -0
- package/src/events/selectors/builder.ts +49 -0
- package/src/events/selectors/index.ts +5 -0
- package/src/events/selectors/predicate.ts +2 -0
- package/src/events/selectors/types.ts +30 -1
- package/src/events/types/artifacts.ts +7 -1
- package/src/events/types/connectors.ts +36 -0
- package/src/events/types/index.ts +7 -0
- package/src/events/types/syncs.ts +4 -0
- package/src/execution/authorization.ts +45 -0
- package/src/execution/authorized-object-reader.ts +33 -5
- package/src/execution/durable.ts +2 -0
- package/src/execution/object-reader-ontology.ts +6 -0
- package/src/execution/request.ts +1 -0
- package/src/execution/scopes.ts +24 -0
- package/src/execution/script.ts +27 -0
- package/src/execution/types.ts +7 -1
- package/src/http/api-routes.ts +33 -0
- package/src/index.ts +39 -4
- package/src/lineage/executors.ts +3 -1
- package/src/materialization/event-envelopes.ts +10 -5
- package/src/materialization/events.ts +2 -0
- package/src/materialization/model.ts +6 -0
- package/src/materializer/README.md +10 -0
- package/src/materializer/projections/replace.ts +42 -1
- package/src/materializer/projections/replacement-plan.ts +44 -4
- package/src/materializer/shared/normalize.ts +4 -0
- package/src/models/audio/runtime.ts +57 -14
- package/src/models/audio/types.ts +20 -0
- package/src/models/index.ts +1 -0
- package/src/objects/query/executor.ts +4 -0
- package/src/objects/query/explain.ts +5 -0
- package/src/objects/query/index.ts +1 -0
- package/src/objects/query/link-query-clearance.ts +4 -1
- package/src/objects/query/links.ts +5 -1
- package/src/objects/query/validate.ts +33 -1
- package/src/objects/sdk/runtime-query-executor.ts +7 -3
- package/src/projections/builders.ts +20 -0
- package/src/projections/index.ts +1 -0
- package/src/projections/registry.ts +1 -0
- package/src/projections/revision.ts +2 -0
- package/src/projections/types.ts +11 -0
- package/src/projections/validation.ts +6 -0
- package/src/queues/in-memory.ts +5 -0
- package/src/queues/index.ts +3 -1
- package/src/queues/types.ts +45 -14
- package/src/runtime/host.ts +125 -11
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/locale.ts +0 -10
- package/src/runtime/resolve-definitions.ts +4 -1
- package/src/runtime/script.ts +62 -0
- package/src/runtime/sixb.ts +15 -5
- package/src/sandboxes/README.md +3 -1
- package/src/sandboxes/auth.ts +32 -4
- package/src/sandboxes/index.ts +15 -1
- package/src/schedules/builders.ts +4 -1
- package/src/schedules/runtime.ts +3 -0
- package/src/schedules/validation.ts +20 -2
- package/src/security/view-conditions.ts +2 -1
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +500 -7
- package/src/storage/agents/index.ts +26 -0
- package/src/storage/agents/provider.ts +454 -15
- package/src/storage/agents/types.ts +315 -3
- package/src/storage/ai-cost/analytics.ts +22 -43
- package/src/storage/ai-cost/types.ts +5 -1
- package/src/storage/artifacts/in-memory.ts +52 -6
- package/src/storage/artifacts/index.ts +2 -0
- package/src/storage/artifacts/record.ts +33 -4
- package/src/storage/artifacts/types.ts +44 -0
- package/src/storage/executions/provider.ts +22 -2
- package/src/storage/executions/types.ts +2 -0
- package/src/storage/executions/validation.ts +27 -0
- package/src/storage/index.ts +29 -0
- package/src/storage/internal.ts +1 -0
- package/src/storage/ontology/in-memory/replacement-plans.ts +22 -0
- package/src/storage/ontology/replacement-plans.ts +6 -0
- package/src/storage/operation-scope.ts +2 -0
- package/src/storage/sync-runs/idempotency.ts +1 -0
- package/src/storage/sync-runs/in-memory.ts +43 -1
- package/src/storage/sync-runs/index.ts +1 -0
- package/src/storage/sync-runs/types.ts +30 -1
- package/src/syncs/accounts.ts +85 -0
- package/src/syncs/builders.ts +18 -1
- package/src/syncs/connections.ts +123 -0
- package/src/syncs/execution.ts +64 -22
- package/src/syncs/index.ts +3 -0
- package/src/syncs/request.ts +81 -23
- package/src/syncs/run-dispatch.ts +69 -7
- package/src/testing/agent-approval-storage-contract.ts +123 -0
- package/src/testing/agent-execution.ts +45 -2
- package/src/testing/agent-inbox-storage-contract.ts +874 -0
- package/src/testing/agent-storage-contract.ts +965 -103
- package/src/testing/ai-cost-storage-contract.ts +80 -0
- package/src/testing/artifact-storage-contract.ts +201 -4
- package/src/testing/execution-storage-contract.ts +31 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/materializer-storage-contract.ts +139 -1
- package/src/testing/queues-contract.ts +22 -0
- package/src/testing/run-claim-storage-contract.ts +116 -0
- package/src/webhooks/connections.ts +9 -50
- package/src/webhooks/index.ts +0 -2
- package/src/webhooks/types.ts +2 -13
- package/src/workers/README.md +4 -1
- package/src/workers/lost-runs.ts +1 -0
- package/src/workers/queue-worker.ts +16 -5
- package/src/workers/queued-run-dispatch.ts +8 -1
- package/src/workers/worker.ts +67 -7
- package/dist/chunk-3z1vxzcm.js +0 -234
- package/dist/chunk-3z1vxzcm.js.map +0 -12
- package/dist/chunk-48c1z8nj.js.map +0 -10
- package/dist/chunk-58geavnf.js +0 -29
- package/dist/chunk-58geavnf.js.map +0 -10
- package/dist/chunk-5a4a52tq.js.map +0 -10
- package/dist/chunk-9nsjjd44.js.map +0 -12
- package/dist/chunk-b9qfh2ya.js.map +0 -11
- package/dist/chunk-eptrvnby.js.map +0 -12
- package/dist/chunk-f6ahf5gf.js.map +0 -13
- package/dist/chunk-gxwy4c3s.js.map +0 -47
- package/dist/chunk-hvbvq7p4.js.map +0 -18
- package/dist/chunk-m2jerfef.js +0 -474
- package/dist/chunk-m2jerfef.js.map +0 -11
- package/dist/chunk-msyevpp3.js.map +0 -22
- package/dist/chunk-n4zzaf6q.js.map +0 -10
- package/dist/chunk-rsrc7vtw.js.map +0 -49
- package/dist/chunk-rsxb14an.js.map +0 -18
- package/dist/chunk-smnt672s.js.map +0 -10
- package/dist/chunk-t0s7b3d1.js.map +0 -13
- package/dist/chunk-td26wjr5.js.map +0 -13
- package/dist/chunk-vzkxqf8h.js.map +0 -23
- package/dist/chunk-wa05txmk.js.map +0 -11
- package/dist/chunk-yv8hv4wq.js.map +0 -10
- package/dist/chunk-yy914zfr.js.map +0 -30
- package/dist/chunk-zeykm8my.js.map +0 -14
- /package/dist/{chunk-stmxh0hv.js.map → chunk-3neam1y5.js.map} +0 -0
- /package/dist/{chunk-p8pgnq8d.js.map → chunk-425ydk65.js.map} +0 -0
- /package/dist/{chunk-p351afzm.js.map → chunk-5sswe5ej.js.map} +0 -0
- /package/dist/{chunk-e0hnbb1m.js.map → chunk-61zptves.js.map} +0 -0
- /package/dist/{chunk-fe6r7yhg.js.map → chunk-92wrka15.js.map} +0 -0
- /package/dist/{chunk-q9nkpr8k.js.map → chunk-9tpmfh3n.js.map} +0 -0
- /package/dist/{chunk-sysnvjce.js.map → chunk-brhp9d97.js.map} +0 -0
- /package/dist/{chunk-8a8k38tz.js.map → chunk-brybqw5k.js.map} +0 -0
- /package/dist/{chunk-855w9nvw.js.map → chunk-cg7cygfj.js.map} +0 -0
- /package/dist/{chunk-r2psmn42.js.map → chunk-eg6xqef7.js.map} +0 -0
- /package/dist/{chunk-7kpqntgw.js.map → chunk-f05994as.js.map} +0 -0
- /package/dist/{chunk-2bn6813a.js.map → chunk-grt2j5vp.js.map} +0 -0
- /package/dist/{chunk-rtdrm592.js.map → chunk-htdzx40w.js.map} +0 -0
- /package/dist/{chunk-bc3y6gff.js.map → chunk-jka26v8c.js.map} +0 -0
- /package/dist/{chunk-6ef4esq4.js.map → chunk-pqj8vff9.js.map} +0 -0
- /package/dist/{chunk-n68vz95m.js.map → chunk-qbd282aa.js.map} +0 -0
- /package/dist/{chunk-r9rtavg9.js.map → chunk-t19wjmnc.js.map} +0 -0
- /package/dist/{chunk-dhkc9b23.js.map → chunk-v8a1qjzp.js.map} +0 -0
- /package/dist/{chunk-8bns0y68.js.map → chunk-xf76csps.js.map} +0 -0
- /package/dist/{chunk-vepea5c3.js.map → chunk-ym1bqd98.js.map} +0 -0
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
validateObjectQueryWithAdmission,
|
|
5
5
|
SYSTEM_PRINCIPAL2,
|
|
6
6
|
principalsEqual2
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-394zjzjs.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveRuntimeAuthorizationForProject,
|
|
10
10
|
AuthorizationError2,
|
|
11
11
|
isRuntimeAllowed2
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-tapdssb5.js";
|
|
13
13
|
import {
|
|
14
14
|
createArtifactId,
|
|
15
15
|
createArtifactCommentId
|
|
@@ -20,25 +20,47 @@ import {
|
|
|
20
20
|
} from "./chunk-wkv3h3q7.js";
|
|
21
21
|
import {
|
|
22
22
|
collectArtifactRefIds
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7mhbs9yy.js";
|
|
24
24
|
import {
|
|
25
25
|
ArtifactStorageError,
|
|
26
26
|
turnUndoable2
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-88xeh6zx.js";
|
|
28
28
|
import {
|
|
29
29
|
ARTIFACT_LIMITS2,
|
|
30
30
|
ARTIFACT_STATE_LIMITS2,
|
|
31
31
|
ARTIFACT_HOLDERS_LIMIT2,
|
|
32
32
|
ARTIFACT_COMMENT_LIMITS2
|
|
33
33
|
} from "./chunk-9vsc919v.js";
|
|
34
|
+
import {
|
|
35
|
+
computeBlobDigest2
|
|
36
|
+
} from "./chunk-xrmbhap8.js";
|
|
34
37
|
import {
|
|
35
38
|
objectBatchKey2
|
|
36
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-9c9yknwt.js";
|
|
37
40
|
import {
|
|
38
41
|
objectReadersIn,
|
|
39
42
|
getAuthorizedOntologyView,
|
|
43
|
+
getQueryDiscovery,
|
|
40
44
|
readerClearance
|
|
41
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-fmgf9h5e.js";
|
|
46
|
+
import {
|
|
47
|
+
ArtifactRequestError2,
|
|
48
|
+
documentData,
|
|
49
|
+
documentMarks,
|
|
50
|
+
fillDocumentHtml,
|
|
51
|
+
frozenDocumentHtml2,
|
|
52
|
+
checkArtifactFiles,
|
|
53
|
+
readArtifactText,
|
|
54
|
+
invalidArtifact,
|
|
55
|
+
decodeHtmlEntities,
|
|
56
|
+
HTML_ENTRY2,
|
|
57
|
+
refuseFrameAssetPaths,
|
|
58
|
+
readHtmlReferences,
|
|
59
|
+
FRAME_DEFAULT_THEMES2,
|
|
60
|
+
FRAME_CDN_ALLOWLIST2,
|
|
61
|
+
FRAME_ASSETS2,
|
|
62
|
+
serializeArtifactQueryResult2
|
|
63
|
+
} from "./chunk-vs2s3p8n.js";
|
|
42
64
|
import {
|
|
43
65
|
isArtifactAddress2,
|
|
44
66
|
parseArtifactAddress2,
|
|
@@ -49,8 +71,9 @@ import {
|
|
|
49
71
|
isLiveTextPath,
|
|
50
72
|
createArtifactDocument,
|
|
51
73
|
documentFiles2,
|
|
52
|
-
mergeIntoDocument2
|
|
53
|
-
|
|
74
|
+
mergeIntoDocument2,
|
|
75
|
+
holdPage
|
|
76
|
+
} from "./chunk-bqr703h4.js";
|
|
54
77
|
import {
|
|
55
78
|
BOARD_PREVIEW_JOB2,
|
|
56
79
|
BOARD_PREVIEW_WAIT_MS2,
|
|
@@ -59,15 +82,16 @@ import {
|
|
|
59
82
|
canvasEndBox,
|
|
60
83
|
ARTIFACT_QUERIES_DIRECTORY,
|
|
61
84
|
ARTIFACT_QUERY_KINDS,
|
|
85
|
+
DOCUMENT_HOLDER_QUERY2,
|
|
62
86
|
isArtifactQueryName,
|
|
63
87
|
artifactQueryPath,
|
|
64
88
|
artifactQueryName2,
|
|
65
89
|
parseArtifactQuery,
|
|
90
|
+
createHeadingSlugger2,
|
|
66
91
|
ARTIFACT_THEME_FILE2,
|
|
67
92
|
parseArtifactTheme2,
|
|
68
93
|
artifactThemeModes2,
|
|
69
94
|
resolveArtifactAddress2,
|
|
70
|
-
createHeadingSlugger2,
|
|
71
95
|
CsvParseError2,
|
|
72
96
|
parseCsv2,
|
|
73
97
|
WORKBOOK_FILE2,
|
|
@@ -80,20 +104,7 @@ import {
|
|
|
80
104
|
sheetColumnsProblem,
|
|
81
105
|
sheetFormulasProblem,
|
|
82
106
|
sheetChartsProblem
|
|
83
|
-
} from "./chunk-
|
|
84
|
-
import {
|
|
85
|
-
ArtifactRequestError2,
|
|
86
|
-
checkArtifactFiles,
|
|
87
|
-
readArtifactText,
|
|
88
|
-
invalidArtifact,
|
|
89
|
-
decodeHtmlEntities,
|
|
90
|
-
HTML_ENTRY2,
|
|
91
|
-
refuseFrameAssetPaths,
|
|
92
|
-
readHtmlReferences,
|
|
93
|
-
FRAME_DEFAULT_THEMES2,
|
|
94
|
-
FRAME_ASSETS2,
|
|
95
|
-
serializeArtifactQueryResult2
|
|
96
|
-
} from "./chunk-hvbvq7p4.js";
|
|
107
|
+
} from "./chunk-60662fyv.js";
|
|
97
108
|
import {
|
|
98
109
|
ObjectQueryValidationError2,
|
|
99
110
|
ObjectQueryPlanningError2,
|
|
@@ -103,11 +114,13 @@ import {
|
|
|
103
114
|
import {
|
|
104
115
|
AgentRequestError2
|
|
105
116
|
} from "./chunk-9wr3yajk.js";
|
|
106
|
-
import {
|
|
107
|
-
statFileRef2
|
|
108
|
-
} from "./chunk-a3faa34j.js";
|
|
109
117
|
|
|
110
118
|
// src/agents/thread-access.ts
|
|
119
|
+
function agentRunEndedShort(run) {
|
|
120
|
+
if (run.status === "failed")
|
|
121
|
+
return true;
|
|
122
|
+
return run.finishReason === "timeout" || run.finishReason === "interrupted";
|
|
123
|
+
}
|
|
111
124
|
function createAgentThreadAccessRule(runtime, authority, agents) {
|
|
112
125
|
const caller = authority.type === "principal" ? authority.context.principal : SYSTEM_PRINCIPAL2;
|
|
113
126
|
const blocked = authority.type === "denied" || authority.type === "delegated";
|
|
@@ -251,7 +264,7 @@ async function announceArtifactUpdates(events, latest) {
|
|
|
251
264
|
}))
|
|
252
265
|
}, { source: "Sixb" });
|
|
253
266
|
}
|
|
254
|
-
async function announceArtifactComment(events, comment, action) {
|
|
267
|
+
async function announceArtifactComment(events, comment, shareGrantId, action) {
|
|
255
268
|
await events.emit({
|
|
256
269
|
events: [
|
|
257
270
|
{
|
|
@@ -260,6 +273,7 @@ async function announceArtifactComment(events, comment, action) {
|
|
|
260
273
|
artifactId: comment.artifactId,
|
|
261
274
|
commentId: comment.id,
|
|
262
275
|
...comment.parentId === undefined ? {} : { parentId: comment.parentId },
|
|
276
|
+
...shareGrantId === undefined ? {} : { shareGrantId },
|
|
263
277
|
action
|
|
264
278
|
}
|
|
265
279
|
}
|
|
@@ -271,7 +285,9 @@ async function announceArtifactComment(events, comment, action) {
|
|
|
271
285
|
var ELEMENT_ADDRESS = /^body(>[a-z][a-z0-9-]*:\d+)*$/;
|
|
272
286
|
var MAX_ELEMENT_ADDRESS_LENGTH = 1024;
|
|
273
287
|
function createArtifactCommentsRuntime(input) {
|
|
274
|
-
const { projectId, events } = input;
|
|
288
|
+
const { projectId, events, guest } = input;
|
|
289
|
+
const threadOf = (comment) => comment.parentId === undefined ? Promise.resolve(comment) : input.storage().getComment({ projectId, artifactId: comment.artifactId, id: comment.parentId });
|
|
290
|
+
const reads = (thread) => thread !== null && (!guest || guest.grantId !== undefined && threadLink(thread) === guest.grantId);
|
|
275
291
|
const readable = async (artifactId) => {
|
|
276
292
|
const reached = await input.reach(artifactId);
|
|
277
293
|
if (!reached)
|
|
@@ -283,23 +299,28 @@ function createArtifactCommentsRuntime(input) {
|
|
|
283
299
|
};
|
|
284
300
|
const managed = async (artifactId, commentId) => {
|
|
285
301
|
const { access } = await readable(artifactId);
|
|
286
|
-
const manager = input.manager();
|
|
287
302
|
const comment = await input.storage().getComment({ projectId, artifactId, id: commentId });
|
|
288
|
-
|
|
303
|
+
const thread = comment ? await threadOf(comment) : null;
|
|
304
|
+
if (!comment || !reads(thread))
|
|
289
305
|
throw commentNotFound(artifactId, commentId);
|
|
306
|
+
const manager = input.manager();
|
|
290
307
|
const changes = access === "owner" || access === "update";
|
|
291
308
|
const authored = comment.author.type !== "guest" && principalsEqual2(comment.author, manager);
|
|
292
309
|
if (!changes && !authored) {
|
|
293
310
|
throw new ArtifactRequestError2("not_allowed", "[Sixb] Only a comment's author, or whoever may change the artifact, resolves or deletes it.");
|
|
294
311
|
}
|
|
295
|
-
return comment;
|
|
312
|
+
return { comment, thread };
|
|
296
313
|
};
|
|
297
314
|
return {
|
|
298
315
|
async listComments(artifactId) {
|
|
299
316
|
const reached = await input.reach(artifactId);
|
|
300
317
|
if (!reached || reached.access === "none")
|
|
301
318
|
return null;
|
|
302
|
-
|
|
319
|
+
const comments = await input.storage().listComments({ projectId, id: artifactId });
|
|
320
|
+
if (!guest)
|
|
321
|
+
return comments;
|
|
322
|
+
const threads = new Set(comments.filter((comment) => comment.parentId === undefined && reads(comment)).map((comment) => comment.id));
|
|
323
|
+
return comments.filter((comment) => threads.has(comment.parentId ?? comment.id));
|
|
303
324
|
},
|
|
304
325
|
async addComment(artifactId, comment) {
|
|
305
326
|
const { artifact } = await readable(artifactId);
|
|
@@ -310,9 +331,10 @@ function createArtifactCommentsRuntime(input) {
|
|
|
310
331
|
throw invalid(`A comment holds 1 to ${ARTIFACT_COMMENT_LIMITS2.maxBodyLength} characters of text.`);
|
|
311
332
|
}
|
|
312
333
|
let anchor;
|
|
334
|
+
let parent = null;
|
|
313
335
|
if (comment.parentId !== undefined) {
|
|
314
|
-
|
|
315
|
-
if (!parent)
|
|
336
|
+
parent = await storage.getComment({ projectId, artifactId, id: comment.parentId });
|
|
337
|
+
if (!reads(parent))
|
|
316
338
|
throw commentNotFound(artifactId, comment.parentId);
|
|
317
339
|
anchor = parent.anchor;
|
|
318
340
|
} else {
|
|
@@ -330,14 +352,14 @@ function createArtifactCommentsRuntime(input) {
|
|
|
330
352
|
...comment.origin ? { origin: comment.origin } : {},
|
|
331
353
|
createdAt: new Date
|
|
332
354
|
});
|
|
333
|
-
await announceArtifactComment(events, created, "created");
|
|
355
|
+
await announceArtifactComment(events, created, threadLink(parent ?? created), "created");
|
|
334
356
|
return created;
|
|
335
357
|
} catch (error) {
|
|
336
358
|
throw commentRequestError(error);
|
|
337
359
|
}
|
|
338
360
|
},
|
|
339
361
|
async resolveComment(artifactId, commentId, resolved = true) {
|
|
340
|
-
await managed(artifactId, commentId);
|
|
362
|
+
const { thread } = await managed(artifactId, commentId);
|
|
341
363
|
const changed = await input.storage().resolveComment({
|
|
342
364
|
projectId,
|
|
343
365
|
artifactId,
|
|
@@ -346,18 +368,21 @@ function createArtifactCommentsRuntime(input) {
|
|
|
346
368
|
});
|
|
347
369
|
if (!changed)
|
|
348
370
|
throw commentNotFound(artifactId, commentId);
|
|
349
|
-
await announceArtifactComment(events, changed, resolved ? "resolved" : "reopened");
|
|
371
|
+
await announceArtifactComment(events, changed, threadLink(thread), resolved ? "resolved" : "reopened");
|
|
350
372
|
return changed;
|
|
351
373
|
},
|
|
352
374
|
async deleteComment(artifactId, commentId) {
|
|
353
|
-
const comment = await managed(artifactId, commentId);
|
|
375
|
+
const { comment, thread } = await managed(artifactId, commentId);
|
|
354
376
|
const deleted = await input.storage().deleteComment({ projectId, artifactId, id: commentId });
|
|
355
377
|
if (!deleted)
|
|
356
378
|
throw commentNotFound(artifactId, commentId);
|
|
357
|
-
await announceArtifactComment(events, comment, "deleted");
|
|
379
|
+
await announceArtifactComment(events, comment, threadLink(thread), "deleted");
|
|
358
380
|
}
|
|
359
381
|
};
|
|
360
382
|
}
|
|
383
|
+
function threadLink(thread) {
|
|
384
|
+
return thread.author.type === "guest" ? thread.author.grantId : undefined;
|
|
385
|
+
}
|
|
361
386
|
async function checkAnchor(storage, artifact, anchor) {
|
|
362
387
|
const revision = anchor.revision ?? artifact.revision;
|
|
363
388
|
if (!Number.isSafeInteger(revision) || revision < 1 || revision > artifact.revision) {
|
|
@@ -524,17 +549,18 @@ function sameArtifactFiles2(left, right) {
|
|
|
524
549
|
}
|
|
525
550
|
|
|
526
551
|
// src/artifacts/live/state.ts
|
|
527
|
-
function
|
|
528
|
-
return kind === "canvas";
|
|
552
|
+
function keepsDocument2(kind) {
|
|
553
|
+
return kind === "canvas" || kind === "document";
|
|
529
554
|
}
|
|
530
555
|
async function loadArtifactDocument2(blobStorage, artifact, files) {
|
|
531
556
|
const doc = new Y.Doc;
|
|
532
557
|
const stored = artifact.document;
|
|
558
|
+
const clientID = madeClientId(artifact.id, stored, files);
|
|
533
559
|
if (stored?.revision === artifact.revision) {
|
|
534
560
|
Y.applyUpdate(doc, await readDocumentState2(blobStorage, stored.file));
|
|
561
|
+
holdPage(doc, clientID);
|
|
535
562
|
return doc;
|
|
536
563
|
}
|
|
537
|
-
const clientID = madeClientId(artifact.id, stored, files);
|
|
538
564
|
const live = await readLiveFiles2(blobStorage, files);
|
|
539
565
|
let made;
|
|
540
566
|
if (stored) {
|
|
@@ -547,6 +573,7 @@ async function loadArtifactDocument2(blobStorage, artifact, files) {
|
|
|
547
573
|
}
|
|
548
574
|
Y.applyUpdate(doc, Y.encodeStateAsUpdate(made));
|
|
549
575
|
made.destroy();
|
|
576
|
+
holdPage(doc, clientID);
|
|
550
577
|
return doc;
|
|
551
578
|
}
|
|
552
579
|
async function readDocumentState2(blobStorage, document) {
|
|
@@ -562,7 +589,7 @@ async function storeArtifactDocument(blobStorage, doc) {
|
|
|
562
589
|
});
|
|
563
590
|
}
|
|
564
591
|
async function firstArtifactDocument(blobStorage, kind, files) {
|
|
565
|
-
if (!
|
|
592
|
+
if (!keepsDocument2(kind))
|
|
566
593
|
return;
|
|
567
594
|
const doc = createArtifactDocument(kind, await readLiveFiles2(blobStorage, files));
|
|
568
595
|
try {
|
|
@@ -591,7 +618,7 @@ async function mergeArtifactWrite(context, write) {
|
|
|
591
618
|
...write.baseRevision === undefined ? {} : { baseRevision: write.baseRevision },
|
|
592
619
|
merged: false
|
|
593
620
|
};
|
|
594
|
-
if (!
|
|
621
|
+
if (!keepsDocument2(write.kind))
|
|
595
622
|
return unmerged;
|
|
596
623
|
const { projectId, storage, blobStorage } = context;
|
|
597
624
|
const artifact = await storage.get({ projectId, id: write.artifactId });
|
|
@@ -637,15 +664,16 @@ async function withMergedWrite(context, write, store) {
|
|
|
637
664
|
try {
|
|
638
665
|
return await store(merged);
|
|
639
666
|
} catch (error) {
|
|
640
|
-
if (!isMoved(error) || !
|
|
667
|
+
if (!isMoved(error) || !keepsDocument2(write.kind) || attempt === MERGE_ATTEMPTS) {
|
|
641
668
|
throw error;
|
|
669
|
+
}
|
|
642
670
|
}
|
|
643
671
|
}
|
|
644
672
|
}
|
|
645
673
|
async function documentHolding(context, artifactId, files) {
|
|
646
674
|
const { projectId, storage, blobStorage } = context;
|
|
647
675
|
const artifact = await storage.get({ projectId, id: artifactId });
|
|
648
|
-
if (!artifact || !
|
|
676
|
+
if (!artifact || !keepsDocument2(artifact.kind))
|
|
649
677
|
return null;
|
|
650
678
|
const latest = await storage.getVersion({
|
|
651
679
|
projectId,
|
|
@@ -682,14 +710,21 @@ async function withDocumentHolding(context, artifactId, files, baseRevision, sto
|
|
|
682
710
|
}
|
|
683
711
|
}
|
|
684
712
|
}
|
|
685
|
-
async function undoneTurnDocuments(context, turnRunId) {
|
|
713
|
+
async function undoneTurnDocuments(context, turnRunId, laterTurnRunIds = []) {
|
|
686
714
|
const { projectId, storage } = context;
|
|
687
715
|
const documents = {};
|
|
688
|
-
|
|
689
|
-
|
|
716
|
+
const laterWrites = new Map;
|
|
717
|
+
for (const later of laterTurnRunIds) {
|
|
718
|
+
for (const write of await storage.listTurnWrites({ projectId, turnRunId: later })) {
|
|
719
|
+
laterWrites.set(write.artifactId, (laterWrites.get(write.artifactId) ?? 0) + write.writes);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
for (const own of await storage.listTurnWrites({ projectId, turnRunId })) {
|
|
723
|
+
if (own.created)
|
|
690
724
|
continue;
|
|
725
|
+
const write = { ...own, writes: own.writes + (laterWrites.get(own.artifactId) ?? 0) };
|
|
691
726
|
const artifact = await storage.get({ projectId, id: write.artifactId });
|
|
692
|
-
if (!artifact || !
|
|
727
|
+
if (!artifact || !keepsDocument2(artifact.kind))
|
|
693
728
|
continue;
|
|
694
729
|
const points = await storage.listRestorePoints({ projectId, id: artifact.id });
|
|
695
730
|
const point = points.find((each) => each.turnRunId === turnRunId);
|
|
@@ -700,7 +735,7 @@ async function undoneTurnDocuments(context, turnRunId) {
|
|
|
700
735
|
...point ? { point } : {},
|
|
701
736
|
...target ? { target: { frozen: target.frozenAt !== undefined } } : {}
|
|
702
737
|
});
|
|
703
|
-
if (!point || !undoable)
|
|
738
|
+
if (!point || !undoable || !keepsDocument2(artifact.kind))
|
|
704
739
|
continue;
|
|
705
740
|
const held = await documentHolding(context, artifact.id, point.files);
|
|
706
741
|
if (held?.baseRevision === artifact.revision)
|
|
@@ -719,6 +754,9 @@ async function filesAtRevision(storage, projectId, artifactId, revision) {
|
|
|
719
754
|
return versions.find((version) => version.revision === revision)?.files ?? null;
|
|
720
755
|
}
|
|
721
756
|
|
|
757
|
+
// src/artifacts/publish/pdf.ts
|
|
758
|
+
import { createHash as createHash3 } from "crypto";
|
|
759
|
+
|
|
722
760
|
// src/artifacts/publish/previews.ts
|
|
723
761
|
import { createHash as createHash2 } from "crypto";
|
|
724
762
|
|
|
@@ -742,6 +780,9 @@ async function answerArtifactQueries2(version, read) {
|
|
|
742
780
|
const name = artifactQueryName2(file.path);
|
|
743
781
|
return name === undefined ? [] : [name];
|
|
744
782
|
});
|
|
783
|
+
if (version.outline.kind === "document" && version.outline.holder) {
|
|
784
|
+
names.push(DOCUMENT_HOLDER_QUERY2);
|
|
785
|
+
}
|
|
745
786
|
const answers = await Promise.all(names.map(async (name) => [name, await answerArtifactQuery(() => read(name))]));
|
|
746
787
|
return Object.fromEntries(answers);
|
|
747
788
|
}
|
|
@@ -897,13 +938,13 @@ async function boardPreviewStatuses2(storage, version, input) {
|
|
|
897
938
|
return [board.id, ready ? "ready" : waiting ? "pending" : "none"];
|
|
898
939
|
}));
|
|
899
940
|
}
|
|
900
|
-
async function storeBoardPreviews2(
|
|
941
|
+
async function storeBoardPreviews2(storage, version, previews) {
|
|
901
942
|
if (previews.length === 0)
|
|
902
943
|
return [];
|
|
903
944
|
const { boards, themes } = previewedBoards(version);
|
|
904
945
|
const keys = new Map(boards.map((board) => [board.id, board.renderKey]));
|
|
905
946
|
const createdAt = new Date;
|
|
906
|
-
const checked =
|
|
947
|
+
const checked = previews.map((preview) => {
|
|
907
948
|
const { board, theme, size, file } = preview;
|
|
908
949
|
const refuse = (reason) => ({ refused: { board, theme, size, reason } });
|
|
909
950
|
const renderKey = keys.get(board);
|
|
@@ -917,13 +958,11 @@ async function storeBoardPreviews2(context, version, previews) {
|
|
|
917
958
|
if (file.sizeBytes > MAX_BOARD_PREVIEW_BYTES2) {
|
|
918
959
|
return refuse(`it is ${file.sizeBytes} bytes, past the ${MAX_BOARD_PREVIEW_BYTES2} kept`);
|
|
919
960
|
}
|
|
920
|
-
if (!await statFileRef2(context.blobStorage, file))
|
|
921
|
-
return refuse("it is not stored");
|
|
922
961
|
return { record: { renderKey, theme, size, file: { ...file }, createdAt } };
|
|
923
|
-
})
|
|
962
|
+
});
|
|
924
963
|
const records = checked.flatMap((each) => ("record" in each) ? [each.record] : []);
|
|
925
964
|
if (records.length > 0) {
|
|
926
|
-
await
|
|
965
|
+
await storage.putBoardPreviews({ projectId: version.projectId, previews: records });
|
|
927
966
|
}
|
|
928
967
|
return checked.flatMap((each) => ("refused" in each) ? [each.refused] : []);
|
|
929
968
|
}
|
|
@@ -937,21 +976,20 @@ async function requestBoardPreviews(input, version, options = {}) {
|
|
|
937
976
|
if ((await missingBoardPreviews2(input.storage, version)).length === 0)
|
|
938
977
|
return;
|
|
939
978
|
const queries = boardsReadLiveData2(version) && !options.withoutAnswers ? await storeQueryAnswers(input, version) : undefined;
|
|
940
|
-
const delayMs = options.delayMs ?? BOARD_PREVIEW_JOB2.settleMs;
|
|
941
979
|
await input.queue.enqueue({
|
|
942
980
|
projectId: version.projectId,
|
|
943
981
|
jobs: [
|
|
944
982
|
{
|
|
945
983
|
id: boardPreviewsJobId(version.artifactId),
|
|
946
984
|
replace: true,
|
|
947
|
-
type: "
|
|
985
|
+
type: "artifact.previews.requested",
|
|
948
986
|
payload: {
|
|
949
987
|
artifactId: version.artifactId,
|
|
950
988
|
version: version.version,
|
|
951
989
|
updatedAt: version.updatedAt.toISOString(),
|
|
952
990
|
...queries ? { queries } : {}
|
|
953
991
|
},
|
|
954
|
-
availableAt: new Date(Date.now() +
|
|
992
|
+
availableAt: new Date(Date.now() + BOARD_PREVIEW_JOB2.settleMs).toISOString()
|
|
955
993
|
}
|
|
956
994
|
]
|
|
957
995
|
});
|
|
@@ -975,6 +1013,484 @@ function frameKitDigest() {
|
|
|
975
1013
|
return kitDigest;
|
|
976
1014
|
}
|
|
977
1015
|
|
|
1016
|
+
// src/artifacts/publish/validate/document-html.ts
|
|
1017
|
+
import { posix as posix2 } from "path";
|
|
1018
|
+
|
|
1019
|
+
// src/artifacts/paper.ts
|
|
1020
|
+
var PX_PER_UNIT = {
|
|
1021
|
+
px: 1,
|
|
1022
|
+
in: 96,
|
|
1023
|
+
cm: 96 / 2.54,
|
|
1024
|
+
mm: 96 / 25.4,
|
|
1025
|
+
q: 96 / 101.6,
|
|
1026
|
+
pt: 96 / 72,
|
|
1027
|
+
pc: 16
|
|
1028
|
+
};
|
|
1029
|
+
var PAGE_SIZES = {
|
|
1030
|
+
a5: ["148mm", "210mm"],
|
|
1031
|
+
a4: ["210mm", "297mm"],
|
|
1032
|
+
a3: ["297mm", "420mm"],
|
|
1033
|
+
b5: ["176mm", "250mm"],
|
|
1034
|
+
b4: ["250mm", "353mm"],
|
|
1035
|
+
"jis-b5": ["182mm", "257mm"],
|
|
1036
|
+
"jis-b4": ["257mm", "364mm"],
|
|
1037
|
+
letter: ["8.5in", "11in"],
|
|
1038
|
+
legal: ["8.5in", "14in"],
|
|
1039
|
+
ledger: ["11in", "17in"]
|
|
1040
|
+
};
|
|
1041
|
+
function readDocumentPaper(stylesheets) {
|
|
1042
|
+
let size = null;
|
|
1043
|
+
const margin = [0, 0, 0, 0];
|
|
1044
|
+
for (const css of stylesheets) {
|
|
1045
|
+
for (const declarations of pageRules(css)) {
|
|
1046
|
+
for (const [property, value] of declarations) {
|
|
1047
|
+
if (property === "size") {
|
|
1048
|
+
size = readSize(value) ?? size;
|
|
1049
|
+
} else if (property === "margin") {
|
|
1050
|
+
const sides = readLengths(value);
|
|
1051
|
+
if (sides && sides.length <= 4) {
|
|
1052
|
+
const [top, right = top, bottom = top, left = right] = sides;
|
|
1053
|
+
margin.splice(0, 4, top, right, bottom, left);
|
|
1054
|
+
}
|
|
1055
|
+
} else {
|
|
1056
|
+
const side = ["margin-top", "margin-right", "margin-bottom", "margin-left"].indexOf(property);
|
|
1057
|
+
const length = side === -1 ? null : readLength(value);
|
|
1058
|
+
if (length !== null)
|
|
1059
|
+
margin[side] = length;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
if (!size)
|
|
1065
|
+
return null;
|
|
1066
|
+
const round = (value) => Math.round(value * 100) / 100;
|
|
1067
|
+
return {
|
|
1068
|
+
width: round(size[0]),
|
|
1069
|
+
height: round(size[1]),
|
|
1070
|
+
margin: {
|
|
1071
|
+
top: round(margin[0]),
|
|
1072
|
+
right: round(margin[1]),
|
|
1073
|
+
bottom: round(margin[2]),
|
|
1074
|
+
left: round(margin[3])
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
function pageRules(css) {
|
|
1079
|
+
const text = css.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
1080
|
+
const rules = [];
|
|
1081
|
+
const opening = /@page\b([^{;]*)\{/gi;
|
|
1082
|
+
for (let match = opening.exec(text);match; match = opening.exec(text)) {
|
|
1083
|
+
const body = blockAt(text, opening.lastIndex);
|
|
1084
|
+
opening.lastIndex += body.length;
|
|
1085
|
+
if (match[1]?.trim())
|
|
1086
|
+
continue;
|
|
1087
|
+
let flat = "";
|
|
1088
|
+
let depth = 0;
|
|
1089
|
+
for (const char of body) {
|
|
1090
|
+
if (char === "{")
|
|
1091
|
+
depth += 1;
|
|
1092
|
+
else if (char === "}")
|
|
1093
|
+
depth -= 1;
|
|
1094
|
+
else if (depth === 0)
|
|
1095
|
+
flat += char;
|
|
1096
|
+
}
|
|
1097
|
+
rules.push(flat.split(";").flatMap((declaration) => {
|
|
1098
|
+
const colon = declaration.indexOf(":");
|
|
1099
|
+
if (colon === -1)
|
|
1100
|
+
return [];
|
|
1101
|
+
const property = declaration.slice(0, colon).trim().toLowerCase();
|
|
1102
|
+
const value = declaration.slice(colon + 1).replace(/!important\s*$/i, "").trim().toLowerCase();
|
|
1103
|
+
return property && value ? [[property, value]] : [];
|
|
1104
|
+
}));
|
|
1105
|
+
}
|
|
1106
|
+
return rules;
|
|
1107
|
+
}
|
|
1108
|
+
function blockAt(text, start) {
|
|
1109
|
+
let depth = 1;
|
|
1110
|
+
for (let index = start;index < text.length; index++) {
|
|
1111
|
+
if (text[index] === "{")
|
|
1112
|
+
depth += 1;
|
|
1113
|
+
else if (text[index] === "}")
|
|
1114
|
+
depth -= 1;
|
|
1115
|
+
if (depth === 0)
|
|
1116
|
+
return text.slice(start, index);
|
|
1117
|
+
}
|
|
1118
|
+
return text.slice(start);
|
|
1119
|
+
}
|
|
1120
|
+
function readSize(value) {
|
|
1121
|
+
const words = value.split(/\s+/);
|
|
1122
|
+
const orientation = words.find((word) => word === "portrait" || word === "landscape");
|
|
1123
|
+
const rest = words.filter((word) => word !== orientation);
|
|
1124
|
+
let size = null;
|
|
1125
|
+
if (rest.length === 1 && rest[0] && PAGE_SIZES[rest[0]]) {
|
|
1126
|
+
const [width, height] = PAGE_SIZES[rest[0]];
|
|
1127
|
+
size = [readLength(width), readLength(height)];
|
|
1128
|
+
} else if (rest.length === 0 && orientation) {
|
|
1129
|
+
size = [readLength("8.5in"), readLength("11in")];
|
|
1130
|
+
} else {
|
|
1131
|
+
const lengths = readLengths(rest.join(" "));
|
|
1132
|
+
if (lengths?.length === 1 && lengths[0])
|
|
1133
|
+
size = [lengths[0], lengths[0]];
|
|
1134
|
+
else if (lengths?.length === 2 && lengths[0] && lengths[1])
|
|
1135
|
+
size = [lengths[0], lengths[1]];
|
|
1136
|
+
}
|
|
1137
|
+
if (!size || size[0] <= 0 || size[1] <= 0)
|
|
1138
|
+
return null;
|
|
1139
|
+
const [short, long] = size[0] <= size[1] ? size : [size[1], size[0]];
|
|
1140
|
+
if (orientation === "landscape")
|
|
1141
|
+
return [long, short];
|
|
1142
|
+
if (orientation === "portrait")
|
|
1143
|
+
return [short, long];
|
|
1144
|
+
return size;
|
|
1145
|
+
}
|
|
1146
|
+
function readLengths(value) {
|
|
1147
|
+
const lengths = value.split(/\s+/).map(readLength);
|
|
1148
|
+
return lengths.length > 0 && lengths.every((length) => length !== null) ? lengths : null;
|
|
1149
|
+
}
|
|
1150
|
+
function readLength(value) {
|
|
1151
|
+
if (value === "0")
|
|
1152
|
+
return 0;
|
|
1153
|
+
const match = /^(-?\d*\.?\d+)([a-z]+)$/.exec(value);
|
|
1154
|
+
const perUnit = match?.[2] ? PX_PER_UNIT[match[2]] : undefined;
|
|
1155
|
+
if (!match || perUnit === undefined)
|
|
1156
|
+
return null;
|
|
1157
|
+
const length = Number(match[1]) * perUnit;
|
|
1158
|
+
return Number.isFinite(length) && length >= 0 ? length : null;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// src/artifacts/publish/validate/document-html.ts
|
|
1162
|
+
var DOCUMENT_HTML_ENTRY = "document.html";
|
|
1163
|
+
var REFUSED_ELEMENTS = [
|
|
1164
|
+
"script",
|
|
1165
|
+
"iframe",
|
|
1166
|
+
"frame",
|
|
1167
|
+
"frameset",
|
|
1168
|
+
"object",
|
|
1169
|
+
"embed",
|
|
1170
|
+
"applet",
|
|
1171
|
+
"form",
|
|
1172
|
+
"base",
|
|
1173
|
+
"portal",
|
|
1174
|
+
"meta[http-equiv]"
|
|
1175
|
+
];
|
|
1176
|
+
var RAW_TEXT_ELEMENTS = ["style", "title", "textarea", "xmp", "noembed", "noframes", "noscript"];
|
|
1177
|
+
var ADDRESS_ATTRIBUTES = ["href", "src", "xlink:href", "poster", "action", "formaction"];
|
|
1178
|
+
async function validateHtmlDocument(blobStorage, files) {
|
|
1179
|
+
const entry = files.find((file) => file.path === DOCUMENT_HTML_ENTRY);
|
|
1180
|
+
if (!entry)
|
|
1181
|
+
throw invalidArtifact(`A designed document needs '${DOCUMENT_HTML_ENTRY}'.`);
|
|
1182
|
+
refuseFrameAssetPaths(files, "the document");
|
|
1183
|
+
const html = await readArtifactText(blobStorage, entry, ARTIFACT_LIMITS2.maxDocumentBytes);
|
|
1184
|
+
const paths = new Set(files.map((file) => file.path));
|
|
1185
|
+
let refused;
|
|
1186
|
+
const refuse = (message) => {
|
|
1187
|
+
refused ??= message;
|
|
1188
|
+
};
|
|
1189
|
+
const headings = [];
|
|
1190
|
+
const slug = createHeadingSlugger2();
|
|
1191
|
+
const slugs = [];
|
|
1192
|
+
let heading = null;
|
|
1193
|
+
const styles = [];
|
|
1194
|
+
let style = null;
|
|
1195
|
+
let objectTypeId;
|
|
1196
|
+
const rewriter = new HTMLRewriter().on(REFUSED_ELEMENTS.join(", "), {
|
|
1197
|
+
element(element) {
|
|
1198
|
+
refuse(`${DOCUMENT_HTML_ENTRY} holds <${element.tagName}>. A designed document is laid out and printed, never run: it may not hold scripts, frames, forms, or <base>.`);
|
|
1199
|
+
}
|
|
1200
|
+
}).on("*", {
|
|
1201
|
+
element(element) {
|
|
1202
|
+
for (const [name, value] of element.attributes) {
|
|
1203
|
+
const attribute = name.toLowerCase();
|
|
1204
|
+
if (attribute.startsWith("on")) {
|
|
1205
|
+
refuse(`${DOCUMENT_HTML_ENTRY} gives <${element.tagName}> the handler '${name}'. A designed document runs no script.`);
|
|
1206
|
+
} else if (ADDRESS_ATTRIBUTES.includes(attribute) && /^\s*javascript:/i.test(decodeHtmlEntities(value).replace(/[\s\u0000-\u001f]/g, ""))) {
|
|
1207
|
+
refuse(`${DOCUMENT_HTML_ENTRY} links <${element.tagName}> to a javascript: address. A designed document runs no script.`);
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
}).on(RAW_TEXT_ELEMENTS.map((tag) => `${tag}[data-sixb-field], ${tag}[data-sixb-each]`).join(", "), {
|
|
1212
|
+
element(element) {
|
|
1213
|
+
refuse(`${DOCUMENT_HTML_ENTRY} shows live data in <${element.tagName}>, whose text is not markup. Put the field in an element that shows text, such as <span>.`);
|
|
1214
|
+
}
|
|
1215
|
+
}).on("h1, h2, h3, h4, h5, h6", {
|
|
1216
|
+
element(element) {
|
|
1217
|
+
const current = { depth: Number(element.tagName.slice(1)), text: "" };
|
|
1218
|
+
heading = current;
|
|
1219
|
+
headings.push(current);
|
|
1220
|
+
element.onEndTag(() => {
|
|
1221
|
+
slugs.push(slug(plainText(current.text)));
|
|
1222
|
+
heading = null;
|
|
1223
|
+
});
|
|
1224
|
+
},
|
|
1225
|
+
text(chunk) {
|
|
1226
|
+
if (heading)
|
|
1227
|
+
heading.text += chunk.text;
|
|
1228
|
+
}
|
|
1229
|
+
}).on("img[src]", {
|
|
1230
|
+
element(element) {
|
|
1231
|
+
const source = decodeHtmlEntities(element.getAttribute("src") ?? "").trim();
|
|
1232
|
+
if (isArtifactAddress2(source))
|
|
1233
|
+
return;
|
|
1234
|
+
const problem = localFileProblem(source, paths);
|
|
1235
|
+
if (problem) {
|
|
1236
|
+
refuse(`${DOCUMENT_HTML_ENTRY} shows the image '${source}', ${problem}. Images are files in the artifact, by their relative path, or another artifact's address, such as artifact:art_k3m9q2x7tp/logo.png.`);
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
}).on("link[href]", {
|
|
1240
|
+
element(element) {
|
|
1241
|
+
const rel = (element.getAttribute("rel") ?? "").toLowerCase().split(/\s+/);
|
|
1242
|
+
if (!rel.includes("stylesheet"))
|
|
1243
|
+
return;
|
|
1244
|
+
const href = decodeHtmlEntities(element.getAttribute("href") ?? "").trim();
|
|
1245
|
+
if (FRAME_CDN_ALLOWLIST2.some((origin) => href.startsWith(`${origin}/`)))
|
|
1246
|
+
return;
|
|
1247
|
+
const problem = localFileProblem(href, paths);
|
|
1248
|
+
if (problem) {
|
|
1249
|
+
refuse(`${DOCUMENT_HTML_ENTRY} loads the stylesheet '${href}', ${problem}. A stylesheet is a file in the artifact, by its relative path, or on ${FRAME_CDN_ALLOWLIST2.join(", ")}.`);
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
styles.push({ path: posix2.normalize(safeDecodeUri(href.split(/[?#]/)[0] ?? "")) });
|
|
1253
|
+
}
|
|
1254
|
+
}).on('meta[name="sixb:object-type"]', {
|
|
1255
|
+
element(element) {
|
|
1256
|
+
const content = decodeHtmlEntities(element.getAttribute("content") ?? "").trim();
|
|
1257
|
+
if (content)
|
|
1258
|
+
objectTypeId ??= content;
|
|
1259
|
+
}
|
|
1260
|
+
}).on("style", {
|
|
1261
|
+
element(element) {
|
|
1262
|
+
const current = { css: "" };
|
|
1263
|
+
style = current;
|
|
1264
|
+
styles.push(current);
|
|
1265
|
+
element.onEndTag(() => {
|
|
1266
|
+
style = null;
|
|
1267
|
+
});
|
|
1268
|
+
},
|
|
1269
|
+
text(chunk) {
|
|
1270
|
+
if (style)
|
|
1271
|
+
style.css += chunk.text;
|
|
1272
|
+
}
|
|
1273
|
+
});
|
|
1274
|
+
const { references, refusal } = readHtmlReferences(rewriter, () => slugs.at(-1) ?? "", DOCUMENT_HTML_ENTRY);
|
|
1275
|
+
rewriter.transform(html);
|
|
1276
|
+
const problem = refused ?? refusal();
|
|
1277
|
+
if (problem)
|
|
1278
|
+
throw invalidArtifact(problem);
|
|
1279
|
+
const stylesheets = [];
|
|
1280
|
+
for (const each of styles) {
|
|
1281
|
+
if ("css" in each) {
|
|
1282
|
+
stylesheets.push(each.css);
|
|
1283
|
+
continue;
|
|
1284
|
+
}
|
|
1285
|
+
const file = files.find((candidate) => candidate.path === each.path);
|
|
1286
|
+
if (file) {
|
|
1287
|
+
stylesheets.push(await readArtifactText(blobStorage, file, ARTIFACT_LIMITS2.maxDocumentBytes));
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
const paper = readDocumentPaper(stylesheets);
|
|
1291
|
+
const outlined = headings.map(({ depth, text }, index) => ({
|
|
1292
|
+
depth,
|
|
1293
|
+
text: plainText(text),
|
|
1294
|
+
slug: slugs[index] ?? ""
|
|
1295
|
+
}));
|
|
1296
|
+
return {
|
|
1297
|
+
entry: DOCUMENT_HTML_ENTRY,
|
|
1298
|
+
outline: {
|
|
1299
|
+
kind: "document",
|
|
1300
|
+
format: "html",
|
|
1301
|
+
headings: outlined,
|
|
1302
|
+
...paper ? { paper } : {},
|
|
1303
|
+
...objectTypeId ? { holder: { objectTypeId, links: [] } } : {}
|
|
1304
|
+
},
|
|
1305
|
+
references,
|
|
1306
|
+
marks: documentMarks(html)
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1309
|
+
function plainText(text) {
|
|
1310
|
+
return decodeHtmlEntities(text).replace(/\s+/g, " ").trim();
|
|
1311
|
+
}
|
|
1312
|
+
function localFileProblem(source, paths) {
|
|
1313
|
+
if (source === "" || source.startsWith("//") || /^[a-z][a-z\d+.-]*:/i.test(source)) {
|
|
1314
|
+
return "which is not a file in the artifact";
|
|
1315
|
+
}
|
|
1316
|
+
const path = posix2.normalize(safeDecodeUri(source.split(/[?#]/)[0] ?? ""));
|
|
1317
|
+
return paths.has(path) ? null : "which is not one of the artifact's files";
|
|
1318
|
+
}
|
|
1319
|
+
function safeDecodeUri(value) {
|
|
1320
|
+
try {
|
|
1321
|
+
return decodeURI(value);
|
|
1322
|
+
} catch {
|
|
1323
|
+
return value;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
// src/artifacts/publish/pdf.ts
|
|
1328
|
+
var MAX_DOCUMENT_PDF_BYTES2 = 64 * 1024 * 1024;
|
|
1329
|
+
var RENDER_KEY_FORMAT2 = "sixb-document-pdf/1";
|
|
1330
|
+
function documentPdfKey2(version, document) {
|
|
1331
|
+
if (version.outline.kind !== "document" || version.outline.format !== "html")
|
|
1332
|
+
return null;
|
|
1333
|
+
const files = version.files.map((entry) => [
|
|
1334
|
+
entry.path,
|
|
1335
|
+
document && entry.path === DOCUMENT_HTML_ENTRY ? document.digest : entry.file.digest
|
|
1336
|
+
]).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0);
|
|
1337
|
+
return createHash3("sha256").update(JSON.stringify([RENDER_KEY_FORMAT2, frameKitDigest(), version.artifactId, files])).digest("hex");
|
|
1338
|
+
}
|
|
1339
|
+
async function requestDocumentPdf(context, version, options = {}) {
|
|
1340
|
+
const renderKey = documentPdfKey2(version, options.document);
|
|
1341
|
+
if (!renderKey)
|
|
1342
|
+
return;
|
|
1343
|
+
if (options.retry) {
|
|
1344
|
+
await context.storage.clearPdfFailure({ projectId: version.projectId, renderKey });
|
|
1345
|
+
}
|
|
1346
|
+
await context.queue.enqueue({
|
|
1347
|
+
projectId: version.projectId,
|
|
1348
|
+
jobs: [
|
|
1349
|
+
{
|
|
1350
|
+
id: `art_pdf_${renderKey}`,
|
|
1351
|
+
...options.retry ? { replace: true } : {},
|
|
1352
|
+
type: "artifact.pdf.requested",
|
|
1353
|
+
payload: {
|
|
1354
|
+
artifactId: version.artifactId,
|
|
1355
|
+
version: version.version,
|
|
1356
|
+
renderKey,
|
|
1357
|
+
...options.document ? { document: options.document } : {}
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
]
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
// src/artifacts/publish/fields.ts
|
|
1365
|
+
async function checkDocumentFields(input) {
|
|
1366
|
+
const data = documentData();
|
|
1367
|
+
const warnings = [];
|
|
1368
|
+
const unknown = (mark, why) => warnings.push({
|
|
1369
|
+
code: "field_unknown",
|
|
1370
|
+
message: `data-sixb-${mark.kind}="${mark.path}" ${why}. It keeps the text written in it.`
|
|
1371
|
+
});
|
|
1372
|
+
const baseOf = (path, within) => {
|
|
1373
|
+
if (path.query !== undefined) {
|
|
1374
|
+
const query = input.queries.get(path.query);
|
|
1375
|
+
return query ? { kind: "rows", query } : { kind: "unknown" };
|
|
1376
|
+
}
|
|
1377
|
+
const each = within.at(-1);
|
|
1378
|
+
if (each === undefined)
|
|
1379
|
+
return { kind: "holder" };
|
|
1380
|
+
const parsed = data.parse(each);
|
|
1381
|
+
if (!parsed)
|
|
1382
|
+
return { kind: "unknown" };
|
|
1383
|
+
if (parsed.query !== undefined && parsed.steps.length === 0)
|
|
1384
|
+
return baseOf(parsed, []);
|
|
1385
|
+
const [step, ...rest] = parsed.steps;
|
|
1386
|
+
const repeatsHolder = baseOf(parsed, within.slice(0, -1)).kind === "holder";
|
|
1387
|
+
return step && rest.length === 0 && step.id === undefined && repeatsHolder ? { kind: "item", key: step.key } : { kind: "unknown" };
|
|
1388
|
+
};
|
|
1389
|
+
const reads = input.marks.flatMap((mark) => {
|
|
1390
|
+
const path = data.parse(mark.path);
|
|
1391
|
+
if (!path) {
|
|
1392
|
+
unknown(mark, "is not a path: name properties with dots, and a list's item by its id in [ ]");
|
|
1393
|
+
return [];
|
|
1394
|
+
}
|
|
1395
|
+
return [{ mark, path, base: baseOf(path, mark.within) }];
|
|
1396
|
+
});
|
|
1397
|
+
let holder;
|
|
1398
|
+
let holderProperties = {};
|
|
1399
|
+
const linkProperties = new Map;
|
|
1400
|
+
const readsHolder = reads.some((read) => read.base.kind === "holder");
|
|
1401
|
+
if (readsHolder && !input.holder) {
|
|
1402
|
+
warnings.push({
|
|
1403
|
+
code: "field_unknown",
|
|
1404
|
+
message: `The document's fields read the object that holds it, but it names no type of object: add <meta name="sixb:object-type" content="..."> to its <head>. They keep the text written in them.`
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
if (input.holder) {
|
|
1408
|
+
if (!input.checker) {
|
|
1409
|
+
throw invalidArtifact("The document shows live data of the object that holds it, and this publish has no way to check that its author reads it.");
|
|
1410
|
+
}
|
|
1411
|
+
const objectTypeId = input.holder;
|
|
1412
|
+
const start = { kind: "start", objectTypeId };
|
|
1413
|
+
try {
|
|
1414
|
+
holderProperties = (await input.checker({ kind: "objects", query: start })).schema.properties;
|
|
1415
|
+
} catch (error) {
|
|
1416
|
+
throw invalidArtifact(`The document names the object type '${objectTypeId}' in <meta name="sixb:object-type">, which you cannot read: ${error instanceof Error ? error.message.replace(/^\[Sixb\]\s*/, "") : String(error)}`);
|
|
1417
|
+
}
|
|
1418
|
+
const candidates = new Set;
|
|
1419
|
+
for (const { base, path } of reads) {
|
|
1420
|
+
const first = path.steps[0]?.key;
|
|
1421
|
+
if (base.kind === "holder" && first && !Object.hasOwn(holderProperties, first)) {
|
|
1422
|
+
candidates.add(first);
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
for (const linkId of candidates) {
|
|
1426
|
+
try {
|
|
1427
|
+
const checked = await input.checker({
|
|
1428
|
+
kind: "objects",
|
|
1429
|
+
query: { kind: "expand", input: start, expansions: [{ linkId, direction: "outgoing" }] }
|
|
1430
|
+
});
|
|
1431
|
+
linkProperties.set(linkId, checked.schema.links[linkId]?.properties ?? {});
|
|
1432
|
+
} catch {}
|
|
1433
|
+
}
|
|
1434
|
+
holder = { objectTypeId, links: [...linkProperties.keys()] };
|
|
1435
|
+
}
|
|
1436
|
+
for (const { mark, path, base } of reads) {
|
|
1437
|
+
const [first, second] = path.steps;
|
|
1438
|
+
switch (base.kind) {
|
|
1439
|
+
case "unknown":
|
|
1440
|
+
if (path.query !== undefined)
|
|
1441
|
+
unknown(mark, `names no query: add queries/${path.query}.json`);
|
|
1442
|
+
break;
|
|
1443
|
+
case "rows": {
|
|
1444
|
+
const facets = base.query.kind === "facets";
|
|
1445
|
+
if (path.query !== undefined) {
|
|
1446
|
+
if (mark.kind === "field" && first?.key === "total" && path.steps.length === 1)
|
|
1447
|
+
break;
|
|
1448
|
+
if (first?.key === "facets" && path.steps.length === 2 && facets)
|
|
1449
|
+
break;
|
|
1450
|
+
if (mark.kind === "each" && path.steps.length === 0 && !facets)
|
|
1451
|
+
break;
|
|
1452
|
+
unknown(mark, facets ? `reads facets: repeat over query:${path.query}.facets.<property>, or show query:${path.query}.total` : `reads rows: repeat over query:${path.query}, or show query:${path.query}.total`);
|
|
1453
|
+
break;
|
|
1454
|
+
}
|
|
1455
|
+
if (!first)
|
|
1456
|
+
break;
|
|
1457
|
+
const links = base.query.schema.links;
|
|
1458
|
+
if (Object.hasOwn(base.query.schema.properties, first.key))
|
|
1459
|
+
break;
|
|
1460
|
+
if (Object.hasOwn(links, first.key)) {
|
|
1461
|
+
if (second && !Object.hasOwn(links[first.key]?.properties ?? {}, second.key)) {
|
|
1462
|
+
unknown(mark, `reads '${second.key}', which what '${first.key}' reaches does not hold`);
|
|
1463
|
+
}
|
|
1464
|
+
break;
|
|
1465
|
+
}
|
|
1466
|
+
unknown(mark, `reads '${first.key}', which the rows of its query do not hold`);
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
case "item": {
|
|
1470
|
+
const reached = linkProperties.get(base.key);
|
|
1471
|
+
if (reached && first && !Object.hasOwn(reached, first.key)) {
|
|
1472
|
+
unknown(mark, `reads '${first.key}', which what '${base.key}' reaches does not hold`);
|
|
1473
|
+
}
|
|
1474
|
+
break;
|
|
1475
|
+
}
|
|
1476
|
+
case "holder": {
|
|
1477
|
+
if (!input.holder || !first)
|
|
1478
|
+
break;
|
|
1479
|
+
if (Object.hasOwn(holderProperties, first.key))
|
|
1480
|
+
break;
|
|
1481
|
+
const reached = linkProperties.get(first.key);
|
|
1482
|
+
if (!reached) {
|
|
1483
|
+
unknown(mark, `reads '${first.key}', which a ${input.holder} does not hold`);
|
|
1484
|
+
} else if (second && !Object.hasOwn(reached, second.key)) {
|
|
1485
|
+
unknown(mark, `reads '${second.key}', which what '${first.key}' reaches does not hold`);
|
|
1486
|
+
}
|
|
1487
|
+
break;
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
return { ...holder ? { holder } : {}, warnings };
|
|
1492
|
+
}
|
|
1493
|
+
|
|
978
1494
|
// src/artifacts/run-query.ts
|
|
979
1495
|
var PAGE_SIZE = 1000;
|
|
980
1496
|
async function runArtifactQuery(runtime, name, query) {
|
|
@@ -993,7 +1509,10 @@ async function runArtifactQuery(runtime, name, query) {
|
|
|
993
1509
|
}
|
|
994
1510
|
}
|
|
995
1511
|
function describeArtifactQuery(runtime, query) {
|
|
996
|
-
const validated = validateObjectQuery2(query.query, {
|
|
1512
|
+
const validated = validateObjectQuery2(query.query, {
|
|
1513
|
+
ontology: runtime.ontology,
|
|
1514
|
+
discovery: getQueryDiscovery(runtime.objectReader)
|
|
1515
|
+
});
|
|
997
1516
|
return {
|
|
998
1517
|
resultObjectTypeIds: [...validated.result.objectTypeIds],
|
|
999
1518
|
readObjectTypeIds: [...validated.touchedObjectTypeIds],
|
|
@@ -1207,7 +1726,7 @@ function outermostProject(query, at = "$") {
|
|
|
1207
1726
|
return;
|
|
1208
1727
|
}
|
|
1209
1728
|
}
|
|
1210
|
-
async function checkArtifactQueries(blobStorage, kind, files, checker) {
|
|
1729
|
+
async function checkArtifactQueries(blobStorage, kind, files, checker, options = {}) {
|
|
1211
1730
|
const checked = new Map;
|
|
1212
1731
|
if (kind === "file")
|
|
1213
1732
|
return checked;
|
|
@@ -1215,8 +1734,9 @@ async function checkArtifactQueries(blobStorage, kind, files, checker) {
|
|
|
1215
1734
|
const [first] = queries;
|
|
1216
1735
|
if (!first)
|
|
1217
1736
|
return checked;
|
|
1218
|
-
|
|
1219
|
-
|
|
1737
|
+
const markdown = kind === "document" && !files.some((file) => file.path === DOCUMENT_HTML_ENTRY);
|
|
1738
|
+
if (!ARTIFACT_QUERY_KINDS.includes(kind) || markdown) {
|
|
1739
|
+
throw invalidArtifact(`'${first.path}': a ${markdown ? "Markdown document" : kind} runs no query. A Markdown document shows a live sheet instead; a designed one, document.html, runs queries.`);
|
|
1220
1740
|
}
|
|
1221
1741
|
if (queries.length > ARTIFACT_LIMITS2.maxQueries) {
|
|
1222
1742
|
throw invalidArtifact(`A version holds at most ${ARTIFACT_LIMITS2.maxQueries} queries; this one has ${queries.length}.`);
|
|
@@ -1229,8 +1749,11 @@ async function checkArtifactQueries(blobStorage, kind, files, checker) {
|
|
|
1229
1749
|
if (!name) {
|
|
1230
1750
|
throw invalidArtifact(`'${file.path}' is not a query: name it queries/<name>.json, with lowercase letters, digits and hyphens, at most 64 characters.`);
|
|
1231
1751
|
}
|
|
1752
|
+
if (kind === "document" && name === DOCUMENT_HOLDER_QUERY2) {
|
|
1753
|
+
throw invalidArtifact(`'${file.path}': "${DOCUMENT_HOLDER_QUERY2}" is what a document's fields read of the object that holds it. Name the query otherwise.`);
|
|
1754
|
+
}
|
|
1232
1755
|
const text = await readArtifactText(blobStorage, file, ARTIFACT_LIMITS2.maxQueryBytes);
|
|
1233
|
-
const parsed = parseArtifactQuery(file.path, text);
|
|
1756
|
+
const parsed = parseArtifactQuery(file.path, text, options.holder ? { holder: { kind: "start", objectTypeId: options.holder } } : {});
|
|
1234
1757
|
if ("error" in parsed)
|
|
1235
1758
|
throw invalidArtifact(parsed.error);
|
|
1236
1759
|
try {
|
|
@@ -1345,7 +1868,7 @@ function ownArtifacts(author) {
|
|
|
1345
1868
|
}
|
|
1346
1869
|
|
|
1347
1870
|
// src/artifacts/publish/validate/canvas.ts
|
|
1348
|
-
import { posix as
|
|
1871
|
+
import { posix as posix3 } from "path";
|
|
1349
1872
|
async function validateCanvas(blobStorage, files) {
|
|
1350
1873
|
const byPath = new Map(files.map((file) => [file.path, file]));
|
|
1351
1874
|
const canvasFile = byPath.get(CANVAS_FILE2);
|
|
@@ -1363,7 +1886,7 @@ async function validateCanvas(blobStorage, files) {
|
|
|
1363
1886
|
references.push({ address: item.src, as: "embed", at: item.id });
|
|
1364
1887
|
if (item.type !== "board")
|
|
1365
1888
|
continue;
|
|
1366
|
-
const file = byPath.get(
|
|
1889
|
+
const file = byPath.get(posix3.normalize(item.file));
|
|
1367
1890
|
if (!file) {
|
|
1368
1891
|
throw invalidArtifact(`${CANVAS_FILE2} board '${item.id}' shows '${item.file}', which is not one of the canvas's files.`);
|
|
1369
1892
|
}
|
|
@@ -1384,7 +1907,7 @@ async function validateCanvas(blobStorage, files) {
|
|
|
1384
1907
|
const named = { id: item.id, ...title ? { title } : {} };
|
|
1385
1908
|
if (item.type === "board") {
|
|
1386
1909
|
return [
|
|
1387
|
-
{ ...named, type: "board", file:
|
|
1910
|
+
{ ...named, type: "board", file: posix3.normalize(item.file), w: item.w, h: item.h }
|
|
1388
1911
|
];
|
|
1389
1912
|
}
|
|
1390
1913
|
return item.type === "section" ? [{ ...named, type: "section" }] : [];
|
|
@@ -1523,12 +2046,22 @@ function crosses(start, end, box) {
|
|
|
1523
2046
|
}
|
|
1524
2047
|
|
|
1525
2048
|
// src/artifacts/publish/validate/document.ts
|
|
1526
|
-
import { posix as
|
|
2049
|
+
import { posix as posix4 } from "path";
|
|
1527
2050
|
var DOCUMENT_ENTRY = "document.md";
|
|
1528
2051
|
async function validateDocument(blobStorage, files) {
|
|
1529
|
-
const
|
|
1530
|
-
|
|
1531
|
-
|
|
2052
|
+
const markdown = files.find((file) => file.path === DOCUMENT_ENTRY);
|
|
2053
|
+
const designed = files.some((file) => file.path === DOCUMENT_HTML_ENTRY);
|
|
2054
|
+
if (markdown && designed) {
|
|
2055
|
+
throw invalidArtifact(`A document renders from '${DOCUMENT_ENTRY}' or from '${DOCUMENT_HTML_ENTRY}', not both: keep one.`);
|
|
2056
|
+
}
|
|
2057
|
+
if (designed)
|
|
2058
|
+
return validateHtmlDocument(blobStorage, files);
|
|
2059
|
+
if (!markdown) {
|
|
2060
|
+
throw invalidArtifact(`A document needs its Markdown in '${DOCUMENT_ENTRY}', or its HTML in '${DOCUMENT_HTML_ENTRY}' when it has a design of its own.`);
|
|
2061
|
+
}
|
|
2062
|
+
return validateMarkdownDocument(blobStorage, markdown, files);
|
|
2063
|
+
}
|
|
2064
|
+
async function validateMarkdownDocument(blobStorage, entry, files) {
|
|
1532
2065
|
const markdown = await readArtifactText(blobStorage, entry, ARTIFACT_LIMITS2.maxDocumentBytes);
|
|
1533
2066
|
const html = Bun.markdown.html(markdown, {
|
|
1534
2067
|
tables: true,
|
|
@@ -1591,12 +2124,12 @@ function checkImage(source, paths) {
|
|
|
1591
2124
|
if (source === "" || source.startsWith("//") || /^[a-z][a-z\d+.-]*:/i.test(source)) {
|
|
1592
2125
|
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.`);
|
|
1593
2126
|
}
|
|
1594
|
-
const path =
|
|
2127
|
+
const path = posix4.normalize(safeDecodeUri2(source.split(/[?#]/)[0] ?? ""));
|
|
1595
2128
|
if (!paths.has(path)) {
|
|
1596
2129
|
throw invalidArtifact(`${DOCUMENT_ENTRY} shows the image '${source}', which is not one of the artifact's files.`);
|
|
1597
2130
|
}
|
|
1598
2131
|
}
|
|
1599
|
-
function
|
|
2132
|
+
function safeDecodeUri2(value) {
|
|
1600
2133
|
try {
|
|
1601
2134
|
return decodeURI(value);
|
|
1602
2135
|
} catch {
|
|
@@ -1661,7 +2194,7 @@ async function validatePage(blobStorage, files) {
|
|
|
1661
2194
|
}
|
|
1662
2195
|
|
|
1663
2196
|
// src/artifacts/publish/validate/sheet.ts
|
|
1664
|
-
import { posix as
|
|
2197
|
+
import { posix as posix5 } from "path";
|
|
1665
2198
|
async function validateSheet(blobStorage, files, queries) {
|
|
1666
2199
|
const byPath = new Map(files.map((file) => [file.path, file]));
|
|
1667
2200
|
const workbookFile = byPath.get(WORKBOOK_FILE2);
|
|
@@ -1821,7 +2354,7 @@ function cellProblem(value, format, byPath) {
|
|
|
1821
2354
|
case "link":
|
|
1822
2355
|
return /^https?:\/\/[^\s]+$/i.test(value.trim()) ? undefined : "is not a link: write a full https:// address, or another artifact's address.";
|
|
1823
2356
|
case "image": {
|
|
1824
|
-
const imagePath =
|
|
2357
|
+
const imagePath = posix5.normalize(value.trim());
|
|
1825
2358
|
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.";
|
|
1826
2359
|
}
|
|
1827
2360
|
case "boolean":
|
|
@@ -1914,8 +2447,22 @@ async function prepareArtifactVersion2(context, input) {
|
|
|
1914
2447
|
const title = checkTitle(input.title);
|
|
1915
2448
|
await checkArtifactFiles(context.blobStorage, input.files);
|
|
1916
2449
|
const theme = input.kind === "file" ? undefined : await readTheme(context.blobStorage, input.files);
|
|
1917
|
-
const
|
|
1918
|
-
const
|
|
2450
|
+
const document = input.kind === "document" ? await validateDocument(context.blobStorage, input.files) : null;
|
|
2451
|
+
const queries = await checkArtifactQueries(context.blobStorage, input.kind, input.files, input.checkQuery, document?.outline.holder ? { holder: document.outline.holder.objectTypeId } : {});
|
|
2452
|
+
const fields = document?.marks ? await checkDocumentFields({
|
|
2453
|
+
marks: document.marks,
|
|
2454
|
+
...document.outline.holder ? { holder: document.outline.holder.objectTypeId } : {},
|
|
2455
|
+
queries,
|
|
2456
|
+
...input.checkQuery ? { checker: input.checkQuery } : {}
|
|
2457
|
+
}) : null;
|
|
2458
|
+
const validated = document ? {
|
|
2459
|
+
...document,
|
|
2460
|
+
outline: {
|
|
2461
|
+
...document.outline,
|
|
2462
|
+
...fields?.holder ? { holder: fields.holder } : {}
|
|
2463
|
+
},
|
|
2464
|
+
warnings: fields?.warnings ?? []
|
|
2465
|
+
} : await validateKind(context.blobStorage, input.kind, input.files, queries);
|
|
1919
2466
|
const readable = input.readable ?? ownArtifacts(input.author);
|
|
1920
2467
|
const references = await resolveReferences(referenceContext(context, { readable, artifactId: input.artifactId }), validated.references ?? []);
|
|
1921
2468
|
return {
|
|
@@ -2165,13 +2712,92 @@ function createArtifactsRuntime(runtime, blobStorage, options = {}) {
|
|
|
2165
2712
|
};
|
|
2166
2713
|
const rule = () => createRuntimeArtifactAccessRule(runtime);
|
|
2167
2714
|
const checkQuery = createArtifactQueryChecker(runtime);
|
|
2715
|
+
const runQuery = async (read, name) => {
|
|
2716
|
+
const { artifact, version } = read;
|
|
2717
|
+
const holder = version.outline.kind === "document" ? version.outline.holder : undefined;
|
|
2718
|
+
if (holder && name === DOCUMENT_HOLDER_QUERY2) {
|
|
2719
|
+
const refs = { kind: "refs", refs: [await requireHolder(artifact.id, holder)] };
|
|
2720
|
+
const expansions = holder.links.map((linkId) => ({
|
|
2721
|
+
linkId,
|
|
2722
|
+
direction: "outgoing"
|
|
2723
|
+
}));
|
|
2724
|
+
return runArtifactQuery(runtime, name, {
|
|
2725
|
+
kind: "objects",
|
|
2726
|
+
query: expansions.length > 0 ? { kind: "expand", input: refs, expansions } : refs
|
|
2727
|
+
});
|
|
2728
|
+
}
|
|
2729
|
+
const file = ARTIFACT_QUERY_KINDS.includes(artifact.kind) && isArtifactQueryName(name) ? version.files.find((candidate) => candidate.path === artifactQueryPath(name)) : undefined;
|
|
2730
|
+
if (!file) {
|
|
2731
|
+
throw new ArtifactRequestError2("query_not_found", `[Sixb] Version ${version.version} of artifact '${artifact.id}' has no query '${name}'.`);
|
|
2732
|
+
}
|
|
2733
|
+
const text = await readArtifactText(blobStorage, file, ARTIFACT_LIMITS2.maxQueryBytes);
|
|
2734
|
+
const parse = (start) => parseArtifactQuery(file.path, text, start ? { holder: start } : {});
|
|
2735
|
+
let parsed = parse(holder ? { kind: "refs", refs: [] } : undefined);
|
|
2736
|
+
if (holder && "usesHolder" in parsed && parsed.usesHolder) {
|
|
2737
|
+
parsed = parse({ kind: "refs", refs: [await requireHolder(artifact.id, holder)] });
|
|
2738
|
+
}
|
|
2739
|
+
if ("error" in parsed) {
|
|
2740
|
+
throw new ArtifactRequestError2("query_invalid", `[Sixb] ${parsed.error}`);
|
|
2741
|
+
}
|
|
2742
|
+
return runArtifactQuery(runtime, name, parsed.query);
|
|
2743
|
+
};
|
|
2744
|
+
const writtenIn = async (read, options = {}) => {
|
|
2745
|
+
const { version } = read;
|
|
2746
|
+
const entry = version.files.find((file) => file.path === DOCUMENT_HTML_ENTRY);
|
|
2747
|
+
if (version.outline.kind !== "document" || !entry)
|
|
2748
|
+
return null;
|
|
2749
|
+
const html = await readArtifactText(blobStorage, entry, ARTIFACT_LIMITS2.maxDocumentBytes);
|
|
2750
|
+
const reads = documentData().reads(documentMarks(html));
|
|
2751
|
+
if (!reads.holder && reads.queries.length === 0)
|
|
2752
|
+
return null;
|
|
2753
|
+
if (version.frozenAt)
|
|
2754
|
+
return frozenDocumentHtml2(html);
|
|
2755
|
+
const answer = (name) => runQuery(read, name).then((result) => result, (error) => {
|
|
2756
|
+
if (error instanceof AuthorizationError2 || error instanceof ArtifactRequestError2) {
|
|
2757
|
+
return;
|
|
2758
|
+
}
|
|
2759
|
+
throw error;
|
|
2760
|
+
});
|
|
2761
|
+
const [holder, ...results] = await Promise.all([
|
|
2762
|
+
reads.holder ? answer(DOCUMENT_HOLDER_QUERY2) : undefined,
|
|
2763
|
+
...reads.queries.map(answer)
|
|
2764
|
+
]);
|
|
2765
|
+
const queries = {};
|
|
2766
|
+
reads.queries.forEach((name, index) => {
|
|
2767
|
+
const result = results[index];
|
|
2768
|
+
if (result)
|
|
2769
|
+
queries[name] = result;
|
|
2770
|
+
});
|
|
2771
|
+
const row = holder?.objects?.[0];
|
|
2772
|
+
return fillDocumentHtml(html, { ...row ? { holder: row } : {}, queries }, options.keep ? { keep: true } : { plain: true });
|
|
2773
|
+
};
|
|
2774
|
+
const requireHolder = async (artifactId, holder) => {
|
|
2775
|
+
const found = new Set;
|
|
2776
|
+
const holdings = readableHoldings({
|
|
2777
|
+
runtime,
|
|
2778
|
+
reader: runtime.objectReader,
|
|
2779
|
+
objects: runtime.storage.objects,
|
|
2780
|
+
artifactId
|
|
2781
|
+
});
|
|
2782
|
+
for await (const holding of holdings) {
|
|
2783
|
+
if (holding.objectTypeId === holder.objectTypeId)
|
|
2784
|
+
found.add(holding.primaryId);
|
|
2785
|
+
if (found.size > 1)
|
|
2786
|
+
break;
|
|
2787
|
+
}
|
|
2788
|
+
const [primaryId] = found;
|
|
2789
|
+
if (found.size !== 1 || primaryId === undefined) {
|
|
2790
|
+
throw new ArtifactRequestError2("holder_not_found", `[Sixb] No one ${holder.objectTypeId} you read holds artifact '${artifactId}', so its fields show what is written in them.`);
|
|
2791
|
+
}
|
|
2792
|
+
return { objectTypeId: holder.objectTypeId, primaryId };
|
|
2793
|
+
};
|
|
2168
2794
|
const requestPreviews = async (version, requestOptions) => {
|
|
2169
2795
|
const storage = runtime.storage.artifacts;
|
|
2170
|
-
if (!options.
|
|
2796
|
+
if (!options.rendersInSandboxes || !storage)
|
|
2171
2797
|
return;
|
|
2172
2798
|
await requestBoardPreviews({
|
|
2173
2799
|
storage,
|
|
2174
|
-
queue: runtime.queues.
|
|
2800
|
+
queue: runtime.queues.renders,
|
|
2175
2801
|
blobStorage,
|
|
2176
2802
|
query: (name) => artifacts.query(version.artifactId, name, { version: version.version })
|
|
2177
2803
|
}, version, requestOptions);
|
|
@@ -2278,8 +2904,8 @@ function createArtifactsRuntime(runtime, blobStorage, options = {}) {
|
|
|
2278
2904
|
};
|
|
2279
2905
|
const writeLive = async (artifactId, input) => {
|
|
2280
2906
|
const artifact = await requireUpdatable(artifactId);
|
|
2281
|
-
if (!
|
|
2282
|
-
throw invalidArtifact(`Artifact '${artifactId}' is a ${artifact.kind}
|
|
2907
|
+
if (!keepsDocument2(artifact.kind)) {
|
|
2908
|
+
throw invalidArtifact(`Artifact '${artifactId}' is a ${artifact.kind} that is not edited live: publish its files.`);
|
|
2283
2909
|
}
|
|
2284
2910
|
return write({ artifactId, kind: artifact.kind, ...input });
|
|
2285
2911
|
};
|
|
@@ -2290,7 +2916,8 @@ function createArtifactsRuntime(runtime, blobStorage, options = {}) {
|
|
|
2290
2916
|
events: runtime.events,
|
|
2291
2917
|
author: commentAuthor,
|
|
2292
2918
|
manager: requireCaller,
|
|
2293
|
-
reach
|
|
2919
|
+
reach,
|
|
2920
|
+
...authority.type === "delegated" ? { guest: { grantId: authority.delegation?.grantId } } : {}
|
|
2294
2921
|
}),
|
|
2295
2922
|
async create(input) {
|
|
2296
2923
|
const author = requireCaller();
|
|
@@ -2321,11 +2948,30 @@ function createArtifactsRuntime(runtime, blobStorage, options = {}) {
|
|
|
2321
2948
|
});
|
|
2322
2949
|
},
|
|
2323
2950
|
async freeze(artifactId, input = {}) {
|
|
2951
|
+
let baseRevision = input.baseRevision;
|
|
2952
|
+
const open = await readVersion(artifactId, "latest");
|
|
2953
|
+
const filled = open && !open.version.frozenAt ? await writtenIn(open, { keep: true }) : null;
|
|
2954
|
+
if (open && filled !== null) {
|
|
2955
|
+
await requireUpdatable(artifactId);
|
|
2956
|
+
const document = await blobStorage.put({
|
|
2957
|
+
body: new TextEncoder().encode(filled),
|
|
2958
|
+
fileName: DOCUMENT_HTML_ENTRY,
|
|
2959
|
+
mediaType: "text/html"
|
|
2960
|
+
});
|
|
2961
|
+
const written = await write({
|
|
2962
|
+
artifactId,
|
|
2963
|
+
kind: "document",
|
|
2964
|
+
files: open.version.files.map((file) => file.path === DOCUMENT_HTML_ENTRY ? { path: file.path, file: document } : file),
|
|
2965
|
+
baseRevision: baseRevision ?? open.version.revision,
|
|
2966
|
+
title: open.version.title
|
|
2967
|
+
});
|
|
2968
|
+
baseRevision = written.version.revision;
|
|
2969
|
+
}
|
|
2324
2970
|
const frozenAt = new Date;
|
|
2325
2971
|
const frozen = await change(artifactId, (storage, author) => storage.freeze({
|
|
2326
2972
|
projectId: runtime.projectId,
|
|
2327
2973
|
artifactId,
|
|
2328
|
-
...
|
|
2974
|
+
...baseRevision === undefined ? {} : { baseRevision },
|
|
2329
2975
|
frozenAt,
|
|
2330
2976
|
frozenBy: author
|
|
2331
2977
|
}));
|
|
@@ -2405,21 +3051,49 @@ function createArtifactsRuntime(runtime, blobStorage, options = {}) {
|
|
|
2405
3051
|
async getVersion(artifactId, version) {
|
|
2406
3052
|
return (await readVersion(artifactId, version))?.version ?? null;
|
|
2407
3053
|
},
|
|
2408
|
-
async
|
|
2409
|
-
const read = await readVersion(artifactId,
|
|
3054
|
+
async pdf(artifactId, pdfOptions = {}) {
|
|
3055
|
+
const read = await readVersion(artifactId, pdfOptions.version ?? "latest");
|
|
2410
3056
|
if (!read)
|
|
2411
3057
|
return null;
|
|
2412
|
-
const {
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
3058
|
+
const { version } = read;
|
|
3059
|
+
if (!documentPdfKey2(version)) {
|
|
3060
|
+
throw invalidArtifact(`Version ${version.version} of '${artifactId}' is not a designed document, which alone prints to PDF.`);
|
|
3061
|
+
}
|
|
3062
|
+
const { key } = pdfOptions;
|
|
3063
|
+
const filled = key !== undefined ? null : await writtenIn(read);
|
|
3064
|
+
const printed = filled === null ? null : new TextEncoder().encode(filled);
|
|
3065
|
+
const digest = key ?? (printed ? computeBlobDigest2(printed) : undefined);
|
|
3066
|
+
const keyed = digest ? { key: digest } : {};
|
|
3067
|
+
const renderKey = documentPdfKey2(version, digest ? { digest } : undefined);
|
|
3068
|
+
const storage = requireStorage();
|
|
3069
|
+
const kept = await storage.getPdf({ projectId: runtime.projectId, renderKey });
|
|
3070
|
+
if (kept && !("failure" in kept)) {
|
|
3071
|
+
return { status: "ready", file: kept.file, pages: kept.pages, ...keyed };
|
|
3072
|
+
}
|
|
3073
|
+
if (kept && (!pdfOptions.retry || key !== undefined)) {
|
|
3074
|
+
return { status: "failed", reason: kept.failure, ...keyed };
|
|
2416
3075
|
}
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
if (
|
|
2420
|
-
throw new ArtifactRequestError2("
|
|
3076
|
+
if (pdfOptions.print === false || key !== undefined)
|
|
3077
|
+
return { status: "printing", ...keyed };
|
|
3078
|
+
if (!options.rendersInSandboxes) {
|
|
3079
|
+
throw new ArtifactRequestError2("pdf_unavailable", "[Sixb] A document prints to PDF in a sandbox, and this project has no sandbox provider.");
|
|
2421
3080
|
}
|
|
2422
|
-
|
|
3081
|
+
const document = printed ? await blobStorage.put({
|
|
3082
|
+
body: printed,
|
|
3083
|
+
fileName: DOCUMENT_HTML_ENTRY,
|
|
3084
|
+
mediaType: "text/html"
|
|
3085
|
+
}) : undefined;
|
|
3086
|
+
await requestDocumentPdf({ storage, queue: runtime.queues.renders }, version, {
|
|
3087
|
+
...document ? { document } : {},
|
|
3088
|
+
retry: pdfOptions.retry === true
|
|
3089
|
+
});
|
|
3090
|
+
return { status: "printing", ...keyed };
|
|
3091
|
+
},
|
|
3092
|
+
async query(artifactId, name, options = {}) {
|
|
3093
|
+
const read = await readVersion(artifactId, options.version ?? "latest");
|
|
3094
|
+
if (!read)
|
|
3095
|
+
return null;
|
|
3096
|
+
return runQuery(read, name);
|
|
2423
3097
|
},
|
|
2424
3098
|
async listVersions(artifactId, input = {}) {
|
|
2425
3099
|
if (!await getReadable(artifactId))
|
|
@@ -2524,12 +3198,12 @@ async function sharedLinkGuest(runtime, delegation) {
|
|
|
2524
3198
|
if (!name) {
|
|
2525
3199
|
throw new ArtifactRequestError2("name_required", "[Sixb] A shared link's guest gives their name before they comment.");
|
|
2526
3200
|
}
|
|
2527
|
-
return { type: "guest", id: delegation.sessionId, name };
|
|
3201
|
+
return { type: "guest", id: delegation.sessionId, name, grantId: delegation.grantId };
|
|
2528
3202
|
}
|
|
2529
3203
|
function notFound3(artifactId) {
|
|
2530
3204
|
return new ArtifactRequestError2("artifact_not_found", `[Sixb] Artifact '${artifactId}' was not found.`);
|
|
2531
3205
|
}
|
|
2532
3206
|
|
|
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 };
|
|
3207
|
+
export { agentRunEndedShort, createAgentThreadAccessRule, assertConversationThread2, conversationThreadId2, agentThreadViews, announceArtifactUpdates, readLiveFiles2, storeLiveFiles2, sameArtifactFiles2, keepsDocument2, loadArtifactDocument2, readDocumentState2, firstArtifactDocument, withMergedWrite, undoneTurnDocuments, answerArtifactQueries2, parseArtifactQueryAnswers2, BOARD_PREVIEW_MEDIA_TYPES2, MAX_BOARD_PREVIEW_BYTES2, boardRenderKey, boardPreviewsOfCopy, boardsReadLiveData2, boardPreviews2, boardPreview2, missingBoardPreviews2, boardPreviewStatuses2, storeBoardPreviews2, MAX_DOCUMENT_PDF_BYTES2, documentPdfKey2, publishArtifact2, prepareArtifactVersion2, storeArtifactVersion2, artifactVersionWarnings2, artifactAccessRule2, artifactTransactionRules, artifactQueryChecker2, artifactPreviewRequester, writeLiveArtifact2, createRuntimeArtifactAccessRule, transactionArtifactAccessRules, updatableArtifactIds, createArtifactsRuntime };
|
|
2534
3208
|
|
|
2535
|
-
//# debugId=
|
|
3209
|
+
//# debugId=1B316407BA72A01964756E2164756E21
|