@makaio/framework 1.0.0-dev-1782480236258 → 1.0.0-dev-1783355411417

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.
Files changed (154) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/adapter-BRxCc72E.mjs +1 -0
  3. package/dist/adapters/index.d.mts +11 -2
  4. package/dist/adapters/index.mjs +1 -1
  5. package/dist/adapters/node.d.mts +1 -1
  6. package/dist/{base-orchestrator-Cw0vpNgB.d.mts → base-orchestrator-BNysGvaM.d.mts} +70 -2
  7. package/dist/bus/index.d.mts +39 -1
  8. package/dist/bus/index.mjs +1 -1
  9. package/dist/bus-D-ioC0DE.mjs +1 -0
  10. package/dist/bus-rgUFuO2a.mjs +2 -0
  11. package/dist/{client-BcfR-LJC.mjs → client-BgUjVbXX.mjs} +1 -1
  12. package/dist/contracts/adapter/index.d.mts +1 -1
  13. package/dist/contracts/adapter/index.mjs +1 -1
  14. package/dist/contracts/adapter/schemas/session-lineage.d.mts +1 -1
  15. package/dist/contracts/artifact/index.d.mts +1 -1
  16. package/dist/contracts/client/index.d.mts +1 -1
  17. package/dist/contracts/client/index.mjs +1 -1
  18. package/dist/contracts/config/index.d.mts +6 -6
  19. package/dist/contracts/extension/index.d.mts +2 -2
  20. package/dist/contracts/facet/index.d.mts +1 -1
  21. package/dist/contracts/index.d.mts +14 -14
  22. package/dist/contracts/index.mjs +1 -1
  23. package/dist/contracts/materialization/index.d.mts +3 -3
  24. package/dist/contracts/provider/index.d.mts +1 -1
  25. package/dist/contracts/session/index.d.mts +3 -3
  26. package/dist/contracts/session/index.mjs +1 -1
  27. package/dist/contracts/workflow/index.d.mts +2 -2
  28. package/dist/contracts/workflow/index.mjs +1 -1
  29. package/dist/{definition-DePb3ke-.d.mts → definition-b9jyJqPD.d.mts} +1 -1
  30. package/dist/drizzle/0021_m_mr8e1j84.sql +3 -0
  31. package/dist/drizzle/0022_m_mr8i4ky3.sql +43 -0
  32. package/dist/drizzle/meta/_journal.json +14 -0
  33. package/dist/{handler-2bPhRn0u.mjs → handler-BFNvtv5t.mjs} +1 -1
  34. package/dist/handlers-v47Gbsr1.mjs +57 -0
  35. package/dist/hooks/index.d.mts +8 -0
  36. package/dist/hooks/index.mjs +1 -1
  37. package/dist/{index-BhOLtp0B.d.mts → index-31vR1sxk.d.mts} +47 -29
  38. package/dist/{index-Clqt7Nm3.d.mts → index-3J0HZlPH.d.mts} +372 -87
  39. package/dist/{index-D4gn93gL.d.mts → index-3X0368CL.d.mts} +12 -12
  40. package/dist/{index-gAFwNiJT.d.mts → index-BYfSAJRC.d.mts} +64 -0
  41. package/dist/{index-B1XsbrAr.d.mts → index-BwGfdbI0.d.mts} +6 -6
  42. package/dist/{index-D8ScOpus.d.mts → index-C5C1tk9f.d.mts} +222 -9
  43. package/dist/{index-Cvjnj7Zh.d.mts → index-C6Ys8pxt.d.mts} +5 -5
  44. package/dist/{index-mU2lnU7O.d.mts → index-CqCe7Phc.d.mts} +6 -6
  45. package/dist/{index-Cyi7y_aG.d.mts → index-D6aAzr32.d.mts} +20 -20
  46. package/dist/{index-wfSedMR9.d.mts → index-D7rWAEY0.d.mts} +2 -1
  47. package/dist/{index-CYHWOXUm.d.mts → index-DEzdNQum.d.mts} +1 -1
  48. package/dist/{index-DsLpP5ek.d.mts → index-DQYj8-53.d.mts} +1 -1
  49. package/dist/{index-0WhPbKnH.d.mts → index-DV4nRk0h.d.mts} +21 -21
  50. package/dist/{index-C6SLILCZ.d.mts → index-DvHYpi-J.d.mts} +378 -176
  51. package/dist/{index-BMbmoarE.d.mts → index-O08Q2ikz.d.mts} +8 -8
  52. package/dist/kernel/extension/index.d.mts +1 -1
  53. package/dist/kernel/index.d.mts +2 -2
  54. package/dist/kernel/observability/index.d.mts +1 -1
  55. package/dist/{lib-Ba55od_d.mjs → lib-BOmKyjWD.mjs} +1 -1
  56. package/dist/{lib-CM_BUxN8.mjs → lib-DLZYp5z3.mjs} +1 -1
  57. package/dist/{loop-gate-handlers-BLoGCWMQ.mjs → loop-gate-handlers-Bjmat-K3.mjs} +1 -1
  58. package/dist/{namespace-CGxFYDlK.d.mts → namespace-B4cV_pk3.d.mts} +32 -32
  59. package/dist/{namespace-LUNf8zo5.d.mts → namespace-D1_9WVCo.d.mts} +157 -0
  60. package/dist/{namespace-BsYKEMd8.d.mts → namespace-DAj_riOn.d.mts} +138 -0
  61. package/dist/{namespace-BeMGmLrp.d.mts → namespace-DhDY0juT.d.mts} +75 -9
  62. package/dist/{namespace-Bmi5bjm4.d.mts → namespace-DmqoDDRD.d.mts} +156 -20
  63. package/dist/namespace-dFBD2ZmS.mjs +1 -0
  64. package/dist/node/transports/index.d.mts +8 -0
  65. package/dist/node/transports/index.mjs +2 -2
  66. package/dist/orchestrator-shared-ChygCvR1.mjs +1 -0
  67. package/dist/{orchestrator-shared-ChOdIgh6.d.mts → orchestrator-shared-DFLb1otg.d.mts} +9 -3
  68. package/dist/package-BmRhhi-3.mjs +1 -0
  69. package/dist/package.json +1 -1
  70. package/dist/runtime-node/index.mjs +1 -1
  71. package/dist/schema-7aKBGB7S.mjs +1 -0
  72. package/dist/{schema-DHlTAy0N.mjs → schema-CHp6I33k.mjs} +1 -1
  73. package/dist/{schema-Bf_ZNjif.d.mts → schema-DLNBajAV.d.mts} +23 -1
  74. package/dist/{schemas-D512XweP.d.mts → schemas-DMMWmWjq.d.mts} +4 -4
  75. package/dist/schemas-DZGnr9Tl.mjs +1 -0
  76. package/dist/{schemas-C6TVJ80V2.d.mts → schemas-DuuVuhHX2.d.mts} +2 -2
  77. package/dist/schemas-ftgVeWIG.mjs +1 -0
  78. package/dist/scoped-bus-CZId-Df8.mjs +1 -0
  79. package/dist/services/adapter-subsystem/index.d.mts +2 -2
  80. package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
  81. package/dist/services/execution-target/index.d.mts +1 -1
  82. package/dist/services/filesystem/namespace.d.mts +6 -6
  83. package/dist/services/filesystem/schemas.d.mts +3 -3
  84. package/dist/services/harness/index.d.mts +1 -1
  85. package/dist/services/harness/index.mjs +1 -1
  86. package/dist/services/index.d.mts +103 -34
  87. package/dist/services/index.mjs +1 -1
  88. package/dist/services/log-import/browser.d.mts +2 -2
  89. package/dist/services/log-import/index.d.mts +73 -6
  90. package/dist/services/log-import/index.mjs +2 -2
  91. package/dist/services/log-import/log-import.d.mts +1 -1
  92. package/dist/services/log-import/log-import.mjs +1 -1
  93. package/dist/services/log-import/namespace.d.mts +56 -2
  94. package/dist/services/log-import/namespace.mjs +1 -1
  95. package/dist/services/log-import/schemas.d.mts +45 -1
  96. package/dist/services/log-import/schemas.mjs +1 -1
  97. package/dist/services/session/handlers/index.d.mts +1 -1
  98. package/dist/services/session/handlers/index.mjs +1 -1
  99. package/dist/services/session/index.d.mts +8 -8
  100. package/dist/services/session/index.mjs +1 -1
  101. package/dist/services/session/messages/namespace.mjs +1 -1
  102. package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
  103. package/dist/services/session/orchestrator-testing/index.mjs +1 -1
  104. package/dist/services/session/session-events/namespace.d.mts +1 -1
  105. package/dist/services/session/session-events/namespace.mjs +1 -1
  106. package/dist/services/session/storage/namespace.d.mts +1 -1
  107. package/dist/services/session/storage/schema.d.mts +1 -1
  108. package/dist/services/session/storage/schema.mjs +1 -1
  109. package/dist/services/session/testing/index.mjs +9 -4
  110. package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
  111. package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
  112. package/dist/services/session/turns/namespace.d.mts +1 -1
  113. package/dist/services/session/turns/namespace.mjs +1 -1
  114. package/dist/services/settings/namespace.d.mts +5 -5
  115. package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
  116. package/dist/services/subagent-template/index.d.mts +1 -1
  117. package/dist/services/subagent-template/schemas.d.mts +1 -1
  118. package/dist/services/tool-approval/index.mjs +1 -1
  119. package/dist/services/tools/index.mjs +1 -1
  120. package/dist/services/turn/index.d.mts +1 -1
  121. package/dist/services/turn/namespace.d.mts +1 -1
  122. package/dist/services/turn/schemas.d.mts +89 -0
  123. package/dist/services/turn/schemas.mjs +1 -1
  124. package/dist/session-CKWfn3oc.mjs +1 -0
  125. package/dist/session-DCbJwYEU.mjs +69 -0
  126. package/dist/{session-lineage-5-wRBzuC.d.mts → session-lineage-DR-9DU-U.d.mts} +1 -1
  127. package/dist/storage/drizzle/index.d.mts +1 -1
  128. package/dist/storage/drizzle/index.mjs +1 -1
  129. package/dist/{tool-approval-service-DEQiipxj.mjs → tool-approval-service-MU_DmJsf.mjs} +1 -1
  130. package/dist/tools-BrNm-een.mjs +1 -0
  131. package/dist/{transition-CBjccCMw.d.mts → transition-Dq41YCkc.d.mts} +1 -1
  132. package/dist/{types-InWSdi-V.d.mts → types-BMlzmWp6.d.mts} +11 -1
  133. package/dist/{types-8rhArs_K.d.mts → types-C76EP81O.d.mts} +136 -93
  134. package/dist/ui-components/index.mjs +1 -1
  135. package/dist/{workflow-BqH6ar-D.mjs → workflow-C1z7I5CI.mjs} +1 -1
  136. package/dist/workflow-engine/index.d.mts +12 -12
  137. package/dist/workflow-engine/index.mjs +1 -1
  138. package/dist/workflow-engine/package.mjs +1 -1
  139. package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
  140. package/package.json +1 -1
  141. package/dist/adapter-DaQqmKOJ.mjs +0 -1
  142. package/dist/bus-BgodbPl9.mjs +0 -2
  143. package/dist/bus-HgaFcCZ1.mjs +0 -1
  144. package/dist/handlers-BAycjV02.mjs +0 -41
  145. package/dist/namespace-C-piH3w4.mjs +0 -1
  146. package/dist/orchestrator-shared-Cxk3x8Vs.mjs +0 -1
  147. package/dist/package-B1AXe-oz.mjs +0 -1
  148. package/dist/schema-D6WAI8OL.mjs +0 -1
  149. package/dist/schemas-ArqQTC0Q.mjs +0 -1
  150. package/dist/schemas-uID59wR8.mjs +0 -1
  151. package/dist/scoped-bus-H3xMYR0E.mjs +0 -1
  152. package/dist/session-0nWT4st6.mjs +0 -39
  153. package/dist/session-DH-ja8Ka.mjs +0 -1
  154. package/dist/tools-DFOsOboy.mjs +0 -1
