@makaio/framework 1.0.0-dev-1783282710723 → 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 (144) 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.mjs +1 -1
  8. package/dist/{client-BcfR-LJC.mjs → client-BgUjVbXX.mjs} +1 -1
  9. package/dist/contracts/adapter/index.d.mts +1 -1
  10. package/dist/contracts/adapter/index.mjs +1 -1
  11. package/dist/contracts/artifact/index.d.mts +1 -1
  12. package/dist/contracts/client/index.d.mts +1 -1
  13. package/dist/contracts/client/index.mjs +1 -1
  14. package/dist/contracts/extension/index.d.mts +3 -3
  15. package/dist/contracts/facet/index.d.mts +1 -1
  16. package/dist/contracts/harness/index.d.mts +1 -1
  17. package/dist/contracts/index.d.mts +24 -24
  18. package/dist/contracts/index.mjs +1 -1
  19. package/dist/contracts/materialization/index.d.mts +3 -3
  20. package/dist/contracts/session/index.d.mts +3 -3
  21. package/dist/contracts/session/index.mjs +1 -1
  22. package/dist/contracts/shared/index.d.mts +1 -1
  23. package/dist/contracts/workflow/index.d.mts +2 -2
  24. package/dist/contracts/workflow/index.mjs +1 -1
  25. package/dist/{definition-DFcxkf2i.d.mts → definition-b9jyJqPD.d.mts} +1 -1
  26. package/dist/drizzle/0021_m_mr8e1j84.sql +3 -0
  27. package/dist/drizzle/0022_m_mr8i4ky3.sql +43 -0
  28. package/dist/drizzle/meta/_journal.json +14 -0
  29. package/dist/{handler-2bPhRn0u.mjs → handler-BFNvtv5t.mjs} +1 -1
  30. package/dist/handlers-v47Gbsr1.mjs +57 -0
  31. package/dist/hooks/index.d.mts +8 -0
  32. package/dist/hooks/index.mjs +1 -1
  33. package/dist/{index-CTEsbp9H.d.mts → index-31vR1sxk.d.mts} +31 -13
  34. package/dist/{index-9b2_jXxq.d.mts → index-3J0HZlPH.d.mts} +372 -87
  35. package/dist/{index-Bh6lHiW4.d.mts → index-3X0368CL.d.mts} +16 -16
  36. package/dist/{index-Y2r0Zvcm.d.mts → index-B5w-0Gg9.d.mts} +4 -4
  37. package/dist/{index-DdBRlm7m.d.mts → index-BKZhnb2B.d.mts} +3 -3
  38. package/dist/{index-gAFwNiJT.d.mts → index-BYfSAJRC.d.mts} +64 -0
  39. package/dist/{index-2fK9iSHI.d.mts → index-BwGfdbI0.d.mts} +9 -9
  40. package/dist/{index-DLy-tc0L.d.mts → index-C5C1tk9f.d.mts} +214 -1
  41. package/dist/{index-CL2T6LVv.d.mts → index-C6Ys8pxt.d.mts} +9 -9
  42. package/dist/{index-NkNbYFud.d.mts → index-CaerrEDH.d.mts} +1 -1
  43. package/dist/{index-CfIW5biI.d.mts → index-D7rWAEY0.d.mts} +1 -0
  44. package/dist/{index-CaOWqztb.d.mts → index-DQYj8-53.d.mts} +1 -1
  45. package/dist/{index-Dg-y1mrq.d.mts → index-DV4nRk0h.d.mts} +14 -14
  46. package/dist/{index-GD-i3DW7.d.mts → index-DvHYpi-J.d.mts} +365 -163
  47. package/dist/{index-BMbmoarE.d.mts → index-O08Q2ikz.d.mts} +8 -8
  48. package/dist/kernel/extension/index.d.mts +1 -1
  49. package/dist/kernel/index.d.mts +2 -2
  50. package/dist/kernel/observability/index.d.mts +1 -1
  51. package/dist/{lib-Ba55od_d.mjs → lib-BOmKyjWD.mjs} +1 -1
  52. package/dist/{lib-CM_BUxN8.mjs → lib-DLZYp5z3.mjs} +1 -1
  53. package/dist/{loop-gate-handlers-BLoGCWMQ.mjs → loop-gate-handlers-Bjmat-K3.mjs} +1 -1
  54. package/dist/{namespace-DGAWYjbO.d.mts → namespace-Bm77p82L.d.mts} +5 -5
  55. package/dist/{namespace-LUNf8zo5.d.mts → namespace-D1_9WVCo.d.mts} +157 -0
  56. package/dist/{namespace-BsYKEMd8.d.mts → namespace-DAj_riOn.d.mts} +138 -0
  57. package/dist/{namespace-KMxsPJwm.d.mts → namespace-DhDY0juT.d.mts} +66 -0
  58. package/dist/{namespace-DXW-voCe.d.mts → namespace-DmqoDDRD.d.mts} +158 -22
  59. package/dist/namespace-dFBD2ZmS.mjs +1 -0
  60. package/dist/node/transports/index.mjs +1 -1
  61. package/dist/orchestrator-shared-ChygCvR1.mjs +1 -0
  62. package/dist/{orchestrator-shared-ChOdIgh6.d.mts → orchestrator-shared-DFLb1otg.d.mts} +9 -3
  63. package/dist/package-BmRhhi-3.mjs +1 -0
  64. package/dist/package.json +1 -1
  65. package/dist/runtime-node/index.mjs +1 -1
  66. package/dist/schema-7aKBGB7S.mjs +1 -0
  67. package/dist/{schema-DHlTAy0N.mjs → schema-CHp6I33k.mjs} +1 -1
  68. package/dist/{schema-D1HrnvT7.d.mts → schema-DLNBajAV.d.mts} +23 -1
  69. package/dist/{schemas-DMCGXlKa.d.mts → schemas-DMMWmWjq.d.mts} +3 -3
  70. package/dist/schemas-DZGnr9Tl.mjs +1 -0
  71. package/dist/{schemas-D-9zNyAM2.d.mts → schemas-DuuVuhHX2.d.mts} +2 -2
  72. package/dist/schemas-ftgVeWIG.mjs +1 -0
  73. package/dist/services/context-rules/index.d.mts +6 -6
  74. package/dist/services/filesystem/namespace.d.mts +12 -12
  75. package/dist/services/filesystem/schemas.d.mts +6 -6
  76. package/dist/services/git/namespace.d.mts +4 -4
  77. package/dist/services/git/schemas.d.mts +3 -3
  78. package/dist/services/harness/index.d.mts +1 -1
  79. package/dist/services/harness/index.mjs +1 -1
  80. package/dist/services/index.d.mts +87 -18
  81. package/dist/services/index.mjs +1 -1
  82. package/dist/services/log-import/browser.d.mts +2 -2
  83. package/dist/services/log-import/index.d.mts +73 -6
  84. package/dist/services/log-import/index.mjs +2 -2
  85. package/dist/services/log-import/log-import.d.mts +1 -1
  86. package/dist/services/log-import/log-import.mjs +1 -1
  87. package/dist/services/log-import/namespace.d.mts +54 -0
  88. package/dist/services/log-import/namespace.mjs +1 -1
  89. package/dist/services/log-import/schemas.d.mts +44 -0
  90. package/dist/services/log-import/schemas.mjs +1 -1
  91. package/dist/services/session/handlers/index.d.mts +1 -1
  92. package/dist/services/session/handlers/index.mjs +1 -1
  93. package/dist/services/session/index.d.mts +9 -9
  94. package/dist/services/session/index.mjs +1 -1
  95. package/dist/services/session/messages/namespace.d.mts +1 -1
  96. package/dist/services/session/messages/namespace.mjs +1 -1
  97. package/dist/services/session/orchestrator-testing/index.d.mts +1 -1
  98. package/dist/services/session/orchestrator-testing/index.mjs +1 -1
  99. package/dist/services/session/session-events/namespace.d.mts +1 -1
  100. package/dist/services/session/session-events/namespace.mjs +1 -1
  101. package/dist/services/session/storage/namespace.d.mts +1 -1
  102. package/dist/services/session/storage/schema.d.mts +1 -1
  103. package/dist/services/session/storage/schema.mjs +1 -1
  104. package/dist/services/session/testing/index.mjs +9 -4
  105. package/dist/services/session/testing/orchestrator-shared.d.mts +1 -1
  106. package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
  107. package/dist/services/session/turns/namespace.d.mts +1 -1
  108. package/dist/services/session/turns/namespace.mjs +1 -1
  109. package/dist/services/settings/namespace.d.mts +2 -2
  110. package/dist/services/subagent-template/index.d.mts +1 -1
  111. package/dist/services/subagent-template/schemas.d.mts +1 -1
  112. package/dist/services/tool-approval/index.mjs +1 -1
  113. package/dist/services/tools/index.mjs +1 -1
  114. package/dist/services/turn/index.d.mts +1 -1
  115. package/dist/services/turn/namespace.d.mts +1 -1
  116. package/dist/services/turn/schemas.d.mts +89 -0
  117. package/dist/services/turn/schemas.mjs +1 -1
  118. package/dist/session-CKWfn3oc.mjs +1 -0
  119. package/dist/session-DCbJwYEU.mjs +69 -0
  120. package/dist/storage/drizzle/index.d.mts +1 -1
  121. package/dist/storage/drizzle/index.mjs +1 -1
  122. package/dist/{tool-approval-service-DEQiipxj.mjs → tool-approval-service-MU_DmJsf.mjs} +1 -1
  123. package/dist/tools-BrNm-een.mjs +1 -0
  124. package/dist/{transition-DnXibkhX.d.mts → transition-Dq41YCkc.d.mts} +1 -1
  125. package/dist/{types-BslClRkH.d.mts → types-BMlzmWp6.d.mts} +11 -1
  126. package/dist/{types-Dur8EtpR.d.mts → types-C76EP81O.d.mts} +125 -82
  127. package/dist/ui-components/index.mjs +1 -1
  128. package/dist/{workflow-BqH6ar-D.mjs → workflow-C1z7I5CI.mjs} +1 -1
  129. package/dist/workflow-engine/index.d.mts +1 -1
  130. package/dist/workflow-engine/index.mjs +1 -1
  131. package/dist/workflow-engine/package.mjs +1 -1
  132. package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
  133. package/package.json +1 -1
  134. package/dist/adapter-DaQqmKOJ.mjs +0 -1
  135. package/dist/handlers-BAycjV02.mjs +0 -41
  136. package/dist/namespace-C-piH3w4.mjs +0 -1
  137. package/dist/orchestrator-shared-Cxk3x8Vs.mjs +0 -1
  138. package/dist/package-B1AXe-oz.mjs +0 -1
  139. package/dist/schema-D6WAI8OL.mjs +0 -1
  140. package/dist/schemas-ArqQTC0Q.mjs +0 -1
  141. package/dist/schemas-uID59wR8.mjs +0 -1
  142. package/dist/session-0nWT4st6.mjs +0 -39
  143. package/dist/session-DH-ja8Ka.mjs +0 -1
  144. package/dist/tools-DFOsOboy.mjs +0 -1
