@sixb/core 0.2.3 → 0.2.5
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 +28 -28
- package/dist/agents/cancel.d.ts +1 -1
- package/dist/agents/cancel.d.ts.map +1 -1
- package/dist/agents/child-question.d.ts +35 -2
- package/dist/agents/child-question.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +35 -3
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +4 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +9 -7
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +59 -33
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-loop.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 +79 -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 +6 -1
- package/dist/agents/run-events.d.ts.map +1 -1
- package/dist/agents/run-session-children.d.ts +9 -0
- 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.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.js +1 -1
- package/dist/agents/streams/protocol.d.ts +16 -0
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/tool-files.d.ts +1 -1
- package/dist/agents/tool-files.d.ts.map +1 -1
- package/dist/agents/tool-input-coercion.d.ts +20 -0
- package/dist/agents/tool-input-coercion.d.ts.map +1 -0
- 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 +65 -3
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/runtime.d.ts +32 -5
- package/dist/artifacts/frames/runtime.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +4 -2
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +35 -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 +23 -19
- 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 +26 -18
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/merge.d.ts +5 -5
- 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/auth/index.js +2 -2
- package/dist/authorization/event-visibility.d.ts.map +1 -1
- package/dist/authorization/index.js +1 -1
- package/dist/blob-storage/index.js +1 -1
- package/dist/bootstrap/index.js +38 -38
- package/dist/{chunk-tqa68kj7.js → chunk-0hkdtwqk.js} +5 -5
- package/dist/{chunk-s5n9617r.js → chunk-0mvjpgvm.js} +5 -5
- package/dist/{chunk-k66rp2hr.js → chunk-1yh6jgtz.js} +1 -1
- package/dist/{chunk-26qet7wh.js → chunk-5t9gm5tt.js} +4 -4
- 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-hkaa807g.js → chunk-68hm50qh.js} +3 -3
- package/dist/{chunk-9nsjjd44.js → chunk-8tv3qd65.js} +2 -1
- package/dist/chunk-8tv3qd65.js.map +12 -0
- package/dist/{chunk-fe6r7yhg.js → chunk-92wrka15.js} +1 -1
- package/dist/{chunk-m7b9q5dk.js → chunk-aw1z0gre.js} +4 -4
- package/dist/chunk-az95tsh3.js.map +2 -2
- package/dist/{chunk-4j0sagwv.js → chunk-b4escq4c.js} +62 -14
- package/dist/{chunk-4j0sagwv.js.map → chunk-b4escq4c.js.map} +7 -7
- package/dist/chunk-bqr703h4.js +1799 -0
- package/dist/chunk-bqr703h4.js.map +13 -0
- package/dist/{chunk-eptrvnby.js → chunk-c29729me.js} +42 -3
- package/dist/chunk-c29729me.js.map +12 -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-3014rfjz.js → chunk-ewqn51gr.js} +25 -7
- package/dist/{chunk-3014rfjz.js.map → chunk-ewqn51gr.js.map} +3 -3
- package/dist/{chunk-7z5rkf0m.js → chunk-ey1p8w68.js} +175 -5
- package/dist/chunk-ey1p8w68.js.map +13 -0
- package/dist/{chunk-z0t4p2sk.js → chunk-fpf57gca.js} +350 -61
- package/dist/chunk-fpf57gca.js.map +47 -0
- package/dist/{chunk-kv0kvknv.js → chunk-fzae1jpq.js} +7 -7
- package/dist/{chunk-b9qfh2ya.js → chunk-fzbhybya.js} +29 -2
- package/dist/chunk-fzbhybya.js.map +11 -0
- package/dist/{chunk-2by73sm2.js → chunk-gjhrz66x.js} +225 -17
- package/dist/{chunk-2by73sm2.js.map → chunk-gjhrz66x.js.map} +5 -5
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-6gtxshcc.js → chunk-k29n4176.js} +6 -6
- package/dist/{chunk-48c1z8nj.js → chunk-k3jh8gsg.js} +10 -2
- package/dist/chunk-k3jh8gsg.js.map +10 -0
- package/dist/{chunk-w9s23r24.js → chunk-m3qx2pns.js} +751 -93
- package/dist/chunk-m3qx2pns.js.map +34 -0
- package/dist/{chunk-smnt672s.js → chunk-m9ketb51.js} +20 -4
- package/dist/chunk-m9ketb51.js.map +10 -0
- package/dist/chunk-mbwsgjn7.js +40 -0
- package/dist/chunk-mbwsgjn7.js.map +11 -0
- package/dist/{chunk-sysnvjce.js → chunk-naxjka9v.js} +2 -2
- package/dist/{chunk-n4zzaf6q.js → chunk-nxysqbt0.js} +4 -2
- package/dist/chunk-nxysqbt0.js.map +10 -0
- package/dist/{chunk-vzkxqf8h.js → chunk-paxabbqd.js} +49 -5
- package/dist/chunk-paxabbqd.js.map +23 -0
- package/dist/{chunk-8tqnsx3q.js → chunk-pc7kra3k.js} +5 -3
- package/dist/{chunk-8tqnsx3q.js.map → chunk-pc7kra3k.js.map} +3 -3
- package/dist/{chunk-qafng88v.js → chunk-pqvvqc65.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-8t2ynwg0.js → chunk-q8d9p0tb.js} +24 -1
- package/dist/{chunk-8t2ynwg0.js.map → chunk-q8d9p0tb.js.map} +3 -3
- package/dist/{chunk-wa05txmk.js → chunk-qavwr628.js} +49 -5
- package/dist/chunk-qavwr628.js.map +12 -0
- package/dist/{chunk-bkmnd7zq.js → chunk-rg725hry.js} +174 -30
- package/dist/{chunk-bkmnd7zq.js.map → chunk-rg725hry.js.map} +9 -8
- package/dist/{chunk-8p7bze4c.js → chunk-s1mqyqmm.js} +3 -3
- package/dist/{chunk-p351afzm.js → chunk-s5pj68fa.js} +2 -2
- package/dist/{chunk-855w9nvw.js → chunk-vehcr9eb.js} +1 -1
- package/dist/{chunk-qds484t8.js → chunk-vs2s3p8n.js} +932 -21
- package/dist/chunk-vs2s3p8n.js.map +20 -0
- package/dist/chunk-vtjzwymr.js.map +2 -2
- package/dist/{chunk-n68vz95m.js → chunk-wqe9shx2.js} +1 -1
- package/dist/{chunk-0k3r5kb3.js → chunk-xcrnrpfh.js} +1 -1
- 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-e9w4mgdh.js → chunk-z1njfqqs.js} +589 -53
- package/dist/{chunk-e9w4mgdh.js.map → chunk-z1njfqqs.js.map} +14 -11
- package/dist/{chunk-yv8hv4wq.js → chunk-z4jqb44a.js} +3 -1
- package/dist/chunk-z4jqb44a.js.map +10 -0
- package/dist/{chunk-s7xqfxs9.js → chunk-zft9bzbc.js} +2 -1
- package/dist/{chunk-s7xqfxs9.js.map → chunk-zft9bzbc.js.map} +3 -3
- package/dist/{chunk-38yvdqzd.js → chunk-zxhym8tr.js} +1 -1
- 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/events.d.ts +17 -0
- package/dist/connectors/connections/events.d.ts.map +1 -0
- 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 +4 -0
- package/dist/connectors/connections/service.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts +7 -1
- package/dist/connectors/execution.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/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 +18 -1
- 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.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/execution/agent.js +28 -28
- package/dist/execution/authorization.d.ts +5 -0
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/primitive.js +28 -28
- package/dist/execution/request.js +29 -29
- 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 +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -44
- 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 +1 -1
- 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 +13 -13
- 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/execution/index.js +12 -12
- package/dist/models/language-model.d.ts +6 -0
- package/dist/models/language-model.d.ts.map +1 -1
- package/dist/models/tools.d.ts +2 -0
- package/dist/models/tools.d.ts.map +1 -1
- package/dist/objects/index.js +28 -28
- package/dist/objects/query/index.js +12 -12
- package/dist/pipelines/index.js +18 -18
- 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 +13 -13
- 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 +2 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +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 +39 -18
- package/dist/runtime/internal.js.map +4 -3
- 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/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/shares/internal.js +12 -12
- 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 +26 -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 +12 -3
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +25 -5
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +156 -1
- package/dist/storage/agents/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 +2 -1
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +34 -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 +3 -3
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +18 -14
- 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 +8 -6
- 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/workflow-runs/provider.js +3 -3
- package/dist/syncs/index.js +19 -19
- 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/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 +5524 -4555
- package/dist/testing/index.js.map +10 -9
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-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 +16 -49
- 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/queued-run-dispatch.d.ts.map +1 -1
- package/dist/workflows/index.js +35 -35
- package/package.json +6 -1
- package/src/agents/README.md +6 -2
- package/src/agents/approval-outcome.ts +2 -2
- package/src/agents/cancel.ts +2 -2
- package/src/agents/child-question.ts +76 -8
- package/src/agents/execution.ts +168 -30
- package/src/agents/ids.ts +9 -1
- package/src/agents/index.ts +27 -6
- package/src/agents/model-loop.ts +3 -1
- package/src/agents/queued-turn.ts +46 -0
- package/src/agents/request.ts +517 -2
- package/src/agents/run-after-finish.ts +259 -2
- package/src/agents/run-artifacts.ts +3 -93
- package/src/agents/run-events.ts +26 -1
- package/src/agents/run-session-children.ts +33 -0
- package/src/agents/run-session-http.ts +10 -2
- package/src/agents/run-session-serve.ts +3 -8
- package/src/agents/run-session.ts +142 -3
- package/src/agents/run-turn.ts +8 -0
- package/src/agents/streams/index.ts +1 -0
- package/src/agents/streams/protocol.ts +41 -1
- package/src/agents/tool-files.ts +1 -1
- package/src/agents/tool-input-coercion.ts +140 -0
- package/src/agents/turn-answered.ts +31 -0
- package/src/agents/validation.ts +13 -3
- 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 +96 -3
- package/src/artifacts/frames/runtime.ts +709 -19
- package/src/artifacts/index.ts +6 -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 +14 -12
- 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/authorization/event-visibility.ts +13 -0
- package/src/connectors/connection-handles.ts +71 -0
- package/src/connectors/connections/authorizations.ts +50 -2
- package/src/connectors/connections/events.ts +57 -0
- package/src/connectors/connections/runs.ts +5 -0
- package/src/connectors/connections/service.ts +19 -1
- package/src/connectors/execution.ts +30 -2
- package/src/connectors/index.ts +3 -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 +26 -1
- package/src/events/definitions.ts +14 -0
- package/src/events/execution.ts +9 -2
- 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/execution/authorization.ts +45 -0
- package/src/execution/durable.ts +2 -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 +26 -1
- package/src/index.ts +21 -2
- 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/language-model.ts +6 -0
- package/src/models/tools.ts +2 -0
- 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 +112 -4
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/resolve-definitions.ts +4 -1
- package/src/runtime/script.ts +62 -0
- package/src/runtime/sixb.ts +3 -3
- package/src/schedules/builders.ts +4 -1
- package/src/schedules/runtime.ts +3 -0
- package/src/schedules/validation.ts +20 -2
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +229 -1
- package/src/storage/agents/index.ts +16 -0
- package/src/storage/agents/provider.ts +284 -2
- package/src/storage/agents/types.ts +168 -1
- package/src/storage/artifacts/in-memory.ts +32 -1
- package/src/storage/artifacts/index.ts +2 -0
- package/src/storage/artifacts/record.ts +25 -2
- package/src/storage/artifacts/types.ts +37 -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 +18 -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 +1 -0
- package/src/testing/agent-execution.ts +45 -2
- package/src/testing/agent-inbox-storage-contract.ts +815 -0
- package/src/testing/agent-storage-contract.ts +103 -0
- package/src/testing/artifact-storage-contract.ts +72 -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/webhooks/connections.ts +9 -50
- package/src/webhooks/index.ts +0 -2
- package/src/webhooks/types.ts +2 -13
- package/src/workers/queued-run-dispatch.ts +8 -1
- 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-7z5rkf0m.js.map +0 -13
- 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-m2jerfef.js +0 -474
- package/dist/chunk-m2jerfef.js.map +0 -11
- package/dist/chunk-n4zzaf6q.js.map +0 -10
- package/dist/chunk-qds484t8.js.map +0 -18
- package/dist/chunk-smnt672s.js.map +0 -10
- package/dist/chunk-vzkxqf8h.js.map +0 -23
- package/dist/chunk-w9s23r24.js.map +0 -30
- package/dist/chunk-wa05txmk.js.map +0 -11
- package/dist/chunk-yv8hv4wq.js.map +0 -10
- package/dist/chunk-z0t4p2sk.js.map +0 -47
- /package/dist/{chunk-tqa68kj7.js.map → chunk-0hkdtwqk.js.map} +0 -0
- /package/dist/{chunk-s5n9617r.js.map → chunk-0mvjpgvm.js.map} +0 -0
- /package/dist/{chunk-k66rp2hr.js.map → chunk-1yh6jgtz.js.map} +0 -0
- /package/dist/{chunk-26qet7wh.js.map → chunk-5t9gm5tt.js.map} +0 -0
- /package/dist/{chunk-e0hnbb1m.js.map → chunk-61zptves.js.map} +0 -0
- /package/dist/{chunk-hkaa807g.js.map → chunk-68hm50qh.js.map} +0 -0
- /package/dist/{chunk-fe6r7yhg.js.map → chunk-92wrka15.js.map} +0 -0
- /package/dist/{chunk-m7b9q5dk.js.map → chunk-aw1z0gre.js.map} +0 -0
- /package/dist/{chunk-kv0kvknv.js.map → chunk-fzae1jpq.js.map} +0 -0
- /package/dist/{chunk-6gtxshcc.js.map → chunk-k29n4176.js.map} +0 -0
- /package/dist/{chunk-sysnvjce.js.map → chunk-naxjka9v.js.map} +0 -0
- /package/dist/{chunk-qafng88v.js.map → chunk-pqvvqc65.js.map} +0 -0
- /package/dist/{chunk-8p7bze4c.js.map → chunk-s1mqyqmm.js.map} +0 -0
- /package/dist/{chunk-p351afzm.js.map → chunk-s5pj68fa.js.map} +0 -0
- /package/dist/{chunk-855w9nvw.js.map → chunk-vehcr9eb.js.map} +0 -0
- /package/dist/{chunk-n68vz95m.js.map → chunk-wqe9shx2.js.map} +0 -0
- /package/dist/{chunk-0k3r5kb3.js.map → chunk-xcrnrpfh.js.map} +0 -0
- /package/dist/{chunk-38yvdqzd.js.map → chunk-zxhym8tr.js.map} +0 -0
|
@@ -60,6 +60,11 @@ export type ArtifactLiveServerMessage =
|
|
|
60
60
|
*/
|
|
61
61
|
readonly snapshot: string
|
|
62
62
|
readonly error?: string
|
|
63
|
+
/**
|
|
64
|
+
* Publishing refused what the document holds: nothing tries it again until someone changes
|
|
65
|
+
* it.
|
|
66
|
+
*/
|
|
67
|
+
readonly refused?: true
|
|
63
68
|
}
|
|
64
69
|
/** The connection may now only watch: the person lost the right to change the artifact. */
|
|
65
70
|
| { readonly type: "access"; readonly artifactId: string; readonly access: ArtifactLiveAccess }
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export { type LiveArtifactWrite, writeLiveArtifact } from "../execution"
|
|
7
|
-
export { mergeIntoDocument } from "./document"
|
|
7
|
+
export { mergeIntoDocument, readChange } from "./document"
|
|
8
8
|
export { readLiveFiles, sameArtifactFiles, storeLiveFiles } from "./files"
|
|
9
9
|
export {
|
|
10
10
|
AGENT_PRESENCE_MS,
|
|
@@ -13,4 +13,4 @@ export {
|
|
|
13
13
|
artifactPresenceStream,
|
|
14
14
|
parseArtifactLiveRecord,
|
|
15
15
|
} from "./presence"
|
|
16
|
-
export { loadArtifactDocument, readDocumentState } from "./state"
|
|
16
|
+
export { keepsDocument, loadArtifactDocument, readDocumentState } from "./state"
|
|
@@ -2,16 +2,19 @@ import * as Y from "yjs"
|
|
|
2
2
|
import type { BlobStorage, FileRef } from "../../blob-storage/types"
|
|
3
3
|
import type { ArtifactDocument, ArtifactFile, ArtifactRecord } from "../../storage/artifacts/types"
|
|
4
4
|
import type { ArtifactKind } from "../kinds"
|
|
5
|
-
import { createArtifactDocument, documentFiles, mergeIntoDocument } from "./document"
|
|
5
|
+
import { createArtifactDocument, documentFiles, holdPage, mergeIntoDocument } from "./document"
|
|
6
6
|
import { readLiveFiles } from "./files"
|
|
7
7
|
|
|
8
8
|
// An artifact's document as storage keeps it: its whole Yjs state in one blob, replaced by every
|
|
9
9
|
// write. Everyone who loads it, a server holding it live or a write merging into it, continues
|
|
10
10
|
// the same history, so their changes merge as Yjs merges concurrent edits.
|
|
11
11
|
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Whether an artifact is edited live, and so keeps its content as a document: a canvas, and a
|
|
14
|
+
* document, Markdown or designed, which people edit in place.
|
|
15
|
+
*/
|
|
13
16
|
export function keepsDocument(kind: ArtifactKind): boolean {
|
|
14
|
-
return kind === "canvas"
|
|
17
|
+
return kind === "canvas" || kind === "document"
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
/**
|
|
@@ -33,12 +36,13 @@ export async function loadArtifactDocument(
|
|
|
33
36
|
): Promise<Y.Doc> {
|
|
34
37
|
const doc = new Y.Doc()
|
|
35
38
|
const stored = artifact.document
|
|
39
|
+
const clientID = madeClientId(artifact.id, stored, files)
|
|
36
40
|
if (stored?.revision === artifact.revision) {
|
|
37
41
|
Y.applyUpdate(doc, await readDocumentState(blobStorage, stored.file))
|
|
42
|
+
holdPage(doc, clientID)
|
|
38
43
|
return doc
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
const clientID = madeClientId(artifact.id, stored, files)
|
|
42
46
|
const live = await readLiveFiles(blobStorage, files)
|
|
43
47
|
let made: Y.Doc
|
|
44
48
|
if (stored) {
|
|
@@ -52,6 +56,7 @@ export async function loadArtifactDocument(
|
|
|
52
56
|
|
|
53
57
|
Y.applyUpdate(doc, Y.encodeStateAsUpdate(made))
|
|
54
58
|
made.destroy()
|
|
59
|
+
holdPage(doc, clientID)
|
|
55
60
|
return doc
|
|
56
61
|
}
|
|
57
62
|
|
package/src/artifacts/outline.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DocumentPaper } from "./paper"
|
|
1
2
|
import type { ArtifactThemeMode } from "./theme"
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -15,6 +16,22 @@ export type ArtifactOutline =
|
|
|
15
16
|
export interface DocumentOutline {
|
|
16
17
|
readonly kind: "document"
|
|
17
18
|
readonly headings: readonly DocumentHeading[]
|
|
19
|
+
/** `html` for a designed document, `document.html` with its own stylesheets; absent for Markdown. */
|
|
20
|
+
readonly format?: "html"
|
|
21
|
+
/** The sheet a designed document's `@page` rule sets, which gives it pages; absent without one. */
|
|
22
|
+
readonly paper?: DocumentPaper
|
|
23
|
+
/**
|
|
24
|
+
* The object a designed document shows live data of, as `<meta name="sixb:object-type">` names
|
|
25
|
+
* its type: the one object of that type that holds the document. Absent without the tag.
|
|
26
|
+
*/
|
|
27
|
+
readonly holder?: DocumentHolder
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** What a designed document reads of the object that holds it. */
|
|
31
|
+
export interface DocumentHolder {
|
|
32
|
+
readonly objectTypeId: string
|
|
33
|
+
/** The links of the holder its fields read through, which reading the holder expands. */
|
|
34
|
+
readonly links: readonly string[]
|
|
18
35
|
}
|
|
19
36
|
|
|
20
37
|
export interface DocumentHeading {
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sheet a designed document prints on, as its stylesheets' `@page` rule sets it, in CSS pixels
|
|
3
|
+
* (96 to the inch): the page's size, and its margins. The app lays the document's pages out on it,
|
|
4
|
+
* and the PDF prints on it.
|
|
5
|
+
*/
|
|
6
|
+
export interface DocumentPaper {
|
|
7
|
+
readonly width: number
|
|
8
|
+
readonly height: number
|
|
9
|
+
readonly margin: {
|
|
10
|
+
readonly top: number
|
|
11
|
+
readonly right: number
|
|
12
|
+
readonly bottom: number
|
|
13
|
+
readonly left: number
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const PX_PER_UNIT: Readonly<Record<string, number>> = {
|
|
18
|
+
px: 1,
|
|
19
|
+
in: 96,
|
|
20
|
+
cm: 96 / 2.54,
|
|
21
|
+
mm: 96 / 25.4,
|
|
22
|
+
q: 96 / 101.6,
|
|
23
|
+
pt: 96 / 72,
|
|
24
|
+
pc: 16,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The named sizes CSS gives `size`, portrait, in millimetres or inches as their standard is. */
|
|
28
|
+
const PAGE_SIZES: Readonly<Record<string, readonly [string, string]>> = {
|
|
29
|
+
a5: ["148mm", "210mm"],
|
|
30
|
+
a4: ["210mm", "297mm"],
|
|
31
|
+
a3: ["297mm", "420mm"],
|
|
32
|
+
b5: ["176mm", "250mm"],
|
|
33
|
+
b4: ["250mm", "353mm"],
|
|
34
|
+
"jis-b5": ["182mm", "257mm"],
|
|
35
|
+
"jis-b4": ["257mm", "364mm"],
|
|
36
|
+
letter: ["8.5in", "11in"],
|
|
37
|
+
legal: ["8.5in", "14in"],
|
|
38
|
+
ledger: ["11in", "17in"],
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The paper the stylesheets ask for, read in the order the document applies them: the `size` and
|
|
43
|
+
* margins of every unnamed, unqualified `@page` rule, a later one over an earlier one. Null when
|
|
44
|
+
* none sets a size, or sets one Sixb can't measure (`auto`, or a length in `em`).
|
|
45
|
+
*/
|
|
46
|
+
export function readDocumentPaper(stylesheets: readonly string[]): DocumentPaper | null {
|
|
47
|
+
let size: readonly [number, number] | null = null
|
|
48
|
+
const margin: [number, number, number, number] = [0, 0, 0, 0]
|
|
49
|
+
for (const css of stylesheets) {
|
|
50
|
+
for (const declarations of pageRules(css)) {
|
|
51
|
+
for (const [property, value] of declarations) {
|
|
52
|
+
if (property === "size") {
|
|
53
|
+
size = readSize(value) ?? size
|
|
54
|
+
} else if (property === "margin") {
|
|
55
|
+
const sides = readLengths(value)
|
|
56
|
+
if (sides && sides.length <= 4) {
|
|
57
|
+
const [top, right = top, bottom = top, left = right] = sides
|
|
58
|
+
margin.splice(0, 4, top, right, bottom, left)
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
const side = ["margin-top", "margin-right", "margin-bottom", "margin-left"].indexOf(
|
|
62
|
+
property
|
|
63
|
+
)
|
|
64
|
+
const length = side === -1 ? null : readLength(value)
|
|
65
|
+
if (length !== null) margin[side] = length
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (!size) return null
|
|
71
|
+
|
|
72
|
+
const round = (value: number) => Math.round(value * 100) / 100
|
|
73
|
+
return {
|
|
74
|
+
width: round(size[0]),
|
|
75
|
+
height: round(size[1]),
|
|
76
|
+
margin: {
|
|
77
|
+
top: round(margin[0]),
|
|
78
|
+
right: round(margin[1]),
|
|
79
|
+
bottom: round(margin[2]),
|
|
80
|
+
left: round(margin[3]),
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The declarations of each `@page { … }` rule in the CSS, in order, as `[property, value]` pairs.
|
|
87
|
+
* A named page (`@page cover`) or one for some pages only (`@page :first`) is left out: it applies
|
|
88
|
+
* to pages the document picks, not the sheet the document prints on. Margin boxes nested in a rule
|
|
89
|
+
* (`@top-center { … }`) are skipped.
|
|
90
|
+
*/
|
|
91
|
+
function pageRules(css: string): (readonly [string, string])[][] {
|
|
92
|
+
const text = css.replace(/\/\*[\s\S]*?\*\//g, "")
|
|
93
|
+
const rules: (readonly [string, string])[][] = []
|
|
94
|
+
const opening = /@page\b([^{;]*)\{/gi
|
|
95
|
+
for (let match = opening.exec(text); match; match = opening.exec(text)) {
|
|
96
|
+
const body = blockAt(text, opening.lastIndex)
|
|
97
|
+
opening.lastIndex += body.length
|
|
98
|
+
if (match[1]?.trim()) continue
|
|
99
|
+
|
|
100
|
+
// Only what sits at the rule's own level: nested blocks are margin boxes.
|
|
101
|
+
let flat = ""
|
|
102
|
+
let depth = 0
|
|
103
|
+
for (const char of body) {
|
|
104
|
+
if (char === "{") depth += 1
|
|
105
|
+
else if (char === "}") depth -= 1
|
|
106
|
+
else if (depth === 0) flat += char
|
|
107
|
+
}
|
|
108
|
+
rules.push(
|
|
109
|
+
flat.split(";").flatMap((declaration) => {
|
|
110
|
+
const colon = declaration.indexOf(":")
|
|
111
|
+
if (colon === -1) return []
|
|
112
|
+
const property = declaration.slice(0, colon).trim().toLowerCase()
|
|
113
|
+
const value = declaration
|
|
114
|
+
.slice(colon + 1)
|
|
115
|
+
.replace(/!important\s*$/i, "")
|
|
116
|
+
.trim()
|
|
117
|
+
.toLowerCase()
|
|
118
|
+
return property && value ? [[property, value] as const] : []
|
|
119
|
+
})
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
return rules
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The text of the block that opened just before `start`, up to its closing brace. */
|
|
126
|
+
function blockAt(text: string, start: number): string {
|
|
127
|
+
let depth = 1
|
|
128
|
+
for (let index = start; index < text.length; index++) {
|
|
129
|
+
if (text[index] === "{") depth += 1
|
|
130
|
+
else if (text[index] === "}") depth -= 1
|
|
131
|
+
if (depth === 0) return text.slice(start, index)
|
|
132
|
+
}
|
|
133
|
+
return text.slice(start)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function readSize(value: string): readonly [number, number] | null {
|
|
137
|
+
const words = value.split(/\s+/)
|
|
138
|
+
const orientation = words.find((word) => word === "portrait" || word === "landscape")
|
|
139
|
+
const rest = words.filter((word) => word !== orientation)
|
|
140
|
+
let size: readonly [number, number] | null = null
|
|
141
|
+
if (rest.length === 1 && rest[0] && PAGE_SIZES[rest[0]]) {
|
|
142
|
+
const [width, height] = PAGE_SIZES[rest[0]] as readonly [string, string]
|
|
143
|
+
size = [readLength(width) as number, readLength(height) as number]
|
|
144
|
+
} else if (rest.length === 0 && orientation) {
|
|
145
|
+
size = [readLength("8.5in") as number, readLength("11in") as number]
|
|
146
|
+
} else {
|
|
147
|
+
const lengths = readLengths(rest.join(" "))
|
|
148
|
+
if (lengths?.length === 1 && lengths[0]) size = [lengths[0], lengths[0]]
|
|
149
|
+
else if (lengths?.length === 2 && lengths[0] && lengths[1]) size = [lengths[0], lengths[1]]
|
|
150
|
+
}
|
|
151
|
+
if (!size || size[0] <= 0 || size[1] <= 0) return null
|
|
152
|
+
|
|
153
|
+
const [short, long] = size[0] <= size[1] ? size : [size[1], size[0]]
|
|
154
|
+
if (orientation === "landscape") return [long, short]
|
|
155
|
+
if (orientation === "portrait") return [short, long]
|
|
156
|
+
return size
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function readLengths(value: string): number[] | null {
|
|
160
|
+
const lengths = value.split(/\s+/).map(readLength)
|
|
161
|
+
return lengths.length > 0 && lengths.every((length) => length !== null)
|
|
162
|
+
? (lengths as number[])
|
|
163
|
+
: null
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function readLength(value: string): number | null {
|
|
167
|
+
if (value === "0") return 0
|
|
168
|
+
const match = /^(-?\d*\.?\d+)([a-z]+)$/.exec(value)
|
|
169
|
+
const perUnit = match?.[2] ? PX_PER_UNIT[match[2]] : undefined
|
|
170
|
+
if (!match || perUnit === undefined) return null
|
|
171
|
+
const length = Number(match[1]) * perUnit
|
|
172
|
+
return Number.isFinite(length) && length >= 0 ? length : null
|
|
173
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** How long the render worker gives one PDF, how many times it tries, and how long it waits between. */
|
|
2
|
+
export const DOCUMENT_PDF_JOB = {
|
|
3
|
+
timeoutMs: 2 * 60_000,
|
|
4
|
+
attempts: 2,
|
|
5
|
+
backoffMs: 15_000,
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
/** How long a PDF asked for is worth waiting for: every attempt, and the waits between them. */
|
|
9
|
+
export const DOCUMENT_PDF_WAIT_MS =
|
|
10
|
+
DOCUMENT_PDF_JOB.attempts * DOCUMENT_PDF_JOB.timeoutMs +
|
|
11
|
+
(DOCUMENT_PDF_JOB.attempts - 1) * DOCUMENT_PDF_JOB.backoffMs
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { type DocumentMark, type DocumentPath, documentData } from "../frames/document-data"
|
|
2
|
+
import type { DocumentHolder } from "../outline"
|
|
3
|
+
import type { ArtifactQueryProperty, CheckedArtifactQuery } from "../queries"
|
|
4
|
+
import type { ArtifactWarning } from "../warnings"
|
|
5
|
+
import { invalidArtifact } from "./files"
|
|
6
|
+
import type { ArtifactQueryChecker } from "./queries"
|
|
7
|
+
|
|
8
|
+
type Properties = Readonly<Record<string, ArtifactQueryProperty>>
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* What a path reads from: the holder, a query's rows, an item of what a holder's property or link
|
|
12
|
+
* holds, which only the holder's type tells apart, or what is not checked.
|
|
13
|
+
*/
|
|
14
|
+
type Base =
|
|
15
|
+
| { readonly kind: "holder" }
|
|
16
|
+
| { readonly kind: "rows"; readonly query: CheckedArtifactQuery }
|
|
17
|
+
| { readonly kind: "item"; readonly key: string }
|
|
18
|
+
| { readonly kind: "unknown" }
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Checks a designed document's fields and repeated elements against what they read, as its author
|
|
22
|
+
* reads it: the object that holds it, of the type it names, and its queries. A path that reads
|
|
23
|
+
* nothing they hold is a `field_unknown` warning, never a refusal, so a document that names a
|
|
24
|
+
* property its author cannot see still publishes. One that reads a list item, or a value deeper
|
|
25
|
+
* than a property, is not checked past it.
|
|
26
|
+
*
|
|
27
|
+
* Returns the holder, with the links its fields read through, which reading the holder expands.
|
|
28
|
+
* A holder its author cannot read refuses the version, as a query they could not run does.
|
|
29
|
+
*/
|
|
30
|
+
export async function checkDocumentFields(input: {
|
|
31
|
+
readonly marks: readonly DocumentMark[]
|
|
32
|
+
readonly holder?: string
|
|
33
|
+
readonly queries: ReadonlyMap<string, CheckedArtifactQuery>
|
|
34
|
+
readonly checker?: ArtifactQueryChecker
|
|
35
|
+
}): Promise<{ readonly holder?: DocumentHolder; readonly warnings: readonly ArtifactWarning[] }> {
|
|
36
|
+
const data = documentData()
|
|
37
|
+
const warnings: ArtifactWarning[] = []
|
|
38
|
+
const unknown = (mark: DocumentMark, why: string) =>
|
|
39
|
+
warnings.push({
|
|
40
|
+
code: "field_unknown",
|
|
41
|
+
message: `data-sixb-${mark.kind}="${mark.path}" ${why}. It keeps the text written in it.`,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
/** What a path reads from, given the repeated elements it is in. */
|
|
45
|
+
const baseOf = (path: DocumentPath, within: readonly string[]): Base => {
|
|
46
|
+
if (path.query !== undefined) {
|
|
47
|
+
const query = input.queries.get(path.query)
|
|
48
|
+
return query ? { kind: "rows", query } : { kind: "unknown" }
|
|
49
|
+
}
|
|
50
|
+
const each = within.at(-1)
|
|
51
|
+
if (each === undefined) return { kind: "holder" }
|
|
52
|
+
const parsed = data.parse(each)
|
|
53
|
+
if (!parsed) return { kind: "unknown" }
|
|
54
|
+
if (parsed.query !== undefined && parsed.steps.length === 0) return baseOf(parsed, [])
|
|
55
|
+
const [step, ...rest] = parsed.steps
|
|
56
|
+
const repeatsHolder = baseOf(parsed, within.slice(0, -1)).kind === "holder"
|
|
57
|
+
return step && rest.length === 0 && step.id === undefined && repeatsHolder
|
|
58
|
+
? { kind: "item", key: step.key }
|
|
59
|
+
: { kind: "unknown" }
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const reads = input.marks.flatMap((mark) => {
|
|
63
|
+
const path = data.parse(mark.path)
|
|
64
|
+
if (!path) {
|
|
65
|
+
unknown(mark, "is not a path: name properties with dots, and a list's item by its id in [ ]")
|
|
66
|
+
return []
|
|
67
|
+
}
|
|
68
|
+
return [{ mark, path, base: baseOf(path, mark.within) }]
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
// A holder's properties, and those of the objects each link its fields name reaches.
|
|
72
|
+
let holder: DocumentHolder | undefined
|
|
73
|
+
let holderProperties: Properties = {}
|
|
74
|
+
const linkProperties = new Map<string, Properties>()
|
|
75
|
+
const readsHolder = reads.some((read) => read.base.kind === "holder")
|
|
76
|
+
if (readsHolder && !input.holder) {
|
|
77
|
+
warnings.push({
|
|
78
|
+
code: "field_unknown",
|
|
79
|
+
message:
|
|
80
|
+
'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.',
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
if (input.holder) {
|
|
84
|
+
if (!input.checker) {
|
|
85
|
+
throw invalidArtifact(
|
|
86
|
+
"The document shows live data of the object that holds it, and this publish has no way to check that its author reads it."
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
const objectTypeId = input.holder
|
|
90
|
+
const start = { kind: "start", objectTypeId } as const
|
|
91
|
+
try {
|
|
92
|
+
holderProperties = (await input.checker({ kind: "objects", query: start })).schema.properties
|
|
93
|
+
} catch (error) {
|
|
94
|
+
throw invalidArtifact(
|
|
95
|
+
`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)}`
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// A first step that is no property may be a link: its objects are read with the holder.
|
|
100
|
+
const candidates = new Set<string>()
|
|
101
|
+
for (const { base, path } of reads) {
|
|
102
|
+
const first = path.steps[0]?.key
|
|
103
|
+
if (base.kind === "holder" && first && !Object.hasOwn(holderProperties, first)) {
|
|
104
|
+
candidates.add(first)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const linkId of candidates) {
|
|
108
|
+
try {
|
|
109
|
+
const checked = await input.checker({
|
|
110
|
+
kind: "objects",
|
|
111
|
+
query: { kind: "expand", input: start, expansions: [{ linkId, direction: "outgoing" }] },
|
|
112
|
+
})
|
|
113
|
+
linkProperties.set(linkId, checked.schema.links[linkId]?.properties ?? {})
|
|
114
|
+
} catch {
|
|
115
|
+
// Neither a property nor a link: its fields are warned about below.
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
holder = { objectTypeId, links: [...linkProperties.keys()] }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
for (const { mark, path, base } of reads) {
|
|
122
|
+
const [first, second] = path.steps
|
|
123
|
+
switch (base.kind) {
|
|
124
|
+
case "unknown":
|
|
125
|
+
if (path.query !== undefined)
|
|
126
|
+
unknown(mark, `names no query: add queries/${path.query}.json`)
|
|
127
|
+
break
|
|
128
|
+
case "rows": {
|
|
129
|
+
const facets = base.query.kind === "facets"
|
|
130
|
+
if (path.query !== undefined) {
|
|
131
|
+
if (mark.kind === "field" && first?.key === "total" && path.steps.length === 1) break
|
|
132
|
+
if (first?.key === "facets" && path.steps.length === 2 && facets) break
|
|
133
|
+
if (mark.kind === "each" && path.steps.length === 0 && !facets) break
|
|
134
|
+
unknown(
|
|
135
|
+
mark,
|
|
136
|
+
facets
|
|
137
|
+
? `reads facets: repeat over query:${path.query}.facets.<property>, or show query:${path.query}.total`
|
|
138
|
+
: `reads rows: repeat over query:${path.query}, or show query:${path.query}.total`
|
|
139
|
+
)
|
|
140
|
+
break
|
|
141
|
+
}
|
|
142
|
+
if (!first) break
|
|
143
|
+
const links = base.query.schema.links
|
|
144
|
+
if (Object.hasOwn(base.query.schema.properties, first.key)) break
|
|
145
|
+
if (Object.hasOwn(links, first.key)) {
|
|
146
|
+
if (second && !Object.hasOwn(links[first.key]?.properties ?? {}, second.key)) {
|
|
147
|
+
unknown(mark, `reads '${second.key}', which what '${first.key}' reaches does not hold`)
|
|
148
|
+
}
|
|
149
|
+
break
|
|
150
|
+
}
|
|
151
|
+
unknown(mark, `reads '${first.key}', which the rows of its query do not hold`)
|
|
152
|
+
break
|
|
153
|
+
}
|
|
154
|
+
case "item": {
|
|
155
|
+
// An item of a property's list is not checked; one the holder lacks is warned about once.
|
|
156
|
+
const reached = linkProperties.get(base.key)
|
|
157
|
+
if (reached && first && !Object.hasOwn(reached, first.key)) {
|
|
158
|
+
unknown(mark, `reads '${first.key}', which what '${base.key}' reaches does not hold`)
|
|
159
|
+
}
|
|
160
|
+
break
|
|
161
|
+
}
|
|
162
|
+
case "holder": {
|
|
163
|
+
if (!input.holder || !first) break
|
|
164
|
+
if (Object.hasOwn(holderProperties, first.key)) break
|
|
165
|
+
const reached = linkProperties.get(first.key)
|
|
166
|
+
if (!reached) {
|
|
167
|
+
unknown(mark, `reads '${first.key}', which a ${input.holder} does not hold`)
|
|
168
|
+
} else if (second && !Object.hasOwn(reached, second.key)) {
|
|
169
|
+
unknown(mark, `reads '${second.key}', which what '${first.key}' reaches does not hold`)
|
|
170
|
+
}
|
|
171
|
+
break
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return { ...(holder ? { holder } : {}), warnings }
|
|
177
|
+
}
|
|
@@ -7,8 +7,13 @@ export { BOARD_PREVIEW_JOB } from "../canvas-display"
|
|
|
7
7
|
export { artifactAccessRule, artifactQueryChecker } from "../execution"
|
|
8
8
|
export { isArtifactId } from "../ids"
|
|
9
9
|
export { ARTIFACT_LIMITS } from "../limits"
|
|
10
|
-
export { artifactQueryName } from "../queries"
|
|
10
|
+
export { artifactQueryName, DOCUMENT_HOLDER_QUERY } from "../queries"
|
|
11
11
|
export { artifactThemeModes } from "../theme"
|
|
12
|
+
export {
|
|
13
|
+
DOCUMENT_PDF_JOB,
|
|
14
|
+
documentPdfKey,
|
|
15
|
+
MAX_DOCUMENT_PDF_BYTES,
|
|
16
|
+
} from "./pdf"
|
|
12
17
|
export {
|
|
13
18
|
BOARD_PREVIEW_MEDIA_TYPES,
|
|
14
19
|
type BoardPreviewInput,
|
|
@@ -9,11 +9,11 @@ import { documentFiles, type LiveFiles, mergeIntoDocument } from "../live/docume
|
|
|
9
9
|
import { readLiveFiles, sameArtifactFiles, storeLiveFiles } from "../live/files"
|
|
10
10
|
import { keepsDocument, loadArtifactDocument, storeArtifactDocument } from "../live/state"
|
|
11
11
|
|
|
12
|
-
// A canvas is edited by many at once, and keeps its content as a Yjs
|
|
13
|
-
// ../live/state.ts). Every write to one is made into that document: a live editor's
|
|
14
|
-
// update it holds, any other as the changes from the files it was made from to its own.
|
|
15
|
-
// made from an earlier revision is so merged, not refused, and whatever was written
|
|
16
|
-
// stays.
|
|
12
|
+
// A canvas, or a designed document, is edited by many at once, and keeps its content as a Yjs
|
|
13
|
+
// document (see ../live/state.ts). Every write to one is made into that document: a live editor's
|
|
14
|
+
// as the Yjs update it holds, any other as the changes from the files it was made from to its own.
|
|
15
|
+
// A write made from an earlier revision is so merged, not refused, and whatever was written
|
|
16
|
+
// meanwhile stays. Anything else keeps the conflict check.
|
|
17
17
|
|
|
18
18
|
/** How many times a merged write starts over when another lands between its merge and its store. */
|
|
19
19
|
const MERGE_ATTEMPTS = 3
|
|
@@ -49,10 +49,10 @@ export interface MergedArtifactWrite {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* The write to store. One to a
|
|
53
|
-
* it, and is based on the latest revision; one that moved past its base is merged
|
|
54
|
-
* latest version holds now. A write whose base files are not known is left as it is,
|
|
55
|
-
* conflict check to refuse.
|
|
52
|
+
* The write to store. One to an artifact that keeps a document is made into that document, which
|
|
53
|
+
* is stored with it, and is based on the latest revision; one that moved past its base is merged
|
|
54
|
+
* into what the latest version holds now. A write whose base files are not known is left as it is,
|
|
55
|
+
* for the conflict check to refuse.
|
|
56
56
|
*/
|
|
57
57
|
export async function mergeArtifactWrite(
|
|
58
58
|
context: {
|
|
@@ -141,7 +141,9 @@ export async function withMergedWrite<T>(
|
|
|
141
141
|
try {
|
|
142
142
|
return await store(merged)
|
|
143
143
|
} catch (error) {
|
|
144
|
-
if (!isMoved(error) || !keepsDocument(write.kind) || attempt === MERGE_ATTEMPTS)
|
|
144
|
+
if (!isMoved(error) || !keepsDocument(write.kind) || attempt === MERGE_ATTEMPTS) {
|
|
145
|
+
throw error
|
|
146
|
+
}
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
}
|
|
@@ -210,7 +212,7 @@ export async function withDocumentHolding<T>(
|
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
/**
|
|
213
|
-
* The documents of the
|
|
215
|
+
* The documents of the artifacts a retry of a turn puts back, by id: each one the undo will put
|
|
214
216
|
* back, as the turn's restore point holds it. Made before the undo, at the revision it requires,
|
|
215
217
|
* so the undo can store them: one written meanwhile is not undone, and its document goes unused.
|
|
216
218
|
*/
|
|
@@ -238,7 +240,7 @@ export async function undoneTurnDocuments(
|
|
|
238
240
|
...(point ? { point } : {}),
|
|
239
241
|
...(target ? { target: { frozen: target.frozenAt !== undefined } } : {}),
|
|
240
242
|
})
|
|
241
|
-
if (!point || !undoable) continue
|
|
243
|
+
if (!point || !undoable || !keepsDocument(artifact.kind)) continue
|
|
242
244
|
|
|
243
245
|
const held = await documentHolding(context, artifact.id, point.files)
|
|
244
246
|
if (held?.baseRevision === artifact.revision) documents[artifact.id] = held.document
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createHash } from "node:crypto"
|
|
2
|
+
import type { FileRef } from "../../blob-storage/types"
|
|
3
|
+
import type { Queue, RenderQueueJob } from "../../queues"
|
|
4
|
+
import type { ArtifactStorage, ArtifactVersionRecord } from "../../storage/artifacts/types"
|
|
5
|
+
import { frameKitDigest } from "./previews"
|
|
6
|
+
import { DOCUMENT_HTML_ENTRY } from "./validate/document-html"
|
|
7
|
+
|
|
8
|
+
// A designed document prints to PDF in Chromium, as its stylesheets' @page rule lays it out. The
|
|
9
|
+
// PDF is derived data, kept apart from the version by what it prints, its render key, so a version
|
|
10
|
+
// restored or frozen as it was keeps its PDF. It is printed when someone asks for it, by the render
|
|
11
|
+
// worker in a blank sandbox of the project.
|
|
12
|
+
|
|
13
|
+
export { DOCUMENT_PDF_JOB } from "../pdf-job"
|
|
14
|
+
|
|
15
|
+
/** The largest PDF the worker reads back from its sandbox: past it, the document has none. */
|
|
16
|
+
export const MAX_DOCUMENT_PDF_BYTES = 64 * 1024 * 1024
|
|
17
|
+
|
|
18
|
+
const RENDER_KEY_FORMAT = "sixb-document-pdf/1"
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* What a designed document's PDF is of, as a SHA-256: every file of its version, the frame's kit
|
|
22
|
+
* and runtime it prints with, and its artifact, whose other artifacts' pictures it may show. Null
|
|
23
|
+
* for a version that is not a designed document. `document` is the `document.html` it prints
|
|
24
|
+
* instead of its own, with the values its fields read written in.
|
|
25
|
+
*/
|
|
26
|
+
export function documentPdfKey(
|
|
27
|
+
version: Pick<ArtifactVersionRecord, "artifactId" | "files" | "outline">,
|
|
28
|
+
document?: { readonly digest: string }
|
|
29
|
+
): string | null {
|
|
30
|
+
if (version.outline.kind !== "document" || version.outline.format !== "html") return null
|
|
31
|
+
|
|
32
|
+
const files = version.files
|
|
33
|
+
.map(
|
|
34
|
+
(entry) =>
|
|
35
|
+
[
|
|
36
|
+
entry.path,
|
|
37
|
+
document && entry.path === DOCUMENT_HTML_ENTRY ? document.digest : entry.file.digest,
|
|
38
|
+
] as const
|
|
39
|
+
)
|
|
40
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
|
|
41
|
+
return createHash("sha256")
|
|
42
|
+
.update(JSON.stringify([RENDER_KEY_FORMAT, frameKitDigest(), version.artifactId, files]))
|
|
43
|
+
.digest("hex")
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Asks the render worker to print a designed document's version to PDF, with `document` for its
|
|
48
|
+
* `document.html` when given. Asking again while it is asked for asks nothing more; `retry`
|
|
49
|
+
* forgets why it could not be printed before, and asks again.
|
|
50
|
+
*/
|
|
51
|
+
export async function requestDocumentPdf(
|
|
52
|
+
context: {
|
|
53
|
+
readonly storage: Pick<ArtifactStorage, "clearPdfFailure">
|
|
54
|
+
readonly queue: Pick<Queue<RenderQueueJob>, "enqueue">
|
|
55
|
+
},
|
|
56
|
+
version: ArtifactVersionRecord,
|
|
57
|
+
options: { readonly document?: FileRef; readonly retry?: boolean } = {}
|
|
58
|
+
): Promise<void> {
|
|
59
|
+
const renderKey = documentPdfKey(version, options.document)
|
|
60
|
+
if (!renderKey) return
|
|
61
|
+
|
|
62
|
+
if (options.retry) {
|
|
63
|
+
await context.storage.clearPdfFailure({ projectId: version.projectId, renderKey })
|
|
64
|
+
}
|
|
65
|
+
await context.queue.enqueue({
|
|
66
|
+
projectId: version.projectId,
|
|
67
|
+
jobs: [
|
|
68
|
+
{
|
|
69
|
+
// One job per PDF: a job still kept answers asking again, unless it is a retry.
|
|
70
|
+
id: `art_pdf_${renderKey}`,
|
|
71
|
+
...(options.retry ? { replace: true } : {}),
|
|
72
|
+
type: "artifact.pdf.requested",
|
|
73
|
+
payload: {
|
|
74
|
+
artifactId: version.artifactId,
|
|
75
|
+
version: version.version,
|
|
76
|
+
renderKey,
|
|
77
|
+
...(options.document ? { document: options.document } : {}),
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
})
|
|
82
|
+
}
|