@sixb/core 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.js +28 -28
- package/dist/agents/cancel.d.ts +1 -1
- package/dist/agents/cancel.d.ts.map +1 -1
- package/dist/agents/child-question.d.ts +35 -2
- package/dist/agents/child-question.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +35 -3
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/ids.d.ts +4 -0
- package/dist/agents/ids.d.ts.map +1 -1
- package/dist/agents/index.d.ts +9 -7
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +59 -33
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/queued-turn.d.ts +16 -0
- package/dist/agents/queued-turn.d.ts.map +1 -0
- package/dist/agents/request.d.ts +79 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-after-finish.d.ts +10 -0
- package/dist/agents/run-after-finish.d.ts.map +1 -1
- package/dist/agents/run-artifacts.d.ts +0 -38
- package/dist/agents/run-artifacts.d.ts.map +1 -1
- package/dist/agents/run-events.d.ts +6 -1
- package/dist/agents/run-events.d.ts.map +1 -1
- package/dist/agents/run-session-children.d.ts +9 -0
- package/dist/agents/run-session-children.d.ts.map +1 -1
- package/dist/agents/run-session-http.d.ts.map +1 -1
- package/dist/agents/run-session-serve.d.ts.map +1 -1
- package/dist/agents/run-session.d.ts +14 -1
- package/dist/agents/run-session.d.ts.map +1 -1
- package/dist/agents/run-turn.d.ts.map +1 -1
- package/dist/agents/streams/index.d.ts +1 -1
- package/dist/agents/streams/index.d.ts.map +1 -1
- package/dist/agents/streams/index.js +1 -1
- package/dist/agents/streams/internal.js +1 -1
- package/dist/agents/streams/protocol.d.ts +16 -0
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/tool-files.d.ts +1 -1
- package/dist/agents/tool-files.d.ts.map +1 -1
- package/dist/agents/tool-input-coercion.d.ts +20 -0
- package/dist/agents/tool-input-coercion.d.ts.map +1 -0
- package/dist/agents/turn-answered.d.ts +7 -0
- package/dist/agents/turn-answered.d.ts.map +1 -0
- package/dist/agents/validation.d.ts +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/artifacts/canvas-display.d.ts +3 -5
- package/dist/artifacts/canvas-display.d.ts.map +1 -1
- package/dist/artifacts/comments.d.ts +14 -3
- package/dist/artifacts/comments.d.ts.map +1 -1
- package/dist/artifacts/document-fill.d.ts +18 -0
- package/dist/artifacts/document-fill.d.ts.map +1 -0
- package/dist/artifacts/errors.d.ts +1 -1
- package/dist/artifacts/errors.d.ts.map +1 -1
- package/dist/artifacts/events.d.ts +3 -2
- package/dist/artifacts/events.d.ts.map +1 -1
- package/dist/artifacts/execution.d.ts +40 -4
- package/dist/artifacts/execution.d.ts.map +1 -1
- package/dist/artifacts/frames/assets.d.ts +8 -1
- package/dist/artifacts/frames/assets.d.ts.map +1 -1
- package/dist/artifacts/frames/document-data.d.ts +98 -0
- package/dist/artifacts/frames/document-data.d.ts.map +1 -0
- package/dist/artifacts/frames/entries.d.ts +12 -7
- package/dist/artifacts/frames/entries.d.ts.map +1 -1
- package/dist/artifacts/frames/index.d.ts +2 -1
- package/dist/artifacts/frames/index.d.ts.map +1 -1
- package/dist/artifacts/frames/index.js +22 -13
- package/dist/artifacts/frames/index.js.map +4 -4
- package/dist/artifacts/frames/kit.d.ts +15 -0
- package/dist/artifacts/frames/kit.d.ts.map +1 -1
- package/dist/artifacts/frames/protocol.d.ts +65 -3
- package/dist/artifacts/frames/protocol.d.ts.map +1 -1
- package/dist/artifacts/frames/runtime.d.ts +32 -5
- package/dist/artifacts/frames/runtime.d.ts.map +1 -1
- package/dist/artifacts/index.d.ts +4 -2
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +35 -3
- package/dist/artifacts/index.js.map +3 -3
- package/dist/artifacts/live/blocks.d.ts +62 -0
- package/dist/artifacts/live/blocks.d.ts.map +1 -0
- package/dist/artifacts/live/board.d.ts +6 -0
- package/dist/artifacts/live/board.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts +12 -0
- package/dist/artifacts/live/document.d.ts.map +1 -1
- package/dist/artifacts/live/index.d.ts +2 -0
- package/dist/artifacts/live/index.d.ts.map +1 -1
- package/dist/artifacts/live/index.js +148 -44
- package/dist/artifacts/live/index.js.map +3 -3
- package/dist/artifacts/live/page.d.ts +49 -0
- package/dist/artifacts/live/page.d.ts.map +1 -0
- package/dist/artifacts/live/protocol.d.ts +5 -0
- package/dist/artifacts/live/protocol.d.ts.map +1 -1
- package/dist/artifacts/live/server.d.ts +2 -2
- package/dist/artifacts/live/server.d.ts.map +1 -1
- package/dist/artifacts/live/server.js +23 -19
- package/dist/artifacts/live/server.js.map +1 -1
- package/dist/artifacts/live/state.d.ts +4 -1
- package/dist/artifacts/live/state.d.ts.map +1 -1
- package/dist/artifacts/outline.d.ts +16 -0
- package/dist/artifacts/outline.d.ts.map +1 -1
- package/dist/artifacts/paper.d.ts +22 -0
- package/dist/artifacts/paper.d.ts.map +1 -0
- package/dist/artifacts/pdf-job.d.ts +9 -0
- package/dist/artifacts/pdf-job.d.ts.map +1 -0
- package/dist/artifacts/publish/fields.d.ts +25 -0
- package/dist/artifacts/publish/fields.d.ts.map +1 -0
- package/dist/artifacts/publish/index.d.ts +2 -1
- package/dist/artifacts/publish/index.d.ts.map +1 -1
- package/dist/artifacts/publish/index.js +26 -18
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/merge.d.ts +5 -5
- package/dist/artifacts/publish/merge.d.ts.map +1 -1
- package/dist/artifacts/publish/pdf.d.ts +28 -0
- package/dist/artifacts/publish/pdf.d.ts.map +1 -0
- package/dist/artifacts/publish/previews.d.ts +12 -20
- package/dist/artifacts/publish/previews.d.ts.map +1 -1
- package/dist/artifacts/publish/publish.d.ts.map +1 -1
- package/dist/artifacts/publish/queries.d.ts +6 -1
- package/dist/artifacts/publish/queries.d.ts.map +1 -1
- package/dist/artifacts/publish/query-answers.d.ts +5 -2
- package/dist/artifacts/publish/query-answers.d.ts.map +1 -1
- package/dist/artifacts/publish/validate/document-html.d.ts +24 -0
- package/dist/artifacts/publish/validate/document-html.d.ts.map +1 -0
- package/dist/artifacts/publish/validate/document.d.ts +5 -3
- package/dist/artifacts/publish/validate/document.d.ts.map +1 -1
- package/dist/artifacts/queries.d.ts +16 -2
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/auth/index.js +2 -2
- package/dist/authorization/event-visibility.d.ts.map +1 -1
- package/dist/authorization/index.js +1 -1
- package/dist/blob-storage/index.js +1 -1
- package/dist/bootstrap/index.js +38 -38
- package/dist/{chunk-tqa68kj7.js → chunk-0hkdtwqk.js} +5 -5
- package/dist/{chunk-s5n9617r.js → chunk-0mvjpgvm.js} +5 -5
- package/dist/{chunk-k66rp2hr.js → chunk-1yh6jgtz.js} +1 -1
- package/dist/{chunk-26qet7wh.js → chunk-5t9gm5tt.js} +4 -4
- package/dist/{chunk-a6fjkcne.js → chunk-60662fyv.js} +54 -28
- package/dist/{chunk-a6fjkcne.js.map → chunk-60662fyv.js.map} +7 -6
- package/dist/{chunk-e0hnbb1m.js → chunk-61zptves.js} +1 -1
- package/dist/{chunk-hkaa807g.js → chunk-68hm50qh.js} +3 -3
- package/dist/{chunk-9nsjjd44.js → chunk-8tv3qd65.js} +2 -1
- package/dist/chunk-8tv3qd65.js.map +12 -0
- package/dist/{chunk-fe6r7yhg.js → chunk-92wrka15.js} +1 -1
- package/dist/{chunk-m7b9q5dk.js → chunk-aw1z0gre.js} +4 -4
- package/dist/chunk-az95tsh3.js.map +2 -2
- package/dist/{chunk-4j0sagwv.js → chunk-b4escq4c.js} +62 -14
- package/dist/{chunk-4j0sagwv.js.map → chunk-b4escq4c.js.map} +7 -7
- package/dist/chunk-bqr703h4.js +1799 -0
- package/dist/chunk-bqr703h4.js.map +13 -0
- package/dist/{chunk-eptrvnby.js → chunk-c29729me.js} +42 -3
- package/dist/chunk-c29729me.js.map +12 -0
- package/dist/{chunk-t24yktqr.js → chunk-dvgc56n2.js} +20 -4
- package/dist/{chunk-t24yktqr.js.map → chunk-dvgc56n2.js.map} +5 -5
- package/dist/{chunk-3014rfjz.js → chunk-ewqn51gr.js} +25 -7
- package/dist/{chunk-3014rfjz.js.map → chunk-ewqn51gr.js.map} +3 -3
- package/dist/{chunk-7z5rkf0m.js → chunk-ey1p8w68.js} +175 -5
- package/dist/chunk-ey1p8w68.js.map +13 -0
- package/dist/{chunk-z0t4p2sk.js → chunk-fpf57gca.js} +350 -61
- package/dist/chunk-fpf57gca.js.map +47 -0
- package/dist/{chunk-kv0kvknv.js → chunk-fzae1jpq.js} +7 -7
- package/dist/{chunk-b9qfh2ya.js → chunk-fzbhybya.js} +29 -2
- package/dist/chunk-fzbhybya.js.map +11 -0
- package/dist/{chunk-2by73sm2.js → chunk-gjhrz66x.js} +225 -17
- package/dist/{chunk-2by73sm2.js.map → chunk-gjhrz66x.js.map} +5 -5
- package/dist/chunk-hn2r7z41.js.map +1 -1
- package/dist/{chunk-6gtxshcc.js → chunk-k29n4176.js} +6 -6
- package/dist/{chunk-48c1z8nj.js → chunk-k3jh8gsg.js} +10 -2
- package/dist/chunk-k3jh8gsg.js.map +10 -0
- package/dist/{chunk-w9s23r24.js → chunk-m3qx2pns.js} +751 -93
- package/dist/chunk-m3qx2pns.js.map +34 -0
- package/dist/{chunk-smnt672s.js → chunk-m9ketb51.js} +20 -4
- package/dist/chunk-m9ketb51.js.map +10 -0
- package/dist/chunk-mbwsgjn7.js +40 -0
- package/dist/chunk-mbwsgjn7.js.map +11 -0
- package/dist/{chunk-sysnvjce.js → chunk-naxjka9v.js} +2 -2
- package/dist/{chunk-n4zzaf6q.js → chunk-nxysqbt0.js} +4 -2
- package/dist/chunk-nxysqbt0.js.map +10 -0
- package/dist/{chunk-vzkxqf8h.js → chunk-paxabbqd.js} +49 -5
- package/dist/chunk-paxabbqd.js.map +23 -0
- package/dist/{chunk-8tqnsx3q.js → chunk-pc7kra3k.js} +5 -3
- package/dist/{chunk-8tqnsx3q.js.map → chunk-pc7kra3k.js.map} +3 -3
- package/dist/{chunk-qafng88v.js → chunk-pqvvqc65.js} +4 -4
- package/dist/chunk-pvpq483h.js.map +2 -2
- package/dist/{chunk-mzx71snp.js → chunk-q7g9cqwt.js} +7 -2
- package/dist/{chunk-mzx71snp.js.map → chunk-q7g9cqwt.js.map} +3 -3
- package/dist/{chunk-8t2ynwg0.js → chunk-q8d9p0tb.js} +24 -1
- package/dist/{chunk-8t2ynwg0.js.map → chunk-q8d9p0tb.js.map} +3 -3
- package/dist/{chunk-wa05txmk.js → chunk-qavwr628.js} +49 -5
- package/dist/chunk-qavwr628.js.map +12 -0
- package/dist/{chunk-bkmnd7zq.js → chunk-rg725hry.js} +174 -30
- package/dist/{chunk-bkmnd7zq.js.map → chunk-rg725hry.js.map} +9 -8
- package/dist/{chunk-8p7bze4c.js → chunk-s1mqyqmm.js} +3 -3
- package/dist/{chunk-p351afzm.js → chunk-s5pj68fa.js} +2 -2
- package/dist/{chunk-855w9nvw.js → chunk-vehcr9eb.js} +1 -1
- package/dist/{chunk-qds484t8.js → chunk-vs2s3p8n.js} +932 -21
- package/dist/chunk-vs2s3p8n.js.map +20 -0
- package/dist/chunk-vtjzwymr.js.map +2 -2
- package/dist/{chunk-n68vz95m.js → chunk-wqe9shx2.js} +1 -1
- package/dist/{chunk-0k3r5kb3.js → chunk-xcrnrpfh.js} +1 -1
- package/dist/{chunk-cwdzcv37.js → chunk-xrmbhap8.js} +2 -2
- package/dist/{chunk-cwdzcv37.js.map → chunk-xrmbhap8.js.map} +2 -2
- package/dist/{chunk-f6ahf5gf.js → chunk-xxfj0rr2.js} +20 -5
- package/dist/chunk-xxfj0rr2.js.map +13 -0
- package/dist/{chunk-3hzhcfsv.js → chunk-y8fwm3z2.js} +2 -2
- package/dist/{chunk-3hzhcfsv.js.map → chunk-y8fwm3z2.js.map} +3 -3
- package/dist/{chunk-e9w4mgdh.js → chunk-z1njfqqs.js} +589 -53
- package/dist/{chunk-e9w4mgdh.js.map → chunk-z1njfqqs.js.map} +14 -11
- package/dist/{chunk-yv8hv4wq.js → chunk-z4jqb44a.js} +3 -1
- package/dist/chunk-z4jqb44a.js.map +10 -0
- package/dist/{chunk-s7xqfxs9.js → chunk-zft9bzbc.js} +2 -1
- package/dist/{chunk-s7xqfxs9.js.map → chunk-zft9bzbc.js.map} +3 -3
- package/dist/{chunk-38yvdqzd.js → chunk-zxhym8tr.js} +1 -1
- package/dist/connectors/connection-handles.d.ts +9 -0
- package/dist/connectors/connection-handles.d.ts.map +1 -0
- package/dist/connectors/connections/authorizations.d.ts +9 -0
- package/dist/connectors/connections/authorizations.d.ts.map +1 -1
- package/dist/connectors/connections/events.d.ts +17 -0
- package/dist/connectors/connections/events.d.ts.map +1 -0
- package/dist/connectors/connections/runs.d.ts +3 -0
- package/dist/connectors/connections/runs.d.ts.map +1 -1
- package/dist/connectors/connections/service.d.ts +4 -0
- package/dist/connectors/connections/service.d.ts.map +1 -1
- package/dist/connectors/execution.d.ts +7 -1
- package/dist/connectors/execution.d.ts.map +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.d.ts.map +1 -1
- package/dist/connectors/types.d.ts +22 -1
- package/dist/connectors/types.d.ts.map +1 -1
- package/dist/datasets/write.js +1 -1
- package/dist/deploy/index.d.ts +1 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/internal.js +3 -2
- package/dist/deploy/internal.js.map +3 -3
- package/dist/deploy/services.d.ts.map +1 -1
- package/dist/deploy/types.d.ts +18 -1
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/events/definitions.d.ts +4 -0
- package/dist/events/definitions.d.ts.map +1 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +3 -3
- package/dist/events/outbox-dispatcher.d.ts +7 -0
- package/dist/events/outbox-dispatcher.d.ts.map +1 -1
- package/dist/events/scope.d.ts +1 -0
- package/dist/events/scope.d.ts.map +1 -1
- package/dist/events/scope.js +1 -1
- package/dist/events/selectors/builder.d.ts +9 -1
- package/dist/events/selectors/builder.d.ts.map +1 -1
- package/dist/events/selectors/index.d.ts +2 -2
- package/dist/events/selectors/index.d.ts.map +1 -1
- package/dist/events/selectors/index.js +2 -2
- package/dist/events/selectors/predicate.d.ts.map +1 -1
- package/dist/events/selectors/types.d.ts +18 -3
- package/dist/events/selectors/types.d.ts.map +1 -1
- package/dist/events/types/artifacts.d.ts +7 -1
- package/dist/events/types/artifacts.d.ts.map +1 -1
- package/dist/events/types/connectors.d.ts +32 -0
- package/dist/events/types/connectors.d.ts.map +1 -0
- package/dist/events/types/index.d.ts +3 -1
- package/dist/events/types/index.d.ts.map +1 -1
- package/dist/execution/agent.js +28 -28
- package/dist/execution/authorization.d.ts +5 -0
- package/dist/execution/authorization.d.ts.map +1 -1
- package/dist/execution/primitive.js +28 -28
- package/dist/execution/request.js +29 -29
- package/dist/execution/scopes.d.ts +8 -0
- package/dist/execution/scopes.d.ts.map +1 -1
- package/dist/execution/script.d.ts +7 -0
- package/dist/execution/script.d.ts.map +1 -0
- package/dist/execution/types.d.ts +16 -1
- package/dist/execution/types.d.ts.map +1 -1
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -44
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +1 -1
- package/dist/lineage/executors.d.ts +1 -1
- package/dist/lineage/executors.d.ts.map +1 -1
- package/dist/maintenance/index.js +1 -1
- package/dist/materialization/event-envelopes.d.ts +3 -3
- package/dist/materialization/event-envelopes.d.ts.map +1 -1
- package/dist/materialization/events.d.ts +6 -0
- package/dist/materialization/events.d.ts.map +1 -1
- package/dist/materialization/index.js +1 -1
- package/dist/materialization/model.d.ts +6 -0
- package/dist/materialization/model.d.ts.map +1 -1
- package/dist/materializer/index.js +13 -13
- package/dist/materializer/projections/replace.d.ts.map +1 -1
- package/dist/materializer/projections/replacement-plan.d.ts +2 -0
- package/dist/materializer/projections/replacement-plan.d.ts.map +1 -1
- package/dist/materializer/shared/normalize.d.ts +1 -0
- package/dist/materializer/shared/normalize.d.ts.map +1 -1
- package/dist/models/execution/index.js +12 -12
- package/dist/models/language-model.d.ts +6 -0
- package/dist/models/language-model.d.ts.map +1 -1
- package/dist/models/tools.d.ts +2 -0
- package/dist/models/tools.d.ts.map +1 -1
- package/dist/objects/index.js +28 -28
- package/dist/objects/query/index.js +12 -12
- package/dist/pipelines/index.js +18 -18
- package/dist/projections/builders.d.ts +7 -1
- package/dist/projections/builders.d.ts.map +1 -1
- package/dist/projections/index.d.ts +1 -1
- package/dist/projections/index.d.ts.map +1 -1
- package/dist/projections/internal.js +13 -13
- package/dist/projections/types.d.ts +10 -0
- package/dist/projections/types.d.ts.map +1 -1
- package/dist/projections/validation.d.ts.map +1 -1
- package/dist/queues/in-memory.d.ts +2 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/queues/index.d.ts +1 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +1 -1
- package/dist/queues/types.d.ts +40 -13
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +13 -0
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.d.ts +1 -0
- package/dist/runtime/internal.d.ts.map +1 -1
- package/dist/runtime/internal.js +39 -18
- package/dist/runtime/internal.js.map +4 -3
- package/dist/runtime/resolve-definitions.d.ts +1 -1
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/script.d.ts +39 -0
- package/dist/runtime/script.d.ts.map +1 -0
- package/dist/runtime/sixb.d.ts +2 -2
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/schedules/builders.d.ts.map +1 -1
- package/dist/schedules/index.js +3 -3
- package/dist/schedules/runtime.d.ts.map +1 -1
- package/dist/schedules/validation.d.ts +2 -0
- package/dist/schedules/validation.d.ts.map +1 -1
- package/dist/shares/internal.js +12 -12
- package/dist/storage/agents/errors.d.ts +1 -1
- package/dist/storage/agents/errors.d.ts.map +1 -1
- package/dist/storage/agents/in-memory.d.ts +26 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +2 -2
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +12 -3
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +25 -5
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +156 -1
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts +7 -1
- package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
- package/dist/storage/artifacts/index.d.ts +1 -1
- package/dist/storage/artifacts/index.d.ts.map +1 -1
- package/dist/storage/artifacts/record.d.ts +2 -1
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +34 -0
- package/dist/storage/artifacts/types.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +3 -3
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +1 -1
- package/dist/storage/executions/types.d.ts +6 -0
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +3 -3
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +18 -14
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +1 -1
- package/dist/storage/internal.d.ts.map +1 -1
- package/dist/storage/internal.js +8 -6
- package/dist/storage/internal.js.map +2 -2
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts +2 -0
- package/dist/storage/ontology/in-memory/replacement-plans.d.ts.map +1 -1
- package/dist/storage/ontology/provider.js +1 -1
- package/dist/storage/ontology/replacement-plans.d.ts +8 -0
- package/dist/storage/ontology/replacement-plans.d.ts.map +1 -1
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/workflow-runs/provider.js +3 -3
- package/dist/syncs/index.js +19 -19
- package/dist/testing/agent-execution.d.ts +3 -0
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-inbox-storage-contract.d.ts +15 -0
- package/dist/testing/agent-inbox-storage-contract.d.ts.map +1 -0
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +5524 -4555
- package/dist/testing/index.js.map +10 -9
- package/dist/testing/materializer-storage-contract.d.ts.map +1 -1
- package/dist/testing/queues-contract.d.ts.map +1 -1
- package/dist/webhooks/connections.d.ts +3 -4
- package/dist/webhooks/connections.d.ts.map +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.d.ts.map +1 -1
- package/dist/webhooks/internal.js +16 -49
- package/dist/webhooks/internal.js.map +3 -3
- package/dist/webhooks/types.d.ts +2 -11
- package/dist/webhooks/types.d.ts.map +1 -1
- package/dist/workers/queued-run-dispatch.d.ts.map +1 -1
- package/dist/workflows/index.js +35 -35
- package/package.json +6 -1
- package/src/agents/README.md +6 -2
- package/src/agents/approval-outcome.ts +2 -2
- package/src/agents/cancel.ts +2 -2
- package/src/agents/child-question.ts +76 -8
- package/src/agents/execution.ts +168 -30
- package/src/agents/ids.ts +9 -1
- package/src/agents/index.ts +27 -6
- package/src/agents/model-loop.ts +3 -1
- package/src/agents/queued-turn.ts +46 -0
- package/src/agents/request.ts +517 -2
- package/src/agents/run-after-finish.ts +259 -2
- package/src/agents/run-artifacts.ts +3 -93
- package/src/agents/run-events.ts +26 -1
- package/src/agents/run-session-children.ts +33 -0
- package/src/agents/run-session-http.ts +10 -2
- package/src/agents/run-session-serve.ts +3 -8
- package/src/agents/run-session.ts +142 -3
- package/src/agents/run-turn.ts +8 -0
- package/src/agents/streams/index.ts +1 -0
- package/src/agents/streams/protocol.ts +41 -1
- package/src/agents/tool-files.ts +1 -1
- package/src/agents/tool-input-coercion.ts +140 -0
- package/src/agents/turn-answered.ts +31 -0
- package/src/agents/validation.ts +13 -3
- package/src/artifacts/canvas-display.ts +4 -6
- package/src/artifacts/comments.ts +70 -17
- package/src/artifacts/document-fill.ts +103 -0
- package/src/artifacts/errors.ts +2 -0
- package/src/artifacts/events.ts +4 -1
- package/src/artifacts/execution.ts +265 -31
- package/src/artifacts/frames/assets.ts +42 -7
- package/src/artifacts/frames/document-data.ts +353 -0
- package/src/artifacts/frames/entries.ts +22 -16
- package/src/artifacts/frames/grants.ts +2 -2
- package/src/artifacts/frames/index.ts +3 -0
- package/src/artifacts/frames/kit.ts +102 -0
- package/src/artifacts/frames/protocol.ts +96 -3
- package/src/artifacts/frames/runtime.ts +709 -19
- package/src/artifacts/index.ts +6 -0
- package/src/artifacts/live/blocks.ts +889 -0
- package/src/artifacts/live/board.ts +195 -42
- package/src/artifacts/live/document.ts +170 -5
- package/src/artifacts/live/index.ts +7 -0
- package/src/artifacts/live/page.ts +807 -0
- package/src/artifacts/live/protocol.ts +5 -0
- package/src/artifacts/live/server.ts +2 -2
- package/src/artifacts/live/state.ts +9 -4
- package/src/artifacts/outline.ts +17 -0
- package/src/artifacts/paper.ts +173 -0
- package/src/artifacts/pdf-job.ts +11 -0
- package/src/artifacts/publish/fields.ts +177 -0
- package/src/artifacts/publish/index.ts +6 -1
- package/src/artifacts/publish/merge.ts +14 -12
- package/src/artifacts/publish/pdf.ts +82 -0
- package/src/artifacts/publish/previews.ts +24 -34
- package/src/artifacts/publish/publish.ts +26 -3
- package/src/artifacts/publish/queries.ts +20 -4
- package/src/artifacts/publish/query-answers.ts +14 -3
- package/src/artifacts/publish/validate/document-html.ts +245 -0
- package/src/artifacts/publish/validate/document.ts +34 -3
- package/src/artifacts/queries.ts +59 -13
- package/src/authorization/event-visibility.ts +13 -0
- package/src/connectors/connection-handles.ts +71 -0
- package/src/connectors/connections/authorizations.ts +50 -2
- package/src/connectors/connections/events.ts +57 -0
- package/src/connectors/connections/runs.ts +5 -0
- package/src/connectors/connections/service.ts +19 -1
- package/src/connectors/execution.ts +30 -2
- package/src/connectors/index.ts +3 -0
- package/src/connectors/types.ts +29 -1
- package/src/deploy/index.ts +1 -0
- package/src/deploy/services.ts +1 -0
- package/src/deploy/types.ts +26 -1
- package/src/events/definitions.ts +14 -0
- package/src/events/execution.ts +9 -2
- package/src/events/index.ts +8 -0
- package/src/events/outbox-dispatcher.ts +12 -2
- package/src/events/scope.ts +3 -0
- package/src/events/selectors/builder.ts +49 -0
- package/src/events/selectors/index.ts +5 -0
- package/src/events/selectors/predicate.ts +2 -0
- package/src/events/selectors/types.ts +30 -1
- package/src/events/types/artifacts.ts +7 -1
- package/src/events/types/connectors.ts +36 -0
- package/src/events/types/index.ts +7 -0
- package/src/execution/authorization.ts +45 -0
- package/src/execution/durable.ts +2 -0
- package/src/execution/scopes.ts +24 -0
- package/src/execution/script.ts +27 -0
- package/src/execution/types.ts +7 -1
- package/src/http/api-routes.ts +26 -1
- package/src/index.ts +21 -2
- package/src/lineage/executors.ts +3 -1
- package/src/materialization/event-envelopes.ts +10 -5
- package/src/materialization/events.ts +2 -0
- package/src/materialization/model.ts +6 -0
- package/src/materializer/README.md +10 -0
- package/src/materializer/projections/replace.ts +42 -1
- package/src/materializer/projections/replacement-plan.ts +44 -4
- package/src/materializer/shared/normalize.ts +4 -0
- package/src/models/language-model.ts +6 -0
- package/src/models/tools.ts +2 -0
- package/src/projections/builders.ts +20 -0
- package/src/projections/index.ts +1 -0
- package/src/projections/registry.ts +1 -0
- package/src/projections/revision.ts +2 -0
- package/src/projections/types.ts +11 -0
- package/src/projections/validation.ts +6 -0
- package/src/queues/in-memory.ts +5 -0
- package/src/queues/index.ts +3 -1
- package/src/queues/types.ts +45 -14
- package/src/runtime/host.ts +112 -4
- package/src/runtime/internal.ts +1 -0
- package/src/runtime/resolve-definitions.ts +4 -1
- package/src/runtime/script.ts +62 -0
- package/src/runtime/sixb.ts +3 -3
- package/src/schedules/builders.ts +4 -1
- package/src/schedules/runtime.ts +3 -0
- package/src/schedules/validation.ts +20 -2
- package/src/storage/agents/errors.ts +1 -0
- package/src/storage/agents/in-memory.ts +229 -1
- package/src/storage/agents/index.ts +16 -0
- package/src/storage/agents/provider.ts +284 -2
- package/src/storage/agents/types.ts +168 -1
- package/src/storage/artifacts/in-memory.ts +32 -1
- package/src/storage/artifacts/index.ts +2 -0
- package/src/storage/artifacts/record.ts +25 -2
- package/src/storage/artifacts/types.ts +37 -0
- package/src/storage/executions/provider.ts +22 -2
- package/src/storage/executions/types.ts +2 -0
- package/src/storage/executions/validation.ts +27 -0
- package/src/storage/index.ts +18 -0
- package/src/storage/internal.ts +1 -0
- package/src/storage/ontology/in-memory/replacement-plans.ts +22 -0
- package/src/storage/ontology/replacement-plans.ts +6 -0
- package/src/storage/operation-scope.ts +1 -0
- package/src/testing/agent-execution.ts +45 -2
- package/src/testing/agent-inbox-storage-contract.ts +815 -0
- package/src/testing/agent-storage-contract.ts +103 -0
- package/src/testing/artifact-storage-contract.ts +72 -4
- package/src/testing/execution-storage-contract.ts +31 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/materializer-storage-contract.ts +139 -1
- package/src/testing/queues-contract.ts +22 -0
- package/src/webhooks/connections.ts +9 -50
- package/src/webhooks/index.ts +0 -2
- package/src/webhooks/types.ts +2 -13
- package/src/workers/queued-run-dispatch.ts +8 -1
- package/dist/chunk-48c1z8nj.js.map +0 -10
- package/dist/chunk-58geavnf.js +0 -29
- package/dist/chunk-58geavnf.js.map +0 -10
- package/dist/chunk-7z5rkf0m.js.map +0 -13
- package/dist/chunk-9nsjjd44.js.map +0 -12
- package/dist/chunk-b9qfh2ya.js.map +0 -11
- package/dist/chunk-eptrvnby.js.map +0 -12
- package/dist/chunk-f6ahf5gf.js.map +0 -13
- package/dist/chunk-m2jerfef.js +0 -474
- package/dist/chunk-m2jerfef.js.map +0 -11
- package/dist/chunk-n4zzaf6q.js.map +0 -10
- package/dist/chunk-qds484t8.js.map +0 -18
- package/dist/chunk-smnt672s.js.map +0 -10
- package/dist/chunk-vzkxqf8h.js.map +0 -23
- package/dist/chunk-w9s23r24.js.map +0 -30
- package/dist/chunk-wa05txmk.js.map +0 -11
- package/dist/chunk-yv8hv4wq.js.map +0 -10
- package/dist/chunk-z0t4p2sk.js.map +0 -47
- /package/dist/{chunk-tqa68kj7.js.map → chunk-0hkdtwqk.js.map} +0 -0
- /package/dist/{chunk-s5n9617r.js.map → chunk-0mvjpgvm.js.map} +0 -0
- /package/dist/{chunk-k66rp2hr.js.map → chunk-1yh6jgtz.js.map} +0 -0
- /package/dist/{chunk-26qet7wh.js.map → chunk-5t9gm5tt.js.map} +0 -0
- /package/dist/{chunk-e0hnbb1m.js.map → chunk-61zptves.js.map} +0 -0
- /package/dist/{chunk-hkaa807g.js.map → chunk-68hm50qh.js.map} +0 -0
- /package/dist/{chunk-fe6r7yhg.js.map → chunk-92wrka15.js.map} +0 -0
- /package/dist/{chunk-m7b9q5dk.js.map → chunk-aw1z0gre.js.map} +0 -0
- /package/dist/{chunk-kv0kvknv.js.map → chunk-fzae1jpq.js.map} +0 -0
- /package/dist/{chunk-6gtxshcc.js.map → chunk-k29n4176.js.map} +0 -0
- /package/dist/{chunk-sysnvjce.js.map → chunk-naxjka9v.js.map} +0 -0
- /package/dist/{chunk-qafng88v.js.map → chunk-pqvvqc65.js.map} +0 -0
- /package/dist/{chunk-8p7bze4c.js.map → chunk-s1mqyqmm.js.map} +0 -0
- /package/dist/{chunk-p351afzm.js.map → chunk-s5pj68fa.js.map} +0 -0
- /package/dist/{chunk-855w9nvw.js.map → chunk-vehcr9eb.js.map} +0 -0
- /package/dist/{chunk-n68vz95m.js.map → chunk-wqe9shx2.js.map} +0 -0
- /package/dist/{chunk-0k3r5kb3.js.map → chunk-xcrnrpfh.js.map} +0 -0
- /package/dist/{chunk-38yvdqzd.js.map → chunk-zxhym8tr.js.map} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isDeepStrictEqual } from "node:util"
|
|
2
2
|
import { createAgentMessageId, createCopiedAgentContextCheckpointId } from "../../agents/ids"
|
|
3
|
+
import type { AgentMessagePart } from "../../agents/message"
|
|
3
4
|
import { AGENT_REASONING_LEVELS } from "../../agents/types"
|
|
4
5
|
import type { Principal, UserPrincipal } from "../../auth"
|
|
5
6
|
import { isFileRef } from "../../blob-storage/validation"
|
|
@@ -9,9 +10,9 @@ import { isModelReasoning } from "../../models/language-model"
|
|
|
9
10
|
import type { ExecutionRecord, ExecutionStorage } from "../executions"
|
|
10
11
|
import { findAgentRunExecution } from "../executions/run-link"
|
|
11
12
|
import { AgentStorageError } from "./errors"
|
|
12
|
-
import { AGENT_COMPUTER_BACKGROUND_COMMANDS_MAX } from "./types"
|
|
13
|
+
import { AGENT_COMPUTER_BACKGROUND_COMMANDS_MAX, AGENT_THREAD_INBOX_MAX_ITEMS } from "./types"
|
|
13
14
|
|
|
14
|
-
export { AGENT_COMPUTER_BACKGROUND_COMMANDS_MAX }
|
|
15
|
+
export { AGENT_COMPUTER_BACKGROUND_COMMANDS_MAX, AGENT_THREAD_INBOX_MAX_ITEMS }
|
|
15
16
|
|
|
16
17
|
import type {
|
|
17
18
|
AddAgentThreadParticipantsInput,
|
|
@@ -22,6 +23,9 @@ import type {
|
|
|
22
23
|
AgentBackgroundCommandRef,
|
|
23
24
|
AgentComputerSessionRecord,
|
|
24
25
|
AgentContextCheckpointRecord,
|
|
26
|
+
AgentInboxItemRecord,
|
|
27
|
+
AgentInboxMode,
|
|
28
|
+
AgentInboxSpec,
|
|
25
29
|
AgentMemoryChange,
|
|
26
30
|
AgentMessageRecord,
|
|
27
31
|
AgentRunRecord,
|
|
@@ -32,10 +36,12 @@ import type {
|
|
|
32
36
|
AgentThreadSandboxParams,
|
|
33
37
|
AgentThreadSandboxState,
|
|
34
38
|
AgentTokenRateRecord,
|
|
39
|
+
ConsumeClaimedAgentInboxInput,
|
|
35
40
|
ConversationAgentRunRecord,
|
|
36
41
|
ConversationAgentRunSpec,
|
|
37
42
|
CreateAgentContextCheckpointInput,
|
|
38
43
|
CreateSubagentRunInput,
|
|
44
|
+
EnqueueAgentInboxItemInput,
|
|
39
45
|
FinishAgentRunInput,
|
|
40
46
|
ForkAgentThreadInput,
|
|
41
47
|
ListAgentApprovalsInput,
|
|
@@ -45,11 +51,14 @@ import type {
|
|
|
45
51
|
SubagentRunFile,
|
|
46
52
|
SubagentRunRecord,
|
|
47
53
|
SubagentRunResult,
|
|
54
|
+
TakeAgentInboxSteersInput,
|
|
48
55
|
TransitionAgentThreadSandboxInput,
|
|
56
|
+
UpdateAgentInboxItemInput,
|
|
49
57
|
} from "./types"
|
|
50
58
|
import {
|
|
51
59
|
AGENT_APPROVAL_MODES,
|
|
52
60
|
AGENT_HOLDING_APPROVAL_MODES,
|
|
61
|
+
AGENT_INBOX_MODES,
|
|
53
62
|
AGENT_MEMORY_HISTORY_DAYS,
|
|
54
63
|
AGENT_TOKEN_RATE_MAX_BYTES_PER_TOKEN,
|
|
55
64
|
AGENT_TOKEN_RATE_MIN_BYTES_PER_TOKEN,
|
|
@@ -91,6 +100,23 @@ export function transitionAgentThreadSandbox(
|
|
|
91
100
|
resetAt: new Date().toISOString(),
|
|
92
101
|
}
|
|
93
102
|
}
|
|
103
|
+
if (input.action === "restore") {
|
|
104
|
+
if (thread.activeRunId !== null) return fail("cannot be restored during an active run.")
|
|
105
|
+
if (!state || state.name !== input.name) return fail("changed; reload before restoring.")
|
|
106
|
+
if (state.status !== "busy" && state.status !== "blocked") {
|
|
107
|
+
return fail("does not require recovery.")
|
|
108
|
+
}
|
|
109
|
+
// Only a workspace its run finished preparing holds anything to go on from. A provider never
|
|
110
|
+
// resumes a VM that still runs, so the next run cannot reach a late operation of the last one.
|
|
111
|
+
if (!state.initialized) return fail("was never prepared; start fresh instead.")
|
|
112
|
+
return {
|
|
113
|
+
name: state.name,
|
|
114
|
+
status: "ready",
|
|
115
|
+
initialized: true,
|
|
116
|
+
...(state.sourceFingerprint ? { sourceFingerprint: state.sourceFingerprint } : {}),
|
|
117
|
+
...(state.resetAt ? { resetAt: state.resetAt } : {}),
|
|
118
|
+
}
|
|
119
|
+
}
|
|
94
120
|
if (
|
|
95
121
|
!run ||
|
|
96
122
|
run.threadId !== thread.id ||
|
|
@@ -1538,3 +1564,259 @@ export function agentApprovalMatches(
|
|
|
1538
1564
|
(approval.reportedInMessageId !== undefined) === input.reported)
|
|
1539
1565
|
)
|
|
1540
1566
|
}
|
|
1567
|
+
|
|
1568
|
+
// -- agent_thread_inbox: shared validation and transitions ------------------------------------
|
|
1569
|
+
|
|
1570
|
+
function assertNonEmptyText(value: unknown, field: string, prefix: string): void {
|
|
1571
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
1572
|
+
throw new AgentStorageError(
|
|
1573
|
+
"invalid_input",
|
|
1574
|
+
`[${prefix}] Agent inbox '${field}' must not be empty.`
|
|
1575
|
+
)
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
function assertPrincipalInput(principal: Principal, field: string, prefix: string): void {
|
|
1580
|
+
if (
|
|
1581
|
+
!isPlainRecord(principal) ||
|
|
1582
|
+
!["user", "serviceAccount", "system"].includes(principal.type) ||
|
|
1583
|
+
typeof principal.id !== "string" ||
|
|
1584
|
+
principal.id.trim().length === 0
|
|
1585
|
+
) {
|
|
1586
|
+
throw new AgentStorageError("invalid_input", `[${prefix}] Agent inbox '${field}' is invalid.`)
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1590
|
+
export function assertAgentInboxMode(
|
|
1591
|
+
mode: unknown,
|
|
1592
|
+
prefix = "Sixb"
|
|
1593
|
+
): asserts mode is AgentInboxMode {
|
|
1594
|
+
if (!(AGENT_INBOX_MODES as readonly unknown[]).includes(mode)) {
|
|
1595
|
+
throw new AgentStorageError(
|
|
1596
|
+
"invalid_input",
|
|
1597
|
+
`[${prefix}] Agent inbox mode must be one of: ${AGENT_INBOX_MODES.join(", ")}.`
|
|
1598
|
+
)
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
export function assertAgentInboxSpec(spec: AgentInboxSpec | undefined, prefix = "Sixb"): void {
|
|
1603
|
+
if (spec === undefined) return
|
|
1604
|
+
if (!isPlainRecord(spec)) {
|
|
1605
|
+
throw new AgentStorageError("invalid_input", `[${prefix}] Agent inbox spec must be an object.`)
|
|
1606
|
+
}
|
|
1607
|
+
if (spec.model !== undefined) {
|
|
1608
|
+
if (
|
|
1609
|
+
!isPlainRecord(spec.model) ||
|
|
1610
|
+
typeof spec.model.provider !== "string" ||
|
|
1611
|
+
spec.model.provider.trim().length === 0 ||
|
|
1612
|
+
typeof spec.model.modelId !== "string" ||
|
|
1613
|
+
spec.model.modelId.trim().length === 0
|
|
1614
|
+
) {
|
|
1615
|
+
throw new AgentStorageError(
|
|
1616
|
+
"invalid_input",
|
|
1617
|
+
`[${prefix}] Agent inbox model reference must have non-empty provider and modelId.`
|
|
1618
|
+
)
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
if (spec.reasoning !== undefined) {
|
|
1622
|
+
const validLevel = (AGENT_REASONING_LEVELS as readonly unknown[]).includes(spec.reasoning)
|
|
1623
|
+
if (!validLevel && !isModelReasoning(spec.reasoning)) {
|
|
1624
|
+
throw new AgentStorageError("invalid_input", `[${prefix}] Agent inbox reasoning is invalid.`)
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
if (
|
|
1628
|
+
spec.approvalMode !== undefined &&
|
|
1629
|
+
!(AGENT_APPROVAL_MODES as readonly unknown[]).includes(spec.approvalMode)
|
|
1630
|
+
) {
|
|
1631
|
+
throw new AgentStorageError(
|
|
1632
|
+
"invalid_input",
|
|
1633
|
+
`[${prefix}] Agent inbox approvalMode must be one of: ${AGENT_APPROVAL_MODES.join(", ")}.`
|
|
1634
|
+
)
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
|
|
1638
|
+
export function assertEnqueueAgentInboxItemInput(
|
|
1639
|
+
input: EnqueueAgentInboxItemInput,
|
|
1640
|
+
prefix = "Sixb"
|
|
1641
|
+
): void {
|
|
1642
|
+
assertNonEmptyText(input.projectId, "projectId", prefix)
|
|
1643
|
+
assertNonEmptyText(input.id, "id", prefix)
|
|
1644
|
+
assertNonEmptyText(input.threadId, "threadId", prefix)
|
|
1645
|
+
assertNonEmptyText(input.messageId, "messageId", prefix)
|
|
1646
|
+
assertPrincipalInput(input.authorPrincipal, "authorPrincipal", prefix)
|
|
1647
|
+
assertAgentInboxMode(input.mode, prefix)
|
|
1648
|
+
assertAgentInboxParts(input.parts, input.mode, prefix)
|
|
1649
|
+
assertAgentInboxSpec(input.spec, prefix)
|
|
1650
|
+
if (input.executionId !== undefined) assertNonEmptyText(input.executionId, "executionId", prefix)
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* A steer is read mid-turn, where nothing prepares its files: its bytes must be the ones a later
|
|
1655
|
+
* replay of the saved message sends, so it carries no file part. A message with one waits for the
|
|
1656
|
+
* next turn, where the turn prepares its attachments as it does the trigger's.
|
|
1657
|
+
*/
|
|
1658
|
+
function assertAgentInboxParts(
|
|
1659
|
+
parts: readonly AgentMessagePart[] | undefined,
|
|
1660
|
+
mode: AgentInboxMode,
|
|
1661
|
+
prefix: string
|
|
1662
|
+
): void {
|
|
1663
|
+
if (!Array.isArray(parts) || parts.length === 0) {
|
|
1664
|
+
throw new AgentStorageError(
|
|
1665
|
+
"invalid_input",
|
|
1666
|
+
`[${prefix}] Agent inbox 'parts' must be a non-empty array.`
|
|
1667
|
+
)
|
|
1668
|
+
}
|
|
1669
|
+
if (mode === "steer" && parts.some((part) => part.type === "file")) {
|
|
1670
|
+
throw new AgentStorageError(
|
|
1671
|
+
"invalid_input",
|
|
1672
|
+
`[${prefix}] An agent inbox 'steer' carries no file: queue it for the next turn instead.`
|
|
1673
|
+
)
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
export function assertUpdateAgentInboxItemInput(
|
|
1678
|
+
input: UpdateAgentInboxItemInput,
|
|
1679
|
+
prefix = "Sixb"
|
|
1680
|
+
): void {
|
|
1681
|
+
assertNonEmptyText(input.projectId, "projectId", prefix)
|
|
1682
|
+
assertNonEmptyText(input.threadId, "threadId", prefix)
|
|
1683
|
+
assertNonEmptyText(input.id, "id", prefix)
|
|
1684
|
+
if (input.mode !== undefined) assertAgentInboxMode(input.mode, prefix)
|
|
1685
|
+
if (input.parts !== undefined) assertAgentInboxParts(input.parts, input.mode ?? "queue", prefix)
|
|
1686
|
+
if (input.spec !== undefined && input.spec !== null) assertAgentInboxSpec(input.spec, prefix)
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
export function assertTakeAgentInboxSteersInput(
|
|
1690
|
+
input: TakeAgentInboxSteersInput,
|
|
1691
|
+
prefix = "Sixb"
|
|
1692
|
+
): void {
|
|
1693
|
+
assertNonEmptyText(input.projectId, "projectId", prefix)
|
|
1694
|
+
assertNonEmptyText(input.threadId, "threadId", prefix)
|
|
1695
|
+
assertNonEmptyText(input.runId, "runId", prefix)
|
|
1696
|
+
assertNonEmptyText(input.executionToken, "executionToken", prefix)
|
|
1697
|
+
if (!Number.isInteger(input.stepIndex) || input.stepIndex < 0) {
|
|
1698
|
+
throw new AgentStorageError(
|
|
1699
|
+
"invalid_input",
|
|
1700
|
+
`[${prefix}] Agent inbox 'stepIndex' must be a non-negative integer.`
|
|
1701
|
+
)
|
|
1702
|
+
}
|
|
1703
|
+
assertPrincipalInput(input.authorPrincipal, "authorPrincipal", prefix)
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
export function assertInboxThreadAcceptsItem(
|
|
1707
|
+
thread: Pick<AgentThreadRecord, "id" | "kind" | "status"> | null,
|
|
1708
|
+
threadId: string,
|
|
1709
|
+
projectId: string,
|
|
1710
|
+
existingCount: number,
|
|
1711
|
+
prefix = "Sixb"
|
|
1712
|
+
): void {
|
|
1713
|
+
if (!thread) {
|
|
1714
|
+
throw new AgentStorageError(
|
|
1715
|
+
"thread_not_found",
|
|
1716
|
+
`[${prefix}] Agent thread '${threadId}' not found for project '${projectId}'.`
|
|
1717
|
+
)
|
|
1718
|
+
}
|
|
1719
|
+
assertConversationThreadRow(thread, "holds inbox messages", prefix)
|
|
1720
|
+
if (thread.status !== "active") {
|
|
1721
|
+
throw new AgentStorageError(
|
|
1722
|
+
"invalid_state",
|
|
1723
|
+
`[${prefix}] Archived agent thread '${thread.id}' does not accept inbox messages.`
|
|
1724
|
+
)
|
|
1725
|
+
}
|
|
1726
|
+
if (existingCount >= AGENT_THREAD_INBOX_MAX_ITEMS) {
|
|
1727
|
+
throw new AgentStorageError(
|
|
1728
|
+
"inbox_limit",
|
|
1729
|
+
`[${prefix}] Agent thread '${thread.id}' can hold at most ${AGENT_THREAD_INBOX_MAX_ITEMS} pending inbox items.`
|
|
1730
|
+
)
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
export function assertInboxRunOwnership(
|
|
1735
|
+
run: Pick<AgentRunRecord, "id" | "kind" | "threadId" | "status" | "execution"> | null,
|
|
1736
|
+
input: Pick<ConsumeClaimedAgentInboxInput, "projectId" | "threadId" | "runId" | "executionToken">,
|
|
1737
|
+
prefix = "Sixb"
|
|
1738
|
+
): void {
|
|
1739
|
+
if (
|
|
1740
|
+
!run ||
|
|
1741
|
+
run.kind !== "conversation" ||
|
|
1742
|
+
run.threadId !== input.threadId ||
|
|
1743
|
+
run.status !== "running" ||
|
|
1744
|
+
run.execution?.token !== input.executionToken
|
|
1745
|
+
) {
|
|
1746
|
+
throw new AgentStorageError(
|
|
1747
|
+
"execution_lost",
|
|
1748
|
+
`[${prefix}] Execution token is no longer current on agent run '${input.runId}'.`
|
|
1749
|
+
)
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
export function newAgentInboxItemRecord(
|
|
1754
|
+
input: EnqueueAgentInboxItemInput,
|
|
1755
|
+
seq: number
|
|
1756
|
+
): AgentInboxItemRecord {
|
|
1757
|
+
const createdAt = new Date(input.createdAt ?? new Date())
|
|
1758
|
+
const normalizedSpec = normalizeInboxSpec(input.spec)
|
|
1759
|
+
return {
|
|
1760
|
+
id: input.id,
|
|
1761
|
+
projectId: input.projectId,
|
|
1762
|
+
threadId: input.threadId,
|
|
1763
|
+
messageId: input.messageId,
|
|
1764
|
+
seq,
|
|
1765
|
+
authorPrincipal: structuredClone(input.authorPrincipal),
|
|
1766
|
+
mode: input.mode,
|
|
1767
|
+
parts: structuredClone(input.parts),
|
|
1768
|
+
...(normalizedSpec ? { spec: normalizedSpec } : {}),
|
|
1769
|
+
...(input.timeZone ? { timeZone: input.timeZone } : {}),
|
|
1770
|
+
...(input.locale ? { locale: input.locale } : {}),
|
|
1771
|
+
...(input.immediate ? { immediate: true } : {}),
|
|
1772
|
+
...(input.executionId ? { executionId: input.executionId } : {}),
|
|
1773
|
+
createdAt,
|
|
1774
|
+
updatedAt: new Date(createdAt),
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
export function updatedAgentInboxItemRecord(
|
|
1779
|
+
current: AgentInboxItemRecord,
|
|
1780
|
+
input: UpdateAgentInboxItemInput
|
|
1781
|
+
): AgentInboxItemRecord {
|
|
1782
|
+
if (current.claimedBy !== undefined) {
|
|
1783
|
+
throw new AgentStorageError(
|
|
1784
|
+
"invalid_state",
|
|
1785
|
+
`[Sixb] Agent inbox item '${current.id}' was already claimed by run '${current.claimedBy.runId}'.`
|
|
1786
|
+
)
|
|
1787
|
+
}
|
|
1788
|
+
const nextSpec =
|
|
1789
|
+
input.spec === undefined
|
|
1790
|
+
? current.spec
|
|
1791
|
+
: input.spec === null
|
|
1792
|
+
? undefined
|
|
1793
|
+
: normalizeInboxSpec(input.spec)
|
|
1794
|
+
const nextImmediate = input.immediate === undefined ? current.immediate : input.immediate
|
|
1795
|
+
const { spec: _oldSpec, immediate: _oldImmediate, ...base } = current
|
|
1796
|
+
const mode = input.mode ?? current.mode
|
|
1797
|
+
const parts =
|
|
1798
|
+
input.parts !== undefined ? structuredClone(input.parts) : structuredClone(current.parts)
|
|
1799
|
+
// Promoting a message that carries a file to a steer would read bytes a replay cannot send.
|
|
1800
|
+
assertAgentInboxParts(parts, mode, "Sixb")
|
|
1801
|
+
return {
|
|
1802
|
+
...base,
|
|
1803
|
+
mode,
|
|
1804
|
+
parts,
|
|
1805
|
+
...(nextSpec ? { spec: structuredClone(nextSpec) } : {}),
|
|
1806
|
+
...(nextImmediate ? { immediate: true } : {}),
|
|
1807
|
+
updatedAt: new Date(input.updatedAt ?? new Date()),
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
function normalizeInboxSpec(spec: AgentInboxSpec | undefined): AgentInboxSpec | undefined {
|
|
1812
|
+
if (!spec) return undefined
|
|
1813
|
+
const out: {
|
|
1814
|
+
model?: AgentInboxSpec["model"]
|
|
1815
|
+
reasoning?: AgentInboxSpec["reasoning"]
|
|
1816
|
+
approvalMode?: AgentInboxSpec["approvalMode"]
|
|
1817
|
+
} = {}
|
|
1818
|
+
if (spec.model !== undefined) out.model = structuredClone(spec.model)
|
|
1819
|
+
if (spec.reasoning !== undefined) out.reasoning = structuredClone(spec.reasoning)
|
|
1820
|
+
if (spec.approvalMode !== undefined) out.approvalMode = spec.approvalMode
|
|
1821
|
+
return Object.keys(out).length > 0 ? out : undefined
|
|
1822
|
+
}
|
|
@@ -63,6 +63,11 @@ export type TransitionAgentThreadSandboxInput = {
|
|
|
63
63
|
readonly expectedSandboxName: string
|
|
64
64
|
readonly name: string
|
|
65
65
|
}
|
|
66
|
+
| {
|
|
67
|
+
/** Go on in the sandbox a failed save left, as its owner chose: the one named `name`. */
|
|
68
|
+
readonly action: "restore"
|
|
69
|
+
readonly name: string
|
|
70
|
+
}
|
|
66
71
|
)
|
|
67
72
|
|
|
68
73
|
/**
|
|
@@ -477,7 +482,7 @@ export interface SubagentRunFile {
|
|
|
477
482
|
readonly fileRef: FileRef
|
|
478
483
|
}
|
|
479
484
|
|
|
480
|
-
/** Durable child output returned to its parent by `
|
|
485
|
+
/** Durable child output returned to its parent by `wait`. */
|
|
481
486
|
export interface SubagentRunResult {
|
|
482
487
|
/** Empty only for a child that paused on its held calls before it answered. */
|
|
483
488
|
readonly text: string
|
|
@@ -1362,6 +1367,167 @@ export interface AgentTokenRateStore {
|
|
|
1362
1367
|
}): Promise<readonly AgentTokenRateRecord[]>
|
|
1363
1368
|
}
|
|
1364
1369
|
|
|
1370
|
+
// -- agent_thread_inbox: mid-run steers and queued follow-up messages -------------------------
|
|
1371
|
+
|
|
1372
|
+
export const AGENT_INBOX_MODES = ["steer", "queue"] as const
|
|
1373
|
+
export type AgentInboxMode = (typeof AGENT_INBOX_MODES)[number]
|
|
1374
|
+
|
|
1375
|
+
/** Maximum pending items one conversation thread holds in its inbox at once. */
|
|
1376
|
+
export const AGENT_THREAD_INBOX_MAX_ITEMS = 50
|
|
1377
|
+
|
|
1378
|
+
/** Optional per-turn overrides carried by a queued or immediate inbox item. */
|
|
1379
|
+
export interface AgentInboxSpec {
|
|
1380
|
+
readonly model?: LanguageModelRef
|
|
1381
|
+
readonly reasoning?: AgentReasoning
|
|
1382
|
+
readonly approvalMode?: AgentApprovalMode
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
/** Claim recorded when a running conversation turn drains a `steer` item at a step boundary. */
|
|
1386
|
+
export interface AgentInboxClaim {
|
|
1387
|
+
readonly runId: string
|
|
1388
|
+
readonly executionToken: string
|
|
1389
|
+
readonly stepIndex: number
|
|
1390
|
+
readonly afterAnswer?: boolean
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
export interface AgentInboxItemRecord {
|
|
1394
|
+
readonly id: string
|
|
1395
|
+
readonly projectId: string
|
|
1396
|
+
readonly threadId: string
|
|
1397
|
+
/** Stable id reserved for `agent_messages` once this item is delivered. */
|
|
1398
|
+
readonly messageId: string
|
|
1399
|
+
readonly seq: number
|
|
1400
|
+
readonly authorPrincipal: Principal
|
|
1401
|
+
readonly mode: AgentInboxMode
|
|
1402
|
+
readonly parts: readonly AgentMessagePart[]
|
|
1403
|
+
readonly spec?: AgentInboxSpec
|
|
1404
|
+
readonly timeZone?: string
|
|
1405
|
+
readonly locale?: string
|
|
1406
|
+
/** Marked by Send now so `afterAgentRunFinished` dispatches it across a user cancel. */
|
|
1407
|
+
readonly immediate?: boolean
|
|
1408
|
+
/**
|
|
1409
|
+
* The execution of the request that sent it. A turn that starts it without a request of its
|
|
1410
|
+
* sender's runs as a child of this one, with the sender's grants as they are then.
|
|
1411
|
+
*/
|
|
1412
|
+
readonly executionId?: string
|
|
1413
|
+
readonly claimedBy?: AgentInboxClaim
|
|
1414
|
+
readonly createdAt: Date
|
|
1415
|
+
readonly updatedAt: Date
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
export interface EnqueueAgentInboxItemInput {
|
|
1419
|
+
readonly id: string
|
|
1420
|
+
readonly projectId: string
|
|
1421
|
+
readonly threadId: string
|
|
1422
|
+
readonly messageId: string
|
|
1423
|
+
readonly authorPrincipal: Principal
|
|
1424
|
+
readonly mode: AgentInboxMode
|
|
1425
|
+
readonly parts: readonly AgentMessagePart[]
|
|
1426
|
+
readonly spec?: AgentInboxSpec
|
|
1427
|
+
readonly timeZone?: string
|
|
1428
|
+
readonly locale?: string
|
|
1429
|
+
readonly immediate?: boolean
|
|
1430
|
+
readonly executionId?: string
|
|
1431
|
+
readonly createdAt?: Date
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
export interface EnqueueAgentInboxItemResult {
|
|
1435
|
+
readonly item: AgentInboxItemRecord
|
|
1436
|
+
readonly created: boolean
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
export interface ListAgentInboxItemsInput {
|
|
1440
|
+
readonly projectId: string
|
|
1441
|
+
readonly threadId: string
|
|
1442
|
+
/** Whether items already claimed by a running step are included; defaults to `true`. */
|
|
1443
|
+
readonly includeClaimed?: boolean
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
export interface UpdateAgentInboxItemInput {
|
|
1447
|
+
readonly projectId: string
|
|
1448
|
+
readonly threadId: string
|
|
1449
|
+
readonly id: string
|
|
1450
|
+
readonly mode?: AgentInboxMode
|
|
1451
|
+
readonly parts?: readonly AgentMessagePart[]
|
|
1452
|
+
readonly spec?: AgentInboxSpec | null
|
|
1453
|
+
readonly immediate?: boolean
|
|
1454
|
+
readonly updatedAt?: Date
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
export interface RemoveAgentInboxItemInput {
|
|
1458
|
+
readonly projectId: string
|
|
1459
|
+
readonly threadId: string
|
|
1460
|
+
readonly id: string
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
export interface TakeAgentInboxSteersInput {
|
|
1464
|
+
readonly projectId: string
|
|
1465
|
+
readonly threadId: string
|
|
1466
|
+
readonly runId: string
|
|
1467
|
+
readonly executionToken: string
|
|
1468
|
+
readonly stepIndex: number
|
|
1469
|
+
readonly afterAnswer?: boolean
|
|
1470
|
+
/**
|
|
1471
|
+
* The run's requester: a turn runs as them, so it reads only the steers they sent. Another
|
|
1472
|
+
* participant's steer waits for a turn of theirs.
|
|
1473
|
+
*/
|
|
1474
|
+
readonly authorPrincipal: Principal
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
export interface ConsumeClaimedAgentInboxInput {
|
|
1478
|
+
readonly projectId: string
|
|
1479
|
+
readonly threadId: string
|
|
1480
|
+
readonly runId: string
|
|
1481
|
+
readonly executionToken: string
|
|
1482
|
+
/** Message ids persisted into `agent_messages`; other claims of this run are released. */
|
|
1483
|
+
readonly messageIds: readonly string[]
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
export interface TakeNextQueuedAgentInboxInput {
|
|
1487
|
+
readonly projectId: string
|
|
1488
|
+
readonly threadId: string
|
|
1489
|
+
/** When `true`, only an item marked `immediate` is popped (used after a user cancel). */
|
|
1490
|
+
readonly onlyImmediate?: boolean
|
|
1491
|
+
/**
|
|
1492
|
+
* Only an item this person sent: a turn runs as its requester, so it starts the messages they
|
|
1493
|
+
* sent, and another participant's waits for a turn of theirs.
|
|
1494
|
+
*/
|
|
1495
|
+
readonly authorPrincipal?: Principal
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
export interface ListWaitingAgentInboxThreadsInput {
|
|
1499
|
+
readonly projectId: string
|
|
1500
|
+
/** Only threads holding an item created before this: newer ones a turn's end is still starting. */
|
|
1501
|
+
readonly createdBefore: Date
|
|
1502
|
+
/** Page after this thread id, in id order. */
|
|
1503
|
+
readonly afterThreadId?: string
|
|
1504
|
+
readonly limit: number
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
export interface AgentInboxStore {
|
|
1508
|
+
enqueue(input: EnqueueAgentInboxItemInput): Promise<EnqueueAgentInboxItemResult>
|
|
1509
|
+
getById(params: { projectId: string; id: string }): Promise<AgentInboxItemRecord | null>
|
|
1510
|
+
list(input: ListAgentInboxItemsInput): Promise<readonly AgentInboxItemRecord[]>
|
|
1511
|
+
/** Update an unclaimed inbox item; throws `invalid_state` when already claimed. */
|
|
1512
|
+
update(input: UpdateAgentInboxItemInput): Promise<AgentInboxItemRecord | null>
|
|
1513
|
+
/** Remove an unclaimed inbox item; throws `invalid_state` when already claimed. */
|
|
1514
|
+
remove(input: RemoveAgentInboxItemInput): Promise<AgentInboxItemRecord | null>
|
|
1515
|
+
/**
|
|
1516
|
+
* Fenced by `(runId, executionToken)`: claim the non-immediate steers `authorPrincipal` sent, in
|
|
1517
|
+
* FIFO order. The thread's running turn holds it, so a claim any other execution left behind (one
|
|
1518
|
+
* this run replaced, or a turn whose release failed) was never written, and is taken over.
|
|
1519
|
+
*/
|
|
1520
|
+
takeSteers(input: TakeAgentInboxSteersInput): Promise<readonly AgentInboxItemRecord[]>
|
|
1521
|
+
/** Consume persisted claims of `(runId, executionToken)` and release any unwritten ones. */
|
|
1522
|
+
consumeClaimed(input: ConsumeClaimedAgentInboxInput): Promise<readonly AgentInboxItemRecord[]>
|
|
1523
|
+
/** Release remaining claims held by `runId` after an interrupted, failed, or cancelled turn. */
|
|
1524
|
+
releaseClaimed(input: { projectId: string; runId: string }): Promise<number>
|
|
1525
|
+
/** Pop the next unclaimed item when `thread.activeRunId` is null; null when busy or empty. */
|
|
1526
|
+
takeNextQueued(input: TakeNextQueuedAgentInboxInput): Promise<AgentInboxItemRecord | null>
|
|
1527
|
+
/** Ids of threads no turn holds whose inbox still holds an item, for the repair pass. */
|
|
1528
|
+
listWaitingThreads(input: ListWaitingAgentInboxThreadsInput): Promise<readonly string[]>
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1365
1531
|
export interface AgentStorage {
|
|
1366
1532
|
readonly threads: AgentThreadStore
|
|
1367
1533
|
readonly runs: AgentRunStore
|
|
@@ -1372,4 +1538,5 @@ export interface AgentStorage {
|
|
|
1372
1538
|
readonly approvalModes: AgentApprovalModeStore
|
|
1373
1539
|
readonly computers: AgentComputerSessionStore
|
|
1374
1540
|
readonly tokenRates: AgentTokenRateStore
|
|
1541
|
+
readonly inbox: AgentInboxStore
|
|
1375
1542
|
}
|
|
@@ -14,6 +14,8 @@ import type {
|
|
|
14
14
|
ArtifactCommentKey,
|
|
15
15
|
ArtifactCommentRecord,
|
|
16
16
|
ArtifactFrameGrantRecord,
|
|
17
|
+
ArtifactPdfKeyInput,
|
|
18
|
+
ArtifactPdfRecord,
|
|
17
19
|
ArtifactRecord,
|
|
18
20
|
ArtifactRestorePointReason,
|
|
19
21
|
ArtifactRestorePointRecord,
|
|
@@ -81,6 +83,7 @@ interface InMemoryArtifactSnapshot {
|
|
|
81
83
|
readonly frameGrants: ReadonlyMap<string, ArtifactFrameGrantRecord>
|
|
82
84
|
readonly state: ReadonlyMap<string, ReadonlyMap<string, ArtifactStateEntry>>
|
|
83
85
|
readonly boardPreviews: ReadonlyMap<string, ArtifactBoardPreviewRecord>
|
|
86
|
+
readonly pdfs: ReadonlyMap<string, ArtifactPdfRecord>
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
export class InMemoryArtifactStorage implements ArtifactStorage {
|
|
@@ -90,6 +93,8 @@ export class InMemoryArtifactStorage implements ArtifactStorage {
|
|
|
90
93
|
private state = new Map<string, Map<string, ArtifactStateEntry>>()
|
|
91
94
|
/** By project, render key, mode, and size; no artifact owns one. */
|
|
92
95
|
private boardPreviews = new Map<string, ArtifactBoardPreviewRecord>()
|
|
96
|
+
/** By project and render key; no artifact owns one. */
|
|
97
|
+
private pdfs = new Map<string, ArtifactPdfRecord>()
|
|
93
98
|
|
|
94
99
|
async create(input: CreateArtifactInput): Promise<PublishedArtifactVersion> {
|
|
95
100
|
const key = artifactKey(input.projectId, input.id)
|
|
@@ -478,6 +483,25 @@ export class InMemoryArtifactStorage implements ArtifactStorage {
|
|
|
478
483
|
}
|
|
479
484
|
}
|
|
480
485
|
|
|
486
|
+
async getPdf(input: ArtifactPdfKeyInput): Promise<ArtifactPdfRecord | null> {
|
|
487
|
+
const kept = this.pdfs.get(`${input.projectId}\0${input.renderKey}`)
|
|
488
|
+
return kept ? structuredClone(kept) : null
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
async putPdf(input: ArtifactPdfRecord): Promise<void> {
|
|
492
|
+
const key = `${input.projectId}\0${input.renderKey}`
|
|
493
|
+
const kept = this.pdfs.get(key)
|
|
494
|
+
if (!kept || ("failure" in kept && !("failure" in input))) {
|
|
495
|
+
this.pdfs.set(key, structuredClone(input))
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
async clearPdfFailure(input: ArtifactPdfKeyInput): Promise<void> {
|
|
500
|
+
const key = `${input.projectId}\0${input.renderKey}`
|
|
501
|
+
const kept = this.pdfs.get(key)
|
|
502
|
+
if (kept && "failure" in kept) this.pdfs.delete(key)
|
|
503
|
+
}
|
|
504
|
+
|
|
481
505
|
async createComment(input: CreateArtifactCommentInput): Promise<ArtifactCommentRecord> {
|
|
482
506
|
const key = artifactKey(input.projectId, input.artifactId)
|
|
483
507
|
const stored = this.artifacts.get(key)
|
|
@@ -516,7 +540,12 @@ export class InMemoryArtifactStorage implements ArtifactStorage {
|
|
|
516
540
|
body: input.body,
|
|
517
541
|
author:
|
|
518
542
|
input.author.type === "guest"
|
|
519
|
-
? {
|
|
543
|
+
? {
|
|
544
|
+
type: "guest",
|
|
545
|
+
id: input.author.id,
|
|
546
|
+
name: input.author.name,
|
|
547
|
+
grantId: input.author.grantId,
|
|
548
|
+
}
|
|
520
549
|
: { type: input.author.type, id: input.author.id },
|
|
521
550
|
...(input.origin
|
|
522
551
|
? { origin: { threadId: input.origin.threadId, runId: input.origin.runId } }
|
|
@@ -588,6 +617,7 @@ export class InMemoryArtifactStorage implements ArtifactStorage {
|
|
|
588
617
|
frameGrants: this.frameGrants,
|
|
589
618
|
state: this.state,
|
|
590
619
|
boardPreviews: this.boardPreviews,
|
|
620
|
+
pdfs: this.pdfs,
|
|
591
621
|
})
|
|
592
622
|
}
|
|
593
623
|
|
|
@@ -597,6 +627,7 @@ export class InMemoryArtifactStorage implements ArtifactStorage {
|
|
|
597
627
|
this.frameGrants = new Map(restored.frameGrants)
|
|
598
628
|
this.state = new Map([...restored.state].map(([key, kept]) => [key, new Map(kept)]))
|
|
599
629
|
this.boardPreviews = new Map(restored.boardPreviews)
|
|
630
|
+
this.pdfs = new Map(restored.pdfs)
|
|
600
631
|
}
|
|
601
632
|
|
|
602
633
|
/**
|
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
ArtifactFrameGrantRecord,
|
|
15
15
|
ArtifactFrameTarget,
|
|
16
16
|
ArtifactKind,
|
|
17
|
+
ArtifactPdfRecord,
|
|
17
18
|
ArtifactRecord,
|
|
18
19
|
ArtifactRestorePointRecord,
|
|
19
20
|
ArtifactStateEntry,
|
|
@@ -207,6 +208,22 @@ export function parseArtifactFrameGrantRow(row: Row): ArtifactFrameGrantRecord {
|
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
210
|
|
|
211
|
+
export function parseArtifactPdfRow(row: Row): ArtifactPdfRecord {
|
|
212
|
+
const renderKey = text(row.renderKey, "renderKey", "PDF")
|
|
213
|
+
const where = `PDF '${renderKey}'`
|
|
214
|
+
const kept = {
|
|
215
|
+
projectId: text(row.projectId, "projectId", where),
|
|
216
|
+
renderKey,
|
|
217
|
+
createdAt: date(row.createdAt, "createdAt", where),
|
|
218
|
+
}
|
|
219
|
+
if (row.failure !== null && row.failure !== undefined) {
|
|
220
|
+
return { ...kept, failure: text(row.failure, "failure", where) }
|
|
221
|
+
}
|
|
222
|
+
const file = json(row.file, "file", where)
|
|
223
|
+
if (!isFileRef(file)) throw corrupt(where, "file is not a file reference")
|
|
224
|
+
return { ...kept, file, pages: positiveInteger(row.pages, "pages", where) }
|
|
225
|
+
}
|
|
226
|
+
|
|
210
227
|
export function parseArtifactBoardPreviewRow(row: Row): ArtifactBoardPreviewRecord {
|
|
211
228
|
const renderKey = text(row.renderKey, "renderKey", "board preview")
|
|
212
229
|
const where = `board preview '${renderKey}'`
|
|
@@ -446,10 +463,15 @@ function principal(type: unknown, id: unknown, column: string, where: string): P
|
|
|
446
463
|
return { type: type as Principal["type"], id: text(id, column, where) }
|
|
447
464
|
}
|
|
448
465
|
|
|
449
|
-
/**
|
|
466
|
+
/**
|
|
467
|
+
* A comment's author: a principal, or a guest with the name they gave and the link they came
|
|
468
|
+
* through, and nothing else.
|
|
469
|
+
*/
|
|
450
470
|
function commentAuthor(row: Row, where: string): ArtifactCommentAuthor {
|
|
451
471
|
if (row.authorPrincipalType !== "guest") {
|
|
452
|
-
if (row.authorName != null
|
|
472
|
+
if (row.authorName != null || row.authorGrantId != null) {
|
|
473
|
+
throw corrupt(where, "a principal's comment keeps a guest's name or link")
|
|
474
|
+
}
|
|
453
475
|
return principal(row.authorPrincipalType, row.authorPrincipalId, "author", where)
|
|
454
476
|
}
|
|
455
477
|
|
|
@@ -457,6 +479,7 @@ function commentAuthor(row: Row, where: string): ArtifactCommentAuthor {
|
|
|
457
479
|
type: "guest",
|
|
458
480
|
id: text(row.authorPrincipalId, "author", where),
|
|
459
481
|
name: text(row.authorName, "authorName", where),
|
|
482
|
+
grantId: text(row.authorGrantId, "authorGrantId", where),
|
|
460
483
|
}
|
|
461
484
|
}
|
|
462
485
|
|