@theokit/sdk 4.37.2 → 4.39.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 (457) hide show
  1. package/CHANGELOG.md +309 -72
  2. package/dist/a2a/index.cjs +3 -3
  3. package/dist/a2a/index.js +1 -1
  4. package/dist/a2a/subagent.d.cts +1 -0
  5. package/dist/a2a/subagent.d.ts +1 -0
  6. package/dist/{agent-SmxntivO.d.ts → agent-D7bRK9Kg.d.cts} +108 -41
  7. package/dist/agent-I3EZZR6S.cjs +55 -0
  8. package/dist/{agent-IE6IE4NW.cjs.map → agent-I3EZZR6S.cjs.map} +1 -1
  9. package/dist/agent-KKZYLY5D.js +46 -0
  10. package/dist/{agent-DW2J37IH.js.map → agent-KKZYLY5D.js.map} +1 -1
  11. package/dist/{agent-DGv1-d81.d.cts → agent-ZCZa7YQv.d.ts} +108 -41
  12. package/dist/agent-session-store-N4TVKHBU.cjs +23 -0
  13. package/dist/agent-session-store-N4TVKHBU.cjs.map +1 -0
  14. package/dist/agent-session-store-RHMHP5DG.js +6 -0
  15. package/dist/agent-session-store-RHMHP5DG.js.map +1 -0
  16. package/dist/agent.d.ts +38 -2
  17. package/dist/auth/index.cjs +15 -15
  18. package/dist/auth/index.js +4 -4
  19. package/dist/{batch-SY5GZLFD.js → batch-6KQM3EBA.js} +12 -12
  20. package/dist/batch-6KQM3EBA.js.map +1 -0
  21. package/dist/{batch-3SEPDXCU.cjs → batch-X6JKGDPK.cjs} +26 -26
  22. package/dist/batch-X6JKGDPK.cjs.map +1 -0
  23. package/dist/chunk-2RW7K6FN.cjs +34 -0
  24. package/dist/chunk-2RW7K6FN.cjs.map +1 -0
  25. package/dist/chunk-3I4B3OIX.js +105 -0
  26. package/dist/chunk-3I4B3OIX.js.map +1 -0
  27. package/dist/{chunk-2WFB5ZOX.js → chunk-42IFCKQZ.js} +5 -5
  28. package/dist/{chunk-2WFB5ZOX.js.map → chunk-42IFCKQZ.js.map} +1 -1
  29. package/dist/{chunk-DCJ5MCJ3.js → chunk-4F7JQZOX.js} +9 -36
  30. package/dist/chunk-4F7JQZOX.js.map +1 -0
  31. package/dist/{chunk-JNIWFCKI.js → chunk-4JSZYSGW.js} +3 -3
  32. package/dist/{chunk-JNIWFCKI.js.map → chunk-4JSZYSGW.js.map} +1 -1
  33. package/dist/{chunk-EEZ7CFMM.js → chunk-5KOW3GLE.js} +2 -2
  34. package/dist/chunk-5KOW3GLE.js.map +1 -0
  35. package/dist/{chunk-6VP3XGEK.js → chunk-65ONFZWM.js} +12 -11
  36. package/dist/chunk-65ONFZWM.js.map +1 -0
  37. package/dist/{chunk-CSZRJ4RE.js → chunk-6EEYRFJC.js} +5 -5
  38. package/dist/{chunk-CSZRJ4RE.js.map → chunk-6EEYRFJC.js.map} +1 -1
  39. package/dist/{chunk-FAY3QDGC.cjs → chunk-6LGQECT7.cjs} +11 -11
  40. package/dist/{chunk-FAY3QDGC.cjs.map → chunk-6LGQECT7.cjs.map} +1 -1
  41. package/dist/{chunk-PAEJPLVN.cjs → chunk-6NEHIHFU.cjs} +4 -4
  42. package/dist/{chunk-PAEJPLVN.cjs.map → chunk-6NEHIHFU.cjs.map} +1 -1
  43. package/dist/chunk-6YNYA7GD.cjs +103 -0
  44. package/dist/chunk-6YNYA7GD.cjs.map +1 -0
  45. package/dist/chunk-74D7KSBP.cjs +112 -0
  46. package/dist/chunk-74D7KSBP.cjs.map +1 -0
  47. package/dist/{chunk-FK4EJD2I.cjs → chunk-75DSEWTJ.cjs} +7 -7
  48. package/dist/{chunk-FK4EJD2I.cjs.map → chunk-75DSEWTJ.cjs.map} +1 -1
  49. package/dist/{chunk-SWIBQFPH.cjs → chunk-7OLG7VI4.cjs} +4 -4
  50. package/dist/{chunk-SWIBQFPH.cjs.map → chunk-7OLG7VI4.cjs.map} +1 -1
  51. package/dist/chunk-7U2HAAWB.cjs +199 -0
  52. package/dist/chunk-7U2HAAWB.cjs.map +1 -0
  53. package/dist/{chunk-YBFDBOUN.cjs → chunk-7YBJZS5P.cjs} +8 -8
  54. package/dist/{chunk-YBFDBOUN.cjs.map → chunk-7YBJZS5P.cjs.map} +1 -1
  55. package/dist/{chunk-GLUWH6JO.js → chunk-AECV3G5Z.js} +4 -4
  56. package/dist/{chunk-GLUWH6JO.js.map → chunk-AECV3G5Z.js.map} +1 -1
  57. package/dist/{chunk-UQPDFW4E.js → chunk-AR5MQZ3J.js} +3 -3
  58. package/dist/{chunk-UQPDFW4E.js.map → chunk-AR5MQZ3J.js.map} +1 -1
  59. package/dist/{chunk-G2F67XUR.cjs → chunk-B4YA6BRS.cjs} +13 -14
  60. package/dist/chunk-B4YA6BRS.cjs.map +1 -0
  61. package/dist/{chunk-LTCOPATU.cjs → chunk-BCQ3E2ZG.cjs} +12 -3
  62. package/dist/chunk-BCQ3E2ZG.cjs.map +1 -0
  63. package/dist/{chunk-ALU3KC4G.cjs → chunk-BPN5ONSW.cjs} +223 -277
  64. package/dist/chunk-BPN5ONSW.cjs.map +1 -0
  65. package/dist/{chunk-YHZXBDAW.js → chunk-BQDUEG4C.js} +16 -16
  66. package/dist/{chunk-YHZXBDAW.js.map → chunk-BQDUEG4C.js.map} +1 -1
  67. package/dist/{chunk-IT3PWBW4.cjs → chunk-BURYFNOM.cjs} +2 -2
  68. package/dist/chunk-BURYFNOM.cjs.map +1 -0
  69. package/dist/{chunk-BJMKQOY2.cjs → chunk-C7OP3FAK.cjs} +47 -11
  70. package/dist/chunk-C7OP3FAK.cjs.map +1 -0
  71. package/dist/{chunk-XAYVHS2B.cjs → chunk-CEIHCKTO.cjs} +4 -4
  72. package/dist/chunk-CEIHCKTO.cjs.map +1 -0
  73. package/dist/{chunk-2423XDPT.cjs → chunk-CN6UX5EV.cjs} +28 -56
  74. package/dist/chunk-CN6UX5EV.cjs.map +1 -0
  75. package/dist/{chunk-VNNK6AKU.js → chunk-D7IULBF2.js} +3 -3
  76. package/dist/chunk-D7IULBF2.js.map +1 -0
  77. package/dist/chunk-DCXRHCZJ.cjs +118 -0
  78. package/dist/chunk-DCXRHCZJ.cjs.map +1 -0
  79. package/dist/{chunk-ICYBIC6N.cjs → chunk-DGLLVCNB.cjs} +4 -4
  80. package/dist/chunk-DGLLVCNB.cjs.map +1 -0
  81. package/dist/{chunk-I35DI7ES.js → chunk-DKFGUOWL.js} +3 -3
  82. package/dist/{chunk-I35DI7ES.js.map → chunk-DKFGUOWL.js.map} +1 -1
  83. package/dist/{chunk-TQI3KRXZ.cjs → chunk-DMTZ3FII.cjs} +18 -18
  84. package/dist/{chunk-TQI3KRXZ.cjs.map → chunk-DMTZ3FII.cjs.map} +1 -1
  85. package/dist/{chunk-QFMXXUUT.js → chunk-DU7DE543.js} +3 -3
  86. package/dist/{chunk-QFMXXUUT.js.map → chunk-DU7DE543.js.map} +1 -1
  87. package/dist/{chunk-W4QN5CMG.cjs → chunk-DWY25VLP.cjs} +9 -9
  88. package/dist/{chunk-W4QN5CMG.cjs.map → chunk-DWY25VLP.cjs.map} +1 -1
  89. package/dist/chunk-E2FFG33C.js +109 -0
  90. package/dist/chunk-E2FFG33C.js.map +1 -0
  91. package/dist/{chunk-QUFSDDNU.cjs → chunk-E4IUN3JB.cjs} +15 -15
  92. package/dist/{chunk-QUFSDDNU.cjs.map → chunk-E4IUN3JB.cjs.map} +1 -1
  93. package/dist/{chunk-THEYGCYS.cjs → chunk-ECHGWE47.cjs} +4 -4
  94. package/dist/chunk-ECHGWE47.cjs.map +1 -0
  95. package/dist/{chunk-U2WLFOA3.cjs → chunk-ECW2MLEW.cjs} +4 -4
  96. package/dist/{chunk-U2WLFOA3.cjs.map → chunk-ECW2MLEW.cjs.map} +1 -1
  97. package/dist/{chunk-MXSMAGDU.js → chunk-ET6PHZRX.js} +33 -26
  98. package/dist/chunk-ET6PHZRX.js.map +1 -0
  99. package/dist/{chunk-G6AASL5T.cjs → chunk-FRUBE44B.cjs} +24 -24
  100. package/dist/{chunk-G6AASL5T.cjs.map → chunk-FRUBE44B.cjs.map} +1 -1
  101. package/dist/{chunk-3ILFUXNE.cjs → chunk-FWBSDQZ7.cjs} +5 -5
  102. package/dist/{chunk-3ILFUXNE.cjs.map → chunk-FWBSDQZ7.cjs.map} +1 -1
  103. package/dist/{chunk-7DXLNNKH.cjs → chunk-G2Q3ZC6C.cjs} +4 -4
  104. package/dist/{chunk-7DXLNNKH.cjs.map → chunk-G2Q3ZC6C.cjs.map} +1 -1
  105. package/dist/{chunk-56ZM6P7Z.cjs → chunk-G4XUXSRN.cjs} +12 -12
  106. package/dist/chunk-G4XUXSRN.cjs.map +1 -0
  107. package/dist/{chunk-VYJSHGAY.js → chunk-GIRD3RWH.js} +422 -295
  108. package/dist/chunk-GIRD3RWH.js.map +1 -0
  109. package/dist/{chunk-NQ4AC2U4.cjs → chunk-HIQFVHC6.cjs} +9 -9
  110. package/dist/{chunk-NQ4AC2U4.cjs.map → chunk-HIQFVHC6.cjs.map} +1 -1
  111. package/dist/{chunk-EXQV452X.js → chunk-HWNVAUK4.js} +3 -3
  112. package/dist/{chunk-EXQV452X.js.map → chunk-HWNVAUK4.js.map} +1 -1
  113. package/dist/{chunk-P34DHHYQ.cjs → chunk-I53ZQHU6.cjs} +34 -27
  114. package/dist/chunk-I53ZQHU6.cjs.map +1 -0
  115. package/dist/{chunk-MHCKWQR3.cjs → chunk-IHFNRNTJ.cjs} +8 -8
  116. package/dist/{chunk-MHCKWQR3.cjs.map → chunk-IHFNRNTJ.cjs.map} +1 -1
  117. package/dist/{chunk-W52DKZBR.cjs → chunk-INSFS5GT.cjs} +680 -553
  118. package/dist/chunk-INSFS5GT.cjs.map +1 -0
  119. package/dist/{chunk-TAPQWDW2.js → chunk-IVSD7L22.js} +12 -4
  120. package/dist/chunk-IVSD7L22.js.map +1 -0
  121. package/dist/{chunk-WDGCZDRG.js → chunk-J3UK2GMN.js} +3 -3
  122. package/dist/{chunk-WDGCZDRG.js.map → chunk-J3UK2GMN.js.map} +1 -1
  123. package/dist/{chunk-4YB7B3RP.cjs → chunk-J6T5LWJ4.cjs} +15 -14
  124. package/dist/chunk-J6T5LWJ4.cjs.map +1 -0
  125. package/dist/{chunk-XAEAMI5H.js → chunk-JRLXEYR4.js} +21 -5
  126. package/dist/chunk-JRLXEYR4.js.map +1 -0
  127. package/dist/{chunk-ZJN6NTHE.js → chunk-JZUPMTJY.js} +3 -3
  128. package/dist/{chunk-ZJN6NTHE.js.map → chunk-JZUPMTJY.js.map} +1 -1
  129. package/dist/{chunk-M5ZQBOIZ.js → chunk-KE6XKRLQ.js} +3 -3
  130. package/dist/{chunk-M5ZQBOIZ.js.map → chunk-KE6XKRLQ.js.map} +1 -1
  131. package/dist/chunk-KGRIHEDT.js +110 -0
  132. package/dist/chunk-KGRIHEDT.js.map +1 -0
  133. package/dist/{chunk-T4QWDOG6.js → chunk-KWUNN5J2.js} +5 -5
  134. package/dist/{chunk-T4QWDOG6.js.map → chunk-KWUNN5J2.js.map} +1 -1
  135. package/dist/{chunk-56OXYUZE.js → chunk-KX7JV5KM.js} +3 -3
  136. package/dist/chunk-KX7JV5KM.js.map +1 -0
  137. package/dist/{chunk-D4ZUJTFB.cjs → chunk-LALG2K33.cjs} +8 -8
  138. package/dist/{chunk-D4ZUJTFB.cjs.map → chunk-LALG2K33.cjs.map} +1 -1
  139. package/dist/{chunk-QGDKZDPN.js → chunk-LGILIGV3.js} +3 -3
  140. package/dist/{chunk-QGDKZDPN.js.map → chunk-LGILIGV3.js.map} +1 -1
  141. package/dist/{chunk-HEN5WXXI.js → chunk-LJX2SQV2.js} +6 -6
  142. package/dist/{chunk-HEN5WXXI.js.map → chunk-LJX2SQV2.js.map} +1 -1
  143. package/dist/{chunk-SDIBMLL5.js → chunk-MC5EINBV.js} +44 -8
  144. package/dist/chunk-MC5EINBV.js.map +1 -0
  145. package/dist/{chunk-F6Y4IEQM.js → chunk-ML5A5DOJ.js} +4 -4
  146. package/dist/{chunk-F6Y4IEQM.js.map → chunk-ML5A5DOJ.js.map} +1 -1
  147. package/dist/{chunk-6EDQBX7U.cjs → chunk-N475ETD6.cjs} +17 -17
  148. package/dist/{chunk-6EDQBX7U.cjs.map → chunk-N475ETD6.cjs.map} +1 -1
  149. package/dist/{chunk-YPQF26X7.cjs → chunk-OBA6YK2R.cjs} +2 -2
  150. package/dist/chunk-OBA6YK2R.cjs.map +1 -0
  151. package/dist/chunk-OXNYIMZZ.js +31 -0
  152. package/dist/chunk-OXNYIMZZ.js.map +1 -0
  153. package/dist/{chunk-NFCKEBHI.js → chunk-PI4RO4GR.js} +3 -3
  154. package/dist/{chunk-NFCKEBHI.js.map → chunk-PI4RO4GR.js.map} +1 -1
  155. package/dist/{chunk-2ONFGMBV.js → chunk-PY2RQOA7.js} +2 -2
  156. package/dist/chunk-PY2RQOA7.js.map +1 -0
  157. package/dist/chunk-QKE556YD.js +197 -0
  158. package/dist/chunk-QKE556YD.js.map +1 -0
  159. package/dist/{chunk-FV3YEMQ7.js → chunk-RP5HQVLD.js} +13 -14
  160. package/dist/chunk-RP5HQVLD.js.map +1 -0
  161. package/dist/chunk-SCFW5MJZ.js +100 -0
  162. package/dist/chunk-SCFW5MJZ.js.map +1 -0
  163. package/dist/{chunk-CD73YHEH.js → chunk-SG5ZWT6C.js} +3 -3
  164. package/dist/{chunk-CD73YHEH.js.map → chunk-SG5ZWT6C.js.map} +1 -1
  165. package/dist/{chunk-MRODLUGY.cjs → chunk-TIMPJL5V.cjs} +4 -4
  166. package/dist/{chunk-MRODLUGY.cjs.map → chunk-TIMPJL5V.cjs.map} +1 -1
  167. package/dist/{chunk-77WHPVXE.js → chunk-TOTP24P6.js} +4 -4
  168. package/dist/chunk-TOTP24P6.js.map +1 -0
  169. package/dist/{chunk-3O2ELBST.cjs → chunk-USZTVNUQ.cjs} +5 -5
  170. package/dist/{chunk-3O2ELBST.cjs.map → chunk-USZTVNUQ.cjs.map} +1 -1
  171. package/dist/{chunk-YDLNI7J6.js → chunk-V2RBCCN5.js} +3 -3
  172. package/dist/chunk-V2RBCCN5.js.map +1 -0
  173. package/dist/{chunk-NNSKJCBM.cjs → chunk-VJYSQXN6.cjs} +10 -10
  174. package/dist/{chunk-NNSKJCBM.cjs.map → chunk-VJYSQXN6.cjs.map} +1 -1
  175. package/dist/{chunk-GM7QDQ24.cjs → chunk-W4WKVOOQ.cjs} +11 -11
  176. package/dist/{chunk-GM7QDQ24.cjs.map → chunk-W4WKVOOQ.cjs.map} +1 -1
  177. package/dist/chunk-XYOHKCYG.cjs +109 -0
  178. package/dist/chunk-XYOHKCYG.cjs.map +1 -0
  179. package/dist/{chunk-ZW345YOI.js → chunk-YP67XZES.js} +4 -4
  180. package/dist/{chunk-ZW345YOI.js.map → chunk-YP67XZES.js.map} +1 -1
  181. package/dist/{chunk-YCXMSDSP.js → chunk-YRXY2A5L.js} +4 -4
  182. package/dist/{chunk-YCXMSDSP.js.map → chunk-YRXY2A5L.js.map} +1 -1
  183. package/dist/{chunk-IEUDKUPM.cjs → chunk-Z2CUEBXV.cjs} +25 -9
  184. package/dist/chunk-Z2CUEBXV.cjs.map +1 -0
  185. package/dist/{chunk-GL7CFBVC.js → chunk-ZYB6B7QJ.js} +112 -165
  186. package/dist/chunk-ZYB6B7QJ.js.map +1 -0
  187. package/dist/compact-session-PYEC3NZV.js +18 -0
  188. package/dist/{compact-session-WNKKIIDW.js.map → compact-session-PYEC3NZV.js.map} +1 -1
  189. package/dist/compact-session-VVT6IBJG.cjs +55 -0
  190. package/dist/{compact-session-H5TKLD55.cjs.map → compact-session-VVT6IBJG.cjs.map} +1 -1
  191. package/dist/compaction.cjs +19 -19
  192. package/dist/compaction.d.cts +9 -9
  193. package/dist/compaction.d.ts +9 -9
  194. package/dist/compaction.js +3 -3
  195. package/dist/concurrency.cjs +6 -6
  196. package/dist/concurrency.js +4 -4
  197. package/dist/context-2FZSC6VQ.cjs +22 -0
  198. package/dist/{context-ZV33V4DC.cjs.map → context-2FZSC6VQ.cjs.map} +1 -1
  199. package/dist/context-ATJJAFOS.js +5 -0
  200. package/dist/{context-VAYLPT4O.js.map → context-ATJJAFOS.js.map} +1 -1
  201. package/dist/{cron-Dx7B-3WB.d.ts → cron-Bx7tzm5R.d.ts} +54 -2
  202. package/dist/{cron-BiK_aNJI.d.cts → cron-D-DVjGQe.d.cts} +54 -2
  203. package/dist/cron.cjs +34 -30
  204. package/dist/cron.d.cts +3 -3
  205. package/dist/cron.d.ts +3 -3
  206. package/dist/cron.js +33 -29
  207. package/dist/{errors-DyVbXdR4.d.cts → errors-DMY-gLSK.d.cts} +1 -1
  208. package/dist/{errors-Cua4WC9H.d.ts → errors-DjBQ4Tn8.d.ts} +1 -1
  209. package/dist/errors.cjs +21 -21
  210. package/dist/errors.d.cts +2 -2
  211. package/dist/errors.d.ts +2 -2
  212. package/dist/errors.js +2 -2
  213. package/dist/eval.cjs +42 -37
  214. package/dist/eval.cjs.map +1 -1
  215. package/dist/eval.js +38 -33
  216. package/dist/eval.js.map +1 -1
  217. package/dist/{executor-OZSYXDKF.cjs → executor-BMRICN46.cjs} +26 -25
  218. package/dist/executor-BMRICN46.cjs.map +1 -0
  219. package/dist/{executor-PAH72CB5.js → executor-T65PPOPT.js} +10 -9
  220. package/dist/executor-T65PPOPT.js.map +1 -0
  221. package/dist/filesystem/index.cjs +7 -7
  222. package/dist/filesystem/index.js +3 -3
  223. package/dist/fs-session-store-J5MCFFUM.cjs +19 -0
  224. package/dist/{fs-session-store-7E7UPLF2.cjs.map → fs-session-store-J5MCFFUM.cjs.map} +1 -1
  225. package/dist/fs-session-store-O6FNHECD.js +10 -0
  226. package/dist/{fs-session-store-6MY7PNI2.js.map → fs-session-store-O6FNHECD.js.map} +1 -1
  227. package/dist/generate-object-UF6WIZLF.cjs +20 -0
  228. package/dist/{generate-object-5SCEH2EE.cjs.map → generate-object-UF6WIZLF.cjs.map} +1 -1
  229. package/dist/generate-object-XDCBYVK3.js +7 -0
  230. package/dist/{generate-object-I7UD4NWN.js.map → generate-object-XDCBYVK3.js.map} +1 -1
  231. package/dist/index-manager-N7RQYUKT.cjs +20 -0
  232. package/dist/{index-manager-R6ZJFEZF.cjs.map → index-manager-N7RQYUKT.cjs.map} +1 -1
  233. package/dist/index-manager-ZVZUHPP7.js +11 -0
  234. package/dist/{index-manager-KKAK7NT3.js.map → index-manager-ZVZUHPP7.js.map} +1 -1
  235. package/dist/index.cjs +154 -148
  236. package/dist/index.cjs.map +1 -1
  237. package/dist/index.d.cts +201 -43
  238. package/dist/index.d.ts +201 -43
  239. package/dist/index.js +62 -59
  240. package/dist/index.js.map +1 -1
  241. package/dist/{inject-session-UXNJQTZ6.js → inject-session-GQMTDZUN.js} +8 -7
  242. package/dist/inject-session-GQMTDZUN.js.map +1 -0
  243. package/dist/{inject-session-DM4SKTZO.cjs → inject-session-LFCYVSLJ.cjs} +11 -10
  244. package/dist/inject-session-LFCYVSLJ.cjs.map +1 -0
  245. package/dist/internal/agent-loop/live-events.d.ts +46 -0
  246. package/dist/internal/agent-loop/loop-thinking-steps.d.ts +28 -0
  247. package/dist/internal/agent-loop/message-builders.d.ts +12 -3
  248. package/dist/internal/budget/compute-cost.d.ts +1 -1
  249. package/dist/internal/diagnostics.d.ts +46 -31
  250. package/dist/internal/error-mappers/anthropic.d.ts +1 -1
  251. package/dist/internal/global-singleton.d.ts +7 -7
  252. package/dist/internal/judge/judge-call.d.ts +14 -14
  253. package/dist/internal/llm/anthropic-shared.d.ts +4 -4
  254. package/dist/internal/llm/retrying-client.d.ts +29 -29
  255. package/dist/internal/llm/transport-error.d.ts +2 -2
  256. package/dist/internal/llm/types.d.ts +49 -9
  257. package/dist/internal/local-agent/mcp-pool.d.ts +7 -3
  258. package/dist/internal/memory/adapters/azure-openai-embedding.d.cts +2 -0
  259. package/dist/internal/memory/adapters/catalog.d.cts +1 -0
  260. package/dist/internal/memory/adapters/cohere-embedding.d.cts +2 -0
  261. package/dist/internal/memory/adapters/deepinfra-embedding.d.cts +2 -0
  262. package/dist/internal/memory/adapters/gemini-embedding.d.cts +2 -0
  263. package/dist/internal/memory/adapters/index.cjs +28 -0
  264. package/dist/internal/memory/adapters/index.cjs.map +1 -0
  265. package/dist/internal/memory/adapters/index.d.cts +16 -0
  266. package/dist/internal/memory/adapters/index.d.ts +16 -0
  267. package/dist/internal/memory/adapters/index.js +11 -0
  268. package/dist/internal/memory/adapters/index.js.map +1 -0
  269. package/dist/internal/memory/adapters/jina-embedding.d.cts +2 -0
  270. package/dist/internal/memory/adapters/mistral-embedding.d.cts +2 -0
  271. package/dist/internal/memory/adapters/ollama-embedding.d.cts +34 -0
  272. package/dist/internal/memory/adapters/openai-compatible.d.cts +51 -0
  273. package/dist/internal/memory/adapters/openai-compatible.d.ts +28 -0
  274. package/dist/internal/memory/adapters/openai-embedding.d.cts +2 -0
  275. package/dist/internal/memory/adapters/openrouter-embedding.d.cts +2 -0
  276. package/dist/internal/memory/adapters/voyage-embedding.d.cts +2 -0
  277. package/dist/internal/memory/dreaming/diary.d.ts +4 -0
  278. package/dist/internal/memory/dreaming/phases.d.ts +15 -0
  279. package/dist/internal/memory/dreaming/run.d.ts +10 -0
  280. package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +15 -0
  281. package/dist/internal/memory/sdk-memory-peer-loader.d.ts +21 -0
  282. package/dist/internal/persistence/exclusive-create.d.cts +2 -2
  283. package/dist/internal/persistence/exclusive-create.d.ts +2 -2
  284. package/dist/internal/persistence/fs-session-store.d.cts +18 -18
  285. package/dist/internal/persistence/fs-session-store.d.ts +18 -18
  286. package/dist/internal/persistence/index.cjs +25 -25
  287. package/dist/internal/persistence/index.cjs.map +1 -1
  288. package/dist/internal/persistence/index.js +6 -6
  289. package/dist/internal/persistence/index.js.map +1 -1
  290. package/dist/internal/persistence/paths.d.cts +7 -7
  291. package/dist/internal/persistence/paths.d.ts +7 -7
  292. package/dist/internal/persistence/session-transcript.d.cts +13 -7
  293. package/dist/internal/persistence/session-transcript.d.ts +13 -7
  294. package/dist/internal/persistence/session-writer.d.cts +30 -13
  295. package/dist/internal/persistence/session-writer.d.ts +30 -13
  296. package/dist/internal/runtime/concurrency/subagent-credentials.d.ts +35 -0
  297. package/dist/internal/runtime/fixtures/fixture-run-base.d.ts +45 -13
  298. package/dist/internal/runtime/lifecycle/goal-marker.d.ts +8 -8
  299. package/dist/internal/security/index.cjs +13 -13
  300. package/dist/internal/security/index.js +3 -3
  301. package/dist/internal/session/agent-session-store.d.ts +1 -0
  302. package/dist/internal/session/agent-session.d.ts +14 -14
  303. package/dist/internal/session/session-cache.d.ts +9 -9
  304. package/dist/internal/session/session-types.d.ts +6 -1
  305. package/dist/judge-call-NA2G6ZMJ.js +5 -0
  306. package/dist/{judge-call-TAEIXMYG.js.map → judge-call-NA2G6ZMJ.js.map} +1 -1
  307. package/dist/judge-call-U2D33JOW.cjs +22 -0
  308. package/dist/{judge-call-SP3G3X2Y.cjs.map → judge-call-U2D33JOW.cjs.map} +1 -1
  309. package/dist/models.cjs +20 -20
  310. package/dist/models.cjs.map +1 -1
  311. package/dist/models.js +5 -5
  312. package/dist/models.js.map +1 -1
  313. package/dist/path-safety.cjs +10 -10
  314. package/dist/path-safety.js +3 -3
  315. package/dist/persistence.cjs +43 -43
  316. package/dist/persistence.cjs.map +1 -1
  317. package/dist/persistence.d.cts +1 -1
  318. package/dist/persistence.d.ts +1 -1
  319. package/dist/persistence.js +14 -14
  320. package/dist/persistence.js.map +1 -1
  321. package/dist/project.cjs +5 -5
  322. package/dist/project.js +3 -3
  323. package/dist/registry-CAS6Y5ZY.js +9 -0
  324. package/dist/{registry-SOXE4RY6.js.map → registry-CAS6Y5ZY.js.map} +1 -1
  325. package/dist/registry-JSDI4WKA.cjs +46 -0
  326. package/dist/{registry-N3GTKYCI.cjs.map → registry-JSDI4WKA.cjs.map} +1 -1
  327. package/dist/retry.cjs +4 -4
  328. package/dist/retry.js +3 -3
  329. package/dist/{run-CwEJtLPE.d.ts → run-i2-fUohR.d.cts} +217 -174
  330. package/dist/{run-CwEJtLPE.d.cts → run-i2-fUohR.d.ts} +217 -174
  331. package/dist/{run-until-YZ2ODWOF.js → run-until-BK56WG4P.js} +3 -3
  332. package/dist/{run-until-YZ2ODWOF.js.map → run-until-BK56WG4P.js.map} +1 -1
  333. package/dist/{run-until-ZZ2JLPJM.cjs → run-until-L5KQD3PV.cjs} +4 -4
  334. package/dist/{run-until-ZZ2JLPJM.cjs.map → run-until-L5KQD3PV.cjs.map} +1 -1
  335. package/dist/sandbox/bwrap.d.cts +20 -20
  336. package/dist/sandbox/bwrap.d.ts +20 -20
  337. package/dist/sandbox/index.cjs +39 -39
  338. package/dist/sandbox/index.cjs.map +1 -1
  339. package/dist/sandbox/index.d.cts +1 -1
  340. package/dist/sandbox/index.d.ts +1 -1
  341. package/dist/sandbox/index.js +35 -35
  342. package/dist/sandbox/index.js.map +1 -1
  343. package/dist/sandbox/linux-sandbox.d.cts +26 -21
  344. package/dist/sandbox/linux-sandbox.d.ts +26 -21
  345. package/dist/server/auth/index.cjs.map +1 -1
  346. package/dist/server/auth/index.d.cts +6 -6
  347. package/dist/server/auth/index.d.ts +6 -6
  348. package/dist/server/auth/index.js.map +1 -1
  349. package/dist/server/auth/orchestrator.d.cts +2 -2
  350. package/dist/server/auth/orchestrator.d.ts +2 -2
  351. package/dist/server/auth/types.d.cts +4 -4
  352. package/dist/server/auth/types.d.ts +4 -4
  353. package/dist/server/errors-envelope.cjs +14 -14
  354. package/dist/server/errors-envelope.d.cts +3 -3
  355. package/dist/server/errors-envelope.d.ts +3 -3
  356. package/dist/server/errors-envelope.js +3 -3
  357. package/dist/session-transcript-3B52DKTG.js +5 -0
  358. package/dist/{session-transcript-6WKLYIN4.js.map → session-transcript-3B52DKTG.js.map} +1 -1
  359. package/dist/session-transcript-H7NUFXXM.cjs +50 -0
  360. package/dist/{session-transcript-EAKR4D2W.cjs.map → session-transcript-H7NUFXXM.cjs.map} +1 -1
  361. package/dist/skills.cjs +7 -7
  362. package/dist/skills.js +5 -5
  363. package/dist/stream-object-4FDU76YW.cjs +20 -0
  364. package/dist/{stream-object-Y7YCX3BI.cjs.map → stream-object-4FDU76YW.cjs.map} +1 -1
  365. package/dist/stream-object-HWDEEQN4.js +7 -0
  366. package/dist/{stream-object-OFM66VUT.js.map → stream-object-HWDEEQN4.js.map} +1 -1
  367. package/dist/subagents-loader-A4W6C3QP.cjs +15 -0
  368. package/dist/subagents-loader-A4W6C3QP.cjs.map +1 -0
  369. package/dist/subagents-loader-X33KH2SZ.js +6 -0
  370. package/dist/subagents-loader-X33KH2SZ.js.map +1 -0
  371. package/dist/subagents-loader.cjs +6 -6
  372. package/dist/subagents-loader.d.cts +2 -2
  373. package/dist/subagents-loader.d.ts +2 -2
  374. package/dist/subagents-loader.js +4 -4
  375. package/dist/subscription/index.cjs +3 -3
  376. package/dist/subscription/index.js +2 -2
  377. package/dist/task-store.cjs +7 -7
  378. package/dist/task-store.js +4 -4
  379. package/dist/types/agent-prims.d.ts +4 -4
  380. package/dist/types/agent.d.ts +68 -3
  381. package/dist/types/conversation.d.ts +7 -0
  382. package/dist/types/goal-events.d.ts +24 -23
  383. package/dist/types/messages.d.ts +9 -0
  384. package/dist/types/run.d.ts +27 -0
  385. package/dist/types/session-message.d.ts +59 -0
  386. package/dist/types/session-record.d.ts +14 -13
  387. package/dist/types/workflow.d.ts +36 -0
  388. package/dist/workflow.cjs +27 -27
  389. package/dist/workflow.d.cts +17 -1
  390. package/dist/workflow.d.ts +17 -1
  391. package/dist/workflow.js +6 -6
  392. package/docs/harness-capability-map.md +22 -0
  393. package/package.json +22 -13
  394. package/dist/agent-DW2J37IH.js +0 -42
  395. package/dist/agent-IE6IE4NW.cjs +0 -51
  396. package/dist/batch-3SEPDXCU.cjs.map +0 -1
  397. package/dist/batch-SY5GZLFD.js.map +0 -1
  398. package/dist/chunk-2423XDPT.cjs.map +0 -1
  399. package/dist/chunk-2ONFGMBV.js.map +0 -1
  400. package/dist/chunk-4YB7B3RP.cjs.map +0 -1
  401. package/dist/chunk-56OXYUZE.js.map +0 -1
  402. package/dist/chunk-56ZM6P7Z.cjs.map +0 -1
  403. package/dist/chunk-5SB4V74H.js +0 -176
  404. package/dist/chunk-5SB4V74H.js.map +0 -1
  405. package/dist/chunk-6VP3XGEK.js.map +0 -1
  406. package/dist/chunk-77WHPVXE.js.map +0 -1
  407. package/dist/chunk-ALU3KC4G.cjs.map +0 -1
  408. package/dist/chunk-BJMKQOY2.cjs.map +0 -1
  409. package/dist/chunk-DCJ5MCJ3.js.map +0 -1
  410. package/dist/chunk-EEZ7CFMM.js.map +0 -1
  411. package/dist/chunk-FV3YEMQ7.js.map +0 -1
  412. package/dist/chunk-G2F67XUR.cjs.map +0 -1
  413. package/dist/chunk-GL7CFBVC.js.map +0 -1
  414. package/dist/chunk-H5YVJB4K.cjs +0 -185
  415. package/dist/chunk-H5YVJB4K.cjs.map +0 -1
  416. package/dist/chunk-ICYBIC6N.cjs.map +0 -1
  417. package/dist/chunk-IEUDKUPM.cjs.map +0 -1
  418. package/dist/chunk-IT3PWBW4.cjs.map +0 -1
  419. package/dist/chunk-ITLS5LRF.cjs +0 -105
  420. package/dist/chunk-ITLS5LRF.cjs.map +0 -1
  421. package/dist/chunk-LTCOPATU.cjs.map +0 -1
  422. package/dist/chunk-MXSMAGDU.js.map +0 -1
  423. package/dist/chunk-P34DHHYQ.cjs.map +0 -1
  424. package/dist/chunk-SDIBMLL5.js.map +0 -1
  425. package/dist/chunk-TAPQWDW2.js.map +0 -1
  426. package/dist/chunk-THEYGCYS.cjs.map +0 -1
  427. package/dist/chunk-VNNK6AKU.js.map +0 -1
  428. package/dist/chunk-VYJSHGAY.js.map +0 -1
  429. package/dist/chunk-W52DKZBR.cjs.map +0 -1
  430. package/dist/chunk-XAEAMI5H.js.map +0 -1
  431. package/dist/chunk-XAYVHS2B.cjs.map +0 -1
  432. package/dist/chunk-YDLNI7J6.js.map +0 -1
  433. package/dist/chunk-YPQF26X7.cjs.map +0 -1
  434. package/dist/chunk-YVTNFKZO.js +0 -103
  435. package/dist/chunk-YVTNFKZO.js.map +0 -1
  436. package/dist/compact-session-H5TKLD55.cjs +0 -54
  437. package/dist/compact-session-WNKKIIDW.js +0 -17
  438. package/dist/context-VAYLPT4O.js +0 -5
  439. package/dist/context-ZV33V4DC.cjs +0 -22
  440. package/dist/executor-OZSYXDKF.cjs.map +0 -1
  441. package/dist/executor-PAH72CB5.js.map +0 -1
  442. package/dist/fs-session-store-6MY7PNI2.js +0 -10
  443. package/dist/fs-session-store-7E7UPLF2.cjs +0 -19
  444. package/dist/generate-object-5SCEH2EE.cjs +0 -20
  445. package/dist/generate-object-I7UD4NWN.js +0 -7
  446. package/dist/index-manager-KKAK7NT3.js +0 -10
  447. package/dist/index-manager-R6ZJFEZF.cjs +0 -19
  448. package/dist/inject-session-DM4SKTZO.cjs.map +0 -1
  449. package/dist/inject-session-UXNJQTZ6.js.map +0 -1
  450. package/dist/judge-call-SP3G3X2Y.cjs +0 -22
  451. package/dist/judge-call-TAEIXMYG.js +0 -5
  452. package/dist/registry-N3GTKYCI.cjs +0 -46
  453. package/dist/registry-SOXE4RY6.js +0 -9
  454. package/dist/session-transcript-6WKLYIN4.js +0 -5
  455. package/dist/session-transcript-EAKR4D2W.cjs +0 -50
  456. package/dist/stream-object-OFM66VUT.js +0 -7
  457. package/dist/stream-object-Y7YCX3BI.cjs +0 -20
