@theokit/sdk 5.14.0 → 5.15.0

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 (212) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/{agent-Dfw3VsIX.d.ts → agent-B6C9i_qu.d.ts} +23 -213
  3. package/dist/{agent-DExqjqYy.d.cts → agent-B6FQad6P.d.cts} +23 -213
  4. package/dist/{agent-T34LCGQM.js → agent-DRDGUU6T.js} +18 -17
  5. package/dist/{agent-T34LCGQM.js.map → agent-DRDGUU6T.js.map} +1 -1
  6. package/dist/{agent-TL4K7BTG.cjs → agent-VI2HITPT.cjs} +19 -18
  7. package/dist/{agent-TL4K7BTG.cjs.map → agent-VI2HITPT.cjs.map} +1 -1
  8. package/dist/agent.d.ts +2 -3
  9. package/dist/{batch-EP3FCL6D.js → batch-N2XDYZED.js} +4 -4
  10. package/dist/{batch-EP3FCL6D.js.map → batch-N2XDYZED.js.map} +1 -1
  11. package/dist/{batch-IZ5EDKJ5.cjs → batch-VFR2MAUE.cjs} +7 -7
  12. package/dist/{batch-IZ5EDKJ5.cjs.map → batch-VFR2MAUE.cjs.map} +1 -1
  13. package/dist/{chunk-3ONIVO2I.js → chunk-23SS4ID4.js} +3 -3
  14. package/dist/{chunk-3ONIVO2I.js.map → chunk-23SS4ID4.js.map} +1 -1
  15. package/dist/{chunk-2C24NSNV.js → chunk-3BBTHFGJ.js} +3 -3
  16. package/dist/{chunk-2C24NSNV.js.map → chunk-3BBTHFGJ.js.map} +1 -1
  17. package/dist/{chunk-NP362THY.cjs → chunk-3F53FLQ7.cjs} +5 -7
  18. package/dist/chunk-3F53FLQ7.cjs.map +1 -0
  19. package/dist/{chunk-SXH37C7X.cjs → chunk-55LLQFHW.cjs} +6 -6
  20. package/dist/{chunk-SXH37C7X.cjs.map → chunk-55LLQFHW.cjs.map} +1 -1
  21. package/dist/{chunk-GARVAUCU.js → chunk-5M5GQYBM.js} +534 -236
  22. package/dist/chunk-5M5GQYBM.js.map +1 -0
  23. package/dist/{chunk-2WY2OFSC.cjs → chunk-64ECM3XM.cjs} +616 -318
  24. package/dist/chunk-64ECM3XM.cjs.map +1 -0
  25. package/dist/{chunk-ZJAYFSVI.js → chunk-7ACS6P5Z.js} +5 -7
  26. package/dist/chunk-7ACS6P5Z.js.map +1 -0
  27. package/dist/{chunk-NAVUTK6X.js → chunk-ARC2V7NY.js} +3 -3
  28. package/dist/{chunk-NAVUTK6X.js.map → chunk-ARC2V7NY.js.map} +1 -1
  29. package/dist/{chunk-WDVG5R2Q.cjs → chunk-AUH2EVWY.cjs} +4 -3
  30. package/dist/chunk-AUH2EVWY.cjs.map +1 -0
  31. package/dist/chunk-BNEUB52I.cjs +55 -0
  32. package/dist/chunk-BNEUB52I.cjs.map +1 -0
  33. package/dist/chunk-BPL5CVZ5.js +53 -0
  34. package/dist/chunk-BPL5CVZ5.js.map +1 -0
  35. package/dist/{chunk-NVQSBRG6.js → chunk-CBBT42VX.js} +3 -3
  36. package/dist/{chunk-NVQSBRG6.js.map → chunk-CBBT42VX.js.map} +1 -1
  37. package/dist/chunk-CHKV2L2Y.cjs +416 -0
  38. package/dist/chunk-CHKV2L2Y.cjs.map +1 -0
  39. package/dist/{chunk-SNVYOX46.cjs → chunk-DJKGDLYZ.cjs} +91 -61
  40. package/dist/chunk-DJKGDLYZ.cjs.map +1 -0
  41. package/dist/{chunk-354F3OF5.js → chunk-FGGVSHDW.js} +3 -3
  42. package/dist/{chunk-354F3OF5.js.map → chunk-FGGVSHDW.js.map} +1 -1
  43. package/dist/{chunk-6OCJWGVD.cjs → chunk-FTXY4D44.cjs} +4 -4
  44. package/dist/{chunk-6OCJWGVD.cjs.map → chunk-FTXY4D44.cjs.map} +1 -1
  45. package/dist/chunk-INVEGVGO.js +405 -0
  46. package/dist/chunk-INVEGVGO.js.map +1 -0
  47. package/dist/{chunk-ZOL3L4EH.js → chunk-IOBHFP2E.js} +49 -19
  48. package/dist/chunk-IOBHFP2E.js.map +1 -0
  49. package/dist/{chunk-BZK5QL3N.cjs → chunk-KMFBNKCT.cjs} +4 -4
  50. package/dist/{chunk-BZK5QL3N.cjs.map → chunk-KMFBNKCT.cjs.map} +1 -1
  51. package/dist/{chunk-DF77RBF4.js → chunk-LCCT5ZXJ.js} +6 -6
  52. package/dist/{chunk-DF77RBF4.js.map → chunk-LCCT5ZXJ.js.map} +1 -1
  53. package/dist/{chunk-G7XBVM3T.cjs → chunk-MHUOVS5I.cjs} +5 -5
  54. package/dist/{chunk-G7XBVM3T.cjs.map → chunk-MHUOVS5I.cjs.map} +1 -1
  55. package/dist/{chunk-CWQPQTUZ.cjs → chunk-NEH3BPFD.cjs} +15 -15
  56. package/dist/{chunk-CWQPQTUZ.cjs.map → chunk-NEH3BPFD.cjs.map} +1 -1
  57. package/dist/{chunk-5AR6O7GW.js → chunk-NK5EOTDY.js} +3 -3
  58. package/dist/{chunk-5AR6O7GW.js.map → chunk-NK5EOTDY.js.map} +1 -1
  59. package/dist/{chunk-4TEGFMSP.cjs → chunk-P7QYG4RZ.cjs} +23 -15
  60. package/dist/chunk-P7QYG4RZ.cjs.map +1 -0
  61. package/dist/chunk-PPU2D4FZ.js +19 -0
  62. package/dist/chunk-PPU2D4FZ.js.map +1 -0
  63. package/dist/{chunk-AB4OPJLD.js → chunk-RGVMJU57.js} +3 -3
  64. package/dist/{chunk-AB4OPJLD.js.map → chunk-RGVMJU57.js.map} +1 -1
  65. package/dist/{chunk-4KBI37F3.cjs → chunk-RTDVSHJR.cjs} +5 -5
  66. package/dist/{chunk-4KBI37F3.cjs.map → chunk-RTDVSHJR.cjs.map} +1 -1
  67. package/dist/{chunk-CJN5CEI3.js → chunk-RZL2W4C3.js} +23 -15
  68. package/dist/chunk-RZL2W4C3.js.map +1 -0
  69. package/dist/chunk-SPEN7RJU.cjs +18 -0
  70. package/dist/{chunk-R5UQL2R5.cjs.map → chunk-SPEN7RJU.cjs.map} +1 -1
  71. package/dist/{chunk-ZF2LDKQQ.cjs → chunk-U3DW3WDE.cjs} +9 -8
  72. package/dist/chunk-U3DW3WDE.cjs.map +1 -0
  73. package/dist/{chunk-LXG6VL6R.cjs → chunk-U7PRI3XM.cjs} +3 -3
  74. package/dist/{chunk-LXG6VL6R.cjs.map → chunk-U7PRI3XM.cjs.map} +1 -1
  75. package/dist/{chunk-H7G65PNI.js → chunk-VCQ37TC5.js} +3 -3
  76. package/dist/{chunk-H7G65PNI.js.map → chunk-VCQ37TC5.js.map} +1 -1
  77. package/dist/{chunk-SDZ4XDWS.cjs → chunk-VWYFGE27.cjs} +9 -9
  78. package/dist/{chunk-SDZ4XDWS.cjs.map → chunk-VWYFGE27.cjs.map} +1 -1
  79. package/dist/{chunk-RN3XDZGS.js → chunk-WM646HEN.js} +4 -3
  80. package/dist/chunk-WM646HEN.js.map +1 -0
  81. package/dist/chunk-X7CE7Y5W.js +305 -0
  82. package/dist/chunk-X7CE7Y5W.js.map +1 -0
  83. package/dist/{chunk-CGH4BCIY.cjs → chunk-XE3CAY6Z.cjs} +5 -5
  84. package/dist/{chunk-CGH4BCIY.cjs.map → chunk-XE3CAY6Z.cjs.map} +1 -1
  85. package/dist/chunk-XOU3CL7S.cjs +312 -0
  86. package/dist/chunk-XOU3CL7S.cjs.map +1 -0
  87. package/dist/{chunk-ULEK4OM4.js → chunk-YKNBTHMD.js} +3 -3
  88. package/dist/{chunk-ULEK4OM4.js.map → chunk-YKNBTHMD.js.map} +1 -1
  89. package/dist/{compact-session-D2MQDB6G.cjs → compact-session-NX7HUNTB.cjs} +16 -16
  90. package/dist/{compact-session-D2MQDB6G.cjs.map → compact-session-NX7HUNTB.cjs.map} +1 -1
  91. package/dist/{compact-session-N2PPHQO6.js → compact-session-Q5IGNFPW.js} +7 -7
  92. package/dist/{compact-session-N2PPHQO6.js.map → compact-session-Q5IGNFPW.js.map} +1 -1
  93. package/dist/{cron-CK2v0VWA.d.cts → cron-Bh3aWgQ2.d.cts} +2 -2
  94. package/dist/{cron-BubDpFJG.d.ts → cron-CCDxeeFZ.d.ts} +2 -2
  95. package/dist/cron.cjs +18 -17
  96. package/dist/cron.d.cts +4 -3
  97. package/dist/cron.d.ts +4 -3
  98. package/dist/cron.js +17 -16
  99. package/dist/eval.cjs +17 -16
  100. package/dist/eval.cjs.map +1 -1
  101. package/dist/eval.js +16 -15
  102. package/dist/eval.js.map +1 -1
  103. package/dist/fs-session-store-CYNTEPJZ.cjs +20 -0
  104. package/dist/{fs-session-store-S2AXVJIX.cjs.map → fs-session-store-CYNTEPJZ.cjs.map} +1 -1
  105. package/dist/fs-session-store-MYQEVUFL.js +11 -0
  106. package/dist/{fs-session-store-6ZCCJX3K.js.map → fs-session-store-MYQEVUFL.js.map} +1 -1
  107. package/dist/{index-manager-HO456AVW.cjs → index-manager-2KH75BRW.cjs} +7 -7
  108. package/dist/{index-manager-HO456AVW.cjs.map → index-manager-2KH75BRW.cjs.map} +1 -1
  109. package/dist/{index-manager-QDH56FER.js → index-manager-NF2WRLOU.js} +6 -6
  110. package/dist/{index-manager-QDH56FER.js.map → index-manager-NF2WRLOU.js.map} +1 -1
  111. package/dist/index.cjs +66 -262
  112. package/dist/index.cjs.map +1 -1
  113. package/dist/index.d.cts +10 -46
  114. package/dist/index.d.ts +10 -46
  115. package/dist/index.js +27 -227
  116. package/dist/index.js.map +1 -1
  117. package/dist/{inject-session-J26SHHIO.js → inject-session-4ROYLZHY.js} +3 -3
  118. package/dist/{inject-session-J26SHHIO.js.map → inject-session-4ROYLZHY.js.map} +1 -1
  119. package/dist/{inject-session-3ICZIJ2N.cjs → inject-session-AWKDCGHV.cjs} +4 -4
  120. package/dist/{inject-session-3ICZIJ2N.cjs.map → inject-session-AWKDCGHV.cjs.map} +1 -1
  121. package/dist/internal/agent-loop/doom-loop-tracker.d.ts +3 -0
  122. package/dist/internal/agent-loop/types.d.ts +6 -0
  123. package/dist/internal/error-mappers/anthropic.d.ts +3 -0
  124. package/dist/internal/error-mappers/openai-compatible.d.ts +2 -3
  125. package/dist/internal/local-agent/local-agent-dispatch.d.ts +3 -1
  126. package/dist/internal/local-agent/send-queue.d.ts +31 -0
  127. package/dist/internal/mcp/client.d.ts +2 -0
  128. package/dist/internal/mcp/oauth-bearer.d.ts +2 -0
  129. package/dist/internal/memory/adapters/index.cjs +3 -3
  130. package/dist/internal/memory/adapters/index.js +2 -2
  131. package/dist/internal/memory/dreaming/phases.d.ts +15 -0
  132. package/dist/internal/memory/dreaming/run.d.ts +29 -0
  133. package/dist/internal/memory/sdk-memory-peer-loader.d.ts +2 -0
  134. package/dist/internal/memory/storage/index.cjs +51 -35
  135. package/dist/internal/memory/storage/index.d.cts +2 -0
  136. package/dist/internal/memory/storage/index.d.ts +2 -0
  137. package/dist/internal/memory/storage/index.js +4 -4
  138. package/dist/internal/persistence/cwd-mutex.d.cts +4 -2
  139. package/dist/internal/persistence/cwd-mutex.d.ts +4 -2
  140. package/dist/internal/persistence/index.cjs +4 -4
  141. package/dist/internal/persistence/index.js +2 -2
  142. package/dist/internal/persistence/sqlite-session-store.d.cts +25 -0
  143. package/dist/internal/persistence/sqlite-session-store.d.ts +25 -0
  144. package/dist/internal/providers/registry.d.ts +5 -1
  145. package/dist/mcp-auth.cjs +25 -307
  146. package/dist/mcp-auth.cjs.map +1 -1
  147. package/dist/mcp-auth.js +5 -305
  148. package/dist/mcp-auth.js.map +1 -1
  149. package/dist/models.cjs +9 -9
  150. package/dist/models.js +2 -2
  151. package/dist/persistence.cjs +9 -4
  152. package/dist/persistence.cjs.map +1 -1
  153. package/dist/persistence.d.cts +744 -40
  154. package/dist/persistence.d.ts +744 -40
  155. package/dist/persistence.js +3 -2
  156. package/dist/persistence.js.map +1 -1
  157. package/dist/providers.cjs +4 -4
  158. package/dist/providers.js +2 -2
  159. package/dist/sandbox/docker-sandbox.d.cts +58 -0
  160. package/dist/sandbox/docker-sandbox.d.ts +58 -0
  161. package/dist/sandbox/index.cjs +129 -1
  162. package/dist/sandbox/index.cjs.map +1 -1
  163. package/dist/sandbox/index.d.cts +1 -0
  164. package/dist/sandbox/index.d.ts +1 -0
  165. package/dist/sandbox/index.js +132 -5
  166. package/dist/sandbox/index.js.map +1 -1
  167. package/dist/{sdk-agent-DwzHcuxy.d.cts → sdk-agent-BA_6_wtc.d.cts} +30 -2
  168. package/dist/{sdk-agent-a3fW1xUK.d.ts → sdk-agent-CnwPODYH.d.ts} +30 -2
  169. package/dist/session-store-Dh07jr9N.d.cts +209 -0
  170. package/dist/session-store-Dh07jr9N.d.ts +209 -0
  171. package/dist/sqlite-session-store-BbcpKY1L.d.ts +64 -0
  172. package/dist/sqlite-session-store-TKXtT4ON.d.cts +64 -0
  173. package/dist/subagents-loader-KLWF4QPD.cjs +16 -0
  174. package/dist/{subagents-loader-TXOA5EJJ.cjs.map → subagents-loader-KLWF4QPD.cjs.map} +1 -1
  175. package/dist/subagents-loader-SXETS2F2.js +7 -0
  176. package/dist/{subagents-loader-Z744TAKD.js.map → subagents-loader-SXETS2F2.js.map} +1 -1
  177. package/dist/subagents-loader.cjs +2 -2
  178. package/dist/subagents-loader.d.cts +3 -2
  179. package/dist/subagents-loader.d.ts +3 -2
  180. package/dist/subagents-loader.js +1 -1
  181. package/dist/types/agent.d.ts +14 -1
  182. package/dist/types/budget-tracker.d.ts +6 -2
  183. package/dist/types/mcp.d.ts +14 -0
  184. package/dist/types/run.d.ts +15 -1
  185. package/dist/workflow.d.cts +1 -1
  186. package/dist/workflow.d.ts +1 -1
  187. package/docs/adr/mutation-testing-scope.md +12 -2
  188. package/docs/error-codes.md +41 -40
  189. package/docs/harness-capability-map.md +32 -6
  190. package/package.json +1 -1
  191. package/dist/chunk-2WY2OFSC.cjs.map +0 -1
  192. package/dist/chunk-4TEGFMSP.cjs.map +0 -1
  193. package/dist/chunk-6CXRYPG7.cjs +0 -211
  194. package/dist/chunk-6CXRYPG7.cjs.map +0 -1
  195. package/dist/chunk-CJN5CEI3.js.map +0 -1
  196. package/dist/chunk-GARVAUCU.js.map +0 -1
  197. package/dist/chunk-MSEL5E5P.js +0 -204
  198. package/dist/chunk-MSEL5E5P.js.map +0 -1
  199. package/dist/chunk-NP362THY.cjs.map +0 -1
  200. package/dist/chunk-Q5EWJPRY.js +0 -18
  201. package/dist/chunk-Q5EWJPRY.js.map +0 -1
  202. package/dist/chunk-R5UQL2R5.cjs +0 -18
  203. package/dist/chunk-RN3XDZGS.js.map +0 -1
  204. package/dist/chunk-SNVYOX46.cjs.map +0 -1
  205. package/dist/chunk-WDVG5R2Q.cjs.map +0 -1
  206. package/dist/chunk-ZF2LDKQQ.cjs.map +0 -1
  207. package/dist/chunk-ZJAYFSVI.js.map +0 -1
  208. package/dist/chunk-ZOL3L4EH.js.map +0 -1
  209. package/dist/fs-session-store-6ZCCJX3K.js +0 -11
  210. package/dist/fs-session-store-S2AXVJIX.cjs +0 -20
  211. package/dist/subagents-loader-TXOA5EJJ.cjs +0 -16
  212. package/dist/subagents-loader-Z744TAKD.js +0 -7
