@sixb/core 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.js +41 -40
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/validation.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +1 -1
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +50 -3
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +2 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +7 -5
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +74 -50
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-routing.d.ts +5 -2
- package/dist/agents/model-routing.d.ts.map +1 -1
- package/dist/agents/queued-turn.d.ts +16 -0
- package/dist/agents/queued-turn.d.ts.map +1 -0
- package/dist/agents/request.d.ts +120 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-after-finish.d.ts +10 -0
- package/dist/agents/run-after-finish.d.ts.map +1 -1
- package/dist/agents/run-artifacts.d.ts +0 -38
- package/dist/agents/run-artifacts.d.ts.map +1 -1
- package/dist/agents/run-events.d.ts +10 -1
- package/dist/agents/run-events.d.ts.map +1 -1
- package/dist/agents/run-session-children.d.ts.map +1 -1
- package/dist/agents/run-session-http.d.ts.map +1 -1
- package/dist/agents/run-session-serve.d.ts.map +1 -1
- package/dist/agents/run-session.d.ts +14 -1
- package/dist/agents/run-session.d.ts.map +1 -1
- package/dist/agents/run-turn.d.ts +9 -1
- package/dist/agents/run-turn.d.ts.map +1 -1
- package/dist/agents/streams/index.d.ts +1 -1
- package/dist/agents/streams/index.d.ts.map +1 -1
- package/dist/agents/streams/index.js +1 -1
- package/dist/agents/streams/internal.d.ts +2 -1
- package/dist/agents/streams/internal.d.ts.map +1 -1
- package/dist/agents/streams/internal.js +22 -2
- package/dist/agents/streams/internal.js.map +1 -1
- package/dist/agents/streams/protocol.d.ts +53 -0
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/streams/steps.d.ts +24 -0
- package/dist/agents/streams/steps.d.ts.map +1 -0
- package/dist/agents/thread-access.d.ts +44 -2
- package/dist/agents/thread-access.d.ts.map +1 -1
- package/dist/agents/turn-answered.d.ts +7 -0
- package/dist/agents/turn-answered.d.ts.map +1 -0
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/artifacts/canvas-display.d.ts +3 -5
- package/dist/artifacts/canvas-display.d.ts.map +1 -1
- package/dist/artifacts/comments.d.ts +14 -3
- package/dist/artifacts/comments.d.ts.map +1 -1
- package/dist/artifacts/document-fill.d.ts +18 -0
- package/dist/artifacts/document-fill.d.ts.map +1 -0
- package/dist/artifacts/errors.d.ts +1 -1
- package/dist/artifacts/errors.d.ts.map +1 -1
- package/dist/artifacts/events.d.ts +3 -2
- package/dist/artifacts/events.d.ts.map +1 -1
- package/dist/artifacts/execution.d.ts +40 -4
- package/dist/artifacts/execution.d.ts.map +1 -1
- package/dist/artifacts/frames/assets.d.ts +8 -1
- package/dist/artifacts/frames/assets.d.ts.map +1 -1
- package/dist/artifacts/frames/document-data.d.ts +98 -0
- package/dist/artifacts/frames/document-data.d.ts.map +1 -0
- package/dist/artifacts/frames/entries.d.ts +12 -7
- package/dist/artifacts/frames/entries.d.ts.map +1 -1
- package/dist/artifacts/frames/index.d.ts +2 -1
- package/dist/artifacts/frames/index.d.ts.map +1 -1
- package/dist/artifacts/frames/index.js +22 -13
- package/dist/artifacts/frames/index.js.map +4 -4
- package/dist/artifacts/frames/kit.d.ts +15 -0
- package/dist/artifacts/frames/kit.d.ts.map +1 -1
- package/dist/artifacts/frames/protocol.d.ts +12 -1
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/runtime.d.ts +24 -4
- package/dist/artifacts/frames/runtime.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +3 -1
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +9 -3
- package/dist/artifacts/index.js.map +3 -3
- package/dist/artifacts/live/blocks.d.ts +62 -0
- package/dist/artifacts/live/blocks.d.ts.map +1 -0
- package/dist/artifacts/live/board.d.ts +6 -0
- package/dist/artifacts/live/board.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts +12 -0
- package/dist/artifacts/live/document.d.ts.map +1 -1
- package/dist/artifacts/live/index.d.ts +2 -0
- package/dist/artifacts/live/index.d.ts.map +1 -1
- package/dist/artifacts/live/index.js +148 -44
- package/dist/artifacts/live/index.js.map +3 -3
- package/dist/artifacts/live/page.d.ts +49 -0
- package/dist/artifacts/live/page.d.ts.map +1 -0
- package/dist/artifacts/live/protocol.d.ts +5 -0
- package/dist/artifacts/live/protocol.d.ts.map +1 -1
- package/dist/artifacts/live/server.d.ts +2 -2
- package/dist/artifacts/live/server.d.ts.map +1 -1
- package/dist/artifacts/live/server.js +29 -24
- package/dist/artifacts/live/server.js.map +1 -1
- package/dist/artifacts/live/state.d.ts +4 -1
- package/dist/artifacts/live/state.d.ts.map +1 -1
- package/dist/artifacts/outline.d.ts +16 -0
- package/dist/artifacts/outline.d.ts.map +1 -1
- package/dist/artifacts/paper.d.ts +22 -0
- package/dist/artifacts/paper.d.ts.map +1 -0
- package/dist/artifacts/pdf-job.d.ts +9 -0
- package/dist/artifacts/pdf-job.d.ts.map +1 -0
- package/dist/artifacts/publish/fields.d.ts +25 -0
- package/dist/artifacts/publish/fields.d.ts.map +1 -0
- package/dist/artifacts/publish/index.d.ts +2 -1
- package/dist/artifacts/publish/index.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +32 -23
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/merge.d.ts +7 -6
- package/dist/artifacts/publish/merge.d.ts.map +1 -1
- package/dist/artifacts/publish/pdf.d.ts +28 -0
- package/dist/artifacts/publish/pdf.d.ts.map +1 -0
- package/dist/artifacts/publish/previews.d.ts +12 -20
- package/dist/artifacts/publish/previews.d.ts.map +1 -1
- package/dist/artifacts/publish/publish.d.ts.map +1 -1
- package/dist/artifacts/publish/queries.d.ts +6 -1
- package/dist/artifacts/publish/queries.d.ts.map +1 -1
- package/dist/artifacts/publish/query-answers.d.ts +5 -2
- package/dist/artifacts/publish/query-answers.d.ts.map +1 -1
- package/dist/artifacts/publish/validate/document-html.d.ts +24 -0
- package/dist/artifacts/publish/validate/document-html.d.ts.map +1 -0
- package/dist/artifacts/publish/validate/document.d.ts +5 -3
- package/dist/artifacts/publish/validate/document.d.ts.map +1 -1
- package/dist/artifacts/queries.d.ts +16 -2
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/run-query.d.ts.map +1 -1
- package/dist/auth/index.js +6 -6
- package/dist/authorization/event-visibility.d.ts.map +1 -1
- package/dist/authorization/index.js +2 -2
- package/dist/blob-storage/index.js +1 -1
- package/dist/bootstrap/index.js +50 -48
- package/dist/bootstrap/index.js.map +2 -2
- package/dist/calendar.d.ts +55 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +19 -0
- package/dist/calendar.js.map +9 -0
- package/dist/{chunk-5a4a52tq.js → chunk-0pmpwn3g.js} +18 -2
- package/dist/chunk-0pmpwn3g.js.map +10 -0
- package/dist/{chunk-0k3r5kb3.js → chunk-394zjzjs.js} +20 -10
- package/dist/{chunk-0k3r5kb3.js.map → chunk-394zjzjs.js.map} +5 -5
- package/dist/{chunk-stmxh0hv.js → chunk-3neam1y5.js} +2 -2
- package/dist/{chunk-zeykm8my.js → chunk-3qtk0070.js} +16 -42
- package/dist/chunk-3qtk0070.js.map +14 -0
- package/dist/{chunk-p8pgnq8d.js → chunk-425ydk65.js} +5 -5
- package/dist/{chunk-p351afzm.js → chunk-5sswe5ej.js} +2 -2
- package/dist/{chunk-a6fjkcne.js → chunk-60662fyv.js} +54 -28
- package/dist/{chunk-a6fjkcne.js.map → chunk-60662fyv.js.map} +7 -6
- package/dist/{chunk-e0hnbb1m.js → chunk-61zptves.js} +1 -1
- package/dist/chunk-6hfbz4d0.js +98 -0
- package/dist/chunk-6hfbz4d0.js.map +10 -0
- package/dist/{chunk-3zagkr6w.js → chunk-7mhbs9yy.js} +4 -4
- package/dist/{chunk-3zagkr6w.js.map → chunk-7mhbs9yy.js.map} +1 -1
- package/dist/{chunk-gxwy4c3s.js → chunk-7r9mqpva.js} +570 -104
- package/dist/chunk-7r9mqpva.js.map +47 -0
- package/dist/{chunk-3014rfjz.js → chunk-88xeh6zx.js} +28 -8
- package/dist/{chunk-3014rfjz.js.map → chunk-88xeh6zx.js.map} +4 -4
- package/dist/{chunk-9nsjjd44.js → chunk-8tv3qd65.js} +2 -1
- package/dist/chunk-8tv3qd65.js.map +12 -0
- package/dist/chunk-90nqenq8.js +386 -0
- package/dist/chunk-90nqenq8.js.map +14 -0
- package/dist/{chunk-fe6r7yhg.js → chunk-92wrka15.js} +1 -1
- package/dist/{chunk-w1wq7gfr.js → chunk-9c9yknwt.js} +464 -29
- package/dist/{chunk-w1wq7gfr.js.map → chunk-9c9yknwt.js.map} +7 -7
- package/dist/{chunk-q9nkpr8k.js → chunk-9tpmfh3n.js} +1 -1
- package/dist/chunk-9wr3yajk.js.map +2 -2
- package/dist/{chunk-rtm1jq00.js → chunk-ats8y3d9.js} +1202 -246
- package/dist/{chunk-rtm1jq00.js.map → chunk-ats8y3d9.js.map} +16 -14
- package/dist/{chunk-td26wjr5.js → chunk-bcz9dxtf.js} +17 -47
- package/dist/chunk-bcz9dxtf.js.map +12 -0
- package/dist/chunk-bqr703h4.js +1799 -0
- package/dist/chunk-bqr703h4.js.map +13 -0
- package/dist/{chunk-sysnvjce.js → chunk-brhp9d97.js} +2 -2
- package/dist/{chunk-8a8k38tz.js → chunk-brybqw5k.js} +1 -1
- package/dist/{chunk-rsxb14an.js → chunk-bs1sd0e0.js} +12 -8
- package/dist/chunk-bs1sd0e0.js.map +18 -0
- package/dist/{chunk-eptrvnby.js → chunk-c29729me.js} +42 -3
- package/dist/chunk-c29729me.js.map +12 -0
- package/dist/{chunk-855w9nvw.js → chunk-cg7cygfj.js} +1 -1
- package/dist/chunk-dq3t5sr3.js +114 -0
- package/dist/chunk-dq3t5sr3.js.map +11 -0
- package/dist/{chunk-t24yktqr.js → chunk-dvgc56n2.js} +20 -4
- package/dist/{chunk-t24yktqr.js.map → chunk-dvgc56n2.js.map} +5 -5
- package/dist/{chunk-r2psmn42.js → chunk-eg6xqef7.js} +1 -1
- package/dist/{chunk-7kpqntgw.js → chunk-f05994as.js} +1 -1
- package/dist/{chunk-msyevpp3.js → chunk-fmgf9h5e.js} +38 -14
- package/dist/chunk-fmgf9h5e.js.map +22 -0
- package/dist/{chunk-b9qfh2ya.js → chunk-fzbhybya.js} +29 -2
- package/dist/chunk-fzbhybya.js.map +11 -0
- package/dist/{chunk-t0s7b3d1.js → chunk-gaj8djsw.js} +251 -6
- package/dist/chunk-gaj8djsw.js.map +13 -0
- package/dist/{chunk-2bn6813a.js → chunk-grt2j5vp.js} +2 -2
- package/dist/{chunk-s7xqfxs9.js → chunk-hkbks1xm.js} +3 -1
- package/dist/{chunk-s7xqfxs9.js.map → chunk-hkbks1xm.js.map} +3 -3
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-rtdrm592.js → chunk-htdzx40w.js} +2 -2
- package/dist/{chunk-bc3y6gff.js → chunk-jka26v8c.js} +1 -1
- package/dist/{chunk-yy914zfr.js → chunk-jt012fxq.js} +772 -98
- package/dist/chunk-jt012fxq.js.map +34 -0
- package/dist/{chunk-48c1z8nj.js → chunk-kft7mp7z.js} +28 -3
- package/dist/chunk-kft7mp7z.js.map +10 -0
- package/dist/chunk-mbwsgjn7.js +40 -0
- package/dist/chunk-mbwsgjn7.js.map +11 -0
- package/dist/{chunk-wa05txmk.js → chunk-n1hbwc6y.js} +51 -8
- package/dist/chunk-n1hbwc6y.js.map +12 -0
- package/dist/{chunk-n4zzaf6q.js → chunk-nxysqbt0.js} +4 -2
- package/dist/chunk-nxysqbt0.js.map +10 -0
- package/dist/{chunk-6ef4esq4.js → chunk-pqj8vff9.js} +4 -4
- package/dist/chunk-pvpq483h.js.map +2 -2
- package/dist/{chunk-mzx71snp.js → chunk-q7g9cqwt.js} +7 -2
- package/dist/{chunk-mzx71snp.js.map → chunk-q7g9cqwt.js.map} +3 -3
- package/dist/{chunk-n68vz95m.js → chunk-qbd282aa.js} +2 -2
- package/dist/{chunk-e91fmg6t.js → chunk-qsa7nw6f.js} +2 -1
- package/dist/{chunk-e91fmg6t.js.map → chunk-qsa7nw6f.js.map} +3 -3
- package/dist/{chunk-rsrc7vtw.js → chunk-s8xxef60.js} +240 -46
- package/dist/chunk-s8xxef60.js.map +50 -0
- package/dist/{chunk-r9rtavg9.js → chunk-t19wjmnc.js} +7 -7
- package/dist/{chunk-vzkxqf8h.js → chunk-tapdssb5.js} +50 -6
- package/dist/chunk-tapdssb5.js.map +23 -0
- package/dist/{chunk-dhkc9b23.js → chunk-v8a1qjzp.js} +1 -1
- package/dist/{chunk-hvbvq7p4.js → chunk-vs2s3p8n.js} +731 -10
- package/dist/chunk-vs2s3p8n.js.map +20 -0
- package/dist/chunk-vtjzwymr.js.map +2 -2
- package/dist/{chunk-8t2ynwg0.js → chunk-wzcjhv54.js} +31 -1
- package/dist/{chunk-8t2ynwg0.js.map → chunk-wzcjhv54.js.map} +3 -3
- package/dist/{chunk-8tqnsx3q.js → chunk-xavet0qs.js} +5 -3
- package/dist/{chunk-8tqnsx3q.js.map → chunk-xavet0qs.js.map} +3 -3
- package/dist/{chunk-8bns0y68.js → chunk-xf76csps.js} +5 -5
- package/dist/{chunk-cwdzcv37.js → chunk-xrmbhap8.js} +2 -2
- package/dist/{chunk-cwdzcv37.js.map → chunk-xrmbhap8.js.map} +2 -2
- package/dist/{chunk-f6ahf5gf.js → chunk-xxfj0rr2.js} +20 -5
- package/dist/chunk-xxfj0rr2.js.map +13 -0
- package/dist/{chunk-3hzhcfsv.js → chunk-y8fwm3z2.js} +2 -2
- package/dist/{chunk-3hzhcfsv.js.map → chunk-y8fwm3z2.js.map} +3 -3
- package/dist/{chunk-smnt672s.js → chunk-ygvay56w.js} +20 -4
- package/dist/chunk-ygvay56w.js.map +10 -0
- package/dist/{chunk-evj5jxz3.js → chunk-ykchk644.js} +63 -15
- package/dist/{chunk-evj5jxz3.js.map → chunk-ykchk644.js.map} +7 -7
- package/dist/{chunk-vepea5c3.js → chunk-ym1bqd98.js} +6 -6
- package/dist/{chunk-yv8hv4wq.js → chunk-z4jqb44a.js} +3 -1
- package/dist/chunk-z4jqb44a.js.map +10 -0
- package/dist/connectors/connection-handles.d.ts +9 -0
- package/dist/connectors/connection-handles.d.ts.map +1 -0
- package/dist/connectors/connections/authorizations.d.ts +9 -0
- package/dist/connectors/connections/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/capability.d.ts +11 -0
- package/dist/connectors/connections/capability.d.ts.map +1 -1
- package/dist/connectors/connections/events.d.ts +17 -0
- package/dist/connectors/connections/events.d.ts.map +1 -0
- package/dist/connectors/connections/internal.d.ts +2 -1
- package/dist/connectors/connections/internal.d.ts.map +1 -1
- package/dist/connectors/connections/internal.js +8 -4
- package/dist/connectors/connections/internal.js.map +1 -1
- package/dist/connectors/connections/runs.d.ts +3 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/service.d.ts +13 -1
- package/dist/connectors/connections/service.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts +14 -2
- package/dist/connectors/execution.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/service.d.ts +5 -1
- package/dist/connectors/service.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +22 -1
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/write.js +1 -1
- package/dist/deploy/index.d.ts +1 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/internal.js +3 -2
- package/dist/deploy/internal.js.map +3 -3
- package/dist/deploy/services.d.ts.map +1 -1
- package/dist/deploy/types.d.ts +22 -2
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/events/definitions.d.ts +4 -0
- package/dist/events/definitions.d.ts.map +1 -1
- package/dist/events/execution.d.ts +8 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +3 -3
- package/dist/events/outbox-dispatcher.d.ts +7 -0
- package/dist/events/outbox-dispatcher.d.ts.map +1 -1
- package/dist/events/scope.d.ts +1 -0
- package/dist/events/scope.d.ts.map +1 -1
- package/dist/events/scope.js +1 -1
- package/dist/events/selectors/builder.d.ts +9 -1
- package/dist/events/selectors/builder.d.ts.map +1 -1
- package/dist/events/selectors/index.d.ts +2 -2
- package/dist/events/selectors/index.d.ts.map +1 -1
- package/dist/events/selectors/index.js +2 -2
- package/dist/events/selectors/predicate.d.ts.map +1 -1
- package/dist/events/selectors/types.d.ts +18 -3
- package/dist/events/selectors/types.d.ts.map +1 -1
- package/dist/events/types/artifacts.d.ts +7 -1
- package/dist/events/types/artifacts.d.ts.map +1 -1
- package/dist/events/types/connectors.d.ts +32 -0
- package/dist/events/types/connectors.d.ts.map +1 -0
- package/dist/events/types/index.d.ts +3 -1
- package/dist/events/types/index.d.ts.map +1 -1
- package/dist/events/types/syncs.d.ts +4 -0
- package/dist/events/types/syncs.d.ts.map +1 -1
- package/dist/execution/agent.js +43 -42
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorization.d.ts +5 -0
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +4 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -1
- package/dist/execution/object-reader-ontology.d.ts +3 -0
- package/dist/execution/object-reader-ontology.d.ts.map +1 -1
- package/dist/execution/primitive.js +41 -40
- package/dist/execution/primitive.js.map +1 -1
- package/dist/execution/request.d.ts +1 -1
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +39 -38
- package/dist/execution/request.js.map +3 -3
- package/dist/execution/scopes.d.ts +8 -0
- package/dist/execution/scopes.d.ts.map +1 -1
- package/dist/execution/script.d.ts +7 -0
- package/dist/execution/script.d.ts.map +1 -0
- package/dist/execution/types.d.ts +16 -1
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +13 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -70
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +1 -1
- package/dist/lineage/executors.d.ts +1 -1
- package/dist/lineage/executors.d.ts.map +1 -1
- package/dist/maintenance/index.js +2 -2
- package/dist/materialization/event-envelopes.d.ts +3 -3
- package/dist/materialization/event-envelopes.d.ts.map +1 -1
- package/dist/materialization/events.d.ts +6 -0
- package/dist/materialization/events.d.ts.map +1 -1
- package/dist/materialization/index.js +1 -1
- package/dist/materialization/model.d.ts +6 -0
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/index.js +24 -23
- package/dist/materializer/index.js.map +1 -1
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts +2 -0
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts +1 -0
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/models/audio/runtime.d.ts.map +1 -1
- package/dist/models/audio/types.d.ts +19 -0
- package/dist/models/audio/types.d.ts.map +1 -1
- package/dist/models/execution/index.js +22 -21
- package/dist/models/execution/index.js.map +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/objects/index.js +41 -40
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/query/executor.d.ts +3 -1
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/explain.d.ts +3 -1
- package/dist/objects/query/explain.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +1 -1
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +21 -20
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/link-query-clearance.d.ts +3 -0
- package/dist/objects/query/link-query-clearance.d.ts.map +1 -1
- package/dist/objects/query/links.d.ts +1 -1
- package/dist/objects/query/links.d.ts.map +1 -1
- package/dist/objects/query/validate.d.ts +17 -0
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
- package/dist/ontology/index.js +3 -3
- package/dist/ontology/internal.js +3 -3
- package/dist/pipelines/index.js +27 -26
- package/dist/pipelines/index.js.map +1 -1
- package/dist/projections/builders.d.ts +7 -1
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/index.d.ts +1 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.js +22 -21
- package/dist/projections/internal.js.map +1 -1
- package/dist/projections/types.d.ts +10 -0
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +3 -2
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +40 -13
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +13 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +47 -25
- package/dist/runtime/internal.js.map +4 -3
- package/dist/runtime/locale.d.ts +0 -2
- package/dist/runtime/locale.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +1 -1
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/script.d.ts +39 -0
- package/dist/runtime/script.d.ts.map +1 -0
- package/dist/runtime/sixb.d.ts +2 -2
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/sandboxes/auth.d.ts +26 -4
- package/dist/sandboxes/auth.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +3 -1
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +5 -5
- package/dist/schedules/builders.d.ts.map +1 -1
- package/dist/schedules/index.js +3 -3
- package/dist/schedules/runtime.d.ts.map +1 -1
- package/dist/schedules/validation.d.ts +2 -0
- package/dist/schedules/validation.d.ts.map +1 -1
- package/dist/security/view-conditions.d.ts.map +1 -1
- package/dist/shares/internal.js +19 -18
- package/dist/shares/internal.js.map +2 -2
- package/dist/storage/agents/errors.d.ts +1 -1
- package/dist/storage/agents/errors.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +43 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +2 -2
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +54 -11
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +41 -5
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +291 -3
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +3 -2
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +4 -3
- package/dist/storage/ai-cost/provider.js.map +1 -1
- package/dist/storage/ai-cost/types.d.ts +5 -1
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts +7 -1
- package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
- package/dist/storage/artifacts/index.d.ts +1 -1
- package/dist/storage/artifacts/index.d.ts.map +1 -1
- package/dist/storage/artifacts/record.d.ts +5 -2
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +41 -0
- package/dist/storage/artifacts/types.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +3 -3
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +1 -1
- package/dist/storage/executions/types.d.ts +6 -0
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +7 -7
- package/dist/storage/index.d.ts +4 -4
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +30 -25
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +1 -1
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +12 -10
- package/dist/storage/internal.js.map +2 -2
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts +2 -0
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/ontology/replacement-plans.d.ts +8 -0
- package/dist/storage/ontology/replacement-plans.d.ts.map +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/sync-runs/idempotency.d.ts.map +1 -1
- package/dist/storage/sync-runs/in-memory.d.ts +2 -1
- package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/sync-runs/index.d.ts +1 -1
- package/dist/storage/sync-runs/index.d.ts.map +1 -1
- package/dist/storage/sync-runs/types.d.ts +27 -2
- package/dist/storage/sync-runs/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +7 -7
- package/dist/syncs/accounts.d.ts +36 -0
- package/dist/syncs/accounts.d.ts.map +1 -0
- package/dist/syncs/builders.d.ts.map +1 -1
- package/dist/syncs/connections.d.ts +36 -0
- package/dist/syncs/connections.d.ts.map +1 -0
- package/dist/syncs/execution.d.ts +14 -4
- package/dist/syncs/execution.d.ts.map +1 -1
- package/dist/syncs/index.d.ts +2 -1
- package/dist/syncs/index.d.ts.map +1 -1
- package/dist/syncs/index.js +28 -27
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/request.d.ts +16 -2
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/syncs/run-dispatch.d.ts +14 -2
- package/dist/syncs/run-dispatch.d.ts.map +1 -1
- package/dist/testing/agent-approval-storage-contract.d.ts.map +1 -1
- package/dist/testing/agent-execution.d.ts +3 -0
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-inbox-storage-contract.d.ts +15 -0
- package/dist/testing/agent-inbox-storage-contract.d.ts.map +1 -0
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6589 -4627
- package/dist/testing/index.js.map +13 -12
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/testing/run-claim-storage-contract.d.ts.map +1 -1
- package/dist/webhooks/connections.d.ts +3 -4
- package/dist/webhooks/connections.d.ts.map +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/internal.js +22 -54
- package/dist/webhooks/internal.js.map +3 -3
- package/dist/webhooks/types.d.ts +2 -11
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workers/index.js +66 -13
- package/dist/workers/index.js.map +4 -4
- package/dist/workers/queue-worker.d.ts +5 -0
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workers/queued-run-dispatch.d.ts.map +1 -1
- package/dist/workers/worker.d.ts +8 -0
- package/dist/workers/worker.d.ts.map +1 -1
- package/dist/workflows/index.js +50 -48
- package/dist/workflows/index.js.map +1 -1
- package/package.json +12 -1
- package/src/actions/validation.ts +3 -1
- package/src/agents/README.md +6 -2
- package/src/agents/children.ts +6 -0
- package/src/agents/errors.ts +3 -0
- package/src/agents/execution.ts +331 -43
- package/src/agents/ids.ts +5 -0
- package/src/agents/index.ts +22 -4
- package/src/agents/model-routing.ts +25 -9
- package/src/agents/queued-turn.ts +46 -0
- package/src/agents/request.ts +1444 -210
- package/src/agents/run-after-finish.ts +259 -2
- package/src/agents/run-artifacts.ts +3 -93
- package/src/agents/run-events.ts +256 -34
- package/src/agents/run-session-children.ts +13 -2
- package/src/agents/run-session-http.ts +9 -2
- package/src/agents/run-session-serve.ts +2 -8
- package/src/agents/run-session.ts +142 -3
- package/src/agents/run-turn.ts +148 -23
- package/src/agents/streams/index.ts +3 -0
- package/src/agents/streams/internal.ts +12 -0
- package/src/agents/streams/protocol.ts +109 -1
- package/src/agents/streams/steps.ts +131 -0
- package/src/agents/thread-access.ts +57 -2
- package/src/agents/turn-answered.ts +31 -0
- package/src/agents/validation.ts +2 -0
- package/src/artifacts/canvas-display.ts +4 -6
- package/src/artifacts/comments.ts +70 -17
- package/src/artifacts/document-fill.ts +103 -0
- package/src/artifacts/errors.ts +2 -0
- package/src/artifacts/events.ts +4 -1
- package/src/artifacts/execution.ts +265 -31
- package/src/artifacts/frames/assets.ts +42 -7
- package/src/artifacts/frames/document-data.ts +353 -0
- package/src/artifacts/frames/entries.ts +22 -16
- package/src/artifacts/frames/grants.ts +2 -2
- package/src/artifacts/frames/index.ts +3 -0
- package/src/artifacts/frames/kit.ts +102 -0
- package/src/artifacts/frames/protocol.ts +12 -1
- package/src/artifacts/frames/runtime.ts +413 -6
- package/src/artifacts/index.ts +3 -0
- package/src/artifacts/live/blocks.ts +889 -0
- package/src/artifacts/live/board.ts +195 -42
- package/src/artifacts/live/document.ts +170 -5
- package/src/artifacts/live/index.ts +7 -0
- package/src/artifacts/live/page.ts +807 -0
- package/src/artifacts/live/protocol.ts +5 -0
- package/src/artifacts/live/server.ts +2 -2
- package/src/artifacts/live/state.ts +9 -4
- package/src/artifacts/outline.ts +17 -0
- package/src/artifacts/paper.ts +173 -0
- package/src/artifacts/pdf-job.ts +11 -0
- package/src/artifacts/publish/fields.ts +177 -0
- package/src/artifacts/publish/index.ts +6 -1
- package/src/artifacts/publish/merge.ts +28 -15
- package/src/artifacts/publish/pdf.ts +82 -0
- package/src/artifacts/publish/previews.ts +24 -34
- package/src/artifacts/publish/publish.ts +26 -3
- package/src/artifacts/publish/queries.ts +20 -4
- package/src/artifacts/publish/query-answers.ts +14 -3
- package/src/artifacts/publish/validate/document-html.ts +245 -0
- package/src/artifacts/publish/validate/document.ts +34 -3
- package/src/artifacts/queries.ts +59 -13
- package/src/artifacts/run-query.ts +5 -2
- package/src/authorization/event-visibility.ts +13 -0
- package/src/calendar.ts +195 -0
- package/src/connectors/connection-handles.ts +71 -0
- package/src/connectors/connections/authorizations.ts +50 -2
- package/src/connectors/connections/capability.ts +40 -0
- package/src/connectors/connections/events.ts +57 -0
- package/src/connectors/connections/internal.ts +3 -0
- package/src/connectors/connections/runs.ts +5 -0
- package/src/connectors/connections/service.ts +93 -6
- package/src/connectors/execution.ts +35 -8
- package/src/connectors/index.ts +3 -0
- package/src/connectors/service.ts +23 -0
- package/src/connectors/types.ts +29 -1
- package/src/deploy/index.ts +1 -0
- package/src/deploy/services.ts +1 -0
- package/src/deploy/types.ts +30 -2
- package/src/events/definitions.ts +14 -0
- package/src/events/execution.ts +51 -4
- package/src/events/index.ts +8 -0
- package/src/events/outbox-dispatcher.ts +12 -2
- package/src/events/scope.ts +3 -0
- package/src/events/selectors/builder.ts +49 -0
- package/src/events/selectors/index.ts +5 -0
- package/src/events/selectors/predicate.ts +2 -0
- package/src/events/selectors/types.ts +30 -1
- package/src/events/types/artifacts.ts +7 -1
- package/src/events/types/connectors.ts +36 -0
- package/src/events/types/index.ts +7 -0
- package/src/events/types/syncs.ts +4 -0
- package/src/execution/authorization.ts +45 -0
- package/src/execution/authorized-object-reader.ts +33 -5
- package/src/execution/durable.ts +2 -0
- package/src/execution/object-reader-ontology.ts +6 -0
- package/src/execution/request.ts +1 -0
- package/src/execution/scopes.ts +24 -0
- package/src/execution/script.ts +27 -0
- package/src/execution/types.ts +7 -1
- package/src/http/api-routes.ts +33 -0
- package/src/index.ts +39 -4
- package/src/lineage/executors.ts +3 -1
- package/src/materialization/event-envelopes.ts +10 -5
- package/src/materialization/events.ts +2 -0
- package/src/materialization/model.ts +6 -0
- package/src/materializer/README.md +10 -0
- package/src/materializer/projections/replace.ts +42 -1
- package/src/materializer/projections/replacement-plan.ts +44 -4
- package/src/materializer/shared/normalize.ts +4 -0
- package/src/models/audio/runtime.ts +57 -14
- package/src/models/audio/types.ts +20 -0
- package/src/models/index.ts +1 -0
- package/src/objects/query/executor.ts +4 -0
- package/src/objects/query/explain.ts +5 -0
- package/src/objects/query/index.ts +1 -0
- package/src/objects/query/link-query-clearance.ts +4 -1
- package/src/objects/query/links.ts +5 -1
- package/src/objects/query/validate.ts +33 -1
- package/src/objects/sdk/runtime-query-executor.ts +7 -3
- package/src/projections/builders.ts +20 -0
- package/src/projections/index.ts +1 -0
- package/src/projections/registry.ts +1 -0
- package/src/projections/revision.ts +2 -0
- package/src/projections/types.ts +11 -0
- package/src/projections/validation.ts +6 -0
- package/src/queues/in-memory.ts +5 -0
- package/src/queues/index.ts +3 -1
- package/src/queues/types.ts +45 -14
- package/src/runtime/host.ts +125 -11
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/locale.ts +0 -10
- package/src/runtime/resolve-definitions.ts +4 -1
- package/src/runtime/script.ts +62 -0
- package/src/runtime/sixb.ts +15 -5
- package/src/sandboxes/README.md +3 -1
- package/src/sandboxes/auth.ts +32 -4
- package/src/sandboxes/index.ts +15 -1
- package/src/schedules/builders.ts +4 -1
- package/src/schedules/runtime.ts +3 -0
- package/src/schedules/validation.ts +20 -2
- package/src/security/view-conditions.ts +2 -1
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +500 -7
- package/src/storage/agents/index.ts +26 -0
- package/src/storage/agents/provider.ts +454 -15
- package/src/storage/agents/types.ts +315 -3
- package/src/storage/ai-cost/analytics.ts +22 -43
- package/src/storage/ai-cost/types.ts +5 -1
- package/src/storage/artifacts/in-memory.ts +52 -6
- package/src/storage/artifacts/index.ts +2 -0
- package/src/storage/artifacts/record.ts +33 -4
- package/src/storage/artifacts/types.ts +44 -0
- package/src/storage/executions/provider.ts +22 -2
- package/src/storage/executions/types.ts +2 -0
- package/src/storage/executions/validation.ts +27 -0
- package/src/storage/index.ts +29 -0
- package/src/storage/internal.ts +1 -0
- package/src/storage/ontology/in-memory/replacement-plans.ts +22 -0
- package/src/storage/ontology/replacement-plans.ts +6 -0
- package/src/storage/operation-scope.ts +2 -0
- package/src/storage/sync-runs/idempotency.ts +1 -0
- package/src/storage/sync-runs/in-memory.ts +43 -1
- package/src/storage/sync-runs/index.ts +1 -0
- package/src/storage/sync-runs/types.ts +30 -1
- package/src/syncs/accounts.ts +85 -0
- package/src/syncs/builders.ts +18 -1
- package/src/syncs/connections.ts +123 -0
- package/src/syncs/execution.ts +64 -22
- package/src/syncs/index.ts +3 -0
- package/src/syncs/request.ts +81 -23
- package/src/syncs/run-dispatch.ts +69 -7
- package/src/testing/agent-approval-storage-contract.ts +123 -0
- package/src/testing/agent-execution.ts +45 -2
- package/src/testing/agent-inbox-storage-contract.ts +874 -0
- package/src/testing/agent-storage-contract.ts +965 -103
- package/src/testing/ai-cost-storage-contract.ts +80 -0
- package/src/testing/artifact-storage-contract.ts +201 -4
- package/src/testing/execution-storage-contract.ts +31 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/materializer-storage-contract.ts +139 -1
- package/src/testing/queues-contract.ts +22 -0
- package/src/testing/run-claim-storage-contract.ts +116 -0
- package/src/webhooks/connections.ts +9 -50
- package/src/webhooks/index.ts +0 -2
- package/src/webhooks/types.ts +2 -13
- package/src/workers/README.md +4 -1
- package/src/workers/lost-runs.ts +1 -0
- package/src/workers/queue-worker.ts +16 -5
- package/src/workers/queued-run-dispatch.ts +8 -1
- package/src/workers/worker.ts +67 -7
- package/dist/chunk-3z1vxzcm.js +0 -234
- package/dist/chunk-3z1vxzcm.js.map +0 -12
- package/dist/chunk-48c1z8nj.js.map +0 -10
- package/dist/chunk-58geavnf.js +0 -29
- package/dist/chunk-58geavnf.js.map +0 -10
- package/dist/chunk-5a4a52tq.js.map +0 -10
- package/dist/chunk-9nsjjd44.js.map +0 -12
- package/dist/chunk-b9qfh2ya.js.map +0 -11
- package/dist/chunk-eptrvnby.js.map +0 -12
- package/dist/chunk-f6ahf5gf.js.map +0 -13
- package/dist/chunk-gxwy4c3s.js.map +0 -47
- package/dist/chunk-hvbvq7p4.js.map +0 -18
- package/dist/chunk-m2jerfef.js +0 -474
- package/dist/chunk-m2jerfef.js.map +0 -11
- package/dist/chunk-msyevpp3.js.map +0 -22
- package/dist/chunk-n4zzaf6q.js.map +0 -10
- package/dist/chunk-rsrc7vtw.js.map +0 -49
- package/dist/chunk-rsxb14an.js.map +0 -18
- package/dist/chunk-smnt672s.js.map +0 -10
- package/dist/chunk-t0s7b3d1.js.map +0 -13
- package/dist/chunk-td26wjr5.js.map +0 -13
- package/dist/chunk-vzkxqf8h.js.map +0 -23
- package/dist/chunk-wa05txmk.js.map +0 -11
- package/dist/chunk-yv8hv4wq.js.map +0 -10
- package/dist/chunk-yy914zfr.js.map +0 -30
- package/dist/chunk-zeykm8my.js.map +0 -14
- /package/dist/{chunk-stmxh0hv.js.map → chunk-3neam1y5.js.map} +0 -0
- /package/dist/{chunk-p8pgnq8d.js.map → chunk-425ydk65.js.map} +0 -0
- /package/dist/{chunk-p351afzm.js.map → chunk-5sswe5ej.js.map} +0 -0
- /package/dist/{chunk-e0hnbb1m.js.map → chunk-61zptves.js.map} +0 -0
- /package/dist/{chunk-fe6r7yhg.js.map → chunk-92wrka15.js.map} +0 -0
- /package/dist/{chunk-q9nkpr8k.js.map → chunk-9tpmfh3n.js.map} +0 -0
- /package/dist/{chunk-sysnvjce.js.map → chunk-brhp9d97.js.map} +0 -0
- /package/dist/{chunk-8a8k38tz.js.map → chunk-brybqw5k.js.map} +0 -0
- /package/dist/{chunk-855w9nvw.js.map → chunk-cg7cygfj.js.map} +0 -0
- /package/dist/{chunk-r2psmn42.js.map → chunk-eg6xqef7.js.map} +0 -0
- /package/dist/{chunk-7kpqntgw.js.map → chunk-f05994as.js.map} +0 -0
- /package/dist/{chunk-2bn6813a.js.map → chunk-grt2j5vp.js.map} +0 -0
- /package/dist/{chunk-rtdrm592.js.map → chunk-htdzx40w.js.map} +0 -0
- /package/dist/{chunk-bc3y6gff.js.map → chunk-jka26v8c.js.map} +0 -0
- /package/dist/{chunk-6ef4esq4.js.map → chunk-pqj8vff9.js.map} +0 -0
- /package/dist/{chunk-n68vz95m.js.map → chunk-qbd282aa.js.map} +0 -0
- /package/dist/{chunk-r9rtavg9.js.map → chunk-t19wjmnc.js.map} +0 -0
- /package/dist/{chunk-dhkc9b23.js.map → chunk-v8a1qjzp.js.map} +0 -0
- /package/dist/{chunk-8bns0y68.js.map → chunk-xf76csps.js.map} +0 -0
- /package/dist/{chunk-vepea5c3.js.map → chunk-ym1bqd98.js.map} +0 -0
|
@@ -174,21 +174,55 @@ export function boardElement(source: string, address: string): BoardElement | nu
|
|
|
174
174
|
* words hashed, as the frame serves a board for editing. Nothing else in it changes.
|
|
175
175
|
*/
|
|
176
176
|
export function annotateBoard(source: string): string {
|
|
177
|
+
return annotated(source).source
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** The attributes that mark an element in a board served for editing. */
|
|
181
|
+
function marksOf({ element, node }: Located): Record<string, string> {
|
|
182
|
+
return {
|
|
183
|
+
[BOARD_ADDRESS_ATTRIBUTE]: element.address,
|
|
184
|
+
[BOARD_KIND_ATTRIBUTE]: element.kind,
|
|
185
|
+
...(element.kind === "text" ? { [BOARD_TEXT_ATTRIBUTE]: boardTextHash(textOf(node)) } : {}),
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* A board's source marked for editing, its elements as located in the source it was given, and
|
|
191
|
+
* where each offset of that source moved to once marked.
|
|
192
|
+
*/
|
|
193
|
+
function annotated(source: string): {
|
|
194
|
+
readonly source: string
|
|
195
|
+
readonly found: readonly Located[]
|
|
196
|
+
readonly at: (offset: number) => number
|
|
197
|
+
} {
|
|
198
|
+
const found = located(source)
|
|
177
199
|
const changes: BoardChange[] = []
|
|
178
|
-
for (const
|
|
179
|
-
const index = startTagClose(source, node)
|
|
200
|
+
for (const each of found) {
|
|
201
|
+
const index = startTagClose(source, each.node)
|
|
180
202
|
if (index === null) continue
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
203
|
+
const marks = Object.entries(marksOf(each)).map(
|
|
204
|
+
([name, value]) => `${name}="${escapeAttribute(value)}"`
|
|
205
|
+
)
|
|
206
|
+
changes.push({ index, remove: 0, insert: ` ${marks.join(" ")}` })
|
|
207
|
+
}
|
|
208
|
+
// Each offset moves by what was inserted before it: changes are in source order.
|
|
209
|
+
const shifts: number[] = []
|
|
210
|
+
let total = 0
|
|
211
|
+
for (const change of changes) {
|
|
212
|
+
total += change.insert.length
|
|
213
|
+
shifts.push(total)
|
|
190
214
|
}
|
|
191
|
-
|
|
215
|
+
const at = (offset: number) => {
|
|
216
|
+
let low = 0
|
|
217
|
+
let high = changes.length
|
|
218
|
+
while (low < high) {
|
|
219
|
+
const middle = (low + high) >> 1
|
|
220
|
+
if ((changes[middle] as BoardChange).index < offset) low = middle + 1
|
|
221
|
+
else high = middle
|
|
222
|
+
}
|
|
223
|
+
return offset + (low === 0 ? 0 : (shifts[low - 1] as number))
|
|
224
|
+
}
|
|
225
|
+
return { source: applyBoardEdit(source, changes), found, at }
|
|
192
226
|
}
|
|
193
227
|
|
|
194
228
|
/**
|
|
@@ -196,7 +230,11 @@ export function annotateBoard(source: string): string {
|
|
|
196
230
|
* the inline tags around the rest stay: typing in a bold word keeps it bold.
|
|
197
231
|
*/
|
|
198
232
|
export function setBoardText(source: string, address: string, text: string): BoardEdit {
|
|
199
|
-
|
|
233
|
+
return setText(source, elementAt(source, address, ["text"]).node, text)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/** The edit that makes an element's text `text`, its markup kept. */
|
|
237
|
+
function setText(source: string, node: Element, text: string): BoardEdit {
|
|
200
238
|
const nodes = textNodes(node)
|
|
201
239
|
const before = nodes.map((each) => each.value).join("")
|
|
202
240
|
if (before === text) return []
|
|
@@ -269,6 +307,12 @@ export function setBoardText(source: string, address: string, text: string): Boa
|
|
|
269
307
|
* they saw them: what others changed in it since is kept, merged as the live document merges
|
|
270
308
|
* concurrent edits. Throws when the address names no text any more: the board changed, and the
|
|
271
309
|
* editor reloads it.
|
|
310
|
+
*
|
|
311
|
+
* The frame collapses an element's whitespace as CSS showed it before the reader types, so `base`
|
|
312
|
+
* may be the source's words with each run of whitespace one space, and a space they type shows
|
|
313
|
+
* twice until the next word. When the source's words, so collapsed, are the reader's, their
|
|
314
|
+
* change is made where it falls in the source, whose line breaks and indents stay; a space that
|
|
315
|
+
* would never show is not written.
|
|
272
316
|
*/
|
|
273
317
|
export function mergeBoardText(
|
|
274
318
|
source: string,
|
|
@@ -278,7 +322,61 @@ export function mergeBoardText(
|
|
|
278
322
|
): BoardEdit {
|
|
279
323
|
const { node } = elementAt(source, address, ["text"])
|
|
280
324
|
const live = textOf(node)
|
|
281
|
-
|
|
325
|
+
if (live === base) return setText(source, node, typed)
|
|
326
|
+
|
|
327
|
+
// Merged as the words show, then made where they fall in the source: whatever else changed
|
|
328
|
+
// since, the reader's words never land in an indent.
|
|
329
|
+
const collapsed = collapsedWords(live)
|
|
330
|
+
const shown = collapsedWords(base).text
|
|
331
|
+
const words = collapsedWords(typed).text
|
|
332
|
+
const merged = collapsed.text === shown ? words : mergeText(shown, words, collapsed.text)
|
|
333
|
+
return setText(source, node, changeThrough(live, collapsed.at, collapsed.text, merged))
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/** Whitespace as CSS collapses it: none at either end, and each run between words one space. */
|
|
337
|
+
const WHITESPACE = /[ \t\n\r\f]/
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Words with their whitespace collapsed, and where each position in them is in the words: the
|
|
341
|
+
* position of each character, the first of a run for a collapsed space, and one past the end.
|
|
342
|
+
*/
|
|
343
|
+
function collapsedWords(words: string): { readonly text: string; readonly at: readonly number[] } {
|
|
344
|
+
let text = ""
|
|
345
|
+
const at: number[] = []
|
|
346
|
+
let space = -1
|
|
347
|
+
for (let index = 0; index < words.length; index += 1) {
|
|
348
|
+
const char = words[index] as string
|
|
349
|
+
if (WHITESPACE.test(char)) {
|
|
350
|
+
if (space < 0 && text.length > 0) space = index
|
|
351
|
+
continue
|
|
352
|
+
}
|
|
353
|
+
if (space >= 0) {
|
|
354
|
+
text += " "
|
|
355
|
+
at.push(space)
|
|
356
|
+
space = -1
|
|
357
|
+
}
|
|
358
|
+
text += char
|
|
359
|
+
at.push(index)
|
|
360
|
+
}
|
|
361
|
+
at.push(text.length === 0 ? 0 : (at.at(-1) as number) + 1)
|
|
362
|
+
return { text, at }
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** `words` with the change from `base` to `typed` made where it falls, through `at`. */
|
|
366
|
+
function changeThrough(words: string, at: readonly number[], base: string, typed: string): string {
|
|
367
|
+
let prefix = 0
|
|
368
|
+
const most = Math.min(base.length, typed.length)
|
|
369
|
+
while (prefix < most && base[prefix] === typed[prefix]) prefix += 1
|
|
370
|
+
let suffix = 0
|
|
371
|
+
while (
|
|
372
|
+
suffix < most - prefix &&
|
|
373
|
+
base[base.length - 1 - suffix] === typed[typed.length - 1 - suffix]
|
|
374
|
+
) {
|
|
375
|
+
suffix += 1
|
|
376
|
+
}
|
|
377
|
+
const from = at[prefix] as number
|
|
378
|
+
const to = at[base.length - suffix] as number
|
|
379
|
+
return words.slice(0, from) + typed.slice(prefix, typed.length - suffix) + words.slice(to)
|
|
282
380
|
}
|
|
283
381
|
|
|
284
382
|
/** Replaces an image's picture, its description, or both. */
|
|
@@ -378,10 +476,9 @@ export interface BoardFramePatch {
|
|
|
378
476
|
*/
|
|
379
477
|
export function boardFramePatches(before: string, after: string): BoardFramePatch[] | null {
|
|
380
478
|
if (before === after) return []
|
|
381
|
-
const
|
|
382
|
-
const
|
|
383
|
-
const
|
|
384
|
-
const next = located(afterSource)
|
|
479
|
+
const marked = { before: annotated(before), after: annotated(after) }
|
|
480
|
+
const old = marked.before.found
|
|
481
|
+
const next = marked.after.found
|
|
385
482
|
const same =
|
|
386
483
|
old.length === next.length &&
|
|
387
484
|
old.every(
|
|
@@ -391,20 +488,45 @@ export function boardFramePatches(before: string, after: string): BoardFramePatc
|
|
|
391
488
|
)
|
|
392
489
|
if (!same) return null
|
|
393
490
|
|
|
491
|
+
// What lies wholly before or after the span the two differ in is as it was.
|
|
492
|
+
let from = 0
|
|
493
|
+
const most = Math.min(before.length, after.length)
|
|
494
|
+
while (from < most && before[from] === after[from]) from += 1
|
|
495
|
+
let suffix = 0
|
|
496
|
+
while (
|
|
497
|
+
suffix < most - from &&
|
|
498
|
+
before[before.length - 1 - suffix] === after[after.length - 1 - suffix]
|
|
499
|
+
) {
|
|
500
|
+
suffix += 1
|
|
501
|
+
}
|
|
502
|
+
const to = after.length - suffix
|
|
503
|
+
|
|
394
504
|
const patches: BoardFramePatch[] = []
|
|
395
|
-
for (const [index,
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
const
|
|
505
|
+
for (const [index, located] of next.entries()) {
|
|
506
|
+
const { element, node } = located
|
|
507
|
+
if (element.end <= from || element.start >= to) continue
|
|
508
|
+
const previous = old[index] as Located
|
|
509
|
+
// As the frame holds them: the element's own, and those that mark it.
|
|
510
|
+
const attributes = { ...attributesOf(node), ...marksOf(located) }
|
|
511
|
+
const changed =
|
|
512
|
+
JSON.stringify({ ...attributesOf(previous.node), ...marksOf(previous) }) !==
|
|
513
|
+
JSON.stringify(attributes)
|
|
399
514
|
|
|
400
515
|
// What holds no addressed element is written whole. A box's own words, between its
|
|
401
516
|
// children, are not: the frame loads the board again when they change.
|
|
402
517
|
let html: string | undefined
|
|
403
518
|
if (element.kind === "box") {
|
|
404
|
-
|
|
519
|
+
const own = (side: typeof marked.before, node: Element) =>
|
|
520
|
+
ownContent(side.source, node, side.at)
|
|
521
|
+
if (own(marked.before, previous.node) !== own(marked.after, node)) return null
|
|
405
522
|
} else {
|
|
406
|
-
const inner = innerOf(
|
|
407
|
-
if (
|
|
523
|
+
const inner = innerOf(marked.after.source, node, marked.after.at)
|
|
524
|
+
if (
|
|
525
|
+
inner !== null &&
|
|
526
|
+
innerOf(marked.before.source, previous.node, marked.before.at) !== inner
|
|
527
|
+
) {
|
|
528
|
+
html = inner
|
|
529
|
+
}
|
|
408
530
|
}
|
|
409
531
|
|
|
410
532
|
if (changed || html !== undefined) {
|
|
@@ -463,7 +585,10 @@ function located(source: string): Located[] {
|
|
|
463
585
|
kind,
|
|
464
586
|
start: node.sourceCodeLocation.startOffset,
|
|
465
587
|
end: node.sourceCodeLocation.endOffset,
|
|
466
|
-
|
|
588
|
+
// Read only where it is shown: an edit or a patch never needs it.
|
|
589
|
+
get label() {
|
|
590
|
+
return labelOf(node, kind)
|
|
591
|
+
},
|
|
467
592
|
},
|
|
468
593
|
})
|
|
469
594
|
if (kind !== "box") return
|
|
@@ -483,15 +608,31 @@ function located(source: string): Located[] {
|
|
|
483
608
|
|
|
484
609
|
function kindOf(node: Element): BoardElementKind {
|
|
485
610
|
if (node.tagName === "img") return "image"
|
|
486
|
-
|
|
611
|
+
// A designed document's field shows live data, and a repeated element is copied for it: neither
|
|
612
|
+
// takes typing, and neither does the text around a field, whose words are the field's too.
|
|
613
|
+
if (
|
|
614
|
+
WHOLE.has(node.tagName) ||
|
|
615
|
+
node.namespaceURI !== "http://www.w3.org/1999/xhtml" ||
|
|
616
|
+
isLive(node)
|
|
617
|
+
) {
|
|
487
618
|
return "whole"
|
|
488
619
|
}
|
|
489
|
-
if (!holdsOnlyWords(node)) return "box"
|
|
620
|
+
if (!holdsOnlyWords(node) || holdsField(node)) return "box"
|
|
490
621
|
return textOf(node).trim() !== "" || TEXT_BLOCKS.has(node.tagName) || INLINE.has(node.tagName)
|
|
491
622
|
? "text"
|
|
492
623
|
: "box"
|
|
493
624
|
}
|
|
494
625
|
|
|
626
|
+
function isLive(node: Element): boolean {
|
|
627
|
+
return node.attrs.some(
|
|
628
|
+
(attribute) => attribute.name === "data-sixb-field" || attribute.name === "data-sixb-each"
|
|
629
|
+
)
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
function holdsField(node: Element): boolean {
|
|
633
|
+
return node.childNodes.some((child) => isElement(child) && (isLive(child) || holdsField(child)))
|
|
634
|
+
}
|
|
635
|
+
|
|
495
636
|
/** Whether an element holds only words and the inline tags that format them. */
|
|
496
637
|
function holdsOnlyWords(node: Element): boolean {
|
|
497
638
|
return node.childNodes.every((child) => {
|
|
@@ -644,29 +785,41 @@ function attributesOf(node: Element): Record<string, string> {
|
|
|
644
785
|
return Object.fromEntries(node.attrs.map((attribute) => [attribute.name, attribute.value]))
|
|
645
786
|
}
|
|
646
787
|
|
|
647
|
-
/**
|
|
648
|
-
|
|
788
|
+
/**
|
|
789
|
+
* What an element holds in `source`, between its tags; null for one with no end tag. `at` moves
|
|
790
|
+
* an offset of the source it was located in to one of `source`.
|
|
791
|
+
*/
|
|
792
|
+
function innerOf(
|
|
793
|
+
source: string,
|
|
794
|
+
node: Element,
|
|
795
|
+
at: (offset: number) => number = (offset) => offset
|
|
796
|
+
): string | null {
|
|
649
797
|
const location = node.sourceCodeLocation
|
|
650
798
|
const start = location?.startTag?.endOffset
|
|
651
|
-
const end = location?.endTag?.startOffset
|
|
652
|
-
if (start === undefined) return null
|
|
653
|
-
return source.slice(start, end
|
|
799
|
+
const end = location?.endTag?.startOffset ?? location?.endOffset ?? start
|
|
800
|
+
if (start === undefined || end === undefined) return null
|
|
801
|
+
return source.slice(at(start), at(end))
|
|
654
802
|
}
|
|
655
803
|
|
|
656
|
-
/** What a box holds in
|
|
657
|
-
function ownContent(
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
804
|
+
/** What a box holds in `source` besides its addressed children, `at` as for {@link innerOf}. */
|
|
805
|
+
function ownContent(
|
|
806
|
+
source: string,
|
|
807
|
+
node: Element,
|
|
808
|
+
at: (offset: number) => number = (offset) => offset
|
|
809
|
+
): string | null {
|
|
810
|
+
const location = node.sourceCodeLocation
|
|
811
|
+
const start = location?.startTag?.endOffset
|
|
812
|
+
const end = location?.endTag?.startOffset ?? location?.endOffset ?? start
|
|
813
|
+
if (start === undefined || end === undefined) return null
|
|
661
814
|
|
|
662
815
|
let own = ""
|
|
663
|
-
let
|
|
816
|
+
let from = start
|
|
664
817
|
for (const child of node.childNodes) {
|
|
665
818
|
if (!isElement(child) || UNADDRESSED.has(child.tagName) || !child.sourceCodeLocation) continue
|
|
666
|
-
own += source.slice(at, child.sourceCodeLocation.startOffset)
|
|
667
|
-
|
|
819
|
+
own += source.slice(at(from), at(child.sourceCodeLocation.startOffset))
|
|
820
|
+
from = child.sourceCodeLocation.endOffset
|
|
668
821
|
}
|
|
669
|
-
return own + source.slice(at,
|
|
822
|
+
return own + source.slice(at(from), at(end))
|
|
670
823
|
}
|
|
671
824
|
|
|
672
825
|
function elementAt(source: string, address: string, kinds: readonly BoardElementKind[]): Located {
|
|
@@ -2,7 +2,26 @@ import * as Y from "yjs"
|
|
|
2
2
|
import type { FileRef } from "../../blob-storage/types"
|
|
3
3
|
import { CANVAS_FILE, type CanvasItem, formatCanvas, parseCanvas } from "../canvas"
|
|
4
4
|
import type { ArtifactKind } from "../kinds"
|
|
5
|
+
import {
|
|
6
|
+
blocksFromY,
|
|
7
|
+
blocksToMarkdown,
|
|
8
|
+
fragmentMarkdown,
|
|
9
|
+
markdownFragment,
|
|
10
|
+
mergeMarkdownBlocks,
|
|
11
|
+
patchBlocks,
|
|
12
|
+
patchFragment,
|
|
13
|
+
} from "./blocks"
|
|
5
14
|
import { diffSequences, diffText, interleave, mergeSequences, mergeText } from "./diff"
|
|
15
|
+
import {
|
|
16
|
+
isPageEntry,
|
|
17
|
+
mergePageSources,
|
|
18
|
+
PAGE_BODY,
|
|
19
|
+
pageEntry,
|
|
20
|
+
pageEntryBlocks,
|
|
21
|
+
pageEntryHtml,
|
|
22
|
+
pageHtml,
|
|
23
|
+
patchPageEntry,
|
|
24
|
+
} from "./page"
|
|
6
25
|
|
|
7
26
|
// An artifact's open version as a Yjs document, which everyone editing it changes at once:
|
|
8
27
|
//
|
|
@@ -15,7 +34,11 @@ import { diffSequences, diffText, interleave, mergeSequences, mergeText } from "
|
|
|
15
34
|
// items: Y.Map<id, Y.Map<key, value>> order: Y.Array<id>
|
|
16
35
|
//
|
|
17
36
|
// with each item's words (`text`, `title`, `label`) as `Y.Text`. Two people moving two items, or
|
|
18
|
-
// one moving an item while another types in it, change different keys and never conflict.
|
|
37
|
+
// one moving an item while another types in it, change different keys and never conflict. A
|
|
38
|
+
// Markdown document holds `document.md` as the blocks its editor edits, a `Y.XmlFragment`
|
|
39
|
+
// (`./blocks`), so typing in one paragraph and moving another merge as block edits do. A designed
|
|
40
|
+
// document holds `document.html` as a page, its body's blocks a `Y.XmlFragment` too (`./page`),
|
|
41
|
+
// unless its source is not one an editor can hold whole: then it is text.
|
|
19
42
|
|
|
20
43
|
/** One file of an artifact as the live layer reads it: its text, or its stored bytes. */
|
|
21
44
|
export type LiveFile = { readonly text: string } | { readonly file: FileRef }
|
|
@@ -53,9 +76,15 @@ export function isLiveTextPath(path: string): boolean {
|
|
|
53
76
|
/** The item keys of a canvas held as `Y.Text`: words that people type. */
|
|
54
77
|
const CANVAS_TEXT_KEYS: ReadonlySet<string> = new Set(["text", "title", "label"])
|
|
55
78
|
|
|
79
|
+
/** A Markdown document's entry, which it holds as blocks. */
|
|
80
|
+
const MARKDOWN_ENTRY = "document.md"
|
|
81
|
+
/** A designed document's entry, which it holds as a page. */
|
|
82
|
+
const PAGE_ENTRY = "document.html"
|
|
83
|
+
|
|
56
84
|
/** The file a kind holds as a structure, if it holds one. */
|
|
57
85
|
function structuredPath(kind: ArtifactKind): string | undefined {
|
|
58
|
-
|
|
86
|
+
if (kind === "canvas") return CANVAS_FILE
|
|
87
|
+
return kind === "document" ? MARKDOWN_ENTRY : undefined
|
|
59
88
|
}
|
|
60
89
|
|
|
61
90
|
/**
|
|
@@ -95,13 +124,91 @@ export function documentKind(doc: Y.Doc): ArtifactKind {
|
|
|
95
124
|
export function documentFiles(doc: Y.Doc): Map<string, LiveFile> {
|
|
96
125
|
const files = new Map<string, LiveFile>()
|
|
97
126
|
doc.getMap<unknown>(LIVE_FILES).forEach((entry, path) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
else files.set(path, { file: entry as FileRef })
|
|
127
|
+
const text = textOf(entry)
|
|
128
|
+
files.set(path, text === undefined ? { file: entry as FileRef } : { text })
|
|
101
129
|
})
|
|
102
130
|
return new Map([...files].sort(([left], [right]) => (left < right ? -1 : 1)))
|
|
103
131
|
}
|
|
104
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Makes `change` to a document, then reads back what it touched as `documentFiles` would, and
|
|
135
|
+
* throws where that would: a keystroke reads back the block it is in, not the whole document.
|
|
136
|
+
* A file replaced, or anything but a block of a page or of a Markdown document, is read whole.
|
|
137
|
+
*/
|
|
138
|
+
export function readChange(doc: Y.Doc, change: () => void): void {
|
|
139
|
+
const files = doc.getMap<unknown>(LIVE_FILES)
|
|
140
|
+
// What each event changed, read as it fires: Yjs reads an event's changes then, or never.
|
|
141
|
+
const changes: {
|
|
142
|
+
readonly target: Y.AbstractType<unknown>
|
|
143
|
+
readonly keys: readonly string[]
|
|
144
|
+
readonly inserted: readonly unknown[]
|
|
145
|
+
}[] = []
|
|
146
|
+
const collect = (events: Y.YEvent<Y.AbstractType<unknown>>[]) => {
|
|
147
|
+
for (const event of events) {
|
|
148
|
+
changes.push({
|
|
149
|
+
target: event.target,
|
|
150
|
+
keys: event.target === files ? [...(event as Y.YMapEvent<unknown>).keysChanged] : [],
|
|
151
|
+
inserted:
|
|
152
|
+
event.target instanceof Y.XmlFragment
|
|
153
|
+
? event.changes.delta.flatMap((part) => (Array.isArray(part.insert) ? part.insert : []))
|
|
154
|
+
: [],
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
files.observeDeep(collect)
|
|
159
|
+
try {
|
|
160
|
+
change()
|
|
161
|
+
} finally {
|
|
162
|
+
files.unobserveDeep(collect)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const whole = new Set<string>()
|
|
166
|
+
const blocks = new Map<Y.XmlFragment, Set<Y.XmlElement | Y.XmlText>>()
|
|
167
|
+
const blockOf = (fragment: Y.XmlFragment, child: unknown) => {
|
|
168
|
+
if (!(child instanceof Y.XmlElement || child instanceof Y.XmlText)) return
|
|
169
|
+
const set = blocks.get(fragment) ?? new Set()
|
|
170
|
+
set.add(child)
|
|
171
|
+
blocks.set(fragment, set)
|
|
172
|
+
}
|
|
173
|
+
for (const { target, keys, inserted } of changes) {
|
|
174
|
+
if (target === files) {
|
|
175
|
+
for (const key of keys) whole.add(key)
|
|
176
|
+
continue
|
|
177
|
+
}
|
|
178
|
+
// The file the change is in, the fragment of blocks it holds, and the block it is in.
|
|
179
|
+
const path: Y.AbstractType<unknown>[] = []
|
|
180
|
+
for (let type: Y.AbstractType<unknown> | null = target; type && type !== files; ) {
|
|
181
|
+
path.unshift(type)
|
|
182
|
+
type = type.parent as Y.AbstractType<unknown> | null
|
|
183
|
+
}
|
|
184
|
+
const [entry] = path
|
|
185
|
+
const key = entry?._item?.parentSub
|
|
186
|
+
if (!entry || typeof key !== "string") continue
|
|
187
|
+
const fragment =
|
|
188
|
+
entry instanceof Y.XmlFragment
|
|
189
|
+
? entry
|
|
190
|
+
: isPageEntry(entry)
|
|
191
|
+
? (entry.get(PAGE_BODY) as Y.XmlFragment)
|
|
192
|
+
: null
|
|
193
|
+
const at = fragment ? path.indexOf(fragment as unknown as Y.AbstractType<unknown>) : -1
|
|
194
|
+
if (!fragment || at < 0) {
|
|
195
|
+
whole.add(key)
|
|
196
|
+
} else if (target === fragment) {
|
|
197
|
+
// Blocks added: each is read; one taken out is not there to read.
|
|
198
|
+
for (const child of inserted) blockOf(fragment, child)
|
|
199
|
+
} else {
|
|
200
|
+
blockOf(fragment, path[at + 1])
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
for (const key of whole) textOf(files.get(key))
|
|
205
|
+
for (const [fragment, children] of blocks) {
|
|
206
|
+
const content = blocksFromY([...children].filter((child) => child.parent === fragment))
|
|
207
|
+
if (isPageEntry(fragment.parent)) pageHtml({ head: "", blocks: content, tail: "" })
|
|
208
|
+
else blocksToMarkdown({ type: "doc", content })
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
105
212
|
/** The canvas a document holds as its structure, for a viewer to read and edit; null without. */
|
|
106
213
|
export function documentCanvas(
|
|
107
214
|
doc: Y.Doc
|
|
@@ -147,6 +254,39 @@ export function mergeIntoDocument(
|
|
|
147
254
|
const currentText = textOf(current)
|
|
148
255
|
const baseText = before && "text" in before ? before.text : currentText
|
|
149
256
|
|
|
257
|
+
if (current instanceof Y.XmlFragment) {
|
|
258
|
+
// Unchanged since the write's files, it takes the write's blocks. Else the two are merged
|
|
259
|
+
// as blocks: how the Agent writes its Markdown, which need not be how the document's
|
|
260
|
+
// blocks write it, is no change.
|
|
261
|
+
if (currentText === baseText) patchFragment(current, file.text)
|
|
262
|
+
else {
|
|
263
|
+
patchBlocks(
|
|
264
|
+
current,
|
|
265
|
+
mergeMarkdownBlocks(baseText ?? "", blocksFromY(current.toArray()), file.text)
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
continue
|
|
269
|
+
}
|
|
270
|
+
const page = kind === "document" && path === PAGE_ENTRY
|
|
271
|
+
if (isPageEntry(current) || (page && current instanceof Y.Text)) {
|
|
272
|
+
// Merged block by block while every side is a page, else as text. A page whose merged
|
|
273
|
+
// source an editor cannot hold whole is text from then on, and text that reads as a page
|
|
274
|
+
// is held as one again.
|
|
275
|
+
const merged =
|
|
276
|
+
mergePageSources(
|
|
277
|
+
baseText ?? "",
|
|
278
|
+
isPageEntry(current) ? pageEntryBlocks(current) : (currentText ?? ""),
|
|
279
|
+
file.text
|
|
280
|
+
) ?? mergeText(baseText ?? "", currentText ?? "", file.text)
|
|
281
|
+
if (isPageEntry(current)) {
|
|
282
|
+
if (!patchPageEntry(current, merged)) files.set(path, new Y.Text(merged))
|
|
283
|
+
} else {
|
|
284
|
+
const entry = pageEntry(merged)
|
|
285
|
+
if (entry) files.set(path, entry)
|
|
286
|
+
else patchText(current as Y.Text, merged)
|
|
287
|
+
}
|
|
288
|
+
continue
|
|
289
|
+
}
|
|
150
290
|
if (path === structured) {
|
|
151
291
|
if (current instanceof Y.Map && mergeCanvas(current, baseText ?? "", file.text)) continue
|
|
152
292
|
} else if (current instanceof Y.Text) {
|
|
@@ -162,10 +302,33 @@ export function mergeIntoDocument(
|
|
|
162
302
|
}, origin)
|
|
163
303
|
}
|
|
164
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Holds as a page a designed document's `document.html` that a document kept as text, from before
|
|
307
|
+
* documents held pages, once it reads as one. Made as `clientID`, named by what the document is
|
|
308
|
+
* made from, so that every server loading it makes the same change.
|
|
309
|
+
*/
|
|
310
|
+
export function holdPage(doc: Y.Doc, clientID: number): void {
|
|
311
|
+
if (doc.getMap(LIVE_ARTIFACT).get("kind") !== "document") return
|
|
312
|
+
const entry = doc.getMap<unknown>(LIVE_FILES).get(PAGE_ENTRY)
|
|
313
|
+
if (!(entry instanceof Y.Text)) return
|
|
314
|
+
const page = pageEntry(entry.toString())
|
|
315
|
+
if (!page) return
|
|
316
|
+
const made = new Y.Doc()
|
|
317
|
+
made.clientID = clientID
|
|
318
|
+
Y.applyUpdate(made, Y.encodeStateAsUpdate(doc))
|
|
319
|
+
const before = Y.encodeStateVector(made)
|
|
320
|
+
made.getMap<unknown>(LIVE_FILES).set(PAGE_ENTRY, page)
|
|
321
|
+
Y.applyUpdate(doc, Y.encodeStateAsUpdate(made, before))
|
|
322
|
+
made.destroy()
|
|
323
|
+
}
|
|
324
|
+
|
|
165
325
|
/** What a document's entry is for a file: a structure, a text, or a reference. */
|
|
166
326
|
function entryOf(kind: ArtifactKind, path: string, file: LiveFile): unknown {
|
|
167
327
|
if ("file" in file) return { ...file.file }
|
|
328
|
+
if (kind === "document" && path === PAGE_ENTRY)
|
|
329
|
+
return pageEntry(file.text) ?? new Y.Text(file.text)
|
|
168
330
|
if (path === structuredPath(kind)) {
|
|
331
|
+
if (kind === "document") return markdownFragment(file.text)
|
|
169
332
|
const parsed = parseCanvas(file.text)
|
|
170
333
|
if ("canvas" in parsed) return canvasStructure(parsed.canvas.items)
|
|
171
334
|
}
|
|
@@ -174,7 +337,9 @@ function entryOf(kind: ArtifactKind, path: string, file: LiveFile): unknown {
|
|
|
174
337
|
|
|
175
338
|
function textOf(entry: unknown): string | undefined {
|
|
176
339
|
if (entry instanceof Y.Text) return entry.toString()
|
|
340
|
+
if (isPageEntry(entry)) return pageEntryHtml(entry)
|
|
177
341
|
if (entry instanceof Y.Map) return canvasText(entry)
|
|
342
|
+
if (entry instanceof Y.XmlFragment) return fragmentMarkdown(entry)
|
|
178
343
|
return undefined
|
|
179
344
|
}
|
|
180
345
|
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
* the `/ws/artifacts` socket that keeps it in step. Browser-safe.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
export {
|
|
8
|
+
type BlockMark,
|
|
9
|
+
type BlockNode,
|
|
10
|
+
blocksToMarkdown,
|
|
11
|
+
markdownToBlocks,
|
|
12
|
+
} from "./blocks"
|
|
7
13
|
export {
|
|
8
14
|
annotateBoard,
|
|
9
15
|
applyBoardEditToText,
|
|
@@ -33,6 +39,7 @@ export {
|
|
|
33
39
|
type LiveFiles,
|
|
34
40
|
mergeCanvasItem,
|
|
35
41
|
} from "./document"
|
|
42
|
+
export { isPageEntry, PAGE_BODY, PAGE_MARK_TAGS, PAGE_TEXT_TAGS, pageEntryHtml } from "./page"
|
|
36
43
|
export {
|
|
37
44
|
AGENT_AWARENESS_FIELD,
|
|
38
45
|
ARTIFACT_LIVE_ROUTE,
|