@@ -1,11 +1,11 @@
1
1
  export { PersistenceSchema } from '../../chunk-CAH3G4IS.js';
2
- export { displayTheokitHome, getProfilesRoot, getTheokitHome, migrateSchema, readVersionedJson, writeVersionedJson } from '../../chunk-ZW345YOI.js';
3
- export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds, withFileLock } from '../../chunk-YHZXBDAW.js';
4
- export { applyWalWithFallback, containsCjk, isCorruptionError, openSqliteResilient, sanitizeFts5Query } from '../../chunk-GLUWH6JO.js';
2
+ export { displayTheokitHome, getProfilesRoot, getTheokitHome, migrateSchema, readVersionedJson, writeVersionedJson } from '../../chunk-YP67XZES.js';
3
+ export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds, withFileLock } from '../../chunk-BQDUEG4C.js';
4
+ export { applyWalWithFallback, containsCjk, isCorruptionError, openSqliteResilient, sanitizeFts5Query } from '../../chunk-AECV3G5Z.js';
5
5
  export { withCwdMutex } from '../../chunk-2XLKLVVR.js';
6
- export { atomicWriteJson, atomicWriteText, replaceFileAtomic } from '../../chunk-56OXYUZE.js';
7
- import '../../chunk-CD73YHEH.js';
8
- import '../../chunk-TAPQWDW2.js';
6
+ export { atomicWriteJson, atomicWriteText, replaceFileAtomic } from '../../chunk-KX7JV5KM.js';
7
+ import '../../chunk-SG5ZWT6C.js';
8
+ import '../../chunk-IVSD7L22.js';
9
9
  import { open } from 'fs/promises';
