@makaio/framework 1.0.0-dev-1781260968078 → 1.0.0-dev-1781367632837

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 (181) hide show
  1. package/README.md +1 -1
  2. package/dist/.makaio-build.json +2 -2
  3. package/dist/adapter-UpcpZDOv.mjs +1 -0
  4. package/dist/adapter-subsystem/index.d.mts +493 -0
  5. package/dist/adapter-subsystem/index.mjs +1 -0
  6. package/dist/adapters/config/index.d.mts +1 -1
  7. package/dist/adapters/index.d.mts +12 -4
  8. package/dist/adapters/index.mjs +1 -1
  9. package/dist/bus/index.mjs +1 -1
  10. package/dist/clients/index.d.mts +4 -7
  11. package/dist/clients/index.mjs +1 -1
  12. package/dist/contracts/adapter/index.d.mts +2 -2
  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/config/index.d.mts +6 -6
  18. package/dist/contracts/extension/index.d.mts +2 -2
  19. package/dist/contracts/facet/index.d.mts +1 -1
  20. package/dist/contracts/index.d.mts +203 -38
  21. package/dist/contracts/index.mjs +1 -1
  22. package/dist/contracts/materialization/index.d.mts +3 -3
  23. package/dist/contracts/provider/index.d.mts +1 -1
  24. package/dist/contracts/session/index.d.mts +3 -3
  25. package/dist/contracts/session/index.mjs +1 -1
  26. package/dist/{definition-SiimP25_.d.mts → definition-DqJOg6Lv.d.mts} +1 -1
  27. package/dist/drizzle/0015_m_mqbh8q5b.sql +1 -0
  28. package/dist/drizzle/0016_m_mqbmq8h7.sql +1 -0
  29. package/dist/drizzle/0017_m_mqbnf924.sql +1 -0
  30. package/dist/drizzle/meta/_journal.json +21 -0
  31. package/dist/{handler-DSfSAlxx.mjs → handler-DqpiV9eA.mjs} +1 -1
  32. package/dist/handlers-BAB4fQNH.mjs +41 -0
  33. package/dist/inbound-hooks/index.d.mts +174 -0
  34. package/dist/inbound-hooks/index.mjs +1 -0
  35. package/dist/{index-BvSyOgTY.d.mts → index-7EPRy0nT.d.mts} +113 -44
  36. package/dist/{index-Cb64d5c5.d.mts → index-B7uYo0C6.d.mts} +20 -3
  37. package/dist/{index-B2xbnMZe.d.mts → index-BCKRUuI2.d.mts} +1 -1
  38. package/dist/{index-CARxIllg.d.mts → index-BFuke0jw.d.mts} +28 -28
  39. package/dist/{index-DTdqGAfH2.d.mts → index-BfUq8fO52.d.mts} +1 -1
  40. package/dist/{index-BtztOqaF.d.mts → index-BheaEhyI.d.mts} +6 -6
  41. package/dist/{index-CZ_TcT6J.d.mts → index-Bibt5jAX.d.mts} +8 -8
  42. package/dist/{index-D5CI1V5d.d.mts → index-C3zfJg6s.d.mts} +16 -16
  43. package/dist/{index-Buo9H8RK.d.mts → index-COPhs8Ay.d.mts} +1 -1
  44. package/dist/{index-CgjslA5-.d.mts → index-CcBAFO-1.d.mts} +4 -4
  45. package/dist/{index-BpniJgxu.d.mts → index-CncH-7wf.d.mts} +16 -16
  46. package/dist/{index-BQiHs8EF.d.mts → index-DdZ9PDEE.d.mts} +24 -24
  47. package/dist/{index-BDRKAxIV.d.mts → index-dAjtejnc.d.mts} +2 -2
  48. package/dist/{index-DDQkhhRo.d.mts → index-qGJoNJon.d.mts} +397 -157
  49. package/dist/{index-BKKNWqkP2.d.mts → index-zgm2j9V92.d.mts} +44 -2
  50. package/dist/kernel/extension/index.d.mts +1 -1
  51. package/dist/kernel/index.d.mts +2 -2
  52. package/dist/kernel/observability/index.d.mts +1 -1
  53. package/dist/mcp-http-server/index.d.mts +132 -19
  54. package/dist/mcp-http-server/index.mjs +1 -1
  55. package/dist/{namespace-D1Iw_d1P.d.mts → namespace--s0d86h-.d.mts} +144 -0
  56. package/dist/{namespace-CHMszppN.d.mts → namespace-6OzA9SwY.d.mts} +26 -26
  57. package/dist/{namespace-CqUGzG53.d.mts → namespace-Bx40zNgT.d.mts} +2 -2
  58. package/dist/{namespace-Ba4bxtHQ.d.mts → namespace-BxxBhcV_.d.mts} +9 -9
  59. package/dist/{namespace-7tsuJhQ9.d.mts → namespace-Cq8ScJGp.d.mts} +94 -58
  60. package/dist/{namespace-B73Sxj5L.d.mts → namespace-DI9_OYOU.d.mts} +6 -6
  61. package/dist/{namespace-DwE2g8Wm.mjs → namespace-Dfq6MDN9.mjs} +1 -1
  62. package/dist/{namespace-BBVtD1gu.d.mts → namespace-Do0AUzwu.d.mts} +6 -6
  63. package/dist/{namespace-DDCjoQUj.d.mts → namespace-aJJfBJU5.d.mts} +170 -0
  64. package/dist/{orchestrator-shared-Dt4WDse7.mjs → orchestrator-shared-BKFXaKPL.mjs} +1 -1
  65. package/dist/{package-BSnp1zOR.d.mts → package--RZnpN2J.d.mts} +2 -3
  66. package/dist/package-BzJvtM5O.mjs +1 -0
  67. package/dist/package-DzN_jdqd.mjs +1 -0
  68. package/dist/package.json +1 -1
  69. package/dist/primitive-runtime-CNC_bSac.mjs +1 -0
  70. package/dist/runtime-node/bus/runtime/namespace.d.mts +8 -8
  71. package/dist/runtime-node/bus/runtime/schemas.d.mts +11 -4
  72. package/dist/runtime-node/bus/runtime/schemas.mjs +1 -1
  73. package/dist/runtime-node/index.d.mts +27 -60
  74. package/dist/runtime-node/index.mjs +26 -26
  75. package/dist/runtime-node/workflow-worker/index.d.mts +1 -1
  76. package/dist/{schema-BNrM9LWb.d.mts → schema-C-yfxlRI.d.mts} +24 -4
  77. package/dist/{schema-BerZmr2q.mjs → schema-C3TgjrsV.mjs} +1 -1
  78. package/dist/{schema-BrnYlDwZ.mjs → schema-CzhOc7TV.mjs} +1 -1
  79. package/dist/{schemas-B5ToLwIs.d.mts → schemas-CJYNpT6v.d.mts} +6 -6
  80. package/dist/{schemas-lqvZ6UpK.d.mts → schemas-CW0h1h6l.d.mts} +3 -3
  81. package/dist/schemas-CuKayWhA.mjs +1 -0
  82. package/dist/{schemas-DAFYpgHk2.d.mts → schemas-DtJWNKZ_2.d.mts} +14 -14
  83. package/dist/{schemas-CkOSG2eJ.d.mts → schemas-t1VR6_b_.d.mts} +3 -3
  84. package/dist/services/adapter-subsystem/index.d.mts +2 -2
  85. package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
  86. package/dist/services/context-rules/index.d.mts +3 -3
  87. package/dist/services/execution-target/index.d.mts +2 -2
  88. package/dist/services/execution-target/namespace.d.mts +1 -1
  89. package/dist/services/execution-target/schemas.d.mts +1 -1
  90. package/dist/services/filesystem/namespace.d.mts +6 -6
  91. package/dist/services/filesystem/schemas.d.mts +3 -3
  92. package/dist/services/git/namespace.d.mts +2 -2
  93. package/dist/services/git/schemas.d.mts +2 -2
  94. package/dist/services/harness/index.d.mts +3 -4
  95. package/dist/services/harness/index.mjs +1 -1
  96. package/dist/services/index.d.mts +147 -50
  97. package/dist/services/index.mjs +1 -1
  98. package/dist/services/log-import/browser.d.mts +2 -2
  99. package/dist/services/log-import/index.d.mts +4 -5
  100. package/dist/services/log-import/index.mjs +1 -1
  101. package/dist/services/log-import/log-import.d.mts +1 -1
  102. package/dist/services/log-import/namespace.d.mts +2 -2
  103. package/dist/services/log-import/schemas.d.mts +1 -1
  104. package/dist/services/provider-context/index.mjs +1 -1
  105. package/dist/services/session/handlers/index.mjs +1 -1
  106. package/dist/services/session/index.d.mts +7 -7
  107. package/dist/services/session/index.mjs +1 -1
  108. package/dist/services/session/messages/namespace.d.mts +1 -1
  109. package/dist/services/session/messages/namespace.mjs +1 -1
  110. package/dist/services/session/orchestrator-testing/index.mjs +1 -1
  111. package/dist/services/session/session-events/namespace.d.mts +1 -1
  112. package/dist/services/session/session-events/namespace.mjs +1 -1
  113. package/dist/services/session/storage/namespace.d.mts +1 -1
  114. package/dist/services/session/storage/schema.d.mts +1 -1
  115. package/dist/services/session/storage/schema.mjs +1 -1
  116. package/dist/services/session/testing/index.mjs +5 -3
  117. package/dist/services/session/testing/orchestrator-shared.mjs +1 -1
  118. package/dist/services/session/turns/namespace.d.mts +1 -1
  119. package/dist/services/session/turns/namespace.mjs +1 -1
  120. package/dist/services/settings/index.mjs +1 -1
  121. package/dist/services/settings/namespace.d.mts +14 -14
  122. package/dist/services/settings/storage/clients-namespace.mjs +1 -1
  123. package/dist/services/settings/storage/extension-configs/namespace.d.mts +3 -3
  124. package/dist/services/settings/storage/index.mjs +1 -1
  125. package/dist/services/settings/storage/providers-namespace.mjs +1 -1
  126. package/dist/services/subagent/index.d.mts +1 -1
  127. package/dist/services/subagent/index.mjs +1 -1
  128. package/dist/services/subagent-template/index.d.mts +1 -1
  129. package/dist/services/subagent-template/schemas.d.mts +1 -1
  130. package/dist/services/tool-approval/index.mjs +1 -1
  131. package/dist/services/tools/index.mjs +1 -1
  132. package/dist/services/tray-menu/index.d.mts +2 -2
  133. package/dist/services/tray-menu/namespace.d.mts +1 -1
  134. package/dist/services/tray-menu/schemas.d.mts +1 -1
  135. package/dist/services/turn/index.d.mts +1 -1
  136. package/dist/services/turn/namespace.d.mts +1 -1
  137. package/dist/services/turn/schemas.d.mts +72 -0
  138. package/dist/services/turn/schemas.mjs +1 -1
  139. package/dist/{session-C1Cami7U.mjs → session-BwX5_k47.mjs} +1 -1
  140. package/dist/session-P4nX60Xx.mjs +39 -0
  141. package/dist/{session-lineage-CXzV_hAP.d.mts → session-lineage-CKg6mErA.d.mts} +1 -1
  142. package/dist/storage/drizzle/index.d.mts +1 -1
  143. package/dist/storage/drizzle/index.mjs +1 -1
  144. package/dist/{tool-approval-service-Cb2F1yT6.mjs → tool-approval-service-DNHV5x0M.mjs} +1 -1
  145. package/dist/{tools-D5DVHC-R.mjs → tools-CQImrHAp.mjs} +1 -1
  146. package/dist/{types-DLVitCZP.d.mts → types-BOuU-0Vs.d.mts} +901 -718
  147. package/dist/{types-D5IMwOkJ.d.mts → types-D0fPFh-D.d.mts} +1 -1
  148. package/dist/{types-BMpIa4fx.d.mts → types-D6jnDjP2.d.mts} +18 -5
  149. package/dist/ui-components/index.d.mts +36 -37
  150. package/dist/ui-views/index.d.mts +2 -2
  151. package/dist/workflow-engine/index.d.mts +49 -16
  152. package/dist/workflow-engine/index.mjs +1 -1
  153. package/dist/workflow-engine/package.d.mts +1 -1
  154. package/dist/workflow-engine/package.mjs +1 -1
  155. package/dist/workflow-engine/workflow-orchestrator.mjs +1 -1
  156. package/package.json +18 -1
  157. package/dist/adapter-Dt2FDMs4.mjs +0 -1
  158. package/dist/drizzle/0001_messages_content_tsv.na.md +0 -18
  159. package/dist/drizzle/meta/0000_snapshot.json +0 -2813
  160. package/dist/drizzle/meta/0001_snapshot.json +0 -2820
  161. package/dist/drizzle/meta/0002_snapshot.json +0 -2827
  162. package/dist/drizzle/meta/0003_snapshot.json +0 -2834
  163. package/dist/drizzle/meta/0004_snapshot.json +0 -2842
  164. package/dist/drizzle/meta/0005_snapshot.json +0 -2849
  165. package/dist/drizzle/meta/0006_snapshot.json +0 -2865
  166. package/dist/drizzle/meta/0007_snapshot.json +0 -2879
  167. package/dist/drizzle/meta/0008_snapshot.json +0 -2886
  168. package/dist/drizzle/meta/0009_snapshot.json +0 -2901
  169. package/dist/drizzle/meta/0010_snapshot.json +0 -2908
  170. package/dist/drizzle/meta/0011_snapshot.json +0 -2915
  171. package/dist/drizzle/meta/0012_snapshot.json +0 -2934
  172. package/dist/drizzle/meta/0013_snapshot.json +0 -2954
  173. package/dist/drizzle/meta/0014_snapshot.json +0 -2959
  174. package/dist/handlers-C8EtpSqK.mjs +0 -41
  175. package/dist/package-Be2Ez4vv.mjs +0 -1
  176. package/dist/package-OE9dMQsq.mjs +0 -1
  177. package/dist/primitive-runtime-Xrc9xh6p.mjs +0 -1
  178. package/dist/schemas-CSUwpaNm.mjs +0 -1
  179. package/dist/session-KnewDVxt.mjs +0 -39
  180. /package/dist/{provider-context-lfG0BpqX.mjs → provider-context-wp4VSJFI.mjs} +0 -0
  181. /package/dist/{shared-schemas-CKe2uN4-.mjs → shared-schemas-DYL7a-No.mjs} +0 -0
@@ -4,6 +4,60 @@ import { z } from "zod";
4
4
  import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
5
5
  import * as _$zod_v4_core0 from "zod/v4/core";
6
6
 