@@ -1,19 +1,19 @@
1
1
  import { r as ExecutionTarget } from "./schemas-D4zaFE2p.mjs";
2
- import { d as Turn$1 } from "./index-gAFwNiJT.mjs";
2
+ import { d as Turn$1 } from "./index-BYfSAJRC.mjs";
3
3
  import { a as PipelineStep, o as SessionEditorAction, t as ActionCategory } from "./types-BMS6yfLS.mjs";
4
4
  import { z } from "zod";
5
5
  import * as _$_makaio_core0 from "@makaio/framework/core";
6
6
  import { ExtractSubjectPayload, SubjectDefinition } from "@makaio/framework/core";
7
7
  import { IMakaioBus } from "@makaio/framework/bus";
8
8
  import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
9
- import { AIReasoningLevel, AdapterRuntimeOptions, BranchKind, ContextWindowState, ForkOptions, ForkTransforms, IMakaioSession, JsonValue, MakaioSessionAgent, MakaioSessionEvent, Message, MessageBlock, MessageInput, ReasoningLevelMap, SessionContext, SessionExtensionContext, SessionLineage, SessionLineageKind, SessionMessage, SessionMessageBlock, TurnInitiator } from "@makaio/framework/contracts";
9
+ import { AIReasoningLevel, AdapterRuntimeOptions, BranchKind, ContextWindowState, ForkOptions, ForkTransforms, ICapabilityProvider, IMakaioSession, JsonValue, MakaioSessionAgent, MakaioSessionEvent, Message, MessageBlock, MessageInput, ReasoningLevelMap, SessionContext, SessionEventType, SessionExtensionContext, SessionLineage, SessionLineageKind, SessionMessage, SessionMessageBlock, SessionMessageOrigin, SessionSubjects, TurnIngestionMarker, TurnInitiator, TurnUsage } from "@makaio/framework/contracts";
10
10
  import { BaseService } from "@makaio/framework/service-base";
