@theokit/sdk 4.38.0 → 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 (378) hide show
  1. package/CHANGELOG.md +237 -0
  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-U3lBX-5t.d.cts → agent-D7bRK9Kg.d.cts} +70 -5
  7. package/dist/agent-I3EZZR6S.cjs +55 -0
  8. package/dist/{agent-2GZC4W2A.cjs.map → agent-I3EZZR6S.cjs.map} +1 -1
  9. package/dist/agent-KKZYLY5D.js +46 -0
  10. package/dist/{agent-3H3UKD6U.js.map → agent-KKZYLY5D.js.map} +1 -1
  11. package/dist/{agent-C3AEtM-W.d.ts → agent-ZCZa7YQv.d.ts} +70 -5
  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 +37 -1
  17. package/dist/auth/index.cjs +15 -15
  18. package/dist/auth/index.js +4 -4
  19. package/dist/{batch-LXSALQC3.js → batch-6KQM3EBA.js} +12 -12
  20. package/dist/batch-6KQM3EBA.js.map +1 -0
  21. package/dist/{batch-NZGN6SFV.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-KWXC6ERT.js → chunk-42IFCKQZ.js} +5 -5
  28. package/dist/{chunk-KWXC6ERT.js.map → chunk-42IFCKQZ.js.map} +1 -1
  29. package/dist/{chunk-4APWS2YF.js → chunk-4F7JQZOX.js} +9 -36
  30. package/dist/chunk-4F7JQZOX.js.map +1 -0
  31. package/dist/{chunk-VYD6BGKK.js → chunk-4JSZYSGW.js} +3 -3
  32. package/dist/{chunk-VYD6BGKK.js.map → chunk-4JSZYSGW.js.map} +1 -1
  33. package/dist/{chunk-A6GXYF2Q.js → chunk-65ONFZWM.js} +7 -6
  34. package/dist/chunk-65ONFZWM.js.map +1 -0
  35. package/dist/{chunk-SGTMDQ4O.js → chunk-6EEYRFJC.js} +5 -5
  36. package/dist/{chunk-SGTMDQ4O.js.map → chunk-6EEYRFJC.js.map} +1 -1
  37. package/dist/{chunk-M4OGSS66.cjs → chunk-6LGQECT7.cjs} +11 -11
  38. package/dist/{chunk-M4OGSS66.cjs.map → chunk-6LGQECT7.cjs.map} +1 -1
  39. package/dist/{chunk-KTXOHCAE.cjs → chunk-6NEHIHFU.cjs} +4 -4
  40. package/dist/{chunk-KTXOHCAE.cjs.map → chunk-6NEHIHFU.cjs.map} +1 -1
  41. package/dist/chunk-6YNYA7GD.cjs +103 -0
  42. package/dist/chunk-6YNYA7GD.cjs.map +1 -0
  43. package/dist/{chunk-2R6NBT5F.cjs → chunk-74D7KSBP.cjs} +11 -11
  44. package/dist/{chunk-2R6NBT5F.cjs.map → chunk-74D7KSBP.cjs.map} +1 -1
  45. package/dist/{chunk-6OIO4FYX.cjs → chunk-75DSEWTJ.cjs} +7 -7
  46. package/dist/{chunk-6OIO4FYX.cjs.map → chunk-75DSEWTJ.cjs.map} +1 -1
  47. package/dist/{chunk-3XRXORBS.cjs → chunk-7OLG7VI4.cjs} +4 -4
  48. package/dist/{chunk-3XRXORBS.cjs.map → chunk-7OLG7VI4.cjs.map} +1 -1
  49. package/dist/chunk-7U2HAAWB.cjs +199 -0
  50. package/dist/chunk-7U2HAAWB.cjs.map +1 -0
  51. package/dist/{chunk-QJQ2MAZF.cjs → chunk-7YBJZS5P.cjs} +8 -8
  52. package/dist/{chunk-QJQ2MAZF.cjs.map → chunk-7YBJZS5P.cjs.map} +1 -1
  53. package/dist/{chunk-ZFZYPLQI.js → chunk-AECV3G5Z.js} +4 -4
  54. package/dist/{chunk-ZFZYPLQI.js.map → chunk-AECV3G5Z.js.map} +1 -1
  55. package/dist/{chunk-QFWQLXCL.js → chunk-AR5MQZ3J.js} +3 -3
  56. package/dist/{chunk-QFWQLXCL.js.map → chunk-AR5MQZ3J.js.map} +1 -1
  57. package/dist/{chunk-G2F67XUR.cjs → chunk-B4YA6BRS.cjs} +13 -14
  58. package/dist/chunk-B4YA6BRS.cjs.map +1 -0
  59. package/dist/{chunk-BE3W4HYV.cjs → chunk-BCQ3E2ZG.cjs} +12 -3
  60. package/dist/chunk-BCQ3E2ZG.cjs.map +1 -0
  61. package/dist/{chunk-G7X2Y7Y2.cjs → chunk-BPN5ONSW.cjs} +182 -236
  62. package/dist/chunk-BPN5ONSW.cjs.map +1 -0
  63. package/dist/{chunk-XJ5TMOGA.js → chunk-BQDUEG4C.js} +3 -3
  64. package/dist/{chunk-XJ5TMOGA.js.map → chunk-BQDUEG4C.js.map} +1 -1
  65. package/dist/{chunk-OFWU6UKF.cjs → chunk-C7OP3FAK.cjs} +47 -11
  66. package/dist/chunk-C7OP3FAK.cjs.map +1 -0
  67. package/dist/{chunk-BUGVDCI5.cjs → chunk-CEIHCKTO.cjs} +4 -4
  68. package/dist/chunk-CEIHCKTO.cjs.map +1 -0
  69. package/dist/{chunk-3BSP7LSG.cjs → chunk-CN6UX5EV.cjs} +28 -56
  70. package/dist/chunk-CN6UX5EV.cjs.map +1 -0
  71. package/dist/{chunk-5BVBNE2F.js → chunk-D7IULBF2.js} +3 -3
  72. package/dist/{chunk-5BVBNE2F.js.map → chunk-D7IULBF2.js.map} +1 -1
  73. package/dist/{chunk-6ZGD7R27.cjs → chunk-DCXRHCZJ.cjs} +8 -75
  74. package/dist/chunk-DCXRHCZJ.cjs.map +1 -0
  75. package/dist/{chunk-YVI4YPUP.cjs → chunk-DGLLVCNB.cjs} +4 -4
  76. package/dist/{chunk-YVI4YPUP.cjs.map → chunk-DGLLVCNB.cjs.map} +1 -1
  77. package/dist/{chunk-JI34KBNC.js → chunk-DKFGUOWL.js} +3 -3
  78. package/dist/{chunk-JI34KBNC.js.map → chunk-DKFGUOWL.js.map} +1 -1
  79. package/dist/{chunk-ZET34IZE.cjs → chunk-DMTZ3FII.cjs} +5 -5
  80. package/dist/{chunk-ZET34IZE.cjs.map → chunk-DMTZ3FII.cjs.map} +1 -1
  81. package/dist/{chunk-6XZBKFQ7.js → chunk-DU7DE543.js} +3 -3
  82. package/dist/{chunk-6XZBKFQ7.js.map → chunk-DU7DE543.js.map} +1 -1
  83. package/dist/{chunk-VVMLMKYZ.cjs → chunk-DWY25VLP.cjs} +9 -9
  84. package/dist/{chunk-VVMLMKYZ.cjs.map → chunk-DWY25VLP.cjs.map} +1 -1
  85. package/dist/{chunk-A4XXV2C6.js → chunk-E2FFG33C.js} +5 -72
  86. package/dist/chunk-E2FFG33C.js.map +1 -0
  87. package/dist/{chunk-R4AMI7KD.cjs → chunk-E4IUN3JB.cjs} +15 -15
  88. package/dist/{chunk-R4AMI7KD.cjs.map → chunk-E4IUN3JB.cjs.map} +1 -1
  89. package/dist/{chunk-TKDWD3MU.cjs → chunk-ECHGWE47.cjs} +4 -4
  90. package/dist/{chunk-TKDWD3MU.cjs.map → chunk-ECHGWE47.cjs.map} +1 -1
  91. package/dist/{chunk-KL7E244K.cjs → chunk-ECW2MLEW.cjs} +4 -4
  92. package/dist/{chunk-KL7E244K.cjs.map → chunk-ECW2MLEW.cjs.map} +1 -1
  93. package/dist/{chunk-EDI7DBWO.js → chunk-ET6PHZRX.js} +3 -3
  94. package/dist/{chunk-EDI7DBWO.js.map → chunk-ET6PHZRX.js.map} +1 -1
  95. package/dist/{chunk-HLK35TD7.cjs → chunk-FRUBE44B.cjs} +24 -24
  96. package/dist/{chunk-HLK35TD7.cjs.map → chunk-FRUBE44B.cjs.map} +1 -1
  97. package/dist/{chunk-SRIF7HMN.cjs → chunk-FWBSDQZ7.cjs} +5 -5
  98. package/dist/{chunk-SRIF7HMN.cjs.map → chunk-FWBSDQZ7.cjs.map} +1 -1
  99. package/dist/{chunk-XKBJT7WI.cjs → chunk-G2Q3ZC6C.cjs} +4 -4
  100. package/dist/{chunk-XKBJT7WI.cjs.map → chunk-G2Q3ZC6C.cjs.map} +1 -1
  101. package/dist/{chunk-4MWBKBS4.cjs → chunk-G4XUXSRN.cjs} +12 -12
  102. package/dist/{chunk-4MWBKBS4.cjs.map → chunk-G4XUXSRN.cjs.map} +1 -1
  103. package/dist/{chunk-VUDH4D2M.js → chunk-GIRD3RWH.js} +282 -276
  104. package/dist/chunk-GIRD3RWH.js.map +1 -0
  105. package/dist/{chunk-BT6DFWZB.cjs → chunk-HIQFVHC6.cjs} +9 -9
  106. package/dist/{chunk-BT6DFWZB.cjs.map → chunk-HIQFVHC6.cjs.map} +1 -1
  107. package/dist/{chunk-UWEALKAN.js → chunk-HWNVAUK4.js} +3 -3
  108. package/dist/{chunk-UWEALKAN.js.map → chunk-HWNVAUK4.js.map} +1 -1
  109. package/dist/{chunk-3VKTDQMX.cjs → chunk-I53ZQHU6.cjs} +4 -4
  110. package/dist/{chunk-3VKTDQMX.cjs.map → chunk-I53ZQHU6.cjs.map} +1 -1
  111. package/dist/{chunk-A3MHE2MQ.cjs → chunk-IHFNRNTJ.cjs} +8 -8
  112. package/dist/{chunk-A3MHE2MQ.cjs.map → chunk-IHFNRNTJ.cjs.map} +1 -1
  113. package/dist/{chunk-UZBA6YYP.cjs → chunk-INSFS5GT.cjs} +540 -534
  114. package/dist/chunk-INSFS5GT.cjs.map +1 -0
  115. package/dist/{chunk-KCZW75PI.js → chunk-IVSD7L22.js} +12 -4
  116. package/dist/chunk-IVSD7L22.js.map +1 -0
  117. package/dist/{chunk-JCXIDFRI.js → chunk-J3UK2GMN.js} +3 -3
  118. package/dist/{chunk-JCXIDFRI.js.map → chunk-J3UK2GMN.js.map} +1 -1
  119. package/dist/{chunk-IBDE4R5L.cjs → chunk-J6T5LWJ4.cjs} +10 -9
  120. package/dist/chunk-J6T5LWJ4.cjs.map +1 -0
  121. package/dist/{chunk-AOZYORH7.js → chunk-JRLXEYR4.js} +21 -5
  122. package/dist/chunk-JRLXEYR4.js.map +1 -0
  123. package/dist/{chunk-EUB7YLU2.js → chunk-JZUPMTJY.js} +3 -3
  124. package/dist/{chunk-EUB7YLU2.js.map → chunk-JZUPMTJY.js.map} +1 -1
  125. package/dist/{chunk-ZK3BJ4XQ.js → chunk-KE6XKRLQ.js} +3 -3
  126. package/dist/{chunk-ZK3BJ4XQ.js.map → chunk-KE6XKRLQ.js.map} +1 -1
  127. package/dist/{chunk-4NVV3GRU.js → chunk-KGRIHEDT.js} +5 -5
  128. package/dist/{chunk-4NVV3GRU.js.map → chunk-KGRIHEDT.js.map} +1 -1
  129. package/dist/{chunk-EE24WJJR.js → chunk-KWUNN5J2.js} +5 -5
  130. package/dist/{chunk-EE24WJJR.js.map → chunk-KWUNN5J2.js.map} +1 -1
  131. package/dist/{chunk-LGCEYEU2.js → chunk-KX7JV5KM.js} +3 -3
  132. package/dist/{chunk-LGCEYEU2.js.map → chunk-KX7JV5KM.js.map} +1 -1
  133. package/dist/{chunk-2K7PRHDB.cjs → chunk-LALG2K33.cjs} +8 -8
  134. package/dist/{chunk-2K7PRHDB.cjs.map → chunk-LALG2K33.cjs.map} +1 -1
  135. package/dist/{chunk-4WIJSKFA.js → chunk-LGILIGV3.js} +3 -3
  136. package/dist/{chunk-4WIJSKFA.js.map → chunk-LGILIGV3.js.map} +1 -1
  137. package/dist/{chunk-7QDTZJRV.js → chunk-LJX2SQV2.js} +6 -6
  138. package/dist/{chunk-7QDTZJRV.js.map → chunk-LJX2SQV2.js.map} +1 -1
  139. package/dist/{chunk-ACHGT3D2.js → chunk-MC5EINBV.js} +44 -8
  140. package/dist/chunk-MC5EINBV.js.map +1 -0
  141. package/dist/{chunk-M6UUTNDT.js → chunk-ML5A5DOJ.js} +4 -4
  142. package/dist/{chunk-M6UUTNDT.js.map → chunk-ML5A5DOJ.js.map} +1 -1
  143. package/dist/{chunk-3MUIYMUG.cjs → chunk-N475ETD6.cjs} +17 -17
  144. package/dist/{chunk-3MUIYMUG.cjs.map → chunk-N475ETD6.cjs.map} +1 -1
  145. package/dist/chunk-OXNYIMZZ.js +31 -0
  146. package/dist/chunk-OXNYIMZZ.js.map +1 -0
  147. package/dist/{chunk-YCHC45BY.js → chunk-PI4RO4GR.js} +3 -3
  148. package/dist/{chunk-YCHC45BY.js.map → chunk-PI4RO4GR.js.map} +1 -1
  149. package/dist/chunk-QKE556YD.js +197 -0
  150. package/dist/chunk-QKE556YD.js.map +1 -0
  151. package/dist/{chunk-FV3YEMQ7.js → chunk-RP5HQVLD.js} +13 -14
  152. package/dist/chunk-RP5HQVLD.js.map +1 -0
  153. package/dist/chunk-SCFW5MJZ.js +100 -0
  154. package/dist/chunk-SCFW5MJZ.js.map +1 -0
  155. package/dist/{chunk-ZYOHF37V.js → chunk-SG5ZWT6C.js} +3 -3
  156. package/dist/{chunk-ZYOHF37V.js.map → chunk-SG5ZWT6C.js.map} +1 -1
  157. package/dist/{chunk-ED7ANP6W.cjs → chunk-TIMPJL5V.cjs} +4 -4
  158. package/dist/{chunk-ED7ANP6W.cjs.map → chunk-TIMPJL5V.cjs.map} +1 -1
  159. package/dist/{chunk-3XKVRLR2.js → chunk-TOTP24P6.js} +4 -4
  160. package/dist/{chunk-3XKVRLR2.js.map → chunk-TOTP24P6.js.map} +1 -1
  161. package/dist/{chunk-PG3QQLWS.cjs → chunk-USZTVNUQ.cjs} +5 -5
  162. package/dist/{chunk-PG3QQLWS.cjs.map → chunk-USZTVNUQ.cjs.map} +1 -1
  163. package/dist/{chunk-XS7SKY2F.js → chunk-V2RBCCN5.js} +3 -3
  164. package/dist/chunk-V2RBCCN5.js.map +1 -0
  165. package/dist/{chunk-D3SJLXYZ.cjs → chunk-VJYSQXN6.cjs} +10 -10
  166. package/dist/{chunk-D3SJLXYZ.cjs.map → chunk-VJYSQXN6.cjs.map} +1 -1
  167. package/dist/{chunk-MXRBNJ6D.cjs → chunk-W4WKVOOQ.cjs} +11 -11
  168. package/dist/{chunk-MXRBNJ6D.cjs.map → chunk-W4WKVOOQ.cjs.map} +1 -1
  169. package/dist/chunk-XYOHKCYG.cjs +109 -0
  170. package/dist/chunk-XYOHKCYG.cjs.map +1 -0
  171. package/dist/{chunk-UD2T7ISG.js → chunk-YP67XZES.js} +4 -4
  172. package/dist/{chunk-UD2T7ISG.js.map → chunk-YP67XZES.js.map} +1 -1
  173. package/dist/{chunk-HHUDNTZC.js → chunk-YRXY2A5L.js} +4 -4
  174. package/dist/{chunk-HHUDNTZC.js.map → chunk-YRXY2A5L.js.map} +1 -1
  175. package/dist/{chunk-6OKPJZMX.cjs → chunk-Z2CUEBXV.cjs} +25 -9
  176. package/dist/chunk-Z2CUEBXV.cjs.map +1 -0
  177. package/dist/{chunk-HI6G3SNY.js → chunk-ZYB6B7QJ.js} +72 -125
  178. package/dist/chunk-ZYB6B7QJ.js.map +1 -0
  179. package/dist/compact-session-PYEC3NZV.js +18 -0
  180. package/dist/{compact-session-RR3ILTES.js.map → compact-session-PYEC3NZV.js.map} +1 -1
  181. package/dist/compact-session-VVT6IBJG.cjs +55 -0
  182. package/dist/{compact-session-YOWJJPPB.cjs.map → compact-session-VVT6IBJG.cjs.map} +1 -1
  183. package/dist/compaction.cjs +16 -16
  184. package/dist/compaction.js +3 -3
  185. package/dist/concurrency.cjs +6 -6
  186. package/dist/concurrency.js +4 -4
  187. package/dist/context-2FZSC6VQ.cjs +22 -0
  188. package/dist/{context-Q6ISOCN2.cjs.map → context-2FZSC6VQ.cjs.map} +1 -1
  189. package/dist/context-ATJJAFOS.js +5 -0
  190. package/dist/{context-ZDBBPIHY.js.map → context-ATJJAFOS.js.map} +1 -1
  191. package/dist/{cron-ChQ6zcW2.d.ts → cron-Bx7tzm5R.d.ts} +54 -2
  192. package/dist/{cron-BdXOZco9.d.cts → cron-D-DVjGQe.d.cts} +54 -2
  193. package/dist/cron.cjs +33 -29
  194. package/dist/cron.d.cts +3 -3
  195. package/dist/cron.d.ts +3 -3
  196. package/dist/cron.js +32 -28
  197. package/dist/{errors-BUVjJGJA.d.cts → errors-DMY-gLSK.d.cts} +1 -1
  198. package/dist/{errors-CZIUKLHt.d.ts → errors-DjBQ4Tn8.d.ts} +1 -1
  199. package/dist/errors.cjs +21 -21
  200. package/dist/errors.d.cts +2 -2
  201. package/dist/errors.d.ts +2 -2
  202. package/dist/errors.js +2 -2
  203. package/dist/eval.cjs +41 -36
  204. package/dist/eval.cjs.map +1 -1
  205. package/dist/eval.js +37 -32
  206. package/dist/eval.js.map +1 -1
  207. package/dist/{executor-DPCBSI35.cjs → executor-BMRICN46.cjs} +26 -25
  208. package/dist/executor-BMRICN46.cjs.map +1 -0
  209. package/dist/{executor-ASDDIM2X.js → executor-T65PPOPT.js} +10 -9
  210. package/dist/executor-T65PPOPT.js.map +1 -0
  211. package/dist/filesystem/index.cjs +7 -7
  212. package/dist/filesystem/index.js +3 -3
  213. package/dist/fs-session-store-J5MCFFUM.cjs +19 -0
  214. package/dist/{fs-session-store-T5ZLQX42.cjs.map → fs-session-store-J5MCFFUM.cjs.map} +1 -1
  215. package/dist/fs-session-store-O6FNHECD.js +10 -0
  216. package/dist/{fs-session-store-K5QUPNJZ.js.map → fs-session-store-O6FNHECD.js.map} +1 -1
  217. package/dist/generate-object-UF6WIZLF.cjs +20 -0
  218. package/dist/{generate-object-F56VIZ6U.cjs.map → generate-object-UF6WIZLF.cjs.map} +1 -1
  219. package/dist/generate-object-XDCBYVK3.js +7 -0
  220. package/dist/{generate-object-LPSO6GVW.js.map → generate-object-XDCBYVK3.js.map} +1 -1
  221. package/dist/index-manager-N7RQYUKT.cjs +20 -0
  222. package/dist/{index-manager-DBJ55ZSO.cjs.map → index-manager-N7RQYUKT.cjs.map} +1 -1
  223. package/dist/index-manager-ZVZUHPP7.js +11 -0
  224. package/dist/{index-manager-F2H2RCZU.js.map → index-manager-ZVZUHPP7.js.map} +1 -1
  225. package/dist/index.cjs +138 -132
  226. package/dist/index.cjs.map +1 -1
  227. package/dist/index.d.cts +167 -9
  228. package/dist/index.d.ts +167 -9
  229. package/dist/index.js +47 -44
  230. package/dist/index.js.map +1 -1
  231. package/dist/{inject-session-RKNLUE72.js → inject-session-GQMTDZUN.js} +7 -6
  232. package/dist/inject-session-GQMTDZUN.js.map +1 -0
  233. package/dist/{inject-session-25EC74WV.cjs → inject-session-LFCYVSLJ.cjs} +9 -8
  234. package/dist/inject-session-LFCYVSLJ.cjs.map +1 -0
  235. package/dist/internal/agent-loop/loop-thinking-steps.d.ts +28 -0
  236. package/dist/internal/agent-loop/message-builders.d.ts +12 -3
  237. package/dist/internal/diagnostics.d.ts +24 -11
  238. package/dist/internal/llm/anthropic-shared.d.ts +4 -4
  239. package/dist/internal/llm/types.d.ts +49 -9
  240. package/dist/internal/local-agent/mcp-pool.d.ts +7 -3
  241. package/dist/internal/memory/adapters/azure-openai-embedding.d.cts +2 -0
  242. package/dist/internal/memory/adapters/catalog.d.cts +1 -0
  243. package/dist/internal/memory/adapters/cohere-embedding.d.cts +2 -0
  244. package/dist/internal/memory/adapters/deepinfra-embedding.d.cts +2 -0
  245. package/dist/internal/memory/adapters/gemini-embedding.d.cts +2 -0
  246. package/dist/internal/memory/adapters/index.cjs +28 -0
  247. package/dist/internal/memory/adapters/index.cjs.map +1 -0
  248. package/dist/internal/memory/adapters/index.d.cts +16 -0
  249. package/dist/internal/memory/adapters/index.d.ts +16 -0
  250. package/dist/internal/memory/adapters/index.js +11 -0
  251. package/dist/internal/memory/adapters/index.js.map +1 -0
  252. package/dist/internal/memory/adapters/jina-embedding.d.cts +2 -0
  253. package/dist/internal/memory/adapters/mistral-embedding.d.cts +2 -0
  254. package/dist/internal/memory/adapters/ollama-embedding.d.cts +34 -0
  255. package/dist/internal/memory/adapters/openai-compatible.d.cts +51 -0
  256. package/dist/internal/memory/adapters/openai-compatible.d.ts +28 -0
  257. package/dist/internal/memory/adapters/openai-embedding.d.cts +2 -0
  258. package/dist/internal/memory/adapters/openrouter-embedding.d.cts +2 -0
  259. package/dist/internal/memory/adapters/voyage-embedding.d.cts +2 -0
  260. package/dist/internal/memory/dreaming/diary.d.ts +4 -0
  261. package/dist/internal/memory/dreaming/phases.d.ts +15 -0
  262. package/dist/internal/memory/dreaming/run.d.ts +10 -0
  263. package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +15 -0
  264. package/dist/internal/memory/sdk-memory-peer-loader.d.ts +21 -0
  265. package/dist/internal/persistence/index.cjs +25 -25
  266. package/dist/internal/persistence/index.js +6 -6
  267. package/dist/internal/persistence/session-transcript.d.cts +6 -0
  268. package/dist/internal/persistence/session-transcript.d.ts +6 -0
  269. package/dist/internal/runtime/concurrency/subagent-credentials.d.ts +35 -0
  270. package/dist/internal/security/index.cjs +13 -13
  271. package/dist/internal/security/index.js +3 -3
  272. package/dist/internal/session/agent-session-store.d.ts +1 -0
  273. package/dist/internal/session/session-types.d.ts +6 -1
  274. package/dist/judge-call-NA2G6ZMJ.js +5 -0
  275. package/dist/{judge-call-3S3T6O2Z.js.map → judge-call-NA2G6ZMJ.js.map} +1 -1
  276. package/dist/judge-call-U2D33JOW.cjs +22 -0
  277. package/dist/{judge-call-XIQJ5GIE.cjs.map → judge-call-U2D33JOW.cjs.map} +1 -1
  278. package/dist/models.cjs +20 -20
  279. package/dist/models.js +5 -5
  280. package/dist/path-safety.cjs +10 -10
  281. package/dist/path-safety.js +3 -3
  282. package/dist/persistence.cjs +35 -35
  283. package/dist/persistence.js +7 -7
  284. package/dist/project.cjs +5 -5
  285. package/dist/project.js +3 -3
  286. package/dist/registry-CAS6Y5ZY.js +9 -0
  287. package/dist/{registry-KMI5RA22.js.map → registry-CAS6Y5ZY.js.map} +1 -1
  288. package/dist/registry-JSDI4WKA.cjs +46 -0
  289. package/dist/{registry-BA3SLAN7.cjs.map → registry-JSDI4WKA.cjs.map} +1 -1
  290. package/dist/retry.cjs +4 -4
  291. package/dist/retry.js +3 -3
  292. package/dist/{run-vJHg2eGw.d.cts → run-i2-fUohR.d.cts} +16 -0
  293. package/dist/{run-vJHg2eGw.d.ts → run-i2-fUohR.d.ts} +16 -0
  294. package/dist/sandbox/index.cjs +6 -6
  295. package/dist/sandbox/index.js +2 -2
  296. package/dist/server/errors-envelope.cjs +14 -14
  297. package/dist/server/errors-envelope.d.cts +3 -3
  298. package/dist/server/errors-envelope.d.ts +3 -3
  299. package/dist/server/errors-envelope.js +3 -3
  300. package/dist/session-transcript-3B52DKTG.js +5 -0
  301. package/dist/{session-transcript-MMPWCESR.js.map → session-transcript-3B52DKTG.js.map} +1 -1
  302. package/dist/session-transcript-H7NUFXXM.cjs +50 -0
  303. package/dist/{session-transcript-DFGX6WNL.cjs.map → session-transcript-H7NUFXXM.cjs.map} +1 -1
  304. package/dist/skills.cjs +7 -7
  305. package/dist/skills.js +5 -5
  306. package/dist/stream-object-4FDU76YW.cjs +20 -0
  307. package/dist/{stream-object-YPXZ4F5P.cjs.map → stream-object-4FDU76YW.cjs.map} +1 -1
  308. package/dist/stream-object-HWDEEQN4.js +7 -0
  309. package/dist/{stream-object-AFERZU63.js.map → stream-object-HWDEEQN4.js.map} +1 -1
  310. package/dist/subagents-loader-A4W6C3QP.cjs +15 -0
  311. package/dist/subagents-loader-A4W6C3QP.cjs.map +1 -0
  312. package/dist/subagents-loader-X33KH2SZ.js +6 -0
  313. package/dist/subagents-loader-X33KH2SZ.js.map +1 -0
  314. package/dist/subagents-loader.cjs +6 -6
  315. package/dist/subagents-loader.d.cts +2 -2
  316. package/dist/subagents-loader.d.ts +2 -2
  317. package/dist/subagents-loader.js +4 -4
  318. package/dist/subscription/index.cjs +3 -3
  319. package/dist/subscription/index.js +2 -2
  320. package/dist/task-store.cjs +7 -7
  321. package/dist/task-store.js +4 -4
  322. package/dist/types/agent.d.ts +68 -3
  323. package/dist/types/conversation.d.ts +7 -0
  324. package/dist/types/messages.d.ts +9 -0
  325. package/dist/types/session-message.d.ts +59 -0
  326. package/dist/types/workflow.d.ts +36 -0
  327. package/dist/workflow.cjs +27 -27
  328. package/dist/workflow.d.cts +17 -1
  329. package/dist/workflow.d.ts +17 -1
  330. package/dist/workflow.js +6 -6
  331. package/docs/harness-capability-map.md +22 -0
  332. package/package.json +11 -1
  333. package/dist/agent-2GZC4W2A.cjs +0 -51
  334. package/dist/agent-3H3UKD6U.js +0 -42
  335. package/dist/batch-LXSALQC3.js.map +0 -1
  336. package/dist/batch-NZGN6SFV.cjs.map +0 -1
  337. package/dist/chunk-3BSP7LSG.cjs.map +0 -1
  338. package/dist/chunk-4APWS2YF.js.map +0 -1
  339. package/dist/chunk-6OKPJZMX.cjs.map +0 -1
  340. package/dist/chunk-6ZGD7R27.cjs.map +0 -1
  341. package/dist/chunk-A4XXV2C6.js.map +0 -1
  342. package/dist/chunk-A6GXYF2Q.js.map +0 -1
  343. package/dist/chunk-ACHGT3D2.js.map +0 -1
  344. package/dist/chunk-AOZYORH7.js.map +0 -1
  345. package/dist/chunk-BE3W4HYV.cjs.map +0 -1
  346. package/dist/chunk-BUGVDCI5.cjs.map +0 -1
  347. package/dist/chunk-FV3YEMQ7.js.map +0 -1
  348. package/dist/chunk-G2F67XUR.cjs.map +0 -1
  349. package/dist/chunk-G7X2Y7Y2.cjs.map +0 -1
  350. package/dist/chunk-HI6G3SNY.js.map +0 -1
  351. package/dist/chunk-IBDE4R5L.cjs.map +0 -1
  352. package/dist/chunk-KCZW75PI.js.map +0 -1
  353. package/dist/chunk-OFWU6UKF.cjs.map +0 -1
  354. package/dist/chunk-UZBA6YYP.cjs.map +0 -1
  355. package/dist/chunk-VUDH4D2M.js.map +0 -1
  356. package/dist/chunk-XS7SKY2F.js.map +0 -1
  357. package/dist/compact-session-RR3ILTES.js +0 -17
  358. package/dist/compact-session-YOWJJPPB.cjs +0 -54
  359. package/dist/context-Q6ISOCN2.cjs +0 -22
  360. package/dist/context-ZDBBPIHY.js +0 -5
  361. package/dist/executor-ASDDIM2X.js.map +0 -1
  362. package/dist/executor-DPCBSI35.cjs.map +0 -1
  363. package/dist/fs-session-store-K5QUPNJZ.js +0 -10
  364. package/dist/fs-session-store-T5ZLQX42.cjs +0 -19
  365. package/dist/generate-object-F56VIZ6U.cjs +0 -20
  366. package/dist/generate-object-LPSO6GVW.js +0 -7
  367. package/dist/index-manager-DBJ55ZSO.cjs +0 -19
  368. package/dist/index-manager-F2H2RCZU.js +0 -10
  369. package/dist/inject-session-25EC74WV.cjs.map +0 -1
  370. package/dist/inject-session-RKNLUE72.js.map +0 -1
  371. package/dist/judge-call-3S3T6O2Z.js +0 -5
  372. package/dist/judge-call-XIQJ5GIE.cjs +0 -22
  373. package/dist/registry-BA3SLAN7.cjs +0 -46
  374. package/dist/registry-KMI5RA22.js +0 -9
  375. package/dist/session-transcript-DFGX6WNL.cjs +0 -50
  376. package/dist/session-transcript-MMPWCESR.js +0 -5
  377. package/dist/stream-object-AFERZU63.js +0 -7
  378. package/dist/stream-object-YPXZ4F5P.cjs +0 -20