7
+ //#region core/contracts/src/session/schemas/crud.d.ts
8
+ /**
9
+ * Caller-facing fields shared by `session.create` and `session.registerExternal`.
10
+ *
11
+ * Extracted so that both subjects stay in sync — changes here are automatically
12
+ * reflected in both schemas. Both subjects apply {@link refineSpawningToolCallId}
13
+ * over this shape for the `spawningToolCallId` invariant.
14
+ */
15
+ declare const SessionCreateBaseSchema: z.ZodObject<{
16
+ sessionId: z.ZodOptional<z.ZodString>;
17
+ parentSessionId: z.ZodOptional<z.ZodString>;
18
+ contextInheritance: z.ZodOptional<z.ZodEnum<{
19
+ none: "none";
20
+ "parent-history": "parent-history";
21
+ }>>;
22
+ forkPointMessageId: z.ZodOptional<z.ZodString>;
23
+ branchKind: z.ZodOptional<z.ZodEnum<{
24
+ fork: "fork";
25
+ subagent: "subagent";
26
+ compress: "compress";
27
+ branch: "branch";
28
+ rewrite: "rewrite";
29
+ coordinator: "coordinator";
30
+ aside: "aside";
31
+ }>>;
32
+ forkTransforms: z.ZodOptional<z.ZodObject<{
33
+ removedMessageIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
34
+ appliedPipeline: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ actionId: z.ZodString;
36
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
37
+ }, z.core.$strip>>>;
38
+ segments: z.ZodOptional<z.ZodArray<z.ZodObject<{
39
+ fromMessageId: z.ZodString;
40
+ toMessageId: z.ZodString;
41
+ policy: z.ZodEnum<{
42
+ verbatim: "verbatim";
43
+ summarize: "summarize";
44
+ exclude: "exclude";
45
+ }>;
46
+ stripReasoning: z.ZodOptional<z.ZodBoolean>;
47
+ stripToolOutputs: z.ZodOptional<z.ZodBoolean>;
48
+ overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLiteral<"exclude">>>;
49
+ summaryText: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$strip>>>;
51
+ }, z.core.$strip>>;
52
+ title: z.ZodOptional<z.ZodString>;
53
+ targetWorkingDirectory: z.ZodOptional<z.ZodString>;
54
+ executionTargetId: z.ZodOptional<z.ZodString>;
55
+ spawningToolCallId: z.ZodOptional<z.ZodString>;
56
+ originWindowId: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strip>;
58
+ /** Parsed type for {@link SessionCreateBaseSchema}. */
59
+ type SessionCreateBase = z.infer<typeof SessionCreateBaseSchema>;
60
+ //#endregion
7
61
  //#region core/contracts/src/session/schemas/agent.d.ts
8
62
  /**
9
63
  * Agent lifecycle status.
@@ -13,8 +67,8 @@ import * as _$zod_v4_core0 from "zod/v4/core";
13
67
  * - 'disposed': Agent replaced (cross-adapter switch) — retained for message metadata
14
68
  */
15
69
  declare const AgentStatusSchema$1: z.ZodEnum<{
16
- idle: "idle";
17
70
  active: "active";
71
+ idle: "idle";
18
72
  dead: "dead";
19
73
  disposed: "disposed";
20
74
  }>;
@@ -33,6 +87,7 @@ declare const MakaioSessionAgentSchema$1: z.ZodObject<{
33
87
  adapterSessionId: z.ZodOptional<z.ZodString>;
34
88
  model: z.ZodOptional<z.ZodString>;
35
89
  cwd: z.ZodOptional<z.ZodString>;
90
+ allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
36
91
  providerConfigId: z.ZodOptional<z.ZodString>;
37
92
  personaId: z.ZodOptional<z.ZodString>;
38
93
  profileId: z.ZodOptional<z.ZodString>;
@@ -48,8 +103,8 @@ declare const MakaioSessionAgentSchema$1: z.ZodObject<{
48
103
  member: "member";
49
104
  }>;
50
105
  status: z.ZodEnum<{
51
- idle: "idle";
52
106
  active: "active";
107
+ idle: "idle";
53
108
  dead: "dead";
54
109
  disposed: "disposed";
55
110
  }>;
@@ -76,6 +131,7 @@ declare const MakaioSessionSchema: z.ZodObject<{
76
131
  adapterSessionId: z.ZodOptional<z.ZodString>;
77
132
  model: z.ZodOptional<z.ZodString>;
78
133
  cwd: z.ZodOptional<z.ZodString>;
134
+ allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
135
  providerConfigId: z.ZodOptional<z.ZodString>;
80
136
  personaId: z.ZodOptional<z.ZodString>;
81
137
  profileId: z.ZodOptional<z.ZodString>;
@@ -91,8 +147,8 @@ declare const MakaioSessionSchema: z.ZodObject<{
91
147
  member: "member";
92
148
  }>;
93
149
  status: z.ZodEnum<{
94
- idle: "idle";
95
150
  active: "active";
151
+ idle: "idle";
96
152
  dead: "dead";
97
153
  disposed: "disposed";
98
154
  }>;
@@ -100,9 +156,9 @@ declare const MakaioSessionSchema: z.ZodObject<{
100
156
  lastActivityAt: z.ZodNumber;
101
157
  }, z.core.$strip>>;
102
158
  status: z.ZodEnum<{
103
- closed: "closed";
104
159
  active: "active";
105
160
  archived: "archived";
161
+ closed: "closed";
106
162
  discovered: "discovered";
107
163
  }>;
108
164
  leadAgentId: z.ZodOptional<z.ZodString>;
@@ -114,10 +170,10 @@ declare const MakaioSessionSchema: z.ZodObject<{
114
170
  rootSessionId: z.ZodOptional<z.ZodString>;
115
171
  forkPointMessageId: z.ZodOptional<z.ZodString>;
116
172
  branchKind: z.ZodOptional<z.ZodEnum<{
117
- branch: "branch";
118
173
  fork: "fork";
119
174
  subagent: "subagent";
120
175
  compress: "compress";
176
+ branch: "branch";
121
177
  rewrite: "rewrite";
122
178
  coordinator: "coordinator";
123
179
  aside: "aside";
@@ -200,6 +256,7 @@ declare const SessionWithPreviewSchema: z.ZodObject<{
200
256
  adapterSessionId: z.ZodOptional<z.ZodString>;
201
257
  model: z.ZodOptional<z.ZodString>;
202
258
  cwd: z.ZodOptional<z.ZodString>;
259
+ allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
203
260
  providerConfigId: z.ZodOptional<z.ZodString>;
204
261
  personaId: z.ZodOptional<z.ZodString>;
205
262
  profileId: z.ZodOptional<z.ZodString>;
@@ -215,8 +272,8 @@ declare const SessionWithPreviewSchema: z.ZodObject<{
215
272
  member: "member";
216
273
  }>;
217
274
  status: z.ZodEnum<{
218
- idle: "idle";
219
275
  active: "active";
276
+ idle: "idle";
220
277
  dead: "dead";
221
278
  disposed: "disposed";
222
279
  }>;
@@ -224,9 +281,9 @@ declare const SessionWithPreviewSchema: z.ZodObject<{
224
281
  lastActivityAt: z.ZodNumber;
225
282
  }, z.core.$strip>>;
226
283
  status: z.ZodEnum<{
227
- closed: "closed";
228
284
  active: "active";
229
285
  archived: "archived";
286
+ closed: "closed";
230
287
  discovered: "discovered";
231
288
  }>;
232
289
  leadAgentId: z.ZodOptional<z.ZodString>;
@@ -238,10 +295,10 @@ declare const SessionWithPreviewSchema: z.ZodObject<{
238
295
  rootSessionId: z.ZodOptional<z.ZodString>;
239
296
  forkPointMessageId: z.ZodOptional<z.ZodString>;
240
297
  branchKind: z.ZodOptional<z.ZodEnum<{
241
- branch: "branch";
242
298
  fork: "fork";
243
299
  subagent: "subagent";
244
300
  compress: "compress";
301
+ branch: "branch";
245
302
  rewrite: "rewrite";
246
303
  coordinator: "coordinator";
247
304
  aside: "aside";
@@ -398,6 +455,7 @@ declare const SessionSnapshotSchema: z.ZodObject<{
398
455
  adapterSessionId: z.ZodOptional<z.ZodString>;
399
456
  model: z.ZodOptional<z.ZodString>;
400
457
  cwd: z.ZodOptional<z.ZodString>;
458
+ allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
401
459
  providerConfigId: z.ZodOptional<z.ZodString>;
402
460
  personaId: z.ZodOptional<z.ZodString>;
403
461
  profileId: z.ZodOptional<z.ZodString>;
@@ -413,8 +471,8 @@ declare const SessionSnapshotSchema: z.ZodObject<{
413
471
  member: "member";
414
472
  }>;
415
473
  status: z.ZodEnum<{
416
- idle: "idle";
417
474
  active: "active";
475
+ idle: "idle";
418
476
  dead: "dead";
419
477
  disposed: "disposed";
420
478
  }>;
@@ -422,9 +480,9 @@ declare const SessionSnapshotSchema: z.ZodObject<{
422
480
  lastActivityAt: z.ZodNumber;
423
481
  }, z.core.$strip>>;
424
482
  status: z.ZodEnum<{
425
- closed: "closed";
426
483
  active: "active";
427
484
  archived: "archived";
485
+ closed: "closed";
428
486
  discovered: "discovered";
429
487
  }>;
430
488
  leadAgentId: z.ZodOptional<z.ZodString>;
@@ -436,10 +494,10 @@ declare const SessionSnapshotSchema: z.ZodObject<{
436
494
  rootSessionId: z.ZodOptional<z.ZodString>;
437
495
  forkPointMessageId: z.ZodOptional<z.ZodString>;
438
496
  branchKind: z.ZodOptional<z.ZodEnum<{
439
- branch: "branch";
440
497
  fork: "fork";
441
498
  subagent: "subagent";
442
499
  compress: "compress";
500
+ branch: "branch";
443
501
  rewrite: "rewrite";
444
502
  coordinator: "coordinator";
445
503
  aside: "aside";
@@ -507,6 +565,7 @@ declare const SessionSnapshotSchema: z.ZodObject<{
507
565
  adapterSessionId: z.ZodOptional<z.ZodString>;
508
566
  model: z.ZodOptional<z.ZodString>;
509
567
  cwd: z.ZodOptional<z.ZodString>;
568
+ allowedDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
510
569
  providerConfigId: z.ZodOptional<z.ZodString>;
511
570
  personaId: z.ZodOptional<z.ZodString>;
512
571
  profileId: z.ZodOptional<z.ZodString>;
@@ -522,8 +581,8 @@ declare const SessionSnapshotSchema: z.ZodObject<{
522
581
  member: "member";
523
582
  }>;
524
583
  status: z.ZodEnum<{
525
- idle: "idle";
526
584
  active: "active";
585
+ idle: "idle";
527
586
  dead: "dead";
528
587
  disposed: "disposed";
529
588
  }>;
@@ -632,6 +691,14 @@ declare const SessionSnapshotSchema: z.ZodObject<{
632
691
  cost: z.ZodOptional<z.ZodNumber>;
633
692
  }, z.core.$strip>>>;
634
693
  }, z.core.$strip>>;
694
+ initiator: z.ZodOptional<z.ZodObject<{
695
+ source: z.ZodEnum<{
696
+ user: "user";
697
+ system: "system";
698
+ extension: "extension";
699
+ }>;
700
+ sourceId: z.ZodOptional<z.ZodString>;
701
+ }, z.core.$strip>>;
635
702
  }, z.core.$strip>>;
636
703
  events: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
637
704
  sessionId: z.ZodString;
@@ -892,10 +959,10 @@ declare const SessionSnapshotSchema: z.ZodObject<{
892
959
  childSessionId: z.ZodString;
893
960
  parentSessionId: z.ZodString;
894
961
  kind: z.ZodEnum<{
895
- branch: "branch";
896
962
  fork: "fork";
897
963
  subagent: "subagent";
898
964
  compress: "compress";
965
+ branch: "branch";
899
966
  rewrite: "rewrite";
900
967
  coordinator: "coordinator";
901
968
  aside: "aside";
@@ -976,10 +1043,10 @@ type AgentRole = z.infer<typeof AgentRoleSchema>;
976
1043
  * by session boundary (child sessions are never in parent's context assembly)
977
1044
  */
978
1045
  declare const BranchKindSchema: z.ZodEnum<{
979
- branch: "branch";
980
1046
  fork: "fork";
981
1047
  subagent: "subagent";
982
1048
  compress: "compress";
1049
+ branch: "branch";
983
1050
  rewrite: "rewrite";
984
1051
  coordinator: "coordinator";
985
1052
  aside: "aside";
@@ -998,108 +1065,383 @@ declare const ImportStatusSchema: z.ZodEnum<{
998
1065
  }>;
999
1066
  type ImportStatus = z.infer<typeof ImportStatusSchema>;
1000
1067
  //#endregion
1001
- //#region core/contracts/src/session/schemas/orchestrator.d.ts
1068
+ //#region core/contracts/src/session/schemas/message.d.ts
1002
1069
  /**
1003
- * Identifies the origin of a turn for loop prevention and audit.
1070
+ * Session message block types for structured content within stored messages.
1004
1071
  *
1005
- * Used by extensions (e.g., Routine) to distinguish user-initiated turns from
1006
- * extension-initiated turns, preventing recursive execution loops.
1072
+ * Unified with MessageBlock all block types (text, image, document, attachment,
1073
+ * reasoning, tool_call, tool_output) are first-class citizens in both storage
1074
+ * and SDK contexts.
1007
1075
  */
1008
- declare const TurnInitiatorSchema: z.ZodObject<{
1009
- source: z.ZodEnum<{
1010
- user: "user";
1011
- system: "system";
1012
- extension: "extension";
1076
+ declare const SessionMessageBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1077
+ type: z.ZodLiteral<"text">;
1078
+ content: z.ZodString;
1079
+ }, z.core.$strip>, z.ZodObject<{
1080
+ type: z.ZodLiteral<"image">;
1081
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1082
+ type: z.ZodLiteral<"base64">;
1083
+ data: z.ZodString;
1084
+ mimeType: z.ZodString;
1085
+ }, z.core.$strip>, z.ZodObject<{
1086
+ type: z.ZodLiteral<"url">;
1087
+ url: z.ZodString;
1088
+ mimeType: z.ZodOptional<z.ZodString>;
1089
+ }, z.core.$strip>], "type">;
1090
+ }, z.core.$strip>, z.ZodObject<{
1091
+ type: z.ZodLiteral<"document">;
1092
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1093
+ type: z.ZodLiteral<"base64">;
1094
+ data: z.ZodString;
1095
+ mimeType: z.ZodString;
1096
+ }, z.core.$strip>, z.ZodObject<{
1097
+ type: z.ZodLiteral<"url">;
1098
+ url: z.ZodString;
1099
+ mimeType: z.ZodOptional<z.ZodString>;
1100
+ }, z.core.$strip>], "type">;
1101
+ }, z.core.$strip>, z.ZodObject<{
1102
+ type: z.ZodLiteral<"attachment">;
1103
+ fileName: z.ZodString;
1104
+ filePath: z.ZodString;
1105
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1106
+ type: z.ZodLiteral<"base64">;
1107
+ data: z.ZodString;
1108
+ mimeType: z.ZodString;
1109
+ }, z.core.$strip>, z.ZodObject<{
1110
+ type: z.ZodLiteral<"url">;
1111
+ url: z.ZodString;
1112
+ mimeType: z.ZodOptional<z.ZodString>;
1113
+ }, z.core.$strip>], "type">;
1114
+ displayName: z.ZodOptional<z.ZodString>;
1115
+ attachmentType: z.ZodEnum<{
1116
+ file: "file";
1117
+ directory: "directory";
1013
1118
  }>;
1014
- sourceId: z.ZodOptional<z.ZodString>;
1015
- }, z.core.$strip>;
1016
- /** Parsed type for {@link TurnInitiatorSchema}. */
1017
- type TurnInitiator$1 = z.infer<typeof TurnInitiatorSchema>;
1119
+ }, z.core.$strip>, z.ZodObject<{
1120
+ type: z.ZodLiteral<"reasoning">;
1121
+ content: z.ZodString;
1122
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1123
+ }, z.core.$strip>, z.ZodObject<{
1124
+ type: z.ZodLiteral<"tool_call">;
1125
+ toolCallId: z.ZodString;
1126
+ name: z.ZodString;
1127
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1128
+ }, z.core.$strip>, z.ZodObject<{
1129
+ type: z.ZodLiteral<"tool_output">;
1130
+ toolCallId: z.ZodString;
1131
+ output: z.ZodString;
1132
+ isError: z.ZodOptional<z.ZodBoolean>;
1133
+ }, z.core.$strip>], "type">;
1134
+ type SessionMessageBlock$1 = MessageBlock$1;
1018
1135
  /**
1019
- * Orchestrator schemas for turn lifecycle and user message routing.
1136
+ * Session message role in a conversation.
1137
+ */
1138
+ declare const SessionMessageRoleSchema: z.ZodEnum<{
1139
+ user: "user";
1140
+ assistant: "assistant";
1141
+ }>;
1142
+ type SessionMessageRole = z.infer<typeof SessionMessageRoleSchema>;
1143
+ declare const SessionMessageOriginSchema: z.ZodEnum<{
1144
+ text: "text";
1145
+ voice: "voice";
1146
+ compact: "compact";
1147
+ }>;
1148
+ type SessionMessageOrigin = z.infer<typeof SessionMessageOriginSchema>;
1149
+ /**
1150
+ * A stored message in a session conversation.
1020
1151
  *
1021
- * These schemas are owned by SessionOrchestrator, not SessionService.
1022
- * SessionService handles lifecycle (CRUD); orchestrator handles routing/turns.
1152
+ * Distinct from `shared/Message` which is the SDK message format for runtime.
1153
+ * SessionMessage includes storage metadata (messageId, turnId, timestamp, etc.).
1154
+ *
1155
+ * Messages are first-class entities stored in the `messages` table.
1156
+ *
1157
+ * Design principles:
1158
+ * - Single source of truth for conversation content
1159
+ * - Blocks preserve full response fidelity (reasoning, tools)
1160
+ * - contentText extracted for full-text search
1161
+ * - Events remain for lifecycle/audit only
1023
1162
  */
1024
- declare const OrchestratorSchemas: {
1025
- /**
1026
- * Send a message to a session's agents.
1027
- *
1028
- * Subject: `session.sendMessage`
1029
- * Type: Request (RPC)
1030
- *
1031
- * Single entry point for all user messages. Handles:
1032
- * - Creating session if sessionId does not exist
1033
- * - Auto-attaching agent via adapter.startAgent if session has no agents
1034
- * - Turn lifecycle (creates turn if none active)
1035
- * - Routing to targeted agents
1036
- *
1037
- * Default targets lead agent; use `agentIds: 'all'` for broadcast.
1038
- *
1039
- * `responseSchema.schema` is a JSON Schema document serialized as a
1040
- * JSON-safe `Record<string, JsonValue>` so it can cross bus, storage, and
1041
- * provider adapter boundaries without runtime-only values.
1042
- * @example
1043
- * ```typescript
1044
- * // Start new conversation (client generates sessionId)
1045
- * const { sessionId, messageId, turnId } = await bus.request(SessionSubjects.sendMessage, {
1046
- * sessionId: crypto.randomUUID(),
1047
- * agent: { kind: 'adapter', adapterName: 'anthropic-sdk', model: 'sonnet' },
1048
- * message: 'Hello!',
1049
- * });
1050
- *
1051
- * // Continue conversation (agent already attached)
1052
- * await bus.request(SessionSubjects.sendMessage, {
1053
- * sessionId,
1054
- * message: 'Follow-up question',
1055
- * });
1056
- *
1057
- * // Broadcast to all agents
1058
- * await bus.request(SessionSubjects.sendMessage, {
1059
- * sessionId,
1060
- * message: 'What do you all think?',
1061
- * agentIds: 'all',
1062
- * });
1063
- * ```
1064
- */
1065
- sendMessage: {
1066
- request: z.ZodObject<{
1067
- sessionId: z.ZodString;
1068
- message: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1069
- role: z.ZodOptional<z.ZodEnum<{
1070
- user: "user";
1071
- assistant: "assistant";
1072
- system: "system";
1073
- }>>;
1074
- blocks: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
1075
- type: z.ZodLiteral<"text">;
1076
- content: z.ZodString;
1077
- }, z.core.$strip>, z.ZodObject<{
1078
- type: z.ZodLiteral<"image">;
1079
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1080
- type: z.ZodLiteral<"base64">;
1081
- data: z.ZodString;
1082
- mimeType: z.ZodString;
1083
- }, z.core.$strip>, z.ZodObject<{
1084
- type: z.ZodLiteral<"url">;
1085
- url: z.ZodString;
1086
- mimeType: z.ZodOptional<z.ZodString>;
1087
- }, z.core.$strip>], "type">;
1088
- }, z.core.$strip>, z.ZodObject<{
1089
- type: z.ZodLiteral<"document">;
1090
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1091
- type: z.ZodLiteral<"base64">;
1092
- data: z.ZodString;
1093
- mimeType: z.ZodString;
1094
- }, z.core.$strip>, z.ZodObject<{
1095
- type: z.ZodLiteral<"url">;
1096
- url: z.ZodString;
1097
- mimeType: z.ZodOptional<z.ZodString>;
1098
- }, z.core.$strip>], "type">;
1163
+ declare const SessionMessageSchema$1: z.ZodObject<{
1164
+ messageId: z.ZodString;
1165
+ turnId: z.ZodNullable<z.ZodString>;
1166
+ sessionId: z.ZodString;
1167
+ role: z.ZodEnum<{
1168
+ user: "user";
1169
+ assistant: "assistant";
1170
+ }>;
1171
+ contentText: z.ZodString;
1172
+ blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1173
+ type: z.ZodLiteral<"text">;
1174
+ content: z.ZodString;
1175
+ }, z.core.$strip>, z.ZodObject<{
1176
+ type: z.ZodLiteral<"image">;
1177
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1178
+ type: z.ZodLiteral<"base64">;
1179
+ data: z.ZodString;
1180
+ mimeType: z.ZodString;
1181
+ }, z.core.$strip>, z.ZodObject<{
1182
+ type: z.ZodLiteral<"url">;
1183
+ url: z.ZodString;
1184
+ mimeType: z.ZodOptional<z.ZodString>;
1185
+ }, z.core.$strip>], "type">;
1186
+ }, z.core.$strip>, z.ZodObject<{
1187
+ type: z.ZodLiteral<"document">;
1188
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1189
+ type: z.ZodLiteral<"base64">;
1190
+ data: z.ZodString;
1191
+ mimeType: z.ZodString;
1192
+ }, z.core.$strip>, z.ZodObject<{
1193
+ type: z.ZodLiteral<"url">;
1194
+ url: z.ZodString;
1195
+ mimeType: z.ZodOptional<z.ZodString>;
1196
+ }, z.core.$strip>], "type">;
1197
+ }, z.core.$strip>, z.ZodObject<{
1198
+ type: z.ZodLiteral<"attachment">;
1199
+ fileName: z.ZodString;
1200
+ filePath: z.ZodString;
1201
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1202
+ type: z.ZodLiteral<"base64">;
1203
+ data: z.ZodString;
1204
+ mimeType: z.ZodString;
1205
+ }, z.core.$strip>, z.ZodObject<{
1206
+ type: z.ZodLiteral<"url">;
1207
+ url: z.ZodString;
1208
+ mimeType: z.ZodOptional<z.ZodString>;
1209
+ }, z.core.$strip>], "type">;
1210
+ displayName: z.ZodOptional<z.ZodString>;
1211
+ attachmentType: z.ZodEnum<{
1212
+ file: "file";
1213
+ directory: "directory";
1214
+ }>;
1215
+ }, z.core.$strip>, z.ZodObject<{
1216
+ type: z.ZodLiteral<"reasoning">;
1217
+ content: z.ZodString;
1218
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1219
+ }, z.core.$strip>, z.ZodObject<{
1220
+ type: z.ZodLiteral<"tool_call">;
1221
+ toolCallId: z.ZodString;
1222
+ name: z.ZodString;
1223
+ args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1224
+ }, z.core.$strip>, z.ZodObject<{
1225
+ type: z.ZodLiteral<"tool_output">;
1226
+ toolCallId: z.ZodString;
1227
+ output: z.ZodString;
1228
+ isError: z.ZodOptional<z.ZodBoolean>;
1229
+ }, z.core.$strip>], "type">>;
1230
+ agentId: z.ZodOptional<z.ZodString>;
1231
+ adapterSessionId: z.ZodOptional<z.ZodString>;
1232
+ adapterMessageId: z.ZodOptional<z.ZodString>;
1233
+ timestamp: z.ZodNumber;
1234
+ editOf: z.ZodOptional<z.ZodString>;
1235
+ origin: z.ZodOptional<z.ZodEnum<{
1236
+ text: "text";
1237
+ voice: "voice";
1238
+ compact: "compact";
1239
+ }>>;
1240
+ }, z.core.$strip>;
1241
+ type SessionMessage$1 = z.infer<typeof SessionMessageSchema$1>;
1242
+ /**
1243
+ * Turn status in the conversation lifecycle.
1244
+ */
1245
+ declare const TurnStatusSchema$1: z.ZodEnum<{
1246
+ error: "error";
1247
+ completed: "completed";
1248
+ active: "active";
1249
+ }>;
1250
+ type TurnStatus = z.infer<typeof TurnStatusSchema$1>;
1251
+ /**
1252
+ * Usage metrics for a single agent or aggregated total.
1253
+ */
1254
+ declare const UsageMetricsSchema: z.ZodObject<{
1255
+ inputTokens: z.ZodNumber;
1256
+ outputTokens: z.ZodNumber;
1257
+ cost: z.ZodOptional<z.ZodNumber>;
1258
+ }, z.core.$strip>;
1259
+ type UsageMetrics = z.infer<typeof UsageMetricsSchema>;
1260
+ /**
1261
+ * Aggregated usage for a turn, with optional per-agent breakdown.
1262
+ */
1263
+ declare const TurnUsageSchema$1: z.ZodObject<{
1264
+ total: z.ZodObject<{
1265
+ inputTokens: z.ZodNumber;
1266
+ outputTokens: z.ZodNumber;
1267
+ cost: z.ZodOptional<z.ZodNumber>;
1268
+ }, z.core.$strip>;
1269
+ byAgent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1270
+ inputTokens: z.ZodNumber;
1271
+ outputTokens: z.ZodNumber;
1272
+ cost: z.ZodOptional<z.ZodNumber>;
1273
+ }, z.core.$strip>>>;
1274
+ }, z.core.$strip>;
1275
+ type TurnUsage = z.infer<typeof TurnUsageSchema$1>;
1276
+ /**
1277
+ * Identifies the origin of a turn for loop prevention and audit.
1278
+ *
1279
+ * Used by extensions (e.g., Routine) to distinguish user-initiated turns from
1280
+ * extension-initiated turns, preventing recursive execution loops.
1281
+ */
1282
+ declare const TurnInitiatorSchema$1: z.ZodObject<{
1283
+ source: z.ZodEnum<{
1284
+ user: "user";
1285
+ system: "system";
1286
+ extension: "extension";
1287
+ }>;
1288
+ sourceId: z.ZodOptional<z.ZodString>;
1289
+ }, z.core.$strip>;
1290
+ /** Parsed type for {@link TurnInitiatorSchema}. */
1291
+ type TurnInitiator$2 = z.infer<typeof TurnInitiatorSchema$1>;
1292
+ /**
1293
+ * A turn in a session conversation.
1294
+ *
1295
+ * A turn represents a user message and all agent responses to it.
1296
+ * Extracted from events to provide explicit turn boundaries.
1297
+ */
1298
+ declare const TurnSchema$1: z.ZodObject<{
1299
+ turnId: z.ZodString;
1300
+ sessionId: z.ZodString;
1301
+ turnNumber: z.ZodNumber;
1302
+ startedAt: z.ZodNumber;
1303
+ completedAt: z.ZodOptional<z.ZodNumber>;
1304
+ status: z.ZodEnum<{
1305
+ error: "error";
1306
+ completed: "completed";
1307
+ active: "active";
1308
+ }>;
1309
+ error: z.ZodOptional<z.ZodString>;
1310
+ usage: z.ZodOptional<z.ZodObject<{
1311
+ total: z.ZodObject<{
1312
+ inputTokens: z.ZodNumber;
1313
+ outputTokens: z.ZodNumber;
1314
+ cost: z.ZodOptional<z.ZodNumber>;
1315
+ }, z.core.$strip>;
1316
+ byAgent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1317
+ inputTokens: z.ZodNumber;
1318
+ outputTokens: z.ZodNumber;
1319
+ cost: z.ZodOptional<z.ZodNumber>;
1320
+ }, z.core.$strip>>>;
1321
+ }, z.core.$strip>>;
1322
+ initiator: z.ZodOptional<z.ZodObject<{
1323
+ source: z.ZodEnum<{
1324
+ user: "user";
1325
+ system: "system";
1326
+ extension: "extension";
1327
+ }>;
1328
+ sourceId: z.ZodOptional<z.ZodString>;
1329
+ }, z.core.$strip>>;
1330
+ }, z.core.$strip>;
1331
+ type Turn$1 = z.infer<typeof TurnSchema$1>;
1332
+ /**
1333
+ * Message routing status for multi-agent delivery tracking.
1334
+ */
1335
+ declare const MessageRoutingStatusSchema: z.ZodEnum<{
1336
+ completed: "completed";
1337
+ sent: "sent";
1338
+ acknowledged: "acknowledged";
1339
+ }>;
1340
+ type MessageRoutingStatus = z.infer<typeof MessageRoutingStatusSchema>;
1341
+ /**
1342
+ * Tracks delivery status of a message to agents in multi-agent sessions.
1343
+ */
1344
+ declare const MessageRoutingSchema$1: z.ZodObject<{
1345
+ messageId: z.ZodString;
1346
+ agentId: z.ZodString;
1347
+ status: z.ZodEnum<{
1348
+ completed: "completed";
1349
+ sent: "sent";
1350
+ acknowledged: "acknowledged";
1351
+ }>;
1352
+ timestamp: z.ZodNumber;
1353
+ error: z.ZodOptional<z.ZodString>;
1354
+ }, z.core.$strip>;
1355
+ type MessageRouting = z.infer<typeof MessageRoutingSchema$1>;
1356
+ //#endregion
1357
+ //#region core/contracts/src/session/schemas/orchestrator.d.ts
1358
+ /** Parsed type for {@link TurnInitiatorSchema}. */
1359
+ type TurnInitiator$1 = z.infer<typeof TurnInitiatorSchema$1>;
1360
+ /**
1361
+ * Orchestrator schemas for turn lifecycle and user message routing.
1362
+ *
1363
+ * These schemas are owned by SessionOrchestrator, not SessionService.
1364
+ * SessionService handles lifecycle (CRUD); orchestrator handles routing/turns.
1365
+ */
1366
+ declare const OrchestratorSchemas: {
1367
+ /**
1368
+ * Send a message to a session's agents.
1369
+ *
1370
+ * Subject: `session.sendMessage`
1371
+ * Type: Request (RPC)
1372
+ *
1373
+ * Single entry point for all user messages. Handles:
1374
+ * - Creating session if sessionId does not exist
1375
+ * - Auto-attaching agent via adapter.startAgent if session has no agents
1376
+ * - Turn lifecycle (creates turn if none active)
1377
+ * - Routing to targeted agents
1378
+ *
1379
+ * Default targets lead agent; use `agentIds: 'all'` for broadcast.
1380
+ *
1381
+ * `responseSchema.schema` is a JSON Schema document serialized as a
1382
+ * JSON-safe `Record<string, JsonValue>` so it can cross bus, storage, and
1383
+ * provider adapter boundaries without runtime-only values.
1384
+ * @example
1385
+ * ```typescript
1386
+ * // Start new conversation (client generates sessionId)
1387
+ * const { sessionId, messageId, turnId } = await bus.request(SessionSubjects.sendMessage, {
1388
+ * sessionId: crypto.randomUUID(),
1389
+ * agent: { kind: 'adapter', adapterName: 'anthropic-sdk', model: 'sonnet' },
1390
+ * message: 'Hello!',
1391
+ * });
1392
+ *
1393
+ * // Continue conversation (agent already attached)
1394
+ * await bus.request(SessionSubjects.sendMessage, {
1395
+ * sessionId,
1396
+ * message: 'Follow-up question',
1397
+ * });
1398
+ *
1399
+ * // Broadcast to all agents
1400
+ * await bus.request(SessionSubjects.sendMessage, {
1401
+ * sessionId,
1402
+ * message: 'What do you all think?',
1403
+ * agentIds: 'all',
1404
+ * });
1405
+ * ```
1406
+ */
1407
+ sendMessage: {
1408
+ request: z.ZodObject<{
1409
+ sessionId: z.ZodString;
1410
+ message: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1411
+ role: z.ZodOptional<z.ZodEnum<{
1412
+ user: "user";
1413
+ assistant: "assistant";
1414
+ system: "system";
1415
+ }>>;
1416
+ blocks: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
1417
+ type: z.ZodLiteral<"text">;
1418
+ content: z.ZodString;
1099
1419
  }, z.core.$strip>, z.ZodObject<{
1100
- type: z.ZodLiteral<"attachment">;
1101
- fileName: z.ZodString;
1102
- filePath: z.ZodString;
1420
+ type: z.ZodLiteral<"image">;
1421
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1422
+ type: z.ZodLiteral<"base64">;
1423
+ data: z.ZodString;
1424
+ mimeType: z.ZodString;
1425
+ }, z.core.$strip>, z.ZodObject<{
1426
+ type: z.ZodLiteral<"url">;
1427
+ url: z.ZodString;
1428
+ mimeType: z.ZodOptional<z.ZodString>;
1429
+ }, z.core.$strip>], "type">;
1430
+ }, z.core.$strip>, z.ZodObject<{
1431
+ type: z.ZodLiteral<"document">;
1432
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1433
+ type: z.ZodLiteral<"base64">;
1434
+ data: z.ZodString;
1435
+ mimeType: z.ZodString;
1436
+ }, z.core.$strip>, z.ZodObject<{
1437
+ type: z.ZodLiteral<"url">;
1438
+ url: z.ZodString;
1439
+ mimeType: z.ZodOptional<z.ZodString>;
1440
+ }, z.core.$strip>], "type">;
1441
+ }, z.core.$strip>, z.ZodObject<{
1442
+ type: z.ZodLiteral<"attachment">;
1443
+ fileName: z.ZodString;
1444
+ filePath: z.ZodString;
1103
1445
  source: z.ZodDiscriminatedUnion<[z.ZodObject<{
1104
1446
  type: z.ZodLiteral<"base64">;
1105
1447
  data: z.ZodString;
@@ -1978,6 +2320,39 @@ declare const OrchestratorSchemas: {
1978
2320
  sourceId: z.ZodOptional<z.ZodString>;
1979
2321
  }, z.core.$strip>>;
1980
2322
  }, z.core.$strip>;
2323
+ /**
2324
+ * Await completion of a specific session turn.
2325
+ *
2326
+ * Subject: `session.turn.await`
2327
+ * Type: Request (RPC)
2328
+ *
2329
+ * Resolves with the matching `session.turn.completed` payload. The timeout is
2330
+ * required so callers cannot accidentally create an unbounded wait.
2331
+ */
2332
+ 'turn.await': {
2333
+ request: z.ZodObject<{
2334
+ sessionId: z.ZodString;
2335
+ turnId: z.ZodString;
2336
+ timeoutMs: z.ZodNumber;
2337
+ }, z.core.$strip>;
2338
+ response: z.ZodObject<{
2339
+ completion: z.ZodObject<{
2340
+ sessionId: z.ZodString;
2341
+ turnId: z.ZodString;
2342
+ turnNumber: z.ZodNumber;
2343
+ success: z.ZodBoolean;
2344
+ error: z.ZodOptional<z.ZodString>;
2345
+ initiator: z.ZodOptional<z.ZodObject<{
2346
+ source: z.ZodEnum<{
2347
+ user: "user";
2348
+ system: "system";
2349
+ extension: "extension";
2350
+ }>;
2351
+ sourceId: z.ZodOptional<z.ZodString>;
2352
+ }, z.core.$strip>>;
2353
+ }, z.core.$strip>;
2354
+ }, z.core.$strip>;
2355
+ };
1981
2356
  /**
1982
2357
  * User message sent to session.
1983
2358
  *
@@ -2195,8 +2570,8 @@ declare const OrchestratorSchemas: {
2195
2570
  fromMessageId: z.ZodOptional<z.ZodString>;
2196
2571
  name: z.ZodOptional<z.ZodString>;
2197
2572
  branchKind: z.ZodOptional<z.ZodEnum<{
2198
- branch: "branch";
2199
2573
  fork: "fork";
2574
+ branch: "branch";
2200
2575
  aside: "aside";
2201
2576
  }>>;
2202
2577
  transforms: z.ZodOptional<z.ZodObject<{
@@ -2226,47 +2601,9 @@ declare const OrchestratorSchemas: {
2226
2601
  sessionId: z.ZodString;
2227
2602
  }, z.core.$strip>;
2228
2603
  };
2229
- /**
2230
- * Aggregated session-level token usage.
2231
- *
2232
- * Subject: `session.usage`
2233
- * Type: Event (fire-and-forget)
2234
- * Emitted when: UsageAggregator receives adapter.session.usage events
2235
- *
2236
- * Aggregates token usage across all adapters in a session.
2237
- * UsageAggregator listens to adapter.session.usage events, aggregates them
2238
- * per-session (keyed by adapterSessionId to avoid collisions), and emits
2239
- * this canonical session-level usage event.
2240
- *
2241
- * ContextTracker consumes this to track context window usage against thresholds.
2242
- * @example
2243
- * ```typescript
2244
- * bus.on(SessionSubjects.usage, (ctx) => {
2245
- * console.debug(
2246
- * `Session ${ctx.payload.sessionId}: ${ctx.payload.totalTokens} tokens ` +
2247
- * `(${ctx.payload.adapterCount} adapters)`
2248
- * );
2249
- * });
2250
- * ```
2251
- */
2252
- usage: {
2253
- request: z.ZodObject<{
2254
- sessionId: z.ZodString;
2255
- totalInputTokens: z.ZodNumber;
2256
- totalOutputTokens: z.ZodNumber;
2257
- totalTokens: z.ZodNumber;
2258
- totalCalls: z.ZodNumber;
2259
- adapterCount: z.ZodNumber;
2260
- }, z.core.$strip>;
2261
- response: z.ZodObject<{
2262
- acknowledged: z.ZodLiteral<true>;
2263
- }, z.core.$strip>;
2264
- };
2265
2604
  };
2266
2605
  type SendMessageRequest = z.infer<typeof OrchestratorSchemas.sendMessage.request>;
2267
2606
  type SendMessageResponse = z.infer<typeof OrchestratorSchemas.sendMessage.response>;
2268
- type SessionUsagePayload = z.infer<typeof OrchestratorSchemas.usage.request>;
2269
- type SessionUsageResponse = z.infer<typeof OrchestratorSchemas.usage.response>;
2270
2607
  //#endregion
2271
2608
  //#region core/contracts/src/session/schemas/event.d.ts
2272
2609
  /**
@@ -2546,551 +2883,286 @@ declare const MakaioSessionEventSchema: z.ZodUnion<readonly [z.ZodDiscriminatedU
2546
2883
  childSessionId: z.ZodString;
2547
2884
  parentSessionId: z.ZodString;
2548
2885
  kind: z.ZodEnum<{
2549
- branch: "branch";
2550
2886
  fork: "fork";
2551
- subagent: "subagent";
2552
- compress: "compress";
2553
- rewrite: "rewrite";
2554
- coordinator: "coordinator";
2555
- aside: "aside";
2556
- }>;
2557
- forkPointMessageId: z.ZodOptional<z.ZodString>;
2558
- }, z.core.$strip>;
2559
- }, z.core.$strip>, z.ZodObject<{
2560
- sessionId: z.ZodString;
2561
- eventId: z.ZodString;
2562
- timestamp: z.ZodNumber;
2563
- type: z.ZodLiteral<"branch.merged">;
2564
- payload: z.ZodObject<{
2565
- childSessionId: z.ZodString;
2566
- parentSessionId: z.ZodString;
2567
- resultJson: z.ZodOptional<z.ZodString>;
2568
- resultMessageId: z.ZodOptional<z.ZodString>;
2569
- }, z.core.$strip>;
2570
- }, z.core.$strip>, z.ZodObject<{
2571
- sessionId: z.ZodString;
2572
- eventId: z.ZodString;
2573
- timestamp: z.ZodNumber;
2574
- type: z.ZodLiteral<"squash">;
2575
- payload: z.ZodObject<{
2576
- summaryJson: z.ZodString;
2577
- tokensBefore: z.ZodOptional<z.ZodNumber>;
2578
- tokensAfter: z.ZodOptional<z.ZodNumber>;
2579
- compressedMessageIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
2580
- }, z.core.$strip>;
2581
- }, z.core.$strip>], "type">, z.ZodObject<{
2582
- sessionId: z.ZodString;
2583
- eventId: z.ZodString;
2584
- timestamp: z.ZodNumber;
2585
- type: z.ZodString;
2586
- payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2587
- }, z.core.$strip>]>;
2588
- /**
2589
- * Zod schema for session event types.
2590
- *
2591
- * Accepts any string at runtime for plugin flexibility.
2592
- * Type safety is provided via {@link SessionEventTypeMap} and declaration merging.
2593
- */
2594
- declare const SessionEventTypeSchema: z.ZodString;
2595
- /**
2596
- * Map of session event types to their payload schemas.
2597
- *
2598
- * **Plugin Extension Pattern:**
2599
- * Plugins can extend this interface via TypeScript declaration merging to add
2600
- * custom event types:
2601
- * @example
2602
- * ```typescript
2603
- * // In plugin code
2604
- * declare module '@makaio/framework/contracts' {
2605
- * interface SessionEventTypeMap {
2606
- * 'timeline.summary': {
2607
- * messageId: string;
2608
- * role: 'user' | 'assistant';
2609
- * summary: string;
2610
- * };
2611
- * }
2612
- * }
2613
- * ```
2614
- *
2615
- * Core event types are defined here to maintain type safety for the base system.
2616
- * Plugins augment this map without modifying source code.
2617
- */
2618
- interface SessionEventTypeMap {
2619
- /**
2620
- * Message correlation event linking messages table to session events.
2621
- */
2622
- message: {
2623
- messageId: string;
2624
- turnId: string | null;
2625
- role: 'user' | 'assistant';
2626
- };
2627
- /**
2628
- * Agent added to session (correlation link).
2629
- */
2630
- 'agent.added': {
2631
- sessionId: string;
2632
- adapterSessionId: string;
2633
- agentId: string;
2634
- adapterId: string;
2635
- adapterName: string;
2636
- role?: 'lead' | 'member';
2637
- model?: string;
2638
- cwd?: string;
2639
- };
2640
- /**
2641
- * Turn started event.
2642
- */
2643
- 'turn.started': {
2644
- sessionId: string;
2645
- turnId: string;
2646
- messageId: string;
2647
- agentIds: string[];
2648
- initiator?: TurnInitiator$1;
2649
- };
2650
- /**
2651
- * Turn completed event.
2652
- */
2653
- 'turn.completed': {
2654
- sessionId: string;
2655
- turnId: string;
2656
- success: boolean;
2657
- error?: string;
2658
- initiator?: TurnInitiator$1;
2659
- };
2660
- /**
2661
- * User message sent to session.
2662
- */
2663
- 'user_message.sent': z.infer<(typeof OrchestratorSchemas)['user_message.sent']>;
2664
- /**
2665
- * User message acknowledged by agent.
2666
- */
2667
- 'user_message.acknowledged': z.infer<(typeof OrchestratorSchemas)['user_message.acknowledged']>;
2668
- /**
2669
- * User message processing completed.
2670
- */
2671
- 'user_message.completed': z.infer<(typeof OrchestratorSchemas)['user_message.completed']>;
2672
- /**
2673
- * Branch created from parent session.
2674
- */
2675
- 'branch.created': {
2676
- childSessionId: string;
2677
- parentSessionId: string;
2678
- kind: z.infer<typeof BranchKindSchema>;
2679
- forkPointMessageId?: string;
2680
- };
2681
- /**
2682
- * Branch merged into parent session.
2683
- */
2684
- 'branch.merged': {
2685
- childSessionId: string;
2686
- parentSessionId: string;
2687
- resultJson?: string;
2688
- resultMessageId?: string;
2689
- };
2690
- /**
2691
- * Context compression event.
2692
- */
2693
- squash: {
2694
- summaryJson: string;
2695
- tokensBefore?: number;
2696
- tokensAfter?: number;
2697
- compressedMessageIds?: string[];
2698
- };
2699
- /**
2700
- * Emitted on the parent session when a Claude Code compaction boundary is
2701
- * imported. Uses the plugin event path — not a core event type.
2702
- */
2703
- 'session.compacted': {
2704
- /** Whether compaction was triggered manually (`/compact`) or automatically. */trigger: 'manual' | 'auto'; /** Approximate token count before compaction. */
2705
- preTokens: number | null; /** Summary text from the `isCompactSummary` user message when available. */
2706
- summary: string | null; /** Makaio session ID of the compress child (post-compaction session). */
2707
- compressChildSessionId: string;
2708
- };
2709
- }
2710
- /**
2711
- * Union of all session event type keys (core + plugin-defined).
2712
- *
2713
- * Runtime validation uses {@link SessionEventTypeSchema} (accepts any string).
2714
- * Compile-time typing is derived from {@link SessionEventTypeMap} keys.
2715
- */
2716
- type SessionEventType = keyof SessionEventTypeMap;
2717
- /**
2718
- * Get the payload type for a specific session event type.
2719
- * @typeParam T - The event type key
2720
- * @example
2721
- * ```typescript
2722
- * type MessagePayload = SessionEventPayload<'message'>;
2723
- * // { messageId: string; turnId: string | null; role: 'user' | 'assistant' }
2724
- * ```
2725
- */
2726
- type SessionEventPayload<T extends SessionEventType> = SessionEventTypeMap[T];
2727
- //#endregion
2728
- //#region core/contracts/src/session/schemas/fork-child-info.d.ts
2729
- /**
2730
- * Information about a child session for fork display.
2731
- * Used by getChildren enriched response.
2732
- */
2733
- declare const ForkChildInfoSchema: z.ZodObject<{
2734
- sessionId: z.ZodString;
2735
- title: z.ZodNullable<z.ZodString>;
2736
- forkPointMessageId: z.ZodNullable<z.ZodString>;
2737
- branchKind: z.ZodNullable<z.ZodEnum<{
2738
- branch: "branch";
2739
- fork: "fork";
2740
- subagent: "subagent";
2741
- compress: "compress";
2742
- rewrite: "rewrite";
2743
- coordinator: "coordinator";
2744
- aside: "aside";
2745
- }>>;
2746
- messageCount: z.ZodNumber;
2747
- hasChildren: z.ZodBoolean;
2748
- spawningToolCallId: z.ZodOptional<z.ZodString>;
2749
- }, z.core.$strip>;
2750
- type ForkChildInfo = z.infer<typeof ForkChildInfoSchema>;
2751
- //#endregion
2752
- //#region core/contracts/src/session/schemas/lifecycle-events.d.ts
2753
- /**
2754
- * Session lifecycle event schemas.
2755
- * These extend SessionSchemas for fork/merge/abandon lifecycle.
2756
- */
2757
- /**
2758
- * Policy for a contiguous range of messages in a fork context window.
2759
- *
2760
- * Segments define how a slice of conversation history is projected into the
2761
- * child session. When `segments` is present on {@link ForkTransforms},
2762
- * `removedMessageIds` and `appliedPipeline` are ignored — segments take
2763
- * precedence as the authoritative context curation strategy.
2764
- */
2765
- declare const SegmentPolicySchema: z.ZodObject<{
2766
- fromMessageId: z.ZodString;
2767
- toMessageId: z.ZodString;
2768
- policy: z.ZodEnum<{
2769
- verbatim: "verbatim";
2770
- summarize: "summarize";
2771
- exclude: "exclude";
2772
- }>;
2773
- stripReasoning: z.ZodOptional<z.ZodBoolean>;
2774
- stripToolOutputs: z.ZodOptional<z.ZodBoolean>;
2775
- overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLiteral<"exclude">>>;
2776
- summaryText: z.ZodOptional<z.ZodString>;
2777
- }, z.core.$strip>;
2778
- /** Inferred type for {@link SegmentPolicySchema}. */
2779
- type SegmentPolicy = z.infer<typeof SegmentPolicySchema>;
2780
- /**
2781
- * Transform configuration for fork sessions.
2782
- * Stored on session record and applied by getFullConversation().
2783
- *
2784
- * When `segments` is present, it takes precedence over `removedMessageIds`
2785
- * and `appliedPipeline` — those fields are ignored at runtime.
2786
- */
2787
- declare const ForkTransformsSchema$1: z.ZodObject<{
2788
- removedMessageIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
2789
- appliedPipeline: z.ZodOptional<z.ZodArray<z.ZodObject<{
2790
- actionId: z.ZodString;
2791
- options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2792
- }, z.core.$strip>>>;
2793
- segments: z.ZodOptional<z.ZodArray<z.ZodObject<{
2794
- fromMessageId: z.ZodString;
2795
- toMessageId: z.ZodString;
2796
- policy: z.ZodEnum<{
2797
- verbatim: "verbatim";
2798
- summarize: "summarize";
2799
- exclude: "exclude";
2800
- }>;
2801
- stripReasoning: z.ZodOptional<z.ZodBoolean>;
2802
- stripToolOutputs: z.ZodOptional<z.ZodBoolean>;
2803
- overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLiteral<"exclude">>>;
2804
- summaryText: z.ZodOptional<z.ZodString>;
2805
- }, z.core.$strip>>>;
2806
- }, z.core.$strip>;
2807
- type ForkTransforms$1 = z.infer<typeof ForkTransformsSchema$1>;
2808
- declare const SessionCreatedEventSchema: z.ZodObject<{
2809
- sessionId: z.ZodString;
2810
- parentSessionId: z.ZodNullable<z.ZodString>;
2811
- branchKind: z.ZodNullable<z.ZodEnum<{
2812
- branch: "branch";
2813
- fork: "fork";
2814
- subagent: "subagent";
2815
- compress: "compress";
2816
- rewrite: "rewrite";
2817
- coordinator: "coordinator";
2818
- aside: "aside";
2819
- }>>;
2820
- createdAt: z.ZodNumber;
2821
- originWindowId: z.ZodOptional<z.ZodString>;
2822
- }, z.core.$strip>;
2823
- declare const SessionUpdatedEventSchema: z.ZodObject<{
2824
- sessionId: z.ZodString;
2825
- changedProperties: z.ZodArray<z.ZodString>;
2826
- }, z.core.$strip>;
2827
- type SessionCreated = z.infer<typeof SessionCreatedEventSchema>;
2828
- type SessionUpdatedEvent = z.infer<typeof SessionUpdatedEventSchema>;
2829
- //#endregion
2830
- //#region core/contracts/src/session/schemas/message.d.ts
2831
- /**
2832
- * Session message block types for structured content within stored messages.
2833
- *
2834
- * Unified with MessageBlock — all block types (text, image, document, attachment,
2835
- * reasoning, tool_call, tool_output) are first-class citizens in both storage
2836
- * and SDK contexts.
2837
- */
2838
- declare const SessionMessageBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2839
- type: z.ZodLiteral<"text">;
2840
- content: z.ZodString;
2841
- }, z.core.$strip>, z.ZodObject<{
2842
- type: z.ZodLiteral<"image">;
2843
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
2844
- type: z.ZodLiteral<"base64">;
2845
- data: z.ZodString;
2846
- mimeType: z.ZodString;
2847
- }, z.core.$strip>, z.ZodObject<{
2848
- type: z.ZodLiteral<"url">;
2849
- url: z.ZodString;
2850
- mimeType: z.ZodOptional<z.ZodString>;
2851
- }, z.core.$strip>], "type">;
2852
- }, z.core.$strip>, z.ZodObject<{
2853
- type: z.ZodLiteral<"document">;
2854
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
2855
- type: z.ZodLiteral<"base64">;
2856
- data: z.ZodString;
2857
- mimeType: z.ZodString;
2858
- }, z.core.$strip>, z.ZodObject<{
2859
- type: z.ZodLiteral<"url">;
2860
- url: z.ZodString;
2861
- mimeType: z.ZodOptional<z.ZodString>;
2862
- }, z.core.$strip>], "type">;
2863
- }, z.core.$strip>, z.ZodObject<{
2864
- type: z.ZodLiteral<"attachment">;
2865
- fileName: z.ZodString;
2866
- filePath: z.ZodString;
2867
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
2868
- type: z.ZodLiteral<"base64">;
2869
- data: z.ZodString;
2870
- mimeType: z.ZodString;
2871
- }, z.core.$strip>, z.ZodObject<{
2872
- type: z.ZodLiteral<"url">;
2873
- url: z.ZodString;
2874
- mimeType: z.ZodOptional<z.ZodString>;
2875
- }, z.core.$strip>], "type">;
2876
- displayName: z.ZodOptional<z.ZodString>;
2877
- attachmentType: z.ZodEnum<{
2878
- file: "file";
2879
- directory: "directory";
2880
- }>;
2881
- }, z.core.$strip>, z.ZodObject<{
2882
- type: z.ZodLiteral<"reasoning">;
2883
- content: z.ZodString;
2884
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2885
- }, z.core.$strip>, z.ZodObject<{
2886
- type: z.ZodLiteral<"tool_call">;
2887
- toolCallId: z.ZodString;
2888
- name: z.ZodString;
2889
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2890
- }, z.core.$strip>, z.ZodObject<{
2891
- type: z.ZodLiteral<"tool_output">;
2892
- toolCallId: z.ZodString;
2893
- output: z.ZodString;
2894
- isError: z.ZodOptional<z.ZodBoolean>;
2895
- }, z.core.$strip>], "type">;
2896
- type SessionMessageBlock$1 = MessageBlock$1;
2897
- /**
2898
- * Session message role in a conversation.
2899
- */
2900
- declare const SessionMessageRoleSchema: z.ZodEnum<{
2901
- user: "user";
2902
- assistant: "assistant";
2903
- }>;
2904
- type SessionMessageRole = z.infer<typeof SessionMessageRoleSchema>;
2905
- declare const SessionMessageOriginSchema: z.ZodEnum<{
2906
- text: "text";
2907
- voice: "voice";
2908
- compact: "compact";
2909
- }>;
2910
- type SessionMessageOrigin = z.infer<typeof SessionMessageOriginSchema>;
2911
- /**
2912
- * A stored message in a session conversation.
2913
- *
2914
- * Distinct from `shared/Message` which is the SDK message format for runtime.
2915
- * SessionMessage includes storage metadata (messageId, turnId, timestamp, etc.).
2916
- *
2917
- * Messages are first-class entities stored in the `messages` table.
2918
- *
2919
- * Design principles:
2920
- * - Single source of truth for conversation content
2921
- * - Blocks preserve full response fidelity (reasoning, tools)
2922
- * - contentText extracted for full-text search
2923
- * - Events remain for lifecycle/audit only
2924
- */
2925
- declare const SessionMessageSchema$1: z.ZodObject<{
2926
- messageId: z.ZodString;
2927
- turnId: z.ZodNullable<z.ZodString>;
2928
- sessionId: z.ZodString;
2929
- role: z.ZodEnum<{
2930
- user: "user";
2931
- assistant: "assistant";
2932
- }>;
2933
- contentText: z.ZodString;
2934
- blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2935
- type: z.ZodLiteral<"text">;
2936
- content: z.ZodString;
2937
- }, z.core.$strip>, z.ZodObject<{
2938
- type: z.ZodLiteral<"image">;
2939
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
2940
- type: z.ZodLiteral<"base64">;
2941
- data: z.ZodString;
2942
- mimeType: z.ZodString;
2943
- }, z.core.$strip>, z.ZodObject<{
2944
- type: z.ZodLiteral<"url">;
2945
- url: z.ZodString;
2946
- mimeType: z.ZodOptional<z.ZodString>;
2947
- }, z.core.$strip>], "type">;
2948
- }, z.core.$strip>, z.ZodObject<{
2949
- type: z.ZodLiteral<"document">;
2950
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
2951
- type: z.ZodLiteral<"base64">;
2952
- data: z.ZodString;
2953
- mimeType: z.ZodString;
2954
- }, z.core.$strip>, z.ZodObject<{
2955
- type: z.ZodLiteral<"url">;
2956
- url: z.ZodString;
2957
- mimeType: z.ZodOptional<z.ZodString>;
2958
- }, z.core.$strip>], "type">;
2959
- }, z.core.$strip>, z.ZodObject<{
2960
- type: z.ZodLiteral<"attachment">;
2961
- fileName: z.ZodString;
2962
- filePath: z.ZodString;
2963
- source: z.ZodDiscriminatedUnion<[z.ZodObject<{
2964
- type: z.ZodLiteral<"base64">;
2965
- data: z.ZodString;
2966
- mimeType: z.ZodString;
2967
- }, z.core.$strip>, z.ZodObject<{
2968
- type: z.ZodLiteral<"url">;
2969
- url: z.ZodString;
2970
- mimeType: z.ZodOptional<z.ZodString>;
2971
- }, z.core.$strip>], "type">;
2972
- displayName: z.ZodOptional<z.ZodString>;
2973
- attachmentType: z.ZodEnum<{
2974
- file: "file";
2975
- directory: "directory";
2887
+ subagent: "subagent";
2888
+ compress: "compress";
2889
+ branch: "branch";
2890
+ rewrite: "rewrite";
2891
+ coordinator: "coordinator";
2892
+ aside: "aside";
2976
2893
  }>;
2977
- }, z.core.$strip>, z.ZodObject<{
2978
- type: z.ZodLiteral<"reasoning">;
2979
- content: z.ZodString;
2980
- metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2981
- }, z.core.$strip>, z.ZodObject<{
2982
- type: z.ZodLiteral<"tool_call">;
2983
- toolCallId: z.ZodString;
2984
- name: z.ZodString;
2985
- args: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2986
- }, z.core.$strip>, z.ZodObject<{
2987
- type: z.ZodLiteral<"tool_output">;
2988
- toolCallId: z.ZodString;
2989
- output: z.ZodString;
2990
- isError: z.ZodOptional<z.ZodBoolean>;
2991
- }, z.core.$strip>], "type">>;
2992
- agentId: z.ZodOptional<z.ZodString>;
2993
- adapterSessionId: z.ZodOptional<z.ZodString>;
2994
- adapterMessageId: z.ZodOptional<z.ZodString>;
2894
+ forkPointMessageId: z.ZodOptional<z.ZodString>;
2895
+ }, z.core.$strip>;
2896
+ }, z.core.$strip>, z.ZodObject<{
2897
+ sessionId: z.ZodString;
2898
+ eventId: z.ZodString;
2995
2899
  timestamp: z.ZodNumber;
2996
- editOf: z.ZodOptional<z.ZodString>;
2997
- origin: z.ZodOptional<z.ZodEnum<{
2998
- text: "text";
2999
- voice: "voice";
3000
- compact: "compact";
3001
- }>>;
3002
- }, z.core.$strip>;
3003
- type SessionMessage$1 = z.infer<typeof SessionMessageSchema$1>;
2900
+ type: z.ZodLiteral<"branch.merged">;
2901
+ payload: z.ZodObject<{
2902
+ childSessionId: z.ZodString;
2903
+ parentSessionId: z.ZodString;
2904
+ resultJson: z.ZodOptional<z.ZodString>;
2905
+ resultMessageId: z.ZodOptional<z.ZodString>;
2906
+ }, z.core.$strip>;
2907
+ }, z.core.$strip>, z.ZodObject<{
2908
+ sessionId: z.ZodString;
2909
+ eventId: z.ZodString;
2910
+ timestamp: z.ZodNumber;
2911
+ type: z.ZodLiteral<"squash">;
2912
+ payload: z.ZodObject<{
2913
+ summaryJson: z.ZodString;
2914
+ tokensBefore: z.ZodOptional<z.ZodNumber>;
2915
+ tokensAfter: z.ZodOptional<z.ZodNumber>;
2916
+ compressedMessageIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
2917
+ }, z.core.$strip>;
2918
+ }, z.core.$strip>], "type">, z.ZodObject<{
2919
+ sessionId: z.ZodString;
2920
+ eventId: z.ZodString;
2921
+ timestamp: z.ZodNumber;
2922
+ type: z.ZodString;
2923
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2924
+ }, z.core.$strip>]>;
3004
2925
  /**
3005
- * Turn status in the conversation lifecycle.
2926
+ * Zod schema for session event types.
2927
+ *
2928
+ * Accepts any string at runtime for plugin flexibility.
2929
+ * Type safety is provided via {@link SessionEventTypeMap} and declaration merging.
3006
2930
  */