@@ -1,4 +1,4 @@
1
- import { enqueueSessionWrite } from './chunk-3ONIVO2I.js';
1
+ import { enqueueSessionWrite } from './chunk-23SS4ID4.js';
2
2
  import { invalidateSessionCache } from './chunk-2XC6KDJM.js';
3
3
  import './chunk-AGO5S5WD.js';
4
4
  import { SessionTranscript } from './chunk-XESYJ4JC.js';
@@ -23,5 +23,5 @@ async function injectSessionTurn(opts) {
23
23
  }
24
24
 
25
25
  export { injectSessionTurn };
26
- //# sourceMappingURL=inject-session-J26SHHIO.js.map
27
- //# sourceMappingURL=inject-session-J26SHHIO.js.map
26
+ //# sourceMappingURL=inject-session-4ROYLZHY.js.map
27
+ //# sourceMappingURL=inject-session-4ROYLZHY.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-J26SHHIO.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-4ROYLZHY.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkLXG6VL6R_cjs = require('./chunk-LXG6VL6R.cjs');
3
+ var chunkU7PRI3XM_cjs = require('./chunk-U7PRI3XM.cjs');
4
4
  var chunkYJNYDJ2T_cjs = require('./chunk-YJNYDJ2T.cjs');
5
5
  require('./chunk-MSW7LB2V.cjs');
