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

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 (146) hide show
  1. package/dist/.makaio-build.json +2 -2
  2. package/dist/adapter-Lx6K7yQS.mjs +1 -0
  3. package/dist/adapter-subsystem/index.mjs +1 -1
  4. package/dist/adapters/config/index.d.mts +1 -1
  5. package/dist/adapters/index.d.mts +219 -40
  6. package/dist/adapters/index.mjs +6 -6
  7. package/dist/adapters/node.d.mts +1 -1
  8. package/dist/adapters/node.mjs +1 -1
  9. package/dist/{base-orchestrator-BNysGvaM.d.mts → base-orchestrator-ODRyDBzu.d.mts} +9 -1
  10. package/dist/bus/index.mjs +1 -1
  11. package/dist/client-n0OJiTt1.mjs +1 -0
  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/adapter/schemas/session-lineage.mjs +1 -1
  16. package/dist/contracts/artifact/index.d.mts +1 -1
  17. package/dist/contracts/client/index.d.mts +2 -2
  18. package/dist/contracts/client/index.mjs +1 -1
  19. package/dist/contracts/config/index.d.mts +6 -6
  20. package/dist/contracts/extension/index.d.mts +3 -3
  21. package/dist/contracts/facet/index.d.mts +1 -1
  22. package/dist/contracts/harness/index.d.mts +1 -1
  23. package/dist/contracts/index.d.mts +372 -194
  24. package/dist/contracts/index.mjs +1 -1
  25. package/dist/contracts/materialization/index.d.mts +2 -2
  26. package/dist/contracts/provider/index.d.mts +1 -1
  27. package/dist/contracts/session/index.d.mts +3 -3
  28. package/dist/contracts/session/index.mjs +1 -1
  29. package/dist/contracts/shared/index.d.mts +1 -1
  30. package/dist/contracts/variant/index.d.mts +1 -1
  31. package/dist/contracts/workflow/index.d.mts +2 -2
  32. package/dist/{definition-b9jyJqPD.d.mts → definition-DpkfJi8v.d.mts} +1 -1
  33. package/dist/drizzle/0023_m_mr9gc37m.sql +1 -0
  34. package/dist/drizzle/meta/_journal.json +7 -0
  35. package/dist/handlers-B74FvKlA.mjs +57 -0
  36. package/dist/hooks/index.d.mts +19 -2
  37. package/dist/{identity-BarL3JYI.mjs → identity-DC3Pk0ps.mjs} +1 -1
  38. package/dist/{index-4eP9DRL_.d.mts → index-B3fjN5HX.d.mts} +7 -7
  39. package/dist/{index-3X0368CL.d.mts → index-B5Uczo3R.d.mts} +24 -24
  40. package/dist/{index-C6Ys8pxt.d.mts → index-BIZeIA5k.d.mts} +6 -6
  41. package/dist/{index-BYfSAJRC.d.mts → index-BvTd61i5.d.mts} +151 -29
  42. package/dist/{index-B5w-0Gg9.d.mts → index-BvjLe_w9.d.mts} +12 -12
  43. package/dist/{index-DQYj8-53.d.mts → index-C8k2f_E0.d.mts} +1 -1
  44. package/dist/{index-DEzdNQum.d.mts → index-CYHWOXUm.d.mts} +1 -1
  45. package/dist/{index-3J0HZlPH.d.mts → index-CwHP8Jxs.d.mts} +145 -12
  46. package/dist/{index-D6aAzr32.d.mts → index-Cyi7y_aG.d.mts} +20 -20
  47. package/dist/{index-BKZhnb2B.d.mts → index-D7Fu3375.d.mts} +404 -24
  48. package/dist/{index-31vR1sxk.d.mts → index-DFK3tpEY.d.mts} +70 -10
  49. package/dist/{index-DV4nRk0h.d.mts → index-DS6kxiFl.d.mts} +15 -15
  50. package/dist/{index-O08Q2ikz.d.mts → index-DTBQOCar.d.mts} +8 -8
  51. package/dist/{index-DvHYpi-J.d.mts → index-DmJ-OpTD.d.mts} +917 -68
  52. package/dist/{index-C5C1tk9f.d.mts → index-Dtb2cVJz.d.mts} +47 -47
  53. package/dist/{index-CaerrEDH.d.mts → index-NkNbYFud.d.mts} +1 -1
  54. package/dist/{index-D9-vOJvZ.d.mts → index-h5go5Dtd.d.mts} +1 -1
  55. package/dist/kernel/extension/index.d.mts +1 -1
  56. package/dist/kernel/index.d.mts +2 -2
  57. package/dist/kernel/observability/index.d.mts +1 -1
  58. package/dist/{namespace-D8P8Sxce2.d.mts → namespace-6sIu5nBI2.d.mts} +2 -2
  59. package/dist/{namespace-CfvtDD_U.d.mts → namespace-BLER-Qom.d.mts} +2 -2
  60. package/dist/{namespace-B3ol3pc-.d.mts → namespace-BigVYQyx.d.mts} +12 -0
  61. package/dist/{namespace-j7vFsmYL.d.mts → namespace-C74bbsdZ.d.mts} +2 -2
  62. package/dist/{namespace-B4cV_pk3.d.mts → namespace-CGxFYDlK.d.mts} +32 -32
  63. package/dist/{namespace-DhDY0juT.d.mts → namespace-D4Uf5Mw_.d.mts} +366 -18
  64. package/dist/{namespace-DmqoDDRD.d.mts → namespace-DRXQyBe0.d.mts} +46 -2
  65. package/dist/{namespace-Bm77p82L.d.mts → namespace-JFzrlNs4.d.mts} +24 -24
  66. package/dist/{package-MmQvNJ3u.d.mts → package-B6mEMD8r.d.mts} +5 -0
  67. package/dist/{package-BmRhhi-3.mjs → package-BQn_RTo7.mjs} +1 -1
  68. package/dist/package.json +1 -1
  69. package/dist/{schema-DLNBajAV.d.mts → schema-B9goOieO.d.mts} +27 -0
  70. package/dist/{schemas-DuuVuhHX2.d.mts → schemas-9S9Y9PHT2.d.mts} +5 -5
  71. package/dist/{schemas-CoFCV42v.d.mts → schemas-B_t6oOK-.d.mts} +2 -2
  72. package/dist/{schemas-lnE9YoG7.d.mts → schemas-CW6YsPT4.d.mts} +3 -3
  73. package/dist/schemas-CkOigLAT.mjs +1 -0
  74. package/dist/{schemas-BemsLc_V.d.mts → schemas-CurUbHy4.d.mts} +4 -4
  75. package/dist/{schemas-DMMWmWjq.d.mts → schemas-DXeGCbJ9.d.mts} +1 -1
  76. package/dist/{schemas-DWfo0wp4.d.mts → schemas-DnmbwE_V.d.mts} +7 -7
  77. package/dist/{schemas-DmGRSeIq.d.mts → schemas-t6h9oSct.d.mts} +28 -1
  78. package/dist/services/adapter-runtime/index.d.mts +4 -4
  79. package/dist/services/adapter-runtime/index.mjs +1 -1
  80. package/dist/services/adapter-runtime/namespace.d.mts +1 -1
  81. package/dist/services/adapter-runtime/schemas.d.mts +2 -2
  82. package/dist/services/adapter-runtime/schemas.mjs +1 -1
  83. package/dist/services/adapter-subsystem/index.d.mts +2 -2
  84. package/dist/services/adapter-subsystem/namespace.d.mts +1 -1
  85. package/dist/services/agent-runtime/index.d.mts +2 -2
  86. package/dist/services/agent-runtime/namespace.d.mts +1 -1
  87. package/dist/services/agent-runtime/schemas.d.mts +1 -1
  88. package/dist/services/context-rules/index.d.mts +3 -3
  89. package/dist/services/filesystem/namespace.d.mts +6 -6
  90. package/dist/services/filesystem/schemas.d.mts +3 -3
  91. package/dist/services/git/namespace.d.mts +2 -2
  92. package/dist/services/git/schemas.d.mts +1 -1
  93. package/dist/services/harness/index.d.mts +3 -3
  94. package/dist/services/index.d.mts +55 -48
  95. package/dist/services/index.mjs +1 -1
  96. package/dist/services/log-import/browser.d.mts +1 -1
  97. package/dist/services/log-import/index.d.mts +14 -1
  98. package/dist/services/log-import/index.mjs +2 -2
  99. package/dist/services/preferences/index.d.mts +2 -2
  100. package/dist/services/preferences/schemas.d.mts +1 -1
  101. package/dist/services/preferences/storage-namespace.d.mts +2 -2
  102. package/dist/services/session/handlers/index.d.mts +1 -1
  103. package/dist/services/session/handlers/index.mjs +1 -1
  104. package/dist/services/session/index.d.mts +7 -7
  105. package/dist/services/session/index.mjs +1 -1
  106. package/dist/services/session/messages/namespace.d.mts +1 -1
  107. package/dist/services/session/session-events/namespace.d.mts +1 -1
  108. package/dist/services/session/storage/namespace.d.mts +1 -1
  109. package/dist/services/session/storage/schema.d.mts +1 -1
  110. package/dist/services/session/storage/schema.mjs +1 -1
  111. package/dist/services/session/testing/index.mjs +3 -2
  112. package/dist/services/session-editor/index.d.mts +1 -1
  113. package/dist/services/settings/namespace.d.mts +5 -5
  114. package/dist/services/subagent-template/index.d.mts +2 -2
  115. package/dist/services/subagent-template/namespace.d.mts +1 -1
  116. package/dist/services/subagent-template/schemas.d.mts +1 -1
  117. package/dist/services/tool-approval/index.mjs +1 -1
  118. package/dist/services/tools/index.mjs +1 -1
  119. package/dist/services/tray-menu/index.d.mts +2 -2
  120. package/dist/services/tray-menu/namespace.d.mts +1 -1
  121. package/dist/services/tray-menu/schemas.d.mts +1 -1
  122. package/dist/session-CZUrp7gC.mjs +69 -0
  123. package/dist/session-Dp7z5N1d.mjs +1 -0
  124. package/dist/{session-lineage-DR-9DU-U.d.mts → session-lineage-C1M7-O3C.d.mts} +3 -3
  125. package/dist/{storage-namespace-Di1A3DMm.d.mts → storage-namespace-BvRF22by.d.mts} +10 -10
  126. package/dist/{tool-approval-service-MU_DmJsf.mjs → tool-approval-service-BIbUSuqg.mjs} +1 -1
  127. package/dist/{tools-BrNm-een.mjs → tools-Yz8XyiwA.mjs} +1 -1
  128. package/dist/{transition-Dq41YCkc.d.mts → transition-DYorNHZu.d.mts} +1 -1
  129. package/dist/{types-C76EP81O.d.mts → types-9XCB1aPK.d.mts} +442 -30
  130. package/dist/{types-BMS6yfLS.d.mts → types-BNW5n6qm.d.mts} +1 -1
  131. package/dist/{types-BMlzmWp6.d.mts → types-BWduCvRU.d.mts} +11 -0
  132. package/dist/{types-Cse8s_cD.d.mts → types-N_BOtTqt.d.mts} +29 -18
  133. package/dist/ui-kernel/index.d.mts +4 -4
  134. package/dist/ui-kernel/pages/namespace.d.mts +4 -4
  135. package/dist/ui-kernel/pages/schemas.d.mts +1 -1
  136. package/dist/workflow-engine/index.d.mts +44 -44
  137. package/dist/workflow-engine/index.mjs +1 -1
  138. package/dist/workflow-engine/package.d.mts +1 -1
  139. package/dist/workflow-engine/package.mjs +1 -1
  140. package/package.json +1 -1
  141. package/dist/adapter-BRxCc72E.mjs +0 -1
  142. package/dist/client-BgUjVbXX.mjs +0 -1
  143. package/dist/handlers-v47Gbsr1.mjs +0 -57
  144. package/dist/schemas-ftgVeWIG.mjs +0 -1
  145. package/dist/session-CKWfn3oc.mjs +0 -1
  146. package/dist/session-DCbJwYEU.mjs +0 -69