3007
- declare const TurnStatusSchema$1: z.ZodEnum<{
3008
- error: "error";
3009
- completed: "completed";
3010
- active: "active";
3011
- }>;
3012
- type TurnStatus = z.infer<typeof TurnStatusSchema$1>;
2931
+ declare const SessionEventTypeSchema: z.ZodString;
3013
2932
  /**
3014
- * Usage metrics for a single agent or aggregated total.
2933
+ * Map of session event types to their payload schemas.
2934
+ *
2935
+ * **Plugin Extension Pattern:**
2936
+ * Plugins can extend this interface via TypeScript declaration merging to add
2937
+ * custom event types:
2938
+ * @example
2939
+ * ```typescript
2940
+ * // In plugin code
2941
+ * declare module '@makaio/framework/contracts' {
2942
+ * interface SessionEventTypeMap {
2943
+ * 'timeline.summary': {
2944
+ * messageId: string;
2945
+ * role: 'user' | 'assistant';
2946
+ * summary: string;
2947
+ * };
2948
+ * }
2949
+ * }
2950
+ * ```
2951
+ *
2952
+ * Core event types are defined here to maintain type safety for the base system.
2953
+ * Plugins augment this map without modifying source code.
3015
2954
  */
3016
- declare const UsageMetricsSchema: z.ZodObject<{
3017
- inputTokens: z.ZodNumber;
3018
- outputTokens: z.ZodNumber;
3019
- cost: z.ZodOptional<z.ZodNumber>;
3020
- }, z.core.$strip>;
3021
- type UsageMetrics = z.infer<typeof UsageMetricsSchema>;
2955
+ interface SessionEventTypeMap {
2956
+ /**
2957
+ * Message correlation event linking messages table to session events.
2958
+ */
2959
+ message: {
2960
+ messageId: string;
2961
+ turnId: string | null;
2962
+ role: 'user' | 'assistant';
2963
+ };
2964
+ /**
2965
+ * Agent added to session (correlation link).
2966
+ */
2967
+ 'agent.added': {
2968
+ sessionId: string;
2969
+ adapterSessionId: string;
2970
+ agentId: string;
2971
+ adapterId: string;
2972
+ adapterName: string;
2973
+ role?: 'lead' | 'member';
2974
+ model?: string;
2975
+ cwd?: string;
2976
+ };
2977
+ /**
2978
+ * Turn started event.
2979
+ */
2980
+ 'turn.started': {
2981
+ sessionId: string;
2982
+ turnId: string;
2983
+ messageId: string;
2984
+ agentIds: string[];
2985
+ initiator?: TurnInitiator$1;
2986
+ };
2987
+ /**
2988
+ * Turn completed event.
2989
+ */
2990
+ 'turn.completed': {
2991
+ sessionId: string;
2992
+ turnId: string;
2993
+ success: boolean;
2994
+ error?: string;
2995
+ initiator?: TurnInitiator$1;
2996
+ };
2997
+ /**
2998
+ * User message sent to session.
2999
+ */
3000
+ 'user_message.sent': z.infer<(typeof OrchestratorSchemas)['user_message.sent']>;
3001
+ /**
3002
+ * User message acknowledged by agent.
3003
+ */
3004
+ 'user_message.acknowledged': z.infer<(typeof OrchestratorSchemas)['user_message.acknowledged']>;
3005
+ /**
3006
+ * User message processing completed.
3007
+ */
3008
+ 'user_message.completed': z.infer<(typeof OrchestratorSchemas)['user_message.completed']>;
3009
+ /**
3010
+ * Branch created from parent session.
3011
+ */
3012
+ 'branch.created': {
3013
+ childSessionId: string;
3014
+ parentSessionId: string;
3015
+ kind: z.infer<typeof BranchKindSchema>;
3016
+ forkPointMessageId?: string;
3017
+ };
3018
+ /**
3019
+ * Branch merged into parent session.
3020
+ */
3021
+ 'branch.merged': {
3022
+ childSessionId: string;
3023
+ parentSessionId: string;
3024
+ resultJson?: string;
3025
+ resultMessageId?: string;
3026
+ };
3027
+ /**
3028
+ * Context compression event.
3029
+ */
3030
+ squash: {
3031
+ summaryJson: string;
3032
+ tokensBefore?: number;
3033
+ tokensAfter?: number;
3034
+ compressedMessageIds?: string[];
3035
+ };
3036
+ /**
3037
+ * Emitted on the parent session when a Claude Code compaction boundary is
3038
+ * imported. Uses the plugin event path — not a core event type.
3039
+ */
3040
+ 'session.compacted': {
3041
+ /** Whether compaction was triggered manually (`/compact`) or automatically. */trigger: 'manual' | 'auto'; /** Approximate token count before compaction. */
3042
+ preTokens: number | null; /** Summary text from the `isCompactSummary` user message when available. */
3043
+ summary: string | null; /** Makaio session ID of the compress child (post-compaction session). */
3044
+ compressChildSessionId: string;
3045
+ };
3046
+ }
3022
3047
  /**
3023
- * Aggregated usage for a turn, with optional per-agent breakdown.
3048
+ * Union of all session event type keys (core + plugin-defined).
3049
+ *
3050
+ * Runtime validation uses {@link SessionEventTypeSchema} (accepts any string).
3051
+ * Compile-time typing is derived from {@link SessionEventTypeMap} keys.
3024
3052
  */