10
10
 
11
11
  async function createExclusive(path, data, options) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/internal/persistence/exclusive-create.ts","../../../src/internal/persistence/sqlite-cas.ts"],"names":[],"mappings":";;;;;;;;;;AAgCA,eAAsB,eAAA,CACpB,IAAA,EACA,IAAA,EACA,OAAA,EACkB;AAClB,EAAA,MAAM,IAAA,GAAO,SAAS,IAAA,IAAQ,GAAA;AAC9B,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,IAAA,EAAM,MAAM,IAAI,CAAA;AAC1C,IAAA,IAAI;AACF,MAAA,MAAM,MAAA,CAAO,UAAU,IAAI,CAAA;AAC3B,MAAA,OAAO,IAAA;AAAA,IACT,CAAA,SAAE;AACA,MAAA,MAAM,OAAO,KAAA,EAAM;AAAA,IACrB;AAAA,EACF,SAAS,GAAA,EAAK;AACZ,IAAA,IAAK,GAAA,CAA8B,SAAS,QAAA,EAAU;AACpD,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,MAAM,GAAA;AAAA,EACR;AACF;;;ACjBO,SAAS,SAAA,CACd,EAAA,EACA,GAAA,EACA,MAAA,EACA,kBAA0B,CAAA,EACjB;AACT,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AAC3B,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,GAAA,CAAI,GAAI,MAAoB,CAAA;AAChD,EAAA,OAAO,OAAO,OAAA,KAAY,eAAA;AAC5B","file":"index.js","sourcesContent":["/**\n * O_EXCL exclusive file creation (ADR D82).\n *\n * `createExclusive(path, data, { mode })` creates a file in a single\n * syscall (`open(path, \"wx\", mode)`). Returns `true` if created, `false`\n * if it already existed (EEXIST swallowed — caller decides). All other\n * errors propagate.\n *\n * Default mode is 0o600 (owner-only) — EC-2 fix from edge-case review:\n * token files, lockfiles, and PID files MUST NOT default to world-\n * readable 0o644 under typical umask 022. Callers writing non-sensitive\n * files can pass `mode: 0o644` explicitly.\n *\n * NFS sem honor de O_EXCL é documentado (D61 — mesma postura do\n * `withFileLock`); SDK target é ext4/APFS/NTFS.\n *\n * @internal\n */\n\nimport { open } from \"node:fs/promises\";\n\nexport interface CreateExclusiveOptions {\n /** Unix mode for the new file (default 0o600 — owner-only). */\n mode?: number;\n}\n\n/**\n * Atomically create `path` with `data`. Returns true iff this call\n * created the file (race-free under POSIX-compliant filesystems).\n *\n * @internal\n */\nexport async function createExclusive(\n path: string,\n data: string | Uint8Array,\n options?: CreateExclusiveOptions,\n): Promise<boolean> {\n const mode = options?.mode ?? 0o600;\n try {\n const handle = await open(path, \"wx\", mode);\n try {\n await handle.writeFile(data);\n return true;\n } finally {\n await handle.close();\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"EEXIST\") {\n return false;\n }\n throw err;\n }\n}\n","/**\n * SQLite optimistic compare-and-swap (ADR D83).\n *\n * `casUpdate(db, sql, params, expectedChanges)` executes a prepared\n * UPDATE and returns true if `result.changes === expectedChanges`.\n * Caller provides the full SQL (including `WHERE version = ?` predicate);\n * helper does NOT generate SQL — DRY at the level of \"wrap the\n * convention\", not \"build queries\".\n *\n * Use case canonical (Hermes `kanban_db.py:1922-1934`):\n *\n * const won = casUpdate(\n * db,\n * \"UPDATE registry SET status = ?, version = version + 1 WHERE id = ? AND version = ?\",\n * [\"running\", \"agent-foo\", 3],\n * );\n * if (!won) { ... re-read and retry ... }\n *\n * Helper does NOT retry — caller responsible for backoff (avoids hidden\n * loops). Helper does NOT cache prepared statements — `better-sqlite3`\n * caches internally; SDK use is one-shot per mutation, not hot loops.\n *\n * @internal\n */\n\nimport type Database from \"better-sqlite3\";\n\ntype DatabaseInstance = InstanceType<typeof Database>;\n\n/**\n * Execute a CAS UPDATE. Returns true iff the actual changes count matches\n * `expectedChanges`. SQL errors (invalid syntax, closed db) propagate.\n *\n * @internal\n */\nexport function casUpdate(\n db: DatabaseInstance,\n sql: string,\n params: ReadonlyArray<unknown>,\n expectedChanges: number = 1,\n): boolean {\n const stmt = db.prepare(sql);\n const result = stmt.run(...(params as unknown[]));\n return result.changes === expectedChanges;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/internal/persistence/exclusive-create.ts","../../../src/internal/persistence/sqlite-cas.ts"],"names":[],"mappings":";;;;;;;;;;AAgCA,eAAsB,eAAA,CACpB,IAAA,EACA,IAAA,EACA,OAAA,EACkB;AAClB,EAAA,MAAM,IAAA,GAAO,SAAS,IAAA,IAAQ,GAAA;AAC9B,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,IAAA,EAAM,MAAM,IAAI,CAAA;AAC1C,IAAA,IAAI;AACF,MAAA,MAAM,MAAA,CAAO,UAAU,IAAI,CAAA;AAC3B,MAAA,OAAO,IAAA;AAAA,IACT,CAAA,SAAE;AACA,MAAA,MAAM,OAAO,KAAA,EAAM;AAAA,IACrB;AAAA,EACF,SAAS,GAAA,EAAK;AACZ,IAAA,IAAK,GAAA,CAA8B,SAAS,QAAA,EAAU;AACpD,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,MAAM,GAAA;AAAA,EACR;AACF;;;ACjBO,SAAS,SAAA,CACd,EAAA,EACA,GAAA,EACA,MAAA,EACA,kBAA0B,CAAA,EACjB;AACT,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AAC3B,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,GAAA,CAAI,GAAI,MAAoB,CAAA;AAChD,EAAA,OAAO,OAAO,OAAA,KAAY,eAAA;AAC5B","file":"index.js","sourcesContent":["/**\n * O_EXCL exclusive file creation (ADR D82).\n *\n * `createExclusive(path, data, { mode })` creates a file in a single\n * syscall (`open(path, \"wx\", mode)`). Returns `true` if created, `false`\n * if it already existed (EEXIST swallowed — caller decides). All other\n * errors propagate.\n *\n * Default mode is 0o600 (owner-only) — EC-2 fix from edge-case review:\n * token files, lockfiles, and PID files MUST NOT default to world-\n * readable 0o644 under typical umask 022. Callers writing non-sensitive\n * files can pass `mode: 0o644` explicitly.\n *\n * NFS not honoring O_EXCL is documented (D61 — same stance as\n * `withFileLock`); the SDK target is ext4/APFS/NTFS.\n *\n * @internal\n */\n\nimport { open } from \"node:fs/promises\";\n\nexport interface CreateExclusiveOptions {\n /** Unix mode for the new file (default 0o600 — owner-only). */\n mode?: number;\n}\n\n/**\n * Atomically create `path` with `data`. Returns true iff this call\n * created the file (race-free under POSIX-compliant filesystems).\n *\n * @internal\n */\nexport async function createExclusive(\n path: string,\n data: string | Uint8Array,\n options?: CreateExclusiveOptions,\n): Promise<boolean> {\n const mode = options?.mode ?? 0o600;\n try {\n const handle = await open(path, \"wx\", mode);\n try {\n await handle.writeFile(data);\n return true;\n } finally {\n await handle.close();\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"EEXIST\") {\n return false;\n }\n throw err;\n }\n}\n","/**\n * SQLite optimistic compare-and-swap (ADR D83).\n *\n * `casUpdate(db, sql, params, expectedChanges)` executes a prepared\n * UPDATE and returns true if `result.changes === expectedChanges`.\n * Caller provides the full SQL (including `WHERE version = ?` predicate);\n * helper does NOT generate SQL — DRY at the level of \"wrap the\n * convention\", not \"build queries\".\n *\n * Use case canonical (Hermes `kanban_db.py:1922-1934`):\n *\n * const won = casUpdate(\n * db,\n * \"UPDATE registry SET status = ?, version = version + 1 WHERE id = ? AND version = ?\",\n * [\"running\", \"agent-foo\", 3],\n * );\n * if (!won) { ... re-read and retry ... }\n *\n * Helper does NOT retry — caller responsible for backoff (avoids hidden\n * loops). Helper does NOT cache prepared statements — `better-sqlite3`\n * caches internally; SDK use is one-shot per mutation, not hot loops.\n *\n * @internal\n */\n\nimport type Database from \"better-sqlite3\";\n\ntype DatabaseInstance = InstanceType<typeof Database>;\n\n/**\n * Execute a CAS UPDATE. Returns true iff the actual changes count matches\n * `expectedChanges`. SQL errors (invalid syntax, closed db) propagate.\n *\n * @internal\n */\nexport function casUpdate(\n db: DatabaseInstance,\n sql: string,\n params: ReadonlyArray<unknown>,\n expectedChanges: number = 1,\n): boolean {\n const stmt = db.prepare(sql);\n const result = stmt.run(...(params as unknown[]));\n return result.changes === expectedChanges;\n}\n"]}