@@ -1,6 +1,6 @@
1
1
  import { ExtractSubjectPayload, SubjectDefinition } from "@makaio/framework/core";
2
2
  import { IMakaioBus, InterceptorContext } from "@makaio/framework/bus";
3
- import { IMakaioSession, JsonValue, MessageInput, SessionContext, SessionMessageBlock, SessionSubjects, StepFinished, StepType, Turn } from "@makaio/framework/contracts";
3
+ import { IMakaioSession, JsonValue, MessageInput, SessionContext, SessionMessageBlock, SessionSubjects, StartMode, StepFinished, StepType, Turn } from "@makaio/framework/contracts";
4
4
  import { SessionSendMessageRequest } from "@makaio/framework/contracts/session";
5
5
 
6
6
  //#region packages/hooks/src/types/hook-name.d.ts
@@ -314,7 +314,24 @@ interface PostStepHookOptions extends BaseHookOptions {
314
314
  }
315
315
  type PreToolUseHookOptions = BaseHookOptions;
316
316
  type PostToolUseHookOptions = BaseHookOptions;
317
- type SessionStartHookOptions = BaseHookOptions;
317
+ /**
318
+ * Options for SessionStart hook.
319
+ *
320
+ * SessionStart hooks fire on `agent.started` events filtered by
321
+ * {@link startModes}. The default filter is `['fresh', 'fork']` so that
322
+ * hooks behave as session-initialisation hooks rather than per-turn hooks.
323
+ */
324
+ interface SessionStartHookOptions extends BaseHookOptions {
325
+ /**
326
+ * Start modes that trigger this hook.
327
+ *
328
+ * - `['fresh']` — only brand-new sessions (e.g. content injectors)
329
+ * - `['fresh', 'fork']` — new sessions and forks (default)
330
+ * - `START_MODES` — all modes (e.g. provider-lifecycle telemetry)
331
+ * Defaults to `['fresh', 'fork']`.
332
+ */
333
+ startModes?: readonly StartMode[];
334
+ }
318
335
  type SessionEndHookOptions = BaseHookOptions;
