@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
package/dist/workflows/index.js
CHANGED
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
defineWorkflow2,
|
|
9
9
|
createWorkflowNodeFailure2,
|
|
10
10
|
unwrapWorkflowNodeFailure2
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-yyj009tv.js";
|
|
12
12
|
import"../chunk-dvgc56n2.js";
|
|
13
13
|
import"../chunk-fzbhybya.js";
|
|
14
14
|
import"../chunk-z4jqb44a.js";
|
|
15
|
-
import"../chunk-
|
|
15
|
+
import"../chunk-9cyq87qa.js";
|
|
16
16
|
import"../chunk-de5sfbc3.js";
|
|
17
|
-
import"../chunk-
|
|
18
|
-
import"../chunk-
|
|
19
|
-
import"../chunk-
|
|
17
|
+
import"../chunk-jka26v8c.js";
|
|
18
|
+
import"../chunk-wzcjhv54.js";
|
|
19
|
+
import"../chunk-k29rdc3h.js";
|
|
20
20
|
import {
|
|
21
21
|
WorkflowDefinitionError2,
|
|
22
22
|
WorkflowValidationError2,
|
|
@@ -46,75 +46,77 @@ import {
|
|
|
46
46
|
snapshotWorkflowActionInput2,
|
|
47
47
|
WorkflowRunDispatcher2,
|
|
48
48
|
requestWorkflowRun2
|
|
49
|
-
} from "../chunk-
|
|
50
|
-
import"../chunk-
|
|
51
|
-
import"../chunk-
|
|
52
|
-
import"../chunk-
|
|
53
|
-
import"../chunk-
|
|
54
|
-
import"../chunk-
|
|
55
|
-
import"../chunk-
|
|
49
|
+
} from "../chunk-8qmp9fpa.js";
|
|
50
|
+
import"../chunk-04r2fdsd.js";
|
|
51
|
+
import"../chunk-n1hbwc6y.js";
|
|
52
|
+
import"../chunk-qbd282aa.js";
|
|
53
|
+
import"../chunk-pfdq1ga6.js";
|
|
54
|
+
import"../chunk-y8fwm3z2.js";
|
|
55
|
+
import"../chunk-phs5fbff.js";
|
|
56
|
+
import"../chunk-t58sktr5.js";
|
|
57
|
+
import"../chunk-cpy282b8.js";
|
|
58
|
+
import"../chunk-xavet0qs.js";
|
|
56
59
|
import"../chunk-3723kgba.js";
|
|
57
|
-
import"../chunk-
|
|
58
|
-
import"../chunk-q9nkpr8k.js";
|
|
60
|
+
import"../chunk-mrs7jy17.js";
|
|
59
61
|
import"../chunk-5qqmndhm.js";
|
|
60
|
-
import"../chunk-
|
|
61
|
-
import"../chunk-y8fwm3z2.js";
|
|
62
|
-
import"../chunk-pc7kra3k.js";
|
|
62
|
+
import"../chunk-9tpmfh3n.js";
|
|
63
63
|
import"../chunk-1vg43g9q.js";
|
|
64
64
|
import"../chunk-191jz8a6.js";
|
|
65
|
+
import"../chunk-m427qgq0.js";
|
|
65
66
|
import"../chunk-czct88ht.js";
|
|
66
67
|
import"../chunk-d9xbwh3h.js";
|
|
67
68
|
import"../chunk-8ncg20rd.js";
|
|
68
|
-
import"../chunk-
|
|
69
|
+
import"../chunk-0pmpwn3g.js";
|
|
69
70
|
import"../chunk-ppxf7gw2.js";
|
|
70
71
|
import"../chunk-w3t94hm6.js";
|
|
71
72
|
import"../chunk-wx7smkn2.js";
|
|
72
|
-
import"../chunk-
|
|
73
|
-
import"../chunk-
|
|
74
|
-
import"../chunk-
|
|
75
|
-
import"../chunk-
|
|
76
|
-
import"../chunk-
|
|
73
|
+
import"../chunk-hvq8xs66.js";
|
|
74
|
+
import"../chunk-6md802cc.js";
|
|
75
|
+
import"../chunk-js9e6487.js";
|
|
76
|
+
import"../chunk-06kpaqg4.js";
|
|
77
|
+
import"../chunk-5sswe5ej.js";
|
|
78
|
+
import"../chunk-61zptves.js";
|
|
77
79
|
import"../chunk-22d3qg4x.js";
|
|
78
80
|
import"../chunk-5rqqp8cr.js";
|
|
79
81
|
import"../chunk-186k5yz3.js";
|
|
80
82
|
import"../chunk-jmfet9r4.js";
|
|
81
83
|
import"../chunk-qf954wje.js";
|
|
82
|
-
import"../chunk-
|
|
84
|
+
import"../chunk-c4nrycdy.js";
|
|
83
85
|
import"../chunk-pk539cwv.js";
|
|
84
86
|
import"../chunk-c29729me.js";
|
|
85
|
-
import"../chunk-
|
|
86
|
-
import"../chunk-
|
|
87
|
-
import"../chunk-
|
|
87
|
+
import"../chunk-cg7cygfj.js";
|
|
88
|
+
import"../chunk-88xeh6zx.js";
|
|
89
|
+
import"../chunk-hkbks1xm.js";
|
|
88
90
|
import"../chunk-hn2r7z41.js";
|
|
89
91
|
import"../chunk-h89wz928.js";
|
|
90
|
-
import"../chunk-61zptves.js";
|
|
91
92
|
import"../chunk-x0v3jd47.js";
|
|
92
93
|
import"../chunk-g2ph4873.js";
|
|
93
94
|
import"../chunk-mbsbxarb.js";
|
|
94
|
-
import"../chunk-
|
|
95
|
-
import"../chunk-
|
|
95
|
+
import"../chunk-5pz3htbe.js";
|
|
96
|
+
import"../chunk-3qtk0070.js";
|
|
96
97
|
import"../chunk-xtztwpkh.js";
|
|
97
|
-
import"../chunk-
|
|
98
|
+
import"../chunk-cswhawa2.js";
|
|
98
99
|
import"../chunk-qttqe1ah.js";
|
|
99
100
|
import"../chunk-az95tsh3.js";
|
|
100
101
|
import"../chunk-3sgvd10b.js";
|
|
101
|
-
import"../chunk-
|
|
102
|
-
import"../chunk-
|
|
103
|
-
import"../chunk-
|
|
104
|
-
import"../chunk-dhkc9b23.js";
|
|
105
|
-
import"../chunk-8a8k38tz.js";
|
|
102
|
+
import"../chunk-dq3t5sr3.js";
|
|
103
|
+
import"../chunk-394zjzjs.js";
|
|
104
|
+
import"../chunk-3neam1y5.js";
|
|
106
105
|
import"../chunk-zrvhsq7f.js";
|
|
106
|
+
import"../chunk-v8a1qjzp.js";
|
|
107
|
+
import"../chunk-brybqw5k.js";
|
|
107
108
|
import"../chunk-frsz8wxd.js";
|
|
108
109
|
import"../chunk-5grk14e5.js";
|
|
109
|
-
import"../chunk-
|
|
110
|
+
import"../chunk-tapdssb5.js";
|
|
110
111
|
import"../chunk-rt9deb92.js";
|
|
111
|
-
import"../chunk-
|
|
112
|
+
import"../chunk-7mhbs9yy.js";
|
|
112
113
|
import"../chunk-7j4yydm2.js";
|
|
113
114
|
import"../chunk-d7v97qxq.js";
|
|
114
115
|
import"../chunk-xrmbhap8.js";
|
|
115
116
|
import"../chunk-gfdh9kqa.js";
|
|
116
117
|
import"../chunk-sgx82nnt.js";
|
|
117
|
-
import"../chunk-
|
|
118
|
+
import"../chunk-r588h4ev.js";
|
|
119
|
+
import"../chunk-5xkqasvn.js";
|
|
118
120
|
import"../chunk-mvz89age.js";
|
|
119
121
|
import"../chunk-6eqsgvxk.js";
|
|
120
122
|
import"../chunk-vs2s3p8n.js";
|
|
@@ -164,4 +166,4 @@ export {
|
|
|
164
166
|
workflowAgentStepActorId2 as workflowAgentStepActorId
|
|
165
167
|
};
|
|
166
168
|
|
|
167
|
-
//# debugId=
|
|
169
|
+
//# debugId=138D1453C3526E4264756E2164756E21
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "The ontology-first runtime for Sixb — objects, links, telemetry, actions, and provider contracts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -83,6 +83,12 @@
|
|
|
83
83
|
"import": "./dist/broker/index.js",
|
|
84
84
|
"default": "./dist/broker/index.js"
|
|
85
85
|
},
|
|
86
|
+
"./calendar": {
|
|
87
|
+
"types": "./dist/calendar.d.ts",
|
|
88
|
+
"bun": "./src/calendar.ts",
|
|
89
|
+
"import": "./dist/calendar.js",
|
|
90
|
+
"default": "./dist/calendar.js"
|
|
91
|
+
},
|
|
86
92
|
"./deploy": {
|
|
87
93
|
"types": "./dist/deploy/index.d.ts",
|
|
88
94
|
"bun": "./src/deploy/index.ts",
|
|
@@ -89,7 +89,9 @@ export function resolveObjectActionSubject(params: {
|
|
|
89
89
|
const { runtime, action, subject } = params
|
|
90
90
|
|
|
91
91
|
if (subject.kind !== "object") {
|
|
92
|
-
throw new OntologyValidationError(
|
|
92
|
+
throw new OntologyValidationError(
|
|
93
|
+
`Action '${action.id}' requires an object subject: name the ${action.binding.objectType.id} it acts on, by its object type and primary id.`
|
|
94
|
+
)
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
const objectType = runtime.ontology.resolveObjectType(subject.objectTypeId)
|
package/src/agents/children.ts
CHANGED
|
@@ -345,10 +345,16 @@ async function questionState(
|
|
|
345
345
|
.find((run) => run.status !== "failed" && run.status !== "cancelled")
|
|
346
346
|
if (!waiting || !isAwaitingAnswerRun(waiting)) return {}
|
|
347
347
|
|
|
348
|
+
const { total } = await agents.messages.list({
|
|
349
|
+
projectId: waiting.projectId,
|
|
350
|
+
threadId: conversationId,
|
|
351
|
+
limit: 1,
|
|
352
|
+
})
|
|
348
353
|
const [latest] = await agents.runs.listThreadSubagents({
|
|
349
354
|
projectId: waiting.projectId,
|
|
350
355
|
threadId: conversationId,
|
|
351
356
|
spawnKey: waiting.spawnKey,
|
|
357
|
+
...(total > 0 ? { retainedTurnsOnly: true } : {}),
|
|
352
358
|
limit: 1,
|
|
353
359
|
})
|
|
354
360
|
if (latest && latest.threadId !== thread.id) return { ended: { reason: "replaced" } }
|
package/src/agents/errors.ts
CHANGED
|
@@ -35,6 +35,9 @@ export type AgentRequestErrorCode =
|
|
|
35
35
|
| "invalid_model_selection"
|
|
36
36
|
| "invalid_locale"
|
|
37
37
|
| "invalid_message"
|
|
38
|
+
| "message_not_found"
|
|
39
|
+
| "message_not_editable"
|
|
40
|
+
| "not_message_author"
|
|
38
41
|
| "run_not_found"
|
|
39
42
|
| "run_not_retryable"
|
|
40
43
|
| "thread_not_found"
|
package/src/agents/execution.ts
CHANGED
|
@@ -71,6 +71,8 @@ import {
|
|
|
71
71
|
type AgentQueuedTurnStart,
|
|
72
72
|
assertComputerPlaceRequest,
|
|
73
73
|
dispatchAgentRun,
|
|
74
|
+
type EditAgentMessageInput,
|
|
75
|
+
editAgentMessage,
|
|
74
76
|
type PromoteAgentInboxItemInput,
|
|
75
77
|
promoteAgentInboxItem,
|
|
76
78
|
type RequestAgentRunInput,
|
|
@@ -88,7 +90,10 @@ import { normalizeSandboxBinding } from "./sandbox"
|
|
|
88
90
|
import { publishAgentThreadMoved } from "./streams/protocol"
|
|
89
91
|
import { listSubagentThreadRuns } from "./subagent-runs"
|
|
90
92
|
import {
|
|
93
|
+
type AgentThreadLastRunView,
|
|
94
|
+
type AgentThreadReadView,
|
|
91
95
|
type AgentThreadView,
|
|
96
|
+
agentRunEndedShort,
|
|
92
97
|
agentThreadViews,
|
|
93
98
|
assertConversationThread,
|
|
94
99
|
createAgentThreadAccessRule,
|
|
@@ -97,6 +102,8 @@ import type { AgentDescriptor } from "./types"
|
|
|
97
102
|
|
|
98
103
|
export type ExecutionAgentRequestInput = Omit<RequestAgentRunInput, "principal">
|
|
99
104
|
|
|
105
|
+
export type ExecutionAgentEditMessageInput = Omit<EditAgentMessageInput, "principal">
|
|
106
|
+
|
|
100
107
|
export type ListExecutionAgentThreadsInput = Omit<
|
|
101
108
|
ListAgentThreadsInput,
|
|
102
109
|
"projectId" | "ownerPrincipal" | "participantPrincipal"
|
|
@@ -160,6 +167,16 @@ export type AgentThreadsRuntime<TParams extends Record<string, unknown> = Record
|
|
|
160
167
|
getById(threadId: string): Promise<AgentThreadView | null>
|
|
161
168
|
/** The caller's own threads, or with `sharedWithMe` the ones other users added it to. */
|
|
162
169
|
list(input?: ListExecutionAgentThreadsInput): Promise<ListAgentThreadViewsResult>
|
|
170
|
+
/**
|
|
171
|
+
* Record that the caller's reading of a thread reached a message, or its newest when omitted,
|
|
172
|
+
* which is what a Done button sends. It never moves backwards, so another device that read
|
|
173
|
+
* further keeps its place; a message a retry or an edit took away marks nothing. Answers the
|
|
174
|
+
* caller's place afterwards.
|
|
175
|
+
*/
|
|
176
|
+
markRead(
|
|
177
|
+
threadId: string,
|
|
178
|
+
input?: { readonly throughMessageId?: string }
|
|
179
|
+
): Promise<AgentThreadReadView>
|
|
163
180
|
/**
|
|
164
181
|
* The sub-agents a conversation's turns spawned, oldest first, each the thread it works in with
|
|
165
182
|
* every run it took; `null` when the caller cannot read the conversation. `runId` keeps those
|
|
@@ -321,6 +338,11 @@ export interface AgentRunsRuntime {
|
|
|
321
338
|
* or stops the running one and starts now.
|
|
322
339
|
*/
|
|
323
340
|
send(input: SendAgentMessageInput): Promise<ExecutionAgentSendResult>
|
|
341
|
+
/**
|
|
342
|
+
* Edit an earlier user message in place, rewinding the thread to that point and starting a new
|
|
343
|
+
* turn from the edited prompt.
|
|
344
|
+
*/
|
|
345
|
+
editMessage(input: ExecutionAgentEditMessageInput): Promise<ExecutionAgentSendResult>
|
|
324
346
|
/**
|
|
325
347
|
* Retry a failed or interrupted turn; only whoever asked for it can, as it runs with their rights.
|
|
326
348
|
* A sub-agent's run is never retried: its turn decides whether to spawn it again.
|
|
@@ -766,7 +788,7 @@ export function createAgentRuntime<
|
|
|
766
788
|
try {
|
|
767
789
|
// Someone who left the thread no longer starts turns in it.
|
|
768
790
|
if (!(await rule.read(run.threadId))) return { status: "closed" }
|
|
769
|
-
return await startQueuedAgentTurnFromInbox(runtime, execution, run, options)
|
|
791
|
+
return await startQueuedAgentTurnFromInbox(runtime, execution, run, options, blobStorage)
|
|
770
792
|
} catch (error) {
|
|
771
793
|
console.error(`[Sixb] Could not start a queued message of Agent run '${run.id}'.`, error)
|
|
772
794
|
return { status: "closed" }
|
|
@@ -796,6 +818,66 @@ export function createAgentRuntime<
|
|
|
796
818
|
},
|
|
797
819
|
}
|
|
798
820
|
|
|
821
|
+
/** The caller, when there is a person: system code and shared links have no reading. */
|
|
822
|
+
const readViewer = (): UserPrincipal | undefined =>
|
|
823
|
+
principal.type === "user" ? principal : undefined
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* A thread's newest run as a client needs it to offer Continue or Retry. A run that ended short
|
|
827
|
+
* also names who asked for it, from its execution: only those runs pay for that read.
|
|
828
|
+
*/
|
|
829
|
+
const lastRunView = async (run: AgentRunRecord): Promise<AgentThreadLastRunView> => {
|
|
830
|
+
const view: AgentThreadLastRunView = {
|
|
831
|
+
id: run.id,
|
|
832
|
+
status: run.status,
|
|
833
|
+
...(run.finishReason === undefined ? {} : { finishReason: run.finishReason }),
|
|
834
|
+
...(run.error === undefined ? {} : { errorCode: run.error.code }),
|
|
835
|
+
...(run.completedAt === undefined ? {} : { completedAt: run.completedAt }),
|
|
836
|
+
}
|
|
837
|
+
if (!agentRunEndedShort(run)) return view
|
|
838
|
+
|
|
839
|
+
const execution = await runtime.storage.executions.getById({
|
|
840
|
+
projectId: runtime.projectId,
|
|
841
|
+
id: run.executionId,
|
|
842
|
+
})
|
|
843
|
+
if (!execution?.requestedBy) return view
|
|
844
|
+
|
|
845
|
+
return { ...view, requestedBy: structuredClone(execution.requestedBy) }
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* The caller's place in each thread and its newest run, in one batched read each, plus one
|
|
850
|
+
* execution read per thread whose newest turn ended short. Only the paths that hand a thread to
|
|
851
|
+
* a person call this: an access check does not pay for it.
|
|
852
|
+
*/
|
|
853
|
+
const withThreadState = async (
|
|
854
|
+
threads: readonly AgentThreadView[],
|
|
855
|
+
viewer: UserPrincipal | undefined
|
|
856
|
+
): Promise<readonly AgentThreadView[]> => {
|
|
857
|
+
const agents = runtime.storage.agents
|
|
858
|
+
if (!viewer || !agents || threads.length === 0) return threads
|
|
859
|
+
|
|
860
|
+
const threadIds = threads.map((thread) => thread.id)
|
|
861
|
+
const [reads, runs] = await Promise.all([
|
|
862
|
+
agents.reads.list({ projectId: runtime.projectId, threadIds, principal: viewer }),
|
|
863
|
+
agents.runs.latestByThread({ projectId: runtime.projectId, threadIds }),
|
|
864
|
+
])
|
|
865
|
+
const lastRuns = await Promise.all(runs.map(lastRunView))
|
|
866
|
+
|
|
867
|
+
const readOf = new Map(reads.map((read) => [read.threadId, read]))
|
|
868
|
+
const runOf = new Map(runs.map((run, index) => [run.threadId, lastRuns[index]]))
|
|
869
|
+
|
|
870
|
+
return threads.map((thread) => {
|
|
871
|
+
const read = readOf.get(thread.id)
|
|
872
|
+
const lastRun = runOf.get(thread.id)
|
|
873
|
+
return {
|
|
874
|
+
...thread,
|
|
875
|
+
...(read === undefined ? {} : { read }),
|
|
876
|
+
...(lastRun === undefined ? {} : { lastRun }),
|
|
877
|
+
}
|
|
878
|
+
})
|
|
879
|
+
}
|
|
880
|
+
|
|
799
881
|
/** Move a conversation's sandbox out of recovery, as its owner chose: fresh, or as it was. */
|
|
800
882
|
const recoverSandbox = async (
|
|
801
883
|
threadId: string,
|
|
@@ -818,25 +900,23 @@ export function createAgentRuntime<
|
|
|
818
900
|
}
|
|
819
901
|
const thread = readable.thread
|
|
820
902
|
const sandboxState = await transition(storage)
|
|
821
|
-
const [view] = await
|
|
903
|
+
const [view] = await withThreadState(
|
|
904
|
+
await agentThreadViews(runtime, [{ ...thread, sandboxState }]),
|
|
905
|
+
readViewer()
|
|
906
|
+
)
|
|
822
907
|
return view ?? thread
|
|
823
908
|
}
|
|
824
909
|
|
|
825
|
-
const
|
|
910
|
+
const ownedMovableThread = async (threadId: string): Promise<AgentThreadRecord> => {
|
|
826
911
|
const readable = await rule.read(threadId)
|
|
827
912
|
if (!readable) throw new AgentRequestError("thread_not_found", "[Sixb] Agent thread not found.")
|
|
913
|
+
assertConversationThread(readable.thread)
|
|
828
914
|
if (readable.access !== "owner") {
|
|
829
915
|
throw new AgentRequestError(
|
|
830
916
|
"not_thread_owner",
|
|
831
917
|
`[Sixb] Only the owner of Agent thread '${threadId}' moves it.`
|
|
832
918
|
)
|
|
833
919
|
}
|
|
834
|
-
if (readable.thread.runsOn !== "computer") {
|
|
835
|
-
throw new AgentRequestError(
|
|
836
|
-
"invalid_message",
|
|
837
|
-
`[Sixb] Agent thread '${threadId}' runs in the cloud, on no computer.`
|
|
838
|
-
)
|
|
839
|
-
}
|
|
840
920
|
return readable.thread
|
|
841
921
|
}
|
|
842
922
|
|
|
@@ -862,7 +942,9 @@ export function createAgentRuntime<
|
|
|
862
942
|
throw error instanceof AgentStorageError && error.code === "active_run_exists"
|
|
863
943
|
? new AgentRequestError(
|
|
864
944
|
"active_run_exists",
|
|
865
|
-
|
|
945
|
+
thread.runsOn === "computer"
|
|
946
|
+
? "[Sixb] A turn is running on the computer: stop it, or let it end, first."
|
|
947
|
+
: "[Sixb] A turn is running in the cloud: stop it, or let it end, first."
|
|
866
948
|
)
|
|
867
949
|
: error
|
|
868
950
|
})
|
|
@@ -912,23 +994,29 @@ export function createAgentRuntime<
|
|
|
912
994
|
})
|
|
913
995
|
),
|
|
914
996
|
moveToComputer: async (threadId, computer) => {
|
|
915
|
-
const thread = await
|
|
997
|
+
const thread = await ownedMovableThread(threadId)
|
|
916
998
|
const moves = movesComputerPlace(thread, computer)
|
|
917
999
|
const moved = await moveThread(thread, moves, (agents) =>
|
|
918
1000
|
agents.threads.assignComputer({ projectId: runtime.projectId, id: threadId, computer })
|
|
919
1001
|
)
|
|
920
1002
|
if (moves) await announceThreadMoved(thread)
|
|
921
|
-
const [view] = await agentThreadViews(runtime, [moved])
|
|
1003
|
+
const [view] = await withThreadState(await agentThreadViews(runtime, [moved]), readViewer())
|
|
922
1004
|
return view ?? moved
|
|
923
1005
|
},
|
|
924
1006
|
moveToCloud: async (threadId) => {
|
|
925
|
-
const thread = await
|
|
1007
|
+
const thread = await ownedMovableThread(threadId)
|
|
1008
|
+
if (thread.runsOn !== "computer") {
|
|
1009
|
+
throw new AgentRequestError(
|
|
1010
|
+
"invalid_message",
|
|
1011
|
+
`[Sixb] Agent thread '${threadId}' runs in the cloud, on no computer.`
|
|
1012
|
+
)
|
|
1013
|
+
}
|
|
926
1014
|
const { thread: moved, queued } = await moveThread(thread, true, (agents) =>
|
|
927
1015
|
agents.threads.moveToCloud({ projectId: runtime.projectId, id: threadId })
|
|
928
1016
|
)
|
|
929
1017
|
if (queued) await dispatchAgentRun(runtime, requireAgents(), queued.id)
|
|
930
1018
|
await announceThreadMoved(thread)
|
|
931
|
-
const [view] = await agentThreadViews(runtime, [moved])
|
|
1019
|
+
const [view] = await withThreadState(await agentThreadViews(runtime, [moved]), readViewer())
|
|
932
1020
|
return view ?? moved
|
|
933
1021
|
},
|
|
934
1022
|
create: async (input) => {
|
|
@@ -976,7 +1064,8 @@ export function createAgentRuntime<
|
|
|
976
1064
|
...(input.runsOn === undefined ? {} : { runsOn: input.runsOn }),
|
|
977
1065
|
...(input.computer === undefined ? {} : { computer: input.computer }),
|
|
978
1066
|
})
|
|
979
|
-
|
|
1067
|
+
const [view] = await withThreadState([{ ...created, participants: [] }], readViewer())
|
|
1068
|
+
return view ?? { ...created, participants: [] }
|
|
980
1069
|
},
|
|
981
1070
|
listChildren: async (threadId, { runId } = {}) => {
|
|
982
1071
|
const thread = await getVisibleThreadRecord(threadId)
|
|
@@ -1015,10 +1104,41 @@ export function createAgentRuntime<
|
|
|
1015
1104
|
ownerPrincipal: principal,
|
|
1016
1105
|
sandbox,
|
|
1017
1106
|
})
|
|
1018
|
-
const [view] = await agentThreadViews(runtime, [fork])
|
|
1107
|
+
const [view] = await withThreadState(await agentThreadViews(runtime, [fork]), readViewer())
|
|
1019
1108
|
return view ?? { ...fork, participants: [] }
|
|
1020
1109
|
},
|
|
1021
|
-
getById:
|
|
1110
|
+
getById: async (threadId) => {
|
|
1111
|
+
const thread = await getVisibleThreadRecord(threadId)
|
|
1112
|
+
if (!thread) return null
|
|
1113
|
+
const [view] = await withThreadState([thread], readViewer())
|
|
1114
|
+
return view ?? null
|
|
1115
|
+
},
|
|
1116
|
+
markRead: async (threadId, input = {}) => {
|
|
1117
|
+
const readable = await rule.read(threadId)
|
|
1118
|
+
if (!readable) {
|
|
1119
|
+
throw new AgentRequestError("thread_not_found", "[Sixb] Agent thread not found.")
|
|
1120
|
+
}
|
|
1121
|
+
assertConversationThread(readable.thread)
|
|
1122
|
+
const reader = settingsPrincipal()
|
|
1123
|
+
if (reader.type !== "user") {
|
|
1124
|
+
throw new AgentRequestError("agent_not_found", "[Sixb] The project Agent is unavailable.")
|
|
1125
|
+
}
|
|
1126
|
+
if (input.throughMessageId !== undefined && input.throughMessageId.trim().length === 0) {
|
|
1127
|
+
throw new AgentRequestError(
|
|
1128
|
+
"invalid_message",
|
|
1129
|
+
"[Sixb] 'throughMessageId' must name a message of the thread."
|
|
1130
|
+
)
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
return requireAgents().reads.mark({
|
|
1134
|
+
projectId: runtime.projectId,
|
|
1135
|
+
threadId,
|
|
1136
|
+
principal: reader,
|
|
1137
|
+
...(input.throughMessageId === undefined
|
|
1138
|
+
? {}
|
|
1139
|
+
: { throughMessageId: input.throughMessageId }),
|
|
1140
|
+
})
|
|
1141
|
+
},
|
|
1022
1142
|
list: async ({ sharedWithMe, ...input } = {}) => {
|
|
1023
1143
|
assertNoAgentSelector(input)
|
|
1024
1144
|
const none = { threads: [], hasMore: false, total: 0 }
|
|
@@ -1038,7 +1158,8 @@ export function createAgentRuntime<
|
|
|
1038
1158
|
? { participantPrincipal: caller }
|
|
1039
1159
|
: { ownerPrincipal: caller }),
|
|
1040
1160
|
})
|
|
1041
|
-
|
|
1161
|
+
const views = await agentThreadViews(runtime, result.threads)
|
|
1162
|
+
return { ...result, threads: await withThreadState(views, readViewer()) }
|
|
1042
1163
|
},
|
|
1043
1164
|
participants: {
|
|
1044
1165
|
add: (threadId, users) =>
|
|
@@ -1070,7 +1191,12 @@ export function createAgentRuntime<
|
|
|
1070
1191
|
`[Sixb] Agent thread '${threadId}' not found.`
|
|
1071
1192
|
)
|
|
1072
1193
|
}
|
|
1073
|
-
return promoteAgentInboxItem(
|
|
1194
|
+
return promoteAgentInboxItem(
|
|
1195
|
+
runtime,
|
|
1196
|
+
execution,
|
|
1197
|
+
{ ...input, threadId, itemId },
|
|
1198
|
+
blobStorage
|
|
1199
|
+
)
|
|
1074
1200
|
},
|
|
1075
1201
|
remove: async (threadId, itemId) => {
|
|
1076
1202
|
if (!(await getVisibleThreadRecord(threadId))) {
|
|
@@ -1095,7 +1221,7 @@ export function createAgentRuntime<
|
|
|
1095
1221
|
`[Sixb] Agent thread '${input.threadId}' not found.`
|
|
1096
1222
|
)
|
|
1097
1223
|
}
|
|
1098
|
-
const result = await sendAgentMessage(runtime, execution, turnModels, input)
|
|
1224
|
+
const result = await sendAgentMessage(runtime, execution, turnModels, input, blobStorage)
|
|
1099
1225
|
return result.kind === "turn"
|
|
1100
1226
|
? { ...result, run: await attachRunView(runtime, result.run) }
|
|
1101
1227
|
: result
|
|
@@ -1119,6 +1245,30 @@ export function createAgentRuntime<
|
|
|
1119
1245
|
})
|
|
1120
1246
|
return { ...result, run: await attachRunView(runtime, result.run) }
|
|
1121
1247
|
},
|
|
1248
|
+
editMessage: async (input) => {
|
|
1249
|
+
assertNoAgentSelector(input)
|
|
1250
|
+
const agent = getAgent()
|
|
1251
|
+
if (!agent) {
|
|
1252
|
+
throw new AgentRequestError("agent_not_found", "[Sixb] The project Agent is unavailable.")
|
|
1253
|
+
}
|
|
1254
|
+
assertAuthorized(runtime, { kind: "agent.run" })
|
|
1255
|
+
if (!(await getVisibleThreadRecord(input.threadId))) {
|
|
1256
|
+
throw new AgentRequestError(
|
|
1257
|
+
"thread_not_found",
|
|
1258
|
+
`[Sixb] Agent thread '${input.threadId}' not found.`
|
|
1259
|
+
)
|
|
1260
|
+
}
|
|
1261
|
+
const result = await editAgentMessage(
|
|
1262
|
+
runtime,
|
|
1263
|
+
execution,
|
|
1264
|
+
turnModels,
|
|
1265
|
+
{ ...input, principal },
|
|
1266
|
+
blobStorage
|
|
1267
|
+
)
|
|
1268
|
+
return result.kind === "turn"
|
|
1269
|
+
? { ...result, run: await attachRunView(runtime, result.run) }
|
|
1270
|
+
: result
|
|
1271
|
+
},
|
|
1122
1272
|
retry: async (runId) => {
|
|
1123
1273
|
const failedRun = await getControllableRun(runId, "retry")
|
|
1124
1274
|
const agent = getAgent()
|
package/src/agents/index.ts
CHANGED
|
@@ -194,6 +194,9 @@ export {
|
|
|
194
194
|
AGENT_MESSAGE_DELIVERIES,
|
|
195
195
|
type AgentMessageDelivery,
|
|
196
196
|
type AgentQueuedTurnStart,
|
|
197
|
+
type EditAgentMessageInput,
|
|
198
|
+
editAgentMessage,
|
|
199
|
+
isEditableAgentMessage,
|
|
197
200
|
isRetryableAgentRun,
|
|
198
201
|
type PromoteAgentInboxItemInput,
|
|
199
202
|
promoteAgentInboxItem,
|
|
@@ -304,6 +307,7 @@ export { decodeWireValue, encodeWireError, encodeWireValue } from "./run-session
|
|
|
304
307
|
export type { AgentApiRoute, AgentRunTokenInput } from "./run-token"
|
|
305
308
|
export {
|
|
306
309
|
AGENT_API_ROUTES,
|
|
310
|
+
AGENT_RUN_HEADER,
|
|
307
311
|
agentRunTokenRunId,
|
|
308
312
|
createAgentRunnerToken,
|
|
309
313
|
createAgentRunToken,
|
|
@@ -341,6 +345,7 @@ export type {
|
|
|
341
345
|
AgentRunControlStreamId,
|
|
342
346
|
AgentRunFailure,
|
|
343
347
|
AgentRunFinishedEvent,
|
|
348
|
+
AgentRunStepsEvent,
|
|
344
349
|
AgentRunStreamEvent,
|
|
345
350
|
AgentRunStreamId,
|
|
346
351
|
} from "./streams/protocol"
|