@@ -176,6 +176,42 @@ interface ImportSegmentLineage {
176
176
  /** Message ID where this session diverged from parent (null for root, subagent, and compress). */
177
177
  forkPointMessageId: string | null;
178
178
  }
179
+ /**
180
+ * Reconstructed conversation turn within an import segment.
181
+ *
182
+ * Importers derive this structure from their turn reconstruction (see
183
+ * `TurnTracker`) during {@link LogImporter.processLogFile}. The persistence
184
+ * layer uses it to create real turn rows and link message `turnId`s, so
185
+ * imported messages participate in the same turn model as live sessions.
186
+ * @remarks
187
+ * The `turnAnchorId` is the idempotency anchor for turn upserts: re-parsing
188
+ * the same file (e.g., after compaction forces a re-read from byte 0) must
189
+ * yield the same anchor for the same turn, so existing turn rows are matched
190
+ * instead of duplicated or renumbered. This requirement implies that every
191
+ * synthesized message an importer emits must carry a DETERMINISTIC
192
+ * `adapterMessageId` — random IDs would break anchor stability across
193
+ * re-parses.
194
+ * @see {@link ImportSegment.turns} - Where these turns are carried
195
+ * @see {@link ProcessLogFileResult.turns} - Importer output containing turns
196
+ */
197
+ interface ImportSegmentTurn {
198
+ /**
199
+ * `adapterMessageId` (external record uuid) of the turn-start user message —
200
+ * the idempotency anchor. MUST be stable across re-parses of the same file.
201
+ */
202
+ turnAnchorId: string;
203
+ /**
204
+ * `adapterMessageId`s of ALL messages belonging to this turn, in transcript
205
+ * order (user + assistant).
206
+ */
207
+ adapterMessageIds: string[];
208
+ /** Unix ms timestamp of the turn-start record. */
209
+ startedAt: number;
210
+ /** Unix ms timestamp of the turn-complete record. */
211
+ completedAt: number;
212
+ /** Turn outcome. Defaults to `'completed'` when omitted. */
213
+ status?: 'completed' | 'error';
214
+ }
179
215
  /**
180
216
  * Compaction boundary metadata from the external tool's log.
181
217
  */