319
336
  //#endregion
320
337
  //#region packages/hooks/src/create-hook.d.ts
@@ -1 +1 @@
1
- import{AdapterRuntimeSubjects as e}from"./services/adapter-runtime/namespace.mjs";import{AdapterSubjects as t}from"@makaio/framework/contracts";const n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function i(e,t){return e>>>t|e<<32-t}function a(e){let t=new TextEncoder().encode(e),a=t.length*8,o=t.length+9+63>>6<<6>>>0,s=new Uint8Array(o);s.set(t),s[t.length]=128;let c=new DataView(s.buffer),l=Math.floor(a/4294967296),u=a>>>0;c.setUint32(o-8,l,!1),c.setUint32(o-4,u,!1);let d=[...r],f=new Uint32Array(64);for(let e=0;e<s.length;e+=64){for(let t=0;t<16;t+=1)f[t]=c.getUint32(e+t*4,!1);for(let e=16;e<64;e+=1){let t=i(f[e-15],7)^i(f[e-15],18)^f[e-15]>>>3,n=i(f[e-2],17)^i(f[e-2],19)^f[e-2]>>>10;f[e]=f[e-16]+t+f[e-7]+n>>>0}let[t,r,a,o,s,l,u,p]=d;for(let e=0;e<64;e+=1){let c=i(s,6)^i(s,11)^i(s,25),d=s&l^~s&u,m=p+c+d+n[e]+f[e]>>>0,h=(i(t,2)^i(t,13)^i(t,22))+(t&r^t&a^r&a)>>>0;p=u,u=l,l=s,s=o+m>>>0,o=a,a=r,r=t,t=m+h>>>0}d[0]=d[0]+t>>>0,d[1]=d[1]+r>>>0,d[2]=d[2]+a>>>0,d[3]=d[3]+o>>>0,d[4]=d[4]+s>>>0,d[5]=d[5]+l>>>0,d[6]=d[6]+u>>>0,d[7]=d[7]+p>>>0}return d.map(e=>e.toString(16).padStart(8,`0`)).join(``)}function o(e,t){let n=a(JSON.stringify([e,t]));return[n.slice(0,8),n.slice(8,12),`5${n.slice(13,16)}`,`a${n.slice(17,20)}`,n.slice(20,32)].join(`-`)}function s(e,t){let n=e.machineId??t;if(!n)throw Error(`resolveId requires machineId when no runtime default machine is configured for adapterName="${e.adapterName}"`);return o(n,e.adapterName)}var c=class{currentMachineId;adapterNamesById=new Map;localAdapterIds=new Set;constructor(e){this.currentMachineId=e}replaceKnownAdapterNames(e){for(let e of this.localAdapterIds)this.adapterNamesById.delete(e);if(this.localAdapterIds=new Set,this.currentMachineId)for(let t of e){let e=o(this.currentMachineId,t);this.adapterNamesById.set(e,t),this.localAdapterIds.add(e)}}resolveId(e){let t=s(e,this.currentMachineId);return this.rememberAdapterId(t,e.adapterName),t}rememberAdapterId(e,t){this.adapterNamesById.set(e,t)}resolveAdapterName(e){return this.adapterNamesById.get(e)}async resolveAdapterNameFromKnownNames(e,t){return this.resolveAdapterName(e)||(this.replaceKnownAdapterNames(await t()),this.resolveAdapterName(e))}clear(){this.adapterNamesById.clear(),this.localAdapterIds.clear()}};function l(n,r={}){let i=new c(r.currentMachineId);r.knownAdapterNames&&i.replaceKnownAdapterNames(r.knownAdapterNames);let a=[n.on(t.initialized,e=>{i.rememberAdapterId(e.payload.adapterId,e.payload.adapterName)}),n.on(e.resolveId,e=>{e.setResult({adapterId:i.resolveId(e.payload)})}),n.on(e.resolveName,async e=>{let t=i.resolveAdapterName(e.payload.adapterId)??(r.listKnownAdapterNames?await i.resolveAdapterNameFromKnownNames(e.payload.adapterId,r.listKnownAdapterNames):void 0);if(!t)throw Error(`Adapter not found for adapterId="${e.payload.adapterId}"`);e.setResult({adapterName:t})})];return{registry:i,cleanup:()=>{for(let e of a)e()}}}export{s as i,o as n,l as r,c as t};
1
+ import{AdapterRuntimeSubjects as e}from"./services/adapter-runtime/namespace.mjs";import{AdapterSubjects as t}from"@makaio/framework/contracts";const n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],r=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function i(e,t){return e>>>t|e<<32-t}function a(e){let t=new TextEncoder().encode(e),a=t.length*8,o=t.length+9+63>>6<<6>>>0,s=new Uint8Array(o);s.set(t),s[t.length]=128;let c=new DataView(s.buffer),l=Math.floor(a/4294967296),u=a>>>0;c.setUint32(o-8,l,!1),c.setUint32(o-4,u,!1);let d=[...r],f=new Uint32Array(64);for(let e=0;e<s.length;e+=64){for(let t=0;t<16;t+=1)f[t]=c.getUint32(e+t*4,!1);for(let e=16;e<64;e+=1){let t=i(f[e-15],7)^i(f[e-15],18)^f[e-15]>>>3,n=i(f[e-2],17)^i(f[e-2],19)^f[e-2]>>>10;f[e]=f[e-16]+t+f[e-7]+n>>>0}let[t,r,a,o,s,l,u,p]=d;for(let e=0;e<64;e+=1){let c=i(s,6)^i(s,11)^i(s,25),d=s&l^~s&u,m=p+c+d+n[e]+f[e]>>>0,h=(i(t,2)^i(t,13)^i(t,22))+(t&r^t&a^r&a)>>>0;p=u,u=l,l=s,s=o+m>>>0,o=a,a=r,r=t,t=m+h>>>0}d[0]=d[0]+t>>>0,d[1]=d[1]+r>>>0,d[2]=d[2]+a>>>0,d[3]=d[3]+o>>>0,d[4]=d[4]+s>>>0,d[5]=d[5]+l>>>0,d[6]=d[6]+u>>>0,d[7]=d[7]+p>>>0}return d.map(e=>e.toString(16).padStart(8,`0`)).join(``)}function o(e,t){let n=a(JSON.stringify([e,t]));return[n.slice(0,8),n.slice(8,12),`5${n.slice(13,16)}`,`a${n.slice(17,20)}`,n.slice(20,32)].join(`-`)}function s(e,t){let n=e.machineId??t;if(!n)throw Error(`resolveId requires machineId when no runtime default machine is configured for adapterName="${e.adapterName}"`);return o(n,e.adapterName)}var c=class{currentMachineId;adapterNamesById=new Map;localAdapterIds=new Set;constructor(e){this.currentMachineId=e}replaceKnownAdapterNames(e){for(let e of this.localAdapterIds)this.adapterNamesById.delete(e);if(this.localAdapterIds=new Set,this.currentMachineId)for(let t of e){let e=o(this.currentMachineId,t);this.adapterNamesById.set(e,t),this.localAdapterIds.add(e)}}resolveId(e){let t=s(e,this.currentMachineId);return this.rememberAdapterId(t,e.adapterName),t}rememberAdapterId(e,t){this.adapterNamesById.set(e,t)}resolveAdapterName(e){return this.adapterNamesById.get(e)}async resolveAdapterNameFromKnownNames(e,t){return this.resolveAdapterName(e)||(this.replaceKnownAdapterNames(await t()),this.resolveAdapterName(e))}clear(){this.adapterNamesById.clear(),this.localAdapterIds.clear()}};function l(n,r={}){let i=new c(r.currentMachineId);r.knownAdapterNames&&i.replaceKnownAdapterNames(r.knownAdapterNames);let a=[n.on(t.initialized,e=>{i.rememberAdapterId(e.payload.adapterId,e.payload.adapterName)}),n.on(e.resolveId,e=>{e.setResult({adapterId:i.resolveId(e.payload)})}),n.on(e.getMachineId,e=>{e.setResult({machineId:r.currentMachineId})}),n.on(e.resolveName,async e=>{let t=i.resolveAdapterName(e.payload.adapterId)??(r.listKnownAdapterNames?await i.resolveAdapterNameFromKnownNames(e.payload.adapterId,r.listKnownAdapterNames):void 0);if(!t)throw Error(`Adapter not found for adapterId="${e.payload.adapterId}"`);e.setResult({adapterName:t})})];return{registry:i,cleanup:()=>{for(let e of a)e()}}}export{s as i,o as n,l as r,c as t};
@@ -27,9 +27,9 @@ type MakaioVariant = z.infer<typeof MakaioVariantSchema>;
27
27
  */