3025
- declare const TurnUsageSchema$1: z.ZodObject<{
3026
- total: z.ZodObject<{
3027
- inputTokens: z.ZodNumber;
3028
- outputTokens: z.ZodNumber;
3029
- cost: z.ZodOptional<z.ZodNumber>;
3030
- }, z.core.$strip>;
3031
- byAgent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3032
- inputTokens: z.ZodNumber;
3033
- outputTokens: z.ZodNumber;
3034
- cost: z.ZodOptional<z.ZodNumber>;
3035
- }, z.core.$strip>>>;
3036
- }, z.core.$strip>;
3037
- type TurnUsage = z.infer<typeof TurnUsageSchema$1>;
3053
+ type SessionEventType = keyof SessionEventTypeMap;
3038
3054
  /**
3039
- * A turn in a session conversation.
3040
- *
3041
- * A turn represents a user message and all agent responses to it.
3042
- * Extracted from events to provide explicit turn boundaries.
3055
+ * Get the payload type for a specific session event type.
3056
+ * @typeParam T - The event type key
3057
+ * @example
3058
+ * ```typescript
3059
+ * type MessagePayload = SessionEventPayload<'message'>;
3060
+ * // { messageId: string; turnId: string | null; role: 'user' | 'assistant' }
3061
+ * ```
3043
3062
  */