6
6
  var chunk3WKWBYPO_cjs = require('./chunk-3WKWBYPO.cjs');
@@ -10,7 +10,7 @@ require('./chunk-RNXXYF22.cjs');
10
10
 
11
11
  // src/internal/session/inject-session.ts
12
12
  async function injectSessionTurn(opts) {
13
- await chunkLXG6VL6R_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
13
+ await chunkU7PRI3XM_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
14
14
  const prior = await opts.store.readRecords(opts.loc.agentId);
15
15
  const transcript = chunk3WKWBYPO_cjs.SessionTranscript.fromRecords(prior, {
16
16
  cwd: opts.loc.cwd,
@@ -25,5 +25,5 @@ async function injectSessionTurn(opts) {
25
25
  }
26
26
 
27
27
  exports.injectSessionTurn = injectSessionTurn;
28
- //# sourceMappingURL=inject-session-3ICZIJ2N.cjs.map
29
- //# sourceMappingURL=inject-session-3ICZIJ2N.cjs.map
28
+ //# sourceMappingURL=inject-session-AWKDCGHV.cjs.map
29
+ //# sourceMappingURL=inject-session-AWKDCGHV.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-3ICZIJ2N.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-AWKDCGHV.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
@@ -17,6 +17,9 @@ export interface DoomLoopVerdict {
17
17
  export interface DoomLoopConfig {
18
18
  softThreshold: number;
19
19
  hardThreshold: number;
20
+ /** Consecutive same-tool calls with CHANGING arguments but an unchanged result (argument churn).
21
+ * Soft nudge at `churnThreshold - 2`, hard stop at `churnThreshold`. */
22
+ churnThreshold: number;
20
23
  }
21
24
  /** Public config on a send: `false` disables the guard; an object tunes the thresholds; absent = on. */
22
25
  export type DoomLoopOption = false | Partial<DoomLoopConfig>;
@@ -3,6 +3,12 @@ import type { SDKMessage } from "../../types/messages.js";
3
3
  import type { RunStatus } from "../../types/run.js";
4
4
  /** SE7 — what a custom tool handler may return: a string or structured content blocks. */
5
5
  export type ToolHandlerResult = string | import("../../types/content-blocks.js").ToolResultContentBlock[];
6
+ export interface SteerQueue {
7
+ /** Take every pending message. */
8
+ drain(): string[];
9
+ /** Like `drain`, but atomically refuses further pushes when nothing was pending. */
10
+ drainOrClose(): string[];
11
+ }
6
12
  export interface AgentLoopOutput {
7
13
  events: SDKMessage[];
8
14
  finalStatus: RunStatus;
@@ -10,6 +10,9 @@
10
10
  * mentions context length, else
11
11
  * `"invalid_request"`; or
12
12
  * `"content_filtered"` for policy.)
13
+ * 404 → `ConfigurationError` (`code: "model_unavailable"` when the
14
+ * body is a `not_found_error` naming a
15
+ * model; other 404s stay `unknown`.)
13
16
  * 408 → `NetworkError` (`code: "timeout"`)
14
17
  * 5xx → `NetworkError` (`code: "server_error"` — covers 529
15
18
  * overloaded_error common at peak
@@ -8,9 +8,8 @@
8
8
  * Body inspection: looks at `body.error.code` / `body.error.type` to detect
9
9
  * `context_too_long`, `content_filtered`, `model_unavailable` semantics, and at
10
10
  * `body.error.message` for a 404 that says no endpoint serves the model
11
- * (OpenRouter's numeric-code body for a retired model id). A 400 and that 404
12
- * end their message with the provider's text, redacted and capped at 512
13
- * characters; every other status keeps the bare message.
11
+ * (OpenRouter's numeric-code body for a retired model id). Every message
12
+ * ends with the provider's text, redacted and capped at 512 characters.
14
13
  * Falls back to status-based mapping when body doesn't expose `.error`
15
14
  * (e.g., HTML server error page, DeepInfra's `{message: "..."}` shape).
16
15
  *
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import type { AgentDefinition, AgentOptions, ModelSelection } from "../../types/agent.js";
8
8
  import type { Run, SDKUserMessage, SendOptions } from "../../types/run.js";
9
- import type { MemoryToolSpec } from "../agent-loop/types.js";
9
+ import type { MemoryToolSpec, SteerQueue } from "../agent-loop/types.js";
10
10
  import type { PersonalityPreset } from "../personality/types.js";
11
11
  import type { PluginManager } from "../plugins/manager.js";
12
12
  import type { HooksExecutor } from "../runtime/hooks/hooks-executor.js";
@@ -34,6 +34,7 @@ export declare function buildRealRunOptions(args: {
34
34
  memoryTools: ReadonlyArray<MemoryToolSpec> | undefined;
35
35
  personalityToolWhitelist?: ReadonlyArray<string>;
36
36
  personalityName?: string;
37
+ steerQueue?: SteerQueue;
37
38
  }): Parameters<typeof createRealLocalRun>[0];
38
39
  export declare function createFixtureRunHelper(args: {
39
40
  inputs: DispatchInputs;
@@ -54,4 +55,5 @@ export declare function dispatchLocalRun(args: {
54
55
  }>;
55
56
  memoryTools: ReadonlyArray<MemoryToolSpec> | undefined;
56
57
  activePreset: PersonalityPreset | undefined;
58
+ steerQueue?: SteerQueue;
57
59
  }): Promise<Run>;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Queue-mode state for `LocalAgent.send` (`SendOptions.queueMode`): the steer queue of the turn in
3
+ * flight and the pending collect batch.
4
+ *
5
+ * @internal
6
+ */
7
+ import type { SteerQueue } from "../agent-loop/types.js";
8
+ /** Steer queue of one turn. Refuses pushes once closed so a late message is never silently lost. */
9
+ export declare class TurnSteerQueue implements SteerQueue {
10
+ private pending;
11
+ private closed;
12
+ /** @returns false when the turn can no longer pick the message up. */
13
+ push(text: string): boolean;
14
+ drain(): string[];
15
+ drainOrClose(): string[];
16
+ /** Stop accepting and hand back what no loop iteration picked up. */
17
+ closeAndTake(): string[];
18
+ }
19
+ /** The turn currently holding the send lock. */
20
+ export interface ActiveTurn {
21
+ readonly steer: TurnSteerQueue;
22
+ readonly run: Promise<Run>;
23
+ }
24
+ /** Messages waiting to become one followup turn. */
25
+ export interface CollectBatch {
26
+ readonly messages: Array<string | SDKUserMessage>;
27
+ readonly run: Promise<Run>;
28
+ }
29
+ /** Join a collected batch into the single message the batched turn sends. */
30
+ export declare function joinCollected(messages: ReadonlyArray<string | SDKUserMessage>): string | SDKUserMessage;
31
+ export declare function hasImages(message: string | SDKUserMessage): boolean;
@@ -8,6 +8,8 @@ export interface McpToolCallResult {
8
8
  }
9
9
  export interface McpClient {
10
10
  readonly name: string;
11
+ /** `true` when the server's config sets `sequential`: the loop runs its calls one at a time. */
12
+ readonly sequential?: boolean;
11
13
  initialize(): Promise<void>;
12
14
  listTools(): Promise<McpTool[]>;
13
15
  callTool(name: string, args: Record<string, unknown>): Promise<McpToolCallResult>;
@@ -0,0 +1,2 @@
1
+ /** `Bearer <token>` for the server, obtained through the declared OAuth flow. */
2
+ export declare function resolveBearer(serverName: string, auth: McpAuthConfig): Promise<string>;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkCGH4BCIY_cjs = require('../../../chunk-CGH4BCIY.cjs');
3
+ var chunkXE3CAY6Z_cjs = require('../../../chunk-XE3CAY6Z.cjs');
4
4
  var chunkGHX4P3V2_cjs = require('../../../chunk-GHX4P3V2.cjs');
5
- require('../../../chunk-NP362THY.cjs');
5
+ require('../../../chunk-3F53FLQ7.cjs');
6
6
  require('../../../chunk-QOGNZMHD.cjs');
7
7
  require('../../../chunk-MUUQ2WFJ.cjs');
8
8
  require('../../../chunk-3KIUY67P.cjs');
@@ -17,7 +17,7 @@ require('../../../chunk-RNXXYF22.cjs');
17
17
 
18
18
  Object.defineProperty(exports, "createOpenAiCompatibleRuntime", {
19
19
  enumerable: true,
20
- get: function () { return chunkCGH4BCIY_cjs.createOpenAiCompatibleRuntime; }
20
+ get: function () { return chunkXE3CAY6Z_cjs.createOpenAiCompatibleRuntime; }
21
21
  });
22
22
  Object.defineProperty(exports, "LruEmbeddingCache", {
23
23
  enumerable: true,
@@ -1,6 +1,6 @@
1
- export { createOpenAiCompatibleRuntime } from '../../../chunk-H7G65PNI.js';
1
+ export { createOpenAiCompatibleRuntime } from '../../../chunk-VCQ37TC5.js';
2
2
  export { LruEmbeddingCache, globalEmbeddingCache } from '../../../chunk-H73MEMQB.js';
3
- import '../../../chunk-ZJAYFSVI.js';
3
+ import '../../../chunk-7ACS6P5Z.js';
4
4
  import '../../../chunk-24MGQDK3.js';
5
5
  import '../../../chunk-FD2UT76F.js';
6
6
  import '../../../chunk-PKRPV3R7.js';
@@ -1,9 +1,24 @@
1
1
  import type { EmbeddingRuntime } from "../embedding-adapter.js";
2
2
  import type { MemoryFact } from "../types.js";
3
+ /**
4
+ * Dreaming/REM phase logic.
5
+ *
6
+ * Three phases:
7
+ * - **light** — drop near-duplicate facts (cosine similarity > 0.95).
8
+ * - **REM** — cluster thematically related facts (cosine ≥ 0.75).
9
+ * - **deep** — pick a representative bullet per cluster (longest text
10
+ * wins) and emit consolidated markdown notes.
11
+ */
12
+ export interface DedupResult {
13
+ kept: MemoryFact[];
14
+ duplicatesRemoved: number;
15
+ }
16
+ /** A group of semantically similar facts, with the text chosen to represent them. */
3
17
  export interface Cluster {
4
18
  representativeText: string;
5
19
  members: ReadonlyArray<MemoryFact>;
6
20
  }
21
+ /** What clustering produced: the clusters and how many facts the per-sweep cap left out. */
7
22
  export interface ClusterResult {
8
23
  clusters: Cluster[];
9
24
  /** How many input facts past the per-sweep cap were not clustered; 0 when none were. */
@@ -1,3 +1,31 @@
1
+ import type { EmbeddingRuntime } from "../embedding-adapter.js";
2
+ import { type MemoryRoot } from "../storage/memory-root.js";
3
+ /**
4
+ * Dreaming sweep orchestrator (ADR D7 of memory-system-peer-project-parity).
5
+ *
6
+ * Phases:
7
+ * 1. **light** — drop near-duplicate facts via cosine similarity.
8
+ * 2. **REM** — cluster thematically related facts.
9
+ * 3. **deep** — write a `notes/dreamed-<ts>.md` per sweep with consolidated
10
+ * clusters; append a diary entry.
11
+ *
12
+ * All file writes go through `replaceFileAtomic` (EC-3) and the entire sweep
13
+ * holds the per-cwd mutex so a `Remember:` append can't race it.
14
+ */
15
+ export interface DreamingOptions {
16
+ cwd: string;
17
+ /**
18
+ * The memory root to sweep. Defaults to the project store — right for a caller with no
19
+ * `memory.directory`, and wrong for one that has it, which is why it is passable (#463).
20
+ */
21
+ memoryRoot?: MemoryRoot;
22
+ embedding: EmbeddingRuntime;
23
+ dedupThreshold?: number;
24
+ clusterThreshold?: number;
25
+ /** Test hook — fixed timestamp for the run. */
26
+ now?: () => number;
27
+ }
28
+ /** Outcome of one dreaming sweep: counts before and after, and the note written. */
1
29
  export interface DreamingResult {
2
30
  status: "ok" | "skipped" | "error";
3
31
  factsBefore: number;
@@ -12,4 +40,5 @@ export interface DreamingResult {
12
40
  */
13
41
  factsLeftOut?: number;
14
42
  }
43
+ /** Run one dreaming sweep (dedupe, cluster, write a consolidated note), serialised per `cwd`. */
15
44
  export declare function runDreamingSweep(options: DreamingOptions): Promise<DreamingResult>;
@@ -34,6 +34,8 @@ export interface SdkMemoryModule {
34
34
  /** Mirrors @theokit/sdk-memory's runDreamingSweep entrypoint. */
35
35
  runDreamingSweep(opts: {
36
36
  cwd: string;
37
+ /** The resolved memory root: facts, notes and diary live here (B-442). Absent means `<cwd>/.theokit/memory`. */
38
+ memoryRoot?: string;
37
39
  embedding: any;
38
40
  dedupThreshold?: number;
39
41
  clusterThreshold?: number;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk6CXRYPG7_cjs = require('../../../chunk-6CXRYPG7.cjs');
3
+ var chunkCHKV2L2Y_cjs = require('../../../chunk-CHKV2L2Y.cjs');
4
4
  var chunkRS7YQR4X_cjs = require('../../../chunk-RS7YQR4X.cjs');
5
- var chunkSDZ4XDWS_cjs = require('../../../chunk-SDZ4XDWS.cjs');
5
+ var chunkVWYFGE27_cjs = require('../../../chunk-VWYFGE27.cjs');
6
6
  require('../../../chunk-KRD3GQAA.cjs');
7
7
  require('../../../chunk-MUUQ2WFJ.cjs');
8
8
  require('../../../chunk-SWALPLFQ.cjs');
@@ -10,8 +10,8 @@ require('../../../chunk-3KIUY67P.cjs');
10
10
  require('../../../chunk-SA6K24NB.cjs');
11
11
  require('../../../chunk-3WKWBYPO.cjs');
12
12
  require('../../../chunk-AT2PESXB.cjs');
13
- require('../../../chunk-G7XBVM3T.cjs');
14
- require('../../../chunk-ZF2LDKQQ.cjs');
13
+ require('../../../chunk-MHUOVS5I.cjs');
14
+ require('../../../chunk-U3DW3WDE.cjs');
15
15
  require('../../../chunk-ZOFRNNZD.cjs');
16
16
  require('../../../chunk-CEGU5AVD.cjs');
17
17
  require('../../../chunk-RNXXYF22.cjs');
@@ -20,23 +20,39 @@ require('../../../chunk-RNXXYF22.cjs');
20
20
 
21
21
  Object.defineProperty(exports, "appendDiaryEntry", {
22
22
  enumerable: true,
23
- get: function () { return chunk6CXRYPG7_cjs.appendDiaryEntry; }
23
+ get: function () { return chunkCHKV2L2Y_cjs.appendDiaryEntry; }
24
+ });
25
+ Object.defineProperty(exports, "deepPhase", {
26
+ enumerable: true,
27
+ get: function () { return chunkCHKV2L2Y_cjs.deepPhase; }
24
28
  });
25
29
  Object.defineProperty(exports, "diaryPath", {
26
30
  enumerable: true,
27
- get: function () { return chunk6CXRYPG7_cjs.diaryPath; }
31
+ get: function () { return chunkCHKV2L2Y_cjs.diaryPath; }
28
32
  });
29
33
  Object.defineProperty(exports, "entryHash", {
30
34
  enumerable: true,
31
- get: function () { return chunk6CXRYPG7_cjs.entryHash; }
35
+ get: function () { return chunkCHKV2L2Y_cjs.entryHash; }
36
+ });
37
+ Object.defineProperty(exports, "lightPhase", {
38
+ enumerable: true,
39
+ get: function () { return chunkCHKV2L2Y_cjs.lightPhase; }
32
40
  });
33
41
  Object.defineProperty(exports, "readAllSqliteFacts", {
34
42
  enumerable: true,
35
- get: function () { return chunk6CXRYPG7_cjs.readAllSqliteFacts; }
43
+ get: function () { return chunkCHKV2L2Y_cjs.readAllSqliteFacts; }
44
+ });
45
+ Object.defineProperty(exports, "remPhase", {
46
+ enumerable: true,
47
+ get: function () { return chunkCHKV2L2Y_cjs.remPhase; }
36
48
  });
37
49
  Object.defineProperty(exports, "renderDiaryEntry", {
38
50
  enumerable: true,
39
- get: function () { return chunk6CXRYPG7_cjs.renderDiaryEntry; }
51
+ get: function () { return chunkCHKV2L2Y_cjs.renderDiaryEntry; }
52
+ });
53
+ Object.defineProperty(exports, "runDreamingSweep", {
54
+ enumerable: true,
55
+ get: function () { return chunkCHKV2L2Y_cjs.runDreamingSweep; }
40
56
  });
41
57
  Object.defineProperty(exports, "persistActiveMemoryTranscript", {
42
58
  enumerable: true,
@@ -44,107 +60,107 @@ Object.defineProperty(exports, "persistActiveMemoryTranscript", {
44
60
  });
45
61
  Object.defineProperty(exports, "MEMORY_INDEX_MAX_BYTES", {
46
62
  enumerable: true,
47
- get: function () { return chunkSDZ4XDWS_cjs.MEMORY_INDEX_MAX_BYTES; }
63
+ get: function () { return chunkVWYFGE27_cjs.MEMORY_INDEX_MAX_BYTES; }
48
64
  });
49
65
  Object.defineProperty(exports, "MEMORY_INDEX_MAX_LINES", {
50
66
  enumerable: true,
51
- get: function () { return chunkSDZ4XDWS_cjs.MEMORY_INDEX_MAX_LINES; }
67
+ get: function () { return chunkVWYFGE27_cjs.MEMORY_INDEX_MAX_LINES; }
52
68
  });
53
69
  Object.defineProperty(exports, "appendFact", {
54
70
  enumerable: true,
55
- get: function () { return chunkSDZ4XDWS_cjs.appendFact; }
71
+ get: function () { return chunkVWYFGE27_cjs.appendFact; }
56
72
  });
57
73
  Object.defineProperty(exports, "appendFactToMarkdown", {
58
74
  enumerable: true,
59
- get: function () { return chunkSDZ4XDWS_cjs.appendFactToMarkdown; }
75
+ get: function () { return chunkVWYFGE27_cjs.appendFactToMarkdown; }
60
76
  });
61
77
  Object.defineProperty(exports, "asMemoryRoot", {
62
78
  enumerable: true,
63
- get: function () { return chunkSDZ4XDWS_cjs.asMemoryRoot; }
79
+ get: function () { return chunkVWYFGE27_cjs.asMemoryRoot; }
64
80
  });
65
81
  Object.defineProperty(exports, "ceilingReachedError", {
66
82
  enumerable: true,
67
- get: function () { return chunkSDZ4XDWS_cjs.ceilingReachedError; }
83
+ get: function () { return chunkVWYFGE27_cjs.ceilingReachedError; }
68
84
  });
69
85
  Object.defineProperty(exports, "claudeProjectMemoryDir", {
70
86
  enumerable: true,
71
- get: function () { return chunkSDZ4XDWS_cjs.claudeProjectMemoryDir; }
87
+ get: function () { return chunkVWYFGE27_cjs.claudeProjectMemoryDir; }
72
88
  });
73
89
  Object.defineProperty(exports, "collectMarkdownFiles", {
74
90
  enumerable: true,
75
- get: function () { return chunkSDZ4XDWS_cjs.collectMarkdownFiles; }
91
+ get: function () { return chunkVWYFGE27_cjs.collectMarkdownFiles; }
76
92
  });
77
93
  Object.defineProperty(exports, "defaultIndexPath", {
78
94
  enumerable: true,
79
- get: function () { return chunkSDZ4XDWS_cjs.defaultIndexPath; }
95
+ get: function () { return chunkVWYFGE27_cjs.defaultIndexPath; }
80
96
  });
81
97
  Object.defineProperty(exports, "discoverSessionFiles", {
82
98
  enumerable: true,
83
- get: function () { return chunkSDZ4XDWS_cjs.discoverSessionFiles; }
99
+ get: function () { return chunkVWYFGE27_cjs.discoverSessionFiles; }
84
100
  });
85
101
  Object.defineProperty(exports, "discoverWikiFiles", {
86
102
  enumerable: true,
87
- get: function () { return chunkSDZ4XDWS_cjs.discoverWikiFiles; }
103
+ get: function () { return chunkVWYFGE27_cjs.discoverWikiFiles; }
88
104
  });
89
105
  Object.defineProperty(exports, "indexBudgetWarning", {
90
106
  enumerable: true,
91
- get: function () { return chunkSDZ4XDWS_cjs.indexBudgetWarning; }
107
+ get: function () { return chunkVWYFGE27_cjs.indexBudgetWarning; }
92
108
  });
93
109
  Object.defineProperty(exports, "lanceStoragePath", {
94
110
  enumerable: true,
95
- get: function () { return chunkSDZ4XDWS_cjs.lanceStoragePath; }
111
+ get: function () { return chunkVWYFGE27_cjs.lanceStoragePath; }
96
112
  });
97
113
  Object.defineProperty(exports, "memoryIndexRoot", {
98
114
  enumerable: true,
99
- get: function () { return chunkSDZ4XDWS_cjs.memoryIndexRoot; }
115
+ get: function () { return chunkVWYFGE27_cjs.memoryIndexRoot; }
100
116
  });
101
117
  Object.defineProperty(exports, "memoryMdPath", {
102
118
  enumerable: true,
103
- get: function () { return chunkSDZ4XDWS_cjs.memoryMdPath; }
119
+ get: function () { return chunkVWYFGE27_cjs.memoryMdPath; }
104
120
  });
105
121
  Object.defineProperty(exports, "memoryReadRoots", {
106
122
  enumerable: true,
107
- get: function () { return chunkSDZ4XDWS_cjs.memoryReadRoots; }
123
+ get: function () { return chunkVWYFGE27_cjs.memoryReadRoots; }
108
124
  });
109
125
  Object.defineProperty(exports, "notesDir", {
110
126
  enumerable: true,
111
- get: function () { return chunkSDZ4XDWS_cjs.notesDir; }
127
+ get: function () { return chunkVWYFGE27_cjs.notesDir; }
112
128
  });
113
129
  Object.defineProperty(exports, "projectMemoryDir", {
114
130
  enumerable: true,
115
- get: function () { return chunkSDZ4XDWS_cjs.projectMemoryDir; }
131
+ get: function () { return chunkVWYFGE27_cjs.projectMemoryDir; }
116
132
  });
117
133
  Object.defineProperty(exports, "readFacts", {
118
134
  enumerable: true,
119
- get: function () { return chunkSDZ4XDWS_cjs.readFacts; }
135
+ get: function () { return chunkVWYFGE27_cjs.readFacts; }
120
136
  });
121
137
  Object.defineProperty(exports, "readFactsFromMarkdown", {
122
138
  enumerable: true,
123
- get: function () { return chunkSDZ4XDWS_cjs.readFactsFromMarkdown; }
139
+ get: function () { return chunkVWYFGE27_cjs.readFactsFromMarkdown; }
124
140
  });
125
141
  Object.defineProperty(exports, "resolveMaxFacts", {
126
142
  enumerable: true,
127
- get: function () { return chunkSDZ4XDWS_cjs.resolveMaxFacts; }
143
+ get: function () { return chunkVWYFGE27_cjs.resolveMaxFacts; }
128
144
  });
129
145
  Object.defineProperty(exports, "resolveMemoryRoot", {
130
146
  enumerable: true,
131
- get: function () { return chunkSDZ4XDWS_cjs.resolveMemoryRoot; }
147
+ get: function () { return chunkVWYFGE27_cjs.resolveMemoryRoot; }
132
148
  });
133
149
  Object.defineProperty(exports, "sessionSummaryPath", {
134
150
  enumerable: true,
135
- get: function () { return chunkSDZ4XDWS_cjs.sessionSummaryPath; }
151
+ get: function () { return chunkVWYFGE27_cjs.sessionSummaryPath; }
136
152
  });
137
153
  Object.defineProperty(exports, "sessionsDir", {
138
154
  enumerable: true,
139
- get: function () { return chunkSDZ4XDWS_cjs.sessionsDir; }
155
+ get: function () { return chunkVWYFGE27_cjs.sessionsDir; }
140
156
  });
141
157
  Object.defineProperty(exports, "wikiDir", {
142
158
  enumerable: true,
143
- get: function () { return chunkSDZ4XDWS_cjs.wikiDir; }
159
+ get: function () { return chunkVWYFGE27_cjs.wikiDir; }
144
160
  });
145
161
  Object.defineProperty(exports, "writeSessionSummary", {
146
162
  enumerable: true,
147
- get: function () { return chunkSDZ4XDWS_cjs.writeSessionSummary; }
163
+ get: function () { return chunkVWYFGE27_cjs.writeSessionSummary; }
148
164
  });
149
165
  //# sourceMappingURL=index.cjs.map
150
166
  //# sourceMappingURL=index.cjs.map
@@ -16,6 +16,8 @@
16
16
  * `package.json` `exports`, so the names below must survive into the published declarations.
17
17
  */
18
18
  export { appendDiaryEntry, type DiaryEntry, diaryPath, entryHash, renderDiaryEntry, } from "../dreaming/diary.js";
19
+ export { type Cluster, type ClusterResult, type DedupResult, deepPhase, lightPhase, remPhase, } from "../dreaming/phases.js";
20
+ export { type DreamingOptions, type DreamingResult, runDreamingSweep, } from "../dreaming/run.js";
19
21
  export { defaultIndexPath } from "../index-db.js";
20
22
  export { collectMarkdownFiles, type DiscoveredFile } from "../index-manager-helpers.js";
21
23
  export { lanceStoragePath } from "../lance-index.js";
@@ -16,6 +16,8 @@
16
16
  * `package.json` `exports`, so the names below must survive into the published declarations.
17
17
  */
18
18
  export { appendDiaryEntry, type DiaryEntry, diaryPath, entryHash, renderDiaryEntry, } from "../dreaming/diary.js";
19
+ export { type Cluster, type ClusterResult, type DedupResult, deepPhase, lightPhase, remPhase, } from "../dreaming/phases.js";
20
+ export { type DreamingOptions, type DreamingResult, runDreamingSweep, } from "../dreaming/run.js";
19
21
  export { defaultIndexPath } from "../index-db.js";
20
22
  export { collectMarkdownFiles, type DiscoveredFile } from "../index-manager-helpers.js";
21
23
  export { lanceStoragePath } from "../lance-index.js";
@@ -1,6 +1,6 @@
1
- export { appendDiaryEntry, diaryPath, entryHash, readAllSqliteFacts, renderDiaryEntry } from '../../../chunk-MSEL5E5P.js';
1
+ export { appendDiaryEntry, deepPhase, diaryPath, entryHash, lightPhase, readAllSqliteFacts, remPhase, renderDiaryEntry, runDreamingSweep } from '../../../chunk-INVEGVGO.js';
2
2
  export { persistActiveMemoryTranscript } from '../../../chunk-QK2ERTO3.js';
3
- export { MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, appendFact, appendFactToMarkdown, asMemoryRoot, ceilingReachedError, claudeProjectMemoryDir, collectMarkdownFiles, defaultIndexPath, discoverSessionFiles, discoverWikiFiles, indexBudgetWarning, lanceStoragePath, memoryIndexRoot, memoryMdPath, memoryReadRoots, notesDir, projectMemoryDir, readFacts, readFactsFromMarkdown, resolveMaxFacts, resolveMemoryRoot, sessionSummaryPath, sessionsDir, wikiDir, writeSessionSummary } from '../../../chunk-DF77RBF4.js';
3
+ export { MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, appendFact, appendFactToMarkdown, asMemoryRoot, ceilingReachedError, claudeProjectMemoryDir, collectMarkdownFiles, defaultIndexPath, discoverSessionFiles, discoverWikiFiles, indexBudgetWarning, lanceStoragePath, memoryIndexRoot, memoryMdPath, memoryReadRoots, notesDir, projectMemoryDir, readFacts, readFactsFromMarkdown, resolveMaxFacts, resolveMemoryRoot, sessionSummaryPath, sessionsDir, wikiDir, writeSessionSummary } from '../../../chunk-LCCT5ZXJ.js';
4
4
  import '../../../chunk-KVNWIAO4.js';
5
5
  import '../../../chunk-FD2UT76F.js';
6
6
  import '../../../chunk-4QCJAJAG.js';
@@ -8,8 +8,8 @@ import '../../../chunk-PKRPV3R7.js';
8
8
  import '../../../chunk-UKMBRMGT.js';
9
9
  import '../../../chunk-XESYJ4JC.js';
10
10
  import '../../../chunk-MLJDW2YK.js';
11
- import '../../../chunk-354F3OF5.js';
12
- import '../../../chunk-Q5EWJPRY.js';
11
+ import '../../../chunk-FGGVSHDW.js';
12
+ import '../../../chunk-PPU2D4FZ.js';
13
13
  import '../../../chunk-M4U24U6G.js';
14
14
  import '../../../chunk-TNFOU6SB.js';
15
15
  import '../../../chunk-3OY6H3I7.js';
@@ -26,10 +26,12 @@
26
26
  * `@theokit/sdk` rather than reimplementing it, precisely so the Map is the same one: a per-package
27
27
  * copy would give each package its own queue and let their writes race.
28
28
  *
29
- * The Map is module-scoped, so nothing survives a process restart or a fresh module instance, and
30
- * its entries are never removed — pass keys from a bounded set rather than from arbitrary input.
29
+ * The Map is module-scoped, so nothing survives a process restart or a fresh module instance.
30
+ * An entry is dropped as soon as its key has no call pending.
31
31
  * Signature and semantics will not change before sdk-core v3.0.
32
32
  *
33
33
  * @public
34
34
  */
35
35
  export declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
36
+ /** Number of keys with a call pending. Test-only observation of the queue map. */
37
+ export declare function pendingCwdMutexKeyCount(): number;
@@ -26,10 +26,12 @@
26
26
  * `@theokit/sdk` rather than reimplementing it, precisely so the Map is the same one: a per-package
27
27
  * copy would give each package its own queue and let their writes race.
28
28
  *
29
- * The Map is module-scoped, so nothing survives a process restart or a fresh module instance, and
30
- * its entries are never removed — pass keys from a bounded set rather than from arbitrary input.
29
+ * The Map is module-scoped, so nothing survives a process restart or a fresh module instance.
30
+ * An entry is dropped as soon as its key has no call pending.
31
31
  * Signature and semantics will not change before sdk-core v3.0.
32
32
  *
33
33
  * @public
34
34
  */
35
35
  export declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
36
+ /** Number of keys with a call pending. Test-only observation of the queue map. */
37
+ export declare function pendingCwdMutexKeyCount(): number;
@@ -5,8 +5,8 @@ var chunk3HA7N2BB_cjs = require('../../chunk-3HA7N2BB.cjs');
5
5
  var chunkA4RAL2ER_cjs = require('../../chunk-A4RAL2ER.cjs');
6
6
  var chunkAT2PESXB_cjs = require('../../chunk-AT2PESXB.cjs');
7
7
  var chunkPOBZXULR_cjs = require('../../chunk-POBZXULR.cjs');
8
- var chunkG7XBVM3T_cjs = require('../../chunk-G7XBVM3T.cjs');
9
- var chunkZF2LDKQQ_cjs = require('../../chunk-ZF2LDKQQ.cjs');
8
+ var chunkMHUOVS5I_cjs = require('../../chunk-MHUOVS5I.cjs');
9
+ var chunkU3DW3WDE_cjs = require('../../chunk-U3DW3WDE.cjs');
10
10
  var chunkZOFRNNZD_cjs = require('../../chunk-ZOFRNNZD.cjs');
11
11
  var chunkYQ3XC6C2_cjs = require('../../chunk-YQ3XC6C2.cjs');
12
12
  require('../../chunk-CEGU5AVD.cjs');
@@ -92,11 +92,11 @@ Object.defineProperty(exports, "readJsonlIds", {
92
92
  });
93
93
  Object.defineProperty(exports, "withFileLock", {
94
94
  enumerable: true,
95
- get: function () { return chunkG7XBVM3T_cjs.withFileLock; }
95
+ get: function () { return chunkMHUOVS5I_cjs.withFileLock; }
96
96
  });
97
97
  Object.defineProperty(exports, "withCwdMutex", {
98
98
  enumerable: true,
99
- get: function () { return chunkZF2LDKQQ_cjs.withCwdMutex; }
99
+ get: function () { return chunkU3DW3WDE_cjs.withCwdMutex; }
100
100
  });
101
101
  Object.defineProperty(exports, "atomicWriteJson", {
102
102
  enumerable: true,
@@ -3,8 +3,8 @@ export { migrateSchema, readVersionedJson, writeVersionedJson } from '../../chun
3
3
  export { containsCjk, sanitizeFts5Query } from '../../chunk-WE22OXQA.js';
4
4
  export { applyWalWithFallback, isCorruptionError, openSqliteResilient } from '../../chunk-MLJDW2YK.js';
5
5
  export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds } from '../../chunk-KU5O7WPK.js';
6
- export { withFileLock } from '../../chunk-354F3OF5.js';
7
- export { withCwdMutex } from '../../chunk-Q5EWJPRY.js';
6
+ export { withFileLock } from '../../chunk-FGGVSHDW.js';
7
+ export { withCwdMutex } from '../../chunk-PPU2D4FZ.js';
8
8
  export { atomicWriteJson, atomicWriteText, replaceFileAtomic } from '../../chunk-M4U24U6G.js';
9
9
  export { displayTheokitHome, getProfilesRoot, getTheokitHome } from '../../chunk-YMVTUV5K.js';
10
10
  import '../../chunk-TNFOU6SB.js';
@@ -0,0 +1,25 @@
1
+ import type { SessionRecord, SessionStore } from "../../types/session-store.js";
2
+ /** Options for {@link SqliteSessionStore}. */
3
+ export interface SqliteSessionStoreOptions {
4
+ /** Absolute path of the SQLite file. Parent directories are created. */
5
+ filePath: string;
6
+ }
7
+ /**
8
+ * A {@link SessionStore} that keeps the native session records in one SQLite file instead of
9
+ * per-agent JSONL transcripts. Pass it as `local.sessionStore`.
10
+ *
11
+ * Uses `better-sqlite3` when installed, else the built-in `node:sqlite` (Node 22.5+).
12
+ * Appends are one transaction, so a batch lands whole or not at all; order is the
13
+ * autoincrement `seq`. Corruption is NOT silently rebuilt: opening a corrupt file throws.
14
+ *
15
+ * @public
16
+ */
17
+ export declare class SqliteSessionStore implements SessionStore {
18
+ private readonly filePath;
19
+ private dbPromise;
20
+ constructor(options: SqliteSessionStoreOptions);
21
+ private db;
22
+ readRecords(agentId: string): Promise<SessionRecord[]>;
23
+ appendRecords(agentId: string, records: readonly SessionRecord[]): Promise<void>;
24
+ dispose(): Promise<void>;
25
+ }