@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
package/src/agents/request.ts
CHANGED
|
@@ -27,6 +27,7 @@ import type { SixbRuntimeContext } from "../runtime/types"
|
|
|
27
27
|
import {
|
|
28
28
|
type AgentApprovalMode,
|
|
29
29
|
type AgentApprovalRecord,
|
|
30
|
+
type AgentInboxItemRecord,
|
|
30
31
|
type AgentStorage,
|
|
31
32
|
AgentStorageError,
|
|
32
33
|
type AgentThreadComputer,
|
|
@@ -53,16 +54,23 @@ import {
|
|
|
53
54
|
resolveAgentApprovalMode,
|
|
54
55
|
turnResumeReadiness,
|
|
55
56
|
} from "./approvals"
|
|
57
|
+
import { cancelAgentRun } from "./cancel"
|
|
56
58
|
import type { AgentContextEntryInput } from "./context/entries"
|
|
57
59
|
import { resolveAgentContextParts } from "./context-resolution"
|
|
58
60
|
import { dispatchQueuedAgentRuns } from "./dispatch"
|
|
59
61
|
import { AgentRequestError } from "./errors"
|
|
60
|
-
import {
|
|
62
|
+
import {
|
|
63
|
+
createAgentInboxItemId,
|
|
64
|
+
createAgentMessageId,
|
|
65
|
+
createAgentRunId,
|
|
66
|
+
createAgentThreadId,
|
|
67
|
+
} from "./ids"
|
|
61
68
|
import type { AgentMessagePart } from "./message"
|
|
62
69
|
import type { TurnModelRouter } from "./model-routing"
|
|
63
70
|
import { assertNoAgentSelector } from "./retired-config"
|
|
64
71
|
import { publishAgentRunActivity } from "./streams/protocol"
|
|
65
72
|
import { assertConversationThread } from "./thread-access"
|
|
73
|
+
import { turnAnsweredEveryMessage } from "./turn-answered"
|
|
66
74
|
import { AGENT_REASONING_LEVELS, type AgentReasoning } from "./types"
|
|
67
75
|
|
|
68
76
|
export interface RequestAgentRunInput {
|
|
@@ -407,6 +415,513 @@ export type AgentTurnResume =
|
|
|
407
415
|
| { readonly status: "resumed"; readonly run: ConversationAgentRunRecord }
|
|
408
416
|
| { readonly status: Exclude<AgentTurnReadiness, "ready"> }
|
|
409
417
|
|
|
418
|
+
/** How a message sent to a thread is delivered while a turn runs. */
|
|
419
|
+
export const AGENT_MESSAGE_DELIVERIES = ["auto", "steer", "queue", "send_now"] as const
|
|
420
|
+
export type AgentMessageDelivery = (typeof AGENT_MESSAGE_DELIVERIES)[number]
|
|
421
|
+
|
|
422
|
+
export interface SendAgentMessageInput
|
|
423
|
+
extends Omit<RequestAgentRunInput, "principal" | "continue"> {
|
|
424
|
+
readonly threadId: string
|
|
425
|
+
/**
|
|
426
|
+
* `auto` (the default) starts a turn, and refuses while another one runs. `steer` reaches the
|
|
427
|
+
* running turn at its next step. `queue` starts a turn once the running one ends. `send_now` stops
|
|
428
|
+
* the running turn and starts this message after it.
|
|
429
|
+
*/
|
|
430
|
+
readonly delivery?: AgentMessageDelivery
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/** What a message became: the turn it started, or the inbox item that waits for one. */
|
|
434
|
+
export type SendAgentMessageResult =
|
|
435
|
+
| {
|
|
436
|
+
readonly kind: "turn"
|
|
437
|
+
readonly run: ConversationAgentRunRecord
|
|
438
|
+
readonly createdThread: boolean
|
|
439
|
+
}
|
|
440
|
+
| { readonly kind: "inbox"; readonly item: AgentInboxItemRecord }
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Send a message to a conversation, delivered as asked.
|
|
444
|
+
*
|
|
445
|
+
* A steer or a send-now reaches only the turn its requester asked for: it runs as them. Any reader
|
|
446
|
+
* may queue a message, which starts as a turn of their own.
|
|
447
|
+
*/
|
|
448
|
+
export async function sendAgentMessage(
|
|
449
|
+
runtime: SixbRuntimeContext,
|
|
450
|
+
execution: ExecutionContext,
|
|
451
|
+
models: AgentRequestModels,
|
|
452
|
+
input: SendAgentMessageInput
|
|
453
|
+
): Promise<SendAgentMessageResult> {
|
|
454
|
+
const delivery = input.delivery ?? "auto"
|
|
455
|
+
const agents = requireAgentStorage(runtime)
|
|
456
|
+
const projectId = runtime.projectId
|
|
457
|
+
const thread = await agents.threads.getById({ projectId, id: input.threadId })
|
|
458
|
+
if (!thread) {
|
|
459
|
+
throw new AgentRequestError(
|
|
460
|
+
"thread_not_found",
|
|
461
|
+
`[Sixb] Agent thread '${input.threadId}' was not found.`
|
|
462
|
+
)
|
|
463
|
+
}
|
|
464
|
+
assertConversationThread(thread)
|
|
465
|
+
|
|
466
|
+
const startTurn = async (): Promise<SendAgentMessageResult> => {
|
|
467
|
+
const { delivery: _delivery, ...request } = input
|
|
468
|
+
const result = await requestAgentRun(runtime, execution, models, request)
|
|
469
|
+
return { kind: "turn", run: result.run, createdThread: result.createdThread }
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Nothing runs, so there is nothing to steer or wait behind.
|
|
473
|
+
const activeId = thread.activeRunId
|
|
474
|
+
if (delivery === "auto" || activeId === null) return startTurn()
|
|
475
|
+
|
|
476
|
+
const active = await agents.runs.getById({ projectId, id: activeId })
|
|
477
|
+
const requester = active
|
|
478
|
+
? (await runtime.storage.executions.getById({ projectId, id: active.executionId }))?.requestedBy
|
|
479
|
+
: undefined
|
|
480
|
+
const principal = messageAuthor(runtime, execution)
|
|
481
|
+
const requesterOfTurn = requester !== undefined && principalsEqual(requester, principal)
|
|
482
|
+
|
|
483
|
+
if (!requesterOfTurn && delivery !== "queue") {
|
|
484
|
+
throw new AgentRequestError(
|
|
485
|
+
"not_run_requester",
|
|
486
|
+
`[Sixb] Agent thread '${thread.id}' runs a turn someone else asked for: only they can steer it or send now. Queue the message for your own turn.`
|
|
487
|
+
)
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
const settings = requesterSettings(input)
|
|
491
|
+
const contextParts = await resolveAgentContextParts(runtime, input.context)
|
|
492
|
+
const trigger = deliveredParts(input, delivery)
|
|
493
|
+
const spec = {
|
|
494
|
+
...(input.model === undefined ? {} : { model: input.model }),
|
|
495
|
+
...(input.reasoning === undefined ? {} : { reasoning: input.reasoning }),
|
|
496
|
+
...(input.approvalMode === undefined ? {} : { approvalMode: input.approvalMode }),
|
|
497
|
+
}
|
|
498
|
+
// The request that sends it is recorded with it: a turn that starts it once this request is gone
|
|
499
|
+
// runs as that request's child, as a turn this request started would have.
|
|
500
|
+
assertRequestAuthorityCanRunAgent(runtime)
|
|
501
|
+
const request = await ensureExecutionRecord(
|
|
502
|
+
runtime.storage.executions,
|
|
503
|
+
executionRecordInputFromRuntime({
|
|
504
|
+
execution,
|
|
505
|
+
runtimeAuthorization: runtime.runtimeAuthorization,
|
|
506
|
+
})
|
|
507
|
+
)
|
|
508
|
+
const { item } = await agents.inbox.enqueue({
|
|
509
|
+
id: createAgentInboxItemId(),
|
|
510
|
+
projectId,
|
|
511
|
+
threadId: thread.id,
|
|
512
|
+
messageId: input.messageId ?? createAgentMessageId(),
|
|
513
|
+
authorPrincipal: principal,
|
|
514
|
+
mode: delivery === "steer" ? "steer" : "queue",
|
|
515
|
+
parts: [...contextParts, ...trigger],
|
|
516
|
+
...(Object.keys(spec).length === 0 ? {} : { spec }),
|
|
517
|
+
...settings,
|
|
518
|
+
...(delivery === "send_now" ? { immediate: true } : {}),
|
|
519
|
+
executionId: request.id,
|
|
520
|
+
})
|
|
521
|
+
|
|
522
|
+
if (delivery === "send_now") {
|
|
523
|
+
await stopTurnBefore(runtime, execution, active as ConversationAgentRunRecord)
|
|
524
|
+
}
|
|
525
|
+
await startIfThreadIdle(runtime, execution, thread.id)
|
|
526
|
+
return { kind: "inbox", item }
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/** What a message the caller sent may become once it waits in a thread's inbox. */
|
|
530
|
+
export interface PromoteAgentInboxItemInput {
|
|
531
|
+
readonly threadId: string
|
|
532
|
+
readonly itemId: string
|
|
533
|
+
/** Edit what it says; its context and files stay as they are. */
|
|
534
|
+
readonly text?: string
|
|
535
|
+
readonly model?: LanguageModelRef
|
|
536
|
+
readonly reasoning?: AgentReasoning
|
|
537
|
+
readonly approvalMode?: AgentApprovalMode
|
|
538
|
+
/** Steer the running turn with it, or keep it for the next turn. */
|
|
539
|
+
readonly delivery?: "steer" | "queue"
|
|
540
|
+
/** Stop the turn it waits behind, and start it now. */
|
|
541
|
+
readonly immediate?: boolean
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Change a message waiting in a thread's inbox, before a turn reads it: what it says, the model it
|
|
546
|
+
* asks for, where it goes, or that it goes now.
|
|
547
|
+
*
|
|
548
|
+
* Only the person who sent it may change it, and a message that steers or goes now reaches only the
|
|
549
|
+
* turn its own requester asked for.
|
|
550
|
+
*/
|
|
551
|
+
export async function promoteAgentInboxItem(
|
|
552
|
+
runtime: SixbRuntimeContext,
|
|
553
|
+
execution: ExecutionContext,
|
|
554
|
+
input: PromoteAgentInboxItemInput
|
|
555
|
+
): Promise<AgentInboxItemRecord> {
|
|
556
|
+
const agents = requireAgentStorage(runtime)
|
|
557
|
+
const projectId = runtime.projectId
|
|
558
|
+
const thread = await agents.threads.getById({ projectId, id: input.threadId })
|
|
559
|
+
if (!thread) {
|
|
560
|
+
throw new AgentRequestError(
|
|
561
|
+
"thread_not_found",
|
|
562
|
+
`[Sixb] Agent thread '${input.threadId}' was not found.`
|
|
563
|
+
)
|
|
564
|
+
}
|
|
565
|
+
assertConversationThread(thread)
|
|
566
|
+
|
|
567
|
+
const item = await agents.inbox.getById({ projectId, id: input.itemId })
|
|
568
|
+
if (!item || item.threadId !== thread.id) {
|
|
569
|
+
throw new AgentRequestError(
|
|
570
|
+
"invalid_message",
|
|
571
|
+
`[Sixb] Agent inbox item '${input.itemId}' is not waiting in thread '${thread.id}'.`
|
|
572
|
+
)
|
|
573
|
+
}
|
|
574
|
+
const principal = messageAuthor(runtime, execution)
|
|
575
|
+
if (!principalsEqual(item.authorPrincipal, principal)) {
|
|
576
|
+
throw new AgentRequestError(
|
|
577
|
+
"not_run_requester",
|
|
578
|
+
`[Sixb] Agent inbox item '${item.id}' was sent by someone else: only they can change it.`
|
|
579
|
+
)
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
const active = thread.activeRunId
|
|
583
|
+
? await agents.runs.getById({ projectId, id: thread.activeRunId })
|
|
584
|
+
: null
|
|
585
|
+
const delivery = input.delivery ?? item.mode
|
|
586
|
+
const turn = active?.kind === "conversation" ? active : null
|
|
587
|
+
if ((delivery === "steer" || input.immediate === true) && turn) {
|
|
588
|
+
if (!(await askedForTurn(runtime, turn, principal))) {
|
|
589
|
+
throw new AgentRequestError(
|
|
590
|
+
"not_run_requester",
|
|
591
|
+
`[Sixb] Agent thread '${thread.id}' runs a turn someone else asked for: only they can steer it or send now. Keep the message queued for your own turn.`
|
|
592
|
+
)
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
const spec = {
|
|
597
|
+
...(input.model === undefined ? {} : { model: input.model }),
|
|
598
|
+
...(input.reasoning === undefined ? {} : { reasoning: input.reasoning }),
|
|
599
|
+
...(input.approvalMode === undefined ? {} : { approvalMode: input.approvalMode }),
|
|
600
|
+
}
|
|
601
|
+
const updated = await agents.inbox.update({
|
|
602
|
+
projectId,
|
|
603
|
+
threadId: thread.id,
|
|
604
|
+
id: item.id,
|
|
605
|
+
...(input.delivery === undefined ? {} : { mode: input.delivery }),
|
|
606
|
+
...(input.text === undefined
|
|
607
|
+
? {}
|
|
608
|
+
: {
|
|
609
|
+
parts: [
|
|
610
|
+
{ type: "text" as const, text: input.text },
|
|
611
|
+
...item.parts.filter((part) => part.type !== "text"),
|
|
612
|
+
],
|
|
613
|
+
}),
|
|
614
|
+
// What it does not name stays as it asked: a new reasoning keeps its model.
|
|
615
|
+
...(Object.keys(spec).length === 0 ? {} : { spec: { ...item.spec, ...spec } }),
|
|
616
|
+
...(input.immediate === true ? { immediate: true } : {}),
|
|
617
|
+
})
|
|
618
|
+
if (!updated) {
|
|
619
|
+
throw new AgentRequestError(
|
|
620
|
+
"invalid_message",
|
|
621
|
+
`[Sixb] Agent inbox item '${item.id}' is no longer waiting in thread '${thread.id}'.`
|
|
622
|
+
)
|
|
623
|
+
}
|
|
624
|
+
if (input.immediate === true && turn) {
|
|
625
|
+
await stopTurnBefore(runtime, execution, turn)
|
|
626
|
+
}
|
|
627
|
+
await startIfThreadIdle(runtime, execution, thread.id)
|
|
628
|
+
return updated
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Take back a message waiting in a thread's inbox, before a turn reads it. Only the person who sent
|
|
633
|
+
* it may withdraw it.
|
|
634
|
+
*/
|
|
635
|
+
export async function withdrawAgentInboxItem(
|
|
636
|
+
runtime: SixbRuntimeContext,
|
|
637
|
+
execution: ExecutionContext,
|
|
638
|
+
input: { readonly threadId: string; readonly itemId: string }
|
|
639
|
+
): Promise<void> {
|
|
640
|
+
const agents = requireAgentStorage(runtime)
|
|
641
|
+
const projectId = runtime.projectId
|
|
642
|
+
const thread = await agents.threads.getById({ projectId, id: input.threadId })
|
|
643
|
+
if (!thread) {
|
|
644
|
+
throw new AgentRequestError(
|
|
645
|
+
"thread_not_found",
|
|
646
|
+
`[Sixb] Agent thread '${input.threadId}' was not found.`
|
|
647
|
+
)
|
|
648
|
+
}
|
|
649
|
+
assertConversationThread(thread)
|
|
650
|
+
const item = await agents.inbox.getById({ projectId, id: input.itemId })
|
|
651
|
+
if (!item || item.threadId !== thread.id) {
|
|
652
|
+
throw new AgentRequestError(
|
|
653
|
+
"invalid_message",
|
|
654
|
+
`[Sixb] Agent inbox item '${input.itemId}' is not waiting in thread '${thread.id}'.`
|
|
655
|
+
)
|
|
656
|
+
}
|
|
657
|
+
if (!principalsEqual(item.authorPrincipal, messageAuthor(runtime, execution))) {
|
|
658
|
+
throw new AgentRequestError(
|
|
659
|
+
"not_run_requester",
|
|
660
|
+
`[Sixb] Agent inbox item '${item.id}' was sent by someone else: only they can withdraw it.`
|
|
661
|
+
)
|
|
662
|
+
}
|
|
663
|
+
const removed = await agents.inbox.remove({ projectId, threadId: thread.id, id: item.id })
|
|
664
|
+
if (!removed) {
|
|
665
|
+
throw new AgentRequestError(
|
|
666
|
+
"invalid_message",
|
|
667
|
+
`[Sixb] Agent inbox item '${item.id}' is no longer waiting in thread '${thread.id}': a turn read it.`
|
|
668
|
+
)
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
/** The person a message this request sends is from. */
|
|
673
|
+
function messageAuthor(runtime: SixbRuntimeContext, execution: ExecutionContext): Principal {
|
|
674
|
+
const authority = resolveExecutionScopeAuthorization(runtime.projectId, {
|
|
675
|
+
execution,
|
|
676
|
+
authorization: runtime.runtimeAuthorization,
|
|
677
|
+
})
|
|
678
|
+
return authority.type === "principal" ? authority.context.principal : SYSTEM_PRINCIPAL
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/** Whether the person asked for this turn, which alone may steer it or send now. */
|
|
682
|
+
async function askedForTurn(
|
|
683
|
+
runtime: SixbRuntimeContext,
|
|
684
|
+
run: ConversationAgentRunRecord,
|
|
685
|
+
principal: Principal
|
|
686
|
+
): Promise<boolean> {
|
|
687
|
+
const requester = (
|
|
688
|
+
await runtime.storage.executions.getById({ projectId: runtime.projectId, id: run.executionId })
|
|
689
|
+
)?.requestedBy
|
|
690
|
+
return requester !== undefined && principalsEqual(requester, principal)
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Stop the turn a message waits behind, so the message starts now. A turn still running ends first,
|
|
695
|
+
* and its end starts the message (see afterAgentRunFinished); one that never started has no end to
|
|
696
|
+
* wait for, so it starts here.
|
|
697
|
+
*/
|
|
698
|
+
async function stopTurnBefore(
|
|
699
|
+
runtime: SixbRuntimeContext,
|
|
700
|
+
execution: ExecutionContext,
|
|
701
|
+
active: ConversationAgentRunRecord
|
|
702
|
+
): Promise<void> {
|
|
703
|
+
if (active.status === "running") {
|
|
704
|
+
await cancelAgentRun(runtime, active)
|
|
705
|
+
return
|
|
706
|
+
}
|
|
707
|
+
await cancelAgentRun(runtime, active).catch(() => undefined)
|
|
708
|
+
await startQueuedAgentTurnFromInbox(runtime, execution, active, { onlyImmediate: true })
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* Start what the caller left waiting once no turn holds the thread: the turn it waited behind ended
|
|
713
|
+
* before the message reached the inbox, or before a stop reached it, so that end read none of it,
|
|
714
|
+
* or it was someone else's, whose end starts their own messages first. It starts the caller's own
|
|
715
|
+
* turn, as them, by the rules a turn's end applies. A failure leaves the message waiting for the
|
|
716
|
+
* repair pass.
|
|
717
|
+
*/
|
|
718
|
+
async function startIfThreadIdle(
|
|
719
|
+
runtime: SixbRuntimeContext,
|
|
720
|
+
execution: ExecutionContext,
|
|
721
|
+
threadId: string
|
|
722
|
+
): Promise<void> {
|
|
723
|
+
const agents = requireAgentStorage(runtime)
|
|
724
|
+
const projectId = runtime.projectId
|
|
725
|
+
try {
|
|
726
|
+
const thread = await agents.threads.getById({ projectId, id: threadId })
|
|
727
|
+
// A turn holds it: that turn's end starts the message.
|
|
728
|
+
if (!thread || thread.activeRunId !== null) return
|
|
729
|
+
const {
|
|
730
|
+
runs: [last],
|
|
731
|
+
} = await agents.runs.list({
|
|
732
|
+
projectId,
|
|
733
|
+
threadId,
|
|
734
|
+
kinds: ["conversation"],
|
|
735
|
+
order: "desc",
|
|
736
|
+
limit: 1,
|
|
737
|
+
})
|
|
738
|
+
if (last?.kind !== "conversation") return
|
|
739
|
+
// A paused turn resumes first, and its end starts what waits: only a message sent now passes
|
|
740
|
+
// it, setting its held calls aside as a message typed in the chat would.
|
|
741
|
+
const onlyImmediate =
|
|
742
|
+
isAwaitingApprovalRun(last) || !(await turnAnsweredEveryMessage(agents, last))
|
|
743
|
+
await startQueuedAgentTurnFromInbox(runtime, execution, last, { onlyImmediate })
|
|
744
|
+
} catch (error) {
|
|
745
|
+
console.error(
|
|
746
|
+
`[Sixb] Could not start what waits in Agent thread '${threadId}'; the repair pass retries.`,
|
|
747
|
+
error
|
|
748
|
+
)
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/** The parts a message of its own carries: what it says, then the files it brings. */
|
|
753
|
+
function deliveredParts(
|
|
754
|
+
input: Pick<SendAgentMessageInput, "text" | "attachments">,
|
|
755
|
+
delivery: AgentMessageDelivery
|
|
756
|
+
): readonly AgentMessagePart[] {
|
|
757
|
+
if (delivery === "steer" && (input.attachments?.length ?? 0) > 0) {
|
|
758
|
+
throw new AgentRequestError(
|
|
759
|
+
"invalid_attachment",
|
|
760
|
+
"[Sixb] A message that steers a running turn carries no file: queue it for the next turn instead."
|
|
761
|
+
)
|
|
762
|
+
}
|
|
763
|
+
assertAttachments(input.attachments)
|
|
764
|
+
const text =
|
|
765
|
+
typeof input.text === "string" && input.text.trim().length > 0
|
|
766
|
+
? [{ type: "text" as const, text: input.text }]
|
|
767
|
+
: []
|
|
768
|
+
const files = (input.attachments ?? []).map((fileRef) => ({ type: "file" as const, fileRef }))
|
|
769
|
+
if (text.length === 0 && files.length === 0) {
|
|
770
|
+
throw new AgentRequestError(
|
|
771
|
+
"invalid_message",
|
|
772
|
+
"[Sixb] An Agent message needs text or attachments."
|
|
773
|
+
)
|
|
774
|
+
}
|
|
775
|
+
return [...text, ...files]
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/** Where a queued turn started from: the thread moved on, nothing waited, or it started. */
|
|
779
|
+
export type AgentQueuedTurnStart =
|
|
780
|
+
| { readonly status: "started"; readonly run: ConversationAgentRunRecord }
|
|
781
|
+
| { readonly status: "nothing" }
|
|
782
|
+
| { readonly status: "closed" }
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* Start the next message the execution's requester queued for this thread, as them, from
|
|
786
|
+
* `finishedRun`: a turn of the thread, whose model and reasoning carry over.
|
|
787
|
+
*
|
|
788
|
+
* It pops the item in the same transaction that writes its message and its run, so two turns
|
|
789
|
+
* ending at once start one between them. `onlyImmediate` starts only a message someone sent now,
|
|
790
|
+
* which is what a turn that did not answer (a stop, a failure) may follow.
|
|
791
|
+
*/
|
|
792
|
+
export async function startQueuedAgentTurnFromInbox(
|
|
793
|
+
runtime: SixbRuntimeContext,
|
|
794
|
+
execution: ExecutionContext,
|
|
795
|
+
finishedRun: ConversationAgentRunRecord,
|
|
796
|
+
input: { readonly onlyImmediate: boolean }
|
|
797
|
+
): Promise<AgentQueuedTurnStart> {
|
|
798
|
+
resolveExecutionScopeAuthorization(runtime.projectId, {
|
|
799
|
+
execution,
|
|
800
|
+
authorization: runtime.runtimeAuthorization,
|
|
801
|
+
})
|
|
802
|
+
assertAuthorized(runtime, { kind: "agent.run" })
|
|
803
|
+
assertRequestAuthorityCanRunAgent(runtime)
|
|
804
|
+
const agents = requireAgentStorage(runtime)
|
|
805
|
+
const projectId = runtime.projectId
|
|
806
|
+
|
|
807
|
+
// The finished turn's spec is where a queued message starts: its model and reasoning, unless the
|
|
808
|
+
// message names others. A turn too old to carry one has nothing to start from.
|
|
809
|
+
const kept = finishedRun.spec
|
|
810
|
+
if (!kept) return { status: "closed" }
|
|
811
|
+
|
|
812
|
+
const thread = await agents.threads.getById({ projectId, id: finishedRun.threadId })
|
|
813
|
+
if (!thread) return { status: "closed" }
|
|
814
|
+
assertSandboxExecutionAvailable(thread)
|
|
815
|
+
// Whom the turn runs as, and whose messages it starts: a turn starts only its requester's.
|
|
816
|
+
const principal = execution.requestedBy
|
|
817
|
+
if (!principal) return { status: "closed" }
|
|
818
|
+
// Its owner's computer runs its turns as its owner: another's message waits for one of theirs.
|
|
819
|
+
if (thread.runsOn === "computer" && !principalsEqual(principal, thread.ownerPrincipal)) {
|
|
820
|
+
return { status: "closed" }
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
const runId = createAgentRunId()
|
|
824
|
+
const durableExecution = await prepareResumedExecution(runtime, execution, runId)
|
|
825
|
+
await assertAiLimitPreflight(runtime, durableExecution)
|
|
826
|
+
|
|
827
|
+
let started: ConversationAgentRunRecord | null
|
|
828
|
+
let superseded: readonly AgentApprovalRecord[] = []
|
|
829
|
+
try {
|
|
830
|
+
started = await runtime.storage.transaction(async (tx) => {
|
|
831
|
+
const agents = tx.agents
|
|
832
|
+
if (!agents) {
|
|
833
|
+
throw new AgentRequestError(
|
|
834
|
+
"storage_unavailable",
|
|
835
|
+
"[Sixb] Agent storage is not configured."
|
|
836
|
+
)
|
|
837
|
+
}
|
|
838
|
+
const item = await agents.inbox.takeNextQueued({
|
|
839
|
+
projectId,
|
|
840
|
+
threadId: thread.id,
|
|
841
|
+
onlyImmediate: input.onlyImmediate,
|
|
842
|
+
authorPrincipal: principal,
|
|
843
|
+
})
|
|
844
|
+
if (!item) return null
|
|
845
|
+
|
|
846
|
+
const inherited = await resolveAgentApprovalMode(agents, {
|
|
847
|
+
projectId,
|
|
848
|
+
principal,
|
|
849
|
+
threadId: thread.id,
|
|
850
|
+
})
|
|
851
|
+
const approvalMode = item.spec?.approvalMode ?? inherited.approvalMode
|
|
852
|
+
const spec = queuedConversationRunSpec(thread, kept, item, approvalMode)
|
|
853
|
+
|
|
854
|
+
await tx.executions.create(durableExecution)
|
|
855
|
+
// Like any message that starts a turn, it tells the model how its earlier calls ended, and
|
|
856
|
+
// sets aside the ones still waiting.
|
|
857
|
+
const reported = await reportAgentApprovals(agents, {
|
|
858
|
+
projectId,
|
|
859
|
+
threadId: thread.id,
|
|
860
|
+
messageId: item.messageId,
|
|
861
|
+
})
|
|
862
|
+
superseded = reported.superseded
|
|
863
|
+
await agents.messages.append({
|
|
864
|
+
id: item.messageId,
|
|
865
|
+
projectId,
|
|
866
|
+
threadId: thread.id,
|
|
867
|
+
runId: null,
|
|
868
|
+
role: "user",
|
|
869
|
+
parts: [...reported.parts, ...item.parts],
|
|
870
|
+
authorPrincipal: item.authorPrincipal,
|
|
871
|
+
createdAt: item.createdAt,
|
|
872
|
+
...(item.timeZone === undefined && item.locale === undefined
|
|
873
|
+
? {}
|
|
874
|
+
: {
|
|
875
|
+
metadata: {
|
|
876
|
+
...(item.timeZone === undefined ? {} : { timeZone: item.timeZone }),
|
|
877
|
+
...(item.locale === undefined ? {} : { locale: item.locale }),
|
|
878
|
+
},
|
|
879
|
+
}),
|
|
880
|
+
})
|
|
881
|
+
return agents.runs.create({
|
|
882
|
+
id: runId,
|
|
883
|
+
projectId,
|
|
884
|
+
executionId: durableExecution.id,
|
|
885
|
+
threadId: thread.id,
|
|
886
|
+
triggerMessageId: item.messageId,
|
|
887
|
+
spec,
|
|
888
|
+
})
|
|
889
|
+
})
|
|
890
|
+
} catch (error) {
|
|
891
|
+
// A turn took the thread meanwhile: its end starts this message, or its requester does.
|
|
892
|
+
if (error instanceof AgentStorageError && error.code === "active_run_exists") {
|
|
893
|
+
return { status: "closed" }
|
|
894
|
+
}
|
|
895
|
+
throw error
|
|
896
|
+
}
|
|
897
|
+
if (!started) return { status: "nothing" }
|
|
898
|
+
|
|
899
|
+
await announceAgentApprovals(runtime.broker, superseded)
|
|
900
|
+
await publishRunActivity(runtime, started)
|
|
901
|
+
await dispatchAgentRun(runtime, agents, runId)
|
|
902
|
+
return { status: "started", run: started }
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/** A queued message's turn: the finished turn's spec, with the message's own choices over it. */
|
|
906
|
+
function queuedConversationRunSpec(
|
|
907
|
+
thread: AgentThreadRecord,
|
|
908
|
+
kept: ConversationAgentRunSpec,
|
|
909
|
+
item: AgentInboxItemRecord,
|
|
910
|
+
approvalMode: AgentApprovalMode
|
|
911
|
+
): ConversationAgentRunSpec {
|
|
912
|
+
const model = item.spec?.model ?? kept.model
|
|
913
|
+
const reasoning = item.spec?.reasoning ?? kept.reasoning
|
|
914
|
+
const timeZone = item.timeZone ?? kept.timeZone
|
|
915
|
+
const locale = item.locale ?? kept.locale
|
|
916
|
+
return inPlace(thread, {
|
|
917
|
+
model,
|
|
918
|
+
...(reasoning === undefined ? {} : { reasoning }),
|
|
919
|
+
...(timeZone === undefined ? {} : { timeZone }),
|
|
920
|
+
...(locale === undefined ? {} : { locale }),
|
|
921
|
+
approvalMode,
|
|
922
|
+
})
|
|
923
|
+
}
|
|
924
|
+
|
|
410
925
|
/**
|
|
411
926
|
* Resume a turn that paused on held calls, once its requester decided on all of them: a new turn
|
|
412
927
|
* with the paused one's spec and the given mode, whose trigger message carries how each call ended,
|
|
@@ -733,7 +1248,7 @@ function assertSandboxExecutionAvailable(thread: AgentThreadRecord): void {
|
|
|
733
1248
|
if (thread.sandboxState && !["new", "ready"].includes(thread.sandboxState.status)) {
|
|
734
1249
|
throw new AgentRequestError(
|
|
735
1250
|
"sandbox_execution_unavailable",
|
|
736
|
-
"[Sixb] Sandbox recovery is required before another run. Reload the thread
|
|
1251
|
+
"[Sixb] Sandbox recovery is required before another run. Reload the thread, then resume its previous sandbox or recreate it to start fresh."
|
|
737
1252
|
)
|
|
738
1253
|
}
|
|
739
1254
|
}
|