3044
- declare const TurnSchema$1: z.ZodObject<{
3045
- turnId: z.ZodString;
3046
- sessionId: z.ZodString;
3047
- turnNumber: z.ZodNumber;
3048
- startedAt: z.ZodNumber;
3049
- completedAt: z.ZodOptional<z.ZodNumber>;
3050
- status: z.ZodEnum<{
3051
- error: "error";
3052
- completed: "completed";
3053
- active: "active";
3054
- }>;
3055
- error: z.ZodOptional<z.ZodString>;
3056
- usage: z.ZodOptional<z.ZodObject<{
3057
- total: z.ZodObject<{
3058
- inputTokens: z.ZodNumber;
3059
- outputTokens: z.ZodNumber;
3060
- cost: z.ZodOptional<z.ZodNumber>;
3061
- }, z.core.$strip>;
3062
- byAgent: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
3063
- inputTokens: z.ZodNumber;
3064
- outputTokens: z.ZodNumber;
3065
- cost: z.ZodOptional<z.ZodNumber>;
3066
- }, z.core.$strip>>>;
3067
- }, z.core.$strip>>;
3063
+ type SessionEventPayload<T extends SessionEventType> = SessionEventTypeMap[T];
3064
+ //#endregion
3065
+ //#region core/contracts/src/session/schemas/fork-child-info.d.ts
3066
+ /**
3067
+ * Information about a child session for fork display.
3068
+ * Used by getChildren enriched response.
3069
+ */
3070
+ declare const ForkChildInfoSchema: z.ZodObject<{
3071
+ sessionId: z.ZodString;
3072
+ title: z.ZodNullable<z.ZodString>;
3073
+ forkPointMessageId: z.ZodNullable<z.ZodString>;
3074
+ branchKind: z.ZodNullable<z.ZodEnum<{
3075
+ fork: "fork";
3076
+ subagent: "subagent";
3077
+ compress: "compress";
3078
+ branch: "branch";
3079
+ rewrite: "rewrite";
3080
+ coordinator: "coordinator";
3081
+ aside: "aside";
3082
+ }>>;
3083
+ messageCount: z.ZodNumber;
3084
+ hasChildren: z.ZodBoolean;
3085
+ spawningToolCallId: z.ZodOptional<z.ZodString>;
3068
3086
  }, z.core.$strip>;