@@ -1,32 +1,33 @@
1
1
  import { extractCodePlugins } from './chunk-2SFBB54R.js';
2
- import { submit, emitRunEvent } from './chunk-7QDTZJRV.js';
3
- import { enqueueSessionWrite, hydrateSession, persistTurnToTranscript, flushSessionWrites, appendSessionMessage, getSessionMessages, discardSession, clearSession } from './chunk-A4XXV2C6.js';
4
- import { FsSessionStore } from './chunk-4NVV3GRU.js';
5
- import { discoverProviderPlugins, getConfiguredBaseUrl, httpRequest, isFixtureApiKey, shouldUseRealLocalRuntime, CircuitBreaker, buildDefaultSummarizer, parseSseStream, resolveProviderChain, inferProviderFromApiKey, detectPrimaryProvider, tryFirstEvent, relayStream, mapOpenAICompatibleError, renderToolResultContentText } from './chunk-HI6G3SNY.js';
6
- import { IndexManager, writeSessionSummary, memoryDir, globalEmbeddingCache, appendFact, readFacts, legacyMemoryJsonPath, memoryMdPath, appendFactToMarkdown } from './chunk-4APWS2YF.js';
7
- import { loadHookConfig, warnOnce, currentPersonalityContext, warnPersonalitySwitchInsideFork } from './chunk-M6UUTNDT.js';
2
+ import { submit, emitRunEvent } from './chunk-LJX2SQV2.js';
3
+ import { enqueueSessionWrite, hydrateSession, persistTurnToTranscript, flushSessionWrites, appendSessionMessage, getSessionMessages, discardSession, clearSession } from './chunk-E2FFG33C.js';
4
+ import { FsSessionStore } from './chunk-KGRIHEDT.js';
5
+ import { discoverProviderPlugins, getConfiguredBaseUrl, httpRequest, isFixtureApiKey, shouldUseRealLocalRuntime, CircuitBreaker, buildDefaultSummarizer, parseSseStream, resolveProviderChain, inferProviderFromApiKey, detectPrimaryProvider, tryFirstEvent, relayStream, renderToolResultContentText } from './chunk-ZYB6B7QJ.js';
6
+ import { IndexManager, writeSessionSummary, memoryDir, appendFact, readFacts, legacyMemoryJsonPath, memoryMdPath, appendFactToMarkdown } from './chunk-4F7JQZOX.js';
7
+ import { loadHookConfig, warnOnce, currentPersonalityContext, warnPersonalitySwitchInsideFork } from './chunk-ML5A5DOJ.js';
8
8
  import { resolveChildEnv } from './chunk-7GFX45DD.js';