11
- import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
12
11
  import * as _$drizzle_orm_sqlite_core0 from "drizzle-orm/sqlite-core";
13
12
  import * as _$drizzle_orm_pg_core0 from "drizzle-orm/pg-core";
14
13
  import * as _$_makaio_storage_drizzle0 from "@makaio/framework/storage/drizzle";
15
14
  import { MakaioDatabase } from "@makaio/framework/storage/drizzle";
16
15
  import * as _$drizzle_orm0 from "drizzle-orm";
16
+ import * as _$_makaio_storage_core0 from "@makaio/framework/storage";
17
17
 
18
18
  //#region services/core/src/session/session-service.d.ts
19
19
  /**
@@ -32,10 +32,11 @@ import * as _$drizzle_orm0 from "drizzle-orm";
32
32
  * `SessionStorageSubjects.*` subjects. Register appropriate storage handlers
33
33
  * (memory or drizzle) before creating this service.
34
34
  *
35
- * `SessionLogger` is intentionally NOT a dependency here: it persists session
36
- * lifecycle events consumed only by recovery context assembly, fork, merge,
37
- * compress, and purge all host features. Host services declare
38
- * `SessionLogger` in their own dependency chain.
35
+ * Session lifecycle rows in `session_events` (agent.added, branch.created)
36
+ * are written by the subscription writers registered during init
37
+ * (see `registerSessionLifecycleEventWriters`); turn lifecycle rows are
38
+ * persisted inline at their emit sites. No separate logger component needs
39
+ * to be wired by hosts.
39
40
  * @example
40
41
  * ```typescript
41
42
  * import { MakaioBus } from '@makaio/framework/bus';
@@ -109,7 +110,7 @@ interface CoreSessionServiceHandlerDeps {
109
110
  * Registers the framework-core session service handlers:
110
111
  * `session.create`, `session.get`, `session.list`, `session.turn.await`,
111
112
  * `session.close`, `session.restartAgents`, `session.update`,
112
- * `session.archive`, `session.purge`, `session.registerExternal`,
113
+ * `session.archive`, `session.purge`,
113
114
  * `session.agent.added`, and `session.agent.removed`.
114
115
  *
115
116
  * These handlers cover the minimal, load-bearing session contract for the
@@ -155,8 +156,8 @@ interface ISessionOrchestrator {
155
156
  * 4. Verify agent liveness and build recovery context for dead agents
156
157
  * (requestOptional `AdapterSubjects.getAgent` + `buildRecoveryContext`)
157
158
  * 5. Get or create turn (via `SessionTurnManager`)
158
- * 6. Generate message ID and store user message + routing records
159
- * (requestOptional, fire-and-forget)
159
+ * 6. Generate message ID and store user message (awaited, persist-before-route)
160
+ * + routing records (fire-and-forget)
160
161
  * 7. Emit `session.turn.started` + `session.user_message.sent`
161
162
  * 8. Route to agents (via `routeToAgentsCore`, single shared context)
162
163
  * 9. Return result with `messageId`, `turnId`, `sessionId`
@@ -198,7 +199,7 @@ declare class SessionOrchestrator implements ISessionOrchestrator {
198
199
  * 3. Resolve target agents
199
200
  * 4. Verify agent liveness and build recovery context for dead agents
200
201
  * 5. Get or create turn (via SessionTurnManager)
201
- * 6. Generate message ID and store user message + routing records (fire-and-forget)
202
+ * 6. Generate message ID and store user message (awaited) + routing records (fire-and-forget)
202
203
  * 7. Emit turn.started + user_message.sent
203
204
  * 8. Route to agents (routeToAgentsCore, single shared context)
204
205
  * 9. Return result with messageId, turnId, sessionId
@@ -2019,7 +2020,7 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
2019
2020
  tableName: "sessions";
2020
2021
  dataType: "string";
2021
2022
  columnType: "SQLiteText";
2022
- data: "branch" | "fork" | "subagent" | "compress" | "rewrite" | "coordinator" | "aside";
2023
+ data: "fork" | "subagent" | "compress" | "branch" | "rewrite" | "coordinator" | "aside";
2023
2024
  driverParam: string;
2024
2025
  notNull: false;
2025
2026
  hasDefault: false;
@@ -2443,6 +2444,23 @@ declare const sessionStorageSchema: _$_makaio_storage_drizzle0.DialectSchema<{
2443
2444
  }, {}, {
2444
2445
  length: number | undefined;
2445
2446
  }>;
2447
+ isSidechain: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
2448
+ name: string;
2449
+ tableName: "sessions";
2450
+ dataType: "boolean";
2451
+ columnType: "SQLiteBoolean";
2452
+ data: boolean;
2453
+ driverParam: number;
2454
+ notNull: false;
2455
+ hasDefault: false;
2456
+ isPrimaryKey: false;
2457
+ isAutoincrement: false;
2458
+ hasRuntimeDefault: false;
2459
+ enumValues: undefined;
2460
+ baseColumn: never;
2461
+ identity: undefined;
2462
+ generated: undefined;
2463
+ }, {}, {}>;
2446
2464
  };
2447
2465
  dialect: "sqlite";
2448
2466
  }>;
@@ -2982,7 +3000,8 @@ declare function getSessionAncestorChain(db: MakaioDatabase, sessionId: string):
2982
3000
  * Session events table schema.
2983
3001
  *
2984
3002
  * Stores immutable, append-only session events for unified history reconstruction.
2985
- * Events are persisted by SessionLogger via storage service.
3003
+ * Lifecycle rows are persisted at their emit sites via the session lifecycle
3004
+ * event helpers (see session-lifecycle-events.ts).
2986
3005
  *
2987
3006
  * **Event Types:**
2988
3007
  * - Message references (type='message' with messageId FK to messages table)
@@ -3370,7 +3389,7 @@ declare function registerMemorySessionEventStorage(bus: IMakaioBus): () => void;
3370
3389
  */