3069
- type Turn$1 = z.infer<typeof TurnSchema$1>;
3087
+ type ForkChildInfo = z.infer<typeof ForkChildInfoSchema>;
3088
+ //#endregion
3089
+ //#region core/contracts/src/session/schemas/lifecycle-events.d.ts
3070
3090
  /**
3071
- * Message routing status for multi-agent delivery tracking.
3091
+ * Session lifecycle event schemas.
3092
+ * These extend SessionSchemas for fork/merge/abandon lifecycle.
3072
3093
  */
3073
- declare const MessageRoutingStatusSchema: z.ZodEnum<{
3074
- completed: "completed";
3075
- sent: "sent";
3076
- acknowledged: "acknowledged";
3077
- }>;
3078
- type MessageRoutingStatus = z.infer<typeof MessageRoutingStatusSchema>;
3079
3094
  /**
3080
- * Tracks delivery status of a message to agents in multi-agent sessions.
3095
+ * Policy for a contiguous range of messages in a fork context window.
3096
+ *
3097
+ * Segments define how a slice of conversation history is projected into the
3098
+ * child session. When `segments` is present on {@link ForkTransforms},
3099
+ * `removedMessageIds` and `appliedPipeline` are ignored — segments take
3100
+ * precedence as the authoritative context curation strategy.
3081
3101
  */