9
- import { readVersionedJson, getTheokitHome, writeVersionedJson } from './chunk-UD2T7ISG.js';
9
+ import { readVersionedJson, getTheokitHome, writeVersionedJson } from './chunk-YP67XZES.js';
10
+ import { createOpenAiCompatibleRuntime } from './chunk-QKE556YD.js';
10
11
  import { sanitizeToolInput } from './chunk-U54XCYG3.js';
11
- import { subAgentToolsFromDefinitions, inheritSubAgentCredentials } from './chunk-FV3YEMQ7.js';
12
+ import { withInheritedSubAgentCredentials, subAgentToolsFromDefinitions } from './chunk-RP5HQVLD.js';
12
13
  import { setAgentFacade } from './chunk-6X6ID4MO.js';
13
14
  import { findGitRoot, DEFAULT_DISCOVERY_SPECS, walkUpForFile, walkUpForGlob } from './chunk-UJ7IQJAG.js';
14
15
  import { withToolWhitelist, checkToolWhitelist } from './chunk-7AD3ZTZL.js';
15
- import { mapWithConcurrency } from './chunk-4WIJSKFA.js';
16
- import { withFileLock } from './chunk-XJ5TMOGA.js';
16
+ import { mapWithConcurrency } from './chunk-LGILIGV3.js';
17
+ import { defaultBaseDir, expandTilde } from './chunk-JRLXEYR4.js';
18
+ import { withFileLock } from './chunk-BQDUEG4C.js';
17
19
  import { withCwdMutex } from './chunk-2XLKLVVR.js';
