@sixb/core 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.js +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 +2 -2
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +50 -44
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/model-routing.d.ts +5 -2
- package/dist/agents/model-routing.d.ts.map +1 -1
- package/dist/agents/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-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/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-5a4a52tq.js → chunk-0pmpwn3g.js} +18 -2
- package/dist/chunk-0pmpwn3g.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-0mvjpgvm.js → chunk-425ydk65.js} +4 -4
- package/dist/{chunk-s5pj68fa.js → chunk-5sswe5ej.js} +2 -2
- package/dist/chunk-6hfbz4d0.js +98 -0
- package/dist/chunk-6hfbz4d0.js.map +10 -0
- package/dist/{chunk-3zagkr6w.js → chunk-7mhbs9yy.js} +4 -4
- package/dist/{chunk-3zagkr6w.js.map → chunk-7mhbs9yy.js.map} +1 -1
- package/dist/{chunk-fpf57gca.js → chunk-7r9mqpva.js} +273 -66
- package/dist/{chunk-fpf57gca.js.map → chunk-7r9mqpva.js.map} +5 -5
- 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-90nqenq8.js +386 -0
- package/dist/chunk-90nqenq8.js.map +14 -0
- package/dist/{chunk-gjhrz66x.js → chunk-9c9yknwt.js} +247 -20
- package/dist/{chunk-gjhrz66x.js.map → chunk-9c9yknwt.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-z1njfqqs.js → chunk-ats8y3d9.js} +721 -156
- package/dist/{chunk-z1njfqqs.js.map → chunk-ats8y3d9.js.map} +13 -13
- package/dist/{chunk-68hm50qh.js → chunk-bcz9dxtf.js} +16 -46
- package/dist/chunk-bcz9dxtf.js.map +12 -0
- package/dist/{chunk-naxjka9v.js → chunk-brhp9d97.js} +2 -2
- package/dist/{chunk-8a8k38tz.js → chunk-brybqw5k.js} +1 -1
- package/dist/{chunk-s1mqyqmm.js → chunk-bs1sd0e0.js} +12 -8
- package/dist/chunk-bs1sd0e0.js.map +18 -0
- package/dist/{chunk-vehcr9eb.js → chunk-cg7cygfj.js} +1 -1
- package/dist/chunk-dq3t5sr3.js +114 -0
- package/dist/chunk-dq3t5sr3.js.map +11 -0
- package/dist/{chunk-r2psmn42.js → chunk-eg6xqef7.js} +1 -1
- package/dist/{chunk-zxhym8tr.js → chunk-f05994as.js} +1 -1
- package/dist/{chunk-5t9gm5tt.js → chunk-fmgf9h5e.js} +38 -14
- package/dist/chunk-fmgf9h5e.js.map +22 -0
- package/dist/{chunk-ey1p8w68.js → chunk-gaj8djsw.js} +80 -4
- package/dist/chunk-gaj8djsw.js.map +13 -0
- package/dist/{chunk-1yh6jgtz.js → chunk-grt2j5vp.js} +2 -2
- 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-rtdrm592.js → chunk-htdzx40w.js} +2 -2
- package/dist/{chunk-bc3y6gff.js → chunk-jka26v8c.js} +1 -1
- package/dist/{chunk-m3qx2pns.js → chunk-jt012fxq.js} +28 -12
- package/dist/{chunk-m3qx2pns.js.map → chunk-jt012fxq.js.map} +5 -5
- package/dist/{chunk-k3jh8gsg.js → chunk-kft7mp7z.js} +20 -3
- package/dist/chunk-kft7mp7z.js.map +10 -0
- package/dist/{chunk-qavwr628.js → chunk-n1hbwc6y.js} +5 -6
- package/dist/chunk-n1hbwc6y.js.map +12 -0
- package/dist/chunk-nxysqbt0.js.map +2 -2
- package/dist/{chunk-pqvvqc65.js → chunk-pqj8vff9.js} +3 -3
- 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-rg725hry.js → chunk-s8xxef60.js} +83 -33
- package/dist/{chunk-rg725hry.js.map → chunk-s8xxef60.js.map} +5 -5
- package/dist/{chunk-fzae1jpq.js → chunk-t19wjmnc.js} +5 -5
- 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-0hkdtwqk.js → chunk-xf76csps.js} +5 -5
- package/dist/{chunk-m9ketb51.js → chunk-ygvay56w.js} +1 -1
- package/dist/{chunk-b4escq4c.js → chunk-ykchk644.js} +6 -6
- package/dist/{chunk-k29n4176.js → chunk-ym1bqd98.js} +6 -6
- 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/types.d.ts +4 -1
- package/dist/deploy/types.d.ts.map +1 -1
- package/dist/events/execution.d.ts +8 -1
- package/dist/events/execution.d.ts.map +1 -1
- package/dist/events/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 +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -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/host.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/sixb.d.ts.map +1 -1
- package/dist/sandboxes/auth.d.ts +26 -4
- package/dist/sandboxes/auth.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +3 -1
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +5 -5
- package/dist/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 +18 -2
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +136 -3
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/analytics.d.ts +3 -2
- package/dist/storage/ai-cost/analytics.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +4 -3
- package/dist/storage/ai-cost/provider.js.map +1 -1
- package/dist/storage/ai-cost/types.d.ts +5 -1
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/artifacts/in-memory.d.ts.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 +22 -21
- 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 +1051 -58
- package/dist/testing/index.js.map +8 -8
- package/dist/testing/run-claim-storage-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 +4 -0
- package/src/agents/model-routing.ts +25 -9
- package/src/agents/request.ts +759 -40
- package/src/agents/run-events.ts +235 -38
- package/src/agents/run-session-children.ts +13 -2
- 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/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/types.ts +4 -1
- 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 +18 -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/host.ts +13 -7
- package/src/runtime/locale.ts +0 -10
- package/src/runtime/sixb.ts +12 -2
- package/src/sandboxes/README.md +3 -1
- package/src/sandboxes/auth.ts +32 -4
- package/src/sandboxes/index.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 +170 -13
- package/src/storage/agents/types.ts +148 -3
- package/src/storage/ai-cost/analytics.ts +22 -43
- package/src/storage/ai-cost/types.ts +5 -1
- package/src/storage/artifacts/in-memory.ts +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 +767 -8
- package/src/testing/ai-cost-storage-contract.ts +80 -0
- package/src/testing/artifact-storage-contract.ts +129 -0
- package/src/testing/run-claim-storage-contract.ts +116 -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-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-0mvjpgvm.js.map → chunk-425ydk65.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-r2psmn42.js.map → chunk-eg6xqef7.js.map} +0 -0
- /package/dist/{chunk-zxhym8tr.js.map → chunk-f05994as.js.map} +0 -0
- /package/dist/{chunk-1yh6jgtz.js.map → chunk-grt2j5vp.js.map} +0 -0
- /package/dist/{chunk-rtdrm592.js.map → chunk-htdzx40w.js.map} +0 -0
- /package/dist/{chunk-bc3y6gff.js.map → chunk-jka26v8c.js.map} +0 -0
- /package/dist/{chunk-pqvvqc65.js.map → chunk-pqj8vff9.js.map} +0 -0
- /package/dist/{chunk-wqe9shx2.js.map → chunk-qbd282aa.js.map} +0 -0
- /package/dist/{chunk-fzae1jpq.js.map → chunk-t19wjmnc.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-0hkdtwqk.js.map → chunk-xf76csps.js.map} +0 -0
- /package/dist/{chunk-m9ketb51.js.map → chunk-ygvay56w.js.map} +0 -0
- /package/dist/{chunk-b4escq4c.js.map → chunk-ykchk644.js.map} +0 -0
- /package/dist/{chunk-k29n4176.js.map → chunk-ym1bqd98.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AGENT_MESSAGE_CONTENT_VERSION } from "../../agents/message"
|
|
2
|
-
import { type Principal, principalsEqual } from "../../auth"
|
|
2
|
+
import { type Principal, principalsEqual, type UserPrincipal } from "../../auth"
|
|
3
3
|
import { parseSixbFailure } from "../../errors/internal"
|
|
4
4
|
import type { SixbFailure } from "../../errors/types"
|
|
5
5
|
import type { ExecutionStorage } from "../executions"
|
|
@@ -33,6 +33,8 @@ import {
|
|
|
33
33
|
assertConversationThreadRow,
|
|
34
34
|
assertCreateAgentContextCheckpointInput,
|
|
35
35
|
assertCreateSubagentRunInput,
|
|
36
|
+
assertDeleteAgentContextCheckpointsAfterSeqInput,
|
|
37
|
+
assertDeleteAgentMessagesFromSeqInput,
|
|
36
38
|
assertEnqueueAgentInboxItemInput,
|
|
37
39
|
assertInboxRunOwnership,
|
|
38
40
|
assertInboxThreadAcceptsItem,
|
|
@@ -47,6 +49,7 @@ import {
|
|
|
47
49
|
compareAgentMemoryPaths,
|
|
48
50
|
compareAgentThreadParticipants,
|
|
49
51
|
countsAsThreadMessage,
|
|
52
|
+
isUnreadFor,
|
|
50
53
|
LIVE_AGENT_APPROVAL_STATUSES,
|
|
51
54
|
movesComputerPlace,
|
|
52
55
|
newAgentApprovalRecord,
|
|
@@ -55,10 +58,12 @@ import {
|
|
|
55
58
|
participantsToAdd,
|
|
56
59
|
planAgentThreadFork,
|
|
57
60
|
queuedTurnInCloud,
|
|
61
|
+
queuedTurnOnComputer,
|
|
58
62
|
remapArtifactIds,
|
|
59
63
|
snapshotAgentThreadSandboxParams,
|
|
60
64
|
subagentRunMatchesCreateInput,
|
|
61
65
|
transitionAgentThreadSandbox,
|
|
66
|
+
unavailableChildSandboxState,
|
|
62
67
|
updatedAgentInboxItemRecord,
|
|
63
68
|
withStopRequest,
|
|
64
69
|
} from "./provider"
|
|
@@ -88,6 +93,9 @@ import type {
|
|
|
88
93
|
AgentRunStore,
|
|
89
94
|
AgentStorage,
|
|
90
95
|
AgentThreadParticipantRecord,
|
|
96
|
+
AgentThreadReadRecord,
|
|
97
|
+
AgentThreadReadState,
|
|
98
|
+
AgentThreadReadStore,
|
|
91
99
|
AgentThreadRecord,
|
|
92
100
|
AgentThreadSandboxState,
|
|
93
101
|
AgentThreadStore,
|
|
@@ -104,7 +112,9 @@ import type {
|
|
|
104
112
|
CreateSubagentRunInput,
|
|
105
113
|
DecideAgentApprovalInput,
|
|
106
114
|
DecideAgentApprovalResult,
|
|
115
|
+
DeleteAgentContextCheckpointsAfterSeqInput,
|
|
107
116
|
DeleteAgentMessagesByRunInput,
|
|
117
|
+
DeleteAgentMessagesFromSeqInput,
|
|
108
118
|
EnqueueAgentInboxItemInput,
|
|
109
119
|
EnqueueAgentInboxItemResult,
|
|
110
120
|
FinishAgentRunInput,
|
|
@@ -121,11 +131,14 @@ import type {
|
|
|
121
131
|
ListAgentRunsResult,
|
|
122
132
|
ListAgentThreadChildrenInput,
|
|
123
133
|
ListAgentThreadParticipantsInput,
|
|
134
|
+
ListAgentThreadReadsInput,
|
|
124
135
|
ListAgentThreadsInput,
|
|
125
136
|
ListAgentThreadsResult,
|
|
137
|
+
ListLatestAgentRunsInput,
|
|
126
138
|
ListThreadSubagentsInput,
|
|
127
139
|
ListWaitingAgentInboxThreadsInput,
|
|
128
140
|
MarkAgentApprovalsReportedInput,
|
|
141
|
+
MarkAgentThreadReadInput,
|
|
129
142
|
MoveAgentThreadToCloudInput,
|
|
130
143
|
MoveAgentThreadToCloudResult,
|
|
131
144
|
ReclaimAgentRunInput,
|
|
@@ -134,6 +147,8 @@ import type {
|
|
|
134
147
|
RequestAgentApprovalInput,
|
|
135
148
|
RequestAgentApprovalResult,
|
|
136
149
|
RequestAgentRunCancelInput,
|
|
150
|
+
RewindAgentApprovalsInput,
|
|
151
|
+
RewindAgentApprovalsResult,
|
|
137
152
|
SaveAgentMemoryInput,
|
|
138
153
|
SaveAgentMemoryResult,
|
|
139
154
|
SettleAgentApprovalsInput,
|
|
@@ -158,6 +173,10 @@ function key(projectId: string, id: string): string {
|
|
|
158
173
|
return JSON.stringify([projectId, id])
|
|
159
174
|
}
|
|
160
175
|
|
|
176
|
+
function readKey(projectId: string, threadId: string, principal: UserPrincipal): string {
|
|
177
|
+
return JSON.stringify([projectId, threadId, principal.id])
|
|
178
|
+
}
|
|
179
|
+
|
|
161
180
|
function clone<T>(value: T): T {
|
|
162
181
|
return structuredClone(value)
|
|
163
182
|
}
|
|
@@ -202,6 +221,8 @@ interface AgentStoreState {
|
|
|
202
221
|
readonly threads: Map<string, AgentThreadRecord>
|
|
203
222
|
/** By thread key; each thread's participants in the order they were added. */
|
|
204
223
|
readonly participants: Map<string, AgentThreadParticipantRecord[]>
|
|
224
|
+
/** By `[projectId, threadId, principalId]`. */
|
|
225
|
+
readonly reads: Map<string, AgentThreadReadRecord>
|
|
205
226
|
readonly runs: Map<string, AgentRunRecord>
|
|
206
227
|
readonly messages: Map<string, AgentMessageRecord>
|
|
207
228
|
readonly checkpoints: Map<string, AgentContextCheckpointRecord>
|
|
@@ -226,6 +247,7 @@ interface StoredAgentMemoryRepo {
|
|
|
226
247
|
export interface InMemoryAgentStorageSnapshot {
|
|
227
248
|
readonly threads: Map<string, AgentThreadRecord>
|
|
228
249
|
readonly participants: Map<string, AgentThreadParticipantRecord[]>
|
|
250
|
+
readonly reads: Map<string, AgentThreadReadRecord>
|
|
229
251
|
readonly runs: Map<string, AgentRunRecord>
|
|
230
252
|
readonly messages: Map<string, AgentMessageRecord>
|
|
231
253
|
readonly checkpoints: Map<string, AgentContextCheckpointRecord>
|
|
@@ -357,6 +379,20 @@ class InMemoryAgentThreadStore implements AgentThreadStore {
|
|
|
357
379
|
this.state.checkpoints.set(key(input.projectId, plan.checkpoint.id), clone(plan.checkpoint))
|
|
358
380
|
}
|
|
359
381
|
|
|
382
|
+
// The owner of the copy keeps their place: copied messages keep their seq, so what they had
|
|
383
|
+
// not read in the source is what they have not read here. Only a user reads.
|
|
384
|
+
const sourceRead =
|
|
385
|
+
input.ownerPrincipal.type === "user"
|
|
386
|
+
? this.state.reads.get(readKey(input.projectId, input.sourceThreadId, input.ownerPrincipal))
|
|
387
|
+
: undefined
|
|
388
|
+
if (sourceRead && input.ownerPrincipal.type === "user") {
|
|
389
|
+
this.state.reads.set(readKey(input.projectId, input.id, input.ownerPrincipal), {
|
|
390
|
+
...sourceRead,
|
|
391
|
+
threadId: input.id,
|
|
392
|
+
throughSeq: Math.min(sourceRead.throughSeq, plan.headSeq),
|
|
393
|
+
})
|
|
394
|
+
}
|
|
395
|
+
|
|
360
396
|
return clone(plan.thread)
|
|
361
397
|
}
|
|
362
398
|
|
|
@@ -455,6 +491,18 @@ class InMemoryAgentThreadStore implements AgentThreadStore {
|
|
|
455
491
|
|
|
456
492
|
const participants = [...existing, ...added].sort(compareAgentThreadParticipants)
|
|
457
493
|
this.state.participants.set(threadKey, participants)
|
|
494
|
+
// Someone who joins starts caught up: what came before is not new to them. A place left
|
|
495
|
+
// from an earlier stay, or written by a mark that raced the removal, does not carry over.
|
|
496
|
+
const headSeq = headSeqOf(this.state, input.projectId, input.threadId)
|
|
497
|
+
for (const participant of added) {
|
|
498
|
+
this.state.reads.set(readKey(input.projectId, input.threadId, participant.principal), {
|
|
499
|
+
projectId: input.projectId,
|
|
500
|
+
threadId: input.threadId,
|
|
501
|
+
principal: clone(participant.principal),
|
|
502
|
+
throughSeq: headSeq,
|
|
503
|
+
readAt: new Date(addedAt),
|
|
504
|
+
})
|
|
505
|
+
}
|
|
458
506
|
return clone(participants)
|
|
459
507
|
}
|
|
460
508
|
|
|
@@ -465,6 +513,7 @@ class InMemoryAgentThreadStore implements AgentThreadStore {
|
|
|
465
513
|
if (!existing || !kept || kept.length === existing.length) return false
|
|
466
514
|
|
|
467
515
|
this.state.participants.set(threadKey, kept)
|
|
516
|
+
this.state.reads.delete(readKey(input.projectId, input.threadId, input.principal))
|
|
468
517
|
return true
|
|
469
518
|
}
|
|
470
519
|
|
|
@@ -477,8 +526,18 @@ class InMemoryAgentThreadStore implements AgentThreadStore {
|
|
|
477
526
|
: null
|
|
478
527
|
assertAssignableComputer(thread, active, input.computer, input.id)
|
|
479
528
|
|
|
529
|
+
const queued = queuedTurnOnComputer(active, input.computer)
|
|
530
|
+
if (queued) this.state.runs.set(key(input.projectId, queued.id), queued)
|
|
531
|
+
if (thread.runsOn !== "computer") {
|
|
532
|
+
for (const [childKey, child] of this.state.threads) {
|
|
533
|
+
if (child.projectId !== input.projectId || child.parent?.threadId !== input.id) continue
|
|
534
|
+
const nextState = unavailableChildSandboxState(child.sandboxState)
|
|
535
|
+
if (nextState) this.state.threads.set(childKey, { ...child, sandboxState: nextState })
|
|
536
|
+
}
|
|
537
|
+
}
|
|
480
538
|
const assigned: AgentThreadRecord = {
|
|
481
539
|
...thread,
|
|
540
|
+
runsOn: "computer",
|
|
482
541
|
computer: clone(input.computer),
|
|
483
542
|
...(movesComputerPlace(thread, input.computer)
|
|
484
543
|
? { movedAt: new Date(input.movedAt ?? new Date()) }
|
|
@@ -517,6 +576,77 @@ class InMemoryAgentThreadStore implements AgentThreadStore {
|
|
|
517
576
|
}
|
|
518
577
|
}
|
|
519
578
|
|
|
579
|
+
// ── reads ────────────────────────────────────────────────────────────────────────────────────
|
|
580
|
+
|
|
581
|
+
class InMemoryAgentThreadReadStore implements AgentThreadReadStore {
|
|
582
|
+
constructor(private readonly state: AgentStoreState) {}
|
|
583
|
+
|
|
584
|
+
async mark(input: MarkAgentThreadReadInput): Promise<AgentThreadReadState> {
|
|
585
|
+
const thread = this.state.threads.get(key(input.projectId, input.threadId))
|
|
586
|
+
if (!thread) {
|
|
587
|
+
throw new AgentStorageError(
|
|
588
|
+
"thread_not_found",
|
|
589
|
+
`[Sixb] Agent thread '${input.threadId}' not found for project '${input.projectId}'.`
|
|
590
|
+
)
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
const reached = this.reachedSeq(input)
|
|
594
|
+
if (reached === null) return this.stateOf(thread, input.principal)
|
|
595
|
+
|
|
596
|
+
const storedKey = readKey(input.projectId, input.threadId, input.principal)
|
|
597
|
+
const known = this.state.reads.get(storedKey)
|
|
598
|
+
const readAt = new Date(input.readAt ?? new Date())
|
|
599
|
+
|
|
600
|
+
// Never backwards: another device that read further keeps its place. Looking always counts.
|
|
601
|
+
this.state.reads.set(storedKey, {
|
|
602
|
+
projectId: input.projectId,
|
|
603
|
+
threadId: input.threadId,
|
|
604
|
+
principal: clone(input.principal),
|
|
605
|
+
throughSeq: Math.max(known?.throughSeq ?? 0, reached),
|
|
606
|
+
readAt: known && known.readAt > readAt ? known.readAt : readAt,
|
|
607
|
+
})
|
|
608
|
+
|
|
609
|
+
return this.stateOf(thread, input.principal)
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
async list(input: ListAgentThreadReadsInput): Promise<readonly AgentThreadReadState[]> {
|
|
613
|
+
return [...new Set(input.threadIds)]
|
|
614
|
+
.map((threadId) => this.state.threads.get(key(input.projectId, threadId)))
|
|
615
|
+
.filter((thread): thread is AgentThreadRecord => thread !== undefined)
|
|
616
|
+
.map((thread) => this.stateOf(thread, input.principal))
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/** The seq a mark reaches: its message's, or the newest. `null` when the message is gone. */
|
|
620
|
+
private reachedSeq(input: MarkAgentThreadReadInput): number | null {
|
|
621
|
+
if (input.throughMessageId === undefined) {
|
|
622
|
+
return headSeqOf(this.state, input.projectId, input.threadId)
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
const message = this.state.messages.get(key(input.projectId, input.throughMessageId))
|
|
626
|
+
return message?.threadId === input.threadId ? message.seq : null
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
private stateOf(thread: AgentThreadRecord, reader: UserPrincipal): AgentThreadReadState {
|
|
630
|
+
const read = this.state.reads.get(readKey(thread.projectId, thread.id, reader))
|
|
631
|
+
const headSeq = headSeqOf(this.state, thread.projectId, thread.id)
|
|
632
|
+
const throughSeq = Math.min(read?.throughSeq ?? 0, headSeq)
|
|
633
|
+
|
|
634
|
+
let unread = 0
|
|
635
|
+
for (const message of this.state.messages.values()) {
|
|
636
|
+
if (message.projectId !== thread.projectId || message.threadId !== thread.id) continue
|
|
637
|
+
if (message.seq > throughSeq && isUnreadFor(message, reader)) unread += 1
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return {
|
|
641
|
+
threadId: thread.id,
|
|
642
|
+
throughSeq,
|
|
643
|
+
headSeq,
|
|
644
|
+
unread,
|
|
645
|
+
...(read === undefined ? {} : { readAt: new Date(read.readAt) }),
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
|
|
520
650
|
// ── runs ──────────────────────────────────────────────────────────────────────────────────────
|
|
521
651
|
|
|
522
652
|
class InMemoryAgentRunStore implements AgentRunStore {
|
|
@@ -883,9 +1013,17 @@ class InMemoryAgentRunStore implements AgentRunStore {
|
|
|
883
1013
|
): Promise<readonly SubagentRunRecord[]> {
|
|
884
1014
|
const runs = [...this.state.runs.values()].filter((run) => run.projectId === input.projectId)
|
|
885
1015
|
const turns = new Map(
|
|
886
|
-
runs.flatMap((run) =>
|
|
887
|
-
run.kind
|
|
888
|
-
|
|
1016
|
+
runs.flatMap((run) => {
|
|
1017
|
+
if (run.kind !== "conversation" || run.threadId !== input.threadId) return []
|
|
1018
|
+
if (
|
|
1019
|
+
input.retainedTurnsOnly &&
|
|
1020
|
+
this.state.messages.get(key(run.projectId, run.triggerMessageId))?.threadId !==
|
|
1021
|
+
run.threadId
|
|
1022
|
+
) {
|
|
1023
|
+
return []
|
|
1024
|
+
}
|
|
1025
|
+
return [[run.id, run]]
|
|
1026
|
+
})
|
|
889
1027
|
)
|
|
890
1028
|
const children = runs
|
|
891
1029
|
.filter((run): run is SubagentRunRecord => run.kind === "subagent")
|
|
@@ -909,6 +1047,19 @@ class InMemoryAgentRunStore implements AgentRunStore {
|
|
|
909
1047
|
return children.slice(0, input.limit ?? 100).map(clone)
|
|
910
1048
|
}
|
|
911
1049
|
|
|
1050
|
+
async latestByThread(input: ListLatestAgentRunsInput): Promise<readonly AgentRunRecord[]> {
|
|
1051
|
+
const wanted = new Set(input.threadIds)
|
|
1052
|
+
const latest = new Map<string, AgentRunRecord>()
|
|
1053
|
+
for (const run of this.state.runs.values()) {
|
|
1054
|
+
if (run.projectId !== input.projectId || !wanted.has(run.threadId)) continue
|
|
1055
|
+
const known = latest.get(run.threadId)
|
|
1056
|
+
if (!known || compareByDate(run.createdAt, known.createdAt, run.id, known.id, "desc") < 0) {
|
|
1057
|
+
latest.set(run.threadId, run)
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
return [...latest.values()].map(clone)
|
|
1061
|
+
}
|
|
1062
|
+
|
|
912
1063
|
async list(input: ListAgentRunsInput): Promise<ListAgentRunsResult> {
|
|
913
1064
|
const order = input.order ?? "desc"
|
|
914
1065
|
const statuses = input.statuses ? new Set(input.statuses) : null
|
|
@@ -1104,6 +1255,7 @@ class InMemoryAgentMessageStore implements AgentMessageStore {
|
|
|
1104
1255
|
for (const [messageKey] of messages) {
|
|
1105
1256
|
this.state.messages.delete(messageKey)
|
|
1106
1257
|
}
|
|
1258
|
+
clampReadsToHead(this.state, input.projectId, input.threadId)
|
|
1107
1259
|
|
|
1108
1260
|
const remainingMessages = [...this.state.messages.values()]
|
|
1109
1261
|
.filter(
|
|
@@ -1125,6 +1277,50 @@ class InMemoryAgentMessageStore implements AgentMessageStore {
|
|
|
1125
1277
|
return messages.length
|
|
1126
1278
|
}
|
|
1127
1279
|
|
|
1280
|
+
async deleteFromSeq(input: DeleteAgentMessagesFromSeqInput): Promise<number> {
|
|
1281
|
+
assertDeleteAgentMessagesFromSeqInput(input)
|
|
1282
|
+
const threadKey = key(input.projectId, input.threadId)
|
|
1283
|
+
const thread = this.state.threads.get(threadKey)
|
|
1284
|
+
if (!thread) {
|
|
1285
|
+
throw new AgentStorageError(
|
|
1286
|
+
"thread_not_found",
|
|
1287
|
+
`[Sixb] Agent thread '${input.threadId}' not found for project '${input.projectId}'.`
|
|
1288
|
+
)
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
const toDelete = [...this.state.messages.entries()].filter(
|
|
1292
|
+
([, message]) =>
|
|
1293
|
+
message.projectId === input.projectId &&
|
|
1294
|
+
message.threadId === input.threadId &&
|
|
1295
|
+
message.seq >= input.fromSeq
|
|
1296
|
+
)
|
|
1297
|
+
if (toDelete.length === 0) return 0
|
|
1298
|
+
|
|
1299
|
+
for (const [messageKey] of toDelete) {
|
|
1300
|
+
this.state.messages.delete(messageKey)
|
|
1301
|
+
}
|
|
1302
|
+
clampReadsToHead(this.state, input.projectId, input.threadId)
|
|
1303
|
+
|
|
1304
|
+
const remainingMessages = [...this.state.messages.values()]
|
|
1305
|
+
.filter(
|
|
1306
|
+
(message) => message.projectId === input.projectId && message.threadId === input.threadId
|
|
1307
|
+
)
|
|
1308
|
+
.sort((left, right) => right.seq - left.seq)
|
|
1309
|
+
const latestMessage = remainingMessages[0]
|
|
1310
|
+
const updatedAt = new Date()
|
|
1311
|
+
this.state.threads.set(
|
|
1312
|
+
threadKey,
|
|
1313
|
+
clone({
|
|
1314
|
+
...thread,
|
|
1315
|
+
messageCount: remainingMessages.filter(countsAsThreadMessage).length,
|
|
1316
|
+
lastMessageAt: latestMessage?.createdAt,
|
|
1317
|
+
updatedAt,
|
|
1318
|
+
})
|
|
1319
|
+
)
|
|
1320
|
+
|
|
1321
|
+
return toDelete.length
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1128
1324
|
async getById(params: { projectId: string; id: string }): Promise<AgentMessageRecord | null> {
|
|
1129
1325
|
const record = this.state.messages.get(key(params.projectId, params.id))
|
|
1130
1326
|
return record ? clone(record) : null
|
|
@@ -1146,14 +1342,32 @@ class InMemoryAgentMessageStore implements AgentMessageStore {
|
|
|
1146
1342
|
}
|
|
1147
1343
|
}
|
|
1148
1344
|
|
|
1149
|
-
|
|
1345
|
+
/** The `seq` of a thread's newest message, 0 when it has none. */
|
|
1346
|
+
function headSeqOf(state: AgentStoreState, projectId: string, threadId: string): number {
|
|
1150
1347
|
let max = 0
|
|
1151
1348
|
for (const message of state.messages.values()) {
|
|
1152
1349
|
if (message.projectId === projectId && message.threadId === threadId && message.seq > max) {
|
|
1153
1350
|
max = message.seq
|
|
1154
1351
|
}
|
|
1155
1352
|
}
|
|
1156
|
-
return max
|
|
1353
|
+
return max
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
function nextMessageSeq(state: AgentStoreState, projectId: string, threadId: string): number {
|
|
1357
|
+
return headSeqOf(state, projectId, threadId) + 1
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* Bring every place past the thread's newest message back to it, after a deletion. The next
|
|
1362
|
+
* message takes the number after the newest, so a place left past it would cover what a retry or
|
|
1363
|
+
* an edit writes next. Messages up to the newest kept their numbers and stay read.
|
|
1364
|
+
*/
|
|
1365
|
+
function clampReadsToHead(state: AgentStoreState, projectId: string, threadId: string): void {
|
|
1366
|
+
const headSeq = headSeqOf(state, projectId, threadId)
|
|
1367
|
+
for (const [readKey, read] of state.reads) {
|
|
1368
|
+
if (read.projectId !== projectId || read.threadId !== threadId) continue
|
|
1369
|
+
if (read.throughSeq > headSeq) state.reads.set(readKey, { ...read, throughSeq: headSeq })
|
|
1370
|
+
}
|
|
1157
1371
|
}
|
|
1158
1372
|
|
|
1159
1373
|
// ── context checkpoints ──────────────────────────────────────────────────────────────────────
|
|
@@ -1245,6 +1459,20 @@ class InMemoryAgentContextCheckpointStore implements AgentContextCheckpointStore
|
|
|
1245
1459
|
return record ? clone(record) : null
|
|
1246
1460
|
}
|
|
1247
1461
|
|
|
1462
|
+
async deleteAfterSeq(input: DeleteAgentContextCheckpointsAfterSeqInput): Promise<number> {
|
|
1463
|
+
assertDeleteAgentContextCheckpointsAfterSeqInput(input)
|
|
1464
|
+
const matching = [...this.state.checkpoints.entries()].filter(
|
|
1465
|
+
([, checkpoint]) =>
|
|
1466
|
+
checkpoint.projectId === input.projectId &&
|
|
1467
|
+
checkpoint.threadId === input.threadId &&
|
|
1468
|
+
checkpoint.observedHeadSeq > input.afterSeq
|
|
1469
|
+
)
|
|
1470
|
+
for (const [checkpointKey] of matching) {
|
|
1471
|
+
this.state.checkpoints.delete(checkpointKey)
|
|
1472
|
+
}
|
|
1473
|
+
return matching.length
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1248
1476
|
async getByRunIds(input: {
|
|
1249
1477
|
readonly projectId: string
|
|
1250
1478
|
readonly threadId: string
|
|
@@ -1528,6 +1756,38 @@ class InMemoryAgentApprovalStore implements AgentApprovalStore {
|
|
|
1528
1756
|
return { cancelled: cancelled.sort(compareApprovals).map(clone), stopped }
|
|
1529
1757
|
}
|
|
1530
1758
|
|
|
1759
|
+
async rewind(input: RewindAgentApprovalsInput): Promise<RewindAgentApprovalsResult> {
|
|
1760
|
+
const runIds = new Set(input.runIds)
|
|
1761
|
+
const clearedIds = new Set(input.clearedMessageIds ?? [])
|
|
1762
|
+
const cancelledAt = new Date(input.cancelledAt ?? new Date())
|
|
1763
|
+
const cancelled: AgentApprovalRecord[] = []
|
|
1764
|
+
let deleted = 0
|
|
1765
|
+
|
|
1766
|
+
for (const [approvalKey, approval] of [...this.state.approvals.entries()]) {
|
|
1767
|
+
if (approval.projectId !== input.projectId || approval.threadId !== input.threadId) continue
|
|
1768
|
+
|
|
1769
|
+
if (runIds.has(approval.runId)) {
|
|
1770
|
+
this.state.approvals.delete(approvalKey)
|
|
1771
|
+
deleted += 1
|
|
1772
|
+
if (approval.status === "pending") {
|
|
1773
|
+
cancelled.push({
|
|
1774
|
+
...approval,
|
|
1775
|
+
status: "cancelled",
|
|
1776
|
+
turnStoppedAt: approval.turnStoppedAt ?? cancelledAt,
|
|
1777
|
+
})
|
|
1778
|
+
}
|
|
1779
|
+
continue
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
if (approval.reportedInMessageId && clearedIds.has(approval.reportedInMessageId)) {
|
|
1783
|
+
const { reportedInMessageId: _reported, ...unreported } = approval
|
|
1784
|
+
this.state.approvals.set(approvalKey, clone(unreported))
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
return { cancelled: cancelled.sort(compareApprovals).map(clone), deleted }
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1531
1791
|
async holdsRun(input: { readonly projectId: string; readonly runId: string }): Promise<boolean> {
|
|
1532
1792
|
return holdsRun(this.state, input.projectId, input.runId)
|
|
1533
1793
|
}
|
|
@@ -2008,6 +2268,7 @@ export class InMemoryAgentStorage implements AgentStorage {
|
|
|
2008
2268
|
private readonly state: AgentStoreState = {
|
|
2009
2269
|
threads: new Map(),
|
|
2010
2270
|
participants: new Map(),
|
|
2271
|
+
reads: new Map(),
|
|
2011
2272
|
runs: new Map(),
|
|
2012
2273
|
messages: new Map(),
|
|
2013
2274
|
checkpoints: new Map(),
|
|
@@ -2019,6 +2280,7 @@ export class InMemoryAgentStorage implements AgentStorage {
|
|
|
2019
2280
|
}
|
|
2020
2281
|
|
|
2021
2282
|
readonly threads: InMemoryAgentThreadStore
|
|
2283
|
+
readonly reads: InMemoryAgentThreadReadStore
|
|
2022
2284
|
readonly runs: InMemoryAgentRunStore
|
|
2023
2285
|
readonly messages: InMemoryAgentMessageStore
|
|
2024
2286
|
readonly checkpoints: InMemoryAgentContextCheckpointStore
|
|
@@ -2031,6 +2293,7 @@ export class InMemoryAgentStorage implements AgentStorage {
|
|
|
2031
2293
|
|
|
2032
2294
|
constructor(executions: ExecutionStorage) {
|
|
2033
2295
|
this.threads = new InMemoryAgentThreadStore(this.state)
|
|
2296
|
+
this.reads = new InMemoryAgentThreadReadStore(this.state)
|
|
2034
2297
|
this.runs = new InMemoryAgentRunStore(this.state, executions)
|
|
2035
2298
|
this.messages = new InMemoryAgentMessageStore(this.state)
|
|
2036
2299
|
this.checkpoints = new InMemoryAgentContextCheckpointStore(this.state)
|
|
@@ -2045,6 +2308,7 @@ export class InMemoryAgentStorage implements AgentStorage {
|
|
|
2045
2308
|
return {
|
|
2046
2309
|
threads: structuredClone(this.state.threads),
|
|
2047
2310
|
participants: structuredClone(this.state.participants),
|
|
2311
|
+
reads: structuredClone(this.state.reads),
|
|
2048
2312
|
runs: structuredClone(this.state.runs),
|
|
2049
2313
|
messages: structuredClone(this.state.messages),
|
|
2050
2314
|
checkpoints: structuredClone(this.state.checkpoints),
|
|
@@ -2059,6 +2323,7 @@ export class InMemoryAgentStorage implements AgentStorage {
|
|
|
2059
2323
|
restore(snapshot: InMemoryAgentStorageSnapshot): void {
|
|
2060
2324
|
replace(this.state.threads, snapshot.threads)
|
|
2061
2325
|
replace(this.state.participants, snapshot.participants)
|
|
2326
|
+
replace(this.state.reads, snapshot.reads)
|
|
2062
2327
|
replace(this.state.runs, snapshot.runs)
|
|
2063
2328
|
replace(this.state.messages, snapshot.messages)
|
|
2064
2329
|
replace(this.state.checkpoints, snapshot.checkpoints)
|
|
@@ -51,6 +51,9 @@ export type {
|
|
|
51
51
|
AgentThreadParent,
|
|
52
52
|
AgentThreadParticipantRecord,
|
|
53
53
|
AgentThreadPlace,
|
|
54
|
+
AgentThreadReadRecord,
|
|
55
|
+
AgentThreadReadState,
|
|
56
|
+
AgentThreadReadStore,
|
|
54
57
|
AgentThreadRecord,
|
|
55
58
|
AgentThreadSandboxParams,
|
|
56
59
|
AgentThreadSandboxState,
|
|
@@ -70,7 +73,9 @@ export type {
|
|
|
70
73
|
CreateSubagentRunInput,
|
|
71
74
|
DecideAgentApprovalInput,
|
|
72
75
|
DecideAgentApprovalResult,
|
|
76
|
+
DeleteAgentContextCheckpointsAfterSeqInput,
|
|
73
77
|
DeleteAgentMessagesByRunInput,
|
|
78
|
+
DeleteAgentMessagesFromSeqInput,
|
|
74
79
|
EnqueueAgentInboxItemInput,
|
|
75
80
|
EnqueueAgentInboxItemResult,
|
|
76
81
|
FinishAgentRunInput,
|
|
@@ -87,11 +92,14 @@ export type {
|
|
|
87
92
|
ListAgentRunsResult,
|
|
88
93
|
ListAgentThreadChildrenInput,
|
|
89
94
|
ListAgentThreadParticipantsInput,
|
|
95
|
+
ListAgentThreadReadsInput,
|
|
90
96
|
ListAgentThreadsInput,
|
|
91
97
|
ListAgentThreadsResult,
|
|
98
|
+
ListLatestAgentRunsInput,
|
|
92
99
|
ListThreadSubagentsInput,
|
|
93
100
|
ListWaitingAgentInboxThreadsInput,
|
|
94
101
|
MarkAgentApprovalsReportedInput,
|
|
102
|
+
MarkAgentThreadReadInput,
|
|
95
103
|
MoveAgentThreadToCloudInput,
|
|
96
104
|
MoveAgentThreadToCloudResult,
|
|
97
105
|
ReclaimAgentRunInput,
|
|
@@ -100,6 +108,8 @@ export type {
|
|
|
100
108
|
RequestAgentApprovalInput,
|
|
101
109
|
RequestAgentApprovalResult,
|
|
102
110
|
RequestAgentRunCancelInput,
|
|
111
|
+
RewindAgentApprovalsInput,
|
|
112
|
+
RewindAgentApprovalsResult,
|
|
103
113
|
SaveAgentMemoryInput,
|
|
104
114
|
SaveAgentMemoryResult,
|
|
105
115
|
SettleAgentApprovalsInput,
|