3082
- declare const MessageRoutingSchema$1: z.ZodObject<{
3083
- messageId: z.ZodString;
3084
- agentId: z.ZodString;
3085
- status: z.ZodEnum<{
3086
- completed: "completed";
3087
- sent: "sent";
3088
- acknowledged: "acknowledged";
3102
+ declare const SegmentPolicySchema: z.ZodObject<{
3103
+ fromMessageId: z.ZodString;
3104
+ toMessageId: z.ZodString;
3105
+ policy: z.ZodEnum<{
3106
+ verbatim: "verbatim";
3107
+ summarize: "summarize";
3108
+ exclude: "exclude";
3089
3109
  }>;
3090
- timestamp: z.ZodNumber;
3091
- error: z.ZodOptional<z.ZodString>;
3110
+ stripReasoning: z.ZodOptional<z.ZodBoolean>;
3111
+ stripToolOutputs: z.ZodOptional<z.ZodBoolean>;
3112
+ overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLiteral<"exclude">>>;
3113
+ summaryText: z.ZodOptional<z.ZodString>;
3092
3114
  }, z.core.$strip>;
3093
- type MessageRouting = z.infer<typeof MessageRoutingSchema$1>;
3115
+ /** Inferred type for {@link SegmentPolicySchema}. */
3116
+ type SegmentPolicy = z.infer<typeof SegmentPolicySchema>;
3117
+ /**
3118
+ * Transform configuration for fork sessions.
3119
+ * Stored on session record and applied by getFullConversation().
3120
+ *
3121
+ * When `segments` is present, it takes precedence over `removedMessageIds`
3122
+ * and `appliedPipeline` — those fields are ignored at runtime.
3123
+ */
3124
+ declare const ForkTransformsSchema$1: z.ZodObject<{
3125
+ removedMessageIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
3126
+ appliedPipeline: z.ZodOptional<z.ZodArray<z.ZodObject<{
3127
+ actionId: z.ZodString;
3128
+ options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
3129
+ }, z.core.$strip>>>;
3130
+ segments: z.ZodOptional<z.ZodArray<z.ZodObject<{
3131
+ fromMessageId: z.ZodString;
3132
+ toMessageId: z.ZodString;
3133
+ policy: z.ZodEnum<{
3134
+ verbatim: "verbatim";
3135
+ summarize: "summarize";
3136
+ exclude: "exclude";
3137
+ }>;
3138
+ stripReasoning: z.ZodOptional<z.ZodBoolean>;
3139
+ stripToolOutputs: z.ZodOptional<z.ZodBoolean>;
3140
+ overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLiteral<"exclude">>>;
3141
+ summaryText: z.ZodOptional<z.ZodString>;
3142
+ }, z.core.$strip>>>;
3143
+ }, z.core.$strip>;
3144
+ type ForkTransforms$1 = z.infer<typeof ForkTransformsSchema$1>;
3145
+ declare const SessionCreatedEventSchema: z.ZodObject<{
3146
+ sessionId: z.ZodString;
3147
+ parentSessionId: z.ZodNullable<z.ZodString>;
3148
+ branchKind: z.ZodNullable<z.ZodEnum<{
3149
+ fork: "fork";
3150
+ subagent: "subagent";
3151
+ compress: "compress";
3152
+ branch: "branch";
3153
+ rewrite: "rewrite";
3154
+ coordinator: "coordinator";
3155
+ aside: "aside";
3156
+ }>>;
3157
+ createdAt: z.ZodNumber;
3158
+ originWindowId: z.ZodOptional<z.ZodString>;
3159
+ }, z.core.$strip>;
3160
+ declare const SessionUpdatedEventSchema: z.ZodObject<{
3161
+ sessionId: z.ZodString;
3162
+ changedProperties: z.ZodArray<z.ZodString>;
3163
+ }, z.core.$strip>;
3164
+ type SessionCreated = z.infer<typeof SessionCreatedEventSchema>;
3165
+ type SessionUpdatedEvent = z.infer<typeof SessionUpdatedEventSchema>;
3094
3166
  //#endregion
3095
3167
  //#region core/contracts/src/session/schemas.d.ts
3096
3168
  /**
@@ -4129,6 +4201,30 @@ declare const SessionSchemas: {
4129
4201
  sourceId: _$zod.ZodOptional<_$zod.ZodString>;
4130
4202
  }, _$zod_v4_core0.$strip>>;
4131
4203
  }, _$zod_v4_core0.$strip>;
4204
+ 'turn.await': {
4205
+ request: _$zod.ZodObject<{
4206
+ sessionId: _$zod.ZodString;
4207
+ turnId: _$zod.ZodString;
4208
+ timeoutMs: _$zod.ZodNumber;
4209
+ }, _$zod_v4_core0.$strip>;
4210
+ response: _$zod.ZodObject<{
4211
+ completion: _$zod.ZodObject<{
4212
+ sessionId: _$zod.ZodString;
4213
+ turnId: _$zod.ZodString;
4214
+ turnNumber: _$zod.ZodNumber;
4215
+ success: _$zod.ZodBoolean;
4216
+ error: _$zod.ZodOptional<_$zod.ZodString>;
4217
+ initiator: _$zod.ZodOptional<_$zod.ZodObject<{
4218
+ source: _$zod.ZodEnum<{
4219
+ user: "user";
4220
+ system: "system";
4221
+ extension: "extension";
4222
+ }>;
4223
+ sourceId: _$zod.ZodOptional<_$zod.ZodString>;
4224
+ }, _$zod_v4_core0.$strip>>;
4225
+ }, _$zod_v4_core0.$strip>;
4226
+ }, _$zod_v4_core0.$strip>;
4227
+ };
4132
4228
  'user_message.sent': _$zod.ZodObject<{
4133
4229
  sessionId: _$zod.ZodString;
4134
4230
  turnId: _$zod.ZodString;
@@ -4299,8 +4395,8 @@ declare const SessionSchemas: {
4299
4395
  fromMessageId: _$zod.ZodOptional<_$zod.ZodString>;
4300
4396
  name: _$zod.ZodOptional<_$zod.ZodString>;
4301
4397
  branchKind: _$zod.ZodOptional<_$zod.ZodEnum<{
4302
- branch: "branch";
4303
4398
  fork: "fork";
4399
+ branch: "branch";
4304
4400
  aside: "aside";
4305
4401
  }>>;
4306
4402
  transforms: _$zod.ZodOptional<_$zod.ZodObject<{
@@ -4330,19 +4426,6 @@ declare const SessionSchemas: {
4330
4426
  sessionId: _$zod.ZodString;
4331
4427
  }, _$zod_v4_core0.$strip>;
4332
4428
  };
4333
- usage: {
4334
- request: _$zod.ZodObject<{
4335
- sessionId: _$zod.ZodString;
4336
- totalInputTokens: _$zod.ZodNumber;
4337
- totalOutputTokens: _$zod.ZodNumber;
4338
- totalTokens: _$zod.ZodNumber;
4339
- totalCalls: _$zod.ZodNumber;
4340
- adapterCount: _$zod.ZodNumber;
4341
- }, _$zod_v4_core0.$strip>;
4342
- response: _$zod.ZodObject<{
4343
- acknowledged: _$zod.ZodLiteral<true>;
4344
- }, _$zod_v4_core0.$strip>;
4345
- };
4346
4429
  merge: {
4347
4430
  request: _$zod.ZodObject<{
4348
4431
  parentSessionId: _$zod.ZodString;
@@ -4385,10 +4468,10 @@ declare const SessionSchemas: {
4385
4468
  title: _$zod.ZodNullable<_$zod.ZodString>;
4386
4469
  forkPointMessageId: _$zod.ZodNullable<_$zod.ZodString>;
4387
4470
  branchKind: _$zod.ZodNullable<_$zod.ZodEnum<{
4388
- branch: "branch";
4389
4471
  fork: "fork";
4390
4472
  subagent: "subagent";
4391
4473
  compress: "compress";
4474
+ branch: "branch";
4392
4475
  rewrite: "rewrite";
4393
4476
  coordinator: "coordinator";
4394
4477
  aside: "aside";
@@ -4442,10 +4525,10 @@ declare const SessionSchemas: {
4442
4525
  childSessionId: _$zod.ZodString;
4443
4526
  parentSessionId: _$zod.ZodString;
4444
4527
  kind: _$zod.ZodEnum<{
4445
- branch: "branch";
4446
4528
  fork: "fork";
4447
4529
  subagent: "subagent";
4448
4530
  compress: "compress";
4531
+ branch: "branch";
4449
4532
  rewrite: "rewrite";
4450
4533
  coordinator: "coordinator";
4451
4534
  aside: "aside";
@@ -4490,10 +4573,10 @@ declare const SessionSchemas: {
4490
4573
  sessionId: _$zod.ZodString;
4491
4574
  parentSessionId: _$zod.ZodNullable<_$zod.ZodString>;
4492
4575
  branchKind: _$zod.ZodNullable<_$zod.ZodEnum<{
4493
- branch: "branch";
4494
4576
  fork: "fork";
4495
4577
  subagent: "subagent";
4496
4578
  compress: "compress";
4579
+ branch: "branch";
4497
4580
  rewrite: "rewrite";
4498
4581
  coordinator: "coordinator";
4499
4582
  aside: "aside";
@@ -4552,6 +4635,7 @@ declare const SessionSchemas: {
4552
4635
  adapterSessionId: _$zod.ZodOptional<_$zod.ZodString>;
4553
4636
  model: _$zod.ZodOptional<_$zod.ZodString>;
4554
4637
  cwd: _$zod.ZodOptional<_$zod.ZodString>;
4638
+ allowedDirectories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
4555
4639
  providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
4556
4640
  personaId: _$zod.ZodOptional<_$zod.ZodString>;
4557
4641
  profileId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -4567,8 +4651,8 @@ declare const SessionSchemas: {
4567
4651
  member: "member";
4568
4652
  }>;
4569
4653
  status: _$zod.ZodEnum<{
4570
- idle: "idle";
4571
4654
  active: "active";
4655
+ idle: "idle";
4572
4656
  dead: "dead";
4573
4657
  disposed: "disposed";
4574
4658
  }>;
@@ -4576,9 +4660,9 @@ declare const SessionSchemas: {
4576
4660
  lastActivityAt: _$zod.ZodNumber;
4577
4661
  }, _$zod_v4_core0.$strip>>;
4578
4662
  status: _$zod.ZodEnum<{
4579
- closed: "closed";
4580
4663
  active: "active";
4581
4664
  archived: "archived";
4665
+ closed: "closed";
4582
4666
  discovered: "discovered";
4583
4667
  }>;
4584
4668
  leadAgentId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -4590,10 +4674,10 @@ declare const SessionSchemas: {
4590
4674
  rootSessionId: _$zod.ZodOptional<_$zod.ZodString>;
4591
4675
  forkPointMessageId: _$zod.ZodOptional<_$zod.ZodString>;
4592
4676
  branchKind: _$zod.ZodOptional<_$zod.ZodEnum<{
4593
- branch: "branch";
4594
4677
  fork: "fork";
4595
4678
  subagent: "subagent";
4596
4679
  compress: "compress";
4680
+ branch: "branch";
4597
4681
  rewrite: "rewrite";
4598
4682
  coordinator: "coordinator";
4599
4683
  aside: "aside";
@@ -4661,6 +4745,7 @@ declare const SessionSchemas: {
4661
4745
  adapterSessionId: _$zod.ZodOptional<_$zod.ZodString>;
4662
4746
  model: _$zod.ZodOptional<_$zod.ZodString>;
4663
4747
  cwd: _$zod.ZodOptional<_$zod.ZodString>;
4748
+ allowedDirectories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
4664
4749
  providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
4665
4750
  personaId: _$zod.ZodOptional<_$zod.ZodString>;
4666
4751
  profileId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -4676,8 +4761,8 @@ declare const SessionSchemas: {
4676
4761
  member: "member";
4677
4762
  }>;
4678
4763
  status: _$zod.ZodEnum<{
4679
- idle: "idle";
4680
4764
  active: "active";
4765
+ idle: "idle";
4681
4766
  dead: "dead";
4682
4767
  disposed: "disposed";
4683
4768
  }>;
@@ -4786,6 +4871,14 @@ declare const SessionSchemas: {
4786
4871
  cost: _$zod.ZodOptional<_$zod.ZodNumber>;
4787
4872
  }, _$zod_v4_core0.$strip>>>;
4788
4873
  }, _$zod_v4_core0.$strip>>;
4874
+ initiator: _$zod.ZodOptional<_$zod.ZodObject<{
4875
+ source: _$zod.ZodEnum<{
4876
+ user: "user";
4877
+ system: "system";
4878
+ extension: "extension";
4879
+ }>;
4880
+ sourceId: _$zod.ZodOptional<_$zod.ZodString>;
4881
+ }, _$zod_v4_core0.$strip>>;
4789
4882
  }, _$zod_v4_core0.$strip>>;
4790
4883
  events: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodUnion<readonly [_$zod.ZodDiscriminatedUnion<[_$zod.ZodObject<{
4791
4884
  sessionId: _$zod.ZodString;
@@ -5046,10 +5139,10 @@ declare const SessionSchemas: {
5046
5139
  childSessionId: _$zod.ZodString;
5047
5140
  parentSessionId: _$zod.ZodString;
5048
5141
  kind: _$zod.ZodEnum<{
5049
- branch: "branch";
5050
5142
  fork: "fork";
5051
5143
  subagent: "subagent";
5052
5144
  compress: "compress";
5145
+ branch: "branch";
5053
5146
  rewrite: "rewrite";
5054
5147
  coordinator: "coordinator";
5055
5148
  aside: "aside";
@@ -5111,6 +5204,7 @@ declare const SessionSchemas: {
5111
5204
  adapterSessionId: _$zod.ZodOptional<_$zod.ZodString>;
5112
5205
  model: _$zod.ZodOptional<_$zod.ZodString>;
5113
5206
  cwd: _$zod.ZodOptional<_$zod.ZodString>;
5207
+ allowedDirectories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
5114
5208
  providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
5115
5209
  personaId: _$zod.ZodOptional<_$zod.ZodString>;
5116
5210
  profileId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -5126,8 +5220,8 @@ declare const SessionSchemas: {
5126
5220
  member: "member";
5127
5221
  }>;
5128
5222
  status: _$zod.ZodEnum<{
5129
- idle: "idle";
5130
5223
  active: "active";
5224
+ idle: "idle";
5131
5225
  dead: "dead";
5132
5226
  disposed: "disposed";
5133
5227
  }>;
@@ -5135,9 +5229,9 @@ declare const SessionSchemas: {
5135
5229
  lastActivityAt: _$zod.ZodNumber;
5136
5230
  }, _$zod_v4_core0.$strip>>;
5137
5231
  status: _$zod.ZodEnum<{
5138
- closed: "closed";
5139
5232
  active: "active";
5140
5233
  archived: "archived";
5234
+ closed: "closed";
5141
5235
  discovered: "discovered";
5142
5236
  }>;
5143
5237
  leadAgentId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -5149,10 +5243,10 @@ declare const SessionSchemas: {
5149
5243
  rootSessionId: _$zod.ZodOptional<_$zod.ZodString>;
5150
5244
  forkPointMessageId: _$zod.ZodOptional<_$zod.ZodString>;
5151
5245
  branchKind: _$zod.ZodOptional<_$zod.ZodEnum<{
5152
- branch: "branch";
5153
5246
  fork: "fork";
5154
5247
  subagent: "subagent";
5155
5248
  compress: "compress";
5249
+ branch: "branch";
5156
5250
  rewrite: "rewrite";
5157
5251
  coordinator: "coordinator";
5158
5252
  aside: "aside";
@@ -5220,6 +5314,7 @@ declare const SessionSchemas: {
5220
5314
  adapterSessionId: _$zod.ZodOptional<_$zod.ZodString>;
5221
5315
  model: _$zod.ZodOptional<_$zod.ZodString>;
5222
5316
  cwd: _$zod.ZodOptional<_$zod.ZodString>;
5317
+ allowedDirectories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
5223
5318
  providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
5224
5319
  personaId: _$zod.ZodOptional<_$zod.ZodString>;
5225
5320
  profileId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -5235,8 +5330,8 @@ declare const SessionSchemas: {
5235
5330
  member: "member";
5236
5331
  }>;
5237
5332
  status: _$zod.ZodEnum<{
5238
- idle: "idle";
5239
5333
  active: "active";
5334
+ idle: "idle";
5240
5335
  dead: "dead";
5241
5336
  disposed: "disposed";
5242
5337
  }>;
@@ -5345,6 +5440,14 @@ declare const SessionSchemas: {
5345
5440
  cost: _$zod.ZodOptional<_$zod.ZodNumber>;
5346
5441
  }, _$zod_v4_core0.$strip>>>;
5347
5442
  }, _$zod_v4_core0.$strip>>;
5443
+ initiator: _$zod.ZodOptional<_$zod.ZodObject<{
5444
+ source: _$zod.ZodEnum<{
5445
+ user: "user";
5446
+ system: "system";
5447
+ extension: "extension";
5448
+ }>;
5449
+ sourceId: _$zod.ZodOptional<_$zod.ZodString>;
5450
+ }, _$zod_v4_core0.$strip>>;
5348
5451
  }, _$zod_v4_core0.$strip>>;
5349
5452
  events: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodUnion<readonly [_$zod.ZodDiscriminatedUnion<[_$zod.ZodObject<{
5350
5453
  sessionId: _$zod.ZodString;
@@ -5605,10 +5708,10 @@ declare const SessionSchemas: {
5605
5708
  childSessionId: _$zod.ZodString;
5606
5709
  parentSessionId: _$zod.ZodString;
5607
5710
  kind: _$zod.ZodEnum<{
5608
- branch: "branch";
5609
5711
  fork: "fork";
5610
5712
  subagent: "subagent";
5611
5713
  compress: "compress";
5714
+ branch: "branch";
5612
5715
  rewrite: "rewrite";
5613
5716
  coordinator: "coordinator";
5614
5717
  aside: "aside";
@@ -6016,10 +6119,10 @@ declare const SessionSchemas: {
6016
6119
  childSessionId: _$zod.ZodString;
6017
6120
  parentSessionId: _$zod.ZodString;
6018
6121
  kind: _$zod.ZodEnum<{
6019
- branch: "branch";
6020
6122
  fork: "fork";
6021
6123
  subagent: "subagent";
6022
6124
  compress: "compress";
6125
+ branch: "branch";
6023
6126
  rewrite: "rewrite";
6024
6127
  coordinator: "coordinator";
6025
6128
  aside: "aside";
@@ -6059,9 +6162,9 @@ declare const SessionSchemas: {
6059
6162
  request: _$zod.ZodObject<{
6060
6163
  status: _$zod.ZodOptional<_$zod.ZodEnum<{
6061
6164
  all: "all";
6062
- closed: "closed";
6063
6165
  active: "active";
6064
6166
  archived: "archived";
6167
+ closed: "closed";
6065
6168
  discovered: "discovered";
6066
6169
  }>>;
6067
6170
  limit: _$zod.ZodOptional<_$zod.ZodNumber>;
@@ -6082,6 +6185,7 @@ declare const SessionSchemas: {
6082
6185
  adapterSessionId: _$zod.ZodOptional<_$zod.ZodString>;
6083
6186
  model: _$zod.ZodOptional<_$zod.ZodString>;
6084
6187
  cwd: _$zod.ZodOptional<_$zod.ZodString>;
6188
+ allowedDirectories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
6085
6189
  providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
6086
6190
  personaId: _$zod.ZodOptional<_$zod.ZodString>;
6087
6191
  profileId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -6097,8 +6201,8 @@ declare const SessionSchemas: {
6097
6201
  member: "member";
6098
6202
  }>;
6099
6203
  status: _$zod.ZodEnum<{
6100
- idle: "idle";
6101
6204
  active: "active";
6205
+ idle: "idle";
6102
6206
  dead: "dead";
6103
6207
  disposed: "disposed";
6104
6208
  }>;
@@ -6106,9 +6210,9 @@ declare const SessionSchemas: {
6106
6210
  lastActivityAt: _$zod.ZodNumber;
6107
6211
  }, _$zod_v4_core0.$strip>>;
6108
6212
  status: _$zod.ZodEnum<{
6109
- closed: "closed";
6110
6213
  active: "active";
6111
6214
  archived: "archived";
6215
+ closed: "closed";
6112
6216
  discovered: "discovered";
6113
6217
  }>;
6114
6218
  leadAgentId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -6120,10 +6224,10 @@ declare const SessionSchemas: {
6120
6224
  rootSessionId: _$zod.ZodOptional<_$zod.ZodString>;
6121
6225
  forkPointMessageId: _$zod.ZodOptional<_$zod.ZodString>;
6122
6226
  branchKind: _$zod.ZodOptional<_$zod.ZodEnum<{
6123
- branch: "branch";
6124
6227
  fork: "fork";
6125
6228
  subagent: "subagent";
6126
6229
  compress: "compress";
6230
+ branch: "branch";
6127
6231
  rewrite: "rewrite";
6128
6232
  coordinator: "coordinator";
6129
6233
  aside: "aside";
@@ -6196,9 +6300,9 @@ declare const SessionSchemas: {
6196
6300
  limit: _$zod.ZodOptional<_$zod.ZodNumber>;
6197
6301
  status: _$zod.ZodOptional<_$zod.ZodEnum<{
6198
6302
  all: "all";
6199
- closed: "closed";
6200
6303
  active: "active";
6201
6304
  archived: "archived";
6305
+ closed: "closed";
6202
6306
  discovered: "discovered";
6203
6307
  }>>;
6204
6308
  isImported: _$zod.ZodOptional<_$zod.ZodBoolean>;
@@ -6216,6 +6320,7 @@ declare const SessionSchemas: {
6216
6320
  adapterSessionId: _$zod.ZodOptional<_$zod.ZodString>;
6217
6321
  model: _$zod.ZodOptional<_$zod.ZodString>;
6218
6322
  cwd: _$zod.ZodOptional<_$zod.ZodString>;
6323
+ allowedDirectories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
6219
6324
  providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
6220
6325
  personaId: _$zod.ZodOptional<_$zod.ZodString>;
6221
6326
  profileId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -6231,8 +6336,8 @@ declare const SessionSchemas: {
6231
6336
  member: "member";
6232
6337
  }>;
6233
6338
  status: _$zod.ZodEnum<{
6234
- idle: "idle";
6235
6339
  active: "active";
6340
+ idle: "idle";
6236
6341
  dead: "dead";
6237
6342
  disposed: "disposed";
6238
6343
  }>;
@@ -6240,9 +6345,9 @@ declare const SessionSchemas: {
6240
6345
  lastActivityAt: _$zod.ZodNumber;
6241
6346
  }, _$zod_v4_core0.$strip>>;
6242
6347
  status: _$zod.ZodEnum<{
6243
- closed: "closed";
6244
6348
  active: "active";
6245
6349
  archived: "archived";
6350
+ closed: "closed";
6246
6351
  discovered: "discovered";
6247
6352
  }>;
6248
6353
  leadAgentId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -6254,10 +6359,10 @@ declare const SessionSchemas: {
6254
6359
  rootSessionId: _$zod.ZodOptional<_$zod.ZodString>;
6255
6360
  forkPointMessageId: _$zod.ZodOptional<_$zod.ZodString>;
6256
6361
  branchKind: _$zod.ZodOptional<_$zod.ZodEnum<{
6257
- branch: "branch";
6258
6362
  fork: "fork";
6259
6363
  subagent: "subagent";
6260
6364
  compress: "compress";
6365
+ branch: "branch";
6261
6366
  rewrite: "rewrite";
6262
6367
  coordinator: "coordinator";
6263
6368
  aside: "aside";
@@ -6341,6 +6446,7 @@ declare const SessionSchemas: {
6341
6446
  adapterSessionId: _$zod.ZodOptional<_$zod.ZodString>;
6342
6447
  model: _$zod.ZodOptional<_$zod.ZodString>;
6343
6448
  cwd: _$zod.ZodOptional<_$zod.ZodString>;
6449
+ allowedDirectories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
6344
6450
  providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
6345
6451
  personaId: _$zod.ZodOptional<_$zod.ZodString>;
6346
6452
  profileId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -6356,8 +6462,8 @@ declare const SessionSchemas: {
6356
6462
  member: "member";
6357
6463
  }>;
6358
6464
  status: _$zod.ZodEnum<{
6359
- idle: "idle";
6360
6465
  active: "active";
6466
+ idle: "idle";
6361
6467
  dead: "dead";
6362
6468
  disposed: "disposed";
6363
6469
  }>;
@@ -6365,9 +6471,9 @@ declare const SessionSchemas: {
6365
6471
  lastActivityAt: _$zod.ZodNumber;
6366
6472
  }, _$zod_v4_core0.$strip>>;
6367
6473
  status: _$zod.ZodEnum<{
6368
- closed: "closed";
6369
6474
  active: "active";
6370
6475
  archived: "archived";
6476
+ closed: "closed";
6371
6477
  discovered: "discovered";
6372
6478
  }>;
6373
6479
  leadAgentId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -6379,10 +6485,10 @@ declare const SessionSchemas: {
6379
6485
  rootSessionId: _$zod.ZodOptional<_$zod.ZodString>;
6380
6486
  forkPointMessageId: _$zod.ZodOptional<_$zod.ZodString>;
6381
6487
  branchKind: _$zod.ZodOptional<_$zod.ZodEnum<{
6382
- branch: "branch";
6383
6488
  fork: "fork";
6384
6489
  subagent: "subagent";
6385
6490
  compress: "compress";
6491
+ branch: "branch";
6386
6492
  rewrite: "rewrite";
6387
6493
  coordinator: "coordinator";
6388
6494
  aside: "aside";
@@ -6454,10 +6560,10 @@ declare const SessionSchemas: {
6454
6560
  }>>;
6455
6561
  forkPointMessageId: _$zod.ZodOptional<_$zod.ZodString>;
6456
6562
  branchKind: _$zod.ZodOptional<_$zod.ZodEnum<{
6457
- branch: "branch";
6458
6563
  fork: "fork";
6459
6564
  subagent: "subagent";
6460
6565
  compress: "compress";
6566
+ branch: "branch";
6461
6567
  rewrite: "rewrite";
6462
6568
  coordinator: "coordinator";
6463
6569
  aside: "aside";
@@ -6508,6 +6614,24 @@ declare const SessionSchemas: {
6508
6614
  success: _$zod.ZodBoolean;
6509
6615
  }, _$zod_v4_core0.$strip>;
6510
6616
  };
6617
+ restartAgents: {
6618
+ request: _$zod.ZodObject<{
6619
+ sessionId: _$zod.ZodString;
6620
+ }, _$zod_v4_core0.$strip>;
6621
+ response: _$zod.ZodObject<{
6622
+ sessionId: _$zod.ZodString;
6623
+ results: _$zod.ZodArray<_$zod.ZodDiscriminatedUnion<[_$zod.ZodObject<{
6624
+ agentId: _$zod.ZodString;
6625
+ adapterId: _$zod.ZodString;
6626
+ success: _$zod.ZodLiteral<true>;
6627
+ }, _$zod_v4_core0.$strip>, _$zod.ZodObject<{
6628
+ agentId: _$zod.ZodString;
6629
+ adapterId: _$zod.ZodString;
6630
+ success: _$zod.ZodLiteral<false>;
6631
+ error: _$zod.ZodString;
6632
+ }, _$zod_v4_core0.$strip>], "success">>;
6633
+ }, _$zod_v4_core0.$strip>;
6634
+ };
6511
6635
  archive: {
6512
6636
  request: _$zod.ZodObject<{
6513
6637
  sessionId: _$zod.ZodString;
@@ -6558,6 +6682,7 @@ declare const SessionSchemas: {
6558
6682
  adapterSessionId: _$zod.ZodOptional<_$zod.ZodString>;
6559
6683
  model: _$zod.ZodOptional<_$zod.ZodString>;
6560
6684
  cwd: _$zod.ZodOptional<_$zod.ZodString>;
6685
+ allowedDirectories: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
6561
6686
  providerConfigId: _$zod.ZodOptional<_$zod.ZodString>;
6562
6687
  personaId: _$zod.ZodOptional<_$zod.ZodString>;
6563
6688
  profileId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -6573,8 +6698,8 @@ declare const SessionSchemas: {
6573
6698
  member: "member";
6574
6699
  }>;
6575
6700
  status: _$zod.ZodEnum<{
6576
- idle: "idle";
6577
6701
  active: "active";
6702
+ idle: "idle";
6578
6703
  dead: "dead";
6579
6704
  disposed: "disposed";
6580
6705
  }>;
@@ -6582,9 +6707,9 @@ declare const SessionSchemas: {
6582
6707
  lastActivityAt: _$zod.ZodNumber;
6583
6708
  }, _$zod_v4_core0.$strip>>;
6584
6709
  status: _$zod.ZodEnum<{
6585
- closed: "closed";
6586
6710
  active: "active";
6587
6711
  archived: "archived";
6712
+ closed: "closed";
6588
6713
  discovered: "discovered";
6589
6714
  }>;
6590
6715
  leadAgentId: _$zod.ZodOptional<_$zod.ZodString>;
@@ -6596,10 +6721,10 @@ declare const SessionSchemas: {
6596
6721
  rootSessionId: _$zod.ZodOptional<_$zod.ZodString>;
6597
6722
  forkPointMessageId: _$zod.ZodOptional<_$zod.ZodString>;
6598
6723
  branchKind: _$zod.ZodOptional<_$zod.ZodEnum<{
6599
- branch: "branch";
6600
6724
  fork: "fork";
6601
6725
  subagent: "subagent";
6602
6726
  compress: "compress";
6727
+ branch: "branch";
6603
6728
  rewrite: "rewrite";
6604
6729
  coordinator: "coordinator";
6605
6730
  aside: "aside";
@@ -6671,6 +6796,64 @@ declare const SessionSchemas: {
6671
6796
  discovered: _$zod.ZodNumber;
6672
6797
  }, _$zod_v4_core0.$strip>;
6673
6798
  };
6799
+ registerExternal: {
6800
+ request: _$zod.ZodObject<{
6801
+ sessionId: _$zod.ZodOptional<_$zod.ZodString>;
6802
+ parentSessionId: _$zod.ZodOptional<_$zod.ZodString>;
6803
+ contextInheritance: _$zod.ZodOptional<_$zod.ZodEnum<{
6804
+ none: "none";
6805
+ "parent-history": "parent-history";
6806
+ }>>;
6807
+ forkPointMessageId: _$zod.ZodOptional<_$zod.ZodString>;
6808
+ branchKind: _$zod.ZodOptional<_$zod.ZodEnum<{
6809
+ fork: "fork";
6810
+ subagent: "subagent";
6811
+ compress: "compress";
6812
+ branch: "branch";
6813
+ rewrite: "rewrite";
6814
+ coordinator: "coordinator";
6815
+ aside: "aside";
6816
+ }>>;
6817
+ forkTransforms: _$zod.ZodOptional<_$zod.ZodObject<{
6818
+ removedMessageIds: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodString>>;
6819
+ appliedPipeline: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodObject<{
6820
+ actionId: _$zod.ZodString;
6821
+ options: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnknown>>;
6822
+ }, _$zod_v4_core0.$strip>>>;
6823
+ segments: _$zod.ZodOptional<_$zod.ZodArray<_$zod.ZodObject<{
6824
+ fromMessageId: _$zod.ZodString;
6825
+ toMessageId: _$zod.ZodString;
6826
+ policy: _$zod.ZodEnum<{
6827
+ verbatim: "verbatim";
6828
+ summarize: "summarize";
6829
+ exclude: "exclude";
6830
+ }>;
6831
+ stripReasoning: _$zod.ZodOptional<_$zod.ZodBoolean>;
6832
+ stripToolOutputs: _$zod.ZodOptional<_$zod.ZodBoolean>;
6833
+ overrides: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodLiteral<"exclude">>>;
6834
+ summaryText: _$zod.ZodOptional<_$zod.ZodString>;
6835
+ }, _$zod_v4_core0.$strip>>>;
6836
+ }, _$zod_v4_core0.$strip>>;
6837
+ title: _$zod.ZodOptional<_$zod.ZodString>;
6838
+ targetWorkingDirectory: _$zod.ZodOptional<_$zod.ZodString>;
6839
+ executionTargetId: _$zod.ZodOptional<_$zod.ZodString>;
6840
+ spawningToolCallId: _$zod.ZodOptional<_$zod.ZodString>;
6841
+ originWindowId: _$zod.ZodOptional<_$zod.ZodString>;
6842
+ adapterName: _$zod.ZodString;
6843
+ adapterSessionId: _$zod.ZodString;
6844
+ lastClientIdentityObservation: _$zod.ZodOptional<_$zod.ZodObject<{
6845
+ clientId: _$zod.ZodString;
6846
+ source: _$zod.ZodString;
6847
+ kind: _$zod.ZodString;
6848
+ observedAt: _$zod.ZodNumber;
6849
+ payload: _$zod.ZodType<Record<string, unknown>, Record<string, unknown>, _$zod_v4_core0.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>;
6850
+ }, _$zod_v4_core0.$strip>>;
6851
+ }, _$zod_v4_core0.$strip>;
6852
+ response: _$zod.ZodObject<{
6853
+ sessionId: _$zod.ZodString;
6854
+ created: _$zod.ZodBoolean;
6855
+ }, _$zod_v4_core0.$strip>;
6856
+ };
6674
6857
  };
6675
6858
  //#endregion
6676
6859
  //#region core/contracts/src/session/types.d.ts
@@ -6774,4 +6957,4 @@ type KnownSessionEvent = { [K in RuntimeKnownSessionEventType]: SessionEventBase
6774
6957
  */
6775
6958
  declare function isKnownSessionEvent(event: MakaioSessionEvent$1): event is KnownSessionEvent;
6776
6959
  //#endregion
6777
- export { BranchKind$1 as $, ForkTransformsSchema$1 as A, SESSION_EVENT_TYPES as B, TurnStatus as C, UsageMetrics as D, TurnUsageSchema$1 as E, SessionUpdatedEvent as F, SendMessageRequest as G, SessionEventType as H, SessionUpdatedEventSchema as I, SessionUsageResponse as J, SendMessageResponse as K, ForkChildInfo as L, SegmentPolicySchema as M, SessionCreated as N, UsageMetricsSchema as O, SessionCreatedEventSchema as P, AgentRoleSchema as Q, ForkChildInfoSchema as R, TurnSchema$1 as S, TurnUsage as T, SessionEventTypeMap as U, SessionEventPayload as V, SessionEventTypeSchema as W, TurnInitiatorSchema as X, TurnInitiator$1 as Y, AgentRole as Z, SessionMessageOriginSchema as _, MakaioSessionAgentSchema$1 as _t, SessionPreviewData as a, SessionSnapshotSchema as at, SessionMessageSchema$1 as b, SessionSchemas as c, SnapshotImportConflictErrorData as ct, MessageRoutingStatus as d, validateSnapshot as dt, BranchKindSchema as et, MessageRoutingStatusSchema as f, MakaioSessionSchema as ft, SessionMessageOrigin as g, AgentStatusSchema$1 as gt, SessionMessageBlockSchema as h, AgentStatus as ht, MakaioSessionEvent$1 as i, SessionSnapshot as it, SegmentPolicy as j, ForkTransforms$1 as k, MessageRouting as l, SnapshotPreviewData as lt, SessionMessageBlock$1 as m, SessionWithPreviewSchema as mt, KnownSessionEvent as n, ImportStatusSchema as nt, SessionWithPreview as o, SnapshotExportOptions as ot, SessionMessage$1 as p, SessionPreviewDataSchema as pt, SessionUsagePayload as q, MakaioSessionAgent$1 as r, SNAPSHOT_VERSION as rt, isKnownSessionEvent as s, SnapshotExportOptionsSchema as st, IMakaioSession$1 as t, ImportStatus as tt, MessageRoutingSchema$1 as u, safeValidateSnapshot as ut, SessionMessageRole as v, TurnStatusSchema$1 as w, Turn$1 as x, SessionMessageRoleSchema as y, MakaioSessionEventSchema as z };
6960
+ export { ImportStatus as $, MessageRoutingStatusSchema as A, TurnInitiator$2 as B, SessionEventTypeMap as C, MessageRouting as D, SendMessageResponse as E, SessionMessageOriginSchema as F, TurnUsage as G, TurnSchema$1 as H, SessionMessageRole as I, UsageMetricsSchema as J, TurnUsageSchema$1 as K, SessionMessageRoleSchema as L, SessionMessageBlock$1 as M, SessionMessageBlockSchema as N, MessageRoutingSchema$1 as O, SessionMessageOrigin as P, BranchKindSchema as Q, SessionMessageSchema$1 as R, SessionEventType as S, SendMessageRequest as T, TurnStatus as U, TurnInitiatorSchema$1 as V, TurnStatusSchema$1 as W, AgentRoleSchema as X, AgentRole as Y, BranchKind$1 as Z, ForkChildInfo as _, SessionCreateBaseSchema as _t, SessionPreviewData as a, SnapshotExportOptionsSchema as at, SESSION_EVENT_TYPES as b, SessionSchemas as c, safeValidateSnapshot as ct, SegmentPolicy as d, SessionPreviewDataSchema as dt, ImportStatusSchema as et, SegmentPolicySchema as f, SessionWithPreviewSchema as ft, SessionUpdatedEventSchema as g, SessionCreateBase as gt, SessionUpdatedEvent as h, MakaioSessionAgentSchema$1 as ht, MakaioSessionEvent$1 as i, SnapshotExportOptions as it, SessionMessage$1 as j, MessageRoutingStatus as k, ForkTransforms$1 as l, validateSnapshot as lt, SessionCreatedEventSchema as m, AgentStatusSchema$1 as mt, KnownSessionEvent as n, SessionSnapshot as nt, SessionWithPreview as o, SnapshotImportConflictErrorData as ot, SessionCreated as p, AgentStatus as pt, UsageMetrics as q, MakaioSessionAgent$1 as r, SessionSnapshotSchema as rt, isKnownSessionEvent as s, SnapshotPreviewData as st, IMakaioSession$1 as t, SNAPSHOT_VERSION as tt, ForkTransformsSchema$1 as u, MakaioSessionSchema as ut, ForkChildInfoSchema as v, SessionEventTypeSchema as w, SessionEventPayload as x, MakaioSessionEventSchema as y, Turn$1 as z };