3371
3390
  declare function registerDrizzleSessionEventStorage(bus: IMakaioBus, db: MakaioDatabase): () => void;
3372
3391
  //#endregion
3373
- //#region services/core/src/session/session-logger.d.ts
3392
+ //#region services/core/src/session/session-lifecycle-events.d.ts
3374
3393
  /**
3375
3394
  * Transform function for event payloads before storage emission.
3376
3395
  * Use for redaction, PII filtering, or payload normalization.
@@ -3384,90 +3403,326 @@ declare function registerDrizzleSessionEventStorage(bus: IMakaioBus, db: MakaioD
3384
3403
  */
3385
3404
  type EventTransform = (event: MakaioSessionEvent) => MakaioSessionEvent | null;
3386
3405
  /**
3387
- * Options for SessionLogger.
3406
+ * Arguments for {@link appendSessionLifecycleEvent}.
3388
3407
  */
3389
- interface SessionLoggerOptions {
3408
+ interface SessionLifecycleEventArgs {
3409
+ /** Event type for classification (e.g. 'turn.started'). */
3410
+ type: SessionEventType;
3411
+ /** Session the event belongs to. */
3412
+ sessionId: string;
3413
+ /** Event payload to persist. */
3414
+ payload: unknown;
3390
3415
  /**
3391
- * Transform function applied before storage emission.
3392
- * Return null to skip storage entirely.
3393
- * Note: Does not affect individual session.* subjects (see EventTransform docs).
3394
- * Default: identity (no transformation)
3416
+ * Stable event identifier. Provide one when the caller needs idempotent
3417
+ * retries; defaults to a fresh UUID per call.
3395
3418
  */
3396
- transform?: EventTransform;
3419
+ eventId?: string;
3420
+ /** Event timestamp (Unix ms). Defaults to `Date.now()`. */
3421
+ timestamp?: number;
3397
3422
  }
3398
3423
  /**
3399
- * Bridges session lifecycle events to storage layer for persistence.
3400
- *
3401
- * **Architecture (Normalized Message Model):**
3402
- * - Messages: Stored in `messages` table via MessageStorageSubjects (by SessionOrchestrator/SessionBridge)
3403
- * - SessionLogger: Stores LIFECYCLE events only — agent.added, turn.started, turn.completed
3404
- *
3405
- * **NO longer subscribes to user_message.* events** user messages are now
3406
- * first-class entities in the `messages` table, not embedded in event payloads.
3407
- *
3408
- * The correlation link is `session.agent.added` which maps:
3409
- * `sessionId agentId adapterSessionId`
3410
- *
3411
- * Subscribes to:
3412
- * - session.agent.added correlation link for multi-agent reconstruction
3413
- * - session.turn.started, session.turn.completed turn lifecycle
3414
- * - session.branch.created branch creation audit trail
3415
- *
3416
- * Does NOT subscribe to session.branch.merged or session.squash — those
3417
- * handlers (merge-handler, compress-handler) own their persistence directly
3418
- * using a stable eventId so retries are idempotent.
3424
+ * Append a session lifecycle row to `session_events`.
3425
+ *
3426
+ * Builds the {@link MakaioSessionEvent} envelope, applies the optional
3427
+ * transform (null result skips persistence), then requests
3428
+ * `storage:sessionEvent.append` via `requestOptional` so ephemeral mode
3429
+ * (no session-event storage registered) degrades gracefully. A handled
3430
+ * append failure propagates to the caller so emit sites can preserve the
3431
+ * persist-before-emit contract.
3432
+ *
3433
+ * This is the single write path for lifecycle rows in `session_events`.
3434
+ * It MUST NOT be used for `branch.merged` / `squash` those handlers
3435
+ * (merge-handler, compress-handler) own their own idempotent persistence
3436
+ * with stable eventIds; double-writing here would duplicate rows.
3437
+ * @param bus - Bus used to reach session-event storage
3438
+ * @param args - Event envelope fields (type, sessionId, payload, optional eventId/timestamp)
3439
+ * @param transform - Optional transform applied before persistence (return null to skip)
3440
+ */
3441
+ declare function appendSessionLifecycleEvent(bus: IMakaioBus, args: SessionLifecycleEventArgs, transform?: EventTransform): Promise<void>;
3442
+ /**
3443
+ * Payload of the canonical `session.turn.started` event.
3444
+ */
3445
+ type SessionTurnStartedPayload = ExtractSubjectPayload<typeof SessionSubjects.turn.started>;
3446
+ /**
3447
+ * Persist the `turn.started` lifecycle row, then emit `session.turn.started`.
3448
+ *
3449
+ * This is the only sanctioned emit path for live-path `session.turn.started`
3450
+ * emissions (single-emitter discipline): the orchestration emit sites
3451
+ * (SessionOrchestrator, attach handler, MakaioSession entity) all route
3452
+ * through this helper so the `session_events` row is durable before any
3453
+ * consumer observes the event (persist-before-emit). The turn ingestion seam
3454
+ * (`ingestCompletedTurn`) is the one other sanctioned emitter — it batches
3455
+ * both lifecycle rows before emitting and must not be rerouted through this
3456
+ * helper (doing so would reorder its persist-before-emit batch).
3457
+ * @param bus - Bus used for lifecycle persistence and event emission
3458
+ * @param payload - The exact `session.turn.started` payload to persist and emit
3459
+ */
3460
+ declare function emitSessionTurnStarted(bus: IMakaioBus, payload: SessionTurnStartedPayload): Promise<void>;
3461
+ /**
3462
+ * Register subscription-based `session_events` writers for the lifecycle
3463
+ * subjects that have no single emit site: `session.agent.added` (persisted as
3464
+ * type `agent.added`, the sessionId ↔ agentId ↔ adapterSessionId correlation
3465
+ * link) and `session.branch.created` (branch creation audit trail).
3466
+ *
3467
+ * `turn.started` / `turn.completed` rows are NOT written here — their emit
3468
+ * sites persist inline ({@link emitSessionTurnStarted}, SessionTurnManager's
3469
+ * completion barrier, the turn ingestion seam) so the row lands before the
3470
+ * event fires.
3471
+ *
3472
+ * Deliberately does NOT subscribe to `session.branch.merged` or
3473
+ * `session.squash`: the merge and compress handlers own their persistence
3474
+ * directly and call `storage:sessionEvent.append` with a stable eventId so
3475
+ * retries are idempotent. Subscribing here would duplicate those rows.
3476
+ *
3477
+ * Wired by `MakaioSessionService` during init, so the writers run in every
3478
+ * host that composes the session package.
3479
+ * @param bus - Bus to subscribe on and persist through
3480
+ * @param transform - Optional transform applied before persistence (return null to skip)
3481
+ * @returns Cleanup function cancelling both subscriptions
3482
+ */
3483
+ declare function registerSessionLifecycleEventWriters(bus: IMakaioBus, transform?: EventTransform): () => void;
3484
+ //#endregion
3485
+ //#region services/core/src/session/turn-ingest.d.ts
3486
+ /**
3487
+ * A message belonging to an ingested turn.
3419
3488
  *
3420
- * Emits transformed events to `storage:sessionEvent.append` for persistence.
3421
- * @example
3422
- * ```typescript
3423
- * // Basic usage - lifecycle events are emitted to storage:sessionEvent.append
3424
- * const sessionLogger = new SessionLogger(MakaioBus);
3425
- *
3426
- * // With redaction transform (mainly for turn error messages)
3427
- * const sessionLogger = new SessionLogger(MakaioBus, {
3428
- * transform: (event) => {
3429
- * // Redact sensitive info if needed
3430
- * return event;
3431
- * },
3432
- * });
3433
- * ```
3489
+ * Mirrors the `storage:message.upsertByAdapterMessageId` request minus
3490
+ * `sessionId` / `turnId`, which the seam supplies from the ingested turn.
3434
3491
  */
3435
- declare class SessionLogger {
3436
- private readonly bus;
3437
- private readonly options;
3438
- private readonly cleanups;
3439
- private readonly transform;
3440
- constructor(bus?: IMakaioBus, options?: SessionLoggerOptions);
3441
- /**
3442
- * Emit a session event to storage layer.
3443
- *
3444
- * Creates event envelope, applies transform, and emits to storage subject.
3445
- * If transform returns null, event is skipped.
3446
- * @param eventType - Event type for classification
3447
- * @param sessionId - Session identifier
3448
- * @param payload - Event payload to persist
3449
- */
3450
- private emitStorageEvent;
3451
- /**
3452
- * Register a handler for a session event subject.
3453
- * @param subject - Subject definition to subscribe to
3454
- * @param eventType - Event type for persistence
3455
- */
3456
- private registerHandler;
3492
+ interface IngestTurnMessage {
3493
+ /** Adapter's message ID (external record uuid) — the idempotency key. */
3494
+ adapterMessageId: string;
3495
+ /** Message role. */
3496
+ role: 'user' | 'assistant';
3497
+ /** Plain text content for FTS indexing. */
3498
+ contentText: string;
3499
+ /** Structured content blocks. */
3500
+ blocks: SessionMessageBlock[];
3501
+ /** Agent ID (for assistant messages). */
3502
+ agentId?: string;
3503
+ /** Adapter's session ID. */
3504
+ adapterSessionId?: string;
3505
+ /** Message timestamp (Unix ms). */
3506
+ timestamp: number;
3507
+ /** Origin of the message (e.g. voice/text). */
3508
+ origin?: SessionMessageOrigin;
3509
+ }
3510
+ /**
3511
+ * Parameters for {@link ingestCompletedTurn}.
3512
+ */
3513
+ interface IngestCompletedTurnParams {
3514
+ /** Makaio session the turn belongs to. */
3515
+ sessionId: string;
3457
3516
  /**
3458
- * Register all session lifecycle event handlers.
3459
- *
3460
- * **Normalized Message Model:**
3461
- * - User messages are stored in `messages` table by SessionOrchestrator
3462
- * - Assistant messages are stored by SessionBridge on agent.complete
3463
- * - SessionLogger only stores LIFECYCLE events for audit/correlation
3517
+ * Content-derived idempotency anchor the adapterMessageId of the
3518
+ * turn-start user message. Re-ingesting the same anchor is a no-op.
3464
3519
  */
3465
- private registerHandlers;
3520
+ turnAnchorId: string;
3521
+ /** Turn start timestamp (Unix ms). */
3522
+ startedAt: number;
3523
+ /** Turn completion timestamp (Unix ms). */
3524
+ completedAt: number;
3525
+ /** Final turn status. */
3526
+ status: 'completed' | 'error';
3527
+ /** Error message when status is 'error'. */
3528
+ error?: string;
3529
+ /** Aggregated token usage for the turn. */
3530
+ usage?: TurnUsage;
3531
+ /** Actor provenance of whoever started the turn. */
3532
+ initiator?: TurnInitiator;
3533
+ /** Whether this emission is live ingestion or historical backfill. */
3534
+ ingestionMarker: TurnIngestionMarker;
3535
+ /** Messages of the turn, in transcript order. */
3536
+ messages: IngestTurnMessage[];
3537
+ }
3538
+ /**
3539
+ * Result of {@link ingestCompletedTurn}.
3540
+ */
3541
+ interface IngestCompletedTurnResult {
3542
+ /** Makaio turn ID (stable across re-ingestion of the same anchor). */
3543
+ turnId: string;
3544
+ /** Monotonic per-session ordinal (stable across re-ingestion). */
3545
+ turnNumber: number;
3546
+ /** True on first ingestion; false when the anchor already existed. */
3547
+ created: boolean;
3548
+ }
3549
+ /**
3550
+ * Ingest an externally-completed turn: persist the turn row and its messages,
3551
+ * then emit the canonical `session.turn.*` events exactly once.
3552
+ *
3553
+ * Steps (persist-before-emit by construction):
3554
+ * 1. Upsert the turn row via `storage:turn.ingestCompleted` (anchor-keyed).
3555
+ * Uses `bus.request`, not `requestOptional`: import paths always run with
3556
+ * turn storage registered — a missing handler is a caller error and must
3557
+ * surface, not silently drop the turn.
3558
+ * 2. Upsert every message via `storage:message.upsertByAdapterMessageId`
3559
+ * with the real `turnId`. NEVER `storage:message.append` — append mints
3560
+ * fresh messageIds and would break re-import idempotency.
3561
+ * 3. When the turn's `session.turn.*` side effects have not completed yet:
3562
+ * persist `turn.started` / `turn.completed` lifecycle rows into
3563
+ * `session_events` (deterministic eventIds, idempotent appends), then emit
3564
+ * `session.turn.started` followed by `session.turn.completed`.
3565
+ * 4. Return the stable `(turnId, turnNumber)` identity plus `created`.
3566
+ *
3567
+ * Both events are emitted AFTER all persistence resolves. This deliberately
3568
+ * differs from the managed orchestration path, which emits `turn.started`
3569
+ * before routing to agents: here the turn is already finished, so there is
3570
+ * no in-progress phase to signal — and emitting only after persistence is
3571
+ * what guarantees the four-point consumer contract (session row, completed
3572
+ * turn row, `getByTurn`-queryable messages, complete event payload) holds
3573
+ * at emission time.
3574
+ *
3575
+ * Invariants:
3576
+ * - (a) Never touches SessionTurnManager in-memory state
3577
+ * (`activeTurns` / `completingSessions`) — the turn is already complete
3578
+ * and never passes through the live turn lifecycle.
3579
+ * - (b) Re-ingestion of the same anchor is a storage no-op and re-emits
3580
+ * nothing once the `turn.completed` lifecycle row is durable. Emission is
3581
+ * NOT gated on the anchor claim alone: a prior ingestion that claimed the
3582
+ * anchor but failed before its side effects completed (partial message
3583
+ * upsert, lifecycle append failure) leaves that row absent, and the next
3584
+ * ingestion of the same anchor resumes the emission instead of suppressing
3585
+ * it forever. Executions are serialized per anchor so concurrent hook- and
3586
+ * watcher-triggered ingestion stays exactly-once. Residual window: a
3587
+ * process crash between the lifecycle append and the bus emit loses that
3588
+ * emission (the durable row already claims it) — an accepted at-most-once
3589
+ * bound absent a transactional outbox. Without session-event storage
3590
+ * registered, resume detection is impossible and emission falls back to
3591
+ * first-ingestion-only.
3592
+ * - (c) The four-point consumer contract holds when `session.turn.*` fires.
3593
+ *
3594
+ * Guard: when `params.messages` is empty, event emission is skipped
3595
+ * (contract point 3 — `getByTurn` — would be unfulfillable) and a warning is
3596
+ * logged; the turn row still persists, and a later re-ingestion that carries
3597
+ * messages emits via the resume path.
3598
+ * @param bus - Bus used for storage requests and event emission
3599
+ * @param params - Turn identity, completion state, marker, and messages
3600
+ * @returns Stable turn identity and whether this call created the turn
3601
+ */
3602
+ declare function ingestCompletedTurn(bus: IMakaioBus, params: IngestCompletedTurnParams): Promise<IngestCompletedTurnResult>;
3603
+ //#endregion
3604
+ //#region services/core/src/session/observed-session-ingestion.d.ts
3605
+ /**
3606
+ * Minimal local mirror of the log-import bus subjects this component calls.
3607
+ *
3608
+ * The log-import service package depends on this package, so importing its
3609
+ * subject definitions here would create a package cycle. Bus subjects are
3610
+ * matched by fully-qualified name and payloads are validated against the
3611
+ * schemas registered by the owning service at boot — these mirrored
3612
+ * definitions are type carriers for the fields this component reads and
3613
+ * writes, not a second source of truth. Canonical schemas live with the
3614
+ * log-import service.
3615
+ *
3616
+ * Exported for tests that stub the log-import seam; not part of the public
3617
+ * session API surface.
3618
+ * @internal
3619
+ */
3620
+ declare const LogImportTriggerSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatSubjectDefinitions<"log-import", {
3621
+ /** Mirror of `log-import.listImporters` (adapterName/clientId subset). */listImporters: {
3622
+ request: z.ZodObject<{}, z.core.$strip>;
3623
+ response: z.ZodObject<{
3624
+ importers: z.ZodArray<z.ZodObject<{
3625
+ adapterName: z.ZodString;
3626
+ clientId: z.ZodOptional<z.ZodString>;
3627
+ }, z.core.$strip>>;
3628
+ }, z.core.$strip>;
3629
+ }; /** Mirror of `log-import.importFile` (path-addressable import trigger). */
3630
+ importFile: {
3631
+ request: z.ZodObject<{
3632
+ filePath: z.ZodString;
3633
+ adapterName: z.ZodString;
3634
+ ingestionMarker: z.ZodOptional<z.ZodEnum<{
3635
+ live: "live";
3636
+ backfill: "backfill";
3637
+ }>>;
3638
+ }, z.core.$strip>;
3639
+ response: z.ZodDiscriminatedUnion<[z.ZodObject<{
3640
+ status: z.ZodLiteral<"imported">;
3641
+ sessionId: z.ZodString;
3642
+ messageCount: z.ZodNumber;
3643
+ turnCount: z.ZodNumber;
3644
+ }, z.core.$strip>, z.ZodObject<{
3645
+ status: z.ZodLiteral<"skipped">;
3646
+ reason: z.ZodEnum<{
3647
+ "no-importer": "no-importer";
3648
+ "file-missing": "file-missing";
3649
+ }>;
3650
+ }, z.core.$strip>], "status">;
3651
+ }; /** Mirror of `log-import.importSession` (discovery-stub-based trigger). */
3652
+ importSession: {
3653
+ request: z.ZodObject<{
3654
+ adapterSessionId: z.ZodString;
3655
+ adapterName: z.ZodString;
3656
+ ingestionMarker: z.ZodOptional<z.ZodEnum<{
3657
+ live: "live";
3658
+ backfill: "backfill";
3659
+ }>>;
3660
+ }, z.core.$strip>;
3661
+ response: z.ZodObject<{
3662
+ sessionId: z.ZodString;
3663
+ messageCount: z.ZodNumber;
3664
+ }, z.core.$strip>;
3665
+ };
3666
+ }>, "log-import">;
3667
+ /**
3668
+ * Check whether a stored session represents a metadata-only observed session.
3669
+ *
3670
+ * Plain discovery scans also use `importStatus: 'discovered'`; the client id
3671
+ * distinguishes hook-observed metadata-only registrations from scan-discovered
3672
+ * sessions that are still eligible for explicit lazy import.
3673
+ * @param session - Stored session row
3674
+ * @returns True when content import must be suppressed
3675
+ */
3676
+ declare function isPolicyDiscoveredObservedSession(session: Pick<IMakaioSession, 'clientId' | 'importStatus'>): boolean;
3677
+ //#endregion
3678
+ //#region services/core/src/session/observed-session-ingestion-policy.d.ts
3679
+ /** Capability id used for observed-session ingestion policy providers. */
3680
+ declare const OBSERVED_SESSION_INGESTION_POLICY_CAPABILITY_ID = "observed-session-ingestion-policy";
3681
+ /** Import lifecycle status a policy can choose for an observed session. */
3682
+ type ObservedSessionIngestionPolicyImportStatus = 'tracking' | 'discovered';
3683
+ /** Decision returned by an observed-session ingestion policy provider. */
3684
+ interface ObservedSessionIngestionPolicyDecision {
3685
+ /** `tracking` imports transcript content; `discovered` registers metadata only. */
3686
+ readonly importStatus: ObservedSessionIngestionPolicyImportStatus;
3687
+ }
3688
+ /** Inputs available when deciding how an observed session should be ingested. */
3689
+ interface ObservedSessionIngestionPolicyInput {
3690
+ /** Stable client id that emitted the observation. */
3691
+ readonly clientId: string;
3692
+ /** Observation source, such as `native-hook` or `adapter-derived`. */
3693
+ readonly source: string;
3694
+ /** External session id reported by the client runtime. */
3695
+ readonly adapterSessionId: string;
3696
+ /** Canonical importer adapter name that would own content import. */
3697
+ readonly adapterName: string;
3698
+ /** Working directory observed at session start, when available. */
3699
+ readonly cwd?: string;
3700
+ /** Transcript path observed from the client runtime, when available. */
3701
+ readonly transcriptPath?: string;
3702
+ }
3703
+ /** Capability provider that decides observed-session content ingestion policy. */
3704
+ interface IObservedSessionIngestionPolicyProvider extends ICapabilityProvider {
3466
3705
  /**
3467
- * Stop the logger and clean up subscriptions.
3706
+ * Decide whether an observed session should content-import or metadata-register only.
3707
+ * @param input - Observed session identity and importer context
3708
+ * @returns Ingestion policy decision
3468
3709
  */
3469
- destroy(): void;
3710
+ decideObservedSessionIngestion(input: ObservedSessionIngestionPolicyInput): ObservedSessionIngestionPolicyDecision | Promise<ObservedSessionIngestionPolicyDecision>;
3470
3711
  }
3712
+ /**
3713
+ * Register an observed-session ingestion policy provider.
3714
+ * @param bus - Makaio bus instance
3715
+ * @param provider - Policy provider to register
3716
+ * @returns Promise that resolves after registration handlers have completed
3717
+ */
3718
+ declare function registerObservedSessionIngestionPolicyProvider(bus: IMakaioBus, provider: IObservedSessionIngestionPolicyProvider): Promise<void>;
3719
+ /**
3720
+ * Unregister an observed-session ingestion policy provider.
3721
+ * @param bus - Makaio bus instance
3722
+ * @param providerId - Policy provider id to remove
3723
+ * @returns Promise that resolves after unregistration handlers have completed
3724
+ */
3725
+ declare function unregisterObservedSessionIngestionPolicyProvider(bus: IMakaioBus, providerId: string): Promise<void>;
3471
3726
  //#endregion
3472
3727
  //#region services/core/src/session/import-cursors/schema.d.ts
3473
3728
  /**
@@ -3836,6 +4091,17 @@ declare const turnsDual: _$_makaio_storage_drizzle0.DualTable<"turns", {
3836
4091
  * Stored as hand-stringified JSON because turn.create uses a raw SQL CTE.
3837
4092
  */
3838
4093
  initiator: _$_makaio_storage_drizzle0.DualBuilder<_$drizzle_orm_sqlite_core0.SQLiteTextBuilderInitial<"initiator", [string, ...string[]], number | undefined>, _$drizzle_orm_pg_core0.PgTextBuilderInitial<"initiator", [string, ...string[]]>>;
4094
+ /**
4095
+ * Content-derived idempotency anchor for turns ingested from external
4096
+ * transcripts — the adapterMessageId (external record uuid) of the
4097
+ * turn-start user message. NULL for turns created by the managed
4098
+ * orchestration path (storage:turn.create).
4099
+ *
4100
+ * Backs the ON CONFLICT target of storage:turn.ingestCompleted so
4101
+ * re-parsing the same transcript (including compaction re-reads from
4102
+ * byte 0) resolves to the existing turn row and never renumbers.
4103
+ */
4104
+ turnAnchorId: _$_makaio_storage_drizzle0.DualBuilder<_$drizzle_orm_sqlite_core0.SQLiteTextBuilderInitial<"turn_anchor_id", [string, ...string[]], number | undefined>, _$drizzle_orm_pg_core0.PgTextBuilderInitial<"turn_anchor_id", [string, ...string[]]>>;
3839
4105
  }>;
3840
4106
  /** SQLite face of the `turns` table (canonical schema). */
3841
4107
  declare const turns: _$drizzle_orm_sqlite_core0.SQLiteTableWithColumns<{
@@ -4007,6 +4273,25 @@ declare const turns: _$drizzle_orm_sqlite_core0.SQLiteTableWithColumns<{
4007
4273
  }, {}, {
4008
4274
  length: number | undefined;
4009
4275
  }>;
4276
+ turnAnchorId: _$drizzle_orm_sqlite_core0.SQLiteColumn<{
4277
+ name: "turn_anchor_id";
4278
+ tableName: "turns";
4279
+ dataType: "string";
4280
+ columnType: "SQLiteText";
4281
+ data: string;
4282
+ driverParam: string;
4283
+ notNull: false;
4284
+ hasDefault: false;
4285
+ isPrimaryKey: false;
4286
+ isAutoincrement: false;
4287
+ hasRuntimeDefault: false;
4288
+ enumValues: [string, ...string[]];
4289
+ baseColumn: never;
4290
+ identity: undefined;
4291
+ generated: undefined;
4292
+ }, {}, {
4293
+ length: number | undefined;
4294
+ }>;
4010
4295
  };
4011
4296
  dialect: "sqlite";
4012
4297
  }>;