28
28
  declare const VariantUpgradeStatusSchema: z.ZodEnum<{
29
29
  error: "error";
30
+ progress: "progress";
30
31
  complete: "complete";
31
32
  downloading: "downloading";
32
- progress: "progress";
33
33
  applying: "applying";
34
34
  }>;
35
35
  /** Inferred TypeScript type for an upgrade status value. */
@@ -58,8 +58,8 @@ declare const VariantSchemas: {
58
58
  }>;
59
59
  bundleCEF: z.ZodBoolean;
60
60
  defaultRenderer: z.ZodEnum<{
61
- cef: "cef";
62
61
  native: "native";
62
+ cef: "cef";
63
63
  }>;
64
64
  }, z.core.$strip>;
65
65
  };
@@ -101,9 +101,9 @@ declare const VariantSchemas: {
101
101
  upgradeProgress: z.ZodObject<{
102
102
  status: z.ZodEnum<{
103
103
  error: "error";
104
+ progress: "progress";
104
105
  complete: "complete";
105
106
  downloading: "downloading";
106
- progress: "progress";
107
107
  applying: "applying";
108
108
  }>;
109
109
  percent: z.ZodOptional<z.ZodNumber>;
@@ -134,8 +134,8 @@ declare const VariantNamespace: _$_makaio_core0.BusNamespaceDefinition<"host:var
134
134
  }>;
135
135
  bundleCEF: _$zod.ZodBoolean;
136
136
  defaultRenderer: _$zod.ZodEnum<{
137
- cef: "cef";
138
137
  native: "native";
138
+ cef: "cef";
139
139
  }>;
140
140
  }, _$zod_v4_core0.$strip>;
141
141
  };