@@ -206,6 +242,18 @@ interface ImportSegment {
206
242
  messages: StorageMessagePayload[];
207
243
  /** Compaction metadata from the boundary record (absent if not a compress child). */
208
244
  compaction?: CompactionMetadata;
245
+ /**
246
+ * Reconstructed turns for this segment, in transcript order.
247
+ * Absent when the importer performs no turn reconstruction.
248
+ * @see {@link ImportSegmentTurn}
249
+ */
250
+ turns?: ImportSegmentTurn[];
251
+ /**
252
+ * Per-segment sidechain flag extracted from the tool's log records.
253
+ * `true` when this segment is a sidechain (e.g., a subagent transcript)
254
+ * rather than the main conversation thread.
255
+ */
256
+ isSidechain?: boolean;
209
257
  /** Child segments (compress children, nested compactions). */
210
258
  children?: ImportSegment[];
211
259
  }
@@ -231,12 +279,26 @@ interface ProcessLogFileResult {
231
279
  compressChildren?: ProcessLogFileResult[];
232
280
  /** Compaction metadata from the boundary record. */
233
281
  compactionMetadata?: CompactionMetadata;
282
+ /**
283
+ * Reconstructed turns for this file/segment, in transcript order.
284
+ * Absent when the importer performs no turn reconstruction.
285
+ * @see {@link ImportSegmentTurn}
286
+ */
287
+ turns?: ImportSegmentTurn[];
288
+ /**
289
+ * Per-file/segment sidechain flag extracted from the tool's log records.
290
+ * `true` when the transcript is a sidechain (e.g., a subagent transcript)
291
+ * rather than the main conversation thread.
292
+ */
293
+ isSidechain?: boolean;
234
294
  }
