@makaio/framework 1.0.0-dev-1785409369816 → 1.0.0-dev-1786014320559
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/.makaio-build.json +4 -3
- package/dist/{account-identity-DFx8pwKL.mjs → account-identity-DGpXd8h_.mjs} +1 -1
- package/dist/adapter-BkdJaOOG.mjs +1 -0
- package/dist/adapter-subsystem/index.d.mts +138 -6
- package/dist/adapter-subsystem/index.mjs +1 -1
- package/dist/adapters/acp-client/index.d.mts +105 -7
- package/dist/adapters/acp-client/index.mjs +2 -2
- package/dist/adapters/config/index.d.mts +1 -1
- package/dist/adapters/config/index.mjs +1 -1
- package/dist/adapters/index.d.mts +362 -801
- package/dist/adapters/index.mjs +6 -6
- package/dist/adapters/node.d.mts +1 -1
- package/dist/adapters/node.mjs +1 -1
- package/dist/adapters/stream-session/index.d.mts +28 -7
- package/dist/adapters/stream-session/index.mjs +1 -1
- package/dist/agent-namespace-D51PODFf.mjs +1 -0
- package/dist/{ajv-DD3SIL2i.mjs → ajv-L5fKxaia.mjs} +2 -2
- package/dist/artifact-k3veR4Yx.mjs +1 -0
- package/dist/attach-error-BSlc7JfL.mjs +1 -0
- package/dist/{auth-DGEdiHF6.mjs → auth-A1K_7q-8.mjs} +1 -1
- package/dist/authority-state-bootstrap-YwtEImIB.mjs +1 -0
- package/dist/automation-trigger-CuSdQwir.mjs +1 -0
- package/dist/await-trigger-ph1S0zVI.mjs +1 -0
- package/dist/bus/index.d.mts +19 -5
- package/dist/bus/index.mjs +1 -1
- package/dist/bus-BIj0_aG6.mjs +1 -0
- package/dist/bus-CqgrphNE.mjs +2 -0
- package/dist/{canonical-model-BAytQ4NV.mjs → canonical-model-DJASlL4m.mjs} +1 -1
- package/dist/{capabilities-BQEp34ir.mjs → capabilities-Bqckjh7G.mjs} +1 -1
- package/dist/{client-DbS847wW.mjs → client-BL5__WT0.mjs} +1 -1
- package/dist/clients/index.d.mts +2 -2
- package/dist/clients/index.mjs +1 -1
- package/dist/clients/managed-install.d.mts +1 -1
- package/dist/clients/managed-install.mjs +1 -1
- package/dist/{compression-74fFeBha.mjs → compression-BbttSqm8.mjs} +1 -1
- package/dist/{config-namespace-TVX-hG4I.mjs → config-namespace-CyzeLWSg.mjs} +1 -1
- package/dist/{context-resolution-DdyhpH4L.d.mts → context-resolution-CW0ya4QO.d.mts} +13 -13
- package/dist/contracts/adapter/index.d.mts +3 -3
- package/dist/contracts/adapter/index.mjs +1 -1
- package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
- package/dist/contracts/artifact/index.d.mts +3 -3
- package/dist/contracts/artifact/index.mjs +1 -1
- package/dist/contracts/auth/index.d.mts +2 -2
- package/dist/contracts/auth/index.mjs +1 -1
- package/dist/contracts/automation-trigger/index.d.mts +4 -0
- package/dist/contracts/automation-trigger/index.mjs +1 -0
- package/dist/contracts/canonical-model/index.d.mts +1 -1
- package/dist/contracts/canonical-model/index.mjs +1 -1
- package/dist/contracts/capabilities/index.d.mts +1 -1
- package/dist/contracts/capabilities/index.mjs +1 -1
- package/dist/contracts/client/index.d.mts +2 -2
- package/dist/contracts/client/index.mjs +1 -1
- package/dist/contracts/common/index.d.mts +1 -1
- package/dist/contracts/config/index.d.mts +1 -1
- package/dist/contracts/config/index.mjs +1 -1
- package/dist/contracts/extension/index.d.mts +6 -5
- package/dist/contracts/extension/index.mjs +1 -1
- package/dist/contracts/facet/index.d.mts +1 -1
- package/dist/contracts/facet/index.mjs +1 -1
- package/dist/contracts/harness/index.d.mts +1 -1
- package/dist/contracts/harness/index.mjs +1 -1
- package/dist/contracts/host/index.d.mts +1 -1
- package/dist/contracts/host/index.mjs +1 -1
- package/dist/contracts/index.d.mts +181 -120
- package/dist/contracts/index.mjs +1 -1
- package/dist/contracts/materialization/index.d.mts +3 -3
- package/dist/contracts/materialization/index.mjs +1 -1
- package/dist/contracts/model-registry/index.d.mts +1 -1
- package/dist/contracts/model-registry/index.mjs +1 -1
- package/dist/contracts/native-session-supervisor/index.d.mts +1 -1
- package/dist/contracts/native-session-supervisor/index.mjs +1 -1
- package/dist/contracts/platform/index.d.mts +1 -1
- package/dist/contracts/platform/index.mjs +1 -1
- package/dist/contracts/provider/index.d.mts +2 -2
- package/dist/contracts/provider/index.mjs +1 -1
- package/dist/contracts/reaction/index.d.mts +2 -0
- package/dist/contracts/reaction/index.mjs +1 -0
- package/dist/contracts/session/index.d.mts +3 -3
- package/dist/contracts/session/index.mjs +1 -1
- package/dist/contracts/shared/index.d.mts +3 -3
- package/dist/contracts/shared/index.mjs +1 -1
- package/dist/contracts/skill/index.d.mts +1 -1
- package/dist/contracts/skill/index.mjs +1 -1
- package/dist/contracts/telemetry/index.d.mts +1 -1
- package/dist/contracts/telemetry/index.mjs +1 -1
- package/dist/contracts/timeout/index.d.mts +1 -1
- package/dist/contracts/timeout/index.mjs +1 -1
- package/dist/contracts/toast/index.mjs +1 -1
- package/dist/contracts/variant/index.d.mts +1 -1
- package/dist/contracts/variant/index.mjs +1 -1
- package/dist/contracts/worker-node/index.d.mts +1 -1
- package/dist/contracts/worker-node/index.mjs +1 -1
- package/dist/contracts/workflow/index.d.mts +3 -3
- package/dist/contracts/workflow/index.mjs +1 -1
- package/dist/contribution-BH-wKsWI.d.mts +35 -0
- package/dist/core/index.d.mts +60 -1
- package/dist/core/index.mjs +1 -1
- package/dist/definition-BYgHlmMw.d.mts +375 -0
- package/dist/{definition-CJfiv8xm.mjs → definition-CDg-Jq1T.mjs} +1 -1
- package/dist/{detached-extension-handle-Ddfquy5_.mjs → detached-extension-handle-DKd17UB6.mjs} +1 -1
- package/dist/drizzle/0031_adapter_session_currency.sql +66 -0
- package/dist/drizzle/0032_native_session_ownership.sql +77 -0
- package/dist/drizzle/0033_m_msf3hu2s.sql +1 -0
- package/dist/drizzle/meta/_journal.json +21 -0
- package/dist/{execution-attempt-repository-DWXKY41_.d.mts → execution-attempt-repository-DFyAnchJ.d.mts} +1 -1
- package/dist/{execution-target-Cf645pDj.mjs → execution-target-ByNwZh5-.mjs} +1 -1
- package/dist/extension-DMdmj9gi.mjs +1 -0
- package/dist/extension-DUmibvMk.mjs +1 -0
- package/dist/extension-context-CqfddWXs.d.mts +295 -0
- package/dist/{extension-discovery-CQRdbVQ6.d.mts → extension-discovery-Fhps4icD.d.mts} +2 -0
- package/dist/{extension-namespace-Yu41YepM.mjs → extension-namespace-B554RmCp.mjs} +1 -1
- package/dist/extension-package-provenance-Dh_-Z-tE.mjs +1 -0
- package/dist/{filesystem-service-DlP2HfDg.mjs → filesystem-service-FAtd9gWH.mjs} +1 -1
- package/dist/framework-packages-D_2hBZ-p.mjs +1 -0
- package/dist/git/index.mjs +1 -1
- package/dist/{globby-1yCVCk8s.mjs → globby-BBLuT_vy.mjs} +1 -1
- package/dist/handlers-2yd00VEq.mjs +57 -0
- package/dist/{harness-DpwsFsE7.mjs → harness-KxbWGL4I.mjs} +1 -1
- package/dist/{hook-responses-Dh1PWXqJ.d.mts → hook-responses-CQZIv3L3.d.mts} +2 -293
- package/dist/{index-DCZ8BX9S.d.mts → index-3eUIRy7T.d.mts} +304 -74
- package/dist/{index-brqfk9JQ.d.mts → index-B4xdTT3c.d.mts} +6 -6
- package/dist/{index-4VfqCjl2.d.mts → index-B5op6AsV.d.mts} +49 -39
- package/dist/{index-CMgLxw14.d.mts → index-B6GOuxVy2.d.mts} +18 -18
- package/dist/index-BFhJe-Sb.d.mts +302 -0
- package/dist/{index-EjsSBQXy2.d.mts → index-BSQ30wYP.d.mts} +1 -1
- package/dist/{index-DlsHL9Jg.d.mts → index-BiAYXjgM.d.mts} +25 -25
- package/dist/{index-B9UW_vPM.d.mts → index-ByZi9bml.d.mts} +4967 -1509
- package/dist/{index-BVlXneHH.d.mts → index-C7HcDpHE.d.mts} +14 -10
- package/dist/{index-BskPjMet.d.mts → index-CB4aIUoF.d.mts} +16 -16
- package/dist/{index-cqLS1eFV.d.mts → index-CDusRXio.d.mts} +70 -71
- package/dist/{index-DnG-QFpG.d.mts → index-CSN_0sCo.d.mts} +18 -1
- package/dist/{index-BAXkicoQ.d.mts → index-C__EQfKa.d.mts} +1 -1
- package/dist/{index-CLvQsL6s2.d.mts → index-CqQYgsbB.d.mts} +1660 -218
- package/dist/{index-BNMnIe-j.d.mts → index-CwDiyJkJ.d.mts} +276 -705
- package/dist/{index-GHASUiem.d.mts → index-DBadVauL.d.mts} +1 -1
- package/dist/{index-gUhidukN.d.mts → index-DI7-tIL3.d.mts} +299 -2
- package/dist/index-DP3o_13U.d.mts +165 -0
- package/dist/{index-DSBT83c0.d.mts → index-DcYAAJ0V.d.mts} +24 -3
- package/dist/{index-D5Nb7IEP.d.mts → index-Dch_AxUg.d.mts} +77 -39
- package/dist/{index-D_ODXsBv.d.mts → index-DcqSUsX6.d.mts} +35 -79
- package/dist/{index-B0Kf_OWi.d.mts → index-DgOfgjx3.d.mts} +1 -1
- package/dist/{index-Ds5_rDEJ.d.mts → index-DwLRZscE.d.mts} +1 -12
- package/dist/{index-DkiTJM5p.d.mts → index-DxYDRoDE2.d.mts} +17 -3
- package/dist/{index-CRvpVIqA.d.mts → index-OsbtyMgx2.d.mts} +10 -1
- package/dist/{index-BaZeoZoS.d.mts → index-bIe_57cL.d.mts} +1 -1
- package/dist/{json-value-Brslhqbm.d.mts → json-value-C1RGgS0a.d.mts} +16 -1
- package/dist/{json-value-DmU8ibo_.mjs → json-value-D57aJhVn.mjs} +1 -1
- package/dist/kernel/cli/index.d.mts +2 -2
- package/dist/kernel/cli/index.mjs +1 -1
- package/dist/kernel/cli/register.d.mts +1 -1
- package/dist/kernel/cli/register.mjs +1 -1
- package/dist/kernel/cli/schemas.mjs +1 -1
- package/dist/kernel/extension/index.d.mts +1 -1
- package/dist/kernel/extension/index.mjs +1 -1
- package/dist/kernel/index.d.mts +9 -9
- package/dist/kernel/index.mjs +1 -1
- package/dist/kernel/namespace/index.d.mts +2 -2
- package/dist/kernel/namespace/index.mjs +1 -1
- package/dist/kernel/observability/index.d.mts +1 -1
- package/dist/kernel/observability/index.mjs +1 -1
- package/dist/kernel/providers/index.d.mts +1 -1
- package/dist/kernel/providers/index.mjs +1 -1
- package/dist/kernel/window/index.d.mts +1 -1
- package/dist/kernel/window/index.mjs +1 -1
- package/dist/{lib-C7-s68uf.mjs → lib-B_rJ6r0T.mjs} +1 -1
- package/dist/{lib-DErgth_E.mjs → lib-CnOAtohU.mjs} +1 -1
- package/dist/load-extensions-CW9uzNR5.mjs +1 -0
- package/dist/{load-extensions-BxsDB87B.d.mts → load-extensions-DUpaMQ7G.d.mts} +17 -13
- package/dist/{materialization-Jd198K3y.mjs → materialization-CcpCDhXh.mjs} +1 -1
- package/dist/mcp-http-server/index.mjs +1 -1
- package/dist/model-ZH3L1dPW.mjs +1 -0
- package/dist/{namespace-BqxtpNAn.mjs → namespace-B7bntOB8.mjs} +1 -1
- package/dist/{namespace-CWUDFGOy.mjs → namespace-BFqkUTJp.mjs} +1 -1
- package/dist/{namespace-CjjFvrIA2.d.mts → namespace-CAy4P5mW.d.mts} +29 -29
- package/dist/{namespace-B8uKAzWJ.mjs → namespace-CFjdyNXG.mjs} +1 -1
- package/dist/{namespace-DV-Hr9sZ.d.mts → namespace-ChnRTUG4.d.mts} +11 -1
- package/dist/namespace-CxrOLeeP.mjs +1 -0
- package/dist/{namespace-g_mbIZq_.d.mts → namespace-DSlfFhB1.d.mts} +410 -26
- package/dist/{namespace-CupOzbRv.d.mts → namespace-DwZwGXgF.d.mts} +24 -20
- package/dist/{namespace-TseEI3Pu.d.mts → namespace-Rge9mMI-.d.mts} +36 -28
- package/dist/{native-session-supervisor-DRx0MX-d.mjs → native-session-supervisor-fZYPUk0-.mjs} +1 -1
- package/dist/node/bus-server/index.d.mts +1 -1
- package/dist/node/bus-server/index.mjs +1 -1
- package/dist/node/bus-server/server-lifecycle.d.mts +1 -1
- package/dist/node/bus-server/server-lifecycle.mjs +1 -1
- package/dist/{orchestrator-shared-BHCv-l2O.d.mts → orchestrator-shared-B-KRW1Z0.d.mts} +1 -0
- package/dist/orchestrator-shared-CTCZc6Vl.mjs +1 -0
- package/dist/ownership-memory-handler-Bblp93YC.mjs +1 -0
- package/dist/{package-DWMxGfzK.d.mts → package-Bf3hyuzs.d.mts} +234 -84
- package/dist/package-CBdvjyyZ.mjs +1 -0
- package/dist/package-CddkNbZI.mjs +1 -0
- package/dist/package-ypz4rKvn.mjs +7 -0
- package/dist/package.json +1 -1
- package/dist/{profile-BTAI31Nt.mjs → profile-BtznZlq3.mjs} +1 -1
- package/dist/{provider-context-Dq53Cgzz.mjs → provider-context-BrLZYnDW.mjs} +1 -1
- package/dist/{provider-context-PZIQWcqQ.mjs → provider-context-Dh-VOOYF.mjs} +1 -1
- package/dist/reaction-BS0k4eNN.mjs +1 -0
- package/dist/{registry-wfF2uTty.mjs → registry-BO_bOoky.mjs} +2 -2
- package/dist/{resolved-DZgqql2Z.mjs → resolved-DMByz1_2.mjs} +1 -1
- package/dist/rules/index.d.mts +1 -1
- package/dist/rules/index.mjs +1 -1
- package/dist/rules/schemas.d.mts +1 -1
- package/dist/runtime-bun/index.mjs +1 -1
- package/dist/runtime-node/extension-discovery.d.mts +1 -1
- package/dist/runtime-node/extension-validation.d.mts +1 -1
- package/dist/runtime-node/extension-validation.mjs +1 -1
- package/dist/runtime-node/index.d.mts +4 -4
- package/dist/runtime-node/index.mjs +24 -24
- package/dist/runtime-node/makaio-config.d.mts +1 -1
- package/dist/runtime-node/makaio-config.mjs +1 -1
- package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
- package/dist/runtime-node/workflow-worker/index.mjs +1 -1
- package/dist/runtime-node/workflow-worker/worker-entry.mjs +1 -1
- package/dist/{schema-Dd-e89MO.mjs → schema-DBG7Jq5_.mjs} +1 -1
- package/dist/{schema-DKUb4rkr.d.mts → schema-DKTzriEY.d.mts} +519 -9
- package/dist/{schemas-DrVg4aQQ.d.mts → schemas-9qeeHGBf.d.mts} +8 -8
- package/dist/{schemas-CRB2O5zo.mjs → schemas-BqD8LlQw.mjs} +1 -1
- package/dist/{schemas-DaHQzpgm.mjs → schemas-CsjN7cmM.mjs} +1 -1
- package/dist/schemas-DSkBOdx_.mjs +1 -0
- package/dist/schemas-DplrlAyR.mjs +1 -0
- package/dist/{schemas-DnYiAvfz.d.mts → schemas-VbB1FTxx.d.mts} +24 -20
- package/dist/scoped-bus-ClwTWqX8.mjs +1 -0
- package/dist/{selection-BNwTKEVT.mjs → selection-7Ku8DBnh.mjs} +1 -1
- package/dist/services/adapter-runtime/index.d.mts +3 -3
- package/dist/services/adapter-runtime/index.mjs +1 -1
- package/dist/services/adapter-runtime/namespace.d.mts +1 -1
- package/dist/services/adapter-runtime/schemas.d.mts +1 -1
- package/dist/services/adapter-subsystem/index.d.mts +4 -4
- package/dist/services/adapter-subsystem/index.mjs +1 -1
- package/dist/services/adapter-subsystem/namespace.d.mts +2 -2
- package/dist/services/adapter-subsystem/namespace.mjs +1 -1
- package/dist/services/agent-runtime/index.d.mts +2 -2
- package/dist/services/agent-runtime/namespace.d.mts +1 -1
- package/dist/services/agent-runtime/schemas.d.mts +1 -1
- package/dist/services/automation-trigger/index.d.mts +943 -0
- package/dist/services/automation-trigger/index.mjs +1 -0
- package/dist/services/capability/index.d.mts +1 -1
- package/dist/services/capability/index.mjs +1 -1
- package/dist/services/codebase/index.d.mts +2 -2
- package/dist/services/codebase/namespace.d.mts +1 -1
- package/dist/services/codebase/schemas.d.mts +1 -1
- package/dist/services/compression/index.d.mts +2 -2
- package/dist/services/compression/namespace.d.mts +1 -1
- package/dist/services/compression/schemas.d.mts +1 -1
- package/dist/services/context-rules/index.d.mts +4 -4
- package/dist/services/context-rules/index.mjs +1 -1
- package/dist/services/execution-target/index.d.mts +3 -3
- package/dist/services/execution-target/index.mjs +1 -1
- package/dist/services/execution-target/namespace.d.mts +1 -1
- package/dist/services/execution-target/namespace.mjs +1 -1
- package/dist/services/execution-target/schemas.d.mts +1 -1
- package/dist/services/execution-target/schemas.mjs +1 -1
- package/dist/services/filesystem/index.d.mts +1 -1
- package/dist/services/filesystem/index.mjs +1 -1
- package/dist/services/filesystem/namespace.d.mts +6 -6
- package/dist/services/filesystem/schemas.d.mts +3 -3
- package/dist/services/git/namespace.mjs +1 -1
- package/dist/services/git/schemas.mjs +1 -1
- package/dist/services/harness/index.mjs +1 -1
- package/dist/services/index.d.mts +459 -93
- package/dist/services/index.mjs +1 -1
- package/dist/services/log-import/browser.d.mts +2 -2
- package/dist/services/log-import/index.d.mts +3 -3
- package/dist/services/log-import/log-import.d.mts +1 -1
- package/dist/services/log-import/log-import.mjs +1 -1
- package/dist/services/log-import/namespace.mjs +1 -1
- package/dist/services/log-import/schemas.mjs +1 -1
- package/dist/services/materialization/index.d.mts +1 -1
- package/dist/services/materialization/index.mjs +1 -1
- package/dist/services/model-registry/index.d.mts +1 -1
- package/dist/services/model-registry/index.mjs +1 -1
- package/dist/services/preferences/index.d.mts +2 -2
- package/dist/services/preferences/schemas.d.mts +1 -1
- package/dist/services/preferences/storage-namespace.d.mts +2 -2
- package/dist/services/provider-context/index.d.mts +1 -1
- package/dist/services/provider-context/index.mjs +1 -1
- package/dist/services/provider-runtime/index.mjs +1 -1
- package/dist/services/session/handlers/index.d.mts +2 -2
- package/dist/services/session/handlers/index.mjs +1 -1
- package/dist/services/session/index.d.mts +10 -10
- package/dist/services/session/index.mjs +1 -1
- package/dist/services/session/messages/namespace.d.mts +1 -1
- package/dist/services/session/messages/namespace.mjs +1 -1
- package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
- package/dist/services/session/orchestrator-testing/index.mjs +1 -1
- package/dist/services/session/session-events/namespace.d.mts +1 -1
- package/dist/services/session/session-events/namespace.mjs +1 -1
- package/dist/services/session/storage/namespace.d.mts +1 -1
- package/dist/services/session/storage/schema.d.mts +2 -2
- package/dist/services/session/storage/schema.mjs +1 -1
- package/dist/services/session/testing/index.d.mts +12 -4
- package/dist/services/session/testing/index.mjs +36 -4
- package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
- package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
- package/dist/services/session/turns/namespace.d.mts +1 -1
- package/dist/services/session/turns/namespace.mjs +1 -1
- package/dist/services/session-editor/index.d.mts +1 -1
- package/dist/services/session-editor/index.mjs +1 -1
- package/dist/services/settings/index.d.mts +3 -3
- package/dist/services/settings/index.mjs +1 -1
- package/dist/services/settings/namespace.d.mts +8 -8
- package/dist/services/settings/namespace.mjs +1 -1
- package/dist/services/settings/storage/clients-namespace.d.mts +1 -1
- package/dist/services/settings/storage/clients-namespace.mjs +1 -1
- package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
- package/dist/services/settings/storage/index.d.mts +3 -3
- package/dist/services/settings/storage/index.mjs +1 -1
- package/dist/services/settings/storage/providers-namespace.d.mts +1 -1
- package/dist/services/settings/storage/providers-namespace.mjs +1 -1
- package/dist/services/subagent/index.d.mts +1 -1
- package/dist/services/subagent/index.mjs +1 -1
- package/dist/services/subagent-template/index.d.mts +2 -2
- package/dist/services/subagent-template/namespace.d.mts +1 -1
- package/dist/services/subagent-template/schemas.d.mts +1 -1
- package/dist/services/tool-approval/index.d.mts +1 -1
- package/dist/services/tool-approval/index.mjs +1 -1
- package/dist/services/tools/index.d.mts +1 -1
- package/dist/services/tools/index.mjs +1 -1
- package/dist/services/tray-menu/index.d.mts +3 -3
- package/dist/services/tray-menu/index.mjs +1 -1
- package/dist/services/tray-menu/namespace.d.mts +1 -1
- package/dist/services/tray-menu/schemas.d.mts +1 -1
- package/dist/services/turn/index.d.mts +1 -1
- package/dist/services/turn/namespace.d.mts +1 -1
- package/dist/services/workflow-transitions/index.d.mts +1 -1
- package/dist/services/workflow-transitions/index.mjs +1 -1
- package/dist/session-BMy2kRpX.mjs +90 -0
- package/dist/session-Cipx34j6.mjs +1 -0
- package/dist/{session-lineage-B_JW5LpF.d.mts → session-lineage-B_PVa1XN.d.mts} +1 -1
- package/dist/shared-BFVuCDPx.mjs +1 -0
- package/dist/{skill-BR6rkfLe.mjs → skill-C1D51nhh.mjs} +1 -1
- package/dist/{src-DD0v-nIj.mjs → src-xbmzokNe.mjs} +1 -1
- package/dist/storage/drizzle/client.d.mts +1 -1
- package/dist/storage/drizzle/client.mjs +1 -1
- package/dist/storage/drizzle/index.d.mts +42 -2
- package/dist/storage/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/drizzle/index.d.mts +1 -1
- package/dist/storage/handlers/drizzle/index.mjs +1 -1
- package/dist/storage/handlers/index.d.mts +1 -1
- package/dist/storage/handlers/index.mjs +1 -1
- package/dist/tool-approval-service-BVgN9Q1r.mjs +1 -0
- package/dist/{tools-PdG9fO1M.mjs → tools-DxwHox1a.mjs} +1 -1
- package/dist/{transition-Du3MQzJV.d.mts → transition-BF1nevaC.d.mts} +7 -34
- package/dist/{types-DMLDHFR9.d.mts → types-BNjPhj_a.d.mts} +1 -1
- package/dist/{types-Dzrwa1GY.d.mts → types-CijlWGwb.d.mts} +2036 -618
- package/dist/types-ClpEaoAm.d.mts +2917 -0
- package/dist/{types-D7_kevBK.d.mts → types-xCdGghb2.d.mts} +1 -1
- package/dist/ui-hooks/index.d.mts +29 -2
- package/dist/ui-hooks/index.mjs +1 -1
- package/dist/ui-kernel/index.d.mts +2 -2
- package/dist/ui-kernel/pages/schemas.d.mts +1 -1
- package/dist/ui-views/index.d.mts +1 -1
- package/dist/utils/index.d.mts +77 -1
- package/dist/utils/index.mjs +2 -2
- package/dist/{version-CoCeMxDT.mjs → version-BfNnVAGr.mjs} +1 -1
- package/dist/{view-builder-DeFd-k7C.d.mts → view-builder-Bc9dx6jF.d.mts} +1 -1
- package/dist/{visibility-qhGWmpSJ.mjs → visibility-Dl1o2I01.mjs} +1 -1
- package/dist/{worker-node-Bl9_vqYi.mjs → worker-node-BDOYPEpi.mjs} +1 -1
- package/dist/{worker-node-DZTuT1DS.mjs → worker-node-DJ41Tr-F.mjs} +1 -1
- package/dist/workflow-Hzc5jlnV.mjs +1 -0
- package/dist/workflow-engine/execution-attempt-repository.d.mts +1 -1
- package/dist/workflow-engine/index.d.mts +114 -395
- package/dist/workflow-engine/index.mjs +1 -1
- package/dist/workflow-engine/package.d.mts +1 -1
- package/dist/workflow-engine/package.mjs +1 -1
- package/dist/workflow-engine/provider-operation.d.mts +1 -1
- package/dist/workflow-engine/testing/index.d.mts +2 -2
- package/dist/workflow-engine/testing/index.mjs +1 -1
- package/dist/workflow-engine/testing/sqlite.d.mts +1 -1
- package/dist/workflow-engine/testing/sqlite.mjs +27 -27
- package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
- package/dist/workflow-engine/workflow-trigger-binding-consumer.d.mts +46 -0
- package/dist/workflow-engine/workflow-trigger-binding-consumer.mjs +1 -0
- package/dist/{workflow-transitions-DSc45ixc.mjs → workflow-transitions-DM0fN_eP.mjs} +1 -1
- package/dist/workflow-worker-DARC7UZl.mjs +1 -0
- package/dist/zod-json-schema-BAGAFfCN.mjs +1 -0
- package/package.json +29 -1
- package/dist/adapter-D5c5LrPN.mjs +0 -1
- package/dist/artifact-DGiXqb11.mjs +0 -1
- package/dist/attach-error-C3tngg6J.mjs +0 -1
- package/dist/authority-state-bootstrap-GPL_tqaT.mjs +0 -1
- package/dist/await-trigger-I3lrepb8.mjs +0 -1
- package/dist/bus-B6SAjgOC.mjs +0 -2
- package/dist/bus-C2l3K74u.mjs +0 -1
- package/dist/extension-DCA4pYrY.mjs +0 -1
- package/dist/extension-hjOPs10e.mjs +0 -1
- package/dist/framework-packages-C3RWfJDk.mjs +0 -1
- package/dist/handlers-CfnLyLfE.mjs +0 -57
- package/dist/load-extensions-D0DfjYLC.mjs +0 -1
- package/dist/model-BGgVmRnN.mjs +0 -1
- package/dist/namespace-DJfUADSV.mjs +0 -1
- package/dist/orchestrator-shared-BxmHCPvx.mjs +0 -1
- package/dist/package-CNUPPcU1.mjs +0 -7
- package/dist/package-Dft_RItb.mjs +0 -1
- package/dist/schemas-Cm09dXL4.mjs +0 -1
- package/dist/scoped-bus-C9BdNwfM.mjs +0 -1
- package/dist/session-BOGCd18q.mjs +0 -1
- package/dist/session-BTFiDoGz.mjs +0 -76
- package/dist/shared-BQ0CHIVy.mjs +0 -1
- package/dist/tool-approval-service-kBA0fRzm.mjs +0 -1
- package/dist/types-CJ_QZ1yW.d.mts +0 -1487
- package/dist/workflow-BfDbgtIQ.mjs +0 -1
- package/dist/workflow-worker-BN9XPxQO.mjs +0 -1
- package/dist/{adapter-auth-runtime-DO-FVTXg.mjs → adapter-auth-runtime-D9Lnl7cc.mjs} +0 -0
- package/dist/{adapter-binding-DQchUtrK.d.mts → adapter-binding-B-FBoCys.d.mts} +0 -0
- package/dist/{attempt-record-codec-CqO1_XnE.mjs → attempt-record-codec-DaFLKR5C.mjs} +0 -0
- package/dist/{base-orchestrator-BilsQNW1.d.mts → base-orchestrator-D9u4NyiM.d.mts} +0 -0
- package/dist/{capability-service-BqiLlRGA.mjs → capability-service-CJHNkjvm.mjs} +0 -0
- package/dist/{client-B--e2qcU.d.mts → client-4ihewPUm.d.mts} +0 -0
- package/dist/{client-binary-version-verifier-taewmKTY.mjs → client-binary-version-verifier-DJajc_Ff.mjs} +0 -0
- package/dist/{client-binary-version-verifier-CgjM_vGF.d.mts → client-binary-version-verifier-jDDZ64Ah.d.mts} +0 -0
- package/dist/{clients-namespace-DfxjG2ZP.d.mts → clients-namespace-DFWuUawf.d.mts} +0 -0
- package/dist/{config-namespace-BCqvufbD.d.mts → config-namespace-D1kyZj0B.d.mts} +0 -0
- package/dist/{create-static-mount-bbQhTt6W.mjs → create-static-mount-9tnGpIeK.mjs} +0 -0
- package/dist/{cross-spawn-B57KZuns.mjs → cross-spawn-BIgueAqr.mjs} +0 -0
- package/dist/{cursor-storage-DIFK_9hg.mjs → cursor-storage-ROWfiTh1.mjs} +0 -0
- package/dist/{definition-gnKgXU91.d.mts → definition-DB-kKc0d.d.mts} +0 -0
- package/dist/{definitions-xrrY0wgz.mjs → definitions-CF6YmEhL.mjs} +0 -0
- package/dist/{descriptor-to-package-DvF08krT.mjs → descriptor-to-package-BecVCopf.mjs} +0 -0
- package/dist/{drizzle-z_0SiGY8.mjs → drizzle-CPv3vdTE.mjs} +0 -0
- package/dist/{esm-CltRnX8_.mjs → esm-CBFWM8u_.mjs} +0 -0
- package/dist/{event-CmVjR6Ib.mjs → event-DR8U9Efx.mjs} +0 -0
- package/dist/{facet-BCI00njh.mjs → facet-DVsW12iF.mjs} +0 -0
- package/dist/{filesystem-service-CQ9yVkSz.d.mts → filesystem-service-Cm2RHKBa.d.mts} +0 -0
- package/dist/{handler-Cbv9FqDO.mjs → handler-Bqlk-6BY.mjs} +0 -0
- package/dist/{host-Caq6ZfSJ.mjs → host-k5yoyKHg.mjs} +0 -0
- package/dist/{identity-D6guMtmi.mjs → identity-DC3Pk0ps.mjs} +0 -0
- package/dist/{index-dtsLKOID.d.mts → index-42UdYStR.d.mts} +0 -0
- package/dist/{index-DR40QWlw.d.mts → index-BJAB-BW_.d.mts} +0 -0
- package/dist/{index-Dm1nUxCF.d.mts → index-BJMezANn.d.mts} +0 -0
- package/dist/{index-CnMu8BQl.d.mts → index-BQprJNA_.d.mts} +0 -0
- package/dist/{index-Cv-o5Krs.d.mts → index-BRCrFirq.d.mts} +0 -0
- package/dist/{index-BVRQEpAg.d.mts → index-BRzHs7Bx.d.mts} +6 -6
- /package/dist/{index-DXN_L5D6.d.mts → index-BSbGB23v.d.mts} +0 -0
- /package/dist/{index-vA--0lOM.d.mts → index-BVcQcphK.d.mts} +0 -0
- /package/dist/{index-ye0oklfU.d.mts → index-BcvqDfcN.d.mts} +0 -0
- /package/dist/{index-CGZQVTid.d.mts → index-BeENojSx2.d.mts} +0 -0
- /package/dist/{index-DjgLchuQ.d.mts → index-Beo_Ik8-.d.mts} +0 -0
- /package/dist/{index-sS6KUlrx.d.mts → index-BgGe9WZz.d.mts} +0 -0
- /package/dist/{index-CWHfOz6d.d.mts → index-CK3f0bAL.d.mts} +0 -0
- /package/dist/{index-DZunhZec.d.mts → index-CQuRTeRa.d.mts} +0 -0
- /package/dist/{index-jTaAHsul.d.mts → index-CRmE88hi.d.mts} +0 -0
- /package/dist/{index-CjdRdsd0.d.mts → index-CvW9_SzR.d.mts} +0 -0
- /package/dist/{index-ByKi34v5.d.mts → index-CxSSdIZz.d.mts} +0 -0
- /package/dist/{index-vcSj12YQ.d.mts → index-E4SET1AA.d.mts} +0 -0
- /package/dist/{index-DN4NOCqN2.d.mts → index-Ol9RBB0W2.d.mts} +0 -0
- /package/dist/{index-BIdsFcQs2.d.mts → index-aoxdnhJ42.d.mts} +0 -0
- /package/dist/{index-SsBHjUqA.d.mts → index-nydhGvXa.d.mts} +0 -0
- /package/dist/{jsonl-transport-bQl3JwIu.mjs → jsonl-transport-Bp_6pB2a.mjs} +0 -0
- /package/dist/{lib-DOBXZmYX.mjs → lib-Bwdd2m81.mjs} +0 -0
- /package/dist/{model-registry-CmgcPDH3.mjs → model-registry-Y854mUml.mjs} +0 -0
- /package/dist/{model-registry-xyBKSye-.mjs → model-registry-yURX738J.mjs} +0 -0
- /package/dist/{modes-BheyN7SS.mjs → modes-DmUsjHdV.mjs} +0 -0
- /package/dist/{namespace-HO2J9sO8.mjs → namespace-B9FEGuEu.mjs} +0 -0
- /package/dist/{namespace-jDhZjw-i.d.mts → namespace-Bi3CmYQy.d.mts} +0 -0
- /package/dist/{namespace-GPA7zots.d.mts → namespace-BusZERU8.d.mts} +0 -0
- /package/dist/{namespace-BOkKoq34.d.mts → namespace-ByP1Iipi.d.mts} +0 -0
- /package/dist/{namespace-YytVKIgI.d.mts → namespace-C1D77w7U.d.mts} +0 -0
- /package/dist/{namespace-CErHuXtb.d.mts → namespace-C6CVEGH8.d.mts} +0 -0
- /package/dist/{namespace-C-9si-fV.mjs → namespace-CfIW0hpQ.mjs} +0 -0
- /package/dist/{namespace-YxU1xf-K.mjs → namespace-CkBbNFSU.mjs} +0 -0
- /package/dist/{namespace-DWCEo-9M.d.mts → namespace-DX1Ec15L.d.mts} +0 -0
- /package/dist/{namespace-CWGKCNZm.mjs → namespace-DbNWsPFY.mjs} +0 -0
- /package/dist/{namespace-Cv1RFP7n.d.mts → namespace-Dgg0uoe6.d.mts} +0 -0
- /package/dist/{namespace-tGRAod3o.d.mts → namespace-s2y_NFKf.d.mts} +0 -0
- /package/dist/{namespace-Blp4c8GK.d.mts → namespace-yREpGJgG.d.mts} +0 -0
- /package/dist/{out-CvjtANXN.mjs → out-DrhwCgqM.mjs} +0 -0
- /package/dist/{packages-DtEEP0Vt.mjs → packages-FBv3fAOR.mjs} +0 -0
- /package/dist/{packages-BZ6pzFIq.d.mts → packages-N3-2Kl-Y.d.mts} +0 -0
- /package/dist/{platform-Bv8llU9c.mjs → platform-BrsMv_S3.mjs} +0 -0
- /package/dist/{provider-operation-Cxoe2SUr.d.mts → provider-operation-DJ_TLZFf.d.mts} +0 -0
- /package/dist/{providers-Co5UszRH.mjs → providers-CCcn4Ndp.mjs} +0 -0
- /package/dist/{providers-namespace-DjFkmvBR.d.mts → providers-namespace-DeJBh6MP.d.mts} +0 -0
- /package/dist/{quick-lru-CrOpWwrf.mjs → quick-lru-uwB0hP-y.mjs} +0 -0
- /package/dist/{schema-introspection-DgWQCpwx.mjs → schema-introspection-C1wvklj9.mjs} +0 -0
- /package/dist/{schema-Db-y-09L.mjs → schema-jIapW8Kb.mjs} +0 -0
- /package/dist/{schemas-CR8hSqTy.d.mts → schemas-B7zo7Zcx.d.mts} +0 -0
- /package/dist/{schemas-CqRm0i9a.mjs → schemas-BNdiVBWh.mjs} +0 -0
- /package/dist/{schemas-B1NWNASS.d.mts → schemas-C-Bm6Oac.d.mts} +0 -0
- /package/dist/{schemas-BO7uOum6.d.mts → schemas-CD0wOQxx.d.mts} +0 -0
- /package/dist/{schemas-N6x2z7Lf.d.mts → schemas-CeUI2i5j.d.mts} +0 -0
- /package/dist/{schemas-CwbYk_kZ.d.mts → schemas-Cg-Kwp8c.d.mts} +0 -0
- /package/dist/{schemas-BtZqovRH.d.mts → schemas-Cv3rR9Sz.d.mts} +0 -0
- /package/dist/{schemas-tDf_WiC8.mjs → schemas-CvHFbzdy.mjs} +0 -0
- /package/dist/{schemas-BsVYZviy.d.mts → schemas-DZH9lpxs.d.mts} +0 -0
- /package/dist/{schemas-BGExwp3j.mjs → schemas-DgwEVUt-.mjs} +0 -0
- /package/dist/{schemas-Bfxskx_2.mjs → schemas-mLpOfMoN.mjs} +0 -0
- /package/dist/{schemas-CQyRBqD6.d.mts → schemas-qA279_j_.d.mts} +0 -0
- /package/dist/{schemas-miYxK_Z1.d.mts → schemas-sMoRnBdZ.d.mts} +0 -0
- /package/dist/{semver-DlM8znk4.mjs → semver-DTXuyLcK.mjs} +0 -0
- /package/dist/{server-lifecycle-Dsq56aqC.d.mts → server-lifecycle-C_8iKgat.d.mts} +0 -0
- /package/dist/{server-lifecycle-kmQ5PUDv.mjs → server-lifecycle-DKx_fWlq.mjs} +0 -0
- /package/dist/{shared-schemas-DXwyMCwZ.mjs → shared-schemas-aahW97QW.mjs} +0 -0
- /package/dist/{src-CCu8TwL6.mjs → src-DHqsl5Pg.mjs} +0 -0
- /package/dist/{storage-namespace-BSrv0vXR.mjs → storage-namespace-Dz2jsssp.mjs} +0 -0
- /package/dist/{storage-namespace-dfywhXR3.d.mts → storage-namespace-Tf3P5yJ5.d.mts} +0 -0
- /package/dist/{storage-namespace-definition-BvlX0QV_.d.mts → storage-namespace-definition-BsnYAPot.d.mts} +0 -0
- /package/dist/{storage-namespace-definition-CkMKt7-I.mjs → storage-namespace-definition-CDef0E20.mjs} +0 -0
- /package/dist/{supports-color-DUugCQsK.mjs → supports-color-i7OTnKcZ.mjs} +0 -0
- /package/dist/{telemetry-Pr3oP2rk.mjs → telemetry-BvCBUjFg.mjs} +0 -0
- /package/dist/{timeout-DWDhddRJ.mjs → timeout-B0nYjLc8.mjs} +0 -0
- /package/dist/{tray-menu-service-BBLa-Rcv.mjs → tray-menu-service-Deo6yyP8.mjs} +0 -0
- /package/dist/{types-BrcjaNPZ.d.mts → types-CNS55jvt.d.mts} +0 -0
- /package/dist/{types-b54n1o57.d.mts → types-Ce6LL25v.d.mts} +0 -0
- /package/dist/{ui-config-CyCdlns_.mjs → ui-config-BIyGzMNL.mjs} +0 -0
- /package/dist/{variant-krjlTdJt.mjs → variant-B4uWdxW7.mjs} +0 -0
- /package/dist/{window-registry-BDnZLPVx.d.mts → window-registry-BLtVx3Iw.d.mts} +0 -0
- /package/dist/{window-registry-I-imZHV_.mjs → window-registry-CoBJq3u4.mjs} +0 -0
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as PipelineStep, o as SessionEditorAction, t as ActionCategory } from "./types-D7_kevBK.mjs";
|
|
1
|
+
import { C as Turn$1, g as OwnedAdapterInstance, h as MachineScopedAdapterInstance } from "./index-DI7-tIL3.mjs";
|
|
2
|
+
import { a as PipelineStep, o as SessionEditorAction, t as ActionCategory } from "./types-xCdGghb2.mjs";
|
|
4
3
|
import { z } from "zod";
|
|
5
4
|
import * as _$_makaio_core0 from "@makaio/framework/core";
|
|
6
5
|
import { ExtractSubjectPayload, SubjectDefinition } from "@makaio/framework/core";
|
|
7
6
|
import { IMakaioBus } from "@makaio/framework/bus";
|
|
8
7
|
import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
|
|
9
|
-
import { AIReasoningLevel, AdapterRuntimeOptions, BranchKind, ContextWindowState, ForkOptions, ForkTransforms, ICapabilityProvider, IMakaioSession, JsonValue, MakaioSessionAgent, MakaioSessionEvent, Message, MessageBlock, MessageInput, NativeLocalityVerdict,
|
|
8
|
+
import { AIReasoningLevel, AdapterRuntimeOptions, AdapterSelection, AdapterSessionClaimRecord, AgentRole, BranchKind, ContextWindowState, ForkOptions, ForkTransforms, ICapabilityProvider, IMakaioSession, JsonValue, MakaioSessionAgent, MakaioSessionEvent, Message, MessageBlock, MessageInput, NativeLocalityVerdict, OwnershipTopology, ResolvedProviderContext, SessionContext, SessionEventType, SessionExtensionContext, SessionLineage, SessionLineageKind, SessionMessage, SessionMessageBlock, SessionMessageOrigin, SessionOwnershipReclaimReason, SessionOwnershipReserveStartServiceResult, SessionSubjects, TurnIngestionMarker, TurnInitiator, TurnUsage } from "@makaio/framework/contracts";
|
|
10
9
|
import { BaseService } from "@makaio/framework/service-base";
|
|
11
10
|
import * as _$drizzle_orm_sqlite_core0 from "drizzle-orm/sqlite-core";
|
|
12
11
|
import * as _$drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
|
|
@@ -16,6 +15,32 @@ import * as _$drizzle_orm0 from "drizzle-orm";
|
|
|
16
15
|
import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
|
|
17
16
|
|
|
18
17
|
//#region services/core/src/session/session-service.d.ts
|
|
18
|
+
/**
|
|
19
|
+
* Host-supplied composition of the session service.
|
|
20
|
+
*
|
|
21
|
+
* Everything here belongs to the ownership authority, which is the one part of
|
|
22
|
+
* this service that cannot work from the bus alone: it has to know which
|
|
23
|
+
* machine it owns claims under, and how many runtimes may own claims there.
|
|
24
|
+
*/
|
|
25
|
+
interface MakaioSessionServiceOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Machine identity the ownership authority owns claims under.
|
|
28
|
+
*
|
|
29
|
+
* Injected by the composition root — the ownership key is (machine, adapter
|
|
30
|
+
* instance, provider session), and an authority that resolved its own machine
|
|
31
|
+
* identity through the bus would make every ownership decision depend on
|
|
32
|
+
* adapter-runtime boot order. Omitted, every identity-dependent ownership
|
|
33
|
+
* operation answers `machine-identity-unavailable` and writes nothing, which
|
|
34
|
+
* is the correct behavior for a host that has no machine identity to offer.
|
|
35
|
+
*/
|
|
36
|
+
machineId?: string;
|
|
37
|
+
/**
|
|
38
|
+
* How many runtime processes may own claims on this machine. Defaults to
|
|
39
|
+
* `'shared-machine'`; a host claims `'machine-exclusive'` only when it can
|
|
40
|
+
* prove no peer process hosts adapters on the same machine.
|
|
41
|
+
*/
|
|
42
|
+
topology?: OwnershipTopology;
|
|
43
|
+
}
|
|
19
44
|
/**
|
|
20
45
|
* Framework-core session service for managing makaio sessions.
|
|
21
46
|
*
|
|
@@ -24,6 +49,12 @@ import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
|
|
|
24
49
|
* `session.turn.await`, `session.restartAgents`, `session.agent.added`, and
|
|
25
50
|
* `session.agent.removed`.
|
|
26
51
|
*
|
|
52
|
+
* It is also the **session-ownership authority**: the `session.ownership.*`
|
|
53
|
+
* operations, each of which is one durable ownership act, and the movement
|
|
54
|
+
* observer that settles every announced provider-session movement through them.
|
|
55
|
+
* That authority needs a machine identity, which the composition root injects
|
|
56
|
+
* (see {@link MakaioSessionServiceOptions}).
|
|
57
|
+
*
|
|
27
58
|
* Host-specific handlers (search, update, resume, archive, purge, analytics,
|
|
28
59
|
* context window, branching) are registered by the host session service which
|
|
29
60
|
* depends on this service.
|
|
@@ -61,11 +92,15 @@ import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
|
|
|
61
92
|
* ```
|
|
62
93
|
*/
|
|
63
94
|
declare class MakaioSessionService extends BaseService {
|
|
95
|
+
private readonly options;
|
|
64
96
|
/**
|
|
65
97
|
* Creates a new MakaioSessionService instance.
|
|
66
98
|
* @param bus - The event bus for inter-service communication
|
|
99
|
+
* @param options - Composition of the ownership authority; omitted entirely,
|
|
100
|
+
* the service still serves every non-ownership subject and declines the
|
|
101
|
+
* identity-dependent ownership ones.
|
|
67
102
|
*/
|
|
68
|
-
constructor(bus?: IMakaioBus);
|
|
103
|
+
constructor(bus?: IMakaioBus, options?: MakaioSessionServiceOptions);
|
|
69
104
|
/**
|
|
70
105
|
* Initialize the service.
|
|
71
106
|
*
|
|
@@ -80,6 +115,24 @@ declare class MakaioSessionService extends BaseService {
|
|
|
80
115
|
* that do not register turn storage).
|
|
81
116
|
*/
|
|
82
117
|
protected onInit(): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Arm the ownership reconcile behind the post-coordinator barrier.
|
|
120
|
+
*
|
|
121
|
+
* Deliberately **not** run from `onInit`. This service starts inside the
|
|
122
|
+
* extension coordinator, and adapter instances register after it — so a
|
|
123
|
+
* reconcile here would probe adapters that do not exist yet and report every
|
|
124
|
+
* live claim's instance as gone. `kernel.phase.coordinatorReady` is broadcast
|
|
125
|
+
* once the coordinator has started everything, which is the first instant at
|
|
126
|
+
* which the probe means what it says.
|
|
127
|
+
*
|
|
128
|
+
* A host that never broadcasts the phase never reconciles: there is no timer
|
|
129
|
+
* and no fallback, because a reconcile at an unknown point in boot is exactly
|
|
130
|
+
* the thing this barrier exists to prevent. Failures are logged and swallowed
|
|
131
|
+
* for the same reason orphaned-turn reconciliation is — diagnostics must
|
|
132
|
+
* never keep a session service from starting.
|
|
133
|
+
* @returns Cleanup that unsubscribes the barrier if it never fires.
|
|
134
|
+
*/
|
|
135
|
+
private scheduleOwnershipReconcile;
|
|
83
136
|
/**
|
|
84
137
|
* Close any turns left `active` from a prior process crash.
|
|
85
138
|
*
|
|
@@ -94,6 +147,264 @@ declare class MakaioSessionService extends BaseService {
|
|
|
94
147
|
private reconcileOrphanedTurns;
|
|
95
148
|
}
|
|
96
149
|
//#endregion
|
|
150
|
+
//#region services/core/src/session/ownership/context.d.ts
|
|
151
|
+
/**
|
|
152
|
+
* What the ownership authority was composed with.
|
|
153
|
+
*
|
|
154
|
+
* The machine identity is **injected, not resolved through the bus**. Resolving
|
|
155
|
+
* it per call would make every ownership decision depend on whether the adapter
|
|
156
|
+
* runtime happened to have registered its identity handler yet — a boot-order
|
|
157
|
+
* dependency the authority cannot observe and callers cannot reason about.
|
|
158
|
+
* Composed with `undefined`, the authority declines every identity-dependent
|
|
159
|
+
* operation instead of deciding under a guess.
|
|
160
|
+
*/
|
|
161
|
+
interface OwnershipAuthorityContext {
|
|
162
|
+
/** Bus the authority reads and writes storage through. */
|
|
163
|
+
readonly bus: IMakaioBus;
|
|
164
|
+
/** Machine identity the authority owns claims under, or `undefined` when it has none. */
|
|
165
|
+
readonly machineId: string | undefined;
|
|
166
|
+
/** {@inheritDoc OwnershipTopologySchema} */
|
|
167
|
+
readonly topology: OwnershipTopology;
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region services/core/src/session/ownership/authority.d.ts
|
|
171
|
+
/**
|
|
172
|
+
* What the session-ownership authority is composed with.
|
|
173
|
+
*
|
|
174
|
+
* The same shape the operations receive, deliberately: what a caller composes
|
|
175
|
+
* the authority with *is* what every operation decides under, so there is no
|
|
176
|
+
* second declaration for the two to drift apart in.
|
|
177
|
+
*/
|
|
178
|
+
type SessionOwnershipAuthorityDeps = OwnershipAuthorityContext;
|
|
179
|
+
/**
|
|
180
|
+
* Register the session-ownership authority.
|
|
181
|
+
*
|
|
182
|
+
* These five subjects are the service surface of the ownership aggregate, and
|
|
183
|
+
* each one is exactly one durable ownership act. That is the point: composed by
|
|
184
|
+
* a caller out of storage RPCs, a reservation or a movement is three
|
|
185
|
+
* transactions with windows in which a crash strands an ownership key or
|
|
186
|
+
* publishes a currency no generation owns.
|
|
187
|
+
* @param context - Bus, machine identity and topology to compose the authority with.
|
|
188
|
+
* @returns Cleanup function unregistering every handler.
|
|
189
|
+
*/
|
|
190
|
+
declare function registerSessionOwnershipAuthority(context: SessionOwnershipAuthorityDeps): () => void;
|
|
191
|
+
//#endregion
|
|
192
|
+
//#region services/core/src/session/ownership/movement-observer.d.ts
|
|
193
|
+
/**
|
|
194
|
+
* Registers the provider-session movement observer.
|
|
195
|
+
*
|
|
196
|
+
* `agent.adapterSession.moved` is an **observation**, not a write. The seam
|
|
197
|
+
* reports where an agent's provider conversation went; what that implies for
|
|
198
|
+
* durable currency — which generation may record it, whether it supersedes
|
|
199
|
+
* anything, whether the session snapshot follows — is the ownership authority's
|
|
200
|
+
* to decide, inside one transaction. This handler's whole job is to turn the
|
|
201
|
+
* announcement into a settle request and to order the settles of one agent.
|
|
202
|
+
*
|
|
203
|
+
* **No lead guard.** A member's movement is now recorded on its own agent row,
|
|
204
|
+
* and the mirror onto the session row is gated inside the settle by the stored
|
|
205
|
+
* designation. The old handler had to drop a member's movement because the only
|
|
206
|
+
* row it could write was the session's; it also had to drop every movement
|
|
207
|
+
* announced during a start, because the designation did not exist yet. Both
|
|
208
|
+
* windows close here: the agent row always exists, and the reservation
|
|
209
|
+
* designates before the first dispatch.
|
|
210
|
+
*
|
|
211
|
+
* **No change guard.** Storage answers `idempotent` for a target that is
|
|
212
|
+
* already settled, which is a decision made against the stored row rather than
|
|
213
|
+
* against a snapshot this handler read a moment earlier.
|
|
214
|
+
*
|
|
215
|
+
* **The announcement is acknowledged, not absorbed.** `bus.emit` resolves when
|
|
216
|
+
* its handlers do, and the producer's seam contract reads that resolution as
|
|
217
|
+
* "the currency write already happened" — it is what lets a producer order the
|
|
218
|
+
* dispatch that abandons the old provider session behind the write, and what
|
|
219
|
+
* lets it hold an undelivered movement for re-announcement. So this handler
|
|
220
|
+
* waits for its queued settlement and answers honestly: it resolves only when
|
|
221
|
+
* the authority actually recorded the movement, and rejects with a
|
|
222
|
+
* {@link MovementNotSettledError} otherwise. Resolving on a refusal would let
|
|
223
|
+
* the producer retire a movement no row carries.
|
|
224
|
+
*
|
|
225
|
+
* Rejecting is the seam's negative acknowledgment, not an escaping failure: the
|
|
226
|
+
* one modeled error is what the producer catches and turns into `false`, and no
|
|
227
|
+
* other error leaves this handler unclassified.
|
|
228
|
+
* @param bus - Message bus used by the session service.
|
|
229
|
+
* @returns Cleanup function.
|
|
230
|
+
*/
|
|
231
|
+
declare function registerAdapterSessionMovementObserver(bus: IMakaioBus): () => void;
|
|
232
|
+
//#endregion
|
|
233
|
+
//#region services/core/src/session/ownership/in-flight-starts.d.ts
|
|
234
|
+
/**
|
|
235
|
+
* What an attempt tells a joiner about the agent it was driving.
|
|
236
|
+
*
|
|
237
|
+
* One bit, because one bit is what every attempt can state honestly and what
|
|
238
|
+
* every joiner actually needs. The three attempts this seam carries — a fresh
|
|
239
|
+
* lead start, an attach, a reserved rehydrate — end in outcomes of three
|
|
240
|
+
* different shapes, and none of them is meaningful to a joiner that ran none of
|
|
241
|
+
* that work under none of those inputs. "Is there a connector for this agent
|
|
242
|
+
* now" is meaningful to all of them.
|
|
243
|
+
*/
|
|
244
|
+
type StartAttemptOutcome = /** A connector for this agent is live, as far as this attempt got. */'connected'
|
|
245
|
+
/**
|
|
246
|
+
* The attempt ended without building one, and said so rather than throwing.
|
|
247
|
+
*
|
|
248
|
+
* The modeled non-successes: a recovery that deferred or was refused, a start
|
|
249
|
+
* that lost its designation race. They are *resolutions*, so a joiner watching
|
|
250
|
+
* only for a rejection cannot see them.
|
|
251
|
+
*/
|
|
252
|
+
| 'no-connector';
|
|
253
|
+
/**
|
|
254
|
+
* One agent's start attempt, as a joinable handle.
|
|
255
|
+
*
|
|
256
|
+
* `settled` resolves — or rejects — when the attempt is completely over,
|
|
257
|
+
* including every failure-cleanup step, and it carries **the attempt's own
|
|
258
|
+
* verdict**. That is what a joiner reads.
|
|
259
|
+
*
|
|
260
|
+
* It did not always: joiners used to await the promise for its timing alone and
|
|
261
|
+
* then re-read the agent row. The row cannot answer the question. Where an
|
|
262
|
+
* attempt *writes* it the row is authoritative about the row — a fresh start's
|
|
263
|
+
* pre-dispatch failure deletes it, so mapping the rejection onto "dead" would
|
|
264
|
+
* contradict the deleted-row rule for one event — but the row was never a proxy
|
|
265
|
+
* for "a connector exists", and every place that treated it as one was one
|
|
266
|
+
* interleaving away from being wrong. A recovery that rolls its claim back to
|
|
267
|
+
* the `idle` it found leaves a row that reads *usable* behind an attempt that
|
|
268
|
+
* built nothing; an `idle` row whose connector died is exactly what the liveness
|
|
269
|
+
* probe exists to catch.
|
|
270
|
+
*
|
|
271
|
+
* So the division is: the attempt's verdict says whether a connector exists, and
|
|
272
|
+
* the row says what state the agent identity is in. A joiner needs both, and
|
|
273
|
+
* infers neither from the other. Where there is no entry to join — another
|
|
274
|
+
* process, or one that died — there is no verdict to read, and the status
|
|
275
|
+
* compare-and-swap arbitrates instead.
|
|
276
|
+
*/
|
|
277
|
+
interface InFlightStart {
|
|
278
|
+
/** Settles when the attempt is over, carrying what it left behind. */
|
|
279
|
+
readonly settled: Promise<StartAttemptOutcome>;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* One call's view of {@link runExclusiveStart}.
|
|
283
|
+
*
|
|
284
|
+
* The flag is what makes the seam usable by a caller that has durable work of
|
|
285
|
+
* its own to do around the dispatch. A joiner ran none of that work — the
|
|
286
|
+
* attempt it joined did, under *its* inputs — so a joiner that went on to
|
|
287
|
+
* persist its own adapter identity, or to settle the provider session *it*
|
|
288
|
+
* planned to resume, would overwrite the identity the running attempt actually
|
|
289
|
+
* established.
|
|
290
|
+
*
|
|
291
|
+
* What a joiner consumes instead is the attempt's own verdict — see
|
|
292
|
+
* {@link InFlightStart.settled} — together with the durable agent row, which
|
|
293
|
+
* says what state the identity is in but never whether a connector exists.
|
|
294
|
+
*/
|
|
295
|
+
interface ExclusiveStart extends InFlightStart {
|
|
296
|
+
/**
|
|
297
|
+
* `true` when this call joined an attempt that was already running, and
|
|
298
|
+
* therefore ran no callback of its own.
|
|
299
|
+
*/
|
|
300
|
+
readonly joined: boolean;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Register a start attempt for an agent and run it, so a concurrent consumer
|
|
304
|
+
* joins the attempt instead of racing it.
|
|
305
|
+
*
|
|
306
|
+
* The entry is published **before** `attempt` runs, and therefore before the
|
|
307
|
+
* attempt's first durable write. That ordering is the whole point: there is no
|
|
308
|
+
* instant at which a `starting` agent row is visible without its entry, so a
|
|
309
|
+
* joiner never has to guess whether an attempt is in progress here.
|
|
310
|
+
*
|
|
311
|
+
* Re-entering for an agent that already has an entry returns the existing one
|
|
312
|
+
* and does **not** run `attempt` — two lifecycle attempts for one agent
|
|
313
|
+
* identity are exactly what this seam exists to prevent. The returned handle
|
|
314
|
+
* says which of the two happened, because a caller whose `attempt` carries
|
|
315
|
+
* durable work must not repeat that work against inputs the running attempt
|
|
316
|
+
* never used (see {@link ExclusiveStart.joined}).
|
|
317
|
+
* @param agentId - Agent identity the attempt belongs to; the seam's key.
|
|
318
|
+
* @param attempt - The complete attempt, answering whether it left a connector
|
|
319
|
+
* behind, including its reservation, its
|
|
320
|
+
* persistence, its settlement and its failure cleanup. Nothing that can leave
|
|
321
|
+
* durable state behind may run outside it: a joiner runs none of it, and what
|
|
322
|
+
* sits outside would then run twice, once against the wrong inputs.
|
|
323
|
+
* @returns This call's handle — the attempt it registered, or the one it joined.
|
|
324
|
+
*/
|
|
325
|
+
declare function runExclusiveStart(agentId: string, attempt: () => Promise<StartAttemptOutcome>): ExclusiveStart;
|
|
326
|
+
/**
|
|
327
|
+
* Look up an in-flight start without creating one.
|
|
328
|
+
*
|
|
329
|
+
* A consumer that finds an entry joins it. Finding none means the attempt
|
|
330
|
+
* belongs to a process that is gone, or to a live peer — neither of which this
|
|
331
|
+
* registry can see, so the caller arbitrates through the agent row's status
|
|
332
|
+
* compare-and-swap instead.
|
|
333
|
+
* @param agentId - Agent identity to look up.
|
|
334
|
+
* @returns The entry, or `undefined` when this process is not driving a start.
|
|
335
|
+
*/
|
|
336
|
+
declare function peekInFlightStart(agentId: string): InFlightStart | undefined;
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region services/core/src/session/ownership/settle-queue.d.ts
|
|
339
|
+
/**
|
|
340
|
+
* Serialize one agent's movement settlements, in receipt order.
|
|
341
|
+
*
|
|
342
|
+
* `bus.emit` runs handlers concurrently across independent producer chains —
|
|
343
|
+
* payload enrichment, connector-swap completion and turn-dispatch rotation all
|
|
344
|
+
* announce without a shared lock — so two movements for one agent otherwise
|
|
345
|
+
* interleave between the authority's revision read and its transaction, and
|
|
346
|
+
* both burn their single `currency-changed` retry against each other. Chaining
|
|
347
|
+
* per agent makes settle order equal receipt order, which is the strongest
|
|
348
|
+
* ordering an observation seam can offer: it does not claim producer order,
|
|
349
|
+
* only that what this process received first is settled first.
|
|
350
|
+
*
|
|
351
|
+
* The chain is keyed per agent rather than globally because two agents' currency
|
|
352
|
+
* rows share nothing — a global queue would serialize independent work and turn
|
|
353
|
+
* one slow settle into everyone's latency.
|
|
354
|
+
* @param agentId - Agent whose settles are being ordered.
|
|
355
|
+
* @param settle - The settle to run once every settle received earlier for this
|
|
356
|
+
* agent has finished.
|
|
357
|
+
* @returns A promise for this settle's own completion. It rejects if `settle`
|
|
358
|
+
* rejects; the chain itself absorbs the failure so queued successors still run.
|
|
359
|
+
*/
|
|
360
|
+
declare function enqueueAgentSettle(agentId: string, settle: () => Promise<void>): Promise<void>;
|
|
361
|
+
//#endregion
|
|
362
|
+
//#region services/core/src/session/ownership/claim-token.d.ts
|
|
363
|
+
/**
|
|
364
|
+
* Mint the identity of one claim generation.
|
|
365
|
+
*
|
|
366
|
+
* The single way a generation identity comes into existence, whether the
|
|
367
|
+
* authority mints it or a caller mints one to name its own settlement with.
|
|
368
|
+
* Re-using a token whose generation is *retired* is a caller bug storage cannot
|
|
369
|
+
* defend against: retired generations are not remembered, so a released token
|
|
370
|
+
* is storable again and how it interacts with later generations is undefined.
|
|
371
|
+
* Re-offering an *unused* token — what the settle retry does — is not that: a
|
|
372
|
+
* rolled-back attempt left no row behind for it to collide with.
|
|
373
|
+
* @returns An opaque, single-use claim token.
|
|
374
|
+
*/
|
|
375
|
+
declare function mintClaimToken(): string;
|
|
376
|
+
//#endregion
|
|
377
|
+
//#region services/core/src/session/ownership/owner-liveness.d.ts
|
|
378
|
+
/**
|
|
379
|
+
* Judge whether a claim's owner is gone — **for diagnostics only**.
|
|
380
|
+
*
|
|
381
|
+
* Reconcile is this function's sole caller, and the verdict it produces
|
|
382
|
+
* authorizes nothing: a takeover is a predicate evaluated inside the taking
|
|
383
|
+
* transaction, over the incumbent's own agent row, and it never consults a
|
|
384
|
+
* probe or a filed verdict. Keeping the assessment out of the authorization
|
|
385
|
+
* path is what makes the authorization impossible to base on evidence that is
|
|
386
|
+
* stale, replayed, or contradicted by a concurrent writer.
|
|
387
|
+
*
|
|
388
|
+
* Reasons are tested in order of how provable they are, and the first that
|
|
389
|
+
* holds is reported:
|
|
390
|
+
*
|
|
391
|
+
* - `agent-gone` — the agent row is absent. Rare, because both claim foreign
|
|
392
|
+
* keys cascade and normally remove the claim with its parent; kept because a
|
|
393
|
+
* diagnostic must report what it observes, and a probe can straddle a delete.
|
|
394
|
+
* - `agent-disposed` — the agent was removed. A disposed agent can never
|
|
395
|
+
* legitimately hold a key.
|
|
396
|
+
* - `adapter-instance-gone` — no adapter answers for the claim's instance.
|
|
397
|
+
* Admitted **only** under `machine-exclusive`: where peers may host adapters
|
|
398
|
+
* on the same machine, an unanswered probe means "not this runtime's", never
|
|
399
|
+
* "nobody's".
|
|
400
|
+
* @param bus - Bus used for the agent read and the adapter probe.
|
|
401
|
+
* @param topology - How many runtime processes may own claims on this machine;
|
|
402
|
+
* the one input that decides whether the adapter probe is evidence at all.
|
|
403
|
+
* @param claim - The claim whose owner is being assessed.
|
|
404
|
+
* @returns The first reason that holds, or `null` when the owner looks alive.
|
|
405
|
+
*/
|
|
406
|
+
declare function assessClaimOwner(bus: IMakaioBus, topology: OwnershipTopology, claim: AdapterSessionClaimRecord): Promise<SessionOwnershipReclaimReason | null>;
|
|
407
|
+
//#endregion
|
|
97
408
|
//#region services/core/src/session/session-service-handlers-core.d.ts
|
|
98
409
|
/**
|
|
99
410
|
* Dependencies required to register the framework-core session service handlers.
|
|
@@ -105,13 +416,28 @@ declare class MakaioSessionService extends BaseService {
|
|
|
105
416
|
interface CoreSessionServiceHandlerDeps {
|
|
106
417
|
/** The event bus used for handler registration and storage dispatch. */
|
|
107
418
|
bus: IMakaioBus;
|
|
419
|
+
/**
|
|
420
|
+
* Machine identity the ownership authority owns claims under.
|
|
421
|
+
*
|
|
422
|
+
* Injected by the composition root, never resolved through the bus: an
|
|
423
|
+
* ownership decision must not depend on whether the adapter runtime's
|
|
424
|
+
* identity handler happened to register first. Absent, every
|
|
425
|
+
* identity-dependent ownership operation declines instead of guessing.
|
|
426
|
+
*/
|
|
427
|
+
machineId?: string;
|
|
428
|
+
/**
|
|
429
|
+
* How many runtime processes may own claims on this machine. Defaults to
|
|
430
|
+
* `'shared-machine'` — the reading no host can be wrong about.
|
|
431
|
+
*/
|
|
432
|
+
topology?: OwnershipTopology;
|
|
108
433
|
}
|
|
109
434
|
/**
|
|
110
435
|
* Registers the framework-core session service handlers:
|
|
111
436
|
* `session.create`, `session.get`, `session.list`, `session.turn.await`,
|
|
112
437
|
* `session.close`, `session.restartAgents`, `session.update`,
|
|
113
438
|
* `session.archive`, `session.purge`,
|
|
114
|
-
* `session.agent.added`,
|
|
439
|
+
* `session.agent.added`, `session.agent.removed`, and the five
|
|
440
|
+
* `session.ownership.*` operations of the ownership authority.
|
|
115
441
|
*
|
|
116
442
|
* These handlers cover the minimal, load-bearing session contract for the
|
|
117
443
|
* framework SDK. Host-specific handlers (search, resume, analytics, context
|
|
@@ -120,7 +446,7 @@ interface CoreSessionServiceHandlerDeps {
|
|
|
120
446
|
* Persistence degrades gracefully when no storage handlers are registered:
|
|
121
447
|
* `session.get` / `session.list` / `session.close` all delegate to
|
|
122
448
|
* `SessionStorageSubjects.*` which may be unhandled in ephemeral mode.
|
|
123
|
-
* @param deps - Bus
|
|
449
|
+
* @param deps - Bus, plus the identity the ownership authority is composed with
|
|
124
450
|
* @returns Array of cleanup callbacks, one per registered handler
|
|
125
451
|
*/
|
|
126
452
|
declare function registerCoreSessionServiceHandlers(deps: CoreSessionServiceHandlerDeps): Array<() => void>;
|
|
@@ -148,16 +474,22 @@ interface ISessionOrchestrator {
|
|
|
148
474
|
*
|
|
149
475
|
* Registers the core session orchestration handlers:
|
|
150
476
|
* 1. Get or create session (via `getOrCreateSession`)
|
|
151
|
-
* 2.
|
|
477
|
+
* 2. Resolve any start the session has in flight (via `resolveInFlightStarts`),
|
|
478
|
+
* before anything probes an agent or concludes the session has none
|
|
479
|
+
* 2b. Refuse a send that stated targets (named ids or `'all'`) against a session
|
|
480
|
+
* that has none — before the start below, so a refused send leaves no agent
|
|
481
|
+
* and no reservation; only the default send may bootstrap a session
|
|
482
|
+
* 3. Start the lead agent if the session has no agents — resolves the canonical
|
|
152
483
|
* `adapterName` from direct selections, uses `adapterId` directly when
|
|
153
|
-
* provided, otherwise resolves it via `AdapterRegistry`, resolves
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* 4.
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
* 6.
|
|
160
|
-
*
|
|
484
|
+
* provided, otherwise resolves it via `AdapterRegistry`, resolves provider
|
|
485
|
+
* credentials when selected, then runs the reserved start (via
|
|
486
|
+
* `startLeadAgent`)
|
|
487
|
+
* 4. Resolve target agents (via `resolveTargetAgents`)
|
|
488
|
+
* 5. Verify agent liveness and recover dead agents under one recovery plan
|
|
489
|
+
* (requestOptional `AdapterSubjects.getAgent` + `buildPlannedRecoveryContext`)
|
|
490
|
+
* 6. Get or create turn (via `SessionTurnManager`), generate the message ID and
|
|
491
|
+
* store the user message (awaited, persist-before-route) + routing records
|
|
492
|
+
* (fire-and-forget)
|
|
161
493
|
* 7. Emit `session.turn.started` + `session.user_message.sent`
|
|
162
494
|
* 8. Route to agents (via `routeToAgentsCore`, single shared context)
|
|
163
495
|
* 9. Return result with `messageId`, `turnId`, `sessionId`
|
|
@@ -197,17 +529,98 @@ declare class SessionOrchestrator implements ISessionOrchestrator {
|
|
|
197
529
|
*
|
|
198
530
|
* Core flow:
|
|
199
531
|
* 1. Get or create session
|
|
200
|
-
* 2.
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
532
|
+
* 2. Join or arbitrate every start the session has in flight
|
|
533
|
+
* 2b. Refuse a target-stating send (named ids or `'all'`) against a session
|
|
534
|
+
* with no agents, before the bootstrap can leave state behind a send that
|
|
535
|
+
* cannot deliver
|
|
536
|
+
* 3. Start the lead agent if the session has no agents (canonicalize direct
|
|
537
|
+
* selections, resolve adapterId, resolve provider credentials, reserved start)
|
|
538
|
+
* 4. Resolve target agents
|
|
539
|
+
* 5. Verify agent liveness and recover dead agents under one recovery plan
|
|
540
|
+
* 6. Get or create turn (via SessionTurnManager), generate the message ID and
|
|
541
|
+
* store the user message (awaited) + routing records (fire-and-forget)
|
|
206
542
|
* 7. Emit turn.started + user_message.sent
|
|
207
543
|
* 8. Route to agents (routeToAgentsCore, single shared context)
|
|
208
544
|
* 9. Return result with messageId, turnId, sessionId
|
|
209
545
|
*/
|
|
210
546
|
private registerSendMessageHandler;
|
|
547
|
+
/**
|
|
548
|
+
* Probe this send's targets and recover the ones that are gone.
|
|
549
|
+
*
|
|
550
|
+
* **An agent whose in-flight start this send consumed *locally* needs no
|
|
551
|
+
* probe; one it merely out-raced does.** The distinction is the evidence
|
|
552
|
+
* behind the verdict. A locally joined attempt reported what it built, and
|
|
553
|
+
* this process ran it. A won compare-and-swap reports only that this caller
|
|
554
|
+
* wrote a status first: the attempt it outran belongs to a process this
|
|
555
|
+
* runtime cannot see, and writing `dead` does not make the agent dead. Wave 3
|
|
556
|
+
* cannot ask whether that process is alive (OQ-B, Wave 4) — but it can ask
|
|
557
|
+
* whether a *connector* answers, which is what the probe already does for
|
|
558
|
+
* every other target and the only instrument here that carries evidence
|
|
559
|
+
* across processes. Skipping it there was the send believing its own status
|
|
560
|
+
* write, and it is what let a second lifecycle open beside a live one.
|
|
561
|
+
*
|
|
562
|
+
* The framework orchestrator evaluates no locality, so it can make only one
|
|
563
|
+
* honest recovery decision: the replacement connector starts fresh and the
|
|
564
|
+
* stored conversation is injected. Holding it as a plan keeps the history
|
|
565
|
+
* assembly and the rehydrate reading one decision — a host that later resumes
|
|
566
|
+
* natively here changes that value alone and both sides follow.
|
|
567
|
+
*
|
|
568
|
+
* Each recovery is reserved and runs inside the in-flight-start seam, which
|
|
569
|
+
* the entry-point inventory requires of every service-owned path that can
|
|
570
|
+
* reach a lifecycle call for an *existing* agent identity: two concurrent
|
|
571
|
+
* sends onto one dead agent would otherwise dispatch two rehydrates, and the
|
|
572
|
+
* second would race the first's connector.
|
|
573
|
+
* @param session - Session being sent to.
|
|
574
|
+
* @param targetAgents - Targets this send materialised.
|
|
575
|
+
* @param recovering - Agents whose in-flight start this send already claimed.
|
|
576
|
+
* @param arbitrated - Of those, the ones claimed by compare-and-swap against another process.
|
|
577
|
+
* @returns The injected history, when any agent needed it, and the agents this runtime may not drive.
|
|
578
|
+
*/
|
|
579
|
+
private recoverDeadTargets;
|
|
580
|
+
/**
|
|
581
|
+
* Re-resolve a send's targets around agents this runtime may not drive.
|
|
582
|
+
*
|
|
583
|
+
* The three send forms degrade differently, and the difference is deliberate:
|
|
584
|
+
*
|
|
585
|
+
* - **lead-default** — a deferred lead is always *total*, because target
|
|
586
|
+
* resolution raises for a session whose named lead it cannot resolve, so
|
|
587
|
+
* there is no state in which the default send proceeds with "the other
|
|
588
|
+
* usable agents". The session re-enters the fresh-start branch and gains a
|
|
589
|
+
* **new** lead agent, which the stored conversation is injected into. That
|
|
590
|
+
* is what fresh-with-history means once the old agent is owned elsewhere: a
|
|
591
|
+
* fresh *agent*, not a second connector bolted onto one this runtime does
|
|
592
|
+
* not own.
|
|
593
|
+
* - **`'all'`** — deliver to the usable ones; a broadcast with no recipient
|
|
594
|
+
* is not a delivery and fails.
|
|
595
|
+
* - **an explicit array** — deliver to the usable ones; a caller that named
|
|
596
|
+
* its agents gets a failure rather than a substitute, because substituting
|
|
597
|
+
* would answer a question nobody asked.
|
|
598
|
+
* @param context - The send's identity, target spec and start inputs.
|
|
599
|
+
* @param targetAgents - Targets as this send materialised them.
|
|
600
|
+
* @param deferredAgentIds - Agents held by a generation this runtime does not own.
|
|
601
|
+
* @returns The surviving targets, and what a replacement start left for the caller to finish.
|
|
602
|
+
* @throws A {@link SessionStartError} when every target deferred and no fresh start applies.
|
|
603
|
+
*/
|
|
604
|
+
private retargetAfterDeferral;
|
|
605
|
+
/**
|
|
606
|
+
* Start the session's lead agent, reserved and in the order §7.1 prescribes.
|
|
607
|
+
*
|
|
608
|
+
* Only the adapter selection is resolved here; the reordered start itself —
|
|
609
|
+
* mint the identity, register the attempt, persist the row, reserve, dispatch,
|
|
610
|
+
* settle, transition — lives in `startLeadAgent` so this class keeps only the
|
|
611
|
+
* selection knowledge that is genuinely orchestrator-owned.
|
|
612
|
+
*
|
|
613
|
+
* A lost designation race is not an error: the session now has the winner's
|
|
614
|
+
* agent, and this send continues against it. Only a session that *still* has
|
|
615
|
+
* no agents after the re-read has nothing to send to.
|
|
616
|
+
* @param session - Session being sent to; its agents and lead are updated in place.
|
|
617
|
+
* @param sessionId - Resolved session identity.
|
|
618
|
+
* @param agentSelection - Public agent selection from the request.
|
|
619
|
+
* @param message - User message, used as canonical-model prompt context.
|
|
620
|
+
* @param sessionContext - Session context passed through to the adapter.
|
|
621
|
+
* @returns What the adopted agents need, empty unless a race was lost.
|
|
622
|
+
*/
|
|
623
|
+
private startLeadAgent;
|
|
211
624
|
/**
|
|
212
625
|
* Complete a turn by delegating to `SessionTurnManager`.
|
|
213
626
|
*
|
|
@@ -221,37 +634,6 @@ declare class SessionOrchestrator implements ISessionOrchestrator {
|
|
|
221
634
|
* Stop the orchestrator and clean up all subscriptions and composition utilities.
|
|
222
635
|
*/
|
|
223
636
|
destroy(): void;
|
|
224
|
-
/**
|
|
225
|
-
* Resolve the adapter name for a direct adapter selection.
|
|
226
|
-
*
|
|
227
|
-
* Adapter startup and persisted identity require a stable adapter name.
|
|
228
|
-
* When the caller provides `adapterId`, the framework validates any explicit
|
|
229
|
-
* name against the adapter-subsystem reverse lookup and otherwise backfills the
|
|
230
|
-
* canonical adapter name from that subsystem-owned mapping.
|
|
231
|
-
* @param selection - Direct adapter selection
|
|
232
|
-
* @param sessionId - Session ID used in error messages
|
|
233
|
-
* @returns Resolved adapter name
|
|
234
|
-
*/
|
|
235
|
-
private resolveAdapterName;
|
|
236
|
-
/**
|
|
237
|
-
* Resolve the public agent selection into the direct adapter shape required
|
|
238
|
-
* by the framework orchestrator's startup path.
|
|
239
|
-
* @param selection - Public session agent selection from the request.
|
|
240
|
-
* @param sessionId - Session ID used for context and diagnostics.
|
|
241
|
-
* @param message - User message used as canonical-model prompt context.
|
|
242
|
-
* @param sessionContext - Optional session context passed through the request.
|
|
243
|
-
* @returns Direct adapter selection for `adapter.startAgent`.
|
|
244
|
-
*/
|
|
245
|
-
private resolveInitialAdapterSelection;
|
|
246
|
-
/**
|
|
247
|
-
* Resolve a framework-owned canonical-model selection to a direct adapter selection.
|
|
248
|
-
* @param selection - Canonical model selection from the session request.
|
|
249
|
-
* @param sessionId - Session ID used for context and diagnostics.
|
|
250
|
-
* @param message - User message used as canonical-model prompt context.
|
|
251
|
-
* @param sessionContext - Optional session context passed through the request.
|
|
252
|
-
* @returns Direct adapter selection with resolved adapter, provider config, and model.
|
|
253
|
-
*/
|
|
254
|
-
private resolveCanonicalModelSelection;
|
|
255
637
|
}
|
|
256
638
|
//#endregion
|
|
257
639
|
//#region services/core/src/session/adapter-registry.d.ts
|
|
@@ -276,6 +658,13 @@ declare class AdapterRegistry {
|
|
|
276
658
|
* the new `adapterId` silently overwrites the previous mapping. This is intentional:
|
|
277
659
|
* adapters that restart emit a fresh initialized event and the registry should
|
|
278
660
|
* reflect the latest instance.
|
|
661
|
+
*
|
|
662
|
+
* **The event names no machine**, and the bus can span hosts, so an instance
|
|
663
|
+
* learned this way is *unattributed*: it says an adapter of this name exists
|
|
664
|
+
* somewhere reachable, not that it belongs to any particular machine. It is
|
|
665
|
+
* therefore cached in the unscoped scope only, and a lookup that named a
|
|
666
|
+
* machine is never served from it — answering one would be a guess about the
|
|
667
|
+
* very identity the caller was careful enough to name.
|
|
279
668
|
* @param bus - The event bus to listen on
|
|
280
669
|
*/
|
|
281
670
|
constructor(bus: IMakaioBus);
|
|
@@ -294,10 +683,18 @@ declare class AdapterRegistry {
|
|
|
294
683
|
* keeps legacy event-driven tests and observers useful, but session routing
|
|
295
684
|
* must prefer the replayable request seam so a session created after adapter
|
|
296
685
|
* initialization does not miss a one-time event.
|
|
686
|
+
* **Naming the machine is what makes the answer usable as an ownership key.**
|
|
687
|
+
* An instance ID is derived from `(machineId, adapterName)`, so a caller that
|
|
688
|
+
* will reserve or settle under a particular machine has to resolve for that
|
|
689
|
+
* same machine — otherwise the instance it dispatches to and the namespace it
|
|
690
|
+
* claims in come from two different identities and the key protects nothing.
|
|
691
|
+
* Omitted, the resolver derives the runtime's own, which is what a caller with
|
|
692
|
+
* no machine of its own to act for wants.
|
|
297
693
|
* @param adapterName - Adapter type name (e.g., `'openai-node'`)
|
|
694
|
+
* @param machineId - Machine to resolve the instance for; omit for the runtime's own.
|
|
298
695
|
* @returns Adapter runtime identifier for bus routing.
|
|
299
696
|
*/
|
|
300
|
-
resolveAvailable(adapterName: string): Promise<string>;
|
|
697
|
+
resolveAvailable(adapterName: string, machineId?: string): Promise<string>;
|
|
301
698
|
/** Stop listening to `adapter.initialized` events and clear the registry. */
|
|
302
699
|
destroy(): void;
|
|
303
700
|
}
|
|
@@ -382,41 +779,139 @@ declare function resolveTargetAgents(session: IMakaioSession, targetSpec: string
|
|
|
382
779
|
*/
|
|
383
780
|
declare function findTurnByAgent(activeTurns: Map<string, Turn$1>, agentId: string): Turn$1 | undefined;
|
|
384
781
|
//#endregion
|
|
385
|
-
//#region services/core/src/session/utils/
|
|
782
|
+
//#region services/core/src/session/utils/start-reservation.d.ts
|
|
783
|
+
/** What every start reservation names, whatever role it takes. */
|
|
784
|
+
interface StartReservationIdentity {
|
|
785
|
+
/** Session the agent belongs to; verified against the agent row by the authority. */
|
|
786
|
+
readonly sessionId: string;
|
|
787
|
+
/** Agent the reservation is taken for. */
|
|
788
|
+
readonly agentId: string;
|
|
789
|
+
/** Adapter type name carried onto any claim for diagnostics. */
|
|
790
|
+
readonly adapterName: string;
|
|
791
|
+
/** Instance the dispatch addresses, and the machine its ownership acts are filed under. */
|
|
792
|
+
readonly instance: OwnedAdapterInstance;
|
|
793
|
+
/** Provider session to reserve, or `null` for a start with no key yet. */
|
|
794
|
+
readonly resumeProviderSessionId: string | null;
|
|
795
|
+
}
|
|
386
796
|
/**
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
797
|
+
* The designation half, as a union rather than an optional field.
|
|
798
|
+
*
|
|
799
|
+
* A lead reservation is a compare-and-swap and must name the exact value the
|
|
800
|
+
* caller read; `null` is a legitimate observation ("the session named no lead")
|
|
801
|
+
* and therefore cannot double as "not supplied". Modelling it as one optional
|
|
802
|
+
* field would make the authority's own refusal — *`expectedLeadAgentId` is
|
|
803
|
+
* required when role is `'lead'`* — reachable from these four callers, which is
|
|
804
|
+
* exactly what a union makes impossible to write.
|
|
805
|
+
*/
|
|
806
|
+
type StartReservationDesignation = {
|
|
807
|
+
/** This start designates the session's lead. */readonly role: Extract<AgentRole, 'lead'>; /** Lead the caller observed on the session row, or `null` when it named none. */
|
|
808
|
+
readonly expectedLeadAgentId: string | null;
|
|
809
|
+
} | {
|
|
810
|
+
/** This start leaves the designation untouched. */readonly role: Exclude<AgentRole, 'lead'>;
|
|
811
|
+
};
|
|
812
|
+
/** Everything a start reservation names beyond the instance it runs against. */
|
|
813
|
+
type StartReservationRequest = StartReservationIdentity & StartReservationDesignation;
|
|
814
|
+
/**
|
|
815
|
+
* Take one start reservation.
|
|
816
|
+
*
|
|
817
|
+
* Issued as a **hard** request by every caller, and that is deliberate rather
|
|
818
|
+
* than incidental: a host that can dispatch a start and cannot reserve one is a
|
|
819
|
+
* broken composition, not a lightweight one, and a degrade here would make that
|
|
820
|
+
* misconfiguration indistinguishable from a supported topology. Each caller owns
|
|
821
|
+
* what a throw means for its own rollback, so no attempt is made to classify it
|
|
822
|
+
* here.
|
|
823
|
+
* @param bus - Bus the reservation is issued on.
|
|
824
|
+
* @param request - Identity, instance, role and resume target of the start being reserved for.
|
|
825
|
+
* @returns What the authority answered, verbatim.
|
|
394
826
|
*/
|
|
395
|
-
declare function
|
|
827
|
+
declare function reserveStartFor(bus: IMakaioBus, request: StartReservationRequest): Promise<SessionOwnershipReserveStartServiceResult>;
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region services/core/src/session/recovery-plan.d.ts
|
|
396
830
|
/**
|
|
397
|
-
*
|
|
831
|
+
* Continue the agent's existing provider conversation.
|
|
398
832
|
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
* catalog.
|
|
402
|
-
* @param bus - Bus instance for RPC calls
|
|
403
|
-
* @param providerConfigId - Canonical provider config ID (ProviderConfigRecord.id)
|
|
404
|
-
* @param model - Model identifier to look up in the provider's catalog
|
|
405
|
-
* @returns Object with `supportedReasoningLevels` when found, or `undefined` when not resolvable
|
|
833
|
+
* The provider still holds the conversation, so history must **not** be
|
|
834
|
+
* injected — the model would see every prior message twice.
|
|
406
835
|
*/
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
836
|
+
interface NativeResumeRecoveryPlan {
|
|
837
|
+
readonly kind: 'native-resume';
|
|
838
|
+
/** Provider session the replacement connector resumes. */
|
|
839
|
+
readonly resumeAdapterSessionId: string;
|
|
840
|
+
}
|
|
410
841
|
/**
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
415
|
-
*
|
|
842
|
+
* Start a fresh provider session and inject the stored conversation.
|
|
843
|
+
*
|
|
844
|
+
* This is the "warm-fresh" case named in the session-locality design: the agent
|
|
845
|
+
* record survives, but its provider conversation does not — either because the
|
|
846
|
+
* provider session is unreachable (foreign machine, unsupported adapter,
|
|
847
|
+
* unconfirmed movement) or because the agent never had a confirmed one. The
|
|
848
|
+
* caller owns history injection; without it the model starts blank on a session
|
|
849
|
+
* that visibly has prior turns.
|
|
416
850
|
*/
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
851
|
+
interface FreshWithHistoryRecoveryPlan {
|
|
852
|
+
readonly kind: 'fresh-with-history';
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* How one agent regains its conversation when its connector is gone.
|
|
856
|
+
*
|
|
857
|
+
* Produced by {@link planAgentRecovery} (or taken as
|
|
858
|
+
* {@link FRESH_WITH_HISTORY_RECOVERY_PLAN} where no provider session can exist)
|
|
859
|
+
* and read back through {@link recoveryPlanResumeTarget} and
|
|
860
|
+
* {@link recoveryPlanRequiresHistory}, so the rehydrate call and the history
|
|
861
|
+
* routing cannot drift apart.
|
|
862
|
+
*/
|
|
863
|
+
type RecoveryPlan = NativeResumeRecoveryPlan | FreshWithHistoryRecoveryPlan;
|
|
864
|
+
/**
|
|
865
|
+
* The fresh-with-history plan.
|
|
866
|
+
*
|
|
867
|
+
* Shared frozen instance: the variant carries no per-agent data, and a single
|
|
868
|
+
* instance keeps call sites from implying that it does.
|
|
869
|
+
*/
|
|
870
|
+
declare const FRESH_WITH_HISTORY_RECOVERY_PLAN: FreshWithHistoryRecoveryPlan;
|
|
871
|
+
/**
|
|
872
|
+
* Derive the recovery plan for one agent from its locality verdict.
|
|
873
|
+
*
|
|
874
|
+
* Native resume requires both halves of the gate:
|
|
875
|
+
* - the verdict is `native` — this machine owns the provider session store, the
|
|
876
|
+
* adapter can resume, and the resume currency is intact; and
|
|
877
|
+
* - the agent's own settled currency names a provider session.
|
|
878
|
+
*
|
|
879
|
+
* A native verdict with no resolved currency stays fresh-with-history. The
|
|
880
|
+
* verdict is computed from session-level structural signals, so borrowing
|
|
881
|
+
* another agent's provider session to satisfy it would attach two agents to one
|
|
882
|
+
* provider conversation.
|
|
883
|
+
*
|
|
884
|
+
* **The target is settled currency, not an origin column.** Callers resolve it
|
|
885
|
+
* through `resolveAgentResumeIdentity`, which follows a movement the ownership
|
|
886
|
+
* seam settled onto the agent row; the immutable `adapterSessionId` records only
|
|
887
|
+
* where the conversation started. Passing the raw column here would evaluate the
|
|
888
|
+
* verdict against the currency and then resume the pre-movement session anyway.
|
|
889
|
+
* @param verdict - Native locality verdict evaluated for this agent
|
|
890
|
+
* @param agentAdapterSessionId - Resume currency resolved for this agent, or `undefined` when nothing is resumable
|
|
891
|
+
* @returns Native-resume plan when both halves of the gate hold, fresh-with-history otherwise
|
|
892
|
+
*/
|
|
893
|
+
declare function planAgentRecovery(verdict: NativeLocalityVerdict, agentAdapterSessionId: string | undefined): RecoveryPlan;
|
|
894
|
+
/**
|
|
895
|
+
* Resume target the plan hands to `adapter.rehydrateAgent`.
|
|
896
|
+
* @param plan - Recovery plan decided for this agent
|
|
897
|
+
* @returns Provider session to resume, or `undefined` for a fresh replacement connector
|
|
898
|
+
*/
|
|
899
|
+
declare function recoveryPlanResumeTarget(plan: RecoveryPlan): string | undefined;
|
|
900
|
+
/**
|
|
901
|
+
* Whether the caller must inject the stored conversation alongside the rehydrate.
|
|
902
|
+
*
|
|
903
|
+
* Exactly the inverse of {@link recoveryPlanResumeTarget} being defined — stated
|
|
904
|
+
* as its own predicate so the history side reads the decision instead of
|
|
905
|
+
* re-deriving it from the absence of a resume target.
|
|
906
|
+
*
|
|
907
|
+
* Declared as a type predicate rather than left to inference: a caller that
|
|
908
|
+
* returns early on history keeps a `native-resume` plan afterwards, and that
|
|
909
|
+
* narrowing is part of what this function promises. Inferring it would make the
|
|
910
|
+
* promise depend on the checker's version rather than on the signature.
|
|
911
|
+
* @param plan - Recovery plan decided for this agent
|
|
912
|
+
* @returns `true` when the replacement connector starts without provider-side history
|
|
913
|
+
*/
|
|
914
|
+
declare function recoveryPlanRequiresHistory(plan: RecoveryPlan): plan is FreshWithHistoryRecoveryPlan;
|
|
420
915
|
//#endregion
|
|
421
916
|
//#region services/core/src/session/utils/recovery-context.d.ts
|
|
422
917
|
/**
|
|
@@ -430,6 +925,19 @@ declare function resolveExecutionTarget(bus: IMakaioBus, params: {
|
|
|
430
925
|
* @returns SessionContext with messageHistory and isFirstTurn signal
|
|
431
926
|
*/
|
|
432
927
|
declare function buildRecoveryContext(bus: IMakaioBus, session: IMakaioSession): Promise<SessionContext>;
|
|
928
|
+
/**
|
|
929
|
+
* Build the session context a recovery plan calls for.
|
|
930
|
+
*
|
|
931
|
+
* This is the history half of the recovery contract: it consumes the same
|
|
932
|
+
* {@link RecoveryPlan} the rehydrate call consumes, so a natively resumed agent
|
|
933
|
+
* can never also be handed the conversation the provider already holds, and a
|
|
934
|
+
* fresh-with-history agent can never start blank.
|
|
935
|
+
* @param bus - Bus instance
|
|
936
|
+
* @param session - Session whose conversation is projected
|
|
937
|
+
* @param plan - Recovery plan decided for the agents being recovered
|
|
938
|
+
* @returns Full-history context for a fresh-with-history plan, `undefined` for native resume
|
|
939
|
+
*/
|
|
940
|
+
declare function buildPlannedRecoveryContext(bus: IMakaioBus, session: IMakaioSession, plan: RecoveryPlan): Promise<SessionContext | undefined>;
|
|
433
941
|
//#endregion
|
|
434
942
|
//#region services/core/src/session/utils/agent-recovery.d.ts
|
|
435
943
|
/**
|
|
@@ -441,14 +949,35 @@ interface RecoveryConfig {
|
|
|
441
949
|
/** Model identifier (e.g., 'claude-sonnet-4-20250514', 'gpt-4o') */
|
|
442
950
|
model?: string;
|
|
443
951
|
/**
|
|
444
|
-
*
|
|
952
|
+
* Whether the replacement connector resumes the provider conversation or
|
|
953
|
+
* starts fresh and receives the stored conversation as injected history.
|
|
954
|
+
*
|
|
955
|
+
* Required, and required to be the same value the caller feeds to its history
|
|
956
|
+
* assembly (via `buildPlannedRecoveryContext`): the two halves of a
|
|
957
|
+
* recovery are only correct together. Deciding native resume here while
|
|
958
|
+
* building history there replays the conversation into a provider session that
|
|
959
|
+
* already holds it; deciding fresh here without building history there starts
|
|
960
|
+
* the model blank on a session with prior turns.
|
|
961
|
+
*
|
|
962
|
+
* Locality evaluation belongs to the caller — see `planAgentRecovery`.
|
|
963
|
+
*/
|
|
964
|
+
plan: RecoveryPlan;
|
|
965
|
+
/**
|
|
966
|
+
* Machine identity every ownership act of this recovery names.
|
|
967
|
+
*
|
|
968
|
+
* A recovery reserves and settles under a machine, and addresses an adapter
|
|
969
|
+
* instance that is derived from one — so both have to come from the *same*
|
|
970
|
+
* identity or the key they build is one no other actor computes. Supplying it
|
|
971
|
+
* is therefore not an optimisation: without it the instance is resolved for
|
|
972
|
+
* this runtime's own machine (or falls back to the agent's persisted one)
|
|
973
|
+
* while the authority files the acts under its default, which is the mixed key
|
|
974
|
+
* the aggregate exists to prevent.
|
|
445
975
|
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
* before setting this field.
|
|
976
|
+
* Omitted only by a caller that genuinely has no machine identity — a headless
|
|
977
|
+
* host, a test composition — where every act is unscoped and consistent for
|
|
978
|
+
* that reason.
|
|
450
979
|
*/
|
|
451
|
-
|
|
980
|
+
machineId?: string;
|
|
452
981
|
}
|
|
453
982
|
/**
|
|
454
983
|
* Ensure agent cwd matches desired cwd, swapping connector if needed.
|
|
@@ -492,18 +1021,47 @@ declare function ensureAgentModel(bus: IMakaioBus, agent: MakaioSessionAgent, de
|
|
|
492
1021
|
changed: true;
|
|
493
1022
|
swapped: boolean;
|
|
494
1023
|
}>;
|
|
1024
|
+
/**
|
|
1025
|
+
* What a liveness-and-recovery pass leaves its caller with.
|
|
1026
|
+
*
|
|
1027
|
+
* Three sets rather than two, because a recovery can now end in a third state:
|
|
1028
|
+
* the agent's provider session is held by a generation this runtime does not
|
|
1029
|
+
* own, so no connector was built and none may be. The helper **names** that set
|
|
1030
|
+
* and decides nothing with it — it has no session, no orchestrator and no way
|
|
1031
|
+
* to start anything, and what a product does without those agents differs per
|
|
1032
|
+
* product.
|
|
1033
|
+
*/
|
|
1034
|
+
interface VerifiedAgents {
|
|
1035
|
+
/** Agents this runtime may drive. */
|
|
1036
|
+
readonly usable: MakaioSessionAgent[];
|
|
1037
|
+
/** Agents recovered during this call. */
|
|
1038
|
+
readonly recoveredAgentIds: Set<string>;
|
|
1039
|
+
/**
|
|
1040
|
+
* Agents this runtime may **not** drive: their provider session is held by a
|
|
1041
|
+
* generation it does not own (I23a). Never empty-able by retrying — the
|
|
1042
|
+
* caller must decide what its product does without them.
|
|
1043
|
+
*/
|
|
1044
|
+
readonly deferredAgentIds: Set<string>;
|
|
1045
|
+
}
|
|
495
1046
|
/**
|
|
496
1047
|
* Verify liveness of agents and recover any that are dead.
|
|
497
|
-
* Queries each agent via getAgent; if unresponsive, triggers
|
|
1048
|
+
* Queries each agent via getAgent; if unresponsive, triggers a reserved
|
|
1049
|
+
* rehydrate via recoverAgent.
|
|
1050
|
+
*
|
|
1051
|
+
* The caller's `recoveryConfig.plan` applies to every agent recovered in this
|
|
1052
|
+
* batch and must be the same plan the caller feeds to its history assembly.
|
|
1053
|
+
*
|
|
1054
|
+
* The **adapter instance is resolved per agent**, inside the loop, and not once
|
|
1055
|
+
* for the batch: a batch may span adapters, and a persisted `adapterId` goes
|
|
1056
|
+
* stale across a runtime restart or failover. Resolving per agent is what keeps
|
|
1057
|
+
* each rehydrate addressed to the live instance that actually owns that agent's
|
|
1058
|
+
* adapter, and keeps a single unresolvable adapter from deciding the batch.
|
|
498
1059
|
* @param bus - Bus instance
|
|
499
1060
|
* @param agents - Agents to verify
|
|
500
|
-
* @param recoveryConfig - Configuration for recovering dead agents
|
|
501
|
-
* @returns
|
|
1061
|
+
* @param recoveryConfig - Configuration for recovering dead agents, including the shared recovery plan
|
|
1062
|
+
* @returns Usable agents, the ones recovered here, and the ones this runtime may not drive
|
|
502
1063
|
*/
|
|
503
|
-
declare function verifyAndRecoverAgents(bus: IMakaioBus, agents: MakaioSessionAgent[], recoveryConfig: RecoveryConfig): Promise<
|
|
504
|
-
verifiedAgents: MakaioSessionAgent[];
|
|
505
|
-
recoveredAgentIds: Set<string>;
|
|
506
|
-
}>;
|
|
1064
|
+
declare function verifyAndRecoverAgents(bus: IMakaioBus, agents: MakaioSessionAgent[], recoveryConfig: RecoveryConfig): Promise<VerifiedAgents>;
|
|
507
1065
|
/**
|
|
508
1066
|
* Build recovery context and apply optional additional transforms.
|
|
509
1067
|
* @param bus - Bus instance
|
|
@@ -514,18 +1072,51 @@ declare function verifyAndRecoverAgents(bus: IMakaioBus, agents: MakaioSessionAg
|
|
|
514
1072
|
declare function buildRecoveryContextWithPipeline(bus: IMakaioBus, session: IMakaioSession, options?: {
|
|
515
1073
|
pipeline?: PipelineStep[];
|
|
516
1074
|
}): Promise<SessionContext>;
|
|
1075
|
+
/** How one agent's recovery ended, for a caller that has a fallback for neither. */
|
|
1076
|
+
type AgentRecoveryOutcome = /** A connector is live again; the agent carries the instance it now lives on. */{
|
|
1077
|
+
readonly kind: 'recovered';
|
|
1078
|
+
readonly agent: MakaioSessionAgent;
|
|
1079
|
+
}
|
|
517
1080
|
/**
|
|
518
|
-
*
|
|
1081
|
+
* This runtime may not drive the agent: its provider session is held by a
|
|
1082
|
+
* generation it does not own. Nothing was dispatched and nothing may be.
|
|
1083
|
+
*/
|
|
1084
|
+
| {
|
|
1085
|
+
readonly kind: 'deferred';
|
|
1086
|
+
readonly reason: 'occupied' | 'machine-identity-unavailable';
|
|
1087
|
+
};
|
|
1088
|
+
/**
|
|
1089
|
+
* Recover a dead agent under the ownership authority.
|
|
519
1090
|
* The agent keeps its identity — no session mutation needed.
|
|
520
1091
|
*
|
|
521
1092
|
* Context delivery happens via the normal sendMessage path that follows
|
|
522
1093
|
* recovery (same handler invocation). No staging needed.
|
|
1094
|
+
*
|
|
1095
|
+
* **The instance is an input, never resolved here — and it arrives with its
|
|
1096
|
+
* machine.** The ownership key is `(machine, adapter instance, provider session)`,
|
|
1097
|
+
* so the reservation this makes has to name the very instance the rehydrate is
|
|
1098
|
+
* dispatched to, in the namespace of the machine that instance was derived for.
|
|
1099
|
+
* Resolving internally would put the reservation and the dispatch in two
|
|
1100
|
+
* different namespaces whenever the persisted ID went stale; taking the machine
|
|
1101
|
+
* as a *second*, independent input would let a caller supply two halves that
|
|
1102
|
+
* were never one key. The resolver hands out both together or neither, and this
|
|
1103
|
+
* signature only accepts it that way.
|
|
1104
|
+
*
|
|
1105
|
+
* The reserved rehydrate runs inside the in-flight-start seam, so a concurrent
|
|
1106
|
+
* consumer that finds this agent mid-recovery joins the attempt instead of
|
|
1107
|
+
* starting a second lifecycle for the same identity — and consumes that join
|
|
1108
|
+
* through the shared seam, which classifies the row the attempt left behind
|
|
1109
|
+
* rather than reading its own success into the absence of a rejection.
|
|
523
1110
|
* @param bus - Bus instance
|
|
524
|
-
* @param deadAgent - The dead agent to recover
|
|
1111
|
+
* @param deadAgent - The dead agent to recover; its `adapterId` is re-stamped to the instance the
|
|
1112
|
+
* attempt actually used
|
|
525
1113
|
* @param recoveryConfig - Configuration for the recovered connector
|
|
526
|
-
* @
|
|
1114
|
+
* @param instance - Live instance to rehydrate into and the machine its ownership acts name, resolved
|
|
1115
|
+
* by the caller for THIS agent
|
|
1116
|
+
* @returns The recovered agent, or the statement that this runtime may not drive it
|
|
1117
|
+
* @throws Whatever {@link failedRehydrateError} raises when the recovery failed rather than deferred
|
|
527
1118
|
*/
|
|
528
|
-
declare function recoverAgent(bus: IMakaioBus, deadAgent: MakaioSessionAgent, recoveryConfig: RecoveryConfig): Promise<
|
|
1119
|
+
declare function recoverAgent(bus: IMakaioBus, deadAgent: MakaioSessionAgent, recoveryConfig: RecoveryConfig, instance: OwnedAdapterInstance): Promise<AgentRecoveryOutcome>;
|
|
529
1120
|
//#endregion
|
|
530
1121
|
//#region services/core/src/session/utils/turn-initiator.d.ts
|
|
531
1122
|
/**
|
|
@@ -540,6 +1131,53 @@ declare function recoverAgent(bus: IMakaioBus, deadAgent: MakaioSessionAgent, re
|
|
|
540
1131
|
*/
|
|
541
1132
|
declare function buildTurnInitiator(source: 'extension' | 'user' | 'system' | undefined, extensionId: string | undefined): TurnInitiator;
|
|
542
1133
|
//#endregion
|
|
1134
|
+
//#region services/core/src/session/session-orchestrator-selection.d.ts
|
|
1135
|
+
/** What resolving a fresh start's instance needs beyond the selection itself. */
|
|
1136
|
+
interface SelectionInstanceContext {
|
|
1137
|
+
/** Adapter type name already resolved for the selection. */
|
|
1138
|
+
readonly adapterName: string;
|
|
1139
|
+
/** Session identity, for the refusal message. */
|
|
1140
|
+
readonly sessionId: string;
|
|
1141
|
+
/** This runtime's machine identity, used when it resolves the instance itself. */
|
|
1142
|
+
readonly machineId: string;
|
|
1143
|
+
/** Registry that resolves an adapter name to a live instance for a named machine. */
|
|
1144
|
+
readonly registry: Pick<AdapterRegistry, 'resolveAvailable'>;
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Resolve the instance a fresh lead start dispatches to, together with the
|
|
1148
|
+
* machine every one of its ownership acts names.
|
|
1149
|
+
*
|
|
1150
|
+
* **A fresh start always has a machine, and that is what closes the last hole
|
|
1151
|
+
* in the degrade matrix.** Its *reservation* is keyless and therefore cannot
|
|
1152
|
+
* see the machine's absence — but its *settlement* is keyed, on the provider
|
|
1153
|
+
* session the connector confirms, so an unnamed machine surfaced there as an
|
|
1154
|
+
* outcome no caller on this path had a policy for. Naming the machine here
|
|
1155
|
+
* removes the case by construction rather than by a new branch.
|
|
1156
|
+
*
|
|
1157
|
+
* Two shapes, and the asymmetry is deliberate:
|
|
1158
|
+
*
|
|
1159
|
+
* - **No instance named:** resolve one for this runtime's own machine, and
|
|
1160
|
+
* hand that same machine to the start. The instance ID is derived from
|
|
1161
|
+
* `(machineId, adapterName)`, so passing one identity to the resolution and
|
|
1162
|
+
* the other to the start is the mixed key; passing the same value to both is
|
|
1163
|
+
* what makes them provably agree.
|
|
1164
|
+
* - **An instance named:** its machine comes from the caller, because the
|
|
1165
|
+
* derivation is one-way and this runtime must not invent one.
|
|
1166
|
+
*
|
|
1167
|
+
* **A selection that named one half without the other is refused before either
|
|
1168
|
+
* branch runs**, by the rule {@link describeHalfNamedInstanceRefusal} states for
|
|
1169
|
+
* every path that reads the pair. Refusing first is what makes the two branches
|
|
1170
|
+
* above total: each one holds a pair it can honour, so neither has to decide what
|
|
1171
|
+
* to do with half of one.
|
|
1172
|
+
* @param bus - Bus the resolution is issued on.
|
|
1173
|
+
* @param selection - Direct adapter selection this start runs from.
|
|
1174
|
+
* @param context - Adapter name, session identity, this runtime's machine and its instance registry.
|
|
1175
|
+
* @returns The instance and the machine, as one key.
|
|
1176
|
+
* @throws A {@link SessionStartError} when a named instance carries no machine, or
|
|
1177
|
+
* a named machine carries no instance.
|
|
1178
|
+
*/
|
|
1179
|
+
declare function resolveSelectionOwnedInstance(bus: IMakaioBus, selection: AdapterSelection, context: SelectionInstanceContext): Promise<MachineScopedAdapterInstance>;
|
|
1180
|
+
//#endregion
|
|
543
1181
|
//#region services/core/src/session/context-window/types.d.ts
|
|
544
1182
|
/**
|
|
545
1183
|
* Context window tracking types for per-session aggregation.
|
|
@@ -763,6 +1401,60 @@ declare function registerListActionsHandler(bus: IMakaioBus): () => void;
|
|
|
763
1401
|
* or contains only whitespace
|
|
764
1402
|
*/
|
|
765
1403
|
declare function normalizeSelectionString(value: string | undefined): string | undefined;
|
|
1404
|
+
/** What a caller may know about the instance a selection named, once normalized. */
|
|
1405
|
+
interface NamedSelectionInstance {
|
|
1406
|
+
/** Instance the selection named, or `undefined` when it named none. */
|
|
1407
|
+
readonly adapterId: string | undefined;
|
|
1408
|
+
/** Machine the selection named, or `undefined` when it named none. */
|
|
1409
|
+
readonly machineId: string | undefined;
|
|
1410
|
+
}
|
|
1411
|
+
/** Session identity and the prefix a caller's own messages carry. */
|
|
1412
|
+
interface SelectionRefusalContext {
|
|
1413
|
+
/** Session the selection was submitted for, for the refusal message. */
|
|
1414
|
+
readonly sessionId: string;
|
|
1415
|
+
/** Prefix of the caller's own error messages; include the trailing space. */
|
|
1416
|
+
readonly errorPrefix: string;
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Explain why a selection naming one half of the instance/machine pair must be
|
|
1420
|
+
* refused rather than served.
|
|
1421
|
+
*
|
|
1422
|
+
* **One rule, every path that reads the pair.** An instance ID is a one-way hash
|
|
1423
|
+
* of `(machineId, adapterName)`, so the two halves are only ever honest together:
|
|
1424
|
+
*
|
|
1425
|
+
* - **A machine and no instance** cannot be served, because resolving an instance
|
|
1426
|
+
* without one named derives it for the runtime doing the resolving. Honouring
|
|
1427
|
+
* the name is not what that derivation does, and ignoring it starts the agent
|
|
1428
|
+
* here while the caller believes it chose a host.
|
|
1429
|
+
* - **An instance and no machine** cannot be completed, because the derivation
|
|
1430
|
+
* cannot be inverted. Filling the gap with the resolving runtime's own machine
|
|
1431
|
+
* files every ownership act under a key no other actor computes — it collides
|
|
1432
|
+
* with nothing, so it protects nothing, while the runtime that really owns the
|
|
1433
|
+
* instance claims the same provider session beside it.
|
|
1434
|
+
*
|
|
1435
|
+
* **Stated once, thrown by each caller in its own error form**, because the paths
|
|
1436
|
+
* that read the pair do not share one: a start refuses with a typed start error, an
|
|
1437
|
+
* attach with its own handler error. Returning the reason rather than throwing it
|
|
1438
|
+
* is what lets the rule be one rule without making the paths converge on an error
|
|
1439
|
+
* type none of them owns.
|
|
1440
|
+
*
|
|
1441
|
+
* **Needed as well as the selection schema**, whose two refinements forbid both
|
|
1442
|
+
* shapes: payload validation returns early in production builds and in-process
|
|
1443
|
+
* callers reach these paths with an unparsed selection, so the schema is a guard
|
|
1444
|
+
* against *writing* such a caller while this is what an existing one meets.
|
|
1445
|
+
*
|
|
1446
|
+
* **No path is exempt, including the one that looked like it had a softer answer.**
|
|
1447
|
+
* An attach used to serve a named instance with no machine as a locality degrade,
|
|
1448
|
+
* on the grounds that a fresh-with-history conversation is still worth offering.
|
|
1449
|
+
* The degraded attach still starts, and its settlement still files the confirmed
|
|
1450
|
+
* provider session under the resolving runtime's machine while the dispatch
|
|
1451
|
+
* addressed the named instance — so the softer answer was the mis-key, taken one
|
|
1452
|
+
* step later.
|
|
1453
|
+
* @param named - Normalized instance and machine the selection named
|
|
1454
|
+
* @param context - Session identity and the prefix of the caller's own messages
|
|
1455
|
+
* @returns The refusal, or `undefined` when the selection named both halves or neither
|
|
1456
|
+
*/
|
|
1457
|
+
declare function describeHalfNamedInstanceRefusal(named: NamedSelectionInstance, context: SelectionRefusalContext): string | undefined;
|
|
766
1458
|
/**
|
|
767
1459
|
* Resolve the canonical `adapterName` for a given deterministic `adapterId`,
|
|
768
1460
|
* rejecting when the caller-supplied name does not match the subsystem lookup.
|
|
@@ -978,6 +1670,14 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
978
1670
|
adapterName: z.ZodString;
|
|
979
1671
|
sessionId: z.ZodString;
|
|
980
1672
|
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
1673
|
+
currentAdapterSessionId: z.ZodOptional<z.ZodString>;
|
|
1674
|
+
currentAdapterSessionIdState: z.ZodOptional<z.ZodEnum<{
|
|
1675
|
+
confirmed: "confirmed";
|
|
1676
|
+
moved: "moved";
|
|
1677
|
+
inherited: "inherited";
|
|
1678
|
+
}>>;
|
|
1679
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
1680
|
+
currencyFence: z.ZodOptional<z.ZodNumber>;
|
|
981
1681
|
model: z.ZodOptional<z.ZodString>;
|
|
982
1682
|
cwd: z.ZodOptional<z.ZodString>;
|
|
983
1683
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -998,6 +1698,7 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
998
1698
|
status: z.ZodEnum<{
|
|
999
1699
|
idle: "idle";
|
|
1000
1700
|
active: "active";
|
|
1701
|
+
starting: "starting";
|
|
1001
1702
|
dead: "dead";
|
|
1002
1703
|
disposed: "disposed";
|
|
1003
1704
|
}>;
|
|
@@ -1009,6 +1710,14 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1009
1710
|
/**
|
|
1010
1711
|
* Store or update an agent.
|
|
1011
1712
|
*
|
|
1713
|
+
* A whole-record write of a caller-held snapshot, so on an *existing* row it
|
|
1714
|
+
* may not carry every column: the ownership columns and the origin provider
|
|
1715
|
+
* session stay with the stored row, and a stored `disposed` status wins over
|
|
1716
|
+
* the snapshot's. Disposal is the agent's removal and is terminal (see
|
|
1717
|
+
* `updateStatus`); a snapshot read before it must not revive the row. On a
|
|
1718
|
+
* fresh row there is nothing to protect and the caller's record is stored
|
|
1719
|
+
* verbatim.
|
|
1720
|
+
*
|
|
1012
1721
|
* Subject: `storage:agent.set`
|
|
1013
1722
|
* Type: Request (RPC)
|
|
1014
1723
|
*/
|
|
@@ -1021,6 +1730,14 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1021
1730
|
adapterName: z.ZodString;
|
|
1022
1731
|
sessionId: z.ZodString;
|
|
1023
1732
|
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
1733
|
+
currentAdapterSessionId: z.ZodOptional<z.ZodString>;
|
|
1734
|
+
currentAdapterSessionIdState: z.ZodOptional<z.ZodEnum<{
|
|
1735
|
+
confirmed: "confirmed";
|
|
1736
|
+
moved: "moved";
|
|
1737
|
+
inherited: "inherited";
|
|
1738
|
+
}>>;
|
|
1739
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
1740
|
+
currencyFence: z.ZodOptional<z.ZodNumber>;
|
|
1024
1741
|
model: z.ZodOptional<z.ZodString>;
|
|
1025
1742
|
cwd: z.ZodOptional<z.ZodString>;
|
|
1026
1743
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1041,6 +1758,7 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1041
1758
|
status: z.ZodEnum<{
|
|
1042
1759
|
idle: "idle";
|
|
1043
1760
|
active: "active";
|
|
1761
|
+
starting: "starting";
|
|
1044
1762
|
dead: "dead";
|
|
1045
1763
|
disposed: "disposed";
|
|
1046
1764
|
}>;
|
|
@@ -1079,6 +1797,7 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1079
1797
|
all: "all";
|
|
1080
1798
|
idle: "idle";
|
|
1081
1799
|
active: "active";
|
|
1800
|
+
starting: "starting";
|
|
1082
1801
|
dead: "dead";
|
|
1083
1802
|
disposed: "disposed";
|
|
1084
1803
|
}>>;
|
|
@@ -1090,6 +1809,14 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1090
1809
|
adapterName: z.ZodString;
|
|
1091
1810
|
sessionId: z.ZodString;
|
|
1092
1811
|
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
1812
|
+
currentAdapterSessionId: z.ZodOptional<z.ZodString>;
|
|
1813
|
+
currentAdapterSessionIdState: z.ZodOptional<z.ZodEnum<{
|
|
1814
|
+
confirmed: "confirmed";
|
|
1815
|
+
moved: "moved";
|
|
1816
|
+
inherited: "inherited";
|
|
1817
|
+
}>>;
|
|
1818
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
1819
|
+
currencyFence: z.ZodOptional<z.ZodNumber>;
|
|
1093
1820
|
model: z.ZodOptional<z.ZodString>;
|
|
1094
1821
|
cwd: z.ZodOptional<z.ZodString>;
|
|
1095
1822
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1110,6 +1837,7 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1110
1837
|
status: z.ZodEnum<{
|
|
1111
1838
|
idle: "idle";
|
|
1112
1839
|
active: "active";
|
|
1840
|
+
starting: "starting";
|
|
1113
1841
|
dead: "dead";
|
|
1114
1842
|
disposed: "disposed";
|
|
1115
1843
|
}>;
|
|
@@ -1135,6 +1863,14 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1135
1863
|
adapterName: z.ZodString;
|
|
1136
1864
|
sessionId: z.ZodString;
|
|
1137
1865
|
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
1866
|
+
currentAdapterSessionId: z.ZodOptional<z.ZodString>;
|
|
1867
|
+
currentAdapterSessionIdState: z.ZodOptional<z.ZodEnum<{
|
|
1868
|
+
confirmed: "confirmed";
|
|
1869
|
+
moved: "moved";
|
|
1870
|
+
inherited: "inherited";
|
|
1871
|
+
}>>;
|
|
1872
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
1873
|
+
currencyFence: z.ZodOptional<z.ZodNumber>;
|
|
1138
1874
|
model: z.ZodOptional<z.ZodString>;
|
|
1139
1875
|
cwd: z.ZodOptional<z.ZodString>;
|
|
1140
1876
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1155,6 +1891,7 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1155
1891
|
status: z.ZodEnum<{
|
|
1156
1892
|
idle: "idle";
|
|
1157
1893
|
active: "active";
|
|
1894
|
+
starting: "starting";
|
|
1158
1895
|
dead: "dead";
|
|
1159
1896
|
disposed: "disposed";
|
|
1160
1897
|
}>;
|
|
@@ -1164,7 +1901,15 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1164
1901
|
}, z.core.$strip>;
|
|
1165
1902
|
};
|
|
1166
1903
|
/**
|
|
1167
|
-
* Update agent status.
|
|
1904
|
+
* Update agent status, optionally as a compare-and-swap.
|
|
1905
|
+
*
|
|
1906
|
+
* **`disposed` is terminal.** A row that already carries it never transitions
|
|
1907
|
+
* again, whatever `status` or `expectedStatus` the call names. Disposal is
|
|
1908
|
+
* the agent's removal, and ownership authority is a predicate over the agent
|
|
1909
|
+
* row: a status revived to `idle` would let a removed agent reserve and
|
|
1910
|
+
* settle again. Enforcing it here — rather than asking every lifecycle writer
|
|
1911
|
+
* to check first — is what makes the guarantee hold against a removal that
|
|
1912
|
+
* lands mid-start or mid-rehydrate.
|
|
1168
1913
|
*
|
|
1169
1914
|
* Subject: `storage:agent.updateStatus`
|
|
1170
1915
|
* Type: Request (RPC)
|
|
@@ -1175,12 +1920,21 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1175
1920
|
status: z.ZodEnum<{
|
|
1176
1921
|
idle: "idle";
|
|
1177
1922
|
active: "active";
|
|
1923
|
+
starting: "starting";
|
|
1178
1924
|
dead: "dead";
|
|
1179
1925
|
disposed: "disposed";
|
|
1180
1926
|
}>;
|
|
1927
|
+
expectedStatus: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1928
|
+
idle: "idle";
|
|
1929
|
+
active: "active";
|
|
1930
|
+
starting: "starting";
|
|
1931
|
+
dead: "dead";
|
|
1932
|
+
disposed: "disposed";
|
|
1933
|
+
}>>>;
|
|
1181
1934
|
}, z.core.$strip>;
|
|
1182
1935
|
response: z.ZodObject<{
|
|
1183
1936
|
success: z.ZodBoolean;
|
|
1937
|
+
transitioned: z.ZodBoolean;
|
|
1184
1938
|
}, z.core.$strip>;
|
|
1185
1939
|
};
|
|
1186
1940
|
/**
|
|
@@ -1201,6 +1955,11 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1201
1955
|
/**
|
|
1202
1956
|
* Update runtime-mutable agent fields without full record overwrite.
|
|
1203
1957
|
*
|
|
1958
|
+
* The agent's ownership columns (currency pair, revision, fence) are
|
|
1959
|
+
* deliberately not expressible here: they may only be written under a claim
|
|
1960
|
+
* generation, through the `storage:sessionOwnership` seam. `adapterSessionId`
|
|
1961
|
+
* below is the immutable *origin* identity, not the currency.
|
|
1962
|
+
*
|
|
1204
1963
|
* Subject: `storage:agent.updateRuntime`
|
|
1205
1964
|
* Type: Request (RPC)
|
|
1206
1965
|
*/
|
|
@@ -1319,6 +2078,78 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1319
2078
|
}, {}, {
|
|
1320
2079
|
length: number | undefined;
|
|
1321
2080
|
}>;
|
|
2081
|
+
currentAdapterSessionId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2082
|
+
name: "current_adapter_session_id";
|
|
2083
|
+
tableName: "agents";
|
|
2084
|
+
dataType: "string";
|
|
2085
|
+
columnType: "SQLiteText";
|
|
2086
|
+
data: string;
|
|
2087
|
+
driverParam: string;
|
|
2088
|
+
notNull: false;
|
|
2089
|
+
hasDefault: false;
|
|
2090
|
+
isPrimaryKey: false;
|
|
2091
|
+
isAutoincrement: false;
|
|
2092
|
+
hasRuntimeDefault: false;
|
|
2093
|
+
enumValues: [string, ...string[]];
|
|
2094
|
+
baseColumn: never;
|
|
2095
|
+
identity: undefined;
|
|
2096
|
+
generated: undefined;
|
|
2097
|
+
}, {}, {
|
|
2098
|
+
length: number | undefined;
|
|
2099
|
+
}>;
|
|
2100
|
+
currentAdapterSessionIdState: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2101
|
+
name: "current_adapter_session_id_state";
|
|
2102
|
+
tableName: "agents";
|
|
2103
|
+
dataType: "string";
|
|
2104
|
+
columnType: "SQLiteText";
|
|
2105
|
+
data: "confirmed" | "moved" | "inherited";
|
|
2106
|
+
driverParam: string;
|
|
2107
|
+
notNull: true;
|
|
2108
|
+
hasDefault: true;
|
|
2109
|
+
isPrimaryKey: false;
|
|
2110
|
+
isAutoincrement: false;
|
|
2111
|
+
hasRuntimeDefault: false;
|
|
2112
|
+
enumValues: ["inherited", "moved", "confirmed"];
|
|
2113
|
+
baseColumn: never;
|
|
2114
|
+
identity: undefined;
|
|
2115
|
+
generated: undefined;
|
|
2116
|
+
}, {}, {
|
|
2117
|
+
length: number | undefined;
|
|
2118
|
+
}>;
|
|
2119
|
+
revision: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2120
|
+
name: string;
|
|
2121
|
+
tableName: "agents";
|
|
2122
|
+
dataType: "number";
|
|
2123
|
+
columnType: "SQLiteInteger";
|
|
2124
|
+
data: number;
|
|
2125
|
+
driverParam: number;
|
|
2126
|
+
notNull: true;
|
|
2127
|
+
hasDefault: true;
|
|
2128
|
+
isPrimaryKey: false;
|
|
2129
|
+
isAutoincrement: false;
|
|
2130
|
+
hasRuntimeDefault: false;
|
|
2131
|
+
enumValues: undefined;
|
|
2132
|
+
baseColumn: never;
|
|
2133
|
+
identity: undefined;
|
|
2134
|
+
generated: undefined;
|
|
2135
|
+
}, {}, {}>;
|
|
2136
|
+
currencyFence: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2137
|
+
name: string;
|
|
2138
|
+
tableName: "agents";
|
|
2139
|
+
dataType: "number";
|
|
2140
|
+
columnType: "SQLiteInteger";
|
|
2141
|
+
data: number;
|
|
2142
|
+
driverParam: number;
|
|
2143
|
+
notNull: true;
|
|
2144
|
+
hasDefault: true;
|
|
2145
|
+
isPrimaryKey: false;
|
|
2146
|
+
isAutoincrement: false;
|
|
2147
|
+
hasRuntimeDefault: false;
|
|
2148
|
+
enumValues: undefined;
|
|
2149
|
+
baseColumn: never;
|
|
2150
|
+
identity: undefined;
|
|
2151
|
+
generated: undefined;
|
|
2152
|
+
}, {}, {}>;
|
|
1322
2153
|
model: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
1323
2154
|
name: "model";
|
|
1324
2155
|
tableName: "agents";
|
|
@@ -1514,14 +2345,14 @@ declare const AgentStorageNamespace: _$_makaio_storage_core0.StorageNamespaceDef
|
|
|
1514
2345
|
tableName: "agents";
|
|
1515
2346
|
dataType: "string";
|
|
1516
2347
|
columnType: "SQLiteText";
|
|
1517
|
-
data: "idle" | "active" | "dead" | "disposed";
|
|
2348
|
+
data: "idle" | "active" | "starting" | "dead" | "disposed";
|
|
1518
2349
|
driverParam: string;
|
|
1519
2350
|
notNull: true;
|
|
1520
2351
|
hasDefault: false;
|
|
1521
2352
|
isPrimaryKey: false;
|
|
1522
2353
|
isAutoincrement: false;
|
|
1523
2354
|
hasRuntimeDefault: false;
|
|
1524
|
-
enumValues: ["idle", "active", "dead", "disposed"];
|
|
2355
|
+
enumValues: ["starting", "idle", "active", "dead", "disposed"];
|
|
1525
2356
|
baseColumn: never;
|
|
1526
2357
|
identity: undefined;
|
|
1527
2358
|
generated: undefined;
|
|
@@ -1588,6 +2419,14 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1588
2419
|
adapterName: z.ZodString;
|
|
1589
2420
|
sessionId: z.ZodString;
|
|
1590
2421
|
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2422
|
+
currentAdapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2423
|
+
currentAdapterSessionIdState: z.ZodOptional<z.ZodEnum<{
|
|
2424
|
+
confirmed: "confirmed";
|
|
2425
|
+
moved: "moved";
|
|
2426
|
+
inherited: "inherited";
|
|
2427
|
+
}>>;
|
|
2428
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
2429
|
+
currencyFence: z.ZodOptional<z.ZodNumber>;
|
|
1591
2430
|
model: z.ZodOptional<z.ZodString>;
|
|
1592
2431
|
cwd: z.ZodOptional<z.ZodString>;
|
|
1593
2432
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1608,6 +2447,7 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1608
2447
|
status: z.ZodEnum<{
|
|
1609
2448
|
idle: "idle";
|
|
1610
2449
|
active: "active";
|
|
2450
|
+
starting: "starting";
|
|
1611
2451
|
dead: "dead";
|
|
1612
2452
|
disposed: "disposed";
|
|
1613
2453
|
}>;
|
|
@@ -1619,6 +2459,14 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1619
2459
|
/**
|
|
1620
2460
|
* Store or update an agent.
|
|
1621
2461
|
*
|
|
2462
|
+
* A whole-record write of a caller-held snapshot, so on an *existing* row it
|
|
2463
|
+
* may not carry every column: the ownership columns and the origin provider
|
|
2464
|
+
* session stay with the stored row, and a stored `disposed` status wins over
|
|
2465
|
+
* the snapshot's. Disposal is the agent's removal and is terminal (see
|
|
2466
|
+
* `updateStatus`); a snapshot read before it must not revive the row. On a
|
|
2467
|
+
* fresh row there is nothing to protect and the caller's record is stored
|
|
2468
|
+
* verbatim.
|
|
2469
|
+
*
|
|
1622
2470
|
* Subject: `storage:agent.set`
|
|
1623
2471
|
* Type: Request (RPC)
|
|
1624
2472
|
*/
|
|
@@ -1631,6 +2479,14 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1631
2479
|
adapterName: z.ZodString;
|
|
1632
2480
|
sessionId: z.ZodString;
|
|
1633
2481
|
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2482
|
+
currentAdapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2483
|
+
currentAdapterSessionIdState: z.ZodOptional<z.ZodEnum<{
|
|
2484
|
+
confirmed: "confirmed";
|
|
2485
|
+
moved: "moved";
|
|
2486
|
+
inherited: "inherited";
|
|
2487
|
+
}>>;
|
|
2488
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
2489
|
+
currencyFence: z.ZodOptional<z.ZodNumber>;
|
|
1634
2490
|
model: z.ZodOptional<z.ZodString>;
|
|
1635
2491
|
cwd: z.ZodOptional<z.ZodString>;
|
|
1636
2492
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1651,6 +2507,7 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1651
2507
|
status: z.ZodEnum<{
|
|
1652
2508
|
idle: "idle";
|
|
1653
2509
|
active: "active";
|
|
2510
|
+
starting: "starting";
|
|
1654
2511
|
dead: "dead";
|
|
1655
2512
|
disposed: "disposed";
|
|
1656
2513
|
}>;
|
|
@@ -1689,6 +2546,7 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1689
2546
|
all: "all";
|
|
1690
2547
|
idle: "idle";
|
|
1691
2548
|
active: "active";
|
|
2549
|
+
starting: "starting";
|
|
1692
2550
|
dead: "dead";
|
|
1693
2551
|
disposed: "disposed";
|
|
1694
2552
|
}>>;
|
|
@@ -1700,6 +2558,14 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1700
2558
|
adapterName: z.ZodString;
|
|
1701
2559
|
sessionId: z.ZodString;
|
|
1702
2560
|
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2561
|
+
currentAdapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2562
|
+
currentAdapterSessionIdState: z.ZodOptional<z.ZodEnum<{
|
|
2563
|
+
confirmed: "confirmed";
|
|
2564
|
+
moved: "moved";
|
|
2565
|
+
inherited: "inherited";
|
|
2566
|
+
}>>;
|
|
2567
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
2568
|
+
currencyFence: z.ZodOptional<z.ZodNumber>;
|
|
1703
2569
|
model: z.ZodOptional<z.ZodString>;
|
|
1704
2570
|
cwd: z.ZodOptional<z.ZodString>;
|
|
1705
2571
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1720,6 +2586,7 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1720
2586
|
status: z.ZodEnum<{
|
|
1721
2587
|
idle: "idle";
|
|
1722
2588
|
active: "active";
|
|
2589
|
+
starting: "starting";
|
|
1723
2590
|
dead: "dead";
|
|
1724
2591
|
disposed: "disposed";
|
|
1725
2592
|
}>;
|
|
@@ -1745,6 +2612,14 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1745
2612
|
adapterName: z.ZodString;
|
|
1746
2613
|
sessionId: z.ZodString;
|
|
1747
2614
|
adapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2615
|
+
currentAdapterSessionId: z.ZodOptional<z.ZodString>;
|
|
2616
|
+
currentAdapterSessionIdState: z.ZodOptional<z.ZodEnum<{
|
|
2617
|
+
confirmed: "confirmed";
|
|
2618
|
+
moved: "moved";
|
|
2619
|
+
inherited: "inherited";
|
|
2620
|
+
}>>;
|
|
2621
|
+
revision: z.ZodOptional<z.ZodNumber>;
|
|
2622
|
+
currencyFence: z.ZodOptional<z.ZodNumber>;
|
|
1748
2623
|
model: z.ZodOptional<z.ZodString>;
|
|
1749
2624
|
cwd: z.ZodOptional<z.ZodString>;
|
|
1750
2625
|
allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -1765,6 +2640,7 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1765
2640
|
status: z.ZodEnum<{
|
|
1766
2641
|
idle: "idle";
|
|
1767
2642
|
active: "active";
|
|
2643
|
+
starting: "starting";
|
|
1768
2644
|
dead: "dead";
|
|
1769
2645
|
disposed: "disposed";
|
|
1770
2646
|
}>;
|
|
@@ -1774,7 +2650,15 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1774
2650
|
}, z.core.$strip>;
|
|
1775
2651
|
};
|
|
1776
2652
|
/**
|
|
1777
|
-
* Update agent status.
|
|
2653
|
+
* Update agent status, optionally as a compare-and-swap.
|
|
2654
|
+
*
|
|
2655
|
+
* **`disposed` is terminal.** A row that already carries it never transitions
|
|
2656
|
+
* again, whatever `status` or `expectedStatus` the call names. Disposal is
|
|
2657
|
+
* the agent's removal, and ownership authority is a predicate over the agent
|
|
2658
|
+
* row: a status revived to `idle` would let a removed agent reserve and
|
|
2659
|
+
* settle again. Enforcing it here — rather than asking every lifecycle writer
|
|
2660
|
+
* to check first — is what makes the guarantee hold against a removal that
|
|
2661
|
+
* lands mid-start or mid-rehydrate.
|
|
1778
2662
|
*
|
|
1779
2663
|
* Subject: `storage:agent.updateStatus`
|
|
1780
2664
|
* Type: Request (RPC)
|
|
@@ -1785,12 +2669,21 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1785
2669
|
status: z.ZodEnum<{
|
|
1786
2670
|
idle: "idle";
|
|
1787
2671
|
active: "active";
|
|
2672
|
+
starting: "starting";
|
|
1788
2673
|
dead: "dead";
|
|
1789
2674
|
disposed: "disposed";
|
|
1790
2675
|
}>;
|
|
2676
|
+
expectedStatus: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
2677
|
+
idle: "idle";
|
|
2678
|
+
active: "active";
|
|
2679
|
+
starting: "starting";
|
|
2680
|
+
dead: "dead";
|
|
2681
|
+
disposed: "disposed";
|
|
2682
|
+
}>>>;
|
|
1791
2683
|
}, z.core.$strip>;
|
|
1792
2684
|
response: z.ZodObject<{
|
|
1793
2685
|
success: z.ZodBoolean;
|
|
2686
|
+
transitioned: z.ZodBoolean;
|
|
1794
2687
|
}, z.core.$strip>;
|
|
1795
2688
|
};
|
|
1796
2689
|
/**
|
|
@@ -1811,6 +2704,11 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1811
2704
|
/**
|
|
1812
2705
|
* Update runtime-mutable agent fields without full record overwrite.
|
|
1813
2706
|
*
|
|
2707
|
+
* The agent's ownership columns (currency pair, revision, fence) are
|
|
2708
|
+
* deliberately not expressible here: they may only be written under a claim
|
|
2709
|
+
* generation, through the `storage:sessionOwnership` seam. `adapterSessionId`
|
|
2710
|
+
* below is the immutable *origin* identity, not the currency.
|
|
2711
|
+
*
|
|
1814
2712
|
* Subject: `storage:agent.updateRuntime`
|
|
1815
2713
|
* Type: Request (RPC)
|
|
1816
2714
|
*/
|
|
@@ -1830,13 +2728,48 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1830
2728
|
};
|
|
1831
2729
|
}>, "storage:agent">;
|
|
1832
2730
|
//#endregion
|
|
2731
|
+
//#region services/core/src/session/storage/memory-store.d.ts
|
|
2732
|
+
/**
|
|
2733
|
+
* In-memory backing state shared by the session, agent and ownership memory handlers.
|
|
2734
|
+
*
|
|
2735
|
+
* Extracting the maps from their individual handler closures is what allows the
|
|
2736
|
+
* ownership handler to read and mutate agent and session rows written by the other
|
|
2737
|
+
* two handlers — a property that cannot be achieved with three disconnected private
|
|
2738
|
+
* `Map` instances. Pass one `SessionStorageMemoryState` to all three `register*`
|
|
2739
|
+
* functions to make them share the same rows.
|
|
2740
|
+
*/
|
|
2741
|
+
interface SessionStorageMemoryState {
|
|
2742
|
+
/** Session rows keyed by `sessionId`. */
|
|
2743
|
+
readonly sessions: Map<string, IMakaioSession>;
|
|
2744
|
+
/** Agent rows keyed by `agentId`. */
|
|
2745
|
+
readonly agents: Map<string, MakaioSessionAgent>;
|
|
2746
|
+
/** Claim rows keyed by `claimId`. */
|
|
2747
|
+
readonly claims: Map<string, AdapterSessionClaimRecord>;
|
|
2748
|
+
}
|
|
2749
|
+
/**
|
|
2750
|
+
* Allocate a fresh, empty in-memory state instance.
|
|
2751
|
+
*
|
|
2752
|
+
* Each call returns an independent set of maps. Pass the same instance to all
|
|
2753
|
+
* three memory handler registrations when they must share the same rows; pass
|
|
2754
|
+
* separate instances to isolate them (the default when no state is supplied).
|
|
2755
|
+
* @returns A new `SessionStorageMemoryState` with empty maps
|
|
2756
|
+
*/
|
|
2757
|
+
declare function createSessionStorageMemoryState(): SessionStorageMemoryState;
|
|
2758
|
+
//#endregion
|
|
1833
2759
|
//#region services/core/src/session/storage/memory-handler.d.ts
|
|
1834
2760
|
/**
|
|
1835
2761
|
* Register in-memory session storage handlers.
|
|
1836
2762
|
*
|
|
1837
2763
|
* Suitable for development, testing, and single-instance deployments.
|
|
1838
2764
|
* Data is lost when the process exits.
|
|
2765
|
+
*
|
|
2766
|
+
* Pass a shared `SessionStorageMemoryState` to make this handler operate on the
|
|
2767
|
+
* same rows as `registerMemoryAgentStorage` and
|
|
2768
|
+
* `registerMemorySessionOwnershipStorage`. Omit it (or pass `undefined`) to get
|
|
2769
|
+
* an isolated, private store — the default, which preserves backward
|
|
2770
|
+
* compatibility for callers that do not need cross-handler state sharing.
|
|
1839
2771
|
* @param bus - The bus instance to register handlers on
|
|
2772
|
+
* @param state - Shared in-memory state; defaults to a new isolated instance
|
|
1840
2773
|
* @returns Cleanup function to unsubscribe all handlers
|
|
1841
2774
|
* @example
|
|
1842
2775
|
* ```typescript
|
|
@@ -1848,7 +2781,7 @@ declare const AgentStorageSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.
|
|
|
1848
2781
|
* cleanup();
|
|
1849
2782
|
* ```
|
|
1850
2783
|
*/
|
|
1851
|
-
declare function registerMemorySessionStorage(bus: IMakaioBus): () => void;
|
|
2784
|
+
declare function registerMemorySessionStorage(bus: IMakaioBus, state?: SessionStorageMemoryState): () => void;
|
|
1852
2785
|
//#endregion
|
|
1853
2786
|
//#region services/core/src/session/storage/drizzle-handler.d.ts
|
|
1854
2787
|
/**
|
|
@@ -1887,10 +2820,17 @@ declare function registerDrizzleSessionStorage(bus: IMakaioBus, db: MakaioDataba
|
|
|
1887
2820
|
* Register in-memory agent storage handlers.
|
|
1888
2821
|
*
|
|
1889
2822
|
* Suitable for development and testing. Data is lost when the process exits.
|
|
2823
|
+
*
|
|
2824
|
+
* Pass a shared `SessionStorageMemoryState` to make this handler operate on the
|
|
2825
|
+
* same rows as `registerMemorySessionStorage` and
|
|
2826
|
+
* `registerMemorySessionOwnershipStorage`. Omit it (or pass `undefined`) to get
|
|
2827
|
+
* an isolated, private store — the default, which preserves backward
|
|
2828
|
+
* compatibility for callers that do not need cross-handler state sharing.
|
|
1890
2829
|
* @param bus - The bus instance to register handlers on
|
|
2830
|
+
* @param state - Shared in-memory state; defaults to a new isolated instance
|
|
1891
2831
|
* @returns Cleanup function to unsubscribe all handlers
|
|
1892
2832
|
*/
|
|
1893
|
-
declare function registerMemoryAgentStorage(bus: IMakaioBus): () => void;
|
|
2833
|
+
declare function registerMemoryAgentStorage(bus: IMakaioBus, state?: SessionStorageMemoryState): () => void;
|
|
1894
2834
|
//#endregion
|
|
1895
2835
|
//#region services/core/src/session/storage/schema.variants.d.ts
|
|
1896
2836
|
/** Dialect variants for the session storage tables. */
|
|
@@ -1957,7 +2897,7 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
1957
2897
|
tableName: "sessions";
|
|
1958
2898
|
dataType: "string";
|
|
1959
2899
|
columnType: "SQLiteText";
|
|
1960
|
-
data: "
|
|
2900
|
+
data: "closed" | "discovered" | "active" | "archived";
|
|
1961
2901
|
driverParam: string;
|
|
1962
2902
|
notNull: true;
|
|
1963
2903
|
hasDefault: false;
|
|
@@ -2123,6 +3063,44 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2123
3063
|
}, {}, {
|
|
2124
3064
|
length: number | undefined;
|
|
2125
3065
|
}>;
|
|
3066
|
+
currentAdapterSessionId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3067
|
+
name: "current_adapter_session_id";
|
|
3068
|
+
tableName: "sessions";
|
|
3069
|
+
dataType: "string";
|
|
3070
|
+
columnType: "SQLiteText";
|
|
3071
|
+
data: string;
|
|
3072
|
+
driverParam: string;
|
|
3073
|
+
notNull: false;
|
|
3074
|
+
hasDefault: false;
|
|
3075
|
+
isPrimaryKey: false;
|
|
3076
|
+
isAutoincrement: false;
|
|
3077
|
+
hasRuntimeDefault: false;
|
|
3078
|
+
enumValues: [string, ...string[]];
|
|
3079
|
+
baseColumn: never;
|
|
3080
|
+
identity: undefined;
|
|
3081
|
+
generated: undefined;
|
|
3082
|
+
}, {}, {
|
|
3083
|
+
length: number | undefined;
|
|
3084
|
+
}>;
|
|
3085
|
+
currentAdapterSessionIdState: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3086
|
+
name: "current_adapter_session_id_state";
|
|
3087
|
+
tableName: "sessions";
|
|
3088
|
+
dataType: "string";
|
|
3089
|
+
columnType: "SQLiteText";
|
|
3090
|
+
data: "confirmed" | "moved" | "inherited";
|
|
3091
|
+
driverParam: string;
|
|
3092
|
+
notNull: true;
|
|
3093
|
+
hasDefault: true;
|
|
3094
|
+
isPrimaryKey: false;
|
|
3095
|
+
isAutoincrement: false;
|
|
3096
|
+
hasRuntimeDefault: false;
|
|
3097
|
+
enumValues: ["inherited", "moved", "confirmed"];
|
|
3098
|
+
baseColumn: never;
|
|
3099
|
+
identity: undefined;
|
|
3100
|
+
generated: undefined;
|
|
3101
|
+
}, {}, {
|
|
3102
|
+
length: number | undefined;
|
|
3103
|
+
}>;
|
|
2126
3104
|
adapterId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2127
3105
|
name: "adapter_id";
|
|
2128
3106
|
tableName: "sessions";
|
|
@@ -2481,27 +3459,275 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2481
3459
|
tableName: "sessions";
|
|
2482
3460
|
dataType: "string";
|
|
2483
3461
|
columnType: "SQLiteText";
|
|
2484
|
-
data: "discovered" | "imported" | "tracking";
|
|
3462
|
+
data: "discovered" | "imported" | "tracking";
|
|
3463
|
+
driverParam: string;
|
|
3464
|
+
notNull: false;
|
|
3465
|
+
hasDefault: false;
|
|
3466
|
+
isPrimaryKey: false;
|
|
3467
|
+
isAutoincrement: false;
|
|
3468
|
+
hasRuntimeDefault: false;
|
|
3469
|
+
enumValues: ["discovered", "imported", "tracking"];
|
|
3470
|
+
baseColumn: never;
|
|
3471
|
+
identity: undefined;
|
|
3472
|
+
generated: undefined;
|
|
3473
|
+
}, {}, {
|
|
3474
|
+
length: number | undefined;
|
|
3475
|
+
}>;
|
|
3476
|
+
isSidechain: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3477
|
+
name: string;
|
|
3478
|
+
tableName: "sessions";
|
|
3479
|
+
dataType: "boolean";
|
|
3480
|
+
columnType: "SQLiteBoolean";
|
|
3481
|
+
data: boolean;
|
|
3482
|
+
driverParam: number;
|
|
3483
|
+
notNull: false;
|
|
3484
|
+
hasDefault: false;
|
|
3485
|
+
isPrimaryKey: false;
|
|
3486
|
+
isAutoincrement: false;
|
|
3487
|
+
hasRuntimeDefault: false;
|
|
3488
|
+
enumValues: undefined;
|
|
3489
|
+
baseColumn: never;
|
|
3490
|
+
identity: undefined;
|
|
3491
|
+
generated: undefined;
|
|
3492
|
+
}, {}, {}>;
|
|
3493
|
+
machineId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3494
|
+
name: "machine_id";
|
|
3495
|
+
tableName: "sessions";
|
|
3496
|
+
dataType: "string";
|
|
3497
|
+
columnType: "SQLiteText";
|
|
3498
|
+
data: string;
|
|
3499
|
+
driverParam: string;
|
|
3500
|
+
notNull: false;
|
|
3501
|
+
hasDefault: false;
|
|
3502
|
+
isPrimaryKey: false;
|
|
3503
|
+
isAutoincrement: false;
|
|
3504
|
+
hasRuntimeDefault: false;
|
|
3505
|
+
enumValues: [string, ...string[]];
|
|
3506
|
+
baseColumn: never;
|
|
3507
|
+
identity: undefined;
|
|
3508
|
+
generated: undefined;
|
|
3509
|
+
}, {}, {
|
|
3510
|
+
length: number | undefined;
|
|
3511
|
+
}>;
|
|
3512
|
+
};
|
|
3513
|
+
dialect: "sqlite";
|
|
3514
|
+
}>;
|
|
3515
|
+
agents: _$drizzle_orm_sqlite_core0.SQLiteTableWithColumns<{
|
|
3516
|
+
name: "agents";
|
|
3517
|
+
schema: undefined;
|
|
3518
|
+
columns: {
|
|
3519
|
+
agentId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3520
|
+
name: "agent_id";
|
|
3521
|
+
tableName: "agents";
|
|
3522
|
+
dataType: "string";
|
|
3523
|
+
columnType: "SQLiteText";
|
|
3524
|
+
data: string;
|
|
3525
|
+
driverParam: string;
|
|
3526
|
+
notNull: true;
|
|
3527
|
+
hasDefault: false;
|
|
3528
|
+
isPrimaryKey: true;
|
|
3529
|
+
isAutoincrement: false;
|
|
3530
|
+
hasRuntimeDefault: false;
|
|
3531
|
+
enumValues: [string, ...string[]];
|
|
3532
|
+
baseColumn: never;
|
|
3533
|
+
identity: undefined;
|
|
3534
|
+
generated: undefined;
|
|
3535
|
+
}, {}, {
|
|
3536
|
+
length: number | undefined;
|
|
3537
|
+
}>;
|
|
3538
|
+
adapterId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3539
|
+
name: "adapter_id";
|
|
3540
|
+
tableName: "agents";
|
|
3541
|
+
dataType: "string";
|
|
3542
|
+
columnType: "SQLiteText";
|
|
3543
|
+
data: string;
|
|
3544
|
+
driverParam: string;
|
|
3545
|
+
notNull: true;
|
|
3546
|
+
hasDefault: false;
|
|
3547
|
+
isPrimaryKey: false;
|
|
3548
|
+
isAutoincrement: false;
|
|
3549
|
+
hasRuntimeDefault: false;
|
|
3550
|
+
enumValues: [string, ...string[]];
|
|
3551
|
+
baseColumn: never;
|
|
3552
|
+
identity: undefined;
|
|
3553
|
+
generated: undefined;
|
|
3554
|
+
}, {}, {
|
|
3555
|
+
length: number | undefined;
|
|
3556
|
+
}>;
|
|
3557
|
+
adapterName: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3558
|
+
name: "adapter_name";
|
|
3559
|
+
tableName: "agents";
|
|
3560
|
+
dataType: "string";
|
|
3561
|
+
columnType: "SQLiteText";
|
|
3562
|
+
data: string;
|
|
3563
|
+
driverParam: string;
|
|
3564
|
+
notNull: true;
|
|
3565
|
+
hasDefault: false;
|
|
3566
|
+
isPrimaryKey: false;
|
|
3567
|
+
isAutoincrement: false;
|
|
3568
|
+
hasRuntimeDefault: false;
|
|
3569
|
+
enumValues: [string, ...string[]];
|
|
3570
|
+
baseColumn: never;
|
|
3571
|
+
identity: undefined;
|
|
3572
|
+
generated: undefined;
|
|
3573
|
+
}, {}, {
|
|
3574
|
+
length: number | undefined;
|
|
3575
|
+
}>;
|
|
3576
|
+
sessionId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3577
|
+
name: "session_id";
|
|
3578
|
+
tableName: "agents";
|
|
3579
|
+
dataType: "string";
|
|
3580
|
+
columnType: "SQLiteText";
|
|
3581
|
+
data: string;
|
|
3582
|
+
driverParam: string;
|
|
3583
|
+
notNull: true;
|
|
3584
|
+
hasDefault: false;
|
|
3585
|
+
isPrimaryKey: false;
|
|
3586
|
+
isAutoincrement: false;
|
|
3587
|
+
hasRuntimeDefault: false;
|
|
3588
|
+
enumValues: [string, ...string[]];
|
|
3589
|
+
baseColumn: never;
|
|
3590
|
+
identity: undefined;
|
|
3591
|
+
generated: undefined;
|
|
3592
|
+
}, {}, {
|
|
3593
|
+
length: number | undefined;
|
|
3594
|
+
}>;
|
|
3595
|
+
adapterSessionId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3596
|
+
name: "adapter_session_id";
|
|
3597
|
+
tableName: "agents";
|
|
3598
|
+
dataType: "string";
|
|
3599
|
+
columnType: "SQLiteText";
|
|
3600
|
+
data: string;
|
|
3601
|
+
driverParam: string;
|
|
3602
|
+
notNull: false;
|
|
3603
|
+
hasDefault: false;
|
|
3604
|
+
isPrimaryKey: false;
|
|
3605
|
+
isAutoincrement: false;
|
|
3606
|
+
hasRuntimeDefault: false;
|
|
3607
|
+
enumValues: [string, ...string[]];
|
|
3608
|
+
baseColumn: never;
|
|
3609
|
+
identity: undefined;
|
|
3610
|
+
generated: undefined;
|
|
3611
|
+
}, {}, {
|
|
3612
|
+
length: number | undefined;
|
|
3613
|
+
}>;
|
|
3614
|
+
currentAdapterSessionId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3615
|
+
name: "current_adapter_session_id";
|
|
3616
|
+
tableName: "agents";
|
|
3617
|
+
dataType: "string";
|
|
3618
|
+
columnType: "SQLiteText";
|
|
3619
|
+
data: string;
|
|
3620
|
+
driverParam: string;
|
|
3621
|
+
notNull: false;
|
|
3622
|
+
hasDefault: false;
|
|
3623
|
+
isPrimaryKey: false;
|
|
3624
|
+
isAutoincrement: false;
|
|
3625
|
+
hasRuntimeDefault: false;
|
|
3626
|
+
enumValues: [string, ...string[]];
|
|
3627
|
+
baseColumn: never;
|
|
3628
|
+
identity: undefined;
|
|
3629
|
+
generated: undefined;
|
|
3630
|
+
}, {}, {
|
|
3631
|
+
length: number | undefined;
|
|
3632
|
+
}>;
|
|
3633
|
+
currentAdapterSessionIdState: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3634
|
+
name: "current_adapter_session_id_state";
|
|
3635
|
+
tableName: "agents";
|
|
3636
|
+
dataType: "string";
|
|
3637
|
+
columnType: "SQLiteText";
|
|
3638
|
+
data: "confirmed" | "moved" | "inherited";
|
|
3639
|
+
driverParam: string;
|
|
3640
|
+
notNull: true;
|
|
3641
|
+
hasDefault: true;
|
|
3642
|
+
isPrimaryKey: false;
|
|
3643
|
+
isAutoincrement: false;
|
|
3644
|
+
hasRuntimeDefault: false;
|
|
3645
|
+
enumValues: ["inherited", "moved", "confirmed"];
|
|
3646
|
+
baseColumn: never;
|
|
3647
|
+
identity: undefined;
|
|
3648
|
+
generated: undefined;
|
|
3649
|
+
}, {}, {
|
|
3650
|
+
length: number | undefined;
|
|
3651
|
+
}>;
|
|
3652
|
+
revision: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3653
|
+
name: string;
|
|
3654
|
+
tableName: "agents";
|
|
3655
|
+
dataType: "number";
|
|
3656
|
+
columnType: "SQLiteInteger";
|
|
3657
|
+
data: number;
|
|
3658
|
+
driverParam: number;
|
|
3659
|
+
notNull: true;
|
|
3660
|
+
hasDefault: true;
|
|
3661
|
+
isPrimaryKey: false;
|
|
3662
|
+
isAutoincrement: false;
|
|
3663
|
+
hasRuntimeDefault: false;
|
|
3664
|
+
enumValues: undefined;
|
|
3665
|
+
baseColumn: never;
|
|
3666
|
+
identity: undefined;
|
|
3667
|
+
generated: undefined;
|
|
3668
|
+
}, {}, {}>;
|
|
3669
|
+
currencyFence: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3670
|
+
name: string;
|
|
3671
|
+
tableName: "agents";
|
|
3672
|
+
dataType: "number";
|
|
3673
|
+
columnType: "SQLiteInteger";
|
|
3674
|
+
data: number;
|
|
3675
|
+
driverParam: number;
|
|
3676
|
+
notNull: true;
|
|
3677
|
+
hasDefault: true;
|
|
3678
|
+
isPrimaryKey: false;
|
|
3679
|
+
isAutoincrement: false;
|
|
3680
|
+
hasRuntimeDefault: false;
|
|
3681
|
+
enumValues: undefined;
|
|
3682
|
+
baseColumn: never;
|
|
3683
|
+
identity: undefined;
|
|
3684
|
+
generated: undefined;
|
|
3685
|
+
}, {}, {}>;
|
|
3686
|
+
model: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3687
|
+
name: "model";
|
|
3688
|
+
tableName: "agents";
|
|
3689
|
+
dataType: "string";
|
|
3690
|
+
columnType: "SQLiteText";
|
|
3691
|
+
data: string;
|
|
3692
|
+
driverParam: string;
|
|
3693
|
+
notNull: false;
|
|
3694
|
+
hasDefault: false;
|
|
3695
|
+
isPrimaryKey: false;
|
|
3696
|
+
isAutoincrement: false;
|
|
3697
|
+
hasRuntimeDefault: false;
|
|
3698
|
+
enumValues: [string, ...string[]];
|
|
3699
|
+
baseColumn: never;
|
|
3700
|
+
identity: undefined;
|
|
3701
|
+
generated: undefined;
|
|
3702
|
+
}, {}, {
|
|
3703
|
+
length: number | undefined;
|
|
3704
|
+
}>;
|
|
3705
|
+
cwd: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3706
|
+
name: "cwd";
|
|
3707
|
+
tableName: "agents";
|
|
3708
|
+
dataType: "string";
|
|
3709
|
+
columnType: "SQLiteText";
|
|
3710
|
+
data: string;
|
|
2485
3711
|
driverParam: string;
|
|
2486
3712
|
notNull: false;
|
|
2487
3713
|
hasDefault: false;
|
|
2488
3714
|
isPrimaryKey: false;
|
|
2489
3715
|
isAutoincrement: false;
|
|
2490
3716
|
hasRuntimeDefault: false;
|
|
2491
|
-
enumValues: [
|
|
3717
|
+
enumValues: [string, ...string[]];
|
|
2492
3718
|
baseColumn: never;
|
|
2493
3719
|
identity: undefined;
|
|
2494
3720
|
generated: undefined;
|
|
2495
3721
|
}, {}, {
|
|
2496
3722
|
length: number | undefined;
|
|
2497
3723
|
}>;
|
|
2498
|
-
|
|
3724
|
+
allowedDirectories: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2499
3725
|
name: string;
|
|
2500
|
-
tableName: "
|
|
2501
|
-
dataType: "
|
|
2502
|
-
columnType: "
|
|
2503
|
-
data:
|
|
2504
|
-
driverParam:
|
|
3726
|
+
tableName: "agents";
|
|
3727
|
+
dataType: "json";
|
|
3728
|
+
columnType: "SQLiteTextJson";
|
|
3729
|
+
data: string[];
|
|
3730
|
+
driverParam: string;
|
|
2505
3731
|
notNull: false;
|
|
2506
3732
|
hasDefault: false;
|
|
2507
3733
|
isPrimaryKey: false;
|
|
@@ -2511,10 +3737,12 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2511
3737
|
baseColumn: never;
|
|
2512
3738
|
identity: undefined;
|
|
2513
3739
|
generated: undefined;
|
|
2514
|
-
}, {}, {
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
3740
|
+
}, {}, {
|
|
3741
|
+
$type: string[];
|
|
3742
|
+
}>;
|
|
3743
|
+
providerConfigId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3744
|
+
name: "provider_config_id";
|
|
3745
|
+
tableName: "agents";
|
|
2518
3746
|
dataType: "string";
|
|
2519
3747
|
columnType: "SQLiteText";
|
|
2520
3748
|
data: string;
|
|
@@ -2531,23 +3759,16 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2531
3759
|
}, {}, {
|
|
2532
3760
|
length: number | undefined;
|
|
2533
3761
|
}>;
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
}>;
|
|
2537
|
-
agents: _$drizzle_orm_sqlite_core0.SQLiteTableWithColumns<{
|
|
2538
|
-
name: "agents";
|
|
2539
|
-
schema: undefined;
|
|
2540
|
-
columns: {
|
|
2541
|
-
agentId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2542
|
-
name: "agent_id";
|
|
3762
|
+
personaId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3763
|
+
name: "persona_id";
|
|
2543
3764
|
tableName: "agents";
|
|
2544
3765
|
dataType: "string";
|
|
2545
3766
|
columnType: "SQLiteText";
|
|
2546
3767
|
data: string;
|
|
2547
3768
|
driverParam: string;
|
|
2548
|
-
notNull:
|
|
3769
|
+
notNull: false;
|
|
2549
3770
|
hasDefault: false;
|
|
2550
|
-
isPrimaryKey:
|
|
3771
|
+
isPrimaryKey: false;
|
|
2551
3772
|
isAutoincrement: false;
|
|
2552
3773
|
hasRuntimeDefault: false;
|
|
2553
3774
|
enumValues: [string, ...string[]];
|
|
@@ -2557,14 +3778,14 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2557
3778
|
}, {}, {
|
|
2558
3779
|
length: number | undefined;
|
|
2559
3780
|
}>;
|
|
2560
|
-
|
|
2561
|
-
name: "
|
|
3781
|
+
profileId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3782
|
+
name: "profile_id";
|
|
2562
3783
|
tableName: "agents";
|
|
2563
3784
|
dataType: "string";
|
|
2564
3785
|
columnType: "SQLiteText";
|
|
2565
3786
|
data: string;
|
|
2566
3787
|
driverParam: string;
|
|
2567
|
-
notNull:
|
|
3788
|
+
notNull: false;
|
|
2568
3789
|
hasDefault: false;
|
|
2569
3790
|
isPrimaryKey: false;
|
|
2570
3791
|
isAutoincrement: false;
|
|
@@ -2576,14 +3797,14 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2576
3797
|
}, {}, {
|
|
2577
3798
|
length: number | undefined;
|
|
2578
3799
|
}>;
|
|
2579
|
-
|
|
2580
|
-
name: "
|
|
3800
|
+
harnessId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3801
|
+
name: "harness_id";
|
|
2581
3802
|
tableName: "agents";
|
|
2582
3803
|
dataType: "string";
|
|
2583
3804
|
columnType: "SQLiteText";
|
|
2584
3805
|
data: string;
|
|
2585
3806
|
driverParam: string;
|
|
2586
|
-
notNull:
|
|
3807
|
+
notNull: false;
|
|
2587
3808
|
hasDefault: false;
|
|
2588
3809
|
isPrimaryKey: false;
|
|
2589
3810
|
isAutoincrement: false;
|
|
@@ -2595,14 +3816,14 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2595
3816
|
}, {}, {
|
|
2596
3817
|
length: number | undefined;
|
|
2597
3818
|
}>;
|
|
2598
|
-
|
|
2599
|
-
name: "
|
|
3819
|
+
clientId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3820
|
+
name: "client_id";
|
|
2600
3821
|
tableName: "agents";
|
|
2601
3822
|
dataType: "string";
|
|
2602
3823
|
columnType: "SQLiteText";
|
|
2603
3824
|
data: string;
|
|
2604
3825
|
driverParam: string;
|
|
2605
|
-
notNull:
|
|
3826
|
+
notNull: false;
|
|
2606
3827
|
hasDefault: false;
|
|
2607
3828
|
isPrimaryKey: false;
|
|
2608
3829
|
isAutoincrement: false;
|
|
@@ -2614,8 +3835,8 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2614
3835
|
}, {}, {
|
|
2615
3836
|
length: number | undefined;
|
|
2616
3837
|
}>;
|
|
2617
|
-
|
|
2618
|
-
name: "
|
|
3838
|
+
compressionMode: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3839
|
+
name: "compression_mode";
|
|
2619
3840
|
tableName: "agents";
|
|
2620
3841
|
dataType: "string";
|
|
2621
3842
|
columnType: "SQLiteText";
|
|
@@ -2633,52 +3854,69 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2633
3854
|
}, {}, {
|
|
2634
3855
|
length: number | undefined;
|
|
2635
3856
|
}>;
|
|
2636
|
-
|
|
2637
|
-
name: "
|
|
3857
|
+
role: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3858
|
+
name: "role";
|
|
2638
3859
|
tableName: "agents";
|
|
2639
3860
|
dataType: "string";
|
|
2640
3861
|
columnType: "SQLiteText";
|
|
2641
|
-
data:
|
|
3862
|
+
data: "lead" | "member";
|
|
2642
3863
|
driverParam: string;
|
|
2643
|
-
notNull:
|
|
3864
|
+
notNull: true;
|
|
2644
3865
|
hasDefault: false;
|
|
2645
3866
|
isPrimaryKey: false;
|
|
2646
3867
|
isAutoincrement: false;
|
|
2647
3868
|
hasRuntimeDefault: false;
|
|
2648
|
-
enumValues: [
|
|
3869
|
+
enumValues: ["lead", "member"];
|
|
2649
3870
|
baseColumn: never;
|
|
2650
3871
|
identity: undefined;
|
|
2651
3872
|
generated: undefined;
|
|
2652
3873
|
}, {}, {
|
|
2653
3874
|
length: number | undefined;
|
|
2654
3875
|
}>;
|
|
2655
|
-
|
|
2656
|
-
name: "
|
|
3876
|
+
status: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3877
|
+
name: "status";
|
|
2657
3878
|
tableName: "agents";
|
|
2658
3879
|
dataType: "string";
|
|
2659
3880
|
columnType: "SQLiteText";
|
|
2660
|
-
data:
|
|
3881
|
+
data: "idle" | "active" | "starting" | "dead" | "disposed";
|
|
2661
3882
|
driverParam: string;
|
|
2662
|
-
notNull:
|
|
3883
|
+
notNull: true;
|
|
2663
3884
|
hasDefault: false;
|
|
2664
3885
|
isPrimaryKey: false;
|
|
2665
3886
|
isAutoincrement: false;
|
|
2666
3887
|
hasRuntimeDefault: false;
|
|
2667
|
-
enumValues: [
|
|
3888
|
+
enumValues: ["starting", "idle", "active", "dead", "disposed"];
|
|
2668
3889
|
baseColumn: never;
|
|
2669
3890
|
identity: undefined;
|
|
2670
3891
|
generated: undefined;
|
|
2671
3892
|
}, {}, {
|
|
2672
3893
|
length: number | undefined;
|
|
2673
3894
|
}>;
|
|
2674
|
-
|
|
3895
|
+
createdAt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2675
3896
|
name: string;
|
|
2676
3897
|
tableName: "agents";
|
|
2677
|
-
dataType: "
|
|
2678
|
-
columnType: "
|
|
2679
|
-
data:
|
|
2680
|
-
driverParam:
|
|
2681
|
-
notNull:
|
|
3898
|
+
dataType: "number";
|
|
3899
|
+
columnType: "SQLiteInteger";
|
|
3900
|
+
data: number;
|
|
3901
|
+
driverParam: number;
|
|
3902
|
+
notNull: true;
|
|
3903
|
+
hasDefault: false;
|
|
3904
|
+
isPrimaryKey: false;
|
|
3905
|
+
isAutoincrement: false;
|
|
3906
|
+
hasRuntimeDefault: false;
|
|
3907
|
+
enumValues: undefined;
|
|
3908
|
+
baseColumn: never;
|
|
3909
|
+
identity: undefined;
|
|
3910
|
+
generated: undefined;
|
|
3911
|
+
}, {}, {}>;
|
|
3912
|
+
lastActivityAt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3913
|
+
name: string;
|
|
3914
|
+
tableName: "agents";
|
|
3915
|
+
dataType: "number";
|
|
3916
|
+
columnType: "SQLiteInteger";
|
|
3917
|
+
data: number;
|
|
3918
|
+
driverParam: number;
|
|
3919
|
+
notNull: true;
|
|
2682
3920
|
hasDefault: false;
|
|
2683
3921
|
isPrimaryKey: false;
|
|
2684
3922
|
isAutoincrement: false;
|
|
@@ -2687,17 +3925,41 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2687
3925
|
baseColumn: never;
|
|
2688
3926
|
identity: undefined;
|
|
2689
3927
|
generated: undefined;
|
|
3928
|
+
}, {}, {}>;
|
|
3929
|
+
};
|
|
3930
|
+
dialect: "sqlite";
|
|
3931
|
+
}>;
|
|
3932
|
+
adapterSessionClaims: _$drizzle_orm_sqlite_core0.SQLiteTableWithColumns<{
|
|
3933
|
+
name: "adapter_session_claims";
|
|
3934
|
+
schema: undefined;
|
|
3935
|
+
columns: {
|
|
3936
|
+
claimId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3937
|
+
name: "claim_id";
|
|
3938
|
+
tableName: "adapter_session_claims";
|
|
3939
|
+
dataType: "string";
|
|
3940
|
+
columnType: "SQLiteText";
|
|
3941
|
+
data: string;
|
|
3942
|
+
driverParam: string;
|
|
3943
|
+
notNull: true;
|
|
3944
|
+
hasDefault: false;
|
|
3945
|
+
isPrimaryKey: true;
|
|
3946
|
+
isAutoincrement: false;
|
|
3947
|
+
hasRuntimeDefault: false;
|
|
3948
|
+
enumValues: [string, ...string[]];
|
|
3949
|
+
baseColumn: never;
|
|
3950
|
+
identity: undefined;
|
|
3951
|
+
generated: undefined;
|
|
2690
3952
|
}, {}, {
|
|
2691
|
-
|
|
3953
|
+
length: number | undefined;
|
|
2692
3954
|
}>;
|
|
2693
|
-
|
|
2694
|
-
name: "
|
|
2695
|
-
tableName: "
|
|
3955
|
+
machineId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3956
|
+
name: "machine_id";
|
|
3957
|
+
tableName: "adapter_session_claims";
|
|
2696
3958
|
dataType: "string";
|
|
2697
3959
|
columnType: "SQLiteText";
|
|
2698
3960
|
data: string;
|
|
2699
3961
|
driverParam: string;
|
|
2700
|
-
notNull:
|
|
3962
|
+
notNull: true;
|
|
2701
3963
|
hasDefault: false;
|
|
2702
3964
|
isPrimaryKey: false;
|
|
2703
3965
|
isAutoincrement: false;
|
|
@@ -2709,14 +3971,14 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2709
3971
|
}, {}, {
|
|
2710
3972
|
length: number | undefined;
|
|
2711
3973
|
}>;
|
|
2712
|
-
|
|
2713
|
-
name: "
|
|
2714
|
-
tableName: "
|
|
3974
|
+
adapterId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3975
|
+
name: "adapter_id";
|
|
3976
|
+
tableName: "adapter_session_claims";
|
|
2715
3977
|
dataType: "string";
|
|
2716
3978
|
columnType: "SQLiteText";
|
|
2717
3979
|
data: string;
|
|
2718
3980
|
driverParam: string;
|
|
2719
|
-
notNull:
|
|
3981
|
+
notNull: true;
|
|
2720
3982
|
hasDefault: false;
|
|
2721
3983
|
isPrimaryKey: false;
|
|
2722
3984
|
isAutoincrement: false;
|
|
@@ -2728,14 +3990,14 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2728
3990
|
}, {}, {
|
|
2729
3991
|
length: number | undefined;
|
|
2730
3992
|
}>;
|
|
2731
|
-
|
|
2732
|
-
name: "
|
|
2733
|
-
tableName: "
|
|
3993
|
+
adapterName: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
3994
|
+
name: "adapter_name";
|
|
3995
|
+
tableName: "adapter_session_claims";
|
|
2734
3996
|
dataType: "string";
|
|
2735
3997
|
columnType: "SQLiteText";
|
|
2736
3998
|
data: string;
|
|
2737
3999
|
driverParam: string;
|
|
2738
|
-
notNull:
|
|
4000
|
+
notNull: true;
|
|
2739
4001
|
hasDefault: false;
|
|
2740
4002
|
isPrimaryKey: false;
|
|
2741
4003
|
isAutoincrement: false;
|
|
@@ -2747,14 +4009,14 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2747
4009
|
}, {}, {
|
|
2748
4010
|
length: number | undefined;
|
|
2749
4011
|
}>;
|
|
2750
|
-
|
|
2751
|
-
name: "
|
|
2752
|
-
tableName: "
|
|
4012
|
+
providerSessionId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
4013
|
+
name: "provider_session_id";
|
|
4014
|
+
tableName: "adapter_session_claims";
|
|
2753
4015
|
dataType: "string";
|
|
2754
4016
|
columnType: "SQLiteText";
|
|
2755
4017
|
data: string;
|
|
2756
4018
|
driverParam: string;
|
|
2757
|
-
notNull:
|
|
4019
|
+
notNull: true;
|
|
2758
4020
|
hasDefault: false;
|
|
2759
4021
|
isPrimaryKey: false;
|
|
2760
4022
|
isAutoincrement: false;
|
|
@@ -2766,14 +4028,14 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2766
4028
|
}, {}, {
|
|
2767
4029
|
length: number | undefined;
|
|
2768
4030
|
}>;
|
|
2769
|
-
|
|
2770
|
-
name: "
|
|
2771
|
-
tableName: "
|
|
4031
|
+
sessionId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
4032
|
+
name: "session_id";
|
|
4033
|
+
tableName: "adapter_session_claims";
|
|
2772
4034
|
dataType: "string";
|
|
2773
4035
|
columnType: "SQLiteText";
|
|
2774
4036
|
data: string;
|
|
2775
4037
|
driverParam: string;
|
|
2776
|
-
notNull:
|
|
4038
|
+
notNull: true;
|
|
2777
4039
|
hasDefault: false;
|
|
2778
4040
|
isPrimaryKey: false;
|
|
2779
4041
|
isAutoincrement: false;
|
|
@@ -2785,14 +4047,14 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2785
4047
|
}, {}, {
|
|
2786
4048
|
length: number | undefined;
|
|
2787
4049
|
}>;
|
|
2788
|
-
|
|
2789
|
-
name: "
|
|
2790
|
-
tableName: "
|
|
4050
|
+
agentId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
4051
|
+
name: "agent_id";
|
|
4052
|
+
tableName: "adapter_session_claims";
|
|
2791
4053
|
dataType: "string";
|
|
2792
4054
|
columnType: "SQLiteText";
|
|
2793
4055
|
data: string;
|
|
2794
4056
|
driverParam: string;
|
|
2795
|
-
notNull:
|
|
4057
|
+
notNull: true;
|
|
2796
4058
|
hasDefault: false;
|
|
2797
4059
|
isPrimaryKey: false;
|
|
2798
4060
|
isAutoincrement: false;
|
|
@@ -2804,47 +4066,64 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2804
4066
|
}, {}, {
|
|
2805
4067
|
length: number | undefined;
|
|
2806
4068
|
}>;
|
|
2807
|
-
|
|
2808
|
-
name: "
|
|
2809
|
-
tableName: "
|
|
4069
|
+
claimToken: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
4070
|
+
name: "claim_token";
|
|
4071
|
+
tableName: "adapter_session_claims";
|
|
2810
4072
|
dataType: "string";
|
|
2811
4073
|
columnType: "SQLiteText";
|
|
2812
|
-
data:
|
|
4074
|
+
data: string;
|
|
2813
4075
|
driverParam: string;
|
|
2814
4076
|
notNull: true;
|
|
2815
4077
|
hasDefault: false;
|
|
2816
4078
|
isPrimaryKey: false;
|
|
2817
4079
|
isAutoincrement: false;
|
|
2818
4080
|
hasRuntimeDefault: false;
|
|
2819
|
-
enumValues: [
|
|
4081
|
+
enumValues: [string, ...string[]];
|
|
2820
4082
|
baseColumn: never;
|
|
2821
4083
|
identity: undefined;
|
|
2822
4084
|
generated: undefined;
|
|
2823
4085
|
}, {}, {
|
|
2824
4086
|
length: number | undefined;
|
|
2825
4087
|
}>;
|
|
4088
|
+
fence: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
4089
|
+
name: string;
|
|
4090
|
+
tableName: "adapter_session_claims";
|
|
4091
|
+
dataType: "number";
|
|
4092
|
+
columnType: "SQLiteInteger";
|
|
4093
|
+
data: number;
|
|
4094
|
+
driverParam: number;
|
|
4095
|
+
notNull: true;
|
|
4096
|
+
hasDefault: false;
|
|
4097
|
+
isPrimaryKey: false;
|
|
4098
|
+
isAutoincrement: false;
|
|
4099
|
+
hasRuntimeDefault: false;
|
|
4100
|
+
enumValues: undefined;
|
|
4101
|
+
baseColumn: never;
|
|
4102
|
+
identity: undefined;
|
|
4103
|
+
generated: undefined;
|
|
4104
|
+
}, {}, {}>;
|
|
2826
4105
|
status: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2827
4106
|
name: "status";
|
|
2828
|
-
tableName: "
|
|
4107
|
+
tableName: "adapter_session_claims";
|
|
2829
4108
|
dataType: "string";
|
|
2830
4109
|
columnType: "SQLiteText";
|
|
2831
|
-
data: "
|
|
4110
|
+
data: "abandoned" | "held" | "releasing";
|
|
2832
4111
|
driverParam: string;
|
|
2833
4112
|
notNull: true;
|
|
2834
|
-
hasDefault:
|
|
4113
|
+
hasDefault: true;
|
|
2835
4114
|
isPrimaryKey: false;
|
|
2836
4115
|
isAutoincrement: false;
|
|
2837
4116
|
hasRuntimeDefault: false;
|
|
2838
|
-
enumValues: ["
|
|
4117
|
+
enumValues: ["held", "releasing", "abandoned"];
|
|
2839
4118
|
baseColumn: never;
|
|
2840
4119
|
identity: undefined;
|
|
2841
4120
|
generated: undefined;
|
|
2842
4121
|
}, {}, {
|
|
2843
4122
|
length: number | undefined;
|
|
2844
4123
|
}>;
|
|
2845
|
-
|
|
4124
|
+
claimedAt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2846
4125
|
name: string;
|
|
2847
|
-
tableName: "
|
|
4126
|
+
tableName: "adapter_session_claims";
|
|
2848
4127
|
dataType: "number";
|
|
2849
4128
|
columnType: "SQLiteInteger";
|
|
2850
4129
|
data: number;
|
|
@@ -2859,9 +4138,9 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2859
4138
|
identity: undefined;
|
|
2860
4139
|
generated: undefined;
|
|
2861
4140
|
}, {}, {}>;
|
|
2862
|
-
|
|
4141
|
+
updatedAt: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
|
|
2863
4142
|
name: string;
|
|
2864
|
-
tableName: "
|
|
4143
|
+
tableName: "adapter_session_claims";
|
|
2865
4144
|
dataType: "number";
|
|
2866
4145
|
columnType: "SQLiteInteger";
|
|
2867
4146
|
data: number;
|
|
@@ -2906,6 +4185,42 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
|
|
|
2906
4185
|
*/
|
|
2907
4186
|
declare function registerDrizzleAgentStorage(bus: IMakaioBus, db: MakaioDatabase): () => void;
|
|
2908
4187
|
//#endregion
|
|
4188
|
+
//#region services/core/src/session/storage/ownership-memory-handler.d.ts
|
|
4189
|
+
/**
|
|
4190
|
+
* Register in-memory session ownership storage handlers.
|
|
4191
|
+
*
|
|
4192
|
+
* Pass a shared `SessionStorageMemoryState` to make these handlers operate on
|
|
4193
|
+
* the same session and agent rows as `registerMemorySessionStorage` and
|
|
4194
|
+
* `registerMemoryAgentStorage`. Omit it (or pass `undefined`) to get an isolated
|
|
4195
|
+
* private store — useful only for unit tests that exercise ownership without
|
|
4196
|
+
* needing real sessions or agents.
|
|
4197
|
+
* @param bus - The bus instance to register handlers on
|
|
4198
|
+
* @param state - Shared in-memory state; defaults to a new isolated instance
|
|
4199
|
+
* @returns Cleanup function to unsubscribe all handlers
|
|
4200
|
+
*/
|
|
4201
|
+
declare function registerMemorySessionOwnershipStorage(bus: IMakaioBus, state?: SessionStorageMemoryState): () => void;
|
|
4202
|
+
//#endregion
|
|
4203
|
+
//#region services/core/src/session/storage/ownership-drizzle-handler.d.ts
|
|
4204
|
+
/**
|
|
4205
|
+
* Register Drizzle-based session ownership storage handlers.
|
|
4206
|
+
*
|
|
4207
|
+
* These are the only writers of the agent currency columns, of the claim table
|
|
4208
|
+
* and of the session row's lead designation. Whole-record surfaces such as
|
|
4209
|
+
* `storage:agent.set` deliberately cannot express those columns, so a writer
|
|
4210
|
+
* holding a pre-movement snapshot cannot resurrect an abandoned provider
|
|
4211
|
+
* session.
|
|
4212
|
+
* @param bus - The bus instance to register handlers on.
|
|
4213
|
+
* @param db - The MakaioDatabase instance.
|
|
4214
|
+
* @returns Cleanup function to unsubscribe all handlers.
|
|
4215
|
+
* @example
|
|
4216
|
+
* ```typescript
|
|
4217
|
+
* const cleanup = registerDrizzleSessionOwnershipStorage(bus, db);
|
|
4218
|
+
* // Later, when shutting down:
|
|
4219
|
+
* cleanup();
|
|
4220
|
+
* ```
|
|
4221
|
+
*/
|
|
4222
|
+
declare function registerDrizzleSessionOwnershipStorage(bus: IMakaioBus, db: MakaioDatabase): () => void;
|
|
4223
|
+
//#endregion
|
|
2909
4224
|
//#region services/core/src/session/storage/fts-search-handler.d.ts
|
|
2910
4225
|
/**
|
|
2911
4226
|
* Registers FTS-backed `storage:session.search` handler.
|
|
@@ -3683,20 +4998,12 @@ interface IngestCompletedTurnResult {
|
|
|
3683
4998
|
*/
|
|
3684
4999
|
declare function ingestCompletedTurn(bus: IMakaioBus, params: IngestCompletedTurnParams): Promise<IngestCompletedTurnResult>;
|
|
3685
5000
|
//#endregion
|
|
3686
|
-
//#region services/core/src/session/
|
|
5001
|
+
//#region services/core/src/session/log-import-trigger-subjects.d.ts
|
|
3687
5002
|
/**
|
|
3688
|
-
*
|
|
5003
|
+
* The three log-import subjects observed-session ingestion triggers.
|
|
3689
5004
|
*
|
|
3690
|
-
*
|
|
3691
|
-
*
|
|
3692
|
-
* matched by fully-qualified name and payloads are validated against the
|
|
3693
|
-
* schemas registered by the owning service at boot — these mirrored
|
|
3694
|
-
* definitions are type carriers for the fields this component reads and
|
|
3695
|
-
* writes, not a second source of truth. Canonical schemas live with the
|
|
3696
|
-
* log-import service.
|
|
3697
|
-
*
|
|
3698
|
-
* Exported for tests that stub the log-import seam; not part of the public
|
|
3699
|
-
* session API surface.
|
|
5005
|
+
* Exported for tests that stub the log-import seam and for the owning
|
|
5006
|
+
* service's conformance pin; not part of the public session API surface.
|
|
3700
5007
|
* @internal
|
|
3701
5008
|
*/
|
|
3702
5009
|
declare const LogImportTriggerSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<"log-import", {
|
|
@@ -3746,6 +5053,8 @@ declare const LogImportTriggerSubjects: _$_makaio_core0.BusSubjects<_$_makaio_co
|
|
|
3746
5053
|
}, z.core.$strip>;
|
|
3747
5054
|
};
|
|
3748
5055
|
}>, "log-import">;
|
|
5056
|
+
//#endregion
|
|
5057
|
+
//#region services/core/src/session/observed-session-ingestion.d.ts
|
|
3749
5058
|
/**
|
|
3750
5059
|
* Check whether a stored session represents a metadata-only observed session.
|
|
3751
5060
|
*
|
|
@@ -3779,10 +5088,15 @@ declare function isTrackingStub(session: Pick<IMakaioSession, 'isImported' | 'im
|
|
|
3779
5088
|
* Bridges observed client sessions into the canonical session model.
|
|
3780
5089
|
*
|
|
3781
5090
|
* Responsibilities:
|
|
3782
|
-
* - Register observed sessions on `client.session.started`
|
|
3783
|
-
* unified registration seam (`storage:session.importUpsert`),
|
|
3784
|
-
* importer's adapter name so hook-first registration and later
|
|
3785
|
-
* imports converge on the same `(source, adapterSessionId)`
|
|
5091
|
+
* - Register newly started observed sessions on `client.session.started`
|
|
5092
|
+
* through the unified registration seam (`storage:session.importUpsert`),
|
|
5093
|
+
* keyed on the importer's adapter name so hook-first registration and later
|
|
5094
|
+
* transcript imports converge on the same `(source, adapterSessionId)`
|
|
5095
|
+
* identity.
|
|
5096
|
+
* - Rebind continued sessions (`startMode` `resume` / `compact`) through
|
|
5097
|
+
* `storage:session.rebindObserved`: a continuation refreshes runtime and
|
|
5098
|
+
* locality facts only and never registers, so it cannot rewrite the origin,
|
|
5099
|
+
* lineage, import status, creation time or content an import owns.
|
|
3786
5100
|
* - Trigger targeted transcript imports on `client.session.turn.completed`
|
|
3787
5101
|
* (`log-import.importFile` when the transcript path is known, discovery
|
|
3788
5102
|
* fallback via `log-import.importSession` otherwise).
|
|
@@ -3901,18 +5215,85 @@ declare class ObservedSessionIngestionService {
|
|
|
3901
5215
|
*/
|
|
3902
5216
|
private debugUnresolved;
|
|
3903
5217
|
/**
|
|
3904
|
-
*
|
|
5218
|
+
* Route an observed session start to registration or rebind.
|
|
5219
|
+
*
|
|
5220
|
+
* A `SessionStart` signal carries two different facts depending on its start
|
|
5221
|
+
* mode, and conflating them is what let a continuation rewrite import data:
|
|
5222
|
+
* - `resume` / `compact` continue an external session that already exists.
|
|
5223
|
+
* Its origin, lineage, import status, creation time and content belong to
|
|
5224
|
+
* whoever first imported it; only the runtime observing it may have moved.
|
|
5225
|
+
* These modes therefore *rebind* (see {@link rebindObservedSession}).
|
|
5226
|
+
* - `fresh`, `clear`, `fork` and an absent start mode announce a session
|
|
5227
|
+
* this process is seeing begin, so they register through the unified
|
|
5228
|
+
* registration seam (see {@link registerObservedSession}).
|
|
3905
5229
|
*
|
|
3906
5230
|
* Skipped for managed sessions and when no importer is resolvable — a
|
|
3907
5231
|
* session that can never receive imported content must not create a
|
|
3908
|
-
* dangling stub.
|
|
3909
|
-
* NOT the raw client id: the `(source, adapterSessionId)` upsert key must
|
|
3910
|
-
* match what the import path writes, otherwise hook-first registration
|
|
3911
|
-
* would fork the session identity and every import would create a
|
|
3912
|
-
* duplicate session.
|
|
5232
|
+
* dangling stub.
|
|
3913
5233
|
* @param payload - `client.session.started` payload
|
|
3914
5234
|
*/
|
|
3915
5235
|
private handleSessionStarted;
|
|
5236
|
+
/**
|
|
5237
|
+
* Rebind an already known observed session to the runtime continuing it.
|
|
5238
|
+
*
|
|
5239
|
+
* Refreshes runtime/locality facts only (working directory, transcript path,
|
|
5240
|
+
* owning machine). A continuation carries no evidence about origin, lineage,
|
|
5241
|
+
* import status or creation time, so it must not be able to write them —
|
|
5242
|
+
* that is precisely what routing resume/compact through the import upsert
|
|
5243
|
+
* used to do.
|
|
5244
|
+
*
|
|
5245
|
+
* A `'not-found'` outcome is resolved by the ingestion policy, because the
|
|
5246
|
+
* skip is only correct while a transcript import is still coming:
|
|
5247
|
+
* - `tracking`: skip. Fabricating a row here would stamp import provenance
|
|
5248
|
+
* and a creation time taken from the resume moment, and the
|
|
5249
|
+
* timestamp-correction clause of the import upsert only fires while
|
|
5250
|
+
* `createdAt` still equals `discoveredAt` — so the invented creation time
|
|
5251
|
+
* would survive the real transcript import forever. Skipping keeps the
|
|
5252
|
+
* session's first row the one the import path creates from the transcript,
|
|
5253
|
+
* with the real creation time and content; the turn-completed trigger
|
|
5254
|
+
* reaches that path on the very next turn without any extra state here.
|
|
5255
|
+
* - `discovered`: register. Metadata-only policy makes the turn-completed
|
|
5256
|
+
* trigger decline content import for this session forever, so no import
|
|
5257
|
+
* will ever create the row and skipping would drop the session entirely.
|
|
5258
|
+
* The registration seam stamps discovered status plus metadata, and its
|
|
5259
|
+
* creation time taken from the observation is the best available — nothing
|
|
5260
|
+
* downstream will correct it.
|
|
5261
|
+
* A successful rebind is also **evidence the conversation is still in use**,
|
|
5262
|
+
* which a `closed` row contradicts — so it is reported to the ownership
|
|
5263
|
+
* authority, which decides what the observation implies for the row (and
|
|
5264
|
+
* which row: a compaction's lineage root, never a synthesized child).
|
|
5265
|
+
* Reporting is this side's whole duty, and it never changes the rebind's own
|
|
5266
|
+
* result.
|
|
5267
|
+
* @param payload - `client.session.started` payload
|
|
5268
|
+
* @param adapterSessionId - External session id of the continued session
|
|
5269
|
+
* @param source - Importer adapter name (import identity of the session)
|
|
5270
|
+
* @param startMode - How the provider continued the conversation
|
|
5271
|
+
* @returns True when a stored session was rebound
|
|
5272
|
+
*/
|
|
5273
|
+
private rebindObservedSession;
|
|
5274
|
+
/**
|
|
5275
|
+
* Build the ingestion-policy input for an observed session-start payload.
|
|
5276
|
+
* @param payload - `client.session.started` payload
|
|
5277
|
+
* @param adapterSessionId - External session id of the observed session
|
|
5278
|
+
* @param adapterName - Importer adapter name that would own content import
|
|
5279
|
+
* @returns Policy input describing the observation
|
|
5280
|
+
*/
|
|
5281
|
+
private policyInput;
|
|
5282
|
+
/**
|
|
5283
|
+
* Register an observed session through the unified registration seam.
|
|
5284
|
+
*
|
|
5285
|
+
* The registration `source` is the importer's adapter name, NOT the raw
|
|
5286
|
+
* client id: the `(source, adapterSessionId)` upsert key must match what the
|
|
5287
|
+
* import path writes, otherwise hook-first registration would fork the
|
|
5288
|
+
* session identity and every import would create a duplicate session.
|
|
5289
|
+
* @param payload - `client.session.started` payload
|
|
5290
|
+
* @param adapterSessionId - External session id of the started session
|
|
5291
|
+
* @param source - Importer adapter name (import identity of the session)
|
|
5292
|
+
* @param decidedImportStatus - Already evaluated ingestion-policy verdict,
|
|
5293
|
+
* passed by callers that had to consult the policy before routing here
|
|
5294
|
+
* @returns True when the registration reached storage
|
|
5295
|
+
*/
|
|
5296
|
+
private registerObservedSession;
|
|
3916
5297
|
/**
|
|
3917
5298
|
* Trigger a targeted transcript import for a completed observed turn.
|
|
3918
5299
|
*
|
|
@@ -4826,7 +6207,7 @@ declare const messages: _$drizzle_orm_sqlite_core0.SQLiteTableWithColumns<{
|
|
|
4826
6207
|
tableName: "messages";
|
|
4827
6208
|
dataType: "string";
|
|
4828
6209
|
columnType: "SQLiteText";
|
|
4829
|
-
data: "text" | "
|
|
6210
|
+
data: "text" | "compact" | "voice";
|
|
4830
6211
|
driverParam: string;
|
|
4831
6212
|
notNull: false;
|
|
4832
6213
|
hasDefault: false;
|
|
@@ -5553,6 +6934,54 @@ declare function buildSessionContext(bus: IMakaioBus, options: BuildContextOptio
|
|
|
5553
6934
|
*/
|
|
5554
6935
|
declare function getFullConversation(bus: IMakaioBus, sessionId: string): Promise<ContextAssemblyResult>;
|
|
5555
6936
|
//#endregion
|
|
6937
|
+
//#region services/core/src/session/session-resume-identity.d.ts
|
|
6938
|
+
/**
|
|
6939
|
+
* The provider session a resume operation may legitimately target right now.
|
|
6940
|
+
*
|
|
6941
|
+
* Produced by {@link resolveSessionResumeIdentity} so that every role in a
|
|
6942
|
+
* resume path — locality evaluation, live-writer detection, and the resume
|
|
6943
|
+
* target handed to the adapter — reads the same value. Reading
|
|
6944
|
+
* `session.adapterSessionId` directly in those roles is what let them diverge:
|
|
6945
|
+
* that column is immutable origin provenance, not resume currency.
|
|
6946
|
+
*/
|
|
6947
|
+
interface SessionResumeIdentity {
|
|
6948
|
+
/**
|
|
6949
|
+
* Provider session ID that is valid resume currency, or `undefined` when the
|
|
6950
|
+
* session has none.
|
|
6951
|
+
*/
|
|
6952
|
+
readonly adapterSessionId: string | undefined;
|
|
6953
|
+
/**
|
|
6954
|
+
* Whether the provider session moved without provider confirmation.
|
|
6955
|
+
*
|
|
6956
|
+
* When `true`, native resume is impossible regardless of every other
|
|
6957
|
+
* structural signal — there is no provider session that still holds the
|
|
6958
|
+
* conversation. Callers degrade to fresh-with-history.
|
|
6959
|
+
*/
|
|
6960
|
+
readonly movedUnconfirmed: boolean;
|
|
6961
|
+
}
|
|
6962
|
+
/**
|
|
6963
|
+
* Resolve the tri-state resume currency of a session row.
|
|
6964
|
+
*
|
|
6965
|
+
* | `currentAdapterSessionIdState` | resume currency |
|
|
6966
|
+
* |-------------------------------|-----------------------------------------|
|
|
6967
|
+
* | `'inherited'` (or absent) | `session.adapterSessionId` (origin) |
|
|
6968
|
+
* | `'confirmed'` | `session.currentAdapterSessionId` |
|
|
6969
|
+
* | `'moved'` | none — degrade to fresh-with-history |
|
|
6970
|
+
*
|
|
6971
|
+
* **Compress children are never a resume source.** Provider-side compaction is
|
|
6972
|
+
* in place — same provider session ID, same transcript — so the row that
|
|
6973
|
+
* carries the provider identity is the lineage root, and the compress children
|
|
6974
|
+
* the transcript importer synthesizes carry no currency at all. Passing one here
|
|
6975
|
+
* therefore resolves to "nothing resumable", which is the correct answer for
|
|
6976
|
+
* that row: the conversation lives on its root. A caller holding a compress
|
|
6977
|
+
* child resolves the root first; this function deliberately does not, because it
|
|
6978
|
+
* takes a row and not a bus, and a lineage walk hidden behind a pure projection
|
|
6979
|
+
* would be a storage read no caller asked for.
|
|
6980
|
+
* @param session - Session record loaded from storage
|
|
6981
|
+
* @returns Resolved resume identity for this session
|
|
6982
|
+
*/
|
|
6983
|
+
declare function resolveSessionResumeIdentity(session: IMakaioSession): SessionResumeIdentity;
|
|
6984
|
+
//#endregion
|
|
5556
6985
|
//#region services/core/src/session/native-locality.d.ts
|
|
5557
6986
|
/**
|
|
5558
6987
|
* Describes whether the session resume/fork intent is a native continuation
|
|
@@ -5608,6 +7037,19 @@ interface NativeLocalityInput {
|
|
|
5608
7037
|
* Required when `session.forkPointMessageId` is set and `intent === 'fork'`.
|
|
5609
7038
|
*/
|
|
5610
7039
|
readonly midHistoryForkSupported?: boolean;
|
|
7040
|
+
/**
|
|
7041
|
+
* Resume currency the caller resolved for this session.
|
|
7042
|
+
*
|
|
7043
|
+
* `session.adapterSessionId` is immutable origin provenance, so callers that
|
|
7044
|
+
* track currency must resolve it with {@link resolveSessionResumeIdentity} and
|
|
7045
|
+
* pass the result here. When present it is authoritative — including when it
|
|
7046
|
+
* resolves to no usable provider session, which must never silently fall back
|
|
7047
|
+
* to the origin column.
|
|
7048
|
+
*
|
|
7049
|
+
* Omit it to read the origin column directly. That is correct only for callers
|
|
7050
|
+
* whose sessions cannot have moved their provider identity.
|
|
7051
|
+
*/
|
|
7052
|
+
readonly resumeIdentity?: SessionResumeIdentity;
|
|
5611
7053
|
}
|
|
5612
7054
|
/**
|
|
5613
7055
|
* Evaluates whether a session can use native resume or fork, or must fall back
|
|
@@ -5627,4 +7069,4 @@ interface NativeLocalityInput {
|
|
|
5627
7069
|
*/
|
|
5628
7070
|
declare function evaluateNativeLocality(input: NativeLocalityInput): NativeLocalityVerdict;
|
|
5629
7071
|
//#endregion
|
|
5630
|
-
export {
|
|
7072
|
+
export { IngestCompletedTurnResult as $, resetBuiltInActionsRegistration as $t, registerDrizzleMessageStorage as A, getOrCreateSession as An, registerMemorySessionOwnershipStorage as At, importCursorsDual as B, mintClaimToken as Bn, createSessionExtensionContext as Bt, registerDrizzleMessageRoutingStorage as C, RecoveryPlan as Cn, fetchAgentsBySession as Ct, SelectMessage as D, StartReservationRequest as Dn, parseForkTransforms as Dt, InsertMessage as E, recoveryPlanResumeTarget as En, mapRowToSession as Et, registerMemoryTurnStorage as F, AdapterRegistry as Fn, SessionStorageMemoryState as Ft, ObservedSessionIngestionPolicyInput as G, registerAdapterSessionMovementObserver as Gn, CONNECTOR_SWAP_DEFAULT_PIPELINE as Gt, OBSERVED_SESSION_INGESTION_POLICY_CAPABILITY_ID as H, InFlightStart as Hn, assembleForkContext as Ht, registerDrizzleTurnStorage as I, ISessionOrchestrator as In, createSessionStorageMemoryState as It, ObservedSessionIngestionService as J, MakaioSessionService as Jn, describeHalfNamedInstanceRefusal as Jt, registerObservedSessionIngestionPolicyProvider as K, SessionOwnershipAuthorityDeps as Kn, NamedSelectionInstance as Kt, EmbeddingIndexManager as L, SessionOrchestrator as Ln, AgentStorageNamespace as Lt, SelectTurn as M, extractTextContent as Mn, registerMemoryAgentStorage as Mt, turns as N, normalizeToBlocks as Nn, registerDrizzleSessionStorage as Nt, messages as O, reserveStartFor as On, registerFtsSearchHandler as Ot, turnsDual as P, TurnContextEnricher as Pn, registerMemorySessionStorage as Pt, IngestCompletedTurnParams as Q, registerBuiltInActions as Qt, registerDrizzleImportCursorStorage as R, registerCoreSessionServiceHandlers as Rn, AgentStorageSubjects as Rt, messageRoutingDual as S, NativeResumeRecoveryPlan as Sn, SearchSessionRow as St, MessageRoutingSubjects as T, recoveryPlanRequiresHistory as Tn, fetchPreviewBySession as Tt, ObservedSessionIngestionPolicyDecision as U, peekInFlightStart as Un, FallbackRuntimeOptions as Ut, IObservedSessionIngestionPolicyProvider as V, enqueueAgentSettle as Vn, SessionBridge as Vt, ObservedSessionIngestionPolicyImportStatus as W, runExclusiveStart as Wn, pickFallbackRuntimeOptions as Wt, isTrackingStub as X, resolveAdapterNameById as Xt, isPolicyDiscoveredObservedSession as Y, MakaioSessionServiceOptions as Yn, normalizeSelectionString as Yt, LogImportTriggerSubjects as Z, registerListActionsHandler as Zt, MakaioSessionConfig as _, verifyAndRecoverAgents as _n, SessionPreviewMaps as _t, resolveSessionResumeIdentity as a, ContextWindowTrackerConfig as an, SessionUserMessageSentPayload as at, SelectMessageRouting as b, FRESH_WITH_HISTORY_RECOVERY_PLAN as bn, mapToSession as bt, BuildContextOptions as c, resolveSelectionOwnedInstance as cn, emitSessionUserMessageSent as ct, toSessionLineage as d, RecoveryConfig as dn, registerMemorySessionEventStorage as dt, actionRegistry as en, IngestTurnMessage as et, registerSessionDiscoveredHandler as f, VerifiedAgents as fn, InsertSessionEvent as ft, MakaioSession as g, recoverAgent as gn, getSessionAncestorChain as gt, registerParentResolver as h, ensureAgentModel as hn, sessionEventsDual as ht, SessionResumeIdentity as i, AgentContextState as in, SessionTurnStartedPayload as it, InsertTurn as j, resolveTargetAgents as jn, registerDrizzleAgentStorage as jt, registerMemoryMessageStorage as k, findTurnByAgent as kn, registerDrizzleSessionOwnershipStorage as kt, ContextAssemblyResult as l, buildTurnInitiator as ln, registerSessionLifecycleEventWriters as lt, registerCompressLineageResolver as m, ensureAgentCwd as mn, sessionEvents as mt, NativeLocalityIntent as n, registerResumeHandler as nn, EventTransform as nt, getFullConversation as o, SessionContextWindowState as on, appendSessionLifecycleEvent as ot, registerSpawningToolCallResolver as p, buildRecoveryContextWithPipeline as pn, SelectSessionEvent as pt, unregisterObservedSessionIngestionPolicyProvider as q, registerSessionOwnershipAuthority as qn, SelectionRefusalContext as qt, evaluateNativeLocality as r, ContextWindowTracker as rn, SessionLifecycleEventArgs as rt, buildSessionContext as s, SelectionInstanceContext as sn, emitSessionTurnStarted as st, NativeLocalityInput as t, registerGetStatusCountsHandler as tn, ingestCompletedTurn as tt, kindToBranchKind as u, AgentRecoveryOutcome as un, registerDrizzleSessionEventStorage as ut, StartTurnOptions as v, buildPlannedRecoveryContext as vn, fetchSessionPreviewMaps as vt, MessageRoutingNamespace as w, planAgentRecovery as wn, fetchMessageCountsBySession as wt, messageRouting as x, FreshWithHistoryRecoveryPlan as xn, SearchFilters as xt, InsertMessageRouting as y, buildRecoveryContext as yn, mapAgentsBySession as yt, importCursors as z, assessClaimOwner as zn, SessionExtensionContextImpl as zt };
|