@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
@@ -18,8 +18,8 @@ import { ExtensionWarningEntry, ExtensionWarningEntrySchema } from "@makaio/fram
18
18
  * detail, not an externally observable state.
19
19
  */
20
20
  declare const ComponentStateSchema: z.ZodEnum<{
21
- discovered: "discovered";
22
21
  failed: "failed";
22
+ discovered: "discovered";
23
23
  stopped: "stopped";
24
24
  active: "active";
25
25
  skipped: "skipped";
@@ -47,8 +47,8 @@ declare const ComponentInfoSchema: z.ZodObject<{
47
47
  name: z.ZodString;
48
48
  displayName: z.ZodString;
49
49
  state: z.ZodEnum<{
50
- discovered: "discovered";
51
50
  failed: "failed";
51
+ discovered: "discovered";
52
52
  stopped: "stopped";
53
53
  active: "active";
54
54
  skipped: "skipped";
@@ -68,8 +68,8 @@ declare const ServiceInfoSchema: z.ZodObject<{
68
68
  name: z.ZodString;
69
69
  displayName: z.ZodString;
70
70
  state: z.ZodEnum<{
71
- discovered: "discovered";
72
71
  failed: "failed";
72
+ discovered: "discovered";
73
73
  stopped: "stopped";
74
74
  active: "active";
75
75
  skipped: "skipped";
@@ -90,8 +90,8 @@ declare const ExtensionInfoSchema: z.ZodObject<{
90
90
  name: z.ZodString;
91
91
  displayName: z.ZodString;
92
92
  state: z.ZodEnum<{
93
- discovered: "discovered";
94
93
  failed: "failed";
94
+ discovered: "discovered";
95
95
  stopped: "stopped";
96
96
  active: "active";
97
97
  skipped: "skipped";
@@ -138,16 +138,16 @@ declare const ExtensionNamespace: _$_makaio_core0.BusNamespaceDefinition<"kernel
138
138
  name: z.ZodString;
139
139
  displayName: z.ZodString;
140
140
  from: z.ZodEnum<{
141
- discovered: "discovered";
142
141
  failed: "failed";
142
+ discovered: "discovered";
143
143
  stopped: "stopped";
144
144
  active: "active";
145
145
  skipped: "skipped";
146
146
  initializing: "initializing";
147
147
  }>;
148
148
  to: z.ZodEnum<{
149
- discovered: "discovered";
150
149
  failed: "failed";
150
+ discovered: "discovered";
151
151
  stopped: "stopped";
152
152
  active: "active";
153
153
  skipped: "skipped";
@@ -181,8 +181,8 @@ declare const ExtensionNamespace: _$_makaio_core0.BusNamespaceDefinition<"kernel
181
181
  name: z.ZodString;
182
182
  displayName: z.ZodString;
183
183
  state: z.ZodEnum<{
184
- discovered: "discovered";
185
184
  failed: "failed";
185
+ discovered: "discovered";
186
186
  stopped: "stopped";
187
187
  active: "active";
188
188
  skipped: "skipped";
@@ -219,8 +219,8 @@ declare const ExtensionNamespace: _$_makaio_core0.BusNamespaceDefinition<"kernel
219
219
  name: z.ZodString;
220
220
  displayName: z.ZodString;
221
221
  state: z.ZodEnum<{
222
- discovered: "discovered";
223
222
  failed: "failed";
223
+ discovered: "discovered";
224
224
  stopped: "stopped";
225
225
  active: "active";
226
226
  skipped: "skipped";
@@ -488,8 +488,8 @@ declare const ExtensionNamespace: _$_makaio_core0.BusNamespaceDefinition<"kernel
488
488
  extensionName: z.ZodString;
489
489
  warnings: z.ZodArray<z.ZodObject<{
490
490
  severity: z.ZodEnum<{
491
- info: "info";
492
491
  degraded: "degraded";
492
+ info: "info";
493
493
  recommended: "recommended";
494
494
  }>;
495
495
  title: z.ZodString;
@@ -528,8 +528,8 @@ declare const ExtensionNamespace: _$_makaio_core0.BusNamespaceDefinition<"kernel
528
528
  extensionName: z.ZodString;
529
529
  warnings: z.ZodArray<z.ZodObject<{
530
530
  severity: z.ZodEnum<{
531
- info: "info";
532
531
  degraded: "degraded";
532
+ info: "info";
533
533
  recommended: "recommended";
534
534
  }>;
535
535
  title: z.ZodString;
@@ -593,16 +593,16 @@ declare const ExtensionSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fla
593
593
  name: z.ZodString;
594
594
  displayName: z.ZodString;
595
595
  from: z.ZodEnum<{
596
- discovered: "discovered";
597
596
  failed: "failed";
597
+ discovered: "discovered";
598
598
  stopped: "stopped";
599
599
  active: "active";
600
600
  skipped: "skipped";
601
601
  initializing: "initializing";
602
602
  }>;
603
603
  to: z.ZodEnum<{
604
- discovered: "discovered";
605
604
  failed: "failed";
605
+ discovered: "discovered";
606
606
  stopped: "stopped";
607
607
  active: "active";
608
608
  skipped: "skipped";
@@ -636,8 +636,8 @@ declare const ExtensionSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fla
636
636
  name: z.ZodString;
637
637
  displayName: z.ZodString;
638
638
  state: z.ZodEnum<{
639
- discovered: "discovered";
640
639
  failed: "failed";
640
+ discovered: "discovered";
641
641
  stopped: "stopped";
642
642
  active: "active";
643
643
  skipped: "skipped";
@@ -674,8 +674,8 @@ declare const ExtensionSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fla
674
674
  name: z.ZodString;
675
675
  displayName: z.ZodString;
676
676
  state: z.ZodEnum<{
677
- discovered: "discovered";
678
677
  failed: "failed";
678
+ discovered: "discovered";
679
679
  stopped: "stopped";
680
680
  active: "active";
681
681
  skipped: "skipped";
@@ -943,8 +943,8 @@ declare const ExtensionSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fla
943
943
  extensionName: z.ZodString;
944
944
  warnings: z.ZodArray<z.ZodObject<{
945
945
  severity: z.ZodEnum<{
946
- info: "info";
947
946
  degraded: "degraded";
947
+ info: "info";
948
948
  recommended: "recommended";
949
949
  }>;
950
950
  title: z.ZodString;
@@ -983,8 +983,8 @@ declare const ExtensionSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fla
983
983
  extensionName: z.ZodString;
984
984
  warnings: z.ZodArray<z.ZodObject<{
985
985
  severity: z.ZodEnum<{
986
- info: "info";
987
986
  degraded: "degraded";
987
+ info: "info";
988
988
  recommended: "recommended";
989
989
  }>;
990
990
  title: z.ZodString;
@@ -141,11 +141,11 @@ declare const HarnessDefinitionCreateSchema: z.ZodObject<{
141
141
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
142
142
  name: z.ZodString;
143
143
  adapterName: z.ZodOptional<z.ZodString>;
144
+ clientId: z.ZodOptional<z.ZodString>;
144
145
  nativeTools: z.ZodObject<{
145
146
  enabled: z.ZodArray<z.ZodString>;
146
147
  disabled: z.ZodArray<z.ZodString>;
147
148
  }, z.core.$strip>;
148
- clientId: z.ZodOptional<z.ZodString>;
149
149
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
150
150
  registryTools: z.ZodObject<{
151
151
  enabled: z.ZodArray<z.ZodString>;
@@ -317,11 +317,11 @@ declare const HarnessSchemas: {
317
317
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
318
318
  name: z.ZodString;
319
319
  adapterName: z.ZodOptional<z.ZodString>;
320
+ clientId: z.ZodOptional<z.ZodString>;
320
321
  nativeTools: z.ZodObject<{
321
322
  enabled: z.ZodArray<z.ZodString>;
322
323
  disabled: z.ZodArray<z.ZodString>;
323
324
  }, z.core.$strip>;
324
- clientId: z.ZodOptional<z.ZodString>;
325
325
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
326
326
  registryTools: z.ZodObject<{
327
327
  enabled: z.ZodArray<z.ZodString>;
@@ -760,11 +760,11 @@ declare const HarnessNamespace: _$_makaio_core0.BusNamespaceDefinition<"harness"
760
760
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
761
761
  name: z.ZodString;
762
762
  adapterName: z.ZodOptional<z.ZodString>;
763
+ clientId: z.ZodOptional<z.ZodString>;
763
764
  nativeTools: z.ZodObject<{
764
765
  enabled: z.ZodArray<z.ZodString>;
765
766
  disabled: z.ZodArray<z.ZodString>;
766
767
  }, z.core.$strip>;
767
- clientId: z.ZodOptional<z.ZodString>;
768
768
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
769
769
  registryTools: z.ZodObject<{
770
770
  enabled: z.ZodArray<z.ZodString>;
@@ -1203,11 +1203,11 @@ declare const HarnessSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatS
1203
1203
  env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1204
1204
  name: z.ZodString;
1205
1205
  adapterName: z.ZodOptional<z.ZodString>;
1206
+ clientId: z.ZodOptional<z.ZodString>;
1206
1207
  nativeTools: z.ZodObject<{
1207
1208
  enabled: z.ZodArray<z.ZodString>;
1208
1209
  disabled: z.ZodArray<z.ZodString>;
1209
1210
  }, z.core.$strip>;
1210
- clientId: z.ZodOptional<z.ZodString>;
1211
1211
  credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1212
1212
  registryTools: z.ZodObject<{
1213
1213
  enabled: z.ZodArray<z.ZodString>;
@@ -1583,9 +1583,9 @@ declare const AdapterNamespace: _$_makaio_core0.BusNamespaceDefinition<"adapter"
1583
1583
  timestamp: _$zod.ZodNumber;
1584
1584
  level: _$zod.ZodOptional<_$zod.ZodEnum<{
1585
1585
  error: "error";
1586
+ warn: "warn";
1586
1587
  debug: "debug";
1587
1588
  info: "info";
1588
- warn: "warn";
1589
1589
  }>>;
1590
1590
  }, _$zod_v4_core0.$strip>;
1591
1591
  error: _$zod.ZodObject<{
@@ -3195,9 +3195,9 @@ declare const AdapterSubjects$1: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fla
3195
3195
  timestamp: _$zod.ZodNumber;
3196
3196
  level: _$zod.ZodOptional<_$zod.ZodEnum<{
3197
3197
  error: "error";
3198
+ warn: "warn";
3198
3199
  debug: "debug";
3199
3200
  info: "info";
3200
- warn: "warn";
3201
3201
  }>>;
3202
3202
  }, _$zod_v4_core0.$strip>;
3203
3203
  error: _$zod.ZodObject<{
@@ -4831,9 +4831,9 @@ declare const AdapterSchemas: {
4831
4831
  timestamp: _$zod.ZodNumber;
4832
4832
  level: _$zod.ZodOptional<_$zod.ZodEnum<{
4833
4833
  error: "error";
4834
+ warn: "warn";
4834
4835
  debug: "debug";
4835
4836
  info: "info";
4836
- warn: "warn";
4837
4837
  }>>;
4838
4838
  }, _$zod_v4_core0.$strip>;
4839
4839
  error: _$zod.ZodObject<{
@@ -201,6 +201,16 @@ type TurnCompleteCallback = (turn: Turn$1, result: TurnCompletionResult) => Prom
201
201
  * `TurnStorageSubjects.create` is unhandled, synthetic IDs are generated
202
202
  * locally. When `TurnStorageSubjects.complete` is unhandled, the turn is
203
203
  * still cleared from memory and `session.turn.completed` is emitted.
204
+ *
205
+ * **Persist-before-emit barrier:** `session.turn.completed` promises the
206
+ * four-point consumer contract, including messages being queryable via
207
+ * `storage:message.getByTurn`. Message persistence (SessionBridge) and turn
208
+ * completion both react to `agent.complete`, and the bus runs event handlers
209
+ * in parallel — so before emitting, `completeTurn` awaits
210
+ * `storage:message.stored` confirmations for the turn's assistant messages
211
+ * (bus-mediated: the manager holds no reference to SessionBridge). The wait
212
+ * is bounded by {@link TURN_COMPLETION_PERSISTENCE_TIMEOUT_MS} and skipped
213
+ * entirely in ephemeral mode.
204
214
  */
205
215
  declare class SessionTurnManager {
206
216
  private readonly bus;
@@ -221,6 +231,18 @@ declare class SessionTurnManager {
221
231
  * the counter and cause duplicate turn numbers if the session continues.
222
232
  */
223
233
  private readonly syntheticTurnCounters;
234
+ /**
235
+ * Stored assistant messages per turnId, counted from `storage:message.stored`.
236
+ *
237
+ * Populated continuously (from construction) so messages persisted before
238
+ * `completeTurn` runs are counted. FIFO-capped at
239
+ * {@link ASSISTANT_PERSISTENCE_COUNTER_CAP}; a turn's entry is deleted when
240
+ * its completion emits, so late `stored` events for an already-emitted turn
241
+ * merely recreate a short-lived entry that the cap eventually evicts.
242
+ */
243
+ private readonly assistantStoredCounts;
244
+ /** Pending persist-before-emit barrier waiters, keyed by turnId. */
245
+ private readonly assistantPersistenceWaiters;
224
246
  /** Bus subscription cleanup functions. */
225
247
  private readonly cleanups;
226
248
  /**
@@ -240,6 +262,15 @@ declare class SessionTurnManager {
240
262
  * @returns The newly created and activated Turn entity
241
263
  */
242
264
  createTurn(sessionId: string, agentIds: string[], initiator?: TurnInitiator, turnId?: string): Promise<Turn$1>;
265
+ /**
266
+ * Discard active in-memory state for a turn that failed before routing began.
267
+ *
268
+ * The storage contract has no turn-delete operation, so this only rolls back
269
+ * the active manager state that would otherwise make the next user message
270
+ * reuse a turn whose first message was never persisted.
271
+ * @param turn - Newly created active turn to discard
272
+ */
273
+ discardActiveTurn(turn: Turn$1): void;
243
274
  /**
244
275
  * Register bus listeners for `agent.usage` and `agent.complete` events.
245
276
  *
@@ -260,6 +291,12 @@ declare class SessionTurnManager {
260
291
  * `TurnStorageSubjects.complete` call. State is cleared only after durable
261
292
  * persistence succeeds; if persistence fails, the state remains intact so
262
293
  * completion can be retried.
294
+ *
295
+ * Before the event fires, the persist-before-emit barrier waits for the
296
+ * turn's assistant messages to be stored (see class docs), then a
297
+ * `turn.completed` lifecycle row is appended to `session_events` — so both
298
+ * message rows and the lifecycle row are durable before consumers observe
299
+ * `session.turn.completed`.
263
300
  * @param turn - The turn to complete
264
301
  * @param result - Turn result (success status and error messages)
265
302
  */
@@ -311,6 +348,33 @@ declare class SessionTurnManager {
311
348
  * @param usageEvent - Usage event to defer until after persistence
312
349
  */
313
350
  private bufferUsageDuringCompletion;
351
+ /**
352
+ * Subscribe to `storage:message.stored` and count stored assistant messages
353
+ * per turnId, resolving any pending barrier waiter on each increment.
354
+ *
355
+ * Registered from the constructor (not `registerCompletionHandlers`) so the
356
+ * barrier also works for callers that drive `completeTurn` directly without
357
+ * wiring the agent-event handlers.
358
+ */
359
+ private registerAssistantPersistenceCounter;
360
+ /**
361
+ * Persist-before-emit barrier: wait until the turn's assistant messages are
362
+ * durably stored (one per agent) or the bounded timeout elapses.
363
+ *
364
+ * Resolution paths, in order:
365
+ * 1. The continuous `storage:message.stored` counter already reached the
366
+ * expected count (messages stored before `completeTurn` ran).
367
+ * 2. `storage:message.getByTurn` is unhandled — no message storage exists,
368
+ * nothing can be waited for (skip).
369
+ * 3. A queryable-state probe already shows the expected assistant messages
370
+ * (covers messages persisted before this manager was constructed).
371
+ * 4. A waiter resolved by the counter reaching the expected count, bounded
372
+ * by {@link TURN_COMPLETION_PERSISTENCE_TIMEOUT_MS} — the timeout is
373
+ * mandatory because SessionBridge persists nothing for agents with zero
374
+ * blocks and no error, and swallows write errors.
375
+ * @param turn - The completing turn (expected count = its agent count)
376
+ */
377
+ private awaitAssistantPersistence;
314
378
  }
315
379
  //#endregion
316
380
  //#region services/core/src/session/handlers/abandon-handler.d.ts
@@ -48,8 +48,8 @@ declare const MaterializationSchemas: {
48
48
  template: z.ZodString;
49
49
  }, z.core.$strip>], "kind">;
50
50
  appliesTo: z.ZodArray<z.ZodEnum<{
51
- artifact: "artifact";
52
51
  workpiece: "workpiece";
52
+ artifact: "artifact";
53
53
  surface: "surface";
54
54
  }>>;
55
55
  valueMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -88,8 +88,8 @@ declare const MaterializationSchemas: {
88
88
  template: z.ZodString;
89
89
  }, z.core.$strip>], "kind">;
90
90
  appliesTo: z.ZodArray<z.ZodEnum<{
91
- artifact: "artifact";
92
91
  workpiece: "workpiece";
92
+ artifact: "artifact";
93
93
  surface: "surface";
94
94
  }>>;
95
95
  valueMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -106,8 +106,8 @@ declare const MaterializationSchemas: {
106
106
  provider: z.ZodString;
107
107
  externalId: z.ZodString;
108
108
  operation: z.ZodEnum<{
109
- deleted: "deleted";
110
109
  upserted: "upserted";
110
+ deleted: "deleted";
111
111
  }>;
112
112
  }, z.core.$strip>; /** Emitted when a provider surface capability set has been resolved. */
113
113
  'capability.resolved': z.ZodObject<{
@@ -153,8 +153,8 @@ declare const MaterializationNamespace: _$_makaio_core0.BusNamespaceDefinition<"
153
153
  template: z.ZodString;
154
154
  }, z.core.$strip>], "kind">;
155
155
  appliesTo: z.ZodArray<z.ZodEnum<{
156
- artifact: "artifact";
157
156
  workpiece: "workpiece";
157
+ artifact: "artifact";
158
158
  surface: "surface";
159
159
  }>>;
160
160
  valueMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -193,8 +193,8 @@ declare const MaterializationNamespace: _$_makaio_core0.BusNamespaceDefinition<"
193
193
  template: z.ZodString;
194
194
  }, z.core.$strip>], "kind">;
195
195
  appliesTo: z.ZodArray<z.ZodEnum<{
196
- artifact: "artifact";
197
196
  workpiece: "workpiece";
197
+ artifact: "artifact";
198
198
  surface: "surface";
199
199
  }>>;
200
200
  valueMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -211,8 +211,8 @@ declare const MaterializationNamespace: _$_makaio_core0.BusNamespaceDefinition<"
211
211
  provider: z.ZodString;
212
212
  externalId: z.ZodString;
213
213
  operation: z.ZodEnum<{
214
- deleted: "deleted";
215
214
  upserted: "upserted";
215
+ deleted: "deleted";
216
216
  }>;
217
217
  }, z.core.$strip>; /** Emitted when a provider surface capability set has been resolved. */
218
218
  'capability.resolved': z.ZodObject<{
@@ -268,8 +268,8 @@ declare const MaterializationSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
268
268
  template: z.ZodString;
269
269
  }, z.core.$strip>], "kind">;
270
270
  appliesTo: z.ZodArray<z.ZodEnum<{
271
- artifact: "artifact";
272
271
  workpiece: "workpiece";
272
+ artifact: "artifact";
273
273
  surface: "surface";
274
274
  }>>;
275
275
  valueMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -308,8 +308,8 @@ declare const MaterializationSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
308
308
  template: z.ZodString;
309
309
  }, z.core.$strip>], "kind">;
310
310
  appliesTo: z.ZodArray<z.ZodEnum<{
311
- artifact: "artifact";
312
311
  workpiece: "workpiece";
312
+ artifact: "artifact";
313
313
  surface: "surface";
314
314
  }>>;
315
315
  valueMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -326,8 +326,8 @@ declare const MaterializationSubjects: _$_makaio_core0.BusSubjects<_$_makaio_cor
326
326
  provider: z.ZodString;
327
327
  externalId: z.ZodString;
328
328
  operation: z.ZodEnum<{
329
- deleted: "deleted";
330
329
  upserted: "upserted";
330
+ deleted: "deleted";
331
331
  }>;
332
332
  }, z.core.$strip>; /** Emitted when a provider surface capability set has been resolved. */
333
333
  'capability.resolved': z.ZodObject<{
@@ -1,4 +1,4 @@
1
- import { It as ArtifactRevision$1 } from "./index-Dg-y1mrq.mjs";
1
+ import { It as ArtifactRevision$1 } from "./index-DV4nRk0h.mjs";
2
2
  import { i as JsonValue$1, t as JsonObjectContractSchema } from "./json-value-DtIkQN7g.mjs";
3
3
  import { z } from "zod";
4
4
  import * as _$_makaio_core0 from "@makaio/framework/core";
@@ -2959,6 +2959,77 @@ declare const WorkflowSchemas: {
2959
2959
  executionId: z.ZodString;
2960
2960
  }, z.core.$strip>;
2961
2961
  };
2962
+ /**
2963
+ * Register an external execution that is not driven by the workflow engine.
2964
+ *
2965
+ * Creates a minimal `workflow_executions` row so that subsequent lifecycle
2966
+ * events (`execution.started`, `frame.*`, `execution.completed/failed`)
2967
+ * satisfy the foreign-key constraints on WorkLog projection tables.
2968
+ *
2969
+ * External executions are not associated with a persisted workflow definition
2970
+ * and do not create coordinator sessions, run-context snapshots, or
2971
+ * runtime state. They exist solely to provide a legitimate parent row for
2972
+ * telemetry projections.
2973
+ *
2974
+ * After registration the caller is responsible for emitting the standard
2975
+ * execution and frame lifecycle events on the bus. The WorkLog projection
2976
+ * consumes them exactly as it does for engine-driven executions.
2977
+ */
2978
+ registerExternalExecution: {
2979
+ request: z.ZodObject<{
2980
+ name: z.ZodString;
2981
+ scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
2982
+ type: z.ZodLiteral<"global">;
2983
+ }, z.core.$strict>, z.ZodObject<{
2984
+ type: z.ZodLiteral<"workspace">;
2985
+ id: z.ZodString;
2986
+ }, z.core.$strict>, z.ZodObject<{
2987
+ type: z.ZodLiteral<"session">;
2988
+ id: z.ZodString;
2989
+ }, z.core.$strict>, z.ZodObject<{
2990
+ type: z.ZodLiteral<"external">;
2991
+ kind: z.ZodString;
2992
+ id: z.ZodString;
2993
+ }, z.core.$strict>], "type">>;
2994
+ artifactRef: z.ZodOptional<z.ZodObject<{
2995
+ kind: z.ZodString;
2996
+ id: z.ZodString;
2997
+ }, z.core.$strip>>;
2998
+ input: z.ZodOptional<z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>;
2999
+ triggerPayload: z.ZodOptional<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>;
3000
+ }, z.core.$strip>;
3001
+ response: z.ZodObject<{
3002
+ executionId: z.ZodString;
3003
+ }, z.core.$strip>;
3004
+ };
3005
+ /**
3006
+ * Complete an external execution by updating its terminal status.
3007
+ *
3008
+ * Callers should also emit the corresponding lifecycle event
3009
+ * (`execution.completed`, `execution.failed`, or `execution.cancelled`)
3010
+ * so that WorkLog projections update the summary row.
3011
+ *
3012
+ * Cross-field invariants (enforced by schema refinement):
3013
+ * - `'failed'` requires a non-empty `error` string.
3014
+ * - `'cancelled'` requires a non-empty `reason` string.
3015
+ * - `'completed'` must not carry `error` or `reason`.
3016
+ */
3017
+ completeExternalExecution: {
3018
+ request: z.ZodObject<{
3019
+ executionId: z.ZodString;
3020
+ status: z.ZodEnum<{
3021
+ completed: "completed";
3022
+ cancelled: "cancelled";
3023
+ failed: "failed";
3024
+ }>;
3025
+ error: z.ZodOptional<z.ZodString>;
3026
+ reason: z.ZodOptional<z.ZodString>;
3027
+ completedAt: z.ZodOptional<z.ZodNumber>;
3028
+ }, z.core.$strip>;
3029
+ response: z.ZodObject<{
3030
+ success: z.ZodBoolean;
3031
+ }, z.core.$strip>;
3032
+ };
2962
3033
  /**
2963
3034
  * Resolve a named role to its full adapter configuration.
2964
3035
  * Called by the workflow executor when an agent step specifies `role`.
@@ -4877,6 +4948,77 @@ declare const WorkflowNamespace$1: _$_makaio_core0.BusNamespaceDefinition<"workf
4877
4948
  executionId: z.ZodString;
4878
4949
  }, z.core.$strip>;
4879
4950
  };
4951
+ /**
4952
+ * Register an external execution that is not driven by the workflow engine.
4953
+ *
4954
+ * Creates a minimal `workflow_executions` row so that subsequent lifecycle
4955
+ * events (`execution.started`, `frame.*`, `execution.completed/failed`)
4956
+ * satisfy the foreign-key constraints on WorkLog projection tables.
4957
+ *
4958
+ * External executions are not associated with a persisted workflow definition
4959
+ * and do not create coordinator sessions, run-context snapshots, or
4960
+ * runtime state. They exist solely to provide a legitimate parent row for
4961
+ * telemetry projections.
4962
+ *
4963
+ * After registration the caller is responsible for emitting the standard
4964
+ * execution and frame lifecycle events on the bus. The WorkLog projection
4965
+ * consumes them exactly as it does for engine-driven executions.
4966
+ */
4967
+ registerExternalExecution: {
4968
+ request: z.ZodObject<{
4969
+ name: z.ZodString;
4970
+ scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
4971
+ type: z.ZodLiteral<"global">;
4972
+ }, z.core.$strict>, z.ZodObject<{
4973
+ type: z.ZodLiteral<"workspace">;
4974
+ id: z.ZodString;
4975
+ }, z.core.$strict>, z.ZodObject<{
4976
+ type: z.ZodLiteral<"session">;
4977
+ id: z.ZodString;
4978
+ }, z.core.$strict>, z.ZodObject<{
4979
+ type: z.ZodLiteral<"external">;
4980
+ kind: z.ZodString;
4981
+ id: z.ZodString;
4982
+ }, z.core.$strict>], "type">>;
4983
+ artifactRef: z.ZodOptional<z.ZodObject<{
4984
+ kind: z.ZodString;
4985
+ id: z.ZodString;
4986
+ }, z.core.$strip>>;
4987
+ input: z.ZodOptional<z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>;
4988
+ triggerPayload: z.ZodOptional<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>;
4989
+ }, z.core.$strip>;
4990
+ response: z.ZodObject<{
4991
+ executionId: z.ZodString;
4992
+ }, z.core.$strip>;
4993
+ };
4994
+ /**
4995
+ * Complete an external execution by updating its terminal status.
4996
+ *
4997
+ * Callers should also emit the corresponding lifecycle event
4998
+ * (`execution.completed`, `execution.failed`, or `execution.cancelled`)
4999
+ * so that WorkLog projections update the summary row.
5000
+ *
5001
+ * Cross-field invariants (enforced by schema refinement):
5002
+ * - `'failed'` requires a non-empty `error` string.
5003
+ * - `'cancelled'` requires a non-empty `reason` string.
5004
+ * - `'completed'` must not carry `error` or `reason`.
5005
+ */
5006
+ completeExternalExecution: {
5007
+ request: z.ZodObject<{
5008
+ executionId: z.ZodString;
5009
+ status: z.ZodEnum<{
5010
+ completed: "completed";
5011
+ cancelled: "cancelled";
5012
+ failed: "failed";
5013
+ }>;
5014
+ error: z.ZodOptional<z.ZodString>;
5015
+ reason: z.ZodOptional<z.ZodString>;
5016
+ completedAt: z.ZodOptional<z.ZodNumber>;
5017
+ }, z.core.$strip>;
5018
+ response: z.ZodObject<{
5019
+ success: z.ZodBoolean;
5020
+ }, z.core.$strip>;
5021
+ };
4880
5022
  /**
4881
5023
  * Resolve a named role to its full adapter configuration.
4882
5024
  * Called by the workflow executor when an agent step specifies `role`.
@@ -6795,6 +6937,77 @@ declare const WorkflowSubjects$1: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fl
6795
6937
  executionId: z.ZodString;
6796
6938
  }, z.core.$strip>;
6797
6939
  };
6940
+ /**
6941
+ * Register an external execution that is not driven by the workflow engine.
6942
+ *
6943
+ * Creates a minimal `workflow_executions` row so that subsequent lifecycle
6944
+ * events (`execution.started`, `frame.*`, `execution.completed/failed`)
6945
+ * satisfy the foreign-key constraints on WorkLog projection tables.
6946
+ *
6947
+ * External executions are not associated with a persisted workflow definition
6948
+ * and do not create coordinator sessions, run-context snapshots, or
6949
+ * runtime state. They exist solely to provide a legitimate parent row for
6950
+ * telemetry projections.
6951
+ *
6952
+ * After registration the caller is responsible for emitting the standard
6953
+ * execution and frame lifecycle events on the bus. The WorkLog projection
6954
+ * consumes them exactly as it does for engine-driven executions.
6955
+ */
6956
+ registerExternalExecution: {
6957
+ request: z.ZodObject<{
6958
+ name: z.ZodString;
6959
+ scope: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
6960
+ type: z.ZodLiteral<"global">;
6961
+ }, z.core.$strict>, z.ZodObject<{
6962
+ type: z.ZodLiteral<"workspace">;
6963
+ id: z.ZodString;
6964
+ }, z.core.$strict>, z.ZodObject<{
6965
+ type: z.ZodLiteral<"session">;
6966
+ id: z.ZodString;
6967
+ }, z.core.$strict>, z.ZodObject<{
6968
+ type: z.ZodLiteral<"external">;
6969
+ kind: z.ZodString;
6970
+ id: z.ZodString;
6971
+ }, z.core.$strict>], "type">>;
6972
+ artifactRef: z.ZodOptional<z.ZodObject<{
6973
+ kind: z.ZodString;
6974
+ id: z.ZodString;
6975
+ }, z.core.$strip>>;
6976
+ input: z.ZodOptional<z.ZodType<_$_makaio_contracts0.JsonValue, unknown, z.core.$ZodTypeInternals<_$_makaio_contracts0.JsonValue, unknown>>>;
6977
+ triggerPayload: z.ZodOptional<z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>>;
6978
+ }, z.core.$strip>;
6979
+ response: z.ZodObject<{
6980
+ executionId: z.ZodString;
6981
+ }, z.core.$strip>;
6982
+ };
6983
+ /**
6984
+ * Complete an external execution by updating its terminal status.
6985
+ *
6986
+ * Callers should also emit the corresponding lifecycle event
6987
+ * (`execution.completed`, `execution.failed`, or `execution.cancelled`)
6988
+ * so that WorkLog projections update the summary row.
6989
+ *
6990
+ * Cross-field invariants (enforced by schema refinement):
6991
+ * - `'failed'` requires a non-empty `error` string.
6992
+ * - `'cancelled'` requires a non-empty `reason` string.
6993
+ * - `'completed'` must not carry `error` or `reason`.
6994
+ */
6995
+ completeExternalExecution: {
6996
+ request: z.ZodObject<{
6997
+ executionId: z.ZodString;
6998
+ status: z.ZodEnum<{
6999
+ completed: "completed";
7000
+ cancelled: "cancelled";
7001
+ failed: "failed";
7002
+ }>;
7003
+ error: z.ZodOptional<z.ZodString>;
7004
+ reason: z.ZodOptional<z.ZodString>;
7005
+ completedAt: z.ZodOptional<z.ZodNumber>;
7006
+ }, z.core.$strip>;
7007
+ response: z.ZodObject<{
7008
+ success: z.ZodBoolean;
7009
+ }, z.core.$strip>;
7010
+ };
6798
7011
  /**
6799
7012
  * Resolve a named role to its full adapter configuration.
6800
7013
  * Called by the workflow executor when an agent step specifies `role`.