@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
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { Broker, BrokerRecord } from "../../broker"
|
|
2
|
+
import type { ModelUiChunk } from "../../models/events"
|
|
3
|
+
import {
|
|
4
|
+
type AgentRunStepsEvent,
|
|
5
|
+
type AgentRunStepsRead,
|
|
6
|
+
type AgentRunStreamEvent,
|
|
7
|
+
agentRunStepsStreamId,
|
|
8
|
+
isAgentRunStreamEvent,
|
|
9
|
+
} from "./protocol"
|
|
10
|
+
|
|
11
|
+
// A run's live stream carries one record per streamed delta, and drops its oldest past a limit: on
|
|
12
|
+
// its own it cannot rebuild a long turn. Its finished steps go to a stream of their own as well
|
|
13
|
+
// (see the stream sink), which a reader who opens the turn late reads first.
|
|
14
|
+
|
|
15
|
+
export type DeltaChunk = Extract<
|
|
16
|
+
ModelUiChunk,
|
|
17
|
+
{ readonly type: "text-delta" | "reasoning-delta" | "tool-input-delta" }
|
|
18
|
+
>
|
|
19
|
+
|
|
20
|
+
export function isDeltaChunk(chunk: ModelUiChunk): chunk is DeltaChunk {
|
|
21
|
+
return (
|
|
22
|
+
chunk.type === "text-delta" ||
|
|
23
|
+
chunk.type === "reasoning-delta" ||
|
|
24
|
+
chunk.type === "tool-input-delta"
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Whether `next` extends `delta`'s span, so the two read as one delta. */
|
|
29
|
+
export function continuesDelta(delta: DeltaChunk, next: ModelUiChunk): next is DeltaChunk {
|
|
30
|
+
if (next.type !== delta.type) return false
|
|
31
|
+
if (delta.type === "tool-input-delta") {
|
|
32
|
+
return next.type === "tool-input-delta" && next.toolCallId === delta.toolCallId
|
|
33
|
+
}
|
|
34
|
+
return (next as { readonly id?: string }).id === delta.id
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function mergeDeltas(delta: DeltaChunk, next: DeltaChunk): DeltaChunk {
|
|
38
|
+
if (delta.type === "tool-input-delta" && next.type === "tool-input-delta") {
|
|
39
|
+
return { ...delta, inputTextDelta: delta.inputTextDelta + next.inputTextDelta }
|
|
40
|
+
}
|
|
41
|
+
if (delta.type !== "tool-input-delta" && next.type !== "tool-input-delta") {
|
|
42
|
+
return { ...delta, delta: delta.delta + next.delta }
|
|
43
|
+
}
|
|
44
|
+
return delta
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Appends `chunk`, merged into the last chunk when it extends the same span. */
|
|
48
|
+
export function appendCompacted(chunks: ModelUiChunk[], chunk: ModelUiChunk): void {
|
|
49
|
+
const last = chunks.at(-1)
|
|
50
|
+
if (last && isDeltaChunk(last) && continuesDelta(last, chunk)) {
|
|
51
|
+
chunks[chunks.length - 1] = mergeDeltas(last, chunk)
|
|
52
|
+
return
|
|
53
|
+
}
|
|
54
|
+
chunks.push(chunk)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A run's finished steps for one attempt, as one event, or null when none finished yet. Records of
|
|
59
|
+
* an earlier attempt are left out: that attempt's work was redone.
|
|
60
|
+
*/
|
|
61
|
+
export async function readAgentRunSteps(
|
|
62
|
+
broker: Broker,
|
|
63
|
+
params: { readonly projectId: string; readonly runId: string; readonly attempt: number }
|
|
64
|
+
): Promise<AgentRunStepsEvent | null> {
|
|
65
|
+
const streamId = agentRunStepsStreamId(params.runId)
|
|
66
|
+
const records: BrokerRecord[] = []
|
|
67
|
+
let afterCursor: string | undefined
|
|
68
|
+
for (;;) {
|
|
69
|
+
const page = await broker.read({
|
|
70
|
+
projectId: params.projectId,
|
|
71
|
+
streamId,
|
|
72
|
+
...(afterCursor === undefined ? {} : { afterCursor }),
|
|
73
|
+
limit: 1_000,
|
|
74
|
+
})
|
|
75
|
+
records.push(...page.records)
|
|
76
|
+
afterCursor = page.cursor ?? afterCursor
|
|
77
|
+
if (!page.hasMore || page.records.length === 0) break
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let last: AgentRunStepsEvent | null = null
|
|
81
|
+
const chunks: ModelUiChunk[] = []
|
|
82
|
+
const reads: AgentRunStepsRead[] = []
|
|
83
|
+
for (const record of records) {
|
|
84
|
+
const event = record.payload as unknown
|
|
85
|
+
if (!isStepsEvent(event) || event.attempt !== params.attempt) continue
|
|
86
|
+
|
|
87
|
+
// Each step's reads keep their place among its chunks once the steps are joined.
|
|
88
|
+
const offset = chunks.length
|
|
89
|
+
const stepReads = event.reads ?? []
|
|
90
|
+
for (const read of stepReads) reads.push({ ...read, at: read.at + offset })
|
|
91
|
+
|
|
92
|
+
event.chunks.forEach((chunk, index) => {
|
|
93
|
+
// A chunk right after a read is not merged into the one before it: the read sits between.
|
|
94
|
+
const afterRead = reads.at(-1)?.at === offset + index
|
|
95
|
+
if (afterRead || index > 0) chunks.push(chunk)
|
|
96
|
+
else appendCompacted(chunks, chunk)
|
|
97
|
+
})
|
|
98
|
+
last = event
|
|
99
|
+
}
|
|
100
|
+
if (last === null) return null
|
|
101
|
+
|
|
102
|
+
const { reads: _lastReads, ...base } = last
|
|
103
|
+
return { ...base, chunks, ...(reads.length === 0 ? {} : { reads }) }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function isStepsEvent(value: unknown): value is AgentRunStepsEvent {
|
|
107
|
+
return isAgentRunStreamEvent(value) && (value as AgentRunStreamEvent).type === "agent.ui.steps"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Whether a live record is a chunk or a read that `steps` already holds. */
|
|
111
|
+
export function coveredBySteps(steps: AgentRunStepsEvent, payload: unknown): boolean {
|
|
112
|
+
if (typeof payload !== "object" || payload === null) return false
|
|
113
|
+
const event = payload as {
|
|
114
|
+
readonly type?: unknown
|
|
115
|
+
readonly attempt?: unknown
|
|
116
|
+
readonly chunkIndex?: unknown
|
|
117
|
+
readonly afterChunkIndex?: unknown
|
|
118
|
+
}
|
|
119
|
+
if (event.attempt !== steps.attempt) return false
|
|
120
|
+
|
|
121
|
+
if (event.type === "agent.ui.chunk") {
|
|
122
|
+
return typeof event.chunkIndex === "number" && event.chunkIndex <= steps.throughChunkIndex
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// A read before the turn's first chunk opens its first step, which every steps event holds.
|
|
126
|
+
if (event.type === "agent.inbox.read") {
|
|
127
|
+
const after = typeof event.afterChunkIndex === "number" ? event.afterChunkIndex : -1
|
|
128
|
+
return after <= steps.throughChunkIndex
|
|
129
|
+
}
|
|
130
|
+
return false
|
|
131
|
+
}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { type Principal, principalsEqual, SYSTEM_PRINCIPAL, type UserPrincipal } from "../auth"
|
|
2
2
|
import { isRuntimeAllowed } from "../authorization"
|
|
3
3
|
import type { resolveRuntimeAuthorizationForProject } from "../execution/authorization"
|
|
4
|
+
import type { AuthorizablePrincipal } from "../execution/types"
|
|
4
5
|
import type { SixbRuntimeContext } from "../runtime/types"
|
|
5
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
AgentRunFailureCode,
|
|
8
|
+
AgentRunFinishReason,
|
|
9
|
+
AgentRunRecord,
|
|
10
|
+
AgentRunStatus,
|
|
11
|
+
AgentStorage,
|
|
12
|
+
AgentThreadRecord,
|
|
13
|
+
} from "../storage/agents"
|
|
6
14
|
import { AgentRequestError } from "./errors"
|
|
7
15
|
|
|
8
16
|
/** How the caller takes part in a conversation: its owner, or a user its owner added. */
|
|
@@ -15,9 +23,56 @@ export interface AgentThreadParticipant {
|
|
|
15
23
|
readonly addedBy: Principal
|
|
16
24
|
}
|
|
17
25
|
|
|
18
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* How far the caller's reading of a thread has reached, and what arrived past it. Reading on one
|
|
28
|
+
* device clears it on every other.
|
|
29
|
+
*/
|
|
30
|
+
export interface AgentThreadReadView {
|
|
31
|
+
readonly threadId: string
|
|
32
|
+
/** The seq of the last message their reading reached; 0 when it reached none. */
|
|
33
|
+
readonly throughSeq: number
|
|
34
|
+
/** The seq of the thread's newest message, 0 when it has none. */
|
|
35
|
+
readonly headSeq: number
|
|
36
|
+
/**
|
|
37
|
+
* Messages past `throughSeq` that someone else wrote: the Agent's answers and other people's
|
|
38
|
+
* messages. Their own messages are not new to them, nor is a message that only reports how
|
|
39
|
+
* approved calls ended.
|
|
40
|
+
*/
|
|
41
|
+
readonly unread: number
|
|
42
|
+
/** When they last marked the thread read, even where their place did not move. */
|
|
43
|
+
readonly readAt?: Date
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The thread's newest run, enough for a client to offer Continue or Retry without reading it. */
|
|
47
|
+
export interface AgentThreadLastRunView {
|
|
48
|
+
readonly id: string
|
|
49
|
+
readonly status: AgentRunStatus
|
|
50
|
+
readonly finishReason?: AgentRunFinishReason
|
|
51
|
+
/** Why it failed, when it did. */
|
|
52
|
+
readonly errorCode?: AgentRunFailureCode
|
|
53
|
+
readonly completedAt?: Date
|
|
54
|
+
/**
|
|
55
|
+
* Who asked for it, when it ended short (failed, timed out or interrupted): only they can run it
|
|
56
|
+
* again, as it runs with their rights.
|
|
57
|
+
*/
|
|
58
|
+
readonly requestedBy?: AuthorizablePrincipal
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A run that stopped before its answer: it failed, timed out, or its worker went away. */
|
|
62
|
+
export function agentRunEndedShort(run: Pick<AgentRunRecord, "status" | "finishReason">): boolean {
|
|
63
|
+
if (run.status === "failed") return true
|
|
64
|
+
return run.finishReason === "timeout" || run.finishReason === "interrupted"
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A thread as the runtime returns it: the stored record with the users taking part in it, the
|
|
69
|
+
* caller's place in it, and its newest run. `read` is absent for an observer, and for system code,
|
|
70
|
+
* which is nobody's reading.
|
|
71
|
+
*/
|
|
19
72
|
export interface AgentThreadView extends AgentThreadRecord {
|
|
20
73
|
readonly participants: readonly AgentThreadParticipant[]
|
|
74
|
+
readonly read?: AgentThreadReadView
|
|
75
|
+
readonly lastRun?: AgentThreadLastRunView
|
|
21
76
|
}
|
|
22
77
|
|
|
23
78
|
/** A thread the caller can read, and how it takes part in it. */
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { isJsonObject } from "../json"
|
|
2
|
+
import type { AgentRunRecord, AgentStorage } from "../storage/agents"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether the turn answered: it succeeded without asking a question the requester answers next.
|
|
6
|
+
* Only after one does a message queued for later start; after any other end, only one sent now.
|
|
7
|
+
*/
|
|
8
|
+
export async function turnAnsweredEveryMessage(
|
|
9
|
+
agents: AgentStorage,
|
|
10
|
+
run: AgentRunRecord
|
|
11
|
+
): Promise<boolean> {
|
|
12
|
+
if (run.status !== "succeeded") return false
|
|
13
|
+
const { messages } = await agents.messages.list({
|
|
14
|
+
projectId: run.projectId,
|
|
15
|
+
threadId: run.threadId,
|
|
16
|
+
roles: ["assistant"],
|
|
17
|
+
order: "desc",
|
|
18
|
+
limit: 1,
|
|
19
|
+
})
|
|
20
|
+
const answer = messages[0]
|
|
21
|
+
if (!answer || answer.runId !== run.id) return true
|
|
22
|
+
// `ask` answers `{ status: "asked" }`: the requester's next message is their answer, so a message
|
|
23
|
+
// they queued instead is not one.
|
|
24
|
+
return !answer.parts.some(
|
|
25
|
+
(part) =>
|
|
26
|
+
part.type === "tool-call" &&
|
|
27
|
+
part.state === "output-available" &&
|
|
28
|
+
isJsonObject(part.output) &&
|
|
29
|
+
part.output.status === "asked"
|
|
30
|
+
)
|
|
31
|
+
}
|
package/src/agents/validation.ts
CHANGED
|
@@ -34,16 +34,14 @@ export function canvasShapeFontSize(width: number, height: number): number {
|
|
|
34
34
|
export const SMALL_BOARD_PREVIEW_WIDTH = 480
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* How the
|
|
38
|
-
*
|
|
39
|
-
* within its 120 seconds; each attempt within `timeoutMs`, up to `attempts`, `backoffMs` apart.
|
|
37
|
+
* How the render worker renders a canvas's missing previews: `settleMs` after the last write that
|
|
38
|
+
* asked; each attempt within `timeoutMs`, up to `attempts`, `backoffMs` apart.
|
|
40
39
|
*
|
|
41
40
|
* `settleMs` is longer than a live canvas waits between two write-backs (`SAVE_MAX_MS` in the
|
|
42
41
|
* server's live rooms), so someone typing in a board is rendered once they pause.
|
|
43
42
|
*/
|
|
44
43
|
export const BOARD_PREVIEW_JOB = {
|
|
45
44
|
settleMs: 15_000,
|
|
46
|
-
graceMs: 180_000,
|
|
47
45
|
timeoutMs: 5 * 60_000,
|
|
48
46
|
attempts: 3,
|
|
49
47
|
backoffMs: 60_000,
|
|
@@ -51,11 +49,11 @@ export const BOARD_PREVIEW_JOB = {
|
|
|
51
49
|
|
|
52
50
|
/**
|
|
53
51
|
* How long after a canvas version is published a missing board preview is still worth waiting
|
|
54
|
-
* for: the job's
|
|
52
|
+
* for: the job's settling, then every one of its attempts and the waits between them. Past it,
|
|
55
53
|
* nothing more will come, so the server says so and a viewer stops asking.
|
|
56
54
|
*/
|
|
57
55
|
export const BOARD_PREVIEW_WAIT_MS =
|
|
58
|
-
BOARD_PREVIEW_JOB.
|
|
56
|
+
BOARD_PREVIEW_JOB.settleMs +
|
|
59
57
|
BOARD_PREVIEW_JOB.attempts * BOARD_PREVIEW_JOB.timeoutMs +
|
|
60
58
|
(BOARD_PREVIEW_JOB.attempts - 1) * BOARD_PREVIEW_JOB.backoffMs
|
|
61
59
|
|
|
@@ -19,6 +19,10 @@ import { ARTIFACT_COMMENT_LIMITS } from "./limits"
|
|
|
19
19
|
// Comments on an artifact: whoever reads it reads and adds them, a shared link's guest included;
|
|
20
20
|
// their author, or whoever may change the artifact, resolves or deletes them, and only the latter a
|
|
21
21
|
// guest's. Each change is announced to its readers.
|
|
22
|
+
//
|
|
23
|
+
// A thread is the team's unless a guest started it. A guest reads only the threads started by a
|
|
24
|
+
// guest of the same link, themselves or whoever else opened it, with every reply, a member's
|
|
25
|
+
// included: the team's threads are missing to them, as if there were none.
|
|
22
26
|
|
|
23
27
|
/** A comment to add, or a reply. */
|
|
24
28
|
export interface ArtifactCommentInput {
|
|
@@ -38,18 +42,22 @@ export interface ArtifactCommentInput {
|
|
|
38
42
|
|
|
39
43
|
/** The comment methods of the artifacts runtime. */
|
|
40
44
|
export interface ArtifactCommentsRuntime {
|
|
41
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Every comment and reply the caller reads, oldest first: a shared link's guest, only its link's
|
|
47
|
+
* threads. `null` when the caller cannot read the artifact.
|
|
48
|
+
*/
|
|
42
49
|
listComments(artifactId: string): Promise<ArtifactCommentRecord[] | null>
|
|
43
50
|
/**
|
|
44
51
|
* Adds a comment, or a reply, authored by the caller, who must read the artifact. A shared link's
|
|
45
52
|
* guest writes it under the name they gave, and is refused with `name_required` until they give
|
|
46
53
|
* one. Throws `invalid_comment` for words or an anchor that will not do, `comment_not_found` for
|
|
47
|
-
* a reply to no comment, and `comments_full`.
|
|
54
|
+
* a reply to no comment the caller reads, and `comments_full`.
|
|
48
55
|
*/
|
|
49
56
|
addComment(artifactId: string, input: ArtifactCommentInput): Promise<ArtifactCommentRecord>
|
|
50
57
|
/**
|
|
51
58
|
* Marks a comment resolved, or opens it again. Its author or whoever may change the artifact
|
|
52
|
-
* may: anyone else, and every guest, is refused with `not_allowed
|
|
59
|
+
* may: anyone else, and every guest, is refused with `not_allowed`, or `comment_not_found` for a
|
|
60
|
+
* guest's comment they do not read.
|
|
53
61
|
*/
|
|
54
62
|
resolveComment(
|
|
55
63
|
artifactId: string,
|
|
@@ -72,11 +80,29 @@ export function createArtifactCommentsRuntime(input: {
|
|
|
72
80
|
readonly author: () => Promise<ArtifactCommentAuthor>
|
|
73
81
|
/** Who resolves or deletes one; throws `not_allowed` for a caller who never may. */
|
|
74
82
|
readonly manager: () => Principal
|
|
83
|
+
/**
|
|
84
|
+
* For a shared link's guest, the link they came through, by its grant: they read only the
|
|
85
|
+
* threads its guests started. Without it, a member reads every thread.
|
|
86
|
+
*/
|
|
87
|
+
readonly guest?: { readonly grantId?: string }
|
|
75
88
|
readonly reach: (
|
|
76
89
|
artifactId: string
|
|
77
90
|
) => Promise<{ readonly artifact: ArtifactRecord; readonly access: ArtifactAccess } | null>
|
|
78
91
|
}): ArtifactCommentsRuntime {
|
|
79
|
-
const { projectId, events } = input
|
|
92
|
+
const { projectId, events, guest } = input
|
|
93
|
+
|
|
94
|
+
/** The thread a comment is in: the comment itself, or the one it replies to. */
|
|
95
|
+
const threadOf = (comment: ArtifactCommentRecord) =>
|
|
96
|
+
comment.parentId === undefined
|
|
97
|
+
? Promise.resolve(comment)
|
|
98
|
+
: input
|
|
99
|
+
.storage()
|
|
100
|
+
.getComment({ projectId, artifactId: comment.artifactId, id: comment.parentId })
|
|
101
|
+
|
|
102
|
+
/** Whether the caller reads this thread: a member every one, a guest only its link's. */
|
|
103
|
+
const reads = (thread: ArtifactCommentRecord | null): thread is ArtifactCommentRecord =>
|
|
104
|
+
thread !== null &&
|
|
105
|
+
(!guest || (guest.grantId !== undefined && threadLink(thread) === guest.grantId))
|
|
80
106
|
|
|
81
107
|
/** The artifact the caller reads; refused with why otherwise. */
|
|
82
108
|
const readable = async (artifactId: string) => {
|
|
@@ -91,12 +117,16 @@ export function createArtifactCommentsRuntime(input: {
|
|
|
91
117
|
return reached
|
|
92
118
|
}
|
|
93
119
|
|
|
94
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* A comment the caller may resolve or delete, with its thread: theirs, or one on an artifact they
|
|
122
|
+
* may change. One in a thread they do not read is missing.
|
|
123
|
+
*/
|
|
95
124
|
const managed = async (artifactId: string, commentId: string) => {
|
|
96
125
|
const { access } = await readable(artifactId)
|
|
97
|
-
const manager = input.manager()
|
|
98
126
|
const comment = await input.storage().getComment({ projectId, artifactId, id: commentId })
|
|
99
|
-
|
|
127
|
+
const thread = comment ? await threadOf(comment) : null
|
|
128
|
+
if (!comment || !reads(thread)) throw commentNotFound(artifactId, commentId)
|
|
129
|
+
const manager = input.manager()
|
|
100
130
|
|
|
101
131
|
// A guest's comment is managed by those who may change the artifact, never by a guest.
|
|
102
132
|
const changes = access === "owner" || access === "update"
|
|
@@ -107,14 +137,23 @@ export function createArtifactCommentsRuntime(input: {
|
|
|
107
137
|
"[Sixb] Only a comment's author, or whoever may change the artifact, resolves or deletes it."
|
|
108
138
|
)
|
|
109
139
|
}
|
|
110
|
-
return comment
|
|
140
|
+
return { comment, thread }
|
|
111
141
|
}
|
|
112
142
|
|
|
113
143
|
return {
|
|
114
144
|
async listComments(artifactId) {
|
|
115
145
|
const reached = await input.reach(artifactId)
|
|
116
146
|
if (!reached || reached.access === "none") return null
|
|
117
|
-
|
|
147
|
+
|
|
148
|
+
const comments = await input.storage().listComments({ projectId, id: artifactId })
|
|
149
|
+
if (!guest) return comments
|
|
150
|
+
|
|
151
|
+
const threads = new Set(
|
|
152
|
+
comments
|
|
153
|
+
.filter((comment) => comment.parentId === undefined && reads(comment))
|
|
154
|
+
.map((comment) => comment.id)
|
|
155
|
+
)
|
|
156
|
+
return comments.filter((comment) => threads.has(comment.parentId ?? comment.id))
|
|
118
157
|
},
|
|
119
158
|
|
|
120
159
|
async addComment(artifactId, comment) {
|
|
@@ -129,11 +168,12 @@ export function createArtifactCommentsRuntime(input: {
|
|
|
129
168
|
)
|
|
130
169
|
}
|
|
131
170
|
|
|
132
|
-
// A reply is about what it replies to.
|
|
171
|
+
// A reply is about what it replies to, in a thread the caller reads.
|
|
133
172
|
let anchor: ArtifactCommentAnchor
|
|
173
|
+
let parent: ArtifactCommentRecord | null = null
|
|
134
174
|
if (comment.parentId !== undefined) {
|
|
135
|
-
|
|
136
|
-
if (!parent) throw commentNotFound(artifactId, comment.parentId)
|
|
175
|
+
parent = await storage.getComment({ projectId, artifactId, id: comment.parentId })
|
|
176
|
+
if (!reads(parent)) throw commentNotFound(artifactId, comment.parentId)
|
|
137
177
|
anchor = parent.anchor
|
|
138
178
|
} else {
|
|
139
179
|
anchor = await checkAnchor(storage, artifact, comment.anchor ?? {})
|
|
@@ -151,7 +191,7 @@ export function createArtifactCommentsRuntime(input: {
|
|
|
151
191
|
...(comment.origin ? { origin: comment.origin } : {}),
|
|
152
192
|
createdAt: new Date(),
|
|
153
193
|
})
|
|
154
|
-
await announceArtifactComment(events, created, "created")
|
|
194
|
+
await announceArtifactComment(events, created, threadLink(parent ?? created), "created")
|
|
155
195
|
return created
|
|
156
196
|
} catch (error) {
|
|
157
197
|
throw commentRequestError(error)
|
|
@@ -159,7 +199,7 @@ export function createArtifactCommentsRuntime(input: {
|
|
|
159
199
|
},
|
|
160
200
|
|
|
161
201
|
async resolveComment(artifactId, commentId, resolved = true) {
|
|
162
|
-
await managed(artifactId, commentId)
|
|
202
|
+
const { thread } = await managed(artifactId, commentId)
|
|
163
203
|
const changed = await input.storage().resolveComment({
|
|
164
204
|
projectId,
|
|
165
205
|
artifactId,
|
|
@@ -168,20 +208,33 @@ export function createArtifactCommentsRuntime(input: {
|
|
|
168
208
|
})
|
|
169
209
|
if (!changed) throw commentNotFound(artifactId, commentId)
|
|
170
210
|
|
|
171
|
-
await announceArtifactComment(
|
|
211
|
+
await announceArtifactComment(
|
|
212
|
+
events,
|
|
213
|
+
changed,
|
|
214
|
+
threadLink(thread),
|
|
215
|
+
resolved ? "resolved" : "reopened"
|
|
216
|
+
)
|
|
172
217
|
return changed
|
|
173
218
|
},
|
|
174
219
|
|
|
175
220
|
async deleteComment(artifactId, commentId) {
|
|
176
|
-
const comment = await managed(artifactId, commentId)
|
|
221
|
+
const { comment, thread } = await managed(artifactId, commentId)
|
|
177
222
|
const deleted = await input.storage().deleteComment({ projectId, artifactId, id: commentId })
|
|
178
223
|
if (!deleted) throw commentNotFound(artifactId, commentId)
|
|
179
224
|
|
|
180
|
-
await announceArtifactComment(events, comment, "deleted")
|
|
225
|
+
await announceArtifactComment(events, comment, threadLink(thread), "deleted")
|
|
181
226
|
},
|
|
182
227
|
}
|
|
183
228
|
}
|
|
184
229
|
|
|
230
|
+
/**
|
|
231
|
+
* The shared link whose guests read a thread, by its grant: the one its first comment's guest came
|
|
232
|
+
* through. None for a thread a member started, which is the team's.
|
|
233
|
+
*/
|
|
234
|
+
function threadLink(thread: Pick<ArtifactCommentRecord, "author">): string | undefined {
|
|
235
|
+
return thread.author.type === "guest" ? thread.author.grantId : undefined
|
|
236
|
+
}
|
|
237
|
+
|
|
185
238
|
/**
|
|
186
239
|
* The anchor as it is kept: a board the canvas's latest version shows, an element's address
|
|
187
240
|
* under it, its label cut to length, and a revision the artifact has had.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultTreeAdapter as adapter,
|
|
3
|
+
type DefaultTreeAdapterTypes,
|
|
4
|
+
parse,
|
|
5
|
+
serialize,
|
|
6
|
+
} from "parse5"
|
|
7
|
+
import {
|
|
8
|
+
type DocumentMark,
|
|
9
|
+
type DocumentSources,
|
|
10
|
+
type DocumentTree,
|
|
11
|
+
documentData,
|
|
12
|
+
} from "./frames/document-data"
|
|
13
|
+
|
|
14
|
+
// A designed document's live data on the server, over parse5: the fields and repeated elements of
|
|
15
|
+
// its `document.html`, and that markup with the values a reader read written in, as a frozen
|
|
16
|
+
// version keeps it or a version prints. The frame shows the same values the same way: both walk
|
|
17
|
+
// the markup with `documentData`.
|
|
18
|
+
|
|
19
|
+
type Element = DefaultTreeAdapterTypes.Element
|
|
20
|
+
type ChildNode = DefaultTreeAdapterTypes.ChildNode
|
|
21
|
+
|
|
22
|
+
const isElement = (node: DefaultTreeAdapterTypes.Node): node is Element => "tagName" in node
|
|
23
|
+
|
|
24
|
+
const tree: DocumentTree<Element> = {
|
|
25
|
+
children: (node) => node.childNodes.filter(isElement),
|
|
26
|
+
attribute: (node, name) => node.attrs.find((each) => each.name === name)?.value ?? null,
|
|
27
|
+
setAttribute(node, name, value) {
|
|
28
|
+
const found = node.attrs.find((each) => each.name === name)
|
|
29
|
+
if (found) found.value = value
|
|
30
|
+
else node.attrs.push({ name, value })
|
|
31
|
+
},
|
|
32
|
+
removeAttribute(node, name) {
|
|
33
|
+
node.attrs = node.attrs.filter((each) => each.name !== name)
|
|
34
|
+
},
|
|
35
|
+
setText(node, text) {
|
|
36
|
+
for (const child of [...node.childNodes]) adapter.detachNode(child)
|
|
37
|
+
adapter.insertText(node, text)
|
|
38
|
+
},
|
|
39
|
+
clone: (node) => copy(node) as Element,
|
|
40
|
+
replace(node, nodes) {
|
|
41
|
+
const parent = node.parentNode
|
|
42
|
+
if (!parent) return
|
|
43
|
+
for (const each of nodes) adapter.insertBefore(parent, each, node)
|
|
44
|
+
adapter.detachNode(node)
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function copy(node: ChildNode): ChildNode {
|
|
49
|
+
if (!isElement(node)) return { ...node, parentNode: null }
|
|
50
|
+
const element = adapter.createElement(
|
|
51
|
+
node.tagName,
|
|
52
|
+
node.namespaceURI,
|
|
53
|
+
node.attrs.map((each) => ({ ...each }))
|
|
54
|
+
)
|
|
55
|
+
for (const child of node.childNodes) adapter.appendChild(element, copy(child))
|
|
56
|
+
return element
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function bodyOf(html: string) {
|
|
60
|
+
const document = parse(html)
|
|
61
|
+
const root = document.childNodes.find(isElement)
|
|
62
|
+
const body = root?.childNodes.find(
|
|
63
|
+
(child): child is Element => isElement(child) && child.tagName === "body"
|
|
64
|
+
)
|
|
65
|
+
return { document, root, body }
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The fields and repeated elements of a designed document's markup. */
|
|
69
|
+
export function documentMarks(html: string): DocumentMark[] {
|
|
70
|
+
const { body } = bodyOf(html)
|
|
71
|
+
return body ? documentData().marks(body, tree) : []
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* A designed document's markup with the values `sources` hold written in. `plain` leaves no field
|
|
76
|
+
* marked, as a version prints; `keep` leaves every one marked, as a frozen version keeps them.
|
|
77
|
+
* Markup with no field or repeated element is returned as it is.
|
|
78
|
+
*/
|
|
79
|
+
export function fillDocumentHtml(
|
|
80
|
+
html: string,
|
|
81
|
+
sources: DocumentSources,
|
|
82
|
+
options: { readonly plain?: boolean; readonly keep?: boolean } = {}
|
|
83
|
+
): string {
|
|
84
|
+
const { document, root, body } = bodyOf(html)
|
|
85
|
+
if (!body || documentData().marks(body, tree).length === 0) return html
|
|
86
|
+
|
|
87
|
+
const lang = root ? (tree.attribute(root, "lang") ?? undefined) : undefined
|
|
88
|
+
documentData().fill(body, tree, {
|
|
89
|
+
sources,
|
|
90
|
+
...(lang ? { lang } : {}),
|
|
91
|
+
...(options.plain ? { plain: true } : {}),
|
|
92
|
+
...(options.keep ? { keep: true } : {}),
|
|
93
|
+
})
|
|
94
|
+
return serialize(document)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* A frozen version's markup as it shows and prints: the values written in when it was frozen, and
|
|
99
|
+
* no field marked, so none is read again.
|
|
100
|
+
*/
|
|
101
|
+
export function frozenDocumentHtml(html: string): string {
|
|
102
|
+
return fillDocumentHtml(html, { queries: {} }, { plain: true })
|
|
103
|
+
}
|
package/src/artifacts/errors.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type ArtifactRequestErrorCode =
|
|
|
6
6
|
| "artifact_moved"
|
|
7
7
|
| "comment_not_found"
|
|
8
8
|
| "comments_full"
|
|
9
|
+
| "holder_not_found"
|
|
9
10
|
| "invalid_artifact"
|
|
10
11
|
| "invalid_comment"
|
|
11
12
|
| "invalid_state"
|
|
@@ -13,6 +14,7 @@ export type ArtifactRequestErrorCode =
|
|
|
13
14
|
| "state_full"
|
|
14
15
|
| "not_allowed"
|
|
15
16
|
| "not_shared"
|
|
17
|
+
| "pdf_unavailable"
|
|
16
18
|
| "query_invalid"
|
|
17
19
|
| "query_not_found"
|
|
18
20
|
| "read_only"
|
package/src/artifacts/events.ts
CHANGED
|
@@ -31,12 +31,14 @@ export async function announceArtifactUpdates(
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Tells whoever reads the
|
|
34
|
+
* Tells whoever reads the comment's thread that it changed, as `artifact.commented`: the
|
|
35
|
+
* artifact's members, and the guests of `shareGrantId`, the link a guest's thread came through.
|
|
35
36
|
* The change is stored by now, so `emit` never fails it.
|
|
36
37
|
*/
|
|
37
38
|
export async function announceArtifactComment(
|
|
38
39
|
events: Pick<DomainEventLog, "emit">,
|
|
39
40
|
comment: Pick<ArtifactCommentRecord, "artifactId" | "id" | "parentId">,
|
|
41
|
+
shareGrantId: string | undefined,
|
|
40
42
|
action: "created" | "resolved" | "reopened" | "deleted"
|
|
41
43
|
): Promise<void> {
|
|
42
44
|
await events.emit(
|
|
@@ -48,6 +50,7 @@ export async function announceArtifactComment(
|
|
|
48
50
|
artifactId: comment.artifactId,
|
|
49
51
|
commentId: comment.id,
|
|
50
52
|
...(comment.parentId === undefined ? {} : { parentId: comment.parentId }),
|
|
53
|
+
...(shareGrantId === undefined ? {} : { shareGrantId }),
|
|
51
54
|
action,
|
|
52
55
|
},
|
|
53
56
|
},
|