18
- import { defaultBaseDir, expandTilde } from './chunk-AOZYORH7.js';
19
20
  import { toJsonSchema } from './chunk-4VPXM6UU.js';
20
- import { atomicWriteJson } from './chunk-LGCEYEU2.js';
21
- import { loadSubagents } from './chunk-HHUDNTZC.js';
22
- import { resolveEffectiveContextWindow, CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN } from './chunk-A6GXYF2Q.js';
21
+ import { atomicWriteJson } from './chunk-KX7JV5KM.js';
22
+ import { loadSubagents } from './chunk-YRXY2A5L.js';
23
+ import { resolveEffectiveContextWindow, CONTEXT_WINDOW_FLOOR, CONTEXT_WINDOW_MARGIN } from './chunk-65ONFZWM.js';
23
24
  import { parseModelId } from './chunk-X2FR4OIT.js';
24
- import { getCatalogModelInfo, registerBuiltins, getProviderProfile, registerProvider, isPatchedModelKey } from './chunk-3XKVRLR2.js';
25
- import { escapeBlockBody, buildSkillsBlock, discoverSkills, stripSkillFrontmatter } from './chunk-KWXC6ERT.js';
26
- import { validateArtifactPath, PathTraversalError, safePathJoin } from './chunk-JCXIDFRI.js';
27
- import { readWorkspaceDir, parseSimpleYaml } from './chunk-QFWQLXCL.js';
28
- import { AgentRunError, coerceToKnownAgentRunErrorCode, UnknownAgentError, ConfigurationError, AuthenticationError, UnsupportedRunOperationError, AgentDisposedError, NetworkError, TheokitAgentError } from './chunk-ZYOHF37V.js';
29
- import { diag, redactSecrets } from './chunk-KCZW75PI.js';
25
+ import { getCatalogModelInfo, registerBuiltins, getProviderProfile, registerProvider, isPatchedModelKey } from './chunk-TOTP24P6.js';
26
+ import { escapeBlockBody, buildSkillsBlock, discoverSkills, stripSkillFrontmatter } from './chunk-42IFCKQZ.js';
27
+ import { validateArtifactPath, PathTraversalError, safePathJoin } from './chunk-J3UK2GMN.js';
28
+ import { readWorkspaceDir, parseSimpleYaml } from './chunk-AR5MQZ3J.js';
29
+ import { AgentRunError, coerceToKnownAgentRunErrorCode, UnknownAgentError, ConfigurationError, AuthenticationError, UnsupportedRunOperationError, AgentDisposedError, NetworkError, TheokitAgentError } from './chunk-SG5ZWT6C.js';
30
+ import { diag, redactSecrets } from './chunk-IVSD7L22.js';
30
31
  import { stat, mkdir, readFile, readdir, access, unlink } from 'fs/promises';
31
32
  import { randomUUID, createHash } from 'crypto';
32
33
  import { join, dirname, resolve, relative, isAbsolute } from 'path';
@@ -221,7 +222,7 @@ async function agentGenerate(agent, agentModel, agentApiKey, agentLocal, input,
221
222
  const { output, maxRetries, errorStrategy, ...sendOptions } = options;
222
223
  const run = await agent.send(input, sendOptions);
223
224
  const result = await run.wait();
224
- const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-LPSO6GVW.js');
225
+ const { generateObjectImpl, GenerateObjectError } = await import('./generate-object-XDCBYVK3.js');
225
226
  const answer = structurableAnswerOrThrow(result, GenerateObjectError);
226
227
  const { getAgentFacade } = await import('./agent-factory-registry-ZVTABLEY.js');
227
228
  const facade = getAgentFacade();
@@ -4989,6 +4990,35 @@ var UsageAccumulator = class {
4989
4990
  }
4990
4991
  };
4991
4992
 
4993
+ // src/internal/agent-loop/live-events.ts
4994
+ var LiveEventLog = class extends Array {
4995
+ /**
4996
+ * Not readonly, and not a constructor parameter — `Array` subclasses are re-instantiated by
4997
+ * `map`/`filter`/`slice` with a length argument, so a constructor with a different signature
4998
+ * breaks those. The sink is attached after construction instead.
4999
+ */
5000
+ #sink;
5001
+ /** Attach the live subscriber. One sink: the run that owns this loop. */
5002
+ subscribe(sink) {
5003
+ this.#sink = sink;
5004
+ }
5005
+ push(...events) {
5006
+ const length = super.push(...events);
5007
+ for (const event of events) {
5008
+ try {
5009
+ this.#sink?.(event);
5010
+ } catch {
5011
+ }
5012
+ }
5013
+ return length;
5014
+ }
5015
+ };
5016
+ function createEventLog(seed) {
5017
+ const log = new LiveEventLog();
5018
+ log.push(...seed);
5019
+ return log;
5020
+ }
5021
+
4992
5022
  // src/internal/agent-loop/message-builders.ts