@@ -158,9 +158,9 @@ declare const VariantNamespace: _$_makaio_core0.BusNamespaceDefinition<"host:var
158
158
  upgradeProgress: _$zod.ZodObject<{
159
159
  status: _$zod.ZodEnum<{
160
160
  error: "error";
161
+ progress: "progress";
161
162
  complete: "complete";
162
163
  downloading: "downloading";
163
- progress: "progress";
164
164
  applying: "applying";
165
165
  }>;
166
166
  percent: _$zod.ZodOptional<_$zod.ZodNumber>;
@@ -181,8 +181,8 @@ declare const VariantSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatS
181
181
  }>;
182
182
  bundleCEF: _$zod.ZodBoolean;
183
183
  defaultRenderer: _$zod.ZodEnum<{
184
- cef: "cef";
185
184
  native: "native";
185
+ cef: "cef";
186
186
  }>;
187
187
  }, _$zod_v4_core0.$strip>;
188
188
  };
@@ -205,9 +205,9 @@ declare const VariantSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.FlatS
205
205
  upgradeProgress: _$zod.ZodObject<{
206
206
  status: _$zod.ZodEnum<{
207
207
  error: "error";
208
+ progress: "progress";
208
209
  complete: "complete";
209
210
  downloading: "downloading";
210
- progress: "progress";
211
211
  applying: "applying";
212
212
  }>;
213
213
  percent: _$zod.ZodOptional<_$zod.ZodNumber>;
@@ -18,11 +18,11 @@ import { ExtensionWarningEntry, ExtensionWarningEntrySchema } from "@makaio/fram
18
18
  * detail, not an externally observable state.
19
19
  */
20
20
  declare const ComponentStateSchema: z.ZodEnum<{
21
+ stopped: "stopped";
21
22
  failed: "failed";
22
23
  discovered: "discovered";
23
- stopped: "stopped";
24
- active: "active";
25
24
  skipped: "skipped";
25
+ active: "active";
26
26
  initializing: "initializing";
27
27
  }>;
28
28
  /** Inferred union of all valid component lifecycle states. */
@@ -47,11 +47,11 @@ declare const ComponentInfoSchema: z.ZodObject<{
47
47
  name: z.ZodString;
48
48
  displayName: z.ZodString;
49
49
  state: z.ZodEnum<{
50
+ stopped: "stopped";
50
51
  failed: "failed";
51
52
  discovered: "discovered";
52
- stopped: "stopped";
53
- active: "active";
54
53
  skipped: "skipped";
54
+ active: "active";
55
55
  initializing: "initializing";
56
56
  }>;
57
57
  error: z.ZodOptional<z.ZodString>;
@@ -68,11 +68,11 @@ declare const ServiceInfoSchema: z.ZodObject<{
68
68
  name: z.ZodString;
69
69
  displayName: z.ZodString;
70
70
  state: z.ZodEnum<{
71
+ stopped: "stopped";
71
72
  failed: "failed";
72
73
  discovered: "discovered";
73
- stopped: "stopped";
74
- active: "active";
75
74
  skipped: "skipped";
75
+ active: "active";
76
76
  initializing: "initializing";
77
77
  }>;
78
78
  error: z.ZodOptional<z.ZodString>;
@@ -90,11 +90,11 @@ declare const ExtensionInfoSchema: z.ZodObject<{
90
90
  name: z.ZodString;
91
91
  displayName: z.ZodString;
92
92
  state: z.ZodEnum<{
93
+ stopped: "stopped";
93
94
  failed: "failed";
94
95
  discovered: "discovered";
95
- stopped: "stopped";
96
- active: "active";
97
96
  skipped: "skipped";
97
+ active: "active";
98
98
  initializing: "initializing";
99
99
  }>;
100
100
  error: z.ZodOptional<z.ZodString>;
@@ -138,19 +138,19 @@ declare const ExtensionNamespace: _$_makaio_core0.BusNamespaceDefinition<"kernel
138
138
  name: z.ZodString;
139
139
  displayName: z.ZodString;
140
140
  from: z.ZodEnum<{
141
+ stopped: "stopped";
141
142
  failed: "failed";
142
143
  discovered: "discovered";
143
- stopped: "stopped";
144
- active: "active";
145
144
  skipped: "skipped";
145
+ active: "active";
146
146
  initializing: "initializing";
147
147
  }>;
148
148
  to: z.ZodEnum<{
149
+ stopped: "stopped";
149
150
  failed: "failed";
150
151
  discovered: "discovered";
151
- stopped: "stopped";
152
- active: "active";
153
152
  skipped: "skipped";
153
+ active: "active";
154
154
  initializing: "initializing";
155
155
  }>;
156
156
  error: z.ZodOptional<z.ZodString>;
@@ -181,11 +181,11 @@ declare const ExtensionNamespace: _$_makaio_core0.BusNamespaceDefinition<"kernel
181
181
  name: z.ZodString;
182
182
  displayName: z.ZodString;
183
183
  state: z.ZodEnum<{
184
+ stopped: "stopped";
184
185
  failed: "failed";
185
186
  discovered: "discovered";
186
- stopped: "stopped";
187
- active: "active";
188
187
  skipped: "skipped";
188
+ active: "active";
189
189
  initializing: "initializing";
190
190
  }>;
191
191
  error: z.ZodOptional<z.ZodString>;
@@ -219,11 +219,11 @@ declare const ExtensionNamespace: _$_makaio_core0.BusNamespaceDefinition<"kernel
219
219
  name: z.ZodString;
220
220
  displayName: z.ZodString;
221
221
  state: z.ZodEnum<{
222
+ stopped: "stopped";
222
223
  failed: "failed";
223
224
  discovered: "discovered";
224
- stopped: "stopped";
225
- active: "active";
226
225
  skipped: "skipped";
226
+ active: "active";
227
227
  initializing: "initializing";
228
228
  }>;
229
229
  error: z.ZodOptional<z.ZodString>;
@@ -593,19 +593,19 @@ declare const ExtensionSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fla
593
593
  name: z.ZodString;
594
594
  displayName: z.ZodString;
595
595
  from: z.ZodEnum<{
596
+ stopped: "stopped";
596
597
  failed: "failed";
597
598
  discovered: "discovered";
598
- stopped: "stopped";
599
- active: "active";
600
599
  skipped: "skipped";
600
+ active: "active";
601
601
  initializing: "initializing";
602
602
  }>;
603
603
  to: z.ZodEnum<{
604
+ stopped: "stopped";
604
605
  failed: "failed";
605
606
  discovered: "discovered";
606
- stopped: "stopped";
607
- active: "active";
608
607
  skipped: "skipped";
608
+ active: "active";
609
609
  initializing: "initializing";
610
610
  }>;
611
611
  error: z.ZodOptional<z.ZodString>;
@@ -636,11 +636,11 @@ declare const ExtensionSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fla
636
636
  name: z.ZodString;
637
637
  displayName: z.ZodString;
638
638
  state: z.ZodEnum<{
639
+ stopped: "stopped";
639
640
  failed: "failed";
640
641
  discovered: "discovered";
641
- stopped: "stopped";
642
- active: "active";
643
642
  skipped: "skipped";
643
+ active: "active";
644
644
  initializing: "initializing";
645
645
  }>;
646
646
  error: z.ZodOptional<z.ZodString>;
@@ -674,11 +674,11 @@ declare const ExtensionSubjects: _$_makaio_core0.BusSubjects<_$_makaio_core0.Fla
674
674
  name: z.ZodString;
675
675
  displayName: z.ZodString;
676
676
  state: z.ZodEnum<{
677
+ stopped: "stopped";
677
678
  failed: "failed";
678
679
  discovered: "discovered";
679
- stopped: "stopped";
680
- active: "active";
681
680
  skipped: "skipped";
681
+ active: "active";
682
682
  initializing: "initializing";
683
683
  }>;
684
684
  error: z.ZodOptional<z.ZodString>;
@@ -1,12 +1,12 @@
1
- import { J as ArtifactLifecycleHookEvent, Y as ArtifactLifecycleHookRegistration$1, z as AnyArtifactKindDefinition } from "./index-DV4nRk0h.mjs";
1
+ import { J as ArtifactLifecycleHookEvent, Y as ArtifactLifecycleHookRegistration$1, z as AnyArtifactKindDefinition } from "./index-DS6kxiFl.mjs";
2
2
  import { A as VersionRange, O as VersionLiteral$1, r as ClientDefinition$1 } from "./definition-CuJvtYeG.mjs";
3
3
  import { c as ProviderDefinitionInput$1, r as ProtocolId$1 } from "./definition-Cllhr9mi.mjs";
4
4
  import { t as RequiredTimeoutConfig } from "./index-CuHqL95P.mjs";
5
- import { F as SessionMessage$1, b as SESSION_EVENT_TYPES, i as MakaioSessionEvent$1 } from "./types-C76EP81O.mjs";
6
- import { D as EntityUIConfig, I as FormFieldProps } from "./index-CaerrEDH.mjs";
7
- import { n as ExtensionTransitionRulesContribution, t as ExtensionTransitionActionsContribution, y as WorkflowBlockCollection$1 } from "./transition-Dq41YCkc.mjs";
8
- import { l as FacetNamespaceDefinition } from "./index-O08Q2ikz.mjs";
9
- import { t as SurfaceBindingDefinition } from "./definition-b9jyJqPD.mjs";
5
+ import { V as SessionMessage$1, b as SESSION_EVENT_TYPES, i as MakaioSessionEvent$1 } from "./types-9XCB1aPK.mjs";
6
+ import { D as EntityUIConfig, I as FormFieldProps } from "./index-NkNbYFud.mjs";
7
+ import { n as ExtensionTransitionRulesContribution, t as ExtensionTransitionActionsContribution, y as WorkflowBlockCollection$1 } from "./transition-DYorNHZu.mjs";
8
+ import { l as FacetNamespaceDefinition } from "./index-DTBQOCar.mjs";
9
+ import { t as SurfaceBindingDefinition } from "./definition-DpkfJi8v.mjs";
10
10
  import { z } from "zod";
11
11
  import { MakaioBusLike, PayloadFilter, RegistrableBusNamespaceDefinition, SubjectSchema } from "@makaio/framework/core";
12
12
  import * as _$_makaio_contracts0 from "@makaio/framework/contracts";
@@ -87,6 +87,8 @@ declare class Turn$1 {
87
87
  private readonly _agentIds;
88
88
  /** Messages sent during this turn */
89
89
  private readonly _messageIds;
90
+ /** Message IDs currently claiming this turn while their storage append is in-flight. */
91
+ private readonly _pendingMessageAppends;
90
92
  /** Agents that have completed successfully */
91
93
  private readonly _completedAgents;
92
94
  /** Agents that errored (agentId → error message) */
@@ -108,6 +110,11 @@ declare class Turn$1 {
108
110
  * @returns Immutable array of message IDs
109
111
  */
110
112
  get messageIds(): readonly string[];
113
+ /**
114
+ * Whether a user message has claimed this turn before its storage append completes.
115
+ * @returns True when at least one message append is in-flight
116
+ */
117
+ get hasPendingMessageAppends(): boolean;
111
118
  /**
112
119
  * Agents that have completed successfully.
113
120
  * @returns Read-only set of completed agent IDs
@@ -123,6 +130,16 @@ declare class Turn$1 {
123
130
  * @param messageId - The message ID to add
124
131
  */
125
132
  addMessage(messageId: string): void;
133
+ /**
134
+ * Claim this turn for a message whose durable append has started.
135
+ * @param messageId - Message ID whose append is in-flight
136
+ */
137
+ claimMessageAppend(messageId: string): void;
138
+ /**
139
+ * Release a failed message append claim without adding the message.
140
+ * @param messageId - Message ID whose append failed
141
+ */
142
+ releaseMessageAppend(messageId: string): void;
126
143
  /**
127
144
  * Mark an agent as completed successfully.
128
145
  * @param agentId - The agent that completed
@@ -165,6 +182,12 @@ declare class Turn$1 {
165
182
  * @returns Turn context with turnId and the specified messageId
166
183
  */
167
184
  getContextForMessage(messageId: string): TurnContext;
185
+ /**
186
+ * Return the recorded terminal outcome for an agent, if any.
187
+ * @param agentId - Agent ID to inspect.
188
+ * @returns Terminal outcome already recorded for the agent.
189
+ */
190
+ private getAgentTerminalOutcome;
168
191
  /**
169
192
  * Check if turn should complete and return appropriate state change.
170
193
  * @returns State change indicating completion status and result if complete
@@ -216,10 +239,14 @@ declare class SessionTurnManager {
216
239
  private readonly bus;
217
240
  /** Active turns keyed by sessionId (one turn per session). */
218
241
  private readonly activeTurns;
219
- /** Per-session usage accumulators, parallel to activeTurns. */
242
+ /** Per-turn usage accumulators, keyed by turnId. */
220
243
  private readonly usageAccumulators;
221
- /** Sessions currently persisting turn completion (prevents concurrent writes). */
222
- private readonly completingSessions;
244
+ /** Turns currently persisting completion (prevents concurrent writes). */
245
+ private readonly completingTurnIds;
246
+ /** Completing turns retained for usage correlation after active routing is cleared. */
247
+ private readonly completingTurns;
248
+ /** Pending terminal completions keyed by turnId; value records whether turn storage handled the transition. */
249
+ private readonly pendingTerminalCompletions;
223
250
  /** Usage events received while completion persistence is in-flight. */
224
251
  private readonly bufferedUsageDuringCompletion;
225
252
  /**
@@ -265,12 +292,25 @@ declare class SessionTurnManager {
265
292
  /**
266
293
  * Discard active in-memory state for a turn that failed before routing began.
267
294
  *
268
- * The storage contract has no turn-delete operation, so this only rolls back
269
- * the active manager state that would otherwise make the next user message
270
- * reuse a turn whose first message was never persisted.
295
+ * Use when no durable turn row needs a terminal status transition.
271
296
  * @param turn - Newly created active turn to discard
272
297
  */
273
298
  discardActiveTurn(turn: Turn$1): void;
299
+ /**
300
+ * Mark an unclaimed newly created turn as failed and discard its active in-memory state.
301
+ *
302
+ * This preserves the durable turn lifecycle invariant when setup fails after
303
+ * `storage:turn.create` has already assigned a turn number.
304
+ * @param turn - Newly created active turn whose setup failed before any message claimed it
305
+ * @param error - Durable error code to store on the terminal turn
306
+ */
307
+ failActiveTurnSetup(turn: Turn$1, error: string): Promise<void>;
308
+ /**
309
+ * Remove a turn from the active routing index when it is no longer routable.
310
+ * @param turn - Turn to remove when it still owns the session slot
311
+ * @returns Whether the turn owned and cleared the active routing slot
312
+ */
313
+ private clearActiveRoutingTurn;
274
314
  /**
275
315
  * Register bus listeners for `agent.usage` and `agent.complete` events.
276
316
  *
@@ -301,6 +341,12 @@ declare class SessionTurnManager {
301
341
  * @param result - Turn result (success status and error messages)
302
342
  */
303
343
  completeTurn(turn: Turn$1, result: TurnCompletionResult): Promise<void>;
344
+ /**
345
+ * Clear in-memory state retained only while a turn completion is in progress.
346
+ * @param turn - Turn whose completion state should be removed
347
+ * @param usageAccumulator - Optional accumulator retained for late usage merges
348
+ */
349
+ private clearCompletionState;
304
350
  /**
305
351
  * Get the active turn for a session, if any.
306
352
  * @param sessionId - Session identifier
@@ -340,14 +386,58 @@ declare class SessionTurnManager {
340
386
  * @param success - Whether the agent completed successfully
341
387
  * @param error - Error message if the agent failed
342
388
  * @param onTurnComplete - Callback to invoke when the turn is complete
389
+ * @param completionTurnId - Turn identifier supplied by the adapter completion event
343
390
  */
344
391
  private handleAgentCompletion;
345
392
  /**
346
393
  * Buffer a usage event that arrived while turn completion persistence is in-flight.
347
- * @param sessionId - Session whose turn is currently completing
394
+ * @param turnId - Turn whose completion is currently being persisted
348
395
  * @param usageEvent - Usage event to defer until after persistence
349
396
  */
350
397
  private bufferUsageDuringCompletion;
398
+ /**
399
+ * Find a turn that may still accept usage by turnId.
400
+ * @param turnId - Turn identifier from an agent usage event
401
+ * @returns Active or completing turn, if usage can still be recorded
402
+ */
403
+ private findTurnForUsage;
404
+ /**
405
+ * Find a turn that may still accept agent completion by turnId.
406
+ * @param turnId - Turn identifier from an agent completion event
407
+ * @returns Active or completing turn, if completion can still be correlated
408
+ */
409
+ private findTurnForCompletion;
410
+ /**
411
+ * Find the active turn for a legacy completion event without turnId.
412
+ * @param agentId - Agent ID from the completion event.
413
+ * @returns Active turn to mutate, or undefined when the event is ambiguous.
414
+ */
415
+ private findTurnForUncorrelatedCompletion;
416
+ /**
417
+ * Check whether a terminal outcome has already been recorded for an agent.
418
+ * @param turn - Turn being completed.
419
+ * @param agentId - Agent ID from the terminal event.
420
+ * @returns Whether the agent already has a terminal outcome on the turn.
421
+ */
422
+ private hasTerminalOutcome;
423
+ /**
424
+ * Persist a turn's terminal status and optional usage snapshot.
425
+ * @param turn - Turn being completed
426
+ * @param result - Completion result to persist
427
+ * @param usage - Usage snapshot to include, when available
428
+ * @param expectedStatus - Optional status guard for the first terminal transition
429
+ * @returns Whether turn storage handled the request and terminalized the turn
430
+ */
431
+ private persistTurnCompletion;
432
+ /**
433
+ * Merge buffered usage and persist the updated snapshot.
434
+ * @param turn - Turn whose buffered usage should be merged
435
+ * @param result - Completion result for the turn
436
+ * @param usageAccumulator - Usage accumulator captured by the completing turn
437
+ * @param currentUsage - Current completed usage snapshot
438
+ * @returns Updated usage snapshot
439
+ */
440
+ private flushBufferedUsageDuringCompletion;
351
441
  /**
352
442
  * Subscribe to `storage:message.stored` and count stored assistant messages
353
443
  * per turnId, resolving any pending barrier waiter on each increment.
@@ -423,9 +513,10 @@ declare function registerCompressHandler(bus: IMakaioBus): () => void;
423
513
  * Creates a new session with parent reference. The forked session starts
424
514
  * empty - its full conversation is assembled by traversing the parent chain.
425
515
  * @param bus - Bus instance for communication
516
+ * @param machineId - Stable runtime machine identity to stamp on child sessions
426
517
  * @returns Cleanup function to unsubscribe
427
518
  */
428
- declare function registerForkHandler(bus: IMakaioBus): () => void;
519
+ declare function registerForkHandler(bus: IMakaioBus, machineId?: string): () => void;
429
520
  //#endregion
430
521
  //#region services/core/src/session/handlers/merge-handler.d.ts
431
522
  /**
@@ -449,6 +540,50 @@ interface CwdSwapMeta {
449
540
  previousCwd: string;
450
541
  newCwd: string;
451
542
  }
543
+ /**
544
+ * Options for routing a message to target agents.
545
+ */
546
+ interface RouteToAgentsOptions {
547
+ /** Bus instance for communication. */
548
+ readonly bus: IMakaioBus;
549
+ /** Session metadata (for fork detection). */
550
+ readonly session: IMakaioSession;
551
+ /** Target agents to route to. */
552
+ readonly agents: MakaioSessionAgent[];
553
+ /** Message content to send. */
554
+ readonly message: MessageInput;
555
+ /** Message identifier. */
556
+ readonly messageId: string;
557
+ /** Turn tracking object. */
558
+ readonly turn: Turn$1;
559
+ /** How to deliver the message. */
560
+ readonly deliveryMode: 'enqueue' | 'immediate' | undefined;
561
+ /** Callback when turn completes (all agents done). */
562
+ readonly onTurnComplete: (turn: Turn$1, result: {
563
+ success: boolean;
564
+ errors: string[];
565
+ }) => Promise<void>;
566
+ /** Session context with curated messageHistory and decision signals. */
567
+ readonly sessionContext?: SessionContext;
568
+ /** Optional enricher for immediate message context. */
569
+ readonly turnContextEnricher?: ITurnContextEnricher;
570
+ /** Whether this is the first message in a new turn. */
571
+ readonly isNewTurn?: boolean;
572
+ /** Context enriched with messageHistory for agents that were just recovered. */
573
+ readonly recoveryContext?: SessionContext;
574
+ /** Set of agent IDs that were recovered in this handler invocation. */
575
+ readonly recoveredAgentIds?: ReadonlySet<string>;
576
+ /** Set of agent IDs that swapped connector due to cwd mismatch. */
577
+ readonly swappedAgentIds?: ReadonlySet<string>;
578
+ /** Previous/new cwd metadata keyed by agent ID. */
579
+ readonly swappedAgentCwd?: ReadonlyMap<string, CwdSwapMeta>;
580
+ /** Curated history for agents forced into fresh mode. */
581
+ readonly freshMessageHistory?: Message[];
582
+ /** Optional structured output descriptor for the turn. */
583
+ readonly responseSchema?: ResponseSchemaDescriptor;
584
+ /** Stable machine identity of the current host process for locality evaluation. */
585
+ readonly localMachineId?: string;
586
+ }
452
587
  /**
453
588
  * Route a message to target agents via agent.sendMessage.
454
589
  *
@@ -456,28 +591,9 @@ interface CwdSwapMeta {
456
591
  * and checks for turn completion.
457
592
  *
458
593
  * For fork sessions on their first turn, assembles projected context from parent chain.
459
- * @param bus - Bus instance for communication
460
- * @param session - Session metadata (for fork detection)
461
- * @param agents - Target agents to route to
462
- * @param message - Message content to send
463
- * @param messageId - Message identifier
464
- * @param turn - Turn tracking object
465
- * @param deliveryMode - How to deliver the message
466
- * @param onTurnComplete - Callback when turn completes (all agents done)
467
- * @param sessionContext - Session context with curated messageHistory and decision signals
468
- * @param turnContextEnricher - Optional enricher for immediate message context
469
- * @param isNewTurn - Whether this is the first message in a new turn
470
- * @param recoveryContext - Context enriched with messageHistory for agents that were just recovered
471
- * @param recoveredAgentIds - Set of agent IDs that were recovered in this handler invocation
472
- * @param swappedAgentIds - Set of agent IDs that swapped connector due to cwd mismatch
473
- * @param swappedAgentCwd - Previous/new cwd metadata keyed by agent ID
474
- * @param freshMessageHistory - Curated history for agents forced into fresh mode
475
- * @param responseSchema - Optional structured output descriptor for the turn
594
+ * @param options - Routing options including bus, session, agents, message, and lifecycle dependencies
476
595
  */
477
- declare function routeToAgents(bus: IMakaioBus, session: IMakaioSession, agents: MakaioSessionAgent[], message: MessageInput, messageId: string, turn: Turn$1, deliveryMode: 'enqueue' | 'immediate' | undefined, onTurnComplete: (turn: Turn$1, result: {
478
- success: boolean;
479
- errors: string[];
480
- }) => Promise<void>, sessionContext?: SessionContext, turnContextEnricher?: ITurnContextEnricher, isNewTurn?: boolean, recoveryContext?: SessionContext, recoveredAgentIds?: ReadonlySet<string>, swappedAgentIds?: ReadonlySet<string>, swappedAgentCwd?: ReadonlyMap<string, CwdSwapMeta>, freshMessageHistory?: Message[], responseSchema?: ResponseSchemaDescriptor): Promise<void>;
596
+ declare function routeToAgents(options: RouteToAgentsOptions): Promise<void>;
481
597
  //#endregion
482
598
  //#region services/core/src/session/handlers/route-to-agents-core.d.ts
483
599
  /**
@@ -486,6 +602,12 @@ declare function routeToAgents(bus: IMakaioBus, session: IMakaioSession, agents:
486
602
  * Fans out to all agents in parallel. On routing failure, marks the agent
487
603
  * as errored and checks for turn completion. On `HookAbortError`, marks
488
604
  * the agent as completed with `cancelled` outcome.
605
+ *
606
+ * Contract: `sessionContext` must not carry a `nativeFork` directive. This
607
+ * function dispatches exclusively via `agent.sendMessage`, which never
608
+ * consumes the directive — fork directives are consumed only on the
609
+ * `startAgent` path. Callers assembling fork contexts must degrade them to
610
+ * fresh-with-history first (see `routeToAgents`).
489
611
  * @param bus - Bus instance for communication
490
612
  * @param session - Session metadata (for session ID)
491
613
  * @param agents - Target agents to route to