@@ -10,15 +10,15 @@
10
10
  * `path.join(cwd, ".theokit")` in callers — use this function so tests
11
11
  * and overrides stay consistent.
12
12
  *
13
- * M94 — este comentário dizia "the ONLY canonical resolver", e deixou de ser verdade: o
14
- * transcript ganhou `transcriptRoot()`, que é **home-ancorado** (`~/.theokit`) com o mesmo
15
- * override por `THEOKIT_HOME`. Os dois defaults diferem de propósitounificar moveria o
16
- * transcript de todo mundo que NÃO define a variável, que é uma migração de dados e não um
13
+ * M94 — this comment said "the ONLY canonical resolver", and stopped being true: the
14
+ * transcript gained `transcriptRoot()`, which is **home-anchored** (`~/.theokit`) with the same
15
+ * `THEOKIT_HOME` override. The two defaults differ on purposeunifying would move the
16
+ * transcript of everyone who does NOT set the variable, which is a data migration and not a
17
17
  * re-export.
18
18
  *
19
- * Consequência que merece estar escrita: **sem `THEOKIT_HOME` o estado segue partido em dois**
20
- * — registry em `<cwd>/.theokit`, transcript em `~/.theokit`. O M94 unifica para quem define
21
- * a variável. Unificar os dois defaults é trabalho de outro milestone.
19
+ * A consequence worth writing down: **without `THEOKIT_HOME` the state stays split in two**
20
+ * — registry in `<cwd>/.theokit`, transcript in `~/.theokit`. M94 unifies only for those who set
21
+ * the variable. Unifying both defaults is another milestone's work.
22
22
  * - `getProfilesRoot()` is intentionally home-anchored (not affected by
23
23
  * `THEOKIT_HOME`) so `theokit profile list` discovers all profiles