235
295
  /**
236
296
  * Converts a {@link ProcessLogFileResult} to a canonical {@link ImportSegment}.
237
297
  *
238
298
  * Strips bus-emission fields (sessionEvent, messageEvents) and recursively
239
- * converts children, producing the clean structural tree.
299
+ * converts children, producing the clean structural tree. Structural fields
300
+ * (`turns`, `isSidechain`) are not bus-emission data and survive the
301
+ * conversion.
240
302
  * @param result - The full import result from an adapter
241
303
  * @returns A canonical import segment tree
242
304
  */
@@ -273,6 +335,12 @@ interface DiscoveryMetadata {
273
335
  kind?: SessionLineageKind;
274
336
  /** Unix ms timestamp of when the session started in the external tool. */
275
337
  startedAt?: number;
338
+ /**
339
+ * Whether the discovered transcript is a sidechain (e.g., a subagent
340
+ * transcript) rather than the main conversation thread. Extracted from
341
+ * the tool's log records; `undefined` when the format has no such flag.
342
+ */
343
+ isSidechain?: boolean;
276
344
  }
277
345
  /**
278
346
  * Contract for log importers (adapters and extensions).
@@ -769,4 +837,4 @@ declare abstract class BaseLogOrchestrator<TRecord, TState = unknown> {
769
837
  protected queueCursorUpdate(filePath: string, bytesRead: number, startOffset: number, mtime: Date, isJsonFormat: boolean, sessionContext?: ImportCursorPosition['sessionContext'], precedingEventPromises?: Promise<void>[]): Promise<void>;
770
838
  }
771
839
  //#endregion
772
- export { LogImporterConfig as _, CompactionMetadata as a, StorageMessagePayload as b, ExternalToolIdentifiers as c, ImportMetadata as d, ImportSegment as f, LogImporter as g, LogImportTestConfig as h, LogFileChangeEvent as i, ExternalToolMeta as l, LogImportSessionContext as m, LogOrchestratorConfig as n, DiscoveryMetadata as o, ImportSegmentLineage as p, ParseFileResult as r, ExternalToolIdentifier as s, BaseLogOrchestrator as t, ImportCursorPosition as u, NormalizedEvent as v, toImportSegment as x, ProcessLogFileResult as y };
840
+ export { toImportSegment as S, LogImporter as _, CompactionMetadata as a, ProcessLogFileResult as b, ExternalToolIdentifiers as c, ImportMetadata as d, ImportSegment as f, LogImportTestConfig as g, LogImportSessionContext as h, LogFileChangeEvent as i, ExternalToolMeta as l, ImportSegmentTurn as m, LogOrchestratorConfig as n, DiscoveryMetadata as o, ImportSegmentLineage as p, ParseFileResult as r, ExternalToolIdentifier as s, BaseLogOrchestrator as t, ImportCursorPosition as u, LogImporterConfig as v, StorageMessagePayload as x, NormalizedEvent as y };