@sixb/core 0.2.4 → 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/execution.d.ts +34 -2
- 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 +6 -4
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +51 -33
- package/dist/agents/index.js.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-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/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 +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-8bns0y68.js → chunk-0hkdtwqk.js} +5 -5
- package/dist/{chunk-p8pgnq8d.js → chunk-0mvjpgvm.js} +5 -5
- package/dist/{chunk-2bn6813a.js → chunk-1yh6jgtz.js} +1 -1
- package/dist/{chunk-msyevpp3.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-td26wjr5.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-3z1vxzcm.js → chunk-aw1z0gre.js} +4 -4
- package/dist/{chunk-evj5jxz3.js → chunk-b4escq4c.js} +62 -14
- package/dist/{chunk-evj5jxz3.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-t0s7b3d1.js → chunk-ey1p8w68.js} +173 -4
- package/dist/chunk-ey1p8w68.js.map +13 -0
- package/dist/{chunk-gxwy4c3s.js → chunk-fpf57gca.js} +316 -57
- package/dist/chunk-fpf57gca.js.map +47 -0
- package/dist/{chunk-r9rtavg9.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-w1wq7gfr.js → chunk-gjhrz66x.js} +225 -17
- package/dist/{chunk-w1wq7gfr.js.map → chunk-gjhrz66x.js.map} +5 -5
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-vepea5c3.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-yy914zfr.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-6ef4esq4.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-rsrc7vtw.js → chunk-rg725hry.js} +174 -30
- package/dist/{chunk-rsrc7vtw.js.map → chunk-rg725hry.js.map} +9 -8
- package/dist/{chunk-rsxb14an.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-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-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-rtm1jq00.js → chunk-z1njfqqs.js} +439 -48
- package/dist/{chunk-rtm1jq00.js.map → chunk-z1njfqqs.js.map} +10 -8
- 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-7kpqntgw.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/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 +155 -0
- 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/execution.ts +167 -29
- package/src/agents/ids.ts +5 -0
- package/src/agents/index.ts +18 -4
- 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-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 +8 -0
- package/src/agents/streams/index.ts +1 -0
- package/src/agents/streams/protocol.ts +41 -1
- 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 +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 +25 -0
- 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/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 +167 -0
- 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-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-n4zzaf6q.js.map +0 -10
- package/dist/chunk-smnt672s.js.map +0 -10
- package/dist/chunk-t0s7b3d1.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-8bns0y68.js.map → chunk-0hkdtwqk.js.map} +0 -0
- /package/dist/{chunk-p8pgnq8d.js.map → chunk-0mvjpgvm.js.map} +0 -0
- /package/dist/{chunk-2bn6813a.js.map → chunk-1yh6jgtz.js.map} +0 -0
- /package/dist/{chunk-msyevpp3.js.map → chunk-5t9gm5tt.js.map} +0 -0
- /package/dist/{chunk-e0hnbb1m.js.map → chunk-61zptves.js.map} +0 -0
- /package/dist/{chunk-td26wjr5.js.map → chunk-68hm50qh.js.map} +0 -0
- /package/dist/{chunk-fe6r7yhg.js.map → chunk-92wrka15.js.map} +0 -0
- /package/dist/{chunk-3z1vxzcm.js.map → chunk-aw1z0gre.js.map} +0 -0
- /package/dist/{chunk-r9rtavg9.js.map → chunk-fzae1jpq.js.map} +0 -0
- /package/dist/{chunk-vepea5c3.js.map → chunk-k29n4176.js.map} +0 -0
- /package/dist/{chunk-sysnvjce.js.map → chunk-naxjka9v.js.map} +0 -0
- /package/dist/{chunk-6ef4esq4.js.map → chunk-pqvvqc65.js.map} +0 -0
- /package/dist/{chunk-rsxb14an.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-7kpqntgw.js.map → chunk-zxhym8tr.js.map} +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createHash } from "node:crypto"
|
|
2
2
|
import type { Principal } from "../../auth"
|
|
3
|
-
import { statFileRef } from "../../blob-storage/file-content"
|
|
4
3
|
import type { BlobStorage, FileRef } from "../../blob-storage/types"
|
|
5
4
|
import { isValidFileRef } from "../../blob-storage/validation"
|
|
6
|
-
import type {
|
|
5
|
+
import type { Queue, RenderQueueJob } from "../../queues"
|
|
7
6
|
import type {
|
|
8
7
|
ArtifactBoardPreviewRecord,
|
|
9
8
|
ArtifactBoardPreviewSize,
|
|
@@ -24,9 +23,8 @@ import { answerArtifactQueries } from "./query-answers"
|
|
|
24
23
|
// a picture until it is read. The picture is derived data, kept apart from the version by what it
|
|
25
24
|
// shows, its render key, so a version that keeps a board as it was keeps its picture.
|
|
26
25
|
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
// the data its version's author can see: never more.
|
|
26
|
+
// The render worker renders what a version's boards miss, in a blank sandbox, however the version
|
|
27
|
+
// was published. A board runs with the data its version's publisher could see: never more.
|
|
30
28
|
|
|
31
29
|
/** A board's picture in one mode and size, as its renderer hands it over. */
|
|
32
30
|
export interface BoardPreviewInput {
|
|
@@ -65,12 +63,6 @@ export type BoardPreviewRequester = (
|
|
|
65
63
|
) => Promise<void>
|
|
66
64
|
|
|
67
65
|
export interface BoardPreviewRequestOptions {
|
|
68
|
-
/**
|
|
69
|
-
* How long the worker waits before it renders: by default `BOARD_PREVIEW_JOB.settleMs`, so a
|
|
70
|
-
* canvas being edited is rendered once it rests. Longer when the publisher renders the pictures
|
|
71
|
-
* itself, as the Agent's layout check does.
|
|
72
|
-
*/
|
|
73
|
-
readonly delayMs?: number
|
|
74
66
|
/**
|
|
75
67
|
* Leaves the version's queries unanswered: the worker then pictures only the boards that read
|
|
76
68
|
* none, and a board that reads one keeps its outline.
|
|
@@ -335,17 +327,13 @@ export interface RefusedBoardPreview {
|
|
|
335
327
|
}
|
|
336
328
|
|
|
337
329
|
/**
|
|
338
|
-
* Keeps pictures of a stored version's boards, each under its board's render key
|
|
339
|
-
* them
|
|
340
|
-
* picture
|
|
341
|
-
*
|
|
342
|
-
* others are kept.
|
|
330
|
+
* Keeps pictures of a stored version's boards, each under its board's render key, as the render
|
|
331
|
+
* worker stored them. Each picture stands alone: one for a board or a mode the version has no
|
|
332
|
+
* picture for, in another format than its size's, or past the size limit, is left out and
|
|
333
|
+
* returned, and the others are kept.
|
|
343
334
|
*/
|
|
344
335
|
export async function storeBoardPreviews(
|
|
345
|
-
|
|
346
|
-
readonly storage: Pick<ArtifactStorage, "putBoardPreviews">
|
|
347
|
-
readonly blobStorage: Pick<BlobStorage, "stat">
|
|
348
|
-
},
|
|
336
|
+
storage: Pick<ArtifactStorage, "putBoardPreviews">,
|
|
349
337
|
version: ArtifactVersionRecord,
|
|
350
338
|
previews: readonly BoardPreviewInput[]
|
|
351
339
|
): Promise<readonly RefusedBoardPreview[]> {
|
|
@@ -355,8 +343,12 @@ export async function storeBoardPreviews(
|
|
|
355
343
|
const keys = new Map(boards.map((board) => [board.id, board.renderKey]))
|
|
356
344
|
const createdAt = new Date()
|
|
357
345
|
|
|
358
|
-
const checked =
|
|
359
|
-
|
|
346
|
+
const checked = previews.map(
|
|
347
|
+
(
|
|
348
|
+
preview
|
|
349
|
+
):
|
|
350
|
+
| { readonly record: Omit<ArtifactBoardPreviewRecord, "projectId"> }
|
|
351
|
+
| { readonly refused: RefusedBoardPreview } => {
|
|
360
352
|
const { board, theme, size, file } = preview
|
|
361
353
|
const refuse = (reason: string) => ({ refused: { board, theme, size, reason } })
|
|
362
354
|
|
|
@@ -372,15 +364,14 @@ export async function storeBoardPreviews(
|
|
|
372
364
|
if (file.sizeBytes > MAX_BOARD_PREVIEW_BYTES) {
|
|
373
365
|
return refuse(`it is ${file.sizeBytes} bytes, past the ${MAX_BOARD_PREVIEW_BYTES} kept`)
|
|
374
366
|
}
|
|
375
|
-
if (!(await statFileRef(context.blobStorage, file))) return refuse("it is not stored")
|
|
376
367
|
|
|
377
368
|
return { record: { renderKey, theme, size, file: { ...file }, createdAt } }
|
|
378
|
-
}
|
|
369
|
+
}
|
|
379
370
|
)
|
|
380
371
|
|
|
381
372
|
const records = checked.flatMap((each) => ("record" in each ? [each.record] : []))
|
|
382
373
|
if (records.length > 0) {
|
|
383
|
-
await
|
|
374
|
+
await storage.putBoardPreviews({ projectId: version.projectId, previews: records })
|
|
384
375
|
}
|
|
385
376
|
|
|
386
377
|
return checked.flatMap((each) => ("refused" in each ? [each.refused] : []))
|
|
@@ -396,9 +387,9 @@ export function boardPreviewsJobId(artifactId: string): string {
|
|
|
396
387
|
}
|
|
397
388
|
|
|
398
389
|
/**
|
|
399
|
-
* Asks the
|
|
400
|
-
* in the artifact's one job: it takes the place of
|
|
401
|
-
* asked when nothing is missing.
|
|
390
|
+
* Asks the render worker to render what a stored version's boards still miss, once the canvas
|
|
391
|
+
* rests, `BOARD_PREVIEW_JOB.settleMs` from now, in the artifact's one job: it takes the place of
|
|
392
|
+
* any asked for an earlier revision. Nothing is asked when nothing is missing.
|
|
402
393
|
*
|
|
403
394
|
* Boards that read queries show their author's data, so the version's queries are answered now,
|
|
404
395
|
* by `query`, as whoever just published it, and the job carries the answers: kept as a blob only
|
|
@@ -411,7 +402,7 @@ export function boardPreviewsJobId(artifactId: string): string {
|
|
|
411
402
|
export async function requestBoardPreviews(
|
|
412
403
|
input: {
|
|
413
404
|
readonly storage: Pick<ArtifactStorage, "listBoardPreviews">
|
|
414
|
-
readonly queue: Pick<Queue<
|
|
405
|
+
readonly queue: Pick<Queue<RenderQueueJob>, "enqueue">
|
|
415
406
|
readonly blobStorage: Pick<BlobStorage, "put">
|
|
416
407
|
/** Runs one of the version's queries as its publisher. */
|
|
417
408
|
readonly query: (name: string) => Promise<ArtifactQueryResult | null>
|
|
@@ -429,21 +420,20 @@ export async function requestBoardPreviews(
|
|
|
429
420
|
? await storeQueryAnswers(input, version)
|
|
430
421
|
: undefined
|
|
431
422
|
|
|
432
|
-
const delayMs = options.delayMs ?? BOARD_PREVIEW_JOB.settleMs
|
|
433
423
|
await input.queue.enqueue({
|
|
434
424
|
projectId: version.projectId,
|
|
435
425
|
jobs: [
|
|
436
426
|
{
|
|
437
427
|
id: boardPreviewsJobId(version.artifactId),
|
|
438
428
|
replace: true,
|
|
439
|
-
type: "
|
|
429
|
+
type: "artifact.previews.requested",
|
|
440
430
|
payload: {
|
|
441
431
|
artifactId: version.artifactId,
|
|
442
432
|
version: version.version,
|
|
443
433
|
updatedAt: version.updatedAt.toISOString(),
|
|
444
434
|
...(queries ? { queries } : {}),
|
|
445
435
|
},
|
|
446
|
-
availableAt: new Date(Date.now() +
|
|
436
|
+
availableAt: new Date(Date.now() + BOARD_PREVIEW_JOB.settleMs).toISOString(),
|
|
447
437
|
},
|
|
448
438
|
],
|
|
449
439
|
})
|
|
@@ -476,8 +466,8 @@ async function storeQueryAnswers(
|
|
|
476
466
|
|
|
477
467
|
let kitDigest: string | undefined
|
|
478
468
|
|
|
479
|
-
/** What a
|
|
480
|
-
function frameKitDigest(): string {
|
|
469
|
+
/** What a page runs with besides its own files: a new kit renders it anew. */
|
|
470
|
+
export function frameKitDigest(): string {
|
|
481
471
|
kitDigest ??= createHash("sha256")
|
|
482
472
|
.update(JSON.stringify([FRAME_ASSETS, FRAME_DEFAULT_THEMES]))
|
|
483
473
|
.digest("hex")
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
parseArtifactTheme,
|
|
25
25
|
} from "../theme"
|
|
26
26
|
import type { ArtifactWarning } from "../warnings"
|
|
27
|
+
import { checkDocumentFields } from "./fields"
|
|
27
28
|
import {
|
|
28
29
|
type ArtifactBlobStorage,
|
|
29
30
|
checkArtifactFiles,
|
|
@@ -154,14 +155,36 @@ export async function prepareArtifactVersion(
|
|
|
154
155
|
const theme =
|
|
155
156
|
input.kind === "file" ? undefined : await readTheme(context.blobStorage, input.files)
|
|
156
157
|
|
|
157
|
-
// The queries first: a live sheet's columns are checked against what its query returns.
|
|
158
|
+
// The queries first: a live sheet's columns are checked against what its query returns. A
|
|
159
|
+
// document is read first instead: the type it names is where its queries may start, and its
|
|
160
|
+
// fields are checked against what the queries return.
|
|
161
|
+
const document =
|
|
162
|
+
input.kind === "document" ? await validateDocument(context.blobStorage, input.files) : null
|
|
158
163
|
const queries = await checkArtifactQueries(
|
|
159
164
|
context.blobStorage,
|
|
160
165
|
input.kind,
|
|
161
166
|
input.files,
|
|
162
|
-
input.checkQuery
|
|
167
|
+
input.checkQuery,
|
|
168
|
+
document?.outline.holder ? { holder: document.outline.holder.objectTypeId } : {}
|
|
163
169
|
)
|
|
164
|
-
const
|
|
170
|
+
const fields = document?.marks
|
|
171
|
+
? await checkDocumentFields({
|
|
172
|
+
marks: document.marks,
|
|
173
|
+
...(document.outline.holder ? { holder: document.outline.holder.objectTypeId } : {}),
|
|
174
|
+
queries,
|
|
175
|
+
...(input.checkQuery ? { checker: input.checkQuery } : {}),
|
|
176
|
+
})
|
|
177
|
+
: null
|
|
178
|
+
const validated = document
|
|
179
|
+
? {
|
|
180
|
+
...document,
|
|
181
|
+
outline: {
|
|
182
|
+
...document.outline,
|
|
183
|
+
...(fields?.holder ? { holder: fields.holder } : {}),
|
|
184
|
+
},
|
|
185
|
+
warnings: fields?.warnings ?? [],
|
|
186
|
+
}
|
|
187
|
+
: await validateKind(context.blobStorage, input.kind, input.files, queries)
|
|
165
188
|
|
|
166
189
|
const readable = input.readable ?? ownArtifacts(input.author)
|
|
167
190
|
const references = await resolveReferences(
|
|
@@ -24,10 +24,12 @@ import {
|
|
|
24
24
|
type ArtifactQuery,
|
|
25
25
|
artifactQueryName,
|
|
26
26
|
type CheckedArtifactQuery,
|
|
27
|
+
DOCUMENT_HOLDER_QUERY,
|
|
27
28
|
parseArtifactQuery,
|
|
28
29
|
} from "../queries"
|
|
29
30
|
import { describeArtifactQuery } from "../run-query"
|
|
30
31
|
import { type ArtifactBlobStorage, invalidArtifact, readArtifactText } from "./files"
|
|
32
|
+
import { DOCUMENT_HTML_ENTRY } from "./validate/document-html"
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* Admits a query as the version's author: it throws what running it as them would throw, and
|
|
@@ -247,12 +249,16 @@ function outermostProject(
|
|
|
247
249
|
* its author through `checker`, and returns what each check learned by query name, for the kind's
|
|
248
250
|
* own check. Fails closed: a version that holds a query is refused without one. A file artifact is
|
|
249
251
|
* delivered as it is, so its one file is never read as a query.
|
|
252
|
+
*
|
|
253
|
+
* A designed document's query may start from the object that holds it, `holder`, an object of
|
|
254
|
+
* the type it names: it is checked from every object of that type its author reads.
|
|
250
255
|
*/
|
|
251
256
|
export async function checkArtifactQueries(
|
|
252
257
|
blobStorage: ArtifactBlobStorage,
|
|
253
258
|
kind: ArtifactKind,
|
|
254
259
|
files: readonly ArtifactFile[],
|
|
255
|
-
checker: ArtifactQueryChecker | undefined
|
|
260
|
+
checker: ArtifactQueryChecker | undefined,
|
|
261
|
+
options: { readonly holder?: string } = {}
|
|
256
262
|
): Promise<ReadonlyMap<string, CheckedArtifactQuery>> {
|
|
257
263
|
const checked = new Map<string, CheckedArtifactQuery>()
|
|
258
264
|
if (kind === "file") return checked
|
|
@@ -261,9 +267,10 @@ export async function checkArtifactQueries(
|
|
|
261
267
|
const [first] = queries
|
|
262
268
|
if (!first) return checked
|
|
263
269
|
|
|
264
|
-
|
|
270
|
+
const markdown = kind === "document" && !files.some((file) => file.path === DOCUMENT_HTML_ENTRY)
|
|
271
|
+
if (!ARTIFACT_QUERY_KINDS.includes(kind) || markdown) {
|
|
265
272
|
throw invalidArtifact(
|
|
266
|
-
`'${first.path}': a ${kind} runs no query. A document shows a live sheet instead.`
|
|
273
|
+
`'${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.`
|
|
267
274
|
)
|
|
268
275
|
}
|
|
269
276
|
|
|
@@ -287,9 +294,18 @@ export async function checkArtifactQueries(
|
|
|
287
294
|
`'${file.path}' is not a query: name it queries/<name>.json, with lowercase letters, digits and hyphens, at most 64 characters.`
|
|
288
295
|
)
|
|
289
296
|
}
|
|
297
|
+
if (kind === "document" && name === DOCUMENT_HOLDER_QUERY) {
|
|
298
|
+
throw invalidArtifact(
|
|
299
|
+
`'${file.path}': "${DOCUMENT_HOLDER_QUERY}" is what a document's fields read of the object that holds it. Name the query otherwise.`
|
|
300
|
+
)
|
|
301
|
+
}
|
|
290
302
|
|
|
291
303
|
const text = await readArtifactText(blobStorage, file, ARTIFACT_LIMITS.maxQueryBytes)
|
|
292
|
-
const parsed = parseArtifactQuery(
|
|
304
|
+
const parsed = parseArtifactQuery(
|
|
305
|
+
file.path,
|
|
306
|
+
text,
|
|
307
|
+
options.holder ? { holder: { kind: "start", objectTypeId: options.holder } } : {}
|
|
308
|
+
)
|
|
293
309
|
if ("error" in parsed) throw invalidArtifact(parsed.error)
|
|
294
310
|
|
|
295
311
|
try {
|
|
@@ -2,7 +2,12 @@ import { AuthorizationError } from "../../authorization/errors"
|
|
|
2
2
|
import { ObjectQueryExecutionError } from "../../objects/query/errors"
|
|
3
3
|
import type { ArtifactVersionRecord } from "../../storage/artifacts/types"
|
|
4
4
|
import { ArtifactRequestError } from "../errors"
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
type ArtifactQueryResult,
|
|
7
|
+
artifactQueryName,
|
|
8
|
+
DOCUMENT_HOLDER_QUERY,
|
|
9
|
+
isArtifactQueryName,
|
|
10
|
+
} from "../queries"
|
|
6
11
|
import { serializeArtifactQueryResult } from "../serialize-query"
|
|
7
12
|
|
|
8
13
|
// A page opened outside the app, by the Agent's layout check or to picture a canvas's boards, reads
|
|
@@ -41,15 +46,21 @@ export async function answerArtifactQuery(
|
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
48
|
|
|
44
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Every query a version holds, each answered by `read`: as whoever it reads as. A designed
|
|
51
|
+
* document's holder, which its fields read, is answered too.
|
|
52
|
+
*/
|
|
45
53
|
export async function answerArtifactQueries(
|
|
46
|
-
version: Pick<ArtifactVersionRecord, "files">,
|
|
54
|
+
version: Pick<ArtifactVersionRecord, "files" | "outline">,
|
|
47
55
|
read: (name: string) => Promise<ArtifactQueryResult | null>
|
|
48
56
|
): Promise<ArtifactQueryAnswers> {
|
|
49
57
|
const names = version.files.flatMap((file) => {
|
|
50
58
|
const name = artifactQueryName(file.path)
|
|
51
59
|
return name === undefined ? [] : [name]
|
|
52
60
|
})
|
|
61
|
+
if (version.outline.kind === "document" && version.outline.holder) {
|
|
62
|
+
names.push(DOCUMENT_HOLDER_QUERY)
|
|
63
|
+
}
|
|
53
64
|
|
|
54
65
|
const answers = await Promise.all(
|
|
55
66
|
names.map(async (name) => [name, await answerArtifactQuery(() => read(name))] as const)
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { posix } from "node:path"
|
|
2
|
+
import type { ArtifactFile } from "../../../storage/artifacts/types"
|
|
3
|
+
import { isArtifactAddress } from "../../address"
|
|
4
|
+
import { documentMarks } from "../../document-fill"
|
|
5
|
+
import { FRAME_CDN_ALLOWLIST } from "../../frames/assets"
|
|
6
|
+
import type { DocumentMark } from "../../frames/document-data"
|
|
7
|
+
import { decodeHtmlEntities } from "../../html"
|
|
8
|
+
import { ARTIFACT_LIMITS } from "../../limits"
|
|
9
|
+
import { createHeadingSlugger, type DocumentHeading, type DocumentOutline } from "../../outline"
|
|
10
|
+
import { readDocumentPaper } from "../../paper"
|
|
11
|
+
import { type ArtifactBlobStorage, invalidArtifact, readArtifactText } from "../files"
|
|
12
|
+
import type { FoundReference } from "../references"
|
|
13
|
+
import { readHtmlReferences, refuseFrameAssetPaths } from "./html"
|
|
14
|
+
|
|
15
|
+
/** The file a designed document renders from, beside its stylesheets, fonts, and images. */
|
|
16
|
+
export const DOCUMENT_HTML_ENTRY = "document.html"
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* What a designed document may not hold: it is read, laid out and printed, never run. A frame
|
|
20
|
+
* would refuse most of them anyway; refusing them here says so to whoever publishes.
|
|
21
|
+
*/
|
|
22
|
+
const REFUSED_ELEMENTS = [
|
|
23
|
+
"script",
|
|
24
|
+
"iframe",
|
|
25
|
+
"frame",
|
|
26
|
+
"frameset",
|
|
27
|
+
"object",
|
|
28
|
+
"embed",
|
|
29
|
+
"applet",
|
|
30
|
+
"form",
|
|
31
|
+
"base",
|
|
32
|
+
"portal",
|
|
33
|
+
"meta[http-equiv]",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
/** Elements whose text is not markup, which may show no live data. */
|
|
37
|
+
const RAW_TEXT_ELEMENTS = ["style", "title", "textarea", "xmp", "noembed", "noframes", "noscript"]
|
|
38
|
+
|
|
39
|
+
/** Attributes that hold an address, which may not run script. */
|
|
40
|
+
const ADDRESS_ATTRIBUTES = ["href", "src", "xlink:href", "poster", "action", "formaction"]
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Reads a designed document: `document.html` and the stylesheets, fonts, and images beside it. It
|
|
44
|
+
* may hold any markup that lays out text, tables, figures, and pictures, styled by any CSS, but
|
|
45
|
+
* nothing that runs: no scripts, no handlers, no frames or forms. Its images are files in the
|
|
46
|
+
* version or another artifact's, and its stylesheets are files in the version or on a CDN the
|
|
47
|
+
* frame loads from. Its headings become the outline, as a Markdown document's do, and the
|
|
48
|
+
* `@page` rule of its stylesheets becomes its paper. `<meta name="sixb:object-type">` names the
|
|
49
|
+
* type of the object it shows live data of, and its fields and repeated elements are returned for
|
|
50
|
+
* publishing to check against what that object and its queries hold.
|
|
51
|
+
*/
|
|
52
|
+
export async function validateHtmlDocument(
|
|
53
|
+
blobStorage: ArtifactBlobStorage,
|
|
54
|
+
files: readonly ArtifactFile[]
|
|
55
|
+
): Promise<{
|
|
56
|
+
readonly entry: string
|
|
57
|
+
readonly outline: DocumentOutline
|
|
58
|
+
readonly references: readonly FoundReference[]
|
|
59
|
+
readonly marks: readonly DocumentMark[]
|
|
60
|
+
}> {
|
|
61
|
+
const entry = files.find((file) => file.path === DOCUMENT_HTML_ENTRY)
|
|
62
|
+
if (!entry) throw invalidArtifact(`A designed document needs '${DOCUMENT_HTML_ENTRY}'.`)
|
|
63
|
+
refuseFrameAssetPaths(files, "the document")
|
|
64
|
+
const html = await readArtifactText(blobStorage, entry, ARTIFACT_LIMITS.maxDocumentBytes)
|
|
65
|
+
const paths = new Set(files.map((file) => file.path))
|
|
66
|
+
|
|
67
|
+
let refused: string | undefined
|
|
68
|
+
const refuse = (message: string) => {
|
|
69
|
+
refused ??= message
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const headings: { depth: number; text: string }[] = []
|
|
73
|
+
const slug = createHeadingSlugger()
|
|
74
|
+
const slugs: string[] = []
|
|
75
|
+
let heading: { depth: number; text: string } | null = null
|
|
76
|
+
// The document's styles in the order it applies them: a stylesheet file by its path, or the
|
|
77
|
+
// text of a `<style>` element.
|
|
78
|
+
const styles: ({ readonly path: string } | { readonly css: string })[] = []
|
|
79
|
+
let style: { css: string } | null = null
|
|
80
|
+
let objectTypeId: string | undefined
|
|
81
|
+
|
|
82
|
+
const rewriter = new HTMLRewriter()
|
|
83
|
+
.on(REFUSED_ELEMENTS.join(", "), {
|
|
84
|
+
element(element) {
|
|
85
|
+
refuse(
|
|
86
|
+
`${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>.`
|
|
87
|
+
)
|
|
88
|
+
},
|
|
89
|
+
})
|
|
90
|
+
.on("*", {
|
|
91
|
+
element(element) {
|
|
92
|
+
for (const [name, value] of element.attributes) {
|
|
93
|
+
const attribute = name.toLowerCase()
|
|
94
|
+
if (attribute.startsWith("on")) {
|
|
95
|
+
refuse(
|
|
96
|
+
`${DOCUMENT_HTML_ENTRY} gives <${element.tagName}> the handler '${name}'. A designed document runs no script.`
|
|
97
|
+
)
|
|
98
|
+
} else if (
|
|
99
|
+
ADDRESS_ATTRIBUTES.includes(attribute) &&
|
|
100
|
+
/^\s*javascript:/i.test(decodeHtmlEntities(value).replace(/[\s\u0000-\u001f]/g, ""))
|
|
101
|
+
) {
|
|
102
|
+
refuse(
|
|
103
|
+
`${DOCUMENT_HTML_ENTRY} links <${element.tagName}> to a javascript: address. A designed document runs no script.`
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
})
|
|
109
|
+
// Their text is never markup: a value written into one could end it and start a script.
|
|
110
|
+
.on(
|
|
111
|
+
RAW_TEXT_ELEMENTS.map((tag) => `${tag}[data-sixb-field], ${tag}[data-sixb-each]`).join(", "),
|
|
112
|
+
{
|
|
113
|
+
element(element) {
|
|
114
|
+
refuse(
|
|
115
|
+
`${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>.`
|
|
116
|
+
)
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
.on("h1, h2, h3, h4, h5, h6", {
|
|
121
|
+
element(element) {
|
|
122
|
+
const current = { depth: Number(element.tagName.slice(1)), text: "" }
|
|
123
|
+
heading = current
|
|
124
|
+
headings.push(current)
|
|
125
|
+
element.onEndTag(() => {
|
|
126
|
+
slugs.push(slug(plainText(current.text)))
|
|
127
|
+
heading = null
|
|
128
|
+
})
|
|
129
|
+
},
|
|
130
|
+
text(chunk) {
|
|
131
|
+
if (heading) heading.text += chunk.text
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
.on("img[src]", {
|
|
135
|
+
element(element) {
|
|
136
|
+
const source = decodeHtmlEntities(element.getAttribute("src") ?? "").trim()
|
|
137
|
+
// Another artifact's file is the references' to check.
|
|
138
|
+
if (isArtifactAddress(source)) return
|
|
139
|
+
const problem = localFileProblem(source, paths)
|
|
140
|
+
if (problem) {
|
|
141
|
+
refuse(
|
|
142
|
+
`${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.`
|
|
143
|
+
)
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
})
|
|
147
|
+
.on("link[href]", {
|
|
148
|
+
element(element) {
|
|
149
|
+
const rel = (element.getAttribute("rel") ?? "").toLowerCase().split(/\s+/)
|
|
150
|
+
if (!rel.includes("stylesheet")) return
|
|
151
|
+
const href = decodeHtmlEntities(element.getAttribute("href") ?? "").trim()
|
|
152
|
+
if (FRAME_CDN_ALLOWLIST.some((origin) => href.startsWith(`${origin}/`))) return
|
|
153
|
+
const problem = localFileProblem(href, paths)
|
|
154
|
+
if (problem) {
|
|
155
|
+
refuse(
|
|
156
|
+
`${DOCUMENT_HTML_ENTRY} loads the stylesheet '${href}', ${problem}. A stylesheet is a file in the artifact, by its relative path, or on ${FRAME_CDN_ALLOWLIST.join(", ")}.`
|
|
157
|
+
)
|
|
158
|
+
return
|
|
159
|
+
}
|
|
160
|
+
styles.push({ path: posix.normalize(safeDecodeUri(href.split(/[?#]/)[0] ?? "")) })
|
|
161
|
+
},
|
|
162
|
+
})
|
|
163
|
+
.on('meta[name="sixb:object-type"]', {
|
|
164
|
+
element(element) {
|
|
165
|
+
const content = decodeHtmlEntities(element.getAttribute("content") ?? "").trim()
|
|
166
|
+
if (content) objectTypeId ??= content
|
|
167
|
+
},
|
|
168
|
+
})
|
|
169
|
+
.on("style", {
|
|
170
|
+
element(element) {
|
|
171
|
+
const current = { css: "" }
|
|
172
|
+
style = current
|
|
173
|
+
styles.push(current)
|
|
174
|
+
element.onEndTag(() => {
|
|
175
|
+
style = null
|
|
176
|
+
})
|
|
177
|
+
},
|
|
178
|
+
text(chunk) {
|
|
179
|
+
if (style) style.css += chunk.text
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
const { references, refusal } = readHtmlReferences(
|
|
183
|
+
rewriter,
|
|
184
|
+
() => slugs.at(-1) ?? "",
|
|
185
|
+
DOCUMENT_HTML_ENTRY
|
|
186
|
+
)
|
|
187
|
+
rewriter.transform(html)
|
|
188
|
+
|
|
189
|
+
const problem = refused ?? refusal()
|
|
190
|
+
if (problem) throw invalidArtifact(problem)
|
|
191
|
+
|
|
192
|
+
const stylesheets: string[] = []
|
|
193
|
+
for (const each of styles) {
|
|
194
|
+
if ("css" in each) {
|
|
195
|
+
stylesheets.push(each.css)
|
|
196
|
+
continue
|
|
197
|
+
}
|
|
198
|
+
const file = files.find((candidate) => candidate.path === each.path)
|
|
199
|
+
if (file) {
|
|
200
|
+
stylesheets.push(await readArtifactText(blobStorage, file, ARTIFACT_LIMITS.maxDocumentBytes))
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const paper = readDocumentPaper(stylesheets)
|
|
204
|
+
|
|
205
|
+
const outlined = headings.map(
|
|
206
|
+
({ depth, text }, index): DocumentHeading => ({
|
|
207
|
+
depth,
|
|
208
|
+
text: plainText(text),
|
|
209
|
+
slug: slugs[index] ?? "",
|
|
210
|
+
})
|
|
211
|
+
)
|
|
212
|
+
return {
|
|
213
|
+
entry: DOCUMENT_HTML_ENTRY,
|
|
214
|
+
outline: {
|
|
215
|
+
kind: "document",
|
|
216
|
+
format: "html",
|
|
217
|
+
headings: outlined,
|
|
218
|
+
...(paper ? { paper } : {}),
|
|
219
|
+
...(objectTypeId ? { holder: { objectTypeId, links: [] } } : {}),
|
|
220
|
+
},
|
|
221
|
+
references,
|
|
222
|
+
marks: documentMarks(html),
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function plainText(text: string): string {
|
|
227
|
+
return decodeHtmlEntities(text).replace(/\s+/g, " ").trim()
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Why `source` is not one of the version's files, or null when it is one. */
|
|
231
|
+
function localFileProblem(source: string, paths: ReadonlySet<string>): string | null {
|
|
232
|
+
if (source === "" || source.startsWith("//") || /^[a-z][a-z\d+.-]*:/i.test(source)) {
|
|
233
|
+
return "which is not a file in the artifact"
|
|
234
|
+
}
|
|
235
|
+
const path = posix.normalize(safeDecodeUri(source.split(/[?#]/)[0] ?? ""))
|
|
236
|
+
return paths.has(path) ? null : "which is not one of the artifact's files"
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function safeDecodeUri(value: string): string {
|
|
240
|
+
try {
|
|
241
|
+
return decodeURI(value)
|
|
242
|
+
} catch {
|
|
243
|
+
return value
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -1,30 +1,61 @@
|
|
|
1
1
|
import { posix } from "node:path"
|
|
2
2
|
import type { ArtifactFile } from "../../../storage/artifacts/types"
|
|
3
3
|
import { isArtifactAddress } from "../../address"
|
|
4
|
+
import type { DocumentMark } from "../../frames/document-data"
|
|
4
5
|
import { decodeHtmlEntities } from "../../html"
|
|
5
6
|
import { ARTIFACT_LIMITS } from "../../limits"
|
|
6
7
|
import { createHeadingSlugger, type DocumentHeading, type DocumentOutline } from "../../outline"
|
|
7
8
|
import { type ArtifactBlobStorage, invalidArtifact, readArtifactText } from "../files"
|
|
8
9
|
import type { FoundReference } from "../references"
|
|
10
|
+
import { DOCUMENT_HTML_ENTRY, validateHtmlDocument } from "./document-html"
|
|
9
11
|
|
|
10
12
|
/** The file a document renders from. */
|
|
11
13
|
export const DOCUMENT_ENTRY = "document.md"
|
|
12
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Reads a document, from its Markdown in `document.md` or, designed, from `document.html`: one or
|
|
17
|
+
* the other, never both.
|
|
18
|
+
*/
|
|
19
|
+
export async function validateDocument(
|
|
20
|
+
blobStorage: ArtifactBlobStorage,
|
|
21
|
+
files: readonly ArtifactFile[]
|
|
22
|
+
): Promise<{
|
|
23
|
+
readonly entry: string
|
|
24
|
+
readonly outline: DocumentOutline
|
|
25
|
+
readonly references: readonly FoundReference[]
|
|
26
|
+
/** A designed document's fields and repeated elements. */
|
|
27
|
+
readonly marks?: readonly DocumentMark[]
|
|
28
|
+
}> {
|
|
29
|
+
const markdown = files.find((file) => file.path === DOCUMENT_ENTRY)
|
|
30
|
+
const designed = files.some((file) => file.path === DOCUMENT_HTML_ENTRY)
|
|
31
|
+
if (markdown && designed) {
|
|
32
|
+
throw invalidArtifact(
|
|
33
|
+
`A document renders from '${DOCUMENT_ENTRY}' or from '${DOCUMENT_HTML_ENTRY}', not both: keep one.`
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
if (designed) return validateHtmlDocument(blobStorage, files)
|
|
37
|
+
if (!markdown) {
|
|
38
|
+
throw invalidArtifact(
|
|
39
|
+
`A document needs its Markdown in '${DOCUMENT_ENTRY}', or its HTML in '${DOCUMENT_HTML_ENTRY}' when it has a design of its own.`
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
return validateMarkdownDocument(blobStorage, markdown, files)
|
|
43
|
+
}
|
|
44
|
+
|
|
13
45
|
/**
|
|
14
46
|
* Reads a document's Markdown: its headings become the outline, and every image must be a file in
|
|
15
47
|
* the version or an `artifact:` address, so the document renders the same wherever it is opened.
|
|
16
48
|
* The addresses it shows and links to are returned with the section each sits in, to resolve.
|
|
17
49
|
*/
|
|
18
|
-
|
|
50
|
+
async function validateMarkdownDocument(
|
|
19
51
|
blobStorage: ArtifactBlobStorage,
|
|
52
|
+
entry: ArtifactFile,
|
|
20
53
|
files: readonly ArtifactFile[]
|
|
21
54
|
): Promise<{
|
|
22
55
|
readonly entry: string
|
|
23
56
|
readonly outline: DocumentOutline
|
|
24
57
|
readonly references: readonly FoundReference[]
|
|
25
58
|
}> {
|
|
26
|
-
const entry = files.find((file) => file.path === DOCUMENT_ENTRY)
|
|
27
|
-
if (!entry) throw invalidArtifact(`A document needs its Markdown in '${DOCUMENT_ENTRY}'.`)
|
|
28
59
|
const markdown = await readArtifactText(blobStorage, entry, ARTIFACT_LIMITS.maxDocumentBytes)
|
|
29
60
|
|
|
30
61
|
// The same options the docs site renders with, so headings and images read the same way.
|