24
24
  * regardless of which is active.
@@ -10,15 +10,15 @@
10
10
  * `path.join(cwd, ".theokit")` in callers — use this function so tests
11
11
  * and overrides stay consistent.
12
12
  *
13
- * M94 — este comentário dizia "the ONLY canonical resolver", e deixou de ser verdade: o
14
- * transcript ganhou `transcriptRoot()`, que é **home-ancorado** (`~/.theokit`) com o mesmo
15
- * override por `THEOKIT_HOME`. Os dois defaults diferem de propósitounificar moveria o
16
- * transcript de todo mundo que NÃO define a variável, que é uma migração de dados e não um
13
+ * M94 — this comment said "the ONLY canonical resolver", and stopped being true: the
14
+ * transcript gained `transcriptRoot()`, which is **home-anchored** (`~/.theokit`) with the same
15
+ * `THEOKIT_HOME` override. The two defaults differ on purposeunifying would move the
16
+ * transcript of everyone who does NOT set the variable, which is a data migration and not a
17
17
  * re-export.
18
18
  *
19
- * Consequência que merece estar escrita: **sem `THEOKIT_HOME` o estado segue partido em dois**
20
- * — registry em `<cwd>/.theokit`, transcript em `~/.theokit`. O M94 unifica para quem define
21
- * a variável. Unificar os dois defaults é trabalho de outro milestone.
19
+ * A consequence worth writing down: **without `THEOKIT_HOME` the state stays split in two**
20
+ * — registry in `<cwd>/.theokit`, transcript in `~/.theokit`. M94 unifies only for those who set
21
+ * the variable. Unifying both defaults is another milestone's work.
22
22
  * - `getProfilesRoot()` is intentionally home-anchored (not affected by
23
23
  * `THEOKIT_HOME`) so `theokit profile list` discovers all profiles
