@sixb/core 0.2.5 → 0.2.7
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 +36 -35
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/validation.d.ts.map +1 -1
- package/dist/agents/errors.d.ts +1 -1
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/execution.d.ts +17 -2
- package/dist/agents/execution.d.ts.map +1 -1
- package/dist/agents/index.d.ts +3 -3
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +53 -45
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-routing.d.ts +16 -2
- package/dist/agents/model-routing.d.ts.map +1 -1
- package/dist/agents/request.d.ts +45 -4
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/run-events.d.ts +4 -0
- package/dist/agents/run-events.d.ts.map +1 -1
- package/dist/agents/run-session-children.d.ts.map +1 -1
- package/dist/agents/run-token.d.ts +6 -0
- package/dist/agents/run-token.d.ts.map +1 -1
- package/dist/agents/run-turn.d.ts +9 -1
- package/dist/agents/run-turn.d.ts.map +1 -1
- package/dist/agents/streams/index.d.ts +1 -1
- package/dist/agents/streams/index.d.ts.map +1 -1
- package/dist/agents/streams/index.js +1 -1
- package/dist/agents/streams/internal.d.ts +2 -1
- package/dist/agents/streams/internal.d.ts.map +1 -1
- package/dist/agents/streams/internal.js +22 -2
- package/dist/agents/streams/internal.js.map +1 -1
- package/dist/agents/streams/protocol.d.ts +37 -0
- package/dist/agents/streams/protocol.d.ts.map +1 -1
- package/dist/agents/streams/steps.d.ts +24 -0
- package/dist/agents/streams/steps.d.ts.map +1 -0
- package/dist/agents/thread-access.d.ts +44 -2
- package/dist/agents/thread-access.d.ts.map +1 -1
- package/dist/artifacts/live/server.js +19 -18
- package/dist/artifacts/live/server.js.map +1 -1
- package/dist/artifacts/publish/index.js +18 -17
- package/dist/artifacts/publish/index.js.map +1 -1
- package/dist/artifacts/publish/merge.d.ts +2 -1
- package/dist/artifacts/publish/merge.d.ts.map +1 -1
- package/dist/artifacts/run-query.d.ts.map +1 -1
- package/dist/auth/index.js +6 -6
- package/dist/authorization/index.js +2 -2
- package/dist/bootstrap/discovery.d.ts +6 -0
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.js +40 -38
- package/dist/bootstrap/index.js.map +2 -2
- package/dist/calendar.d.ts +55 -0
- package/dist/calendar.d.ts.map +1 -0
- package/dist/calendar.js +19 -0
- package/dist/calendar.js.map +9 -0
- package/dist/chunk-04r2fdsd.js +386 -0
- package/dist/chunk-04r2fdsd.js.map +14 -0
- package/dist/{chunk-gjhrz66x.js → chunk-06kpaqg4.js} +248 -21
- package/dist/{chunk-gjhrz66x.js.map → chunk-06kpaqg4.js.map} +6 -6
- package/dist/{chunk-5a4a52tq.js → chunk-0pmpwn3g.js} +18 -2
- package/dist/chunk-0pmpwn3g.js.map +10 -0
- package/dist/{chunk-nxysqbt0.js → chunk-389ybvw9.js} +6 -2
- package/dist/chunk-389ybvw9.js.map +10 -0
- package/dist/{chunk-xcrnrpfh.js → chunk-394zjzjs.js} +20 -10
- package/dist/{chunk-xcrnrpfh.js.map → chunk-394zjzjs.js.map} +5 -5
- package/dist/{chunk-stmxh0hv.js → chunk-3neam1y5.js} +2 -2
- package/dist/{chunk-zeykm8my.js → chunk-3qtk0070.js} +16 -42
- package/dist/chunk-3qtk0070.js.map +14 -0
- package/dist/{chunk-0hkdtwqk.js → chunk-44hrfmbk.js} +5 -5
- package/dist/{chunk-ey1p8w68.js → chunk-5pz3htbe.js} +86 -5
- package/dist/chunk-5pz3htbe.js.map +13 -0
- package/dist/{chunk-s5pj68fa.js → chunk-5sswe5ej.js} +2 -2
- package/dist/{chunk-k3jh8gsg.js → chunk-5xkqasvn.js} +21 -4
- package/dist/chunk-5xkqasvn.js.map +10 -0
- package/dist/{chunk-5t9gm5tt.js → chunk-6md802cc.js} +38 -14
- package/dist/chunk-6md802cc.js.map +22 -0
- package/dist/{chunk-3zagkr6w.js → chunk-7mhbs9yy.js} +4 -4
- package/dist/{chunk-3zagkr6w.js.map → chunk-7mhbs9yy.js.map} +1 -1
- package/dist/{chunk-ewqn51gr.js → chunk-88xeh6zx.js} +6 -4
- package/dist/{chunk-ewqn51gr.js.map → chunk-88xeh6zx.js.map} +4 -4
- package/dist/{chunk-z1njfqqs.js → chunk-8qmp9fpa.js} +783 -171
- package/dist/{chunk-z1njfqqs.js.map → chunk-8qmp9fpa.js.map} +13 -13
- package/dist/{chunk-r2psmn42.js → chunk-95ps0k5q.js} +3 -3
- package/dist/{chunk-r2psmn42.js.map → chunk-95ps0k5q.js.map} +3 -3
- package/dist/{chunk-fpf57gca.js → chunk-9cyq87qa.js} +276 -68
- package/dist/{chunk-fpf57gca.js.map → chunk-9cyq87qa.js.map} +6 -6
- package/dist/{chunk-q9nkpr8k.js → chunk-9tpmfh3n.js} +1 -1
- package/dist/chunk-9wr3yajk.js.map +2 -2
- package/dist/{chunk-naxjka9v.js → chunk-brhp9d97.js} +2 -2
- package/dist/{chunk-8a8k38tz.js → chunk-brybqw5k.js} +1 -1
- package/dist/{chunk-vehcr9eb.js → chunk-cg7cygfj.js} +1 -1
- package/dist/{chunk-b4escq4c.js → chunk-cpy282b8.js} +6 -6
- package/dist/chunk-dq3t5sr3.js +114 -0
- package/dist/chunk-dq3t5sr3.js.map +11 -0
- package/dist/{chunk-68hm50qh.js → chunk-fdk0ks9p.js} +16 -46
- package/dist/chunk-fdk0ks9p.js.map +12 -0
- package/dist/{chunk-fzae1jpq.js → chunk-fycac8e9.js} +50 -16
- package/dist/{chunk-fzae1jpq.js.map → chunk-fycac8e9.js.map} +3 -3
- package/dist/{chunk-zft9bzbc.js → chunk-hkbks1xm.js} +2 -1
- package/dist/{chunk-zft9bzbc.js.map → chunk-hkbks1xm.js.map} +3 -3
- package/dist/{chunk-m3qx2pns.js → chunk-hvq8xs66.js} +28 -12
- package/dist/{chunk-m3qx2pns.js.map → chunk-hvq8xs66.js.map} +5 -5
- package/dist/{chunk-bc3y6gff.js → chunk-jka26v8c.js} +1 -1
- package/dist/{chunk-s1mqyqmm.js → chunk-js9e6487.js} +12 -8
- package/dist/chunk-js9e6487.js.map +18 -0
- package/dist/{chunk-zxhym8tr.js → chunk-k29rdc3h.js} +1 -1
- package/dist/{chunk-rg725hry.js → chunk-m1cwncee.js} +86 -34
- package/dist/{chunk-rg725hry.js.map → chunk-m1cwncee.js.map} +8 -8
- package/dist/{chunk-1yh6jgtz.js → chunk-mrs7jy17.js} +2 -2
- package/dist/{chunk-qavwr628.js → chunk-n1hbwc6y.js} +5 -6
- package/dist/chunk-n1hbwc6y.js.map +12 -0
- package/dist/{chunk-pqvvqc65.js → chunk-pfdq1ga6.js} +3 -3
- package/dist/{chunk-k29n4176.js → chunk-phs5fbff.js} +6 -6
- package/dist/{chunk-wqe9shx2.js → chunk-qbd282aa.js} +2 -2
- package/dist/{chunk-e91fmg6t.js → chunk-qsa7nw6f.js} +2 -1
- package/dist/{chunk-e91fmg6t.js.map → chunk-qsa7nw6f.js.map} +3 -3
- package/dist/chunk-r588h4ev.js +98 -0
- package/dist/chunk-r588h4ev.js.map +10 -0
- package/dist/{chunk-rtdrm592.js → chunk-t58sktr5.js} +12 -4
- package/dist/{chunk-rtdrm592.js.map → chunk-t58sktr5.js.map} +3 -3
- package/dist/{chunk-paxabbqd.js → chunk-tapdssb5.js} +1 -1
- package/dist/{chunk-dhkc9b23.js → chunk-v8a1qjzp.js} +1 -1
- package/dist/{chunk-q8d9p0tb.js → chunk-wzcjhv54.js} +8 -1
- package/dist/{chunk-q8d9p0tb.js.map → chunk-wzcjhv54.js.map} +3 -3
- package/dist/{chunk-pc7kra3k.js → chunk-xavet0qs.js} +1 -1
- package/dist/{chunk-m9ketb51.js → chunk-ygvay56w.js} +1 -1
- package/dist/{chunk-0mvjpgvm.js → chunk-yyj009tv.js} +4 -4
- package/dist/connectors/connections/capability.d.ts +11 -0
- package/dist/connectors/connections/capability.d.ts.map +1 -1
- package/dist/connectors/connections/internal.d.ts +2 -1
- package/dist/connectors/connections/internal.d.ts.map +1 -1
- package/dist/connectors/connections/internal.js +8 -4
- package/dist/connectors/connections/internal.js.map +1 -1
- package/dist/connectors/connections/service.d.ts +9 -1
- 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/service.d.ts +5 -1
- package/dist/connectors/service.d.ts.map +1 -1
- package/dist/deploy/index.d.ts +1 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/internal.js +2 -2
- package/dist/deploy/internal.js.map +2 -2
- package/dist/deploy/types.d.ts +12 -59
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/env/index.d.ts +10 -3
- package/dist/env/index.d.ts.map +1 -1
- package/dist/env/index.js.map +2 -2
- package/dist/events/execution.d.ts +8 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/types/syncs.d.ts +4 -0
- package/dist/events/types/syncs.d.ts.map +1 -1
- package/dist/execution/agent.js +37 -36
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/authorized-object-reader.d.ts +4 -0
- package/dist/execution/authorized-object-reader.d.ts.map +1 -1
- package/dist/execution/object-reader-ontology.d.ts +3 -0
- package/dist/execution/object-reader-ontology.d.ts.map +1 -1
- package/dist/execution/primitive.js +36 -35
- package/dist/execution/primitive.js.map +1 -1
- package/dist/execution/request.d.ts +1 -1
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +33 -32
- package/dist/execution/request.js.map +3 -3
- package/dist/http/api-routes.d.ts.map +1 -1
- package/dist/http/index.js +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +63 -59
- package/dist/index.js.map +1 -1
- package/dist/maintenance/index.js +1 -1
- package/dist/materializer/index.js +22 -21
- package/dist/materializer/index.js.map +1 -1
- package/dist/models/audio/runtime.d.ts.map +1 -1
- package/dist/models/audio/types.d.ts +19 -0
- package/dist/models/audio/types.d.ts.map +1 -1
- package/dist/models/execution/index.js +20 -19
- package/dist/models/execution/index.js.map +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/objects/index.js +36 -35
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/query/executor.d.ts +3 -1
- package/dist/objects/query/executor.d.ts.map +1 -1
- package/dist/objects/query/explain.d.ts +3 -1
- package/dist/objects/query/explain.d.ts.map +1 -1
- package/dist/objects/query/index.d.ts +1 -1
- package/dist/objects/query/index.d.ts.map +1 -1
- package/dist/objects/query/index.js +19 -18
- package/dist/objects/query/index.js.map +1 -1
- package/dist/objects/query/link-query-clearance.d.ts +3 -0
- package/dist/objects/query/link-query-clearance.d.ts.map +1 -1
- package/dist/objects/query/links.d.ts +1 -1
- package/dist/objects/query/links.d.ts.map +1 -1
- package/dist/objects/query/validate.d.ts +17 -0
- package/dist/objects/query/validate.d.ts.map +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts +1 -1
- package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
- package/dist/ontology/index.js +3 -3
- package/dist/ontology/internal.js +3 -3
- package/dist/pipelines/index.js +21 -20
- package/dist/pipelines/index.js.map +1 -1
- package/dist/projections/internal.js +20 -19
- package/dist/projections/internal.js.map +1 -1
- package/dist/queues/in-memory.d.ts +1 -1
- package/dist/queues/in-memory.d.ts.map +1 -1
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/definitions.d.ts +14 -0
- package/dist/runtime/definitions.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +3 -1
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/internal.js +24 -23
- package/dist/runtime/internal.js.map +2 -2
- package/dist/runtime/locale.d.ts +0 -2
- package/dist/runtime/locale.d.ts.map +1 -1
- package/dist/runtime/resolve-definitions.d.ts +2 -1
- package/dist/runtime/resolve-definitions.d.ts.map +1 -1
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/sandboxes/auth.d.ts +26 -4
- package/dist/sandboxes/auth.d.ts.map +1 -1
- package/dist/sandboxes/errors.d.ts +19 -0
- package/dist/sandboxes/errors.d.ts.map +1 -1
- package/dist/sandboxes/exec.d.ts +2 -0
- package/dist/sandboxes/exec.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +4 -2
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +13 -7
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/sandboxes/sandbox.d.ts +15 -1
- package/dist/sandboxes/sandbox.d.ts.map +1 -1
- package/dist/security/view-conditions.d.ts.map +1 -1
- package/dist/shares/internal.js +16 -15
- package/dist/shares/internal.js.map +2 -2
- package/dist/storage/agents/in-memory.d.ts +18 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/index.d.ts +1 -1
- package/dist/storage/agents/index.d.ts.map +1 -1
- package/dist/storage/agents/provider.d.ts +43 -9
- package/dist/storage/agents/provider.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +19 -3
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +150 -4
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +3 -2
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +4 -3
- package/dist/storage/ai-cost/provider.js.map +1 -1
- package/dist/storage/ai-cost/types.d.ts +5 -1
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts.map +1 -1
- package/dist/storage/artifacts/record.d.ts +3 -1
- package/dist/storage/artifacts/record.d.ts.map +1 -1
- package/dist/storage/artifacts/types.d.ts +7 -0
- package/dist/storage/artifacts/types.d.ts.map +1 -1
- package/dist/storage/file-upload-sessions/provider.js +7 -7
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +23 -22
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.js +8 -8
- package/dist/storage/operation-scope.d.ts.map +1 -1
- package/dist/storage/operation-scope.js +1 -1
- package/dist/storage/sync-runs/idempotency.d.ts.map +1 -1
- package/dist/storage/sync-runs/in-memory.d.ts +2 -1
- package/dist/storage/sync-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/sync-runs/index.d.ts +1 -1
- package/dist/storage/sync-runs/index.d.ts.map +1 -1
- package/dist/storage/sync-runs/types.d.ts +27 -2
- package/dist/storage/sync-runs/types.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +7 -7
- package/dist/syncs/accounts.d.ts +36 -0
- package/dist/syncs/accounts.d.ts.map +1 -0
- package/dist/syncs/builders.d.ts.map +1 -1
- package/dist/syncs/connections.d.ts +36 -0
- package/dist/syncs/connections.d.ts.map +1 -0
- package/dist/syncs/execution.d.ts +14 -4
- package/dist/syncs/execution.d.ts.map +1 -1
- package/dist/syncs/index.d.ts +2 -1
- package/dist/syncs/index.d.ts.map +1 -1
- package/dist/syncs/index.js +22 -21
- package/dist/syncs/index.js.map +1 -1
- package/dist/syncs/request.d.ts +16 -2
- package/dist/syncs/request.d.ts.map +1 -1
- package/dist/syncs/run-dispatch.d.ts +14 -2
- package/dist/syncs/run-dispatch.d.ts.map +1 -1
- package/dist/testing/agent-approval-storage-contract.d.ts.map +1 -1
- package/dist/testing/agent-inbox-storage-contract.d.ts.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-cost-storage-contract.d.ts.map +1 -1
- package/dist/testing/artifact-storage-contract.d.ts.map +1 -1
- package/dist/testing/index.js +1157 -100
- package/dist/testing/index.js.map +9 -9
- package/dist/testing/run-claim-storage-contract.d.ts.map +1 -1
- package/dist/testing/sandboxes-contract.d.ts.map +1 -1
- package/dist/webhooks/internal.js +17 -16
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +66 -13
- package/dist/workers/index.js.map +4 -4
- package/dist/workers/queue-worker.d.ts +5 -0
- package/dist/workers/queue-worker.d.ts.map +1 -1
- package/dist/workers/worker.d.ts +8 -0
- package/dist/workers/worker.d.ts.map +1 -1
- package/dist/workflows/index.js +42 -40
- package/dist/workflows/index.js.map +1 -1
- package/package.json +7 -1
- package/src/actions/validation.ts +3 -1
- package/src/agents/children.ts +6 -0
- package/src/agents/errors.ts +3 -0
- package/src/agents/execution.ts +170 -20
- package/src/agents/index.ts +5 -0
- package/src/agents/model-routing.ts +116 -34
- package/src/agents/request.ts +783 -38
- package/src/agents/run-events.ts +235 -38
- package/src/agents/run-session-children.ts +13 -2
- package/src/agents/run-token.ts +7 -0
- package/src/agents/run-turn.ts +140 -23
- package/src/agents/streams/index.ts +2 -0
- package/src/agents/streams/internal.ts +12 -0
- package/src/agents/streams/protocol.ts +69 -1
- package/src/agents/streams/steps.ts +131 -0
- package/src/agents/thread-access.ts +57 -2
- package/src/artifacts/publish/merge.ts +14 -3
- package/src/artifacts/run-query.ts +5 -2
- package/src/bootstrap/discovery.ts +61 -11
- package/src/calendar.ts +195 -0
- package/src/connectors/connections/capability.ts +40 -0
- package/src/connectors/connections/internal.ts +3 -0
- package/src/connectors/connections/service.ts +74 -5
- package/src/connectors/execution.ts +5 -6
- package/src/connectors/service.ts +23 -0
- package/src/deploy/index.ts +0 -5
- package/src/deploy/types.ts +12 -64
- package/src/deploy/validation.ts +1 -1
- package/src/env/index.ts +10 -4
- package/src/events/execution.ts +42 -2
- package/src/events/types/syncs.ts +4 -0
- package/src/execution/authorized-object-reader.ts +33 -5
- package/src/execution/object-reader-ontology.ts +6 -0
- package/src/execution/request.ts +1 -0
- package/src/http/api-routes.ts +8 -0
- package/src/index.ts +21 -2
- package/src/models/audio/runtime.ts +57 -14
- package/src/models/audio/types.ts +20 -0
- package/src/models/index.ts +1 -0
- package/src/objects/query/executor.ts +4 -0
- package/src/objects/query/explain.ts +5 -0
- package/src/objects/query/index.ts +1 -0
- package/src/objects/query/link-query-clearance.ts +4 -1
- package/src/objects/query/links.ts +5 -1
- package/src/objects/query/validate.ts +33 -1
- package/src/objects/sdk/runtime-query-executor.ts +7 -3
- package/src/runtime/create.ts +1 -0
- package/src/runtime/definitions.ts +25 -0
- package/src/runtime/host.ts +16 -8
- package/src/runtime/index.ts +6 -1
- package/src/runtime/locale.ts +0 -10
- package/src/runtime/resolve-definitions.ts +7 -1
- package/src/runtime/sixb.ts +12 -2
- package/src/sandboxes/README.md +12 -1
- package/src/sandboxes/auth.ts +32 -4
- package/src/sandboxes/errors.ts +27 -0
- package/src/sandboxes/exec.ts +3 -1
- package/src/sandboxes/index.ts +18 -1
- package/src/sandboxes/sandbox.ts +15 -1
- package/src/security/view-conditions.ts +2 -1
- package/src/storage/agents/in-memory.ts +271 -6
- package/src/storage/agents/index.ts +10 -0
- package/src/storage/agents/provider.ts +178 -13
- package/src/storage/agents/types.ts +166 -4
- package/src/storage/ai-cost/analytics.ts +22 -43
- package/src/storage/ai-cost/types.ts +5 -1
- package/src/storage/artifacts/in-memory.ts +20 -5
- package/src/storage/artifacts/record.ts +8 -2
- package/src/storage/artifacts/types.ts +7 -0
- package/src/storage/index.ts +11 -0
- package/src/storage/operation-scope.ts +1 -0
- package/src/storage/sync-runs/idempotency.ts +1 -0
- package/src/storage/sync-runs/in-memory.ts +43 -1
- package/src/storage/sync-runs/index.ts +1 -0
- package/src/storage/sync-runs/types.ts +30 -1
- package/src/syncs/accounts.ts +85 -0
- package/src/syncs/builders.ts +18 -1
- package/src/syncs/connections.ts +123 -0
- package/src/syncs/execution.ts +64 -22
- package/src/syncs/index.ts +3 -0
- package/src/syncs/request.ts +81 -23
- package/src/syncs/run-dispatch.ts +69 -7
- package/src/testing/agent-approval-storage-contract.ts +123 -0
- package/src/testing/agent-inbox-storage-contract.ts +59 -0
- package/src/testing/agent-storage-contract.ts +794 -8
- package/src/testing/ai-cost-storage-contract.ts +80 -0
- package/src/testing/artifact-storage-contract.ts +139 -0
- package/src/testing/run-claim-storage-contract.ts +116 -0
- package/src/testing/sandboxes-contract.ts +50 -0
- package/src/workers/README.md +4 -1
- package/src/workers/lost-runs.ts +1 -0
- package/src/workers/queue-worker.ts +16 -5
- package/src/workers/worker.ts +67 -7
- package/dist/chunk-5a4a52tq.js.map +0 -10
- package/dist/chunk-5t9gm5tt.js.map +0 -22
- package/dist/chunk-68hm50qh.js.map +0 -13
- package/dist/chunk-aw1z0gre.js +0 -234
- package/dist/chunk-aw1z0gre.js.map +0 -12
- package/dist/chunk-ey1p8w68.js.map +0 -13
- package/dist/chunk-k3jh8gsg.js.map +0 -10
- package/dist/chunk-nxysqbt0.js.map +0 -10
- package/dist/chunk-qavwr628.js.map +0 -12
- package/dist/chunk-s1mqyqmm.js.map +0 -18
- package/dist/chunk-zeykm8my.js.map +0 -14
- /package/dist/{chunk-stmxh0hv.js.map → chunk-3neam1y5.js.map} +0 -0
- /package/dist/{chunk-0hkdtwqk.js.map → chunk-44hrfmbk.js.map} +0 -0
- /package/dist/{chunk-s5pj68fa.js.map → chunk-5sswe5ej.js.map} +0 -0
- /package/dist/{chunk-q9nkpr8k.js.map → chunk-9tpmfh3n.js.map} +0 -0
- /package/dist/{chunk-naxjka9v.js.map → chunk-brhp9d97.js.map} +0 -0
- /package/dist/{chunk-8a8k38tz.js.map → chunk-brybqw5k.js.map} +0 -0
- /package/dist/{chunk-vehcr9eb.js.map → chunk-cg7cygfj.js.map} +0 -0
- /package/dist/{chunk-b4escq4c.js.map → chunk-cpy282b8.js.map} +0 -0
- /package/dist/{chunk-bc3y6gff.js.map → chunk-jka26v8c.js.map} +0 -0
- /package/dist/{chunk-zxhym8tr.js.map → chunk-k29rdc3h.js.map} +0 -0
- /package/dist/{chunk-1yh6jgtz.js.map → chunk-mrs7jy17.js.map} +0 -0
- /package/dist/{chunk-pqvvqc65.js.map → chunk-pfdq1ga6.js.map} +0 -0
- /package/dist/{chunk-k29n4176.js.map → chunk-phs5fbff.js.map} +0 -0
- /package/dist/{chunk-wqe9shx2.js.map → chunk-qbd282aa.js.map} +0 -0
- /package/dist/{chunk-paxabbqd.js.map → chunk-tapdssb5.js.map} +0 -0
- /package/dist/{chunk-dhkc9b23.js.map → chunk-v8a1qjzp.js.map} +0 -0
- /package/dist/{chunk-pc7kra3k.js.map → chunk-xavet0qs.js.map} +0 -0
- /package/dist/{chunk-m9ketb51.js.map → chunk-ygvay56w.js.map} +0 -0
- /package/dist/{chunk-0mvjpgvm.js.map → chunk-yyj009tv.js.map} +0 -0
|
@@ -16,13 +16,13 @@ import {
|
|
|
16
16
|
paginate,
|
|
17
17
|
InMemoryAuthStorage2,
|
|
18
18
|
principalsEqual2
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-394zjzjs.js";
|
|
20
20
|
import {
|
|
21
21
|
ObjectReadLimitExceededError2,
|
|
22
22
|
snapshotObjectReadExecutionLimits2,
|
|
23
23
|
assertObjectReadFacetCount2,
|
|
24
24
|
assertObjectReadOutputWithinLimit2
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-tapdssb5.js";
|
|
26
26
|
import {
|
|
27
27
|
assertObjectReaderProject2
|
|
28
28
|
} from "./chunk-rt9deb92.js";
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
queryScalarKindForSchema,
|
|
34
34
|
resolvePropertyQueryCapabilities2,
|
|
35
35
|
resolveQuerySchema
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-7mhbs9yy.js";
|
|
37
37
|
import {
|
|
38
38
|
createEventId2
|
|
39
39
|
} from "./chunk-zrvhsq7f.js";
|
|
@@ -44,7 +44,10 @@ import {
|
|
|
44
44
|
participantsToAdd2,
|
|
45
45
|
compareAgentThreadParticipants2,
|
|
46
46
|
remapArtifactIds2,
|
|
47
|
+
assertDeleteAgentMessagesFromSeqInput2,
|
|
48
|
+
assertDeleteAgentContextCheckpointsAfterSeqInput2,
|
|
47
49
|
countsAsThreadMessage2,
|
|
50
|
+
isUnreadFor2,
|
|
48
51
|
planAgentThreadFork2,
|
|
49
52
|
assertConversationAgentRunSpec2,
|
|
50
53
|
assertAgentThreadComputer2,
|
|
@@ -58,6 +61,8 @@ import {
|
|
|
58
61
|
assertStartsOnComputer2,
|
|
59
62
|
movesComputerPlace2,
|
|
60
63
|
queuedTurnInCloud2,
|
|
64
|
+
queuedTurnOnComputer2,
|
|
65
|
+
unavailableChildSandboxState2,
|
|
61
66
|
assertAgentApprovalModeInput2,
|
|
62
67
|
assertAgentRunExecution2,
|
|
63
68
|
assertCreateSubagentRunInput2,
|
|
@@ -95,7 +100,7 @@ import {
|
|
|
95
100
|
assertInboxRunOwnership2,
|
|
96
101
|
newAgentInboxItemRecord2,
|
|
97
102
|
updatedAgentInboxItemRecord2
|
|
98
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-5pz3htbe.js";
|
|
99
104
|
import {
|
|
100
105
|
InMemoryAiUsageStorage2,
|
|
101
106
|
buildAiAccountingOverview,
|
|
@@ -104,7 +109,7 @@ import {
|
|
|
104
109
|
buildAiModelCallGroups,
|
|
105
110
|
normalizeAiModelCallCostRecord2,
|
|
106
111
|
aiModelCallCostMatchesUsage2
|
|
107
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-3qtk0070.js";
|
|
108
113
|
import {
|
|
109
114
|
AiLimitStorageError2,
|
|
110
115
|
aiLimitCalendarMonth2,
|
|
@@ -141,7 +146,7 @@ import {
|
|
|
141
146
|
} from "./chunk-h89wz928.js";
|
|
142
147
|
import {
|
|
143
148
|
DurableFileUploadSessions2
|
|
144
|
-
} from "./chunk-
|
|
149
|
+
} from "./chunk-cg7cygfj.js";
|
|
145
150
|
import {
|
|
146
151
|
actionSubjectsEqual,
|
|
147
152
|
normalizeRecordActionRunInput2,
|
|
@@ -165,7 +170,7 @@ import {
|
|
|
165
170
|
canFinishSyncRun2,
|
|
166
171
|
createTransactionStorageProxy2,
|
|
167
172
|
throwNestedStorageTransaction2
|
|
168
|
-
} from "./chunk-
|
|
173
|
+
} from "./chunk-88xeh6zx.js";
|
|
169
174
|
import {
|
|
170
175
|
ARTIFACT_RESTORE_POINTS2,
|
|
171
176
|
ARTIFACT_COMMENT_LIMITS2
|
|
@@ -239,7 +244,7 @@ import {
|
|
|
239
244
|
createOntologyOperationScope2,
|
|
240
245
|
createObjectOperationScope2,
|
|
241
246
|
createWorkflowRunOperationScope2
|
|
242
|
-
} from "./chunk-
|
|
247
|
+
} from "./chunk-hkbks1xm.js";
|
|
243
248
|
import {
|
|
244
249
|
planRunClaim2,
|
|
245
250
|
selectLostRuns,
|
|
@@ -294,7 +299,7 @@ import {
|
|
|
294
299
|
WorkflowRunError2,
|
|
295
300
|
assertWorkflowRunExecution2,
|
|
296
301
|
assertWorkflowAgentNodeRunExecution2
|
|
297
|
-
} from "./chunk-
|
|
302
|
+
} from "./chunk-5sswe5ej.js";
|
|
298
303
|
import {
|
|
299
304
|
ShareGrantStorageError2,
|
|
300
305
|
normalizeShareGrantCreate2,
|
|
@@ -338,7 +343,7 @@ import {
|
|
|
338
343
|
import {
|
|
339
344
|
AGENT_RUN_FAILURE_CODES2,
|
|
340
345
|
AGENT_TOKEN_RATE_SAMPLES2
|
|
341
|
-
} from "./chunk-
|
|
346
|
+
} from "./chunk-389ybvw9.js";
|
|
342
347
|
import {
|
|
343
348
|
cloneJsonValue2,
|
|
344
349
|
stableJsonStringify2,
|
|
@@ -455,6 +460,9 @@ function normalizeFailure(failure) {
|
|
|
455
460
|
function key(projectId, id) {
|
|
456
461
|
return JSON.stringify([projectId, id]);
|
|
457
462
|
}
|
|
463
|
+
function readKey(projectId, threadId, principal) {
|
|
464
|
+
return JSON.stringify([projectId, threadId, principal.id]);
|
|
465
|
+
}
|
|
458
466
|
function clone(value) {
|
|
459
467
|
return structuredClone(value);
|
|
460
468
|
}
|
|
@@ -550,6 +558,14 @@ class InMemoryAgentThreadStore {
|
|
|
550
558
|
if (plan.checkpoint) {
|
|
551
559
|
this.state.checkpoints.set(key(input.projectId, plan.checkpoint.id), clone(plan.checkpoint));
|
|
552
560
|
}
|
|
561
|
+
const sourceRead = input.ownerPrincipal.type === "user" ? this.state.reads.get(readKey(input.projectId, input.sourceThreadId, input.ownerPrincipal)) : undefined;
|
|
562
|
+
if (sourceRead && input.ownerPrincipal.type === "user") {
|
|
563
|
+
this.state.reads.set(readKey(input.projectId, input.id, input.ownerPrincipal), {
|
|
564
|
+
...sourceRead,
|
|
565
|
+
threadId: input.id,
|
|
566
|
+
throughSeq: Math.min(sourceRead.throughSeq, plan.headSeq)
|
|
567
|
+
});
|
|
568
|
+
}
|
|
553
569
|
return clone(plan.thread);
|
|
554
570
|
}
|
|
555
571
|
async getById(params) {
|
|
@@ -601,6 +617,16 @@ class InMemoryAgentThreadStore {
|
|
|
601
617
|
}));
|
|
602
618
|
const participants = [...existing, ...added].sort(compareAgentThreadParticipants2);
|
|
603
619
|
this.state.participants.set(threadKey, participants);
|
|
620
|
+
const headSeq = headSeqOf(this.state, input.projectId, input.threadId);
|
|
621
|
+
for (const participant of added) {
|
|
622
|
+
this.state.reads.set(readKey(input.projectId, input.threadId, participant.principal), {
|
|
623
|
+
projectId: input.projectId,
|
|
624
|
+
threadId: input.threadId,
|
|
625
|
+
principal: clone(participant.principal),
|
|
626
|
+
throughSeq: headSeq,
|
|
627
|
+
readAt: new Date(addedAt)
|
|
628
|
+
});
|
|
629
|
+
}
|
|
604
630
|
return clone(participants);
|
|
605
631
|
}
|
|
606
632
|
async removeParticipant(input) {
|
|
@@ -610,6 +636,7 @@ class InMemoryAgentThreadStore {
|
|
|
610
636
|
if (!existing || !kept || kept.length === existing.length)
|
|
611
637
|
return false;
|
|
612
638
|
this.state.participants.set(threadKey, kept);
|
|
639
|
+
this.state.reads.delete(readKey(input.projectId, input.threadId, input.principal));
|
|
613
640
|
return true;
|
|
614
641
|
}
|
|
615
642
|
async assignComputer(input) {
|
|
@@ -618,8 +645,21 @@ class InMemoryAgentThreadStore {
|
|
|
618
645
|
const thread = this.state.threads.get(threadKey) ?? null;
|
|
619
646
|
const active = thread?.activeRunId ? this.state.runs.get(key(input.projectId, thread.activeRunId)) ?? null : null;
|
|
620
647
|
assertAssignableComputer2(thread, active, input.computer, input.id);
|
|
648
|
+
const queued = queuedTurnOnComputer2(active, input.computer);
|
|
649
|
+
if (queued)
|
|
650
|
+
this.state.runs.set(key(input.projectId, queued.id), queued);
|
|
651
|
+
if (thread.runsOn !== "computer") {
|
|
652
|
+
for (const [childKey, child] of this.state.threads) {
|
|
653
|
+
if (child.projectId !== input.projectId || child.parent?.threadId !== input.id)
|
|
654
|
+
continue;
|
|
655
|
+
const nextState = unavailableChildSandboxState2(child.sandboxState);
|
|
656
|
+
if (nextState)
|
|
657
|
+
this.state.threads.set(childKey, { ...child, sandboxState: nextState });
|
|
658
|
+
}
|
|
659
|
+
}
|
|
621
660
|
const assigned = {
|
|
622
661
|
...thread,
|
|
662
|
+
runsOn: "computer",
|
|
623
663
|
computer: clone(input.computer),
|
|
624
664
|
...movesComputerPlace2(thread, input.computer) ? { movedAt: new Date(input.movedAt ?? new Date) } : {}
|
|
625
665
|
};
|
|
@@ -647,6 +687,62 @@ class InMemoryAgentThreadStore {
|
|
|
647
687
|
}
|
|
648
688
|
}
|
|
649
689
|
|
|
690
|
+
class InMemoryAgentThreadReadStore {
|
|
691
|
+
state;
|
|
692
|
+
constructor(state) {
|
|
693
|
+
this.state = state;
|
|
694
|
+
}
|
|
695
|
+
async mark(input) {
|
|
696
|
+
const thread = this.state.threads.get(key(input.projectId, input.threadId));
|
|
697
|
+
if (!thread) {
|
|
698
|
+
throw new AgentStorageError2("thread_not_found", `[Sixb] Agent thread '${input.threadId}' not found for project '${input.projectId}'.`);
|
|
699
|
+
}
|
|
700
|
+
const reached = this.reachedSeq(input);
|
|
701
|
+
if (reached === null)
|
|
702
|
+
return this.stateOf(thread, input.principal);
|
|
703
|
+
const storedKey = readKey(input.projectId, input.threadId, input.principal);
|
|
704
|
+
const known = this.state.reads.get(storedKey);
|
|
705
|
+
const readAt = new Date(input.readAt ?? new Date);
|
|
706
|
+
this.state.reads.set(storedKey, {
|
|
707
|
+
projectId: input.projectId,
|
|
708
|
+
threadId: input.threadId,
|
|
709
|
+
principal: clone(input.principal),
|
|
710
|
+
throughSeq: Math.max(known?.throughSeq ?? 0, reached),
|
|
711
|
+
readAt: known && known.readAt > readAt ? known.readAt : readAt
|
|
712
|
+
});
|
|
713
|
+
return this.stateOf(thread, input.principal);
|
|
714
|
+
}
|
|
715
|
+
async list(input) {
|
|
716
|
+
return [...new Set(input.threadIds)].map((threadId) => this.state.threads.get(key(input.projectId, threadId))).filter((thread) => thread !== undefined).map((thread) => this.stateOf(thread, input.principal));
|
|
717
|
+
}
|
|
718
|
+
reachedSeq(input) {
|
|
719
|
+
if (input.throughMessageId === undefined) {
|
|
720
|
+
return headSeqOf(this.state, input.projectId, input.threadId);
|
|
721
|
+
}
|
|
722
|
+
const message = this.state.messages.get(key(input.projectId, input.throughMessageId));
|
|
723
|
+
return message?.threadId === input.threadId ? message.seq : null;
|
|
724
|
+
}
|
|
725
|
+
stateOf(thread, reader) {
|
|
726
|
+
const read = this.state.reads.get(readKey(thread.projectId, thread.id, reader));
|
|
727
|
+
const headSeq = headSeqOf(this.state, thread.projectId, thread.id);
|
|
728
|
+
const throughSeq = Math.min(read?.throughSeq ?? 0, headSeq);
|
|
729
|
+
let unread = 0;
|
|
730
|
+
for (const message of this.state.messages.values()) {
|
|
731
|
+
if (message.projectId !== thread.projectId || message.threadId !== thread.id)
|
|
732
|
+
continue;
|
|
733
|
+
if (message.seq > throughSeq && isUnreadFor2(message, reader))
|
|
734
|
+
unread += 1;
|
|
735
|
+
}
|
|
736
|
+
return {
|
|
737
|
+
threadId: thread.id,
|
|
738
|
+
throughSeq,
|
|
739
|
+
headSeq,
|
|
740
|
+
unread,
|
|
741
|
+
...read === undefined ? {} : { readAt: new Date(read.readAt) }
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
650
746
|
class InMemoryAgentRunStore {
|
|
651
747
|
state;
|
|
652
748
|
executions;
|
|
@@ -902,13 +998,33 @@ class InMemoryAgentRunStore {
|
|
|
902
998
|
}
|
|
903
999
|
async listThreadSubagents(input) {
|
|
904
1000
|
const runs = [...this.state.runs.values()].filter((run) => run.projectId === input.projectId);
|
|
905
|
-
const turns = new Map(runs.flatMap((run) =>
|
|
1001
|
+
const turns = new Map(runs.flatMap((run) => {
|
|
1002
|
+
if (run.kind !== "conversation" || run.threadId !== input.threadId)
|
|
1003
|
+
return [];
|
|
1004
|
+
if (input.retainedTurnsOnly && this.state.messages.get(key(run.projectId, run.triggerMessageId))?.threadId !== run.threadId) {
|
|
1005
|
+
return [];
|
|
1006
|
+
}
|
|
1007
|
+
return [[run.id, run]];
|
|
1008
|
+
}));
|
|
906
1009
|
const children = runs.filter((run) => run.kind === "subagent").filter((run) => turns.has(run.parentRunId)).filter((run) => input.spawnKey === undefined ? true : run.spawnKey === input.spawnKey).filter((run) => input.finishReason === undefined ? true : run.finishReason === input.finishReason).sort((left, right) => {
|
|
907
1010
|
const [a, b] = [turns.get(left.parentRunId), turns.get(right.parentRunId)];
|
|
908
1011
|
return compareByDate(a?.startedAt ?? a?.createdAt, b?.startedAt ?? b?.createdAt, left.parentRunId, right.parentRunId, "desc") || compareByDate(left.createdAt, right.createdAt, left.id, right.id, "desc");
|
|
909
1012
|
});
|
|
910
1013
|
return children.slice(0, input.limit ?? 100).map(clone);
|
|
911
1014
|
}
|
|
1015
|
+
async latestByThread(input) {
|
|
1016
|
+
const wanted = new Set(input.threadIds);
|
|
1017
|
+
const latest = new Map;
|
|
1018
|
+
for (const run of this.state.runs.values()) {
|
|
1019
|
+
if (run.projectId !== input.projectId || !wanted.has(run.threadId))
|
|
1020
|
+
continue;
|
|
1021
|
+
const known = latest.get(run.threadId);
|
|
1022
|
+
if (!known || compareByDate(run.createdAt, known.createdAt, run.id, known.id, "desc") < 0) {
|
|
1023
|
+
latest.set(run.threadId, run);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
return [...latest.values()].map(clone);
|
|
1027
|
+
}
|
|
912
1028
|
async list(input) {
|
|
913
1029
|
const order = input.order ?? "desc";
|
|
914
1030
|
const statuses = input.statuses ? new Set(input.statuses) : null;
|
|
@@ -1022,6 +1138,7 @@ class InMemoryAgentMessageStore {
|
|
|
1022
1138
|
for (const [messageKey] of messages) {
|
|
1023
1139
|
this.state.messages.delete(messageKey);
|
|
1024
1140
|
}
|
|
1141
|
+
clampReadsToHead(this.state, input.projectId, input.threadId);
|
|
1025
1142
|
const remainingMessages = [...this.state.messages.values()].filter((message) => message.projectId === input.projectId && message.threadId === input.threadId).sort((left, right) => right.seq - left.seq);
|
|
1026
1143
|
const latestMessage = remainingMessages[0];
|
|
1027
1144
|
const updatedAt = new Date;
|
|
@@ -1033,6 +1150,31 @@ class InMemoryAgentMessageStore {
|
|
|
1033
1150
|
}));
|
|
1034
1151
|
return messages.length;
|
|
1035
1152
|
}
|
|
1153
|
+
async deleteFromSeq(input) {
|
|
1154
|
+
assertDeleteAgentMessagesFromSeqInput2(input);
|
|
1155
|
+
const threadKey = key(input.projectId, input.threadId);
|
|
1156
|
+
const thread = this.state.threads.get(threadKey);
|
|
1157
|
+
if (!thread) {
|
|
1158
|
+
throw new AgentStorageError2("thread_not_found", `[Sixb] Agent thread '${input.threadId}' not found for project '${input.projectId}'.`);
|
|
1159
|
+
}
|
|
1160
|
+
const toDelete = [...this.state.messages.entries()].filter(([, message]) => message.projectId === input.projectId && message.threadId === input.threadId && message.seq >= input.fromSeq);
|
|
1161
|
+
if (toDelete.length === 0)
|
|
1162
|
+
return 0;
|
|
1163
|
+
for (const [messageKey] of toDelete) {
|
|
1164
|
+
this.state.messages.delete(messageKey);
|
|
1165
|
+
}
|
|
1166
|
+
clampReadsToHead(this.state, input.projectId, input.threadId);
|
|
1167
|
+
const remainingMessages = [...this.state.messages.values()].filter((message) => message.projectId === input.projectId && message.threadId === input.threadId).sort((left, right) => right.seq - left.seq);
|
|
1168
|
+
const latestMessage = remainingMessages[0];
|
|
1169
|
+
const updatedAt = new Date;
|
|
1170
|
+
this.state.threads.set(threadKey, clone({
|
|
1171
|
+
...thread,
|
|
1172
|
+
messageCount: remainingMessages.filter(countsAsThreadMessage2).length,
|
|
1173
|
+
lastMessageAt: latestMessage?.createdAt,
|
|
1174
|
+
updatedAt
|
|
1175
|
+
}));
|
|
1176
|
+
return toDelete.length;
|
|
1177
|
+
}
|
|
1036
1178
|
async getById(params) {
|
|
1037
1179
|
const record = this.state.messages.get(key(params.projectId, params.id));
|
|
1038
1180
|
return record ? clone(record) : null;
|
|
@@ -1045,14 +1187,26 @@ class InMemoryAgentMessageStore {
|
|
|
1045
1187
|
return { messages: page.map(clone), hasMore, total };
|
|
1046
1188
|
}
|
|
1047
1189
|
}
|
|
1048
|
-
function
|
|
1190
|
+
function headSeqOf(state, projectId, threadId) {
|
|
1049
1191
|
let max = 0;
|
|
1050
1192
|
for (const message of state.messages.values()) {
|
|
1051
1193
|
if (message.projectId === projectId && message.threadId === threadId && message.seq > max) {
|
|
1052
1194
|
max = message.seq;
|
|
1053
1195
|
}
|
|
1054
1196
|
}
|
|
1055
|
-
return max
|
|
1197
|
+
return max;
|
|
1198
|
+
}
|
|
1199
|
+
function nextMessageSeq(state, projectId, threadId) {
|
|
1200
|
+
return headSeqOf(state, projectId, threadId) + 1;
|
|
1201
|
+
}
|
|
1202
|
+
function clampReadsToHead(state, projectId, threadId) {
|
|
1203
|
+
const headSeq = headSeqOf(state, projectId, threadId);
|
|
1204
|
+
for (const [readKey, read] of state.reads) {
|
|
1205
|
+
if (read.projectId !== projectId || read.threadId !== threadId)
|
|
1206
|
+
continue;
|
|
1207
|
+
if (read.throughSeq > headSeq)
|
|
1208
|
+
state.reads.set(readKey, { ...read, throughSeq: headSeq });
|
|
1209
|
+
}
|
|
1056
1210
|
}
|
|
1057
1211
|
|
|
1058
1212
|
class InMemoryAgentContextCheckpointStore {
|
|
@@ -1114,6 +1268,14 @@ class InMemoryAgentContextCheckpointStore {
|
|
|
1114
1268
|
const record = this.findLatest(input.projectId, input.threadId);
|
|
1115
1269
|
return record ? clone(record) : null;
|
|
1116
1270
|
}
|
|
1271
|
+
async deleteAfterSeq(input) {
|
|
1272
|
+
assertDeleteAgentContextCheckpointsAfterSeqInput2(input);
|
|
1273
|
+
const matching = [...this.state.checkpoints.entries()].filter(([, checkpoint]) => checkpoint.projectId === input.projectId && checkpoint.threadId === input.threadId && checkpoint.observedHeadSeq > input.afterSeq);
|
|
1274
|
+
for (const [checkpointKey] of matching) {
|
|
1275
|
+
this.state.checkpoints.delete(checkpointKey);
|
|
1276
|
+
}
|
|
1277
|
+
return matching.length;
|
|
1278
|
+
}
|
|
1117
1279
|
async getByRunIds(input) {
|
|
1118
1280
|
const byRunId = new Map([...this.state.checkpoints.values()].filter((checkpoint) => checkpoint.projectId === input.projectId).filter((checkpoint) => checkpoint.threadId === input.threadId).map((checkpoint) => [checkpoint.createdByRunId, checkpoint]));
|
|
1119
1281
|
return [...new Set(input.runIds)].flatMap((runId) => {
|
|
@@ -1300,6 +1462,34 @@ class InMemoryAgentApprovalStore {
|
|
|
1300
1462
|
}
|
|
1301
1463
|
return { cancelled: cancelled.sort(compareApprovals).map(clone), stopped };
|
|
1302
1464
|
}
|
|
1465
|
+
async rewind(input) {
|
|
1466
|
+
const runIds = new Set(input.runIds);
|
|
1467
|
+
const clearedIds = new Set(input.clearedMessageIds ?? []);
|
|
1468
|
+
const cancelledAt = new Date(input.cancelledAt ?? new Date);
|
|
1469
|
+
const cancelled = [];
|
|
1470
|
+
let deleted = 0;
|
|
1471
|
+
for (const [approvalKey, approval] of [...this.state.approvals.entries()]) {
|
|
1472
|
+
if (approval.projectId !== input.projectId || approval.threadId !== input.threadId)
|
|
1473
|
+
continue;
|
|
1474
|
+
if (runIds.has(approval.runId)) {
|
|
1475
|
+
this.state.approvals.delete(approvalKey);
|
|
1476
|
+
deleted += 1;
|
|
1477
|
+
if (approval.status === "pending") {
|
|
1478
|
+
cancelled.push({
|
|
1479
|
+
...approval,
|
|
1480
|
+
status: "cancelled",
|
|
1481
|
+
turnStoppedAt: approval.turnStoppedAt ?? cancelledAt
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
continue;
|
|
1485
|
+
}
|
|
1486
|
+
if (approval.reportedInMessageId && clearedIds.has(approval.reportedInMessageId)) {
|
|
1487
|
+
const { reportedInMessageId: _reported, ...unreported } = approval;
|
|
1488
|
+
this.state.approvals.set(approvalKey, clone(unreported));
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
return { cancelled: cancelled.sort(compareApprovals).map(clone), deleted };
|
|
1492
|
+
}
|
|
1303
1493
|
async holdsRun(input) {
|
|
1304
1494
|
return holdsRun(this.state, input.projectId, input.runId);
|
|
1305
1495
|
}
|
|
@@ -1603,6 +1793,7 @@ class InMemoryAgentStorage2 {
|
|
|
1603
1793
|
state = {
|
|
1604
1794
|
threads: new Map,
|
|
1605
1795
|
participants: new Map,
|
|
1796
|
+
reads: new Map,
|
|
1606
1797
|
runs: new Map,
|
|
1607
1798
|
messages: new Map,
|
|
1608
1799
|
checkpoints: new Map,
|
|
@@ -1613,6 +1804,7 @@ class InMemoryAgentStorage2 {
|
|
|
1613
1804
|
inbox: new Map
|
|
1614
1805
|
};
|
|
1615
1806
|
threads;
|
|
1807
|
+
reads;
|
|
1616
1808
|
runs;
|
|
1617
1809
|
messages;
|
|
1618
1810
|
checkpoints;
|
|
@@ -1624,6 +1816,7 @@ class InMemoryAgentStorage2 {
|
|
|
1624
1816
|
computers = new InMemoryAgentComputerSessionStore;
|
|
1625
1817
|
constructor(executions) {
|
|
1626
1818
|
this.threads = new InMemoryAgentThreadStore(this.state);
|
|
1819
|
+
this.reads = new InMemoryAgentThreadReadStore(this.state);
|
|
1627
1820
|
this.runs = new InMemoryAgentRunStore(this.state, executions);
|
|
1628
1821
|
this.messages = new InMemoryAgentMessageStore(this.state);
|
|
1629
1822
|
this.checkpoints = new InMemoryAgentContextCheckpointStore(this.state);
|
|
@@ -1637,6 +1830,7 @@ class InMemoryAgentStorage2 {
|
|
|
1637
1830
|
return {
|
|
1638
1831
|
threads: structuredClone(this.state.threads),
|
|
1639
1832
|
participants: structuredClone(this.state.participants),
|
|
1833
|
+
reads: structuredClone(this.state.reads),
|
|
1640
1834
|
runs: structuredClone(this.state.runs),
|
|
1641
1835
|
messages: structuredClone(this.state.messages),
|
|
1642
1836
|
checkpoints: structuredClone(this.state.checkpoints),
|
|
@@ -1650,6 +1844,7 @@ class InMemoryAgentStorage2 {
|
|
|
1650
1844
|
restore(snapshot) {
|
|
1651
1845
|
replace(this.state.threads, snapshot.threads);
|
|
1652
1846
|
replace(this.state.participants, snapshot.participants);
|
|
1847
|
+
replace(this.state.reads, snapshot.reads);
|
|
1653
1848
|
replace(this.state.runs, snapshot.runs);
|
|
1654
1849
|
replace(this.state.messages, snapshot.messages);
|
|
1655
1850
|
replace(this.state.checkpoints, snapshot.checkpoints);
|
|
@@ -3678,15 +3873,20 @@ class InMemoryArtifactStorage {
|
|
|
3678
3873
|
return writes.sort((left, right) => left.artifactId < right.artifactId ? -1 : 1);
|
|
3679
3874
|
}
|
|
3680
3875
|
async undoTurnWrites(input) {
|
|
3681
|
-
const { turnRunId } = input;
|
|
3876
|
+
const { turnRunId, laterTurnRunIds = [] } = input;
|
|
3682
3877
|
const restored = [];
|
|
3683
3878
|
const deleted = [];
|
|
3684
3879
|
for (const [key, stored] of this.artifacts) {
|
|
3685
3880
|
if (stored.record.projectId !== input.projectId)
|
|
3686
3881
|
continue;
|
|
3687
|
-
const
|
|
3688
|
-
if (!
|
|
3882
|
+
const own = stored.turnWrites.get(turnRunId);
|
|
3883
|
+
if (!own)
|
|
3689
3884
|
continue;
|
|
3885
|
+
const later = laterTurnRunIds.filter((each) => stored.turnWrites.has(each));
|
|
3886
|
+
const write = {
|
|
3887
|
+
...own,
|
|
3888
|
+
writes: later.reduce((sum, each) => sum + (stored.turnWrites.get(each)?.writes ?? 0), own.writes)
|
|
3889
|
+
};
|
|
3690
3890
|
const revision = stored.record.revision;
|
|
3691
3891
|
if (write.created && turnUndoable2({ write, revision }) && !othersCommented2(stored.comments, input)) {
|
|
3692
3892
|
this.deleteArtifact(key);
|
|
@@ -3702,7 +3902,11 @@ class InMemoryArtifactStorage {
|
|
|
3702
3902
|
...target ? { target: { frozen: target.frozenAt !== undefined } } : {}
|
|
3703
3903
|
});
|
|
3704
3904
|
const undone = untouched && point ? undo(stored, point, input.documents?.[stored.record.id]) : null;
|
|
3705
|
-
|
|
3905
|
+
let next = forgetTurn(undone ?? stored, turnRunId, { undone: undone !== null });
|
|
3906
|
+
if (undone) {
|
|
3907
|
+
for (const each of later)
|
|
3908
|
+
next = forgetTurn(next, each, { undone: true });
|
|
3909
|
+
}
|
|
3706
3910
|
this.artifacts.set(key, next);
|
|
3707
3911
|
if (undone)
|
|
3708
3912
|
restored.push(published(next));
|
|
@@ -9490,7 +9694,8 @@ var SYNC_RUN_FAILURE_CODES2 = [
|
|
|
9490
9694
|
"internal.unexpected",
|
|
9491
9695
|
"runtime.cancelled",
|
|
9492
9696
|
"queue.enqueue_failed",
|
|
9493
|
-
"sync.execution_failed"
|
|
9697
|
+
"sync.execution_failed",
|
|
9698
|
+
"connector.authorization_required"
|
|
9494
9699
|
];
|
|
9495
9700
|
|
|
9496
9701
|
// src/storage/sync-runs/in-memory.ts
|
|
@@ -9562,6 +9767,7 @@ class InMemorySyncRunStorage2 {
|
|
|
9562
9767
|
projectId: input.projectId,
|
|
9563
9768
|
executionId: input.executionId,
|
|
9564
9769
|
syncId: input.syncId,
|
|
9770
|
+
...input.connectionId === undefined ? {} : { connectionId: input.connectionId },
|
|
9565
9771
|
datasetId: input.datasetId,
|
|
9566
9772
|
mode: input.mode,
|
|
9567
9773
|
status: "queued",
|
|
@@ -9676,7 +9882,7 @@ class InMemorySyncRunStorage2 {
|
|
|
9676
9882
|
const order = input.order ?? "desc";
|
|
9677
9883
|
const statuses = toStatusSet(input.statuses);
|
|
9678
9884
|
const syncIds = input.syncIds ? new Set(input.syncIds) : null;
|
|
9679
|
-
const filtered = [...this.rows.values()].filter((record) => record.projectId === input.projectId).filter((record) => input.syncId ? record.syncId === input.syncId : true).filter((record) => syncIds ? syncIds.has(record.syncId) : true).filter((record) => input.datasetId ? record.datasetId === input.datasetId : true).filter((record) => matchesRunListDateFilters(record, {
|
|
9885
|
+
const filtered = [...this.rows.values()].filter((record) => record.projectId === input.projectId).filter((record) => input.syncId ? record.syncId === input.syncId : true).filter((record) => syncIds ? syncIds.has(record.syncId) : true).filter((record) => input.connectionId === undefined ? true : (record.connectionId ?? null) === input.connectionId).filter((record) => isVisibleRun(record, input.visibleConnectionIds)).filter((record) => input.datasetId ? record.datasetId === input.datasetId : true).filter((record) => matchesRunListDateFilters(record, {
|
|
9680
9886
|
statuses,
|
|
9681
9887
|
startedAfter: input.startedAfter,
|
|
9682
9888
|
startedBefore: input.startedBefore
|
|
@@ -9689,11 +9895,29 @@ class InMemorySyncRunStorage2 {
|
|
|
9689
9895
|
};
|
|
9690
9896
|
}
|
|
9691
9897
|
async listLatestBySyncIds(input) {
|
|
9692
|
-
const runs = latestStartedAtByOwnerId([...this.rows.values()].filter((record) => record.projectId === input.projectId), input.syncIds, (record) => record.syncId);
|
|
9898
|
+
const runs = latestStartedAtByOwnerId([...this.rows.values()].filter((record) => record.projectId === input.projectId && isVisibleRun(record, input.visibleConnectionIds)), input.syncIds, (record) => record.syncId);
|
|
9693
9899
|
return {
|
|
9694
9900
|
runs: runs.map(cloneSyncRunRecord)
|
|
9695
9901
|
};
|
|
9696
9902
|
}
|
|
9903
|
+
async listLatestByConnection(input) {
|
|
9904
|
+
const syncIds = new Set(input.syncIds);
|
|
9905
|
+
const connectionIds = input.connectionIds ? new Set(input.connectionIds) : null;
|
|
9906
|
+
const latest = new Map;
|
|
9907
|
+
for (const record of this.rows.values()) {
|
|
9908
|
+
const { connectionId } = record;
|
|
9909
|
+
if (record.projectId !== input.projectId || connectionId === undefined)
|
|
9910
|
+
continue;
|
|
9911
|
+
if (!syncIds.has(record.syncId) || connectionIds && !connectionIds.has(connectionId)) {
|
|
9912
|
+
continue;
|
|
9913
|
+
}
|
|
9914
|
+
const key = JSON.stringify([record.syncId, connectionId]);
|
|
9915
|
+
const current = latest.get(key);
|
|
9916
|
+
if (!current || compareStartedAt(record, current, "desc") < 0)
|
|
9917
|
+
latest.set(key, record);
|
|
9918
|
+
}
|
|
9919
|
+
return { runs: [...latest.values()].map(cloneSyncRunRecord) };
|
|
9920
|
+
}
|
|
9697
9921
|
requireRun(projectId, id) {
|
|
9698
9922
|
const existing = this.rows.get(syncRunKey(projectId, id));
|
|
9699
9923
|
if (!existing) {
|
|
@@ -9713,6 +9937,9 @@ class InMemorySyncRunStorage2 {
|
|
|
9713
9937
|
return cloneSyncRunRecord(run);
|
|
9714
9938
|
}
|
|
9715
9939
|
}
|
|
9940
|
+
function isVisibleRun(record, visibleConnectionIds) {
|
|
9941
|
+
return visibleConnectionIds === undefined || record.connectionId === undefined || visibleConnectionIds.includes(record.connectionId);
|
|
9942
|
+
}
|
|
9716
9943
|
function staleExecution2(id) {
|
|
9717
9944
|
return new SyncRunError2(`[Sixb] Execution token is no longer current on sync run '${id}'.`);
|
|
9718
9945
|
}
|
|
@@ -11290,4 +11517,4 @@ var VECTOR_INDEXING_FAILURE_CODES2 = [
|
|
|
11290
11517
|
];
|
|
11291
11518
|
export { InMemoryActionRunStorage2, AGENT_MESSAGE_CONTENT_VERSION2, InMemoryAgentStorage2, AiCostStorageError2, InMemoryAiCostStorage2, InMemoryAiLimitStorage2, InMemoryConnectorConnectionStorage2, InMemoryDatasetIngestStorage2, InMemoryFileUploadSessions2, objectBatchKey2, linkBatchKey2, objectLinkCursor2, compareQueryScalarValues, matchesPredicate, sortTieDirection2, PIPELINE_RUN_FAILURE_CODES2, InMemoryPipelineRunStorage2, InMemoryProjectionRunStorage2, InMemoryRulesStorage2, InMemoryShareGrantStorage2, InMemoryShareSessionStorage2, SYNC_RUN_FAILURE_CODES2, InMemorySyncRunStorage2, WEBHOOK_RUN_FAILURE_CODES2, WEBHOOK_RUN_LEASE_MS2, canRetryWebhookRun2, InMemoryWebhookRunStorage2, WorkflowInterventionError2, InMemoryWorkflowInterventionStorage2, WORKFLOW_RUN_FAILURE_CODES2, InMemoryWorkflowRunStorage2, InMemoryWorkflowNodeRunStorage2, InMemoryWorkflowAgentNodeRunStorage2, InMemoryStorage2, prepareObjectQueries2, isMigrationCapableStorage2, migrateStorage2, checkStorageSchema2, step2, defineMigrations2, runMigrationSet2, describeMigrationHistory2, VECTOR_INDEXING_FAILURE_CODES2 };
|
|
11292
11519
|
|
|
11293
|
-
//# debugId=
|
|
11520
|
+
//# debugId=F61C51DAC05AF24964756E2164756E21
|