@@ -4998,4 +5283,4 @@ declare function buildSessionContext(bus: IMakaioBus, options: BuildContextOptio
4998
5283
  */
4999
5284
  declare function getFullConversation(bus: IMakaioBus, sessionId: string): Promise<ContextAssemblyResult>;
5000
5285
  //#endregion
5001
- export { fetchMessageCountsBySession as $, registerMemoryTurnStorage as A, RecoveryConfig as At, registerMemorySessionEventStorage as B, findTurnByAgent as Bt, messages as C, registerGetStatusCountsHandler as Ct, SelectTurn as D, ContextWindowTrackerConfig as Dt, InsertTurn as E, AgentContextState as Et, importCursorsDual as F, verifyAndRecoverAgents as Ft, getSessionAncestorChain as G, TurnContextEnricher as Gt, SelectSessionEvent as H, resolveTargetAgents as Ht, EventTransform as I, buildRecoveryContext as It, mapAgentsBySession as J, SessionOrchestrator as Jt, SessionPreviewMaps as K, AdapterRegistry as Kt, SessionLogger as L, resolveAdapterId as Lt, EmbeddingIndexManager as M, ensureAgentCwd as Mt, registerDrizzleImportCursorStorage as N, ensureAgentModel as Nt, turns as O, SessionContextWindowState as Ot, importCursors as P, recoverAgent as Pt, fetchAgentsBySession as Q, SessionLoggerOptions as R, resolveExecutionTarget as Rt, SelectMessage as S, actionRegistry as St, registerDrizzleMessageStorage as T, ContextWindowTracker as Tt, sessionEvents as U, extractTextContent as Ut, InsertSessionEvent as V, getOrCreateSession as Vt, sessionEventsDual as W, normalizeToBlocks as Wt, SearchFilters as X, MakaioSessionService as Xt, mapToSession as Y, registerCoreSessionServiceHandlers as Yt, SearchSessionRow as Z, messageRoutingDual as _, normalizeSelectionString as _t, kindToBranchKind as a, registerMemoryAgentStorage as at, MessageRoutingSubjects as b, registerBuiltInActions as bt, registerSpawningToolCallResolver as c, AgentStorageNamespace as ct, MakaioSession as d, createSessionExtensionContext as dt, fetchPreviewBySession as et, MakaioSessionConfig as f, SessionBridge as ft, messageRouting as g, CONNECTOR_SWAP_DEFAULT_PIPELINE as gt, SelectMessageRouting as h, pickFallbackRuntimeOptions as ht, ContextAssemblyResult as i, registerDrizzleAgentStorage as it, registerDrizzleTurnStorage as j, buildRecoveryContextWithPipeline as jt, turnsDual as k, buildTurnInitiator as kt, registerCompressLineageResolver as l, AgentStorageSubjects as lt, InsertMessageRouting as m, FallbackRuntimeOptions as mt, buildSessionContext as n, parseForkTransforms as nt, toSessionLineage as o, registerDrizzleSessionStorage as ot, StartTurnOptions as p, assembleForkContext as pt, fetchSessionPreviewMaps as q, ISessionOrchestrator as qt, BuildContextOptions as r, registerFtsSearchHandler as rt, registerSessionDiscoveredHandler as s, registerMemorySessionStorage as st, getFullConversation as t, mapRowToSession as tt, registerParentResolver as u, SessionExtensionContextImpl as ut, registerDrizzleMessageRoutingStorage as v, resolveAdapterNameById as vt, registerMemoryMessageStorage as w, registerResumeHandler as wt, InsertMessage as x, resetBuiltInActionsRegistration as xt, MessageRoutingNamespace as y, registerListActionsHandler as yt, registerDrizzleSessionEventStorage as z, resolveModelCapabilities as zt };
5286
+ export { emitSessionTurnStarted as $, resolveAdapterId as $t, registerMemoryTurnStorage as A, FallbackRuntimeOptions as At, ObservedSessionIngestionPolicyInput as B, registerResumeHandler as Bt, messages as C, registerMemorySessionStorage as Ct, SelectTurn as D, createSessionExtensionContext as Dt, InsertTurn as E, SessionExtensionContextImpl as Et, importCursorsDual as F, registerListActionsHandler as Ft, IngestCompletedTurnParams as G, buildTurnInitiator as Gt, unregisterObservedSessionIngestionPolicyProvider as H, AgentContextState as Ht, IObservedSessionIngestionPolicyProvider as I, registerBuiltInActions as It, ingestCompletedTurn as J, ensureAgentCwd as Jt, IngestCompletedTurnResult as K, RecoveryConfig as Kt, OBSERVED_SESSION_INGESTION_POLICY_CAPABILITY_ID as L, resetBuiltInActionsRegistration as Lt, EmbeddingIndexManager as M, CONNECTOR_SWAP_DEFAULT_PIPELINE as Mt, registerDrizzleImportCursorStorage as N, normalizeSelectionString as Nt, turns as O, SessionBridge as Ot, importCursors as P, resolveAdapterNameById as Pt, appendSessionLifecycleEvent as Q, buildRecoveryContext as Qt, ObservedSessionIngestionPolicyDecision as R, actionRegistry as Rt, SelectMessage as S, registerDrizzleSessionStorage as St, registerDrizzleMessageStorage as T, AgentStorageSubjects as Tt, LogImportTriggerSubjects as U, ContextWindowTrackerConfig as Ut, registerObservedSessionIngestionPolicyProvider as V, ContextWindowTracker as Vt, isPolicyDiscoveredObservedSession as W, SessionContextWindowState as Wt, SessionLifecycleEventArgs as X, recoverAgent as Xt, EventTransform as Y, ensureAgentModel as Yt, SessionTurnStartedPayload as Z, verifyAndRecoverAgents as Zt, messageRoutingDual as _, mapRowToSession as _t, kindToBranchKind as a, extractTextContent as an, sessionEvents as at, MessageRoutingSubjects as b, registerDrizzleAgentStorage as bt, registerSpawningToolCallResolver as c, AdapterRegistry as cn, SessionPreviewMaps as ct, MakaioSession as d, registerCoreSessionServiceHandlers as dn, mapToSession as dt, resolveExecutionTarget as en, registerSessionLifecycleEventWriters as et, MakaioSessionConfig as f, MakaioSessionService as fn, SearchFilters as ft, messageRouting as g, fetchPreviewBySession as gt, SelectMessageRouting as h, fetchMessageCountsBySession as ht, ContextAssemblyResult as i, resolveTargetAgents as in, SelectSessionEvent as it, registerDrizzleTurnStorage as j, pickFallbackRuntimeOptions as jt, turnsDual as k, assembleForkContext as kt, registerCompressLineageResolver as l, ISessionOrchestrator as ln, fetchSessionPreviewMaps as lt, InsertMessageRouting as m, fetchAgentsBySession as mt, buildSessionContext as n, findTurnByAgent as nn, registerMemorySessionEventStorage as nt, toSessionLineage as o, normalizeToBlocks as on, sessionEventsDual as ot, StartTurnOptions as p, SearchSessionRow as pt, IngestTurnMessage as q, buildRecoveryContextWithPipeline as qt, BuildContextOptions as r, getOrCreateSession as rn, InsertSessionEvent as rt, registerSessionDiscoveredHandler as s, TurnContextEnricher as sn, getSessionAncestorChain as st, getFullConversation as t, resolveModelCapabilities as tn, registerDrizzleSessionEventStorage as tt, registerParentResolver as u, SessionOrchestrator as un, mapAgentsBySession as ut, registerDrizzleMessageRoutingStorage as v, parseForkTransforms as vt, registerMemoryMessageStorage as w, AgentStorageNamespace as wt, InsertMessage as x, registerMemoryAgentStorage as xt, MessageRoutingNamespace as y, registerFtsSearchHandler as yt, ObservedSessionIngestionPolicyImportStatus as z, registerGetStatusCountsHandler as zt };