24
24
  * regardless of which is active.
@@ -10,6 +10,12 @@ export interface SessionTranscriptOptions {
10
10
  export interface AssistantTurn {
11
11
  text?: string;
12
12
  thinking?: string;
13
+ /**
14
+ * theokit#122 — the provider's signature for the thinking block. Written into the `thinking`
15
+ * record block (`Block` already declared `signature?`), so a resumed session can replay the block
16
+ * exactly as the provider issued it.
17
+ */
18
+ thinkingSignature?: string;
13
19
  toolCalls?: Array<{
14
20
  id: string;
15
21
  name: string;
@@ -57,16 +63,16 @@ export declare function reconstructMessages(records: readonly SessionRecord[]):
57
63
  /**
58
64
  * Raiz do estado de transcript.
59
65
  *
60
- * `THEOKIT_HOME` vence; o fallback é `~/.theokit`. Home-ancorado de propósito, e NÃO
61
- * `getTheokitHome(cwd)` de `paths.ts`: aquele faz fallback para `<cwd>/.theokit`, e trocar
62
- * por ele moveria o transcript de todo mundo que **não** define a variável. O irmão com a
63
- * forma certa é `catalog-source-models-dev.ts` (M94 ADR-2).
66
+ * `THEOKIT_HOME` wins; the fallback is `~/.theokit`. Home-anchored on purpose, and NOT
67
+ * `paths.ts`'s `getTheokitHome(cwd)`: that one falls back to `<cwd>/.theokit`, and switching
68
+ * by it would move the transcript of everyone who does **not** set the variable. The sibling with the
69
+ * right shape is `catalog-source-models-dev.ts` (M94 ADR-2).
64
70
  *
65
- * Antes do M94 esta função ignorava a env, então quem a definia tinha o estado partido em
66
- * dois em silêncio as sessões continuavam em `~/.theokit` enquanto o resto do SDK migrava.
71
+ * Before M94 this function ignored the env var, so whoever set it had their state split in
72
+ * two silentlysessions stayed in `~/.theokit` while the rest of the SDK migrated.
67
73
  */
68
74
  export declare function transcriptRoot(): string;
69
- /** @deprecated Use {@link transcriptRoot}. Mantido como alias — mesmo valor. */
75
+ /** @deprecated Use {@link transcriptRoot}. Kept as an alias — same value. */
70
76
  export declare function defaultBaseDir(): string;
71
77
  /**
72
78
  * Expand a leading `~` / `~/` to the user's home dir. `node:path` does NOT expand `~`, so a
@@ -10,6 +10,12 @@ export interface SessionTranscriptOptions {
10
10
  export interface AssistantTurn {
11
11
  text?: string;
12
12
  thinking?: string;
13
+ /**
14
+ * theokit#122 — the provider's signature for the thinking block. Written into the `thinking`
15
+ * record block (`Block` already declared `signature?`), so a resumed session can replay the block
16
+ * exactly as the provider issued it.
17
+ */
18
+ thinkingSignature?: string;
13
19
  toolCalls?: Array<{
14
20
  id: string;
15
21
  name: string;
@@ -57,16 +63,16 @@ export declare function reconstructMessages(records: readonly SessionRecord[]):
57
63
  /**
58
64
  * Raiz do estado de transcript.
59
65
  *
60
- * `THEOKIT_HOME` vence; o fallback é `~/.theokit`. Home-ancorado de propósito, e NÃO
61
- * `getTheokitHome(cwd)` de `paths.ts`: aquele faz fallback para `<cwd>/.theokit`, e trocar
62
- * por ele moveria o transcript de todo mundo que **não** define a variável. O irmão com a
63
- * forma certa é `catalog-source-models-dev.ts` (M94 ADR-2).
66
+ * `THEOKIT_HOME` wins; the fallback is `~/.theokit`. Home-anchored on purpose, and NOT
67
+ * `paths.ts`'s `getTheokitHome(cwd)`: that one falls back to `<cwd>/.theokit`, and switching
68
+ * by it would move the transcript of everyone who does **not** set the variable. The sibling with the
69
+ * right shape is `catalog-source-models-dev.ts` (M94 ADR-2).
64
70
  *
65
- * Antes do M94 esta função ignorava a env, então quem a definia tinha o estado partido em
66
- * dois em silêncio as sessões continuavam em `~/.theokit` enquanto o resto do SDK migrava.
71
+ * Before M94 this function ignored the env var, so whoever set it had their state split in
72
+ * two silentlysessions stayed in `~/.theokit` while the rest of the SDK migrated.
67
73
  */
68
74
  export declare function transcriptRoot(): string;
69
- /** @deprecated Use {@link transcriptRoot}. Mantido como alias — mesmo valor. */
75
+ /** @deprecated Use {@link transcriptRoot}. Kept as an alias — same value. */
70
76
  export declare function defaultBaseDir(): string;
71
77
  /**
72
78
  * Expand a leading `~` / `~/` to the user's home dir. `node:path` does NOT expand `~`, so a
@@ -45,6 +45,17 @@ export declare class SessionBusyError extends TheokitAgentError {
45
45
  export interface SessionWriterLease {
46
46
  readonly sessionPath: string;
47
47
  release(): Promise<void>;
48
+ /**
49
+ * Re-stamp the ownership record, so a **live** owner never crosses the staleness window.
50
+ *
51
+ * Idempotent and cheap: one `write` of a ~80-byte JSON. Call it on the path that already writes to
52
+ * the session — appending a turn — and the cross-host window stops being a lie about liveness.
53
+ *
54
+ * A no-op after `release()`: renewing a lease you no longer hold would re-create the lock file and
55
+ * hand this process ownership it gave up. That is the one direction of this API that could
56
+ * *create* the double-writer it exists to prevent.
57
+ */
58
+ renew(): void;
48
59
  }
49
60
  /**
50
61
  * Take the exclusive writer lease for `sessionPath`, or reject with {@link SessionBusyError}.
@@ -54,21 +65,27 @@ export interface SessionWriterLease {
54
65
  * processes, not just across async tasks in one process.
55
66
  */
56
67
  /**
57
- * Janela de obsolescência **entre máquinas** — e entre elas.
68
+ * Staleness window **between machines** — and only between them.
58
69
  *
59
- * 30 s a partir da AQUISIÇÃO. O nome "heartbeat" seria mentira: o registro é gravado uma vez, na
60
- * tomada do lease, e **não** é renovado a cada escrita. A versão anterior deste comentário dizia
61
- * "o dono toca o arquivo a cada aquisição, então um processo ativo nunca cruza a janela" — falso
62
- * duas vezes, e a revisão adversarial mediu as duas.
70
+ * 30 s from ACQUISITION. Calling it a "heartbeat" would be a lie: the record is written once, when
71
+ * the lease is taken, and is **not** renewed on every write. An earlier version of this comment
72
+ * claimed "the owner touches the file on every acquisition, so a live process never crosses the
73
+ * window" false twice over, and adversarial review measured both.
63
74
  *
64
- * No **mesmo host** isso não importa: `reclamavel` decide pelo `pid`, que é exato, e a idade não
65
- * entra na conta. Entre hosts, importa e é um limite real: um dono remoto **vivo** perde o lease
66
- * depois de 30 s, porque não como perguntar a outra máquina se o processo dela existe.
75
+ * On the **same host** this does not matter: `reclaimable` decides by `pid`, which is exact, and age
76
+ * never enters the calculation. Across hosts it does matter, and it is a real limit: a **live**
77
+ * remote owner loses the lease after 30 s, because there is no way to ask another machine whether
78
+ * its process still exists.
67
79
  *
68
- * **Resíduo declarado, não mecanizado** (a disciplina de `error-handling.md § 4`): renovar o
69
- * registro a cada append fecharia essa janela, ao custo de um `write` por turno num arquivo que
70
- * hoje é escrito uma vez por sessão. Não foi feito, e o caso multi-host não é o que motiva este
71
- * milestone o enunciado é `exec` e TUI na mesma máquina.
80
+ * **The residue is now closable by the caller** (`agent-builder#118`). `SessionWriterLease.renew()`
81
+ * re-stamps the record; calling it on the path that already writes to the session appending a turn
82
+ * keeps a live owner from ever crossing the window. It costs one `write` of ~80 bytes on a file
83
+ * that was previously written once per session.
84
+ *
85
+ * It is `renew()` and not an internal timer on purpose. A timer inside the lease would keep the event
86
+ * loop alive (or need `unref` plus its own teardown), and it would renew a lease belonging to a
87
+ * process that is hung rather than working — which is precisely the state the window exists to
88
+ * detect. Tying the renewal to a real write means the record tracks **progress**, not mere existence.
72
89
  */
73
- export declare const JANELA_DE_HEARTBEAT_MS = 30000;
90
+ export declare const HEARTBEAT_WINDOW_MS = 30000;
74
91
  export declare function acquireSessionWriter(sessionPath: string): Promise<SessionWriterLease>;
@@ -45,6 +45,17 @@ export declare class SessionBusyError extends TheokitAgentError {
45
45
  export interface SessionWriterLease {
46
46
  readonly sessionPath: string;
47
47
  release(): Promise<void>;
48
+ /**
49
+ * Re-stamp the ownership record, so a **live** owner never crosses the staleness window.
50
+ *
51
+ * Idempotent and cheap: one `write` of a ~80-byte JSON. Call it on the path that already writes to
52
+ * the session — appending a turn — and the cross-host window stops being a lie about liveness.
53
+ *
54
+ * A no-op after `release()`: renewing a lease you no longer hold would re-create the lock file and
55
+ * hand this process ownership it gave up. That is the one direction of this API that could
56
+ * *create* the double-writer it exists to prevent.
57
+ */
58
+ renew(): void;
48
59
  }
49
60
  /**
50
61
  * Take the exclusive writer lease for `sessionPath`, or reject with {@link SessionBusyError}.
@@ -54,21 +65,27 @@ export interface SessionWriterLease {
54
65
  * processes, not just across async tasks in one process.
55
66
  */
56
67
  /**
57
- * Janela de obsolescência **entre máquinas** — e entre elas.
68
+ * Staleness window **between machines** — and only between them.
58
69
  *
59
- * 30 s a partir da AQUISIÇÃO. O nome "heartbeat" seria mentira: o registro é gravado uma vez, na
60
- * tomada do lease, e **não** é renovado a cada escrita. A versão anterior deste comentário dizia
61
- * "o dono toca o arquivo a cada aquisição, então um processo ativo nunca cruza a janela" — falso
62
- * duas vezes, e a revisão adversarial mediu as duas.
70
+ * 30 s from ACQUISITION. Calling it a "heartbeat" would be a lie: the record is written once, when
71
+ * the lease is taken, and is **not** renewed on every write. An earlier version of this comment
72
+ * claimed "the owner touches the file on every acquisition, so a live process never crosses the
73
+ * window" false twice over, and adversarial review measured both.
63
74
  *
64
- * No **mesmo host** isso não importa: `reclamavel` decide pelo `pid`, que é exato, e a idade não
65
- * entra na conta. Entre hosts, importa e é um limite real: um dono remoto **vivo** perde o lease
66
- * depois de 30 s, porque não como perguntar a outra máquina se o processo dela existe.
75
+ * On the **same host** this does not matter: `reclaimable` decides by `pid`, which is exact, and age
76
+ * never enters the calculation. Across hosts it does matter, and it is a real limit: a **live**
77
+ * remote owner loses the lease after 30 s, because there is no way to ask another machine whether
78
+ * its process still exists.
67
79
  *
68
- * **Resíduo declarado, não mecanizado** (a disciplina de `error-handling.md § 4`): renovar o
69
- * registro a cada append fecharia essa janela, ao custo de um `write` por turno num arquivo que
70
- * hoje é escrito uma vez por sessão. Não foi feito, e o caso multi-host não é o que motiva este
71
- * milestone o enunciado é `exec` e TUI na mesma máquina.
80
+ * **The residue is now closable by the caller** (`agent-builder#118`). `SessionWriterLease.renew()`
81
+ * re-stamps the record; calling it on the path that already writes to the session appending a turn
82
+ * keeps a live owner from ever crossing the window. It costs one `write` of ~80 bytes on a file
83
+ * that was previously written once per session.
84
+ *
85
+ * It is `renew()` and not an internal timer on purpose. A timer inside the lease would keep the event
86
+ * loop alive (or need `unref` plus its own teardown), and it would renew a lease belonging to a
87
+ * process that is hung rather than working — which is precisely the state the window exists to
88
+ * detect. Tying the renewal to a real write means the record tracks **progress**, not mere existence.
72
89
  */
73
- export declare const JANELA_DE_HEARTBEAT_MS = 30000;
90
+ export declare const HEARTBEAT_WINDOW_MS = 30000;
74
91
  export declare function acquireSessionWriter(sessionPath: string): Promise<SessionWriterLease>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * theokit#148 — the parent's credentials, delivered through the CALL, not through the tool object.
3
+ *
4
+ * ## The class of bug this replaces
5
+ *
6
+ * Credential inheritance used to ride a property installed on the subagent tool object — first a
7
+ * unique `Symbol()`, then `Symbol.for` after #143. Both are the same shape of contract: "this
8
+ * object will reach the dispatcher with an extra property intact". Nothing enforces that, and it
9
+ * broke twice for two different reasons:
10
+ *
11
+ * - **Module duplication** (#142/#143): `tsup splitting: false` inlined a separate copy of the
12
+ * module into each public entry, so the two copies disagreed on a unique `Symbol()` key. Fixed at
13
+ * the build level by M78's `splitting: true`, but the fragile contract remained.
14
+ * - **Object normalization** (#148): any layer that rebuilds the tool from its known fields drops
15
+ * the property. `@theokit/agents`' `toCompiledTool` does exactly that, and had to add an explicit
16
+ * `Object.getOwnPropertySymbols` copy loop to compensate — a band-aid the SDK's contract forced
17
+ * onto a consumer. A named field would have been dropped by the same four-field rebuild, which is
18
+ * why "make it a typed field" alone does not close this.
19
+ *
20
+ * ## Why the async scope closes it
21
+ *
22
+ * What survives a rebuild is not the object — it is the CALL. A normalizing wrapper builds a new
23
+ * object but still invokes the original handler, inside the parent run's async context. So
24
+ * credentials published on that context reach the handler regardless of what the tool object looks
25
+ * like by then. There is no property left for a layer to drop.
26
+ *
27
+ * It also fixes a defect the per-object slot could not: credentials were stored per tool INSTANCE,
28
+ * so one subagent tool shared by two agents got last-writer-wins. The scope is per run.
29
+ *
30
+ * Nothing is exposed to third-party tool code: the store is module-private, credentials never touch
31
+ * a handler's `ctx`, and `currentInheritedSubAgentCredentials` is `@internal`.
32
+ *
33
+ * @internal
34
+ */
35
+ export {};
@@ -1,7 +1,7 @@
1
1
  import type { ModelSelection } from "../../../types/agent.js";
2
2
  import type { ConversationTurn } from "../../../types/conversation.js";
3
3
  import type { SDKMessage } from "../../../types/messages.js";
4
- import type { Run, RunOperation, RunResult, RunStatus } from "../../../types/run.js";
4
+ import type { Run, RunOperation, RunResult, RunStatus, RunTimelineEvent } from "../../../types/run.js";
5
5
  import type { FixtureScript } from "./fixture-types.js";
6
6
  export declare abstract class FixtureRunBase implements Run {
7
7
  readonly id: string;
@@ -19,6 +19,16 @@ export declare abstract class FixtureRunBase implements Run {
19
19
  protected resolveTermination: (value: RunResult) => void;
20
20
  protected terminated: boolean;
21
21
  private eventNotifier;
22
+ /**
23
+ * theokit#140 - the run's single ordered timeline: structural events and live token/tool deltas,
24
+ * in the order they actually occurred.
25
+ *
26
+ * Kept alongside `script.events` rather than replacing it. `stream()` is the SDKMessage view and
27
+ * stays byte-identical for every existing consumer; this is the complete view, and a consumer
28
+ * picks one. Merging them would have changed `stream()`'s element type - a breaking change for
29
+ * an additive feature.
30
+ */
31
+ protected readonly timeline: RunTimelineEvent[];
22
32
  constructor(options: FixtureRunBaseOptions);
23
33
  abstract bootstrap(): void;
24
34
  /**
@@ -27,24 +37,46 @@ export declare abstract class FixtureRunBase implements Run {
27
37
  * consumers of `stream()` wake up and yield it.
28
38
  */
29
39
  protected notifyNewEvents(): void;
40
+ /**
41
+ * theokit#140 - every event of this run, in true order, from ONE source.
42
+ *
43
+ * ## The defect this replaces
44
+ *
45
+ * A consumer that needed tool calls interleaved with tokens had to fuse two surfaces by hand:
46
+ * `stream()`, which was batched and post-completion, and `SendOptions.onDelta`, which was live.
47
+ * Neither was complete alone - `onDelta` has no `run_started`/`system`, and `stream()` had no
48
+ * token granularity - so the entire reconciliation, including its dedup, lived in the consumer.
49
+ * `@theokit/agents` carried ~200 lines of exactly that, and it is the documented root of its
50
+ * ordering bug (theokit#47), its namespace-dedup bug (#138) and its missing terminal frame (#142).
51
+ *
52
+ * The ordering is not reconstructed here. Both kinds are appended by the loop AS THEY HAPPEN, so
53
+ * arrival order IS model order - there is nothing to sort, and no timestamp heuristic to get
54
+ * wrong.
55
+ *
56
+ * `callId` is whatever the SDK's own `tool_call` events carry, so a consumer no longer holds two
57
+ * id namespaces and no longer has to correlate them.
58
+ */
59
+ events(): AsyncGenerator<RunTimelineEvent, void>;
60
+ /** theokit#140 - append to the timeline and wake `events()`. */
61
+ protected pushTimeline(event: RunTimelineEvent): void;
30
62
  stream(): AsyncGenerator<SDKMessage, void>;
31
63
  /**
32
- * theokit#101 — quando o run termina em erro, `stream()` tem de DIZER.
64
+ * theokit#101 — when the run ends in error, `stream()` has to SAY SO.
33
65
  *
34
- * O erro sempre existiu: o loop o registra em `ctx.error` e `wait()` devolve
35
- * `status: 'error'` com a mensagem. o `stream()` não o mencionavaele drena
36
- * `script.events` e para. Uma falha de provider (404 "No endpoints found", auth, timeout)
37
- * produzia um turno que parecia bem-sucedido e vazio, em TODA superfície que consome o
66
+ * The error always existed: the loop records it in `ctx.error` and `wait()` returns
67
+ * `status: 'error'` with the message. Only `stream()` failed to mention it it drains
68
+ * `script.events` and stops. A provider failure (404 "No endpoints found", auth, timeout)
69
+ * produced a turn that looked successful and empty, on EVERY surface consuming the
38
70
  * stream: HTTP web, MCP, stdio, TUI in-process.
39
71
  *
40
- * Erro silencioso é o pior tipo (Regra Inquebrável 8). E a assimetria era o que o tornava
41
- * difícil de diagnosticar: quem depurasse por `wait()` via o erro e não reproduziria o
42
- * relato de quem depurava pelo stream.
72
+ * A silent error is the worst kind (Unbreakable Rule 8). And the asymmetry was what made it
73
+ * hard to diagnose: anyone debugging via `wait()` saw the error and would not reproduce the
74
+ * report of anyone debugging via the stream.
43
75
  *
44
- * Emite `SDKStatusMessage` com `status: "ERROR"` — o tipo EXISTE na união `SDKMessage`
45
- * e é esperado por quem consome. Um tipo novo seria breaking para todo consumidor que
46
- * faz switch exaustivo; este é aditivo, e um consumidor que ignore `status` simplesmente
47
- * segue como antesnunca pior que hoje.
76
+ * It emits `SDKStatusMessage` with `status: "ERROR"` — the type ALREADY EXISTS in the `SDKMessage` union
77
+ * and is already expected by consumers. A new type would be breaking for every consumer doing
78
+ * an exhaustive switch; this one is additive, and a consumer ignoring `status` simply
79
+ * behaves as beforenever worse than today.
48
80
  */
49
81
  private terminalErrorEvent;
50
82
  wait(): Promise<RunResult>;
@@ -1,13 +1,13 @@
1
1
  /**
2
- * O marcador de continuação do goal-loop — num módulo FOLHA, de propósito.
2
+ * The goal-loop's continuation marker in a LEAF module, on purpose.
3
3
  *
4
- * Ele vivia em `goal-loop.ts` e era importado por `run-until.ts`, que o `goal-loop` por sua vez
5
- * importa de volta. O ciclo estava quebrado em runtime (a volta é `import type` + `await import()`
6
- * dinâmico), mas o detector de ciclos conta a aresta dinâmica e contar import dinâmico como ciclo
7
- * torna o gate impossível de satisfazer sem abandonar a técnica canônica de quebrar ciclos.
4
+ * It lived in `goal-loop.ts` and was imported by `run-until.ts`, which `goal-loop` in turn
5
+ * imports back. The cycle was broken at runtime (the return edge is `import type` + a dynamic
6
+ * `await import()`), but the cycle detector counts the dynamic edge and counting a dynamic import as a cycle
7
+ * makes the gate impossible to satisfy without abandoning the canonical cycle-breaking technique.
8
8
  *
9
- * Uma constante compartilhada por dois módulos que se conhecem é o caso-escola de extração para
10
- * folha: ninguém precisa importar o outro para conhecê-la. Some o ciclo em QUALQUER detector, sem
11
- * política de ferramenta e sem mudar uma linha de comportamento.
9
+ * A constant shared by two modules that know each other is the textbook case for extraction into a
10
+ * leaf: neither needs to import the other to know it. The cycle disappears under ANY detector, with no
11
+ * tool policy and without changing a line of behavior.
12
12
  */
13
13
  export declare const GOAL_CONTINUATION_MARKER = "[[theokit:goal-continuation]]";
@@ -1,51 +1,51 @@
1
1
  'use strict';
2
2
 
3
3
  require('../../chunk-MUUQ2WFJ.cjs');
4
- var chunkYBFDBOUN_cjs = require('../../chunk-YBFDBOUN.cjs');
5
- require('../../chunk-MHCKWQR3.cjs');
6
- var chunkLTCOPATU_cjs = require('../../chunk-LTCOPATU.cjs');
4
+ var chunk7YBJZS5P_cjs = require('../../chunk-7YBJZS5P.cjs');
5
+ require('../../chunk-IHFNRNTJ.cjs');
6
+ var chunkBCQ3E2ZG_cjs = require('../../chunk-BCQ3E2ZG.cjs');
7
7
 
8
8
 
9
9
 
10
10
  Object.defineProperty(exports, "ForbiddenPathError", {
11
11
  enumerable: true,
12
- get: function () { return chunkYBFDBOUN_cjs.ForbiddenPathError; }
12
+ get: function () { return chunk7YBJZS5P_cjs.ForbiddenPathError; }
13
13
  });
14
14
  Object.defineProperty(exports, "PathTraversalError", {
15
15
  enumerable: true,
16
- get: function () { return chunkYBFDBOUN_cjs.PathTraversalError; }
16
+ get: function () { return chunk7YBJZS5P_cjs.PathTraversalError; }
17
17
  });
18
18
  Object.defineProperty(exports, "assertNoSymlinkEscape", {
19
19
  enumerable: true,
20
- get: function () { return chunkYBFDBOUN_cjs.assertNoSymlinkEscape; }
20
+ get: function () { return chunk7YBJZS5P_cjs.assertNoSymlinkEscape; }
21
21
  });
22
22
  Object.defineProperty(exports, "isForbiddenPath", {
23
23
  enumerable: true,
24
- get: function () { return chunkYBFDBOUN_cjs.isForbiddenPath; }
24
+ get: function () { return chunk7YBJZS5P_cjs.isForbiddenPath; }
25
25
  });
26
26
  Object.defineProperty(exports, "safePathJoin", {
27
27
  enumerable: true,
28
- get: function () { return chunkYBFDBOUN_cjs.safePathJoin; }
28
+ get: function () { return chunk7YBJZS5P_cjs.safePathJoin; }
29
29
  });
30
30
  Object.defineProperty(exports, "sanitizeIdentifier", {
31
31
  enumerable: true,
32
- get: function () { return chunkYBFDBOUN_cjs.sanitizeIdentifier; }
32
+ get: function () { return chunk7YBJZS5P_cjs.sanitizeIdentifier; }
33
33
  });
34
34
  Object.defineProperty(exports, "validateArtifactPath", {
35
35
  enumerable: true,
36
- get: function () { return chunkYBFDBOUN_cjs.validateArtifactPath; }
36
+ get: function () { return chunk7YBJZS5P_cjs.validateArtifactPath; }
37
37
  });
38
38
  Object.defineProperty(exports, "addPattern", {
39
39
  enumerable: true,
40
- get: function () { return chunkLTCOPATU_cjs.addPattern; }
40
+ get: function () { return chunkBCQ3E2ZG_cjs.addPattern; }
41
41
  });
42
42
  Object.defineProperty(exports, "maskToken", {
43
43
  enumerable: true,
44
- get: function () { return chunkLTCOPATU_cjs.maskToken; }
44
+ get: function () { return chunkBCQ3E2ZG_cjs.maskToken; }
45
45
  });
46
46
  Object.defineProperty(exports, "redactSecrets", {
47
47
  enumerable: true,
48
- get: function () { return chunkLTCOPATU_cjs.redactSecrets; }
48
+ get: function () { return chunkBCQ3E2ZG_cjs.redactSecrets; }
49
49
  });
50
50
  //# sourceMappingURL=index.cjs.map
51
51
  //# sourceMappingURL=index.cjs.map
@@ -1,6 +1,6 @@
1
1
  import '../../chunk-FD2UT76F.js';
2
- export { ForbiddenPathError, PathTraversalError, assertNoSymlinkEscape, isForbiddenPath, safePathJoin, sanitizeIdentifier, validateArtifactPath } from '../../chunk-WDGCZDRG.js';
3
- import '../../chunk-CD73YHEH.js';
4
- export { addPattern, maskToken, redactSecrets } from '../../chunk-TAPQWDW2.js';
2
+ export { ForbiddenPathError, PathTraversalError, assertNoSymlinkEscape, isForbiddenPath, safePathJoin, sanitizeIdentifier, validateArtifactPath } from '../../chunk-J3UK2GMN.js';
3
+ import '../../chunk-SG5ZWT6C.js';
4
+ export { addPattern, maskToken, redactSecrets } from '../../chunk-IVSD7L22.js';
5
5
  //# sourceMappingURL=index.js.map
6
6
  //# sourceMappingURL=index.js.map
@@ -11,6 +11,7 @@
11
11
  *
12
12
  * @internal
13
13
  */
14
+ import type { ConversationTurn } from "../../types/conversation.js";
14
15
  import type { SessionStore } from "../../types/session-store.js";
15
16
  import type { SessionMessage } from "./session-types.js";
16
17
  /** The turn to persist: the user's text plus the rich per-turn conversation view. */
@@ -1,27 +1,27 @@
1
1
  import type { SessionMessage } from "./session-types.js";
2
2
  export { hydratedKeys, invalidateSessionCache, sessions, transcriptKey, } from "./session-cache.js";
3
3
  /**
4
- * Teto de sessões mantidas em memória.
4
+ * Ceiling on sessions kept in memory.
5
5
  *
6
- * O runtime a sessão **ativa**; o resto é cache puro, reconstruível do transcript em disco.
7
- * 32 é folgado de propósito o caminho primário de remoção é o `descartarSessao()` explícito no
8
- * fim da vida do agente, e este teto é rede de segurança contra um processo de vida longa que roda
9
- * centenas de sessões (risco #2 do plano: um teto apertado poderia evictar sessão ainda referenciada
10
- * por um fluxo assíncrono em voo).
6
+ * The runtime only reads the **active** session; the rest is pure cache, rebuildable from the
7
+ * on-disk transcript. 32 is deliberately generousthe primary removal path is the explicit
8
+ * `discardSession()` at the end of the agent's life, and this ceiling is a safety net against a
9
+ * long-lived process running hundreds of sessions (plan risk #2: a tight ceiling could evict a
10
+ * session still referenced by an in-flight async path).
11
11
  */
12
- export declare const TETO_DE_SESSOES_EM_CACHE = 32;
12
+ export declare const MAX_CACHED_SESSIONS = 32;
13
13
  /**
14
- * Apaga a escrituração de módulo do agente e devolve quantas entradas saíram.
14
+ * Erases the agent's module bookkeeping and returns how many entries were removed.
15
15
  *
16
16
  * M95 — `invalidateSessionCache` limpava **dois** dos quatro mapas (`sessions`, `hydratedKeys`);
17
- * `pendingWrites` e `recordCounts` nunca eram tocados por id, então cresciam pela vida do processo.
18
- * Nenhum dos dois é grande por entrada o vazamento é de contagem, não de volume — mas cache sem
19
- * dono da remoção é cache que cresce.
17
+ * `pendingWrites` and `recordCounts` were never touched by id, so they grew for the life of the
18
+ * process. Neither is large per entrythe leak is in count, not volume — but a cache with no owner
19
+ * for removal is a cache that only grows.
20
20
  *
21
- * Devolve a contagem para que o chamador possa provar a remoção; um segundo descarte devolve 0,
22
- * que é o que torna o teste de idempotência possível sem expor os mapas.
21
+ * Returns the count so the caller can prove the removal; a second discard returns 0, which is what
22
+ * makes the idempotency test possible without exposing the maps.
23
23
  */
24
- export declare function descartarSessao(cwd: string, agentId: string): number;
24
+ export declare function discardSession(cwd: string, agentId: string): number;
25
25
  export declare function getSessionMessages(agentId: string): SessionMessage[];
26
26
  export declare function clearSession(agentId: string): void;
27
27
  /**