4993
5023
  function buildSystemEvent(inputs, toolNames) {
4994
5024
  return {
@@ -5016,7 +5046,7 @@ function buildAssistantEvent(inputs, text) {
5016
5046
  message: { role: "assistant", content: [{ type: "text", text }] }
5017
5047
  };
5018
5048
  }
5019
- function buildThinkingEvent(inputs, text, thinkingDurationMs) {
5049
+ function buildThinkingEvent(inputs, text, thinkingDurationMs, signature) {
5020
5050
  const event = {
5021
5051
  type: "thinking",
5022
5052
  agent_id: inputs.agentId,
@@ -5026,44 +5056,17 @@ function buildThinkingEvent(inputs, text, thinkingDurationMs) {
5026
5056
  if (thinkingDurationMs !== void 0 && thinkingDurationMs >= 0) {
5027
5057
  event.thinking_duration_ms = thinkingDurationMs;
5028
5058
  }
5059
+ if (signature !== void 0) event.signature = signature;
5029
5060
  return event;
5030
5061
  }
5031
- function buildAssistantTurn(text, toolCalls) {
5062
+ function buildAssistantTurn(text, toolCalls, thinking) {
5032
5063
  const content = [];
5064
+ if (thinking !== void 0) content.push(thinking);
5033
5065
  if (text.length > 0) content.push({ type: "text", text });
5034
5066
  for (const call of toolCalls) content.push(call);
5035
5067
  return { role: "assistant", content };
5036
5068
  }
5037
5069
 
5038
- // src/internal/agent-loop/live-events.ts
5039
- var LiveEventLog = class extends Array {
5040
- /**
5041
- * Not readonly, and not a constructor parameter — `Array` subclasses are re-instantiated by
5042
- * `map`/`filter`/`slice` with a length argument, so a constructor with a different signature
5043
- * breaks those. The sink is attached after construction instead.
5044
- */
5045
- #sink;
5046
- /** Attach the live subscriber. One sink: the run that owns this loop. */
5047
- subscribe(sink) {
5048
- this.#sink = sink;
5049
- }
5050
- push(...events) {
5051
- const length = super.push(...events);
5052
- for (const event of events) {
5053
- try {
5054
- this.#sink?.(event);
5055
- } catch {
5056
- }
5057
- }
5058
- return length;
5059
- }
5060
- };
5061
- function createEventLog(seed) {
5062
- const log = new LiveEventLog();
5063
- log.push(...seed);
5064
- return log;
5065
- }
5066
-
5067
5070
  // src/internal/agent-loop/loop-context-init.ts
5068
5071
  function buildUserContent(text, images) {
5069
5072
  const content = [{ type: "text", text }];
@@ -5313,6 +5316,7 @@ async function streamLlmTurn(inputs, ctx) {
5313
5316
  emitLlmMetrics(inputs, result, startAt);
5314
5317
  llmSpan?.end();
5315
5318
  const stripped = stripThinkBlocks(collected.accumulatedText);
5319
+ const thinking = result.thinking ?? collected.thinking;
5316
5320
  return {
5317
5321
  text: stripped.visible,
5318
5322
  toolCalls: result.toolCalls,
@@ -5322,18 +5326,21 @@ async function streamLlmTurn(inputs, ctx) {
5322
5326
  outputTokens: result.outputTokens,
5323
5327
  cacheReadTokens: result.cacheReadTokens,
5324
5328
  cacheWriteTokens: result.cacheWriteTokens,
5325
- reasoningTokens: result.reasoningTokens
5329
+ reasoningTokens: result.reasoningTokens,
5330
+ ...thinking !== void 0 ? { thinking } : {}
5326
5331
  };
5327
5332
  }
5328
5333
  async function collectLlmEvents(generator, inputs, ctx) {
5329
5334
  let accumulatedText = "";
5330
5335
  let errored = false;
5331
5336
  let finishValue;
5337
+ let thinking;
5332
5338
  try {
5333
5339
  const result = await runCollectorLoop(generator, inputs, ctx);
5334
5340
  accumulatedText = result.accumulatedText;
5335
5341
  errored = result.errored;
5336
5342
  finishValue = result.finishValue;
5343
+ thinking = result.thinking;
5337
5344
  } catch (cause) {
5338
5345
  if (inputs.signal?.aborted === true) {
5339
5346
  ctx.finalText = "[aborted]";
@@ -5344,7 +5351,12 @@ async function collectLlmEvents(generator, inputs, ctx) {
5344
5351
  }
5345
5352
  errored = true;
5346
5353
  }
5347
- return { accumulatedText, errored, finishValue };
5354
+ return {
5355
+ accumulatedText,
5356
+ errored,
5357
+ finishValue,
5358
+ ...thinking !== void 0 ? { thinking } : {}
5359
+ };
5348
5360
  }
5349
5361
  function registerLoopError(ctx, cause) {
5350
5362
  if (ctx.error !== void 0) return;
@@ -5355,11 +5367,26 @@ function registerLoopError(ctx, cause) {
5355
5367
  const code = typeof metaCode === "string" ? metaCode : typeof rawCode === "string" ? rawCode : void 0;
5356
5368
  ctx.error = code !== void 0 ? { message, code, cause } : { message, cause };
5357
5369
  }
5370
+ async function consumeStreamEvent(inputs, reasoning, event) {
5371
+ if (event.type === "text_delta") {
5372
+ const text = event.text ?? "";
5373
+ await emitTextDeltaCallback(inputs, text);
5374
+ return text;
5375
+ }
5376
+ if (event.type === "reasoning_delta") {
5377
+ await consumeReasoningDelta(inputs, reasoning, {
5378
+ text: event.text ?? "",
5379
+ ...event.signature !== void 0 ? { signature: event.signature } : {}
5380
+ });
5381
+ }
5382
+ return "";
5383
+ }
5358
5384
  async function runCollectorLoop(generator, inputs, ctx) {
5359
5385
  let accumulatedText = "";
5360
- const reasoning = { text: "", startedAt: void 0 };
5386
+ const reasoning = { text: "", startedAt: void 0, signature: void 0 };
5361
5387
  let errored = false;
5362
5388
  let finishValue;
5389
+ let thinking;
5363
5390
  try {
5364
5391
  while (true) {
5365
5392
  const next = await generator.next();
@@ -5367,24 +5394,22 @@ async function runCollectorLoop(generator, inputs, ctx) {
5367
5394
  finishValue = next;
5368
5395
  break;
5369
5396
  }
5370
- if (next.value.type === "text_delta") {
5371
- accumulatedText += next.value.text;
5372
- await emitTextDeltaCallback(inputs, next.value.text);
5373
- }
5374
- if (next.value.type === "reasoning_delta") {
5375
- await accumulateReasoning(inputs, reasoning, next.value.text);
5376
- }
5377
5397
  if (next.value.type === "error") {
5378
5398
  registerLoopError(ctx, next.value);
5379
5399
  ctx.finalText = "";
5380
5400
  errored = true;
5381
5401
  break;
5382
5402
  }
5403
+ accumulatedText += await consumeStreamEvent(inputs, reasoning, next.value);
5383
5404
  }
5384
5405
  } finally {
5385
- await finalizeReasoning(inputs, ctx, reasoning);
5406
+ thinking = await finalizeReasoning(inputs, ctx, reasoning);
5386
5407
  }
5387
- return { accumulatedText, errored, finishValue };
5408
+ return { accumulatedText, errored, finishValue, ...thinking !== void 0 ? { thinking } : {} };
5409
+ }
5410
+ async function consumeReasoningDelta(inputs, reasoning, delta) {
5411
+ if (delta.signature !== void 0) reasoning.signature = delta.signature;
5412
+ await accumulateReasoning(inputs, reasoning, delta.text);
5388
5413
  }
5389
5414
  async function accumulateReasoning(inputs, reasoning, text) {
5390
5415
  if (reasoning.startedAt === void 0) reasoning.startedAt = Date.now();
@@ -5392,10 +5417,17 @@ async function accumulateReasoning(inputs, reasoning, text) {
5392
5417
  await emitReasoningDeltaCallback(inputs, text);
5393
5418
  }
5394
5419
  async function finalizeReasoning(inputs, ctx, reasoning) {
5395
- if (reasoning.text.length === 0) return;
5420
+ if (reasoning.text.length === 0) return void 0;
5396
5421
  const thinkingDurationMs = reasoning.startedAt === void 0 ? 0 : Date.now() - reasoning.startedAt;
5397
- ctx.events.push(buildThinkingEvent(inputs, reasoning.text, thinkingDurationMs));
5422
+ ctx.events.push(
5423
+ buildThinkingEvent(inputs, reasoning.text, thinkingDurationMs, reasoning.signature)
5424
+ );
5398
5425
  await emitThinkingCompletedCallback(inputs, thinkingDurationMs);
5426
+ return {
5427
+ type: "thinking",
5428
+ text: reasoning.text,
5429
+ ...reasoning.signature !== void 0 ? { signature: reasoning.signature } : {}
5430
+ };
5399
5431
  }
5400
5432
  async function emitTextDeltaCallback(inputs, text) {
5401
5433
  if (inputs.onDelta === void 0) return;
@@ -5425,6 +5457,24 @@ async function emitThinkingCompletedCallback(inputs, thinkingDurationMs) {
5425
5457
  );
5426
5458
  }
5427
5459
 
5460
+ // src/internal/agent-loop/loop-thinking-steps.ts
5461
+ function thinkingStep(thinking) {
5462
+ return {
5463
+ type: "thinkingMessage",
5464
+ message: {
5465
+ text: thinking.text,
5466
+ ...thinking.signature !== void 0 ? { signature: thinking.signature } : {}
5467
+ }
5468
+ };
5469
+ }
5470
+ function recordThinkingOnSilentToolRound(ctx, text, thinking) {
5471
+ if (text.length > 0 || thinking === void 0) return;
5472
+ ctx.conversation.push({
5473
+ type: "agentConversationTurn",
5474
+ turn: { steps: [thinkingStep(thinking)] }
5475
+ });
5476
+ }
5477
+
5428
5478
  // src/internal/tool-dispatch/repair-middleware.ts
5429
5479
  var DECIMAL_RE = /^-?\d+(\.\d+)?$/;
5430
5480
  function repairToolCall(raw, registry) {
@@ -6476,12 +6526,13 @@ async function runAgentLoop(inputs) {
6476
6526
  sendSpan?.end();
6477
6527
  }
6478
6528
  }
6479
- async function emitAssistantTextStep(inputs, ctx, text) {
6529
+ async function emitAssistantTextStep(inputs, ctx, text, thinking) {
6480
6530
  ctx.events.push(buildAssistantEvent(inputs, text));
6481
- ctx.conversation.push({
6482
- type: "agentConversationTurn",
6483
- turn: { steps: [{ type: "assistantMessage", message: { text } }] }
6484
- });
6531
+ const steps = [
6532
+ ...thinking !== void 0 ? [thinkingStep(thinking)] : [],
6533
+ { type: "assistantMessage", message: { text } }
6534
+ ];
6535
+ ctx.conversation.push({ type: "agentConversationTurn", turn: { steps } });
6485
6536
  ctx.finalText = text;
6486
6537
  if (inputs.onStep === void 0) return;
6487
6538
  const cb = inputs.onStep;
@@ -6617,13 +6668,15 @@ async function continueOrTerminate(inputs, ctx, llmOutput) {
6617
6668
  if (llmOutput.errored) return "error";
6618
6669
  const tCtx = { agentId: inputs.agentId, runId: inputs.runId };
6619
6670
  const text = llmOutput.text.length > 0 ? await transformLlmOutputText(inputs, llmOutput.text, tCtx) : llmOutput.text;
6671
+ const thinking = llmOutput.thinking;
6620
6672
  if (text.length > 0) {
6621
- await emitAssistantTextStep(inputs, ctx, text);
6673
+ await emitAssistantTextStep(inputs, ctx, text, thinking);
6622
6674
  }
6623
6675
  if (llmOutput.stopReason !== "tool_use" || llmOutput.toolCalls.length === 0) {
6624
6676
  return finishOrReflect(inputs, ctx, llmOutput);
6625
6677
  }
6626
- ctx.messages.push(buildAssistantTurn(text, llmOutput.toolCalls));
6678
+ recordThinkingOnSilentToolRound(ctx, text, thinking);
6679
+ ctx.messages.push(buildAssistantTurn(text, llmOutput.toolCalls, thinking));
6627
6680
  const rawResults = await dispatchTools(
6628
6681
  // SE12 — forward a read-only text projection of the transcript-so-far to tool
6629
6682
  // handlers via `ctx.messages` (consumed by defineSubAgent's messageFilter).
@@ -6659,7 +6712,9 @@ async function inspectDoomLoop(inputs, ctx, toolCalls) {
6659
6712
  await emitAssistantTextStep(
6660
6713
  inputs,
6661
6714
  ctx,
6662
- verdict.message ?? "Stopped: repeated identical tool calls made no progress."
6715
+ verdict.message ?? "Stopped: repeated identical tool calls made no progress.",
6716
+ // The doom-loop stop message is the SDK's own text, not a model turn — it has no thinking.
6717
+ void 0
6663
6718
  );
6664
6719
  return "stop";
6665
6720
  }
@@ -6806,7 +6861,20 @@ var StdioMcpClient = class extends BaseMcpClient {
6806
6861
  );
6807
6862
  });
6808
6863
  }
6864
+ /**
6865
+ * theokit#155 — idempotent while the child is LIVE.
6866
+ *
6867
+ * Under `mcpLifecycle: 'session'` the pool hands the same client back on the next turn, and
6868
+ * `initializeMcp` runs every turn. An unconditional `spawnChild()` would overwrite `this.child`,
6869
+ * orphaning a healthy process (its `exit` handler is skipped by the `this.child === child` guard)
6870
+ * and paying the ~146 ms spawn + handshake the option exists to avoid.
6871
+ *
6872
+ * This does NOT touch the #59 reconnect path: `reconnect()` calls `spawnChild()` and
6873
+ * `super.initialize()` directly, so it re-spawns exactly as before. After `close()` — or after a
6874
+ * drop, which clears `child` — this method spawns again, as it must.
6875
+ */
6809
6876
  async initialize() {
6877
+ if (this.child !== void 0) return;
6810
6878
  this.spawnChild();
6811
6879
  await super.initialize();
6812
6880
  }
@@ -7177,16 +7245,15 @@ function declarativeSubagentTools(agents2, parentTools) {
7177
7245
  if (agents2 === void 0 || Object.keys(agents2).length === 0) return [];
7178
7246
  return subAgentToolsFromDefinitions(agents2, parentTools);
7179
7247
  }
7180
- function bindParentCredentials(tools, agentOptions) {
7248
+ function resolveInheritedCredentials(agentOptions) {
7181
7249
  const parentPlugins = Array.isArray(agentOptions.plugins) ? agentOptions.plugins : void 0;
7182
7250
  const parentSandbox = agentOptions.local?.sandboxOptions?.enabled;
7183
- const credentials = {
7251
+ return {
7184
7252
  ...agentOptions.apiKey !== void 0 ? { apiKey: agentOptions.apiKey } : {},
7185
7253
  ...typeof agentOptions.model === "object" ? { model: agentOptions.model } : {},
7186
7254
  ...parentPlugins !== void 0 ? { plugins: parentPlugins } : {},
7187
7255
  ...parentSandbox !== void 0 ? { sandbox: parentSandbox } : {}
7188
7256
  };
7189
- for (const tool of tools) inheritSubAgentCredentials(tool, credentials);
7190
7257
  }
7191
7258
  function buildCustomToolsInput(agentOptions, sendOptions, pluginManager, personalityToolWhitelist, agentId, personalityName, subagents, effectiveModel) {
7192
7259
  const baseTools = sendOptions?.tools ?? agentOptions.tools ?? [];
@@ -7198,7 +7265,6 @@ function buildCustomToolsInput(agentOptions, sendOptions, pluginManager, persona
7198
7265
  return {};
7199
7266
  }
7200
7267
  const allTools = [...baseTools, ...subagentTools, ...pluginTools, ...reasoningTools];
7201
- bindParentCredentials(allTools, agentOptions);
7202
7268
  const merged = allTools.map((tool) => ({
7203
7269
  name: tool.name,
7204
7270
  description: tool.description,
@@ -7234,7 +7300,9 @@ function createRealLocalRun(options) {
7234
7300
  supportedOps: supported,
7235
7301
  startTime
7236
7302
  },
7237
- () => buildLoopInputs(options, id, userText, userImages)
7303
+ () => buildLoopInputs(options, id, userText, userImages),
7304
+ runOwnsMcpClients(options.agentOptions),
7305
+ resolveInheritedCredentials(options.agentOptions)
7238
7306
  );
7239
7307
  handle.bootstrap();
7240
7308
  registerRun(handle);
@@ -7373,11 +7441,14 @@ function disposeSessionMcpClients(agentId) {
7373
7441
  void client.close();
7374
7442
  });
7375
7443
  }
7444
+ function runOwnsMcpClients(agentOptions) {
7445
+ return agentOptions.mcpLifecycle !== "session";
7446
+ }
7376
7447
  function buildMcpMap(options) {
7377
7448
  const map = /* @__PURE__ */ new Map();
7378
7449
  const inline = options.sendOptions.mcpServers ?? options.agentOptions.mcpServers;
7379
7450
  if (inline === void 0) return map;
7380
- const pooled = options.agentOptions.mcpLifecycle === "session";
7451
+ const pooled = !runOwnsMcpClients(options.agentOptions);
7381
7452
  if (pooled) sessionMcpPool.reapIdle((c) => void c.close());
7382
7453
  for (const [name, config] of Object.entries(inline)) {
7383
7454
  map.set(
@@ -7389,9 +7460,15 @@ function buildMcpMap(options) {
7389
7460
  }
7390
7461
  var RealLocalRun = class extends FixtureRunBase {
7391
7462
  buildInputs;
7392
- constructor(options, buildInputs) {
7463
+ /** theokit#155 — whether this turn releases its MCP clients, or the session pool does. */
7464
+ ownsMcpClients;
7465
+ /** theokit#148 — what a delegated child inherits from this parent, scoped to the loop. */
7466
+ inheritedCredentials;
7467
+ constructor(options, buildInputs, ownsMcpClients, inheritedCredentials) {
7393
7468
  super(options);
7394
7469
  this.buildInputs = buildInputs;
7470
+ this.ownsMcpClients = ownsMcpClients;
7471
+ this.inheritedCredentials = inheritedCredentials;
7395
7472
  }
7396
7473
  bootstrap() {
7397
7474
  setTimeout(() => {
@@ -7452,15 +7529,18 @@ var RealLocalRun = class extends FixtureRunBase {
7452
7529
  this.pushTimeline({ kind: "delta", update: delta.update });
7453
7530
  };
7454
7531
  try {
7455
- const output = inputs.activeTools !== void 0 ? await withToolWhitelist(new Set(inputs.activeTools), () => runAgentLoop(inputs)) : await runAgentLoop(inputs);
7532
+ const runLoop = () => inputs.activeTools !== void 0 ? withToolWhitelist(new Set(inputs.activeTools), () => runAgentLoop(inputs)) : runAgentLoop(inputs);
7533
+ const output = await withInheritedSubAgentCredentials(this.inheritedCredentials, runLoop);
7456
7534
  this.applyAgentLoopOutput(output);
7457
7535
  this.transitionTo(output.finalStatus);
7458
7536
  } catch (cause) {
7459
7537
  this.emitErrorEvent(cause, "Agent loop failed", "", "agent_loop_failed");
7460
7538
  this.transitionTo("error");
7461
7539
  } finally {
7462
- for (const client of inputs.mcp.values()) {
7463
- await client.close().catch(() => void 0);
7540
+ if (this.ownsMcpClients) {
7541
+ for (const client of inputs.mcp.values()) {
7542
+ await client.close().catch(() => void 0);
7543
+ }
7464
7544
  }
7465
7545
  }
7466
7546
  }
@@ -8067,184 +8147,6 @@ function cacheKey(userText, queryMode, ctx) {
8067
8147
  const parts = [queryMode, ctx?.namespace ?? "", ctx?.userId ?? "", ctx?.scope ?? "", userText];
8068
8148
  return createHash("sha256").update(parts.join("\0")).digest("hex");
8069
8149
  }
8070
- var MAX_BATCH = 100;
8071
- var MAX_RETRIES = 2;
8072
- async function createOpenAiCompatibleRuntime(cfg, options) {
8073
- const model = options.model ?? cfg.defaultModel;
8074
- const apiKey = options.apiKey ?? process.env[cfg.apiKeyEnv];
8075
- if (apiKey === void 0 || apiKey.length === 0) {
8076
- throw new AuthenticationError(`${cfg.apiKeyEnv} missing`, {
8077
- code: "embedding_missing_api_key"
8078
- });
8079
- }
8080
- const envBaseUrl = cfg.baseUrlEnv !== void 0 ? process.env[cfg.baseUrlEnv] : void 0;
8081
- const baseUrl = options.baseUrl ?? envBaseUrl ?? cfg.defaultBaseUrl;
8082
- const fetchImpl = options.fetch ?? fetch;
8083
- const cache = options.cache ?? globalEmbeddingCache;
8084
- const dimension = cfg.dimensionByModel[model];
8085
- if (dimension === void 0) {
8086
- throw new ConfigurationError(
8087
- `${cfg.id} adapter: model "${model}" is not in the dimension table. Use one of: ${Object.keys(cfg.dimensionByModel).join(", ")}. To add it, update dimensionByModel in the adapter source.`,
8088
- { code: "embedding_unknown_model" }
8089
- );
8090
- }
8091
- const embeddingsPath = cfg.embeddingsPath ?? "/v1/embeddings";
8092
- const stats = {
8093
- cacheHits: 0,
8094
- cacheMisses: 0,
8095
- httpCalls: 0,
8096
- retries: 0
8097
- };
8098
- return {
8099
- id: cfg.id,
8100
- model,
8101
- dimension,
8102
- stats: () => ({ ...stats }),
8103
- embed: (texts) => embedTexts({
8104
- texts,
8105
- cache,
8106
- stats,
8107
- model,
8108
- dimension,
8109
- apiKey,
8110
- baseUrl,
8111
- embeddingsPath,
8112
- fetchImpl,
8113
- providerId: cfg.id
8114
- })
8115
- };
8116
- }
8117
- async function embedTexts(input) {
8118
- const { texts, cache, stats, model, dimension } = input;
8119
- const results = new Array(texts.length);
8120
- const pending = [];
8121
- for (let i = 0; i < texts.length; i++) {
8122
- classifyEntry({
8123
- index: i,
8124
- text: texts[i] ?? "",
8125
- model,
8126
- dimension,
8127
- cache,
8128
- stats,
8129
- results,
8130
- pending
8131
- });
8132
- }
8133
- await embedInBoundedBatches(input, pending, results);
8134
- return results.map((v) => v ?? new Array(dimension).fill(0));
8135
- }
8136
- function classifyEntry(args) {
8137
- if (args.text.trim().length === 0) {
8138
- args.results[args.index] = new Array(args.dimension).fill(0);
8139
- return;
8140
- }
8141
- const key = hashKey(args.model, args.text);
8142
- const cached = args.cache.get(key);
8143
- if (cached !== void 0) {
8144
- args.stats.cacheHits += 1;
8145
- args.results[args.index] = cached;
8146
- return;
8147
- }
8148
- args.stats.cacheMisses += 1;
8149
- args.pending.push({ index: args.index, text: args.text, key });
8150
- }
8151
- var MAX_CONCURRENT_BATCHES = 3;
8152
- async function embedInBoundedBatches(input, pending, results) {
8153
- const batches = [];
8154
- for (let offset = 0; offset < pending.length; offset += MAX_BATCH) {
8155
- batches.push(pending.slice(offset, offset + MAX_BATCH));
8156
- }
8157
- await mapWithConcurrency(
8158
- batches,
8159
- MAX_CONCURRENT_BATCHES,
8160
- (batch) => processBatch(input, batch, results)
8161
- );
8162
- }
8163
- async function processBatch(input, batch, results) {
8164
- const vectors = await embedBatch({
8165
- apiKey: input.apiKey,
8166
- baseUrl: input.baseUrl,
8167
- embeddingsPath: input.embeddingsPath,
8168
- model: input.model,
8169
- inputs: batch.map((b) => b.text),
8170
- fetchImpl: input.fetchImpl,
8171
- stats: input.stats,
8172
- providerId: input.providerId
8173
- });
8174
- for (let j = 0; j < batch.length; j++) {
8175
- const slot = batch[j];
8176
- const vector = vectors[j];
8177
- if (slot === void 0 || vector === void 0) continue;
8178
- results[slot.index] = vector;
8179
- input.cache.set(slot.key, vector);
8180
- }
8181
- }
8182
- async function embedBatch(opts) {
8183
- const url = `${opts.baseUrl.replace(/\/$/, "")}${opts.embeddingsPath}`;
8184
- let attempt = 0;
8185
- while (true) {
8186
- opts.stats.httpCalls += 1;
8187
- const response = await postEmbedRequest(opts, url);
8188
- if (response.ok)
8189
- return await parseEmbedResponse(response, opts.providerId, opts.embeddingsPath);
8190
- if (isRetryable(response.status) && attempt < MAX_RETRIES) {
8191
- attempt += 1;
8192
- opts.stats.retries += 1;
8193
- await sleep(linearBackoffMs(attempt));
8194
- continue;
8195
- }
8196
- const text = await response.text().catch(() => "");
8197
- let body = text;
8198
- try {
8199
- body = JSON.parse(text);
8200
- } catch {
8201
- }
8202
- throw mapOpenAICompatibleError({
8203
- providerId: opts.providerId,
8204
- status: response.status,
8205
- body,
8206
- headers: response.headers,
8207
- endpoint: opts.embeddingsPath
8208
- });
8209
- }
8210
- }
8211
- async function postEmbedRequest(opts, url) {
8212
- return opts.fetchImpl(url, {
8213
- method: "POST",
8214
- headers: {
8215
- "content-type": "application/json",
8216
- authorization: `Bearer ${opts.apiKey}`
8217
- },
8218
- body: JSON.stringify({ model: opts.model, input: opts.inputs })
8219
- });
8220
- }
8221
- async function parseEmbedResponse(response, providerId, endpoint) {
8222
- const json = await response.json();
8223
- if (!Array.isArray(json.data)) {
8224
- throw new NetworkError(`${providerId} ${endpoint} returned no data`, {
8225
- code: "embedding_invalid_response",
8226
- metadata: {
8227
- provider: providerId,
8228
- endpoint,
8229
- code: "invalid_request",
8230
- raw: json
8231
- }
8232
- });
8233
- }
8234
- return json.data.map((d) => d.embedding);
8235
- }
8236
- function isRetryable(status) {
8237
- return status === 429 || status >= 500 && status < 600;
8238
- }
8239
- function hashKey(model, text) {
8240
- return createHash("sha256").update(`${model} ${text}`).digest("hex");
8241
- }
8242
- function linearBackoffMs(attempt) {
8243
- return 50 * attempt;
8244
- }
8245
- function sleep(ms) {
8246
- return new Promise((resolve) => setTimeout(resolve, ms));
8247
- }
8248
8150
 
8249
8151
  // src/internal/memory/adapters/azure-openai-embedding.ts
8250
8152
  var DEFAULT_AZURE_OPENAI_EMBEDDING_MODEL = "text-embedding-3-small";
@@ -8267,7 +8169,15 @@ var azureOpenAiMemoryEmbeddingProviderAdapter = {
8267
8169
  baseUrlEnv: "AZURE_OPENAI_ENDPOINT",
8268
8170
  defaultModel: DEFAULT_AZURE_OPENAI_EMBEDDING_MODEL,
8269
8171
  embeddingsPath: "/openai/deployments/{model}/embeddings?api-version=2024-02-01",
8270
- dimensionByModel: DIMENSION_BY_MODEL
8172
+ dimensionByModel: DIMENSION_BY_MODEL,
8173
+ // theokit#159 — Azure is NOT OpenAI on the wire, despite the name. It authenticates an API
8174
+ // key with the `api-key` header (`Authorization: Bearer` is for Entra ID tokens, not for
8175
+ // AZURE_OPENAI_API_KEY), and the deployment already rides in the path, so `model` has no
8176
+ // place in the body. Sending the OpenAI shape meant every request was rejected.
8177
+ dialect: {
8178
+ authHeaders: (apiKey) => ({ "api-key": apiKey }),
8179
+ body: (_model, inputs) => ({ input: inputs })
8180
+ }
8271
8181
  },
8272
8182
  options
8273
8183
  )
@@ -8294,7 +8204,20 @@ var cohereMemoryEmbeddingProviderAdapter = {
8294
8204
  apiKeyEnv: "COHERE_API_KEY",
8295
8205
  defaultModel: DEFAULT_COHERE_EMBEDDING_MODEL,
8296
8206
  embeddingsPath: "/v2/embed",
8297
- dimensionByModel: DIMENSION_BY_MODEL2
8207
+ dimensionByModel: DIMENSION_BY_MODEL2,
8208
+ // theokit#159 — `/v2/embed` diverges in BOTH directions: it names the payload `texts`, requires
8209
+ // `input_type`, and answers `{embeddings:{float:[[...]]}}` rather than `{data:[{embedding}]}`.
8210
+ // `search_document` is the right default here because this runtime embeds material for
8211
+ // storage; a query-side embedder would use `search_query`.
8212
+ dialect: {
8213
+ body: (model, inputs) => ({
8214
+ model,
8215
+ texts: [...inputs],
8216
+ input_type: "search_document",
8217
+ embedding_types: ["float"]
8218
+ }),
8219
+ vectors: (json) => json.embeddings?.float
8220
+ }
8298
8221
  },
8299
8222
  options
8300
8223
  )
@@ -8352,6 +8275,9 @@ var geminiMemoryEmbeddingProviderAdapter = {
8352
8275
  defaultBaseUrl: "https://generativelanguage.googleapis.com",
8353
8276
  apiKeyEnv: "GEMINI_API_KEY",
8354
8277
  defaultModel: DEFAULT_GEMINI_EMBEDDING_MODEL,
8278
+ // theokit#159 — the compat surface is under `/v1beta/openai/`, not the default
8279
+ // `/v1/embeddings`; the previous path 404'd on every call.
8280
+ embeddingsPath: "/v1beta/openai/embeddings",
8355
8281
  dimensionByModel: DIMENSION_BY_MODEL4
8356
8282
  },
8357
8283
  options
@@ -9164,7 +9090,7 @@ function localAgentRunUntil(agent, goal, options) {
9164
9090
  async function* wrap() {
9165
9091
  const { runUntilImpl } = await import('./run-until-BK56WG4P.js');
9166
9092
  const buildDeps = async () => {
9167
- const { judgeCallImpl } = await import('./judge-call-3S3T6O2Z.js');
9093
+ const { judgeCallImpl } = await import('./judge-call-NA2G6ZMJ.js');
9168
9094
  const { getAgentFacade } = await import('./agent-factory-registry-ZVTABLEY.js');
9169
9095
  const create = getAgentFacade().create;
9170
9096
  return {
@@ -9197,7 +9123,7 @@ async function* localAgentStreamToCompletion(agent, message, options) {
9197
9123
  async function localAgentFork(parent, options) {
9198
9124
  const { forkAgentImpl } = await import('./fork-agent-RSV4E3EA.js');
9199
9125
  const { getAgentFacade } = await import('./agent-factory-registry-ZVTABLEY.js');
9200
- const { withPersonalityContext } = await import('./context-ZDBBPIHY.js');
9126
+ const { withPersonalityContext } = await import('./context-ATJJAFOS.js');
9201
9127
  const create = getAgentFacade().create;
9202
9128
  return withPersonalityContext(
9203
9129
  { slug: parent.personalitySlugSnapshot, isFork: true },
@@ -9578,7 +9504,7 @@ async function executeSendLocked(inputs, message, options) {
9578
9504
  function buildCompletionCheckDeps() {
9579
9505
  return {
9580
9506
  judge: async (ctx, opts) => {
9581
- const { judgeCallImpl } = await import('./judge-call-3S3T6O2Z.js');
9507
+ const { judgeCallImpl } = await import('./judge-call-NA2G6ZMJ.js');
9582
9508
  const { getAgentFacade } = await import('./agent-factory-registry-ZVTABLEY.js');
9583
9509
  return judgeCallImpl(ctx, opts, { create: getAgentFacade().create });
9584
9510
  }
@@ -10336,7 +10262,7 @@ var Agent = class _Agent {
10336
10262
  * @public
10337
10263
  */
10338
10264
  static async generateObject(options) {
10339
- const { generateObjectImpl } = await import('./generate-object-LPSO6GVW.js');
10265
+ const { generateObjectImpl } = await import('./generate-object-XDCBYVK3.js');
10340
10266
  return generateObjectImpl(options, {
10341
10267
  create: (opts) => _Agent.create(opts),
10342
10268
  delete: (agentId) => _Agent.delete(agentId)
@@ -10360,7 +10286,7 @@ var Agent = class _Agent {
10360
10286
  delete: (agentId) => _Agent.delete(agentId)
10361
10287
  };
10362
10288
  async function* wrapper() {
10363
- streamObjectImport ??= import('./stream-object-AFERZU63.js');
10289
+ streamObjectImport ??= import('./stream-object-HWDEEQN4.js');
10364
10290
  const { streamObjectImpl } = await streamObjectImport;
10365
10291
  yield* streamObjectImpl(options, deps);
10366
10292
  }
@@ -10384,7 +10310,7 @@ var Agent = class _Agent {
10384
10310
  * @public
10385
10311
  */
10386
10312
  static async batch(prompts, options) {
10387
- const { batchImpl } = await import('./batch-LXSALQC3.js');
10313
+ const { batchImpl } = await import('./batch-6KQM3EBA.js');
10388
10314
  return batchImpl(prompts, options, { create: (opts) => _Agent.create(opts) });
10389
10315
  }
10390
10316
  /**
@@ -10522,7 +10448,7 @@ var Agent = class _Agent {
10522
10448
  `No local agent "${agentId}" registered \u2014 compact targets local sessions.`
10523
10449
  );
10524
10450
  }
10525
- const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-RR3ILTES.js');
10451
+ const { compactSessionTranscript, buildDefaultSummarizer: buildDefaultSummarizer2 } = await import('./compact-session-PYEC3NZV.js');
10526
10452
  const { cwd, model, store } = await openLocalStore(reg);
10527
10453
  return enqueueSessionWrite(
10528
10454
  cwd,
@@ -10558,7 +10484,7 @@ var Agent = class _Agent {
10558
10484
  `No local agent "${agentId}" registered \u2014 injectSessionTurn targets local sessions.`
10559
10485
  );
10560
10486
  }
10561
- const { injectSessionTurn } = await import('./inject-session-RKNLUE72.js');
10487
+ const { injectSessionTurn } = await import('./inject-session-GQMTDZUN.js');
10562
10488
  const { cwd, model, store } = await openLocalStore(reg);
10563
10489
  await injectSessionTurn({
10564
10490
  store,
@@ -10568,6 +10494,86 @@ var Agent = class _Agent {
10568
10494
  assistantText: turn.assistantText
10569
10495
  });
10570
10496
  }
10497
+ /**
10498
+ * theokit#146 — read a LOCAL agent's persisted transcript as STRUCTURE, for rendering.
10499
+ *
10500
+ * A resumed session already replays correctly to the model, but a host had no way to draw it:
10501
+ * the only projection available folded a tool call to the string `[tool call] NAME`, dropping the
10502
+ * call id and every argument. A card UI got prose, so cross-restart resume was worth less than
10503
+ * starting fresh — which is what at least one consumer did.
10504
+ *
10505
+ * Each returned message carries both projections: `text` (unchanged, what the model replay uses)
10506
+ * and `parts` (`text` / `tool_use` / `tool_result` with ids, names, arguments and the
10507
+ * `toolUseId` that correlates a result back to its call).
10508
+ *
10509
+ * Read-only and local-only: it opens the agent's session store and walks the transcript, exactly
10510
+ * as {@link Agent.compact} and {@link Agent.injectSessionTurn} do. It appends nothing.
10511
+ *
10512
+ * @throws UnknownAgentError when `agentId` names no local agent.
10513
+ * @public
10514
+ */
10515
+ static async transcript(agentId) {
10516
+ let reg = getRegisteredAgent(agentId);
10517
+ if (reg === void 0) {
10518
+ await hydrateRegistryFromDisk(process.cwd());
10519
+ reg = getRegisteredAgent(agentId);
10520
+ }
10521
+ if (reg === void 0 || reg.runtime !== "local") {
10522
+ throw new UnknownAgentError(
10523
+ `No local agent "${agentId}" registered \u2014 transcript targets local sessions.`
10524
+ );
10525
+ }
10526
+ const { readSessionMessages } = await import('./agent-session-store-RHMHP5DG.js');
10527
+ const { store } = await openLocalStore(reg);
10528
+ return readSessionMessages(store, agentId);
10529
+ }
10530
+ /**
10531
+ * theokit#123 — read-only introspection of a registered agent's tools and subagents.
10532
+ *
10533
+ * `Agent.list()` / `Agent.get()` enumerate agents and `agent.skills.list()` covers skills, but
10534
+ * tools and subagents lived only on `RegisteredAgent.options` — an internal contract. A
10535
+ * reflection endpoint (theokit-studio's `theokit dev`) therefore had to report empty lists for
10536
+ * both, and say so with an `unavailable_reason`.
10537
+ *
10538
+ * A PROJECTION, not the options object. Tool handlers and subagent prompts are stripped: a
10539
+ * handler is an executable that cannot cross a process boundary, and a prompt is the agent's
10540
+ * instructions rather than its signature — a reflection endpoint serializes what it is handed.
10541
+ *
10542
+ * @throws UnknownAgentError when `agentId` names no registered agent.
10543
+ * @public
10544
+ */
10545
+ static async describe(agentId) {
10546
+ const agent = await getRegisteredAgentOrThrow(agentId);
10547
+ const { loadSubagents: loadSubagents2 } = await import('./subagents-loader-X33KH2SZ.js');
10548
+ const settingSources = agent.options.local?.settingSources;
10549
+ const subagents = await loadSubagents2(
10550
+ agent.cwd ?? process.cwd(),
10551
+ settingSources === void 0 || settingSources.includes("project"),
10552
+ agent.options.agents
10553
+ );
10554
+ return {
10555
+ agentId: agent.agentId,
10556
+ runtime: agent.runtime,
10557
+ ...agent.model !== void 0 ? { model: agent.model } : {},
10558
+ // Always arrays, so a caller can tell "this agent has none" from "the SDK did not say".
10559
+ //
10560
+ // Honest limit, stated because the alternative is an implied claim: `tools` is still the
10561
+ // DECLARED catalog. Plugin tools and the reasoning `think` tool are assembled per run by
10562
+ // `buildCustomToolsInput`, so they are not knowable from the registry alone. Documented on
10563
+ // `AgentDescription.tools`.
10564
+ tools: (agent.options.tools ?? []).map((tool) => ({
10565
+ name: tool.name,
10566
+ description: tool.description,
10567
+ inputSchema: tool.inputSchema
10568
+ })),
10569
+ subagents: Object.entries(subagents).map(([name, def]) => ({
10570
+ name,
10571
+ description: def.description,
10572
+ ...def.model !== void 0 ? { model: def.model } : {},
10573
+ ...def.tools !== void 0 ? { tools: def.tools } : {}
10574
+ }))
10575
+ };
10576
+ }
10571
10577
  /**
10572
10578
  * Permanently delete a cloud agent.
10573
10579
  *
@@ -10605,12 +10611,12 @@ async function openLocalStore(reg) {
10605
10611
  const cwd = reg.cwd ?? process.cwd();
10606
10612
  const optModel = reg.options.model;
10607
10613
  const model = reg.model?.id ?? (typeof optModel === "string" ? optModel : optModel?.id) ?? "unknown";
10608
- const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-K5QUPNJZ.js');
10609
- const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-MMPWCESR.js');
10614
+ const { FsSessionStore: FsSessionStore2 } = await import('./fs-session-store-O6FNHECD.js');
10615
+ const { defaultBaseDir: defaultBaseDir2, expandTilde: expandTilde2 } = await import('./session-transcript-3B52DKTG.js');
10610
10616
  const baseDir = reg.options.local?.baseDir !== void 0 ? expandTilde2(reg.options.local.baseDir) : defaultBaseDir2();
10611
10617
  return { cwd, model, store: new FsSessionStore2({ baseDir, cwd }) };
10612
10618
  }
10613
10619
 
10614
10620
  export { Agent, AgentBuilder, DEFAULT_AGENTIC_MODEL_ID, MEMORY_EMBEDDING_ADAPTERS, Tool, ToolError, UsageAccumulator, computeCost, generateCronId, getPricingEntry, openRouterMemoryEmbeddingProviderAdapter, resolveApiKey };
10615
- //# sourceMappingURL=chunk-VUDH4D2M.js.map
10616
- //# sourceMappingURL=chunk-VUDH4D2M.js.map
10621
+ //# sourceMappingURL=chunk-GIRD3RWH.js.map
10622
+ //# sourceMappingURL=chunk-GIRD3RWH.js.map