@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.
- package/CHANGELOG.md +309 -72
- package/dist/a2a/index.cjs +3 -3
- package/dist/a2a/index.js +1 -1
- package/dist/a2a/subagent.d.cts +1 -0
- package/dist/a2a/subagent.d.ts +1 -0
- package/dist/{agent-SmxntivO.d.ts → agent-D7bRK9Kg.d.cts} +108 -41
- package/dist/agent-I3EZZR6S.cjs +55 -0
- package/dist/{agent-IE6IE4NW.cjs.map → agent-I3EZZR6S.cjs.map} +1 -1
- package/dist/agent-KKZYLY5D.js +46 -0
- package/dist/{agent-DW2J37IH.js.map → agent-KKZYLY5D.js.map} +1 -1
- package/dist/{agent-DGv1-d81.d.cts → agent-ZCZa7YQv.d.ts} +108 -41
- package/dist/agent-session-store-N4TVKHBU.cjs +23 -0
- package/dist/agent-session-store-N4TVKHBU.cjs.map +1 -0
- package/dist/agent-session-store-RHMHP5DG.js +6 -0
- package/dist/agent-session-store-RHMHP5DG.js.map +1 -0
- package/dist/agent.d.ts +38 -2
- package/dist/auth/index.cjs +15 -15
- package/dist/auth/index.js +4 -4
- package/dist/{batch-SY5GZLFD.js → batch-6KQM3EBA.js} +12 -12
- package/dist/batch-6KQM3EBA.js.map +1 -0
- package/dist/{batch-3SEPDXCU.cjs → batch-X6JKGDPK.cjs} +26 -26
- package/dist/batch-X6JKGDPK.cjs.map +1 -0
- package/dist/chunk-2RW7K6FN.cjs +34 -0
- package/dist/chunk-2RW7K6FN.cjs.map +1 -0
- package/dist/chunk-3I4B3OIX.js +105 -0
- package/dist/chunk-3I4B3OIX.js.map +1 -0
- package/dist/{chunk-2WFB5ZOX.js → chunk-42IFCKQZ.js} +5 -5
- package/dist/{chunk-2WFB5ZOX.js.map → chunk-42IFCKQZ.js.map} +1 -1
- package/dist/{chunk-DCJ5MCJ3.js → chunk-4F7JQZOX.js} +9 -36
- package/dist/chunk-4F7JQZOX.js.map +1 -0
- package/dist/{chunk-JNIWFCKI.js → chunk-4JSZYSGW.js} +3 -3
- package/dist/{chunk-JNIWFCKI.js.map → chunk-4JSZYSGW.js.map} +1 -1
- package/dist/{chunk-EEZ7CFMM.js → chunk-5KOW3GLE.js} +2 -2
- package/dist/chunk-5KOW3GLE.js.map +1 -0
- package/dist/{chunk-6VP3XGEK.js → chunk-65ONFZWM.js} +12 -11
- package/dist/chunk-65ONFZWM.js.map +1 -0
- package/dist/{chunk-CSZRJ4RE.js → chunk-6EEYRFJC.js} +5 -5
- package/dist/{chunk-CSZRJ4RE.js.map → chunk-6EEYRFJC.js.map} +1 -1
- package/dist/{chunk-FAY3QDGC.cjs → chunk-6LGQECT7.cjs} +11 -11
- package/dist/{chunk-FAY3QDGC.cjs.map → chunk-6LGQECT7.cjs.map} +1 -1
- package/dist/{chunk-PAEJPLVN.cjs → chunk-6NEHIHFU.cjs} +4 -4
- package/dist/{chunk-PAEJPLVN.cjs.map → chunk-6NEHIHFU.cjs.map} +1 -1
- package/dist/chunk-6YNYA7GD.cjs +103 -0
- package/dist/chunk-6YNYA7GD.cjs.map +1 -0
- package/dist/chunk-74D7KSBP.cjs +112 -0
- package/dist/chunk-74D7KSBP.cjs.map +1 -0
- package/dist/{chunk-FK4EJD2I.cjs → chunk-75DSEWTJ.cjs} +7 -7
- package/dist/{chunk-FK4EJD2I.cjs.map → chunk-75DSEWTJ.cjs.map} +1 -1
- package/dist/{chunk-SWIBQFPH.cjs → chunk-7OLG7VI4.cjs} +4 -4
- package/dist/{chunk-SWIBQFPH.cjs.map → chunk-7OLG7VI4.cjs.map} +1 -1
- package/dist/chunk-7U2HAAWB.cjs +199 -0
- package/dist/chunk-7U2HAAWB.cjs.map +1 -0
- package/dist/{chunk-YBFDBOUN.cjs → chunk-7YBJZS5P.cjs} +8 -8
- package/dist/{chunk-YBFDBOUN.cjs.map → chunk-7YBJZS5P.cjs.map} +1 -1
- package/dist/{chunk-GLUWH6JO.js → chunk-AECV3G5Z.js} +4 -4
- package/dist/{chunk-GLUWH6JO.js.map → chunk-AECV3G5Z.js.map} +1 -1
- package/dist/{chunk-UQPDFW4E.js → chunk-AR5MQZ3J.js} +3 -3
- package/dist/{chunk-UQPDFW4E.js.map → chunk-AR5MQZ3J.js.map} +1 -1
- package/dist/{chunk-G2F67XUR.cjs → chunk-B4YA6BRS.cjs} +13 -14
- package/dist/chunk-B4YA6BRS.cjs.map +1 -0
- package/dist/{chunk-LTCOPATU.cjs → chunk-BCQ3E2ZG.cjs} +12 -3
- package/dist/chunk-BCQ3E2ZG.cjs.map +1 -0
- package/dist/{chunk-ALU3KC4G.cjs → chunk-BPN5ONSW.cjs} +223 -277
- package/dist/chunk-BPN5ONSW.cjs.map +1 -0
- package/dist/{chunk-YHZXBDAW.js → chunk-BQDUEG4C.js} +16 -16
- package/dist/{chunk-YHZXBDAW.js.map → chunk-BQDUEG4C.js.map} +1 -1
- package/dist/{chunk-IT3PWBW4.cjs → chunk-BURYFNOM.cjs} +2 -2
- package/dist/chunk-BURYFNOM.cjs.map +1 -0
- package/dist/{chunk-BJMKQOY2.cjs → chunk-C7OP3FAK.cjs} +47 -11
- package/dist/chunk-C7OP3FAK.cjs.map +1 -0
- package/dist/{chunk-XAYVHS2B.cjs → chunk-CEIHCKTO.cjs} +4 -4
- package/dist/chunk-CEIHCKTO.cjs.map +1 -0
- package/dist/{chunk-2423XDPT.cjs → chunk-CN6UX5EV.cjs} +28 -56
- package/dist/chunk-CN6UX5EV.cjs.map +1 -0
- package/dist/{chunk-VNNK6AKU.js → chunk-D7IULBF2.js} +3 -3
- package/dist/chunk-D7IULBF2.js.map +1 -0
- package/dist/chunk-DCXRHCZJ.cjs +118 -0
- package/dist/chunk-DCXRHCZJ.cjs.map +1 -0
- package/dist/{chunk-ICYBIC6N.cjs → chunk-DGLLVCNB.cjs} +4 -4
- package/dist/chunk-DGLLVCNB.cjs.map +1 -0
- package/dist/{chunk-I35DI7ES.js → chunk-DKFGUOWL.js} +3 -3
- package/dist/{chunk-I35DI7ES.js.map → chunk-DKFGUOWL.js.map} +1 -1
- package/dist/{chunk-TQI3KRXZ.cjs → chunk-DMTZ3FII.cjs} +18 -18
- package/dist/{chunk-TQI3KRXZ.cjs.map → chunk-DMTZ3FII.cjs.map} +1 -1
- package/dist/{chunk-QFMXXUUT.js → chunk-DU7DE543.js} +3 -3
- package/dist/{chunk-QFMXXUUT.js.map → chunk-DU7DE543.js.map} +1 -1
- package/dist/{chunk-W4QN5CMG.cjs → chunk-DWY25VLP.cjs} +9 -9
- package/dist/{chunk-W4QN5CMG.cjs.map → chunk-DWY25VLP.cjs.map} +1 -1
- package/dist/chunk-E2FFG33C.js +109 -0
- package/dist/chunk-E2FFG33C.js.map +1 -0
- package/dist/{chunk-QUFSDDNU.cjs → chunk-E4IUN3JB.cjs} +15 -15
- package/dist/{chunk-QUFSDDNU.cjs.map → chunk-E4IUN3JB.cjs.map} +1 -1
- package/dist/{chunk-THEYGCYS.cjs → chunk-ECHGWE47.cjs} +4 -4
- package/dist/chunk-ECHGWE47.cjs.map +1 -0
- package/dist/{chunk-U2WLFOA3.cjs → chunk-ECW2MLEW.cjs} +4 -4
- package/dist/{chunk-U2WLFOA3.cjs.map → chunk-ECW2MLEW.cjs.map} +1 -1
- package/dist/{chunk-MXSMAGDU.js → chunk-ET6PHZRX.js} +33 -26
- package/dist/chunk-ET6PHZRX.js.map +1 -0
- package/dist/{chunk-G6AASL5T.cjs → chunk-FRUBE44B.cjs} +24 -24
- package/dist/{chunk-G6AASL5T.cjs.map → chunk-FRUBE44B.cjs.map} +1 -1
- package/dist/{chunk-3ILFUXNE.cjs → chunk-FWBSDQZ7.cjs} +5 -5
- package/dist/{chunk-3ILFUXNE.cjs.map → chunk-FWBSDQZ7.cjs.map} +1 -1
- package/dist/{chunk-7DXLNNKH.cjs → chunk-G2Q3ZC6C.cjs} +4 -4
- package/dist/{chunk-7DXLNNKH.cjs.map → chunk-G2Q3ZC6C.cjs.map} +1 -1
- package/dist/{chunk-56ZM6P7Z.cjs → chunk-G4XUXSRN.cjs} +12 -12
- package/dist/chunk-G4XUXSRN.cjs.map +1 -0
- package/dist/{chunk-VYJSHGAY.js → chunk-GIRD3RWH.js} +422 -295
- package/dist/chunk-GIRD3RWH.js.map +1 -0
- package/dist/{chunk-NQ4AC2U4.cjs → chunk-HIQFVHC6.cjs} +9 -9
- package/dist/{chunk-NQ4AC2U4.cjs.map → chunk-HIQFVHC6.cjs.map} +1 -1
- package/dist/{chunk-EXQV452X.js → chunk-HWNVAUK4.js} +3 -3
- package/dist/{chunk-EXQV452X.js.map → chunk-HWNVAUK4.js.map} +1 -1
- package/dist/{chunk-P34DHHYQ.cjs → chunk-I53ZQHU6.cjs} +34 -27
- package/dist/chunk-I53ZQHU6.cjs.map +1 -0
- package/dist/{chunk-MHCKWQR3.cjs → chunk-IHFNRNTJ.cjs} +8 -8
- package/dist/{chunk-MHCKWQR3.cjs.map → chunk-IHFNRNTJ.cjs.map} +1 -1
- package/dist/{chunk-W52DKZBR.cjs → chunk-INSFS5GT.cjs} +680 -553
- package/dist/chunk-INSFS5GT.cjs.map +1 -0
- package/dist/{chunk-TAPQWDW2.js → chunk-IVSD7L22.js} +12 -4
- package/dist/chunk-IVSD7L22.js.map +1 -0
- package/dist/{chunk-WDGCZDRG.js → chunk-J3UK2GMN.js} +3 -3
- package/dist/{chunk-WDGCZDRG.js.map → chunk-J3UK2GMN.js.map} +1 -1
- package/dist/{chunk-4YB7B3RP.cjs → chunk-J6T5LWJ4.cjs} +15 -14
- package/dist/chunk-J6T5LWJ4.cjs.map +1 -0
- package/dist/{chunk-XAEAMI5H.js → chunk-JRLXEYR4.js} +21 -5
- package/dist/chunk-JRLXEYR4.js.map +1 -0
- package/dist/{chunk-ZJN6NTHE.js → chunk-JZUPMTJY.js} +3 -3
- package/dist/{chunk-ZJN6NTHE.js.map → chunk-JZUPMTJY.js.map} +1 -1
- package/dist/{chunk-M5ZQBOIZ.js → chunk-KE6XKRLQ.js} +3 -3
- package/dist/{chunk-M5ZQBOIZ.js.map → chunk-KE6XKRLQ.js.map} +1 -1
- package/dist/chunk-KGRIHEDT.js +110 -0
- package/dist/chunk-KGRIHEDT.js.map +1 -0
- package/dist/{chunk-T4QWDOG6.js → chunk-KWUNN5J2.js} +5 -5
- package/dist/{chunk-T4QWDOG6.js.map → chunk-KWUNN5J2.js.map} +1 -1
- package/dist/{chunk-56OXYUZE.js → chunk-KX7JV5KM.js} +3 -3
- package/dist/chunk-KX7JV5KM.js.map +1 -0
- package/dist/{chunk-D4ZUJTFB.cjs → chunk-LALG2K33.cjs} +8 -8
- package/dist/{chunk-D4ZUJTFB.cjs.map → chunk-LALG2K33.cjs.map} +1 -1
- package/dist/{chunk-QGDKZDPN.js → chunk-LGILIGV3.js} +3 -3
- package/dist/{chunk-QGDKZDPN.js.map → chunk-LGILIGV3.js.map} +1 -1
- package/dist/{chunk-HEN5WXXI.js → chunk-LJX2SQV2.js} +6 -6
- package/dist/{chunk-HEN5WXXI.js.map → chunk-LJX2SQV2.js.map} +1 -1
- package/dist/{chunk-SDIBMLL5.js → chunk-MC5EINBV.js} +44 -8
- package/dist/chunk-MC5EINBV.js.map +1 -0
- package/dist/{chunk-F6Y4IEQM.js → chunk-ML5A5DOJ.js} +4 -4
- package/dist/{chunk-F6Y4IEQM.js.map → chunk-ML5A5DOJ.js.map} +1 -1
- package/dist/{chunk-6EDQBX7U.cjs → chunk-N475ETD6.cjs} +17 -17
- package/dist/{chunk-6EDQBX7U.cjs.map → chunk-N475ETD6.cjs.map} +1 -1
- package/dist/{chunk-YPQF26X7.cjs → chunk-OBA6YK2R.cjs} +2 -2
- package/dist/chunk-OBA6YK2R.cjs.map +1 -0
- package/dist/chunk-OXNYIMZZ.js +31 -0
- package/dist/chunk-OXNYIMZZ.js.map +1 -0
- package/dist/{chunk-NFCKEBHI.js → chunk-PI4RO4GR.js} +3 -3
- package/dist/{chunk-NFCKEBHI.js.map → chunk-PI4RO4GR.js.map} +1 -1
- package/dist/{chunk-2ONFGMBV.js → chunk-PY2RQOA7.js} +2 -2
- package/dist/chunk-PY2RQOA7.js.map +1 -0
- package/dist/chunk-QKE556YD.js +197 -0
- package/dist/chunk-QKE556YD.js.map +1 -0
- package/dist/{chunk-FV3YEMQ7.js → chunk-RP5HQVLD.js} +13 -14
- package/dist/chunk-RP5HQVLD.js.map +1 -0
- package/dist/chunk-SCFW5MJZ.js +100 -0
- package/dist/chunk-SCFW5MJZ.js.map +1 -0
- package/dist/{chunk-CD73YHEH.js → chunk-SG5ZWT6C.js} +3 -3
- package/dist/{chunk-CD73YHEH.js.map → chunk-SG5ZWT6C.js.map} +1 -1
- package/dist/{chunk-MRODLUGY.cjs → chunk-TIMPJL5V.cjs} +4 -4
- package/dist/{chunk-MRODLUGY.cjs.map → chunk-TIMPJL5V.cjs.map} +1 -1
- package/dist/{chunk-77WHPVXE.js → chunk-TOTP24P6.js} +4 -4
- package/dist/chunk-TOTP24P6.js.map +1 -0
- package/dist/{chunk-3O2ELBST.cjs → chunk-USZTVNUQ.cjs} +5 -5
- package/dist/{chunk-3O2ELBST.cjs.map → chunk-USZTVNUQ.cjs.map} +1 -1
- package/dist/{chunk-YDLNI7J6.js → chunk-V2RBCCN5.js} +3 -3
- package/dist/chunk-V2RBCCN5.js.map +1 -0
- package/dist/{chunk-NNSKJCBM.cjs → chunk-VJYSQXN6.cjs} +10 -10
- package/dist/{chunk-NNSKJCBM.cjs.map → chunk-VJYSQXN6.cjs.map} +1 -1
- package/dist/{chunk-GM7QDQ24.cjs → chunk-W4WKVOOQ.cjs} +11 -11
- package/dist/{chunk-GM7QDQ24.cjs.map → chunk-W4WKVOOQ.cjs.map} +1 -1
- package/dist/chunk-XYOHKCYG.cjs +109 -0
- package/dist/chunk-XYOHKCYG.cjs.map +1 -0
- package/dist/{chunk-ZW345YOI.js → chunk-YP67XZES.js} +4 -4
- package/dist/{chunk-ZW345YOI.js.map → chunk-YP67XZES.js.map} +1 -1
- package/dist/{chunk-YCXMSDSP.js → chunk-YRXY2A5L.js} +4 -4
- package/dist/{chunk-YCXMSDSP.js.map → chunk-YRXY2A5L.js.map} +1 -1
- package/dist/{chunk-IEUDKUPM.cjs → chunk-Z2CUEBXV.cjs} +25 -9
- package/dist/chunk-Z2CUEBXV.cjs.map +1 -0
- package/dist/{chunk-GL7CFBVC.js → chunk-ZYB6B7QJ.js} +112 -165
- package/dist/chunk-ZYB6B7QJ.js.map +1 -0
- package/dist/compact-session-PYEC3NZV.js +18 -0
- package/dist/{compact-session-WNKKIIDW.js.map → compact-session-PYEC3NZV.js.map} +1 -1
- package/dist/compact-session-VVT6IBJG.cjs +55 -0
- package/dist/{compact-session-H5TKLD55.cjs.map → compact-session-VVT6IBJG.cjs.map} +1 -1
- package/dist/compaction.cjs +19 -19
- package/dist/compaction.d.cts +9 -9
- package/dist/compaction.d.ts +9 -9
- package/dist/compaction.js +3 -3
- package/dist/concurrency.cjs +6 -6
- package/dist/concurrency.js +4 -4
- package/dist/context-2FZSC6VQ.cjs +22 -0
- package/dist/{context-ZV33V4DC.cjs.map → context-2FZSC6VQ.cjs.map} +1 -1
- package/dist/context-ATJJAFOS.js +5 -0
- package/dist/{context-VAYLPT4O.js.map → context-ATJJAFOS.js.map} +1 -1
- package/dist/{cron-Dx7B-3WB.d.ts → cron-Bx7tzm5R.d.ts} +54 -2
- package/dist/{cron-BiK_aNJI.d.cts → cron-D-DVjGQe.d.cts} +54 -2
- package/dist/cron.cjs +34 -30
- package/dist/cron.d.cts +3 -3
- package/dist/cron.d.ts +3 -3
- package/dist/cron.js +33 -29
- package/dist/{errors-DyVbXdR4.d.cts → errors-DMY-gLSK.d.cts} +1 -1
- package/dist/{errors-Cua4WC9H.d.ts → errors-DjBQ4Tn8.d.ts} +1 -1
- package/dist/errors.cjs +21 -21
- package/dist/errors.d.cts +2 -2
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -2
- package/dist/eval.cjs +42 -37
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +38 -33
- package/dist/eval.js.map +1 -1
- package/dist/{executor-OZSYXDKF.cjs → executor-BMRICN46.cjs} +26 -25
- package/dist/executor-BMRICN46.cjs.map +1 -0
- package/dist/{executor-PAH72CB5.js → executor-T65PPOPT.js} +10 -9
- package/dist/executor-T65PPOPT.js.map +1 -0
- package/dist/filesystem/index.cjs +7 -7
- package/dist/filesystem/index.js +3 -3
- package/dist/fs-session-store-J5MCFFUM.cjs +19 -0
- package/dist/{fs-session-store-7E7UPLF2.cjs.map → fs-session-store-J5MCFFUM.cjs.map} +1 -1
- package/dist/fs-session-store-O6FNHECD.js +10 -0
- package/dist/{fs-session-store-6MY7PNI2.js.map → fs-session-store-O6FNHECD.js.map} +1 -1
- package/dist/generate-object-UF6WIZLF.cjs +20 -0
- package/dist/{generate-object-5SCEH2EE.cjs.map → generate-object-UF6WIZLF.cjs.map} +1 -1
- package/dist/generate-object-XDCBYVK3.js +7 -0
- package/dist/{generate-object-I7UD4NWN.js.map → generate-object-XDCBYVK3.js.map} +1 -1
- package/dist/index-manager-N7RQYUKT.cjs +20 -0
- package/dist/{index-manager-R6ZJFEZF.cjs.map → index-manager-N7RQYUKT.cjs.map} +1 -1
- package/dist/index-manager-ZVZUHPP7.js +11 -0
- package/dist/{index-manager-KKAK7NT3.js.map → index-manager-ZVZUHPP7.js.map} +1 -1
- package/dist/index.cjs +154 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +201 -43
- package/dist/index.d.ts +201 -43
- package/dist/index.js +62 -59
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-UXNJQTZ6.js → inject-session-GQMTDZUN.js} +8 -7
- package/dist/inject-session-GQMTDZUN.js.map +1 -0
- package/dist/{inject-session-DM4SKTZO.cjs → inject-session-LFCYVSLJ.cjs} +11 -10
- package/dist/inject-session-LFCYVSLJ.cjs.map +1 -0
- package/dist/internal/agent-loop/live-events.d.ts +46 -0
- package/dist/internal/agent-loop/loop-thinking-steps.d.ts +28 -0
- package/dist/internal/agent-loop/message-builders.d.ts +12 -3
- package/dist/internal/budget/compute-cost.d.ts +1 -1
- package/dist/internal/diagnostics.d.ts +46 -31
- package/dist/internal/error-mappers/anthropic.d.ts +1 -1
- package/dist/internal/global-singleton.d.ts +7 -7
- package/dist/internal/judge/judge-call.d.ts +14 -14
- package/dist/internal/llm/anthropic-shared.d.ts +4 -4
- package/dist/internal/llm/retrying-client.d.ts +29 -29
- package/dist/internal/llm/transport-error.d.ts +2 -2
- package/dist/internal/llm/types.d.ts +49 -9
- package/dist/internal/local-agent/mcp-pool.d.ts +7 -3
- package/dist/internal/memory/adapters/azure-openai-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/catalog.d.cts +1 -0
- package/dist/internal/memory/adapters/cohere-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/deepinfra-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/gemini-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/index.cjs +28 -0
- package/dist/internal/memory/adapters/index.cjs.map +1 -0
- package/dist/internal/memory/adapters/index.d.cts +16 -0
- package/dist/internal/memory/adapters/index.d.ts +16 -0
- package/dist/internal/memory/adapters/index.js +11 -0
- package/dist/internal/memory/adapters/index.js.map +1 -0
- package/dist/internal/memory/adapters/jina-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/mistral-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/ollama-embedding.d.cts +34 -0
- package/dist/internal/memory/adapters/openai-compatible.d.cts +51 -0
- package/dist/internal/memory/adapters/openai-compatible.d.ts +28 -0
- package/dist/internal/memory/adapters/openai-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/openrouter-embedding.d.cts +2 -0
- package/dist/internal/memory/adapters/voyage-embedding.d.cts +2 -0
- package/dist/internal/memory/dreaming/diary.d.ts +4 -0
- package/dist/internal/memory/dreaming/phases.d.ts +15 -0
- package/dist/internal/memory/dreaming/run.d.ts +10 -0
- package/dist/internal/memory/migrate-sqlite-to-lance.d.ts +15 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +21 -0
- package/dist/internal/persistence/exclusive-create.d.cts +2 -2
- package/dist/internal/persistence/exclusive-create.d.ts +2 -2
- package/dist/internal/persistence/fs-session-store.d.cts +18 -18
- package/dist/internal/persistence/fs-session-store.d.ts +18 -18
- package/dist/internal/persistence/index.cjs +25 -25
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +6 -6
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/persistence/paths.d.cts +7 -7
- package/dist/internal/persistence/paths.d.ts +7 -7
- package/dist/internal/persistence/session-transcript.d.cts +13 -7
- package/dist/internal/persistence/session-transcript.d.ts +13 -7
- package/dist/internal/persistence/session-writer.d.cts +30 -13
- package/dist/internal/persistence/session-writer.d.ts +30 -13
- package/dist/internal/runtime/concurrency/subagent-credentials.d.ts +35 -0
- package/dist/internal/runtime/fixtures/fixture-run-base.d.ts +45 -13
- package/dist/internal/runtime/lifecycle/goal-marker.d.ts +8 -8
- package/dist/internal/security/index.cjs +13 -13
- package/dist/internal/security/index.js +3 -3
- package/dist/internal/session/agent-session-store.d.ts +1 -0
- package/dist/internal/session/agent-session.d.ts +14 -14
- package/dist/internal/session/session-cache.d.ts +9 -9
- package/dist/internal/session/session-types.d.ts +6 -1
- package/dist/judge-call-NA2G6ZMJ.js +5 -0
- package/dist/{judge-call-TAEIXMYG.js.map → judge-call-NA2G6ZMJ.js.map} +1 -1
- package/dist/judge-call-U2D33JOW.cjs +22 -0
- package/dist/{judge-call-SP3G3X2Y.cjs.map → judge-call-U2D33JOW.cjs.map} +1 -1
- package/dist/models.cjs +20 -20
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +5 -5
- package/dist/models.js.map +1 -1
- package/dist/path-safety.cjs +10 -10
- package/dist/path-safety.js +3 -3
- package/dist/persistence.cjs +43 -43
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.d.cts +1 -1
- package/dist/persistence.d.ts +1 -1
- package/dist/persistence.js +14 -14
- package/dist/persistence.js.map +1 -1
- package/dist/project.cjs +5 -5
- package/dist/project.js +3 -3
- package/dist/registry-CAS6Y5ZY.js +9 -0
- package/dist/{registry-SOXE4RY6.js.map → registry-CAS6Y5ZY.js.map} +1 -1
- package/dist/registry-JSDI4WKA.cjs +46 -0
- package/dist/{registry-N3GTKYCI.cjs.map → registry-JSDI4WKA.cjs.map} +1 -1
- package/dist/retry.cjs +4 -4
- package/dist/retry.js +3 -3
- package/dist/{run-CwEJtLPE.d.ts → run-i2-fUohR.d.cts} +217 -174
- package/dist/{run-CwEJtLPE.d.cts → run-i2-fUohR.d.ts} +217 -174
- package/dist/{run-until-YZ2ODWOF.js → run-until-BK56WG4P.js} +3 -3
- package/dist/{run-until-YZ2ODWOF.js.map → run-until-BK56WG4P.js.map} +1 -1
- package/dist/{run-until-ZZ2JLPJM.cjs → run-until-L5KQD3PV.cjs} +4 -4
- package/dist/{run-until-ZZ2JLPJM.cjs.map → run-until-L5KQD3PV.cjs.map} +1 -1
- package/dist/sandbox/bwrap.d.cts +20 -20
- package/dist/sandbox/bwrap.d.ts +20 -20
- package/dist/sandbox/index.cjs +39 -39
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +1 -1
- package/dist/sandbox/index.d.ts +1 -1
- package/dist/sandbox/index.js +35 -35
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/linux-sandbox.d.cts +26 -21
- package/dist/sandbox/linux-sandbox.d.ts +26 -21
- package/dist/server/auth/index.cjs.map +1 -1
- package/dist/server/auth/index.d.cts +6 -6
- package/dist/server/auth/index.d.ts +6 -6
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/auth/orchestrator.d.cts +2 -2
- package/dist/server/auth/orchestrator.d.ts +2 -2
- package/dist/server/auth/types.d.cts +4 -4
- package/dist/server/auth/types.d.ts +4 -4
- package/dist/server/errors-envelope.cjs +14 -14
- package/dist/server/errors-envelope.d.cts +3 -3
- package/dist/server/errors-envelope.d.ts +3 -3
- package/dist/server/errors-envelope.js +3 -3
- package/dist/session-transcript-3B52DKTG.js +5 -0
- package/dist/{session-transcript-6WKLYIN4.js.map → session-transcript-3B52DKTG.js.map} +1 -1
- package/dist/session-transcript-H7NUFXXM.cjs +50 -0
- package/dist/{session-transcript-EAKR4D2W.cjs.map → session-transcript-H7NUFXXM.cjs.map} +1 -1
- package/dist/skills.cjs +7 -7
- package/dist/skills.js +5 -5
- package/dist/stream-object-4FDU76YW.cjs +20 -0
- package/dist/{stream-object-Y7YCX3BI.cjs.map → stream-object-4FDU76YW.cjs.map} +1 -1
- package/dist/stream-object-HWDEEQN4.js +7 -0
- package/dist/{stream-object-OFM66VUT.js.map → stream-object-HWDEEQN4.js.map} +1 -1
- package/dist/subagents-loader-A4W6C3QP.cjs +15 -0
- package/dist/subagents-loader-A4W6C3QP.cjs.map +1 -0
- package/dist/subagents-loader-X33KH2SZ.js +6 -0
- package/dist/subagents-loader-X33KH2SZ.js.map +1 -0
- package/dist/subagents-loader.cjs +6 -6
- package/dist/subagents-loader.d.cts +2 -2
- package/dist/subagents-loader.d.ts +2 -2
- package/dist/subagents-loader.js +4 -4
- package/dist/subscription/index.cjs +3 -3
- package/dist/subscription/index.js +2 -2
- package/dist/task-store.cjs +7 -7
- package/dist/task-store.js +4 -4
- package/dist/types/agent-prims.d.ts +4 -4
- package/dist/types/agent.d.ts +68 -3
- package/dist/types/conversation.d.ts +7 -0
- package/dist/types/goal-events.d.ts +24 -23
- package/dist/types/messages.d.ts +9 -0
- package/dist/types/run.d.ts +27 -0
- package/dist/types/session-message.d.ts +59 -0
- package/dist/types/session-record.d.ts +14 -13
- package/dist/types/workflow.d.ts +36 -0
- package/dist/workflow.cjs +27 -27
- package/dist/workflow.d.cts +17 -1
- package/dist/workflow.d.ts +17 -1
- package/dist/workflow.js +6 -6
- package/docs/harness-capability-map.md +22 -0
- package/package.json +22 -13
- package/dist/agent-DW2J37IH.js +0 -42
- package/dist/agent-IE6IE4NW.cjs +0 -51
- package/dist/batch-3SEPDXCU.cjs.map +0 -1
- package/dist/batch-SY5GZLFD.js.map +0 -1
- package/dist/chunk-2423XDPT.cjs.map +0 -1
- package/dist/chunk-2ONFGMBV.js.map +0 -1
- package/dist/chunk-4YB7B3RP.cjs.map +0 -1
- package/dist/chunk-56OXYUZE.js.map +0 -1
- package/dist/chunk-56ZM6P7Z.cjs.map +0 -1
- package/dist/chunk-5SB4V74H.js +0 -176
- package/dist/chunk-5SB4V74H.js.map +0 -1
- package/dist/chunk-6VP3XGEK.js.map +0 -1
- package/dist/chunk-77WHPVXE.js.map +0 -1
- package/dist/chunk-ALU3KC4G.cjs.map +0 -1
- package/dist/chunk-BJMKQOY2.cjs.map +0 -1
- package/dist/chunk-DCJ5MCJ3.js.map +0 -1
- package/dist/chunk-EEZ7CFMM.js.map +0 -1
- package/dist/chunk-FV3YEMQ7.js.map +0 -1
- package/dist/chunk-G2F67XUR.cjs.map +0 -1
- package/dist/chunk-GL7CFBVC.js.map +0 -1
- package/dist/chunk-H5YVJB4K.cjs +0 -185
- package/dist/chunk-H5YVJB4K.cjs.map +0 -1
- package/dist/chunk-ICYBIC6N.cjs.map +0 -1
- package/dist/chunk-IEUDKUPM.cjs.map +0 -1
- package/dist/chunk-IT3PWBW4.cjs.map +0 -1
- package/dist/chunk-ITLS5LRF.cjs +0 -105
- package/dist/chunk-ITLS5LRF.cjs.map +0 -1
- package/dist/chunk-LTCOPATU.cjs.map +0 -1
- package/dist/chunk-MXSMAGDU.js.map +0 -1
- package/dist/chunk-P34DHHYQ.cjs.map +0 -1
- package/dist/chunk-SDIBMLL5.js.map +0 -1
- package/dist/chunk-TAPQWDW2.js.map +0 -1
- package/dist/chunk-THEYGCYS.cjs.map +0 -1
- package/dist/chunk-VNNK6AKU.js.map +0 -1
- package/dist/chunk-VYJSHGAY.js.map +0 -1
- package/dist/chunk-W52DKZBR.cjs.map +0 -1
- package/dist/chunk-XAEAMI5H.js.map +0 -1
- package/dist/chunk-XAYVHS2B.cjs.map +0 -1
- package/dist/chunk-YDLNI7J6.js.map +0 -1
- package/dist/chunk-YPQF26X7.cjs.map +0 -1
- package/dist/chunk-YVTNFKZO.js +0 -103
- package/dist/chunk-YVTNFKZO.js.map +0 -1
- package/dist/compact-session-H5TKLD55.cjs +0 -54
- package/dist/compact-session-WNKKIIDW.js +0 -17
- package/dist/context-VAYLPT4O.js +0 -5
- package/dist/context-ZV33V4DC.cjs +0 -22
- package/dist/executor-OZSYXDKF.cjs.map +0 -1
- package/dist/executor-PAH72CB5.js.map +0 -1
- package/dist/fs-session-store-6MY7PNI2.js +0 -10
- package/dist/fs-session-store-7E7UPLF2.cjs +0 -19
- package/dist/generate-object-5SCEH2EE.cjs +0 -20
- package/dist/generate-object-I7UD4NWN.js +0 -7
- package/dist/index-manager-KKAK7NT3.js +0 -10
- package/dist/index-manager-R6ZJFEZF.cjs +0 -19
- package/dist/inject-session-DM4SKTZO.cjs.map +0 -1
- package/dist/inject-session-UXNJQTZ6.js.map +0 -1
- package/dist/judge-call-SP3G3X2Y.cjs +0 -22
- package/dist/judge-call-TAEIXMYG.js +0 -5
- package/dist/registry-N3GTKYCI.cjs +0 -46
- package/dist/registry-SOXE4RY6.js +0 -9
- package/dist/session-transcript-6WKLYIN4.js +0 -5
- package/dist/session-transcript-EAKR4D2W.cjs +0 -50
- package/dist/stream-object-OFM66VUT.js +0 -7
- package/dist/stream-object-Y7YCX3BI.cjs +0 -20
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { enqueueSessionWrite } from './chunk-
|
|
2
|
-
import { invalidateSessionCache } from './chunk-
|
|
3
|
-
import
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-
|
|
1
|
+
import { enqueueSessionWrite } from './chunk-E2FFG33C.js';
|
|
2
|
+
import { invalidateSessionCache } from './chunk-5KOW3GLE.js';
|
|
3
|
+
import './chunk-3I4B3OIX.js';
|
|
4
|
+
import { SessionTranscript } from './chunk-JRLXEYR4.js';
|
|
5
|
+
import './chunk-KX7JV5KM.js';
|
|
6
|
+
import './chunk-IVSD7L22.js';
|
|
6
7
|
|
|
7
8
|
// src/internal/session/inject-session.ts
|
|
8
9
|
async function injectSessionTurn(opts) {
|
|
@@ -21,5 +22,5 @@ async function injectSessionTurn(opts) {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export { injectSessionTurn };
|
|
24
|
-
//# sourceMappingURL=inject-session-
|
|
25
|
-
//# sourceMappingURL=inject-session-
|
|
25
|
+
//# sourceMappingURL=inject-session-GQMTDZUN.js.map
|
|
26
|
+
//# sourceMappingURL=inject-session-GQMTDZUN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-GQMTDZUN.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
3
|
+
var chunkDCXRHCZJ_cjs = require('./chunk-DCXRHCZJ.cjs');
|
|
4
|
+
var chunkBURYFNOM_cjs = require('./chunk-BURYFNOM.cjs');
|
|
5
|
+
require('./chunk-XYOHKCYG.cjs');
|
|
6
|
+
var chunkZ2CUEBXV_cjs = require('./chunk-Z2CUEBXV.cjs');
|
|
7
|
+
require('./chunk-DGLLVCNB.cjs');
|
|
8
|
+
require('./chunk-BCQ3E2ZG.cjs');
|
|
8
9
|
|
|
9
10
|
// src/internal/session/inject-session.ts
|
|
10
11
|
async function injectSessionTurn(opts) {
|
|
11
|
-
await
|
|
12
|
+
await chunkDCXRHCZJ_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
12
13
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
13
|
-
const transcript =
|
|
14
|
+
const transcript = chunkZ2CUEBXV_cjs.SessionTranscript.fromRecords(prior, {
|
|
14
15
|
cwd: opts.loc.cwd,
|
|
15
16
|
sessionId: opts.sessionId,
|
|
16
17
|
model: opts.loc.model ?? "unknown"
|
|
@@ -18,10 +19,10 @@ async function injectSessionTurn(opts) {
|
|
|
18
19
|
transcript.appendUserTurn(opts.userText);
|
|
19
20
|
transcript.appendAssistantTurn({ text: opts.assistantText });
|
|
20
21
|
await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));
|
|
21
|
-
|
|
22
|
+
chunkBURYFNOM_cjs.invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
exports.injectSessionTurn = injectSessionTurn;
|
|
26
|
-
//# sourceMappingURL=inject-session-
|
|
27
|
-
//# sourceMappingURL=inject-session-
|
|
27
|
+
//# sourceMappingURL=inject-session-LFCYVSLJ.cjs.map
|
|
28
|
+
//# sourceMappingURL=inject-session-LFCYVSLJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-LFCYVSLJ.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { SDKMessage } from "../../types/messages.js";
|
|
2
|
+
/**
|
|
3
|
+
* theokit#140 — the loop's event log, reporting each event AS IT HAPPENS.
|
|
4
|
+
*
|
|
5
|
+
* ## The defect this closes
|
|
6
|
+
*
|
|
7
|
+
* `runAgentLoop` collected events into a plain array and returned it, so nothing reached the run
|
|
8
|
+
* until the loop had finished. `RealLocalRun.applyAgentLoopOutput` then copied the whole batch in
|
|
9
|
+
* one pass. Meanwhile `SendOptions.onDelta` fired live from inside that same loop.
|
|
10
|
+
*
|
|
11
|
+
* Two clocks, one of which does not start until the other has stopped. A consumer that wanted tool
|
|
12
|
+
* calls interleaved with tokens in true order had to fuse both surfaces itself — which is exactly
|
|
13
|
+
* what `@theokit/agents` was doing, and the documented root of its ordering bug (theokit#47), its
|
|
14
|
+
* namespace-dedup bug (theokit#138) and its missing terminal frame (theokit#142).
|
|
15
|
+
*
|
|
16
|
+
* ## Why a subclass, and not a callback threaded through nine call sites
|
|
17
|
+
*
|
|
18
|
+
* The events are appended from nine places across `loop.ts`, `loop-llm-stream.ts` and
|
|
19
|
+
* `tool-dispatch.ts`. Threading an `onEvent` parameter to each would touch every one of them and,
|
|
20
|
+
* worse, would leave the NEXT `events.push(...)` silently un-notified — a defect that reintroduces
|
|
21
|
+
* itself by omission, which is the failure mode this whole issue is about.
|
|
22
|
+
*
|
|
23
|
+
* Extending `Array` moves the decision to the single place the log is CREATED. Every existing push
|
|
24
|
+
* becomes live with no call-site change, and any push added later is live for free.
|
|
25
|
+
*
|
|
26
|
+
* It stays a real `Array`: `AgentLoopOutput.events` is still `SDKMessage[]`, `instanceof Array`
|
|
27
|
+
* still holds, and every downstream consumer — including the batch copy in `applyAgentLoopOutput` —
|
|
28
|
+
* is unchanged. This is additive; nothing that worked before observes a difference.
|
|
29
|
+
*
|
|
30
|
+
* `push` is the only override, deliberately. The loop only ever appends; overriding the rest of the
|
|
31
|
+
* mutation surface would be guarding against callers that do not exist (YAGNI), and a subscriber
|
|
32
|
+
* that must reason about splices is a worse contract than one that receives appends.
|
|
33
|
+
*/
|
|
34
|
+
export declare class LiveEventLog extends Array<SDKMessage> {
|
|
35
|
+
#private;
|
|
36
|
+
/** Attach the live subscriber. One sink: the run that owns this loop. */
|
|
37
|
+
subscribe(sink: (event: SDKMessage) => void): void;
|
|
38
|
+
push(...events: SDKMessage[]): number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Build the loop's event log, seeded with the events that exist before the loop starts.
|
|
42
|
+
*
|
|
43
|
+
* `LiveEventLog.from` rather than `new LiveEventLog(...seed)`: the `Array` constructor treats a
|
|
44
|
+
* single numeric argument as a length, and a seed is a list of events, never a count.
|
|
45
|
+
*/
|
|
46
|
+
export declare function createEventLog(seed: readonly SDKMessage[]): LiveEventLog;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* theokit#122 — where a round's thinking block becomes a conversation step.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from `loop.ts` when it crossed the G8 400-LoC cap. These two belong together: both
|
|
5
|
+
* answer "the round produced a thinking block — where does it land in the persisted conversation",
|
|
6
|
+
* and the answer differs by which path closes the round.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
import type { LlmThinkingPart } from "../llm/types.js";
|
|
11
|
+
import type { LoopContext } from "./loop-context-init.js";
|
|
12
|
+
/**
|
|
13
|
+
* theokit#122 — the round's thinking block as a conversation step.
|
|
14
|
+
*
|
|
15
|
+
* Shared by the two paths that can close a round: the assistant-text path and the tool_use path.
|
|
16
|
+
* The tool_use path is the one that matters — a round of thinking + a tool call with NO preamble
|
|
17
|
+
* text is the common Anthropic shape, and it is exactly the case the first version of this fix
|
|
18
|
+
* dropped (the block stayed on the context and was persisted against the NEXT round's text).
|
|
19
|
+
*/
|
|
20
|
+
export declare function thinkingStep(thinking: LlmThinkingPart): ConversationStep;
|
|
21
|
+
/**
|
|
22
|
+
* theokit#122 — persist the block for a round that called a tool and said nothing.
|
|
23
|
+
*
|
|
24
|
+
* Such a round emits no assistant-text step, so without this the block is never recorded for it —
|
|
25
|
+
* which is exactly how the first version of this fix let round N's signature reach round N+1.
|
|
26
|
+
* No-op when the round had text (the text path already recorded it) or produced no thinking.
|
|
27
|
+
*/
|
|
28
|
+
export declare function recordThinkingOnSilentToolRound(ctx: LoopContext, text: string, thinking: LlmThinkingPart | undefined): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SDKAssistantMessage, SDKThinkingMessage, SDKUserMessageEvent } from "../../types/messages.js";
|
|
2
|
-
import type { LlmMessage, LlmToolCallPart } from "../llm/types.js";
|
|
2
|
+
import type { LlmMessage, LlmThinkingPart, LlmToolCallPart } from "../llm/types.js";
|
|
3
3
|
import type { AgentLoopInputs } from "./loop-types.js";
|
|
4
4
|
export declare function buildUserEvent(inputs: AgentLoopInputs): SDKUserMessageEvent;
|
|
5
5
|
export declare function buildAssistantEvent(inputs: AgentLoopInputs, text: string): SDKAssistantMessage;
|
|
@@ -8,5 +8,14 @@ export declare function buildAssistantEvent(inputs: AgentLoopInputs, text: strin
|
|
|
8
8
|
* issue #48: when the reasoning duration was measured, carry it as `thinking_duration_ms`
|
|
9
9
|
* so a `Run.stream()` replay can render how long the model reasoned.
|
|
10
10
|
*/
|
|
11
|
-
export declare function buildThinkingEvent(inputs: AgentLoopInputs, text: string, thinkingDurationMs?: number): SDKThinkingMessage;
|
|
12
|
-
|
|
11
|
+
export declare function buildThinkingEvent(inputs: AgentLoopInputs, text: string, thinkingDurationMs?: number, signature?: string): SDKThinkingMessage;
|
|
12
|
+
/**
|
|
13
|
+
* theokit#122 — `thinking` is FIRST, and that ordering is a provider requirement, not a preference.
|
|
14
|
+
*
|
|
15
|
+
* Anthropic verifies the signed block on the next request and requires it to lead the assistant
|
|
16
|
+
* message it belongs to. Omitting it (which this builder did until theokit#122's follow-up) makes
|
|
17
|
+
* round 2 of any thinking + tools run fail with `400 "thinking blocks cannot be modified"` — the
|
|
18
|
+
* exact failure the issue exists to remove. An unsigned block is passed through here and dropped at
|
|
19
|
+
* the wire by `thinkingToWireBlock`, which is where that policy belongs.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildAssistantTurn(text: string, toolCalls: LlmToolCallPart[], thinking?: LlmThinkingPart): LlmMessage;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - "subscription_included" routes (Codex CLI, future Claude Pro) →
|
|
11
11
|
* return $0 with status="included".
|
|
12
12
|
* - Provider unknown / pricing missing → status="unknown" with
|
|
13
|
-
* undefined amountUsd (
|
|
13
|
+
* undefined amountUsd (does NOT return a false 0).
|
|
14
14
|
*
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
@@ -1,54 +1,69 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* The library's single diagnostics channel — silent by default (#147).
|
|
3
3
|
*
|
|
4
4
|
* ## O problema
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* The SDK wrote diagnostics straight to `process.stderr` from hot paths — 92 sites across 51
|
|
7
|
+
* files under `internal/`. In a TUI host (Ink, alternate screen), those writes interleave with the
|
|
8
|
+
* render and **corrupt the frame**. And the host had no way to intercept them: there was no
|
|
9
|
+
* injectable logger. One consumer went as far as installing `proper-lockfile` just to silence ONE
|
|
10
|
+
* of them.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* A library cannot assume `stdout`/`stderr` are free sinks. The application owns the terminal, not
|
|
13
|
+
* the dependency.
|
|
14
14
|
*
|
|
15
15
|
* ## O contrato
|
|
16
16
|
*
|
|
17
|
-
* - **`setDiagnosticsSink(fn)`**
|
|
18
|
-
* (
|
|
19
|
-
* - **
|
|
17
|
+
* - **`setDiagnosticsSink(fn)`** hands the messages to the application, which decides where to put
|
|
18
|
+
* them (a status line, a file, a panel). It is what was missing for a TUI to coexist with the SDK.
|
|
19
|
+
* - **With no sink, nothing is emitted.** A library does not own the host's terminal.
|
|
20
20
|
*
|
|
21
|
-
* ##
|
|
21
|
+
* ## Silent by default, and how 36 suites survived the flip
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* migrá-los às pressas, em quatro formas diferentes de espionar o `stderr`, é a receita para
|
|
27
|
-
* enfraquecer 58 suítes de uma vez.
|
|
23
|
+
* The default WAS `stderr`, and 36 test files spy on `process.stderr.write` to assert a given
|
|
24
|
+
* warning is emitted. That contract is real and had to survive; migrating all 36 by hand, across
|
|
25
|
+
* four different spy styles, is how you weaken 36 suites in one commit.
|
|
28
26
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
27
|
+
* So the flip happened at the default, and `vitest.setup.ts` installs a sink that FORWARDS to
|
|
28
|
+
* `stderr` for the duration of every test. Those assertions still test what they always tested —
|
|
29
|
+
* "this condition emits a diagnostic" — through the channel a host would use, while production
|
|
30
|
+
* emits nothing unless asked.
|
|
33
31
|
*
|
|
34
|
-
*
|
|
32
|
+
* The cost is stated rather than hidden: no test observes the production default by accident, so
|
|
33
|
+
* `tests/diagnostics-public-entry.test.ts` pins it explicitly by clearing the sink first.
|
|
35
34
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* ## Coverage is the whole guarantee
|
|
36
|
+
*
|
|
37
|
+
* The first sweep migrated the 92 sites under `internal/` and left `src/`'s own modules —
|
|
38
|
+
* `event-bus.ts`, `batch.ts`, `compaction.ts`, `internal/workflow/step-branch.ts`. A host could
|
|
39
|
+
* therefore install a sink and still have its frame corrupted by a batch run, which is the reported
|
|
40
|
+
* defect with a smaller blast radius. Those are routed here too, and
|
|
41
|
+
* `tests/lint/no-direct-terminal-write.test.ts` is what keeps the next hot path from
|
|
42
|
+
* reintroducing one. "Mostly interceptable" is not interceptable.
|
|
43
|
+
*
|
|
44
|
+
* The remaining direct writers are allowlisted there with a reason, and every one of them is a seam
|
|
45
|
+
* whose destination the CALLER already chooses (`opts.warn`, `opts.logger`, the Workflow logger).
|
|
46
|
+
*
|
|
47
|
+
* ## What this is NOT
|
|
48
|
+
*
|
|
49
|
+
* It is not a logger with levels, formatting or multiple destinations. It is the minimum that
|
|
50
|
+
* resolves the reported blocker; a full logger here would be inventing a requirement nobody asked
|
|
51
|
+
* for.
|
|
38
52
|
*/
|
|
39
|
-
/**
|
|
53
|
+
/** Receives each diagnostic message already formatted, with the trailing `\n`. */
|
|
40
54
|
export type DiagnosticsSink = (message: string) => void;
|
|
41
55
|
/**
|
|
42
|
-
*
|
|
56
|
+
* Installs (or removes, by passing `undefined`) the diagnostics destination.
|
|
43
57
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
58
|
+
* When a sink is present it is the ONLY destination — `stderr` gets no copy. Duplicating
|
|
59
|
+
* destinations would hand the problem back to the TUI that installed the sink precisely to get the
|
|
60
|
+
* messages out of the terminal.
|
|
46
61
|
*/
|
|
47
62
|
export declare function setDiagnosticsSink(next: DiagnosticsSink | undefined): void;
|
|
48
63
|
/**
|
|
49
|
-
*
|
|
64
|
+
* Emits a library diagnostic message.
|
|
50
65
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
66
|
+
* Replaces `process.stderr.write` on internal paths. Never throws: a faulty sink must not
|
|
67
|
+
* must not take down the run it merely observes.
|
|
53
68
|
*/
|
|
54
69
|
export declare function diag(message: string): void;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* `"content_filtered"` for policy.)
|
|
13
13
|
* 408 → `NetworkError` (`code: "timeout"`)
|
|
14
14
|
* 5xx → `NetworkError` (`code: "server_error"` — covers 529
|
|
15
|
-
* overloaded_error common
|
|
15
|
+
* overloaded_error common at peak
|
|
16
16
|
* de pico)
|
|
17
17
|
* other → `UnknownAgentError` (`code: "unknown"`)
|
|
18
18
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Singleton por realm, chaveado por `Symbol.for`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* `node_modules`, ESM
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* It exists because a package can be loaded more than once in the same process (two copies in
|
|
5
|
+
* `node_modules`, ESM and CJS side by side, a monorepo with distinct versions) — and then a module-level
|
|
6
|
+
* `const x = new Map()` produces TWO caches that cannot see each other. `Symbol.for` uses the global
|
|
7
|
+
* symbol registry, which belongs to the realm and not the module, so every copy converges on one instance.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* It was copied verbatim into `providers/discovery.ts` and `providers/catalog-loader.ts`. That is
|
|
10
|
+
* duplicated KNOWLEDGE, not a coincidence of shape: the two copies have to agree on the
|
|
11
|
+
* mechanism, and one fixed without the other produces exactly the bug the function exists to avoid.
|
|
12
12
|
*/
|
|
13
13
|
export declare function globalSingleton<T>(key: string, create: () => T): T;
|
|
@@ -8,32 +8,32 @@ export interface JudgeContext {
|
|
|
8
8
|
/** Caller-supplied tuning knobs for the judge call. */
|
|
9
9
|
export interface JudgeOptions {
|
|
10
10
|
/**
|
|
11
|
-
* Judge model identifier.
|
|
12
|
-
* `"openai/gpt-4o-mini"`
|
|
11
|
+
* Judge model identifier. When absent, it DERIVES from {@link agentModel} — and only falls back to the literal
|
|
12
|
+
* `"openai/gpt-4o-mini"` when neither is provided.
|
|
13
13
|
*
|
|
14
|
-
* M80 —
|
|
15
|
-
* 404,
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* M80 — the fixed default was provider-blind: it only resolves on OpenRouter. With an Anthropic key it gives
|
|
15
|
+
* 404, with an OAuth bearer it gives 401, and in both the goal burned 3 whole turns before failing with
|
|
16
|
+
* a misleading reason. The agent-builder already worked around this by deriving on its own; the knowledge
|
|
17
|
+
* belongs here.
|
|
18
18
|
*/
|
|
19
19
|
judgeModel?: string;
|
|
20
20
|
/**
|
|
21
|
-
* M80 —
|
|
22
|
-
* chat
|
|
21
|
+
* M80 — the DRIVEN agent's model. It is the basis of the derivation: a judge running on the same model as the
|
|
22
|
+
* chat works wherever chat works.
|
|
23
23
|
*/
|
|
24
24
|
agentModel?: string;
|
|
25
25
|
/** Override env. Default `process.env.OPENROUTER_API_KEY` (EC-A). */
|
|
26
26
|
apiKey?: string;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* M80 —
|
|
29
|
+
* M80 — the judge's credential or model does not work: 401/404.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* Fails FAST by design. `rules/error-handling.md` § 2 separates recoverable from unrecoverable, and a
|
|
32
|
+
* nonexistent model does not start existing on retry — folding that into `{parseFailed: true}` made the loop
|
|
33
|
+
* try three times and report "failed" on a consecutive-failure limit, hiding that the cause was the
|
|
34
|
+
* credential. A slow, opaque failure traded for a fast, clear one.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
36
|
+
* PARSE failures and network errors stay folded: they are recoverable, and the loop already decides on
|
|
37
37
|
* consecutivas.
|
|
38
38
|
*/
|
|
39
39
|
export declare class JudgeCredentialError extends TheokitAgentError {
|
|
@@ -25,10 +25,6 @@ export interface AnthropicResponseLike {
|
|
|
25
25
|
export declare function extractAnthropicText(response: AnthropicResponseLike): string;
|
|
26
26
|
export declare function extractAnthropicToolCalls(response: AnthropicResponseLike): LlmToolCallPart[];
|
|
27
27
|
export declare function mapAnthropicStopReason(reason: string | null): LlmStopReason;
|
|
28
|
-
/**
|
|
29
|
-
* Convert an SDK `LlmMessage` to the Anthropic Messages wire shape.
|
|
30
|
-
* Identical across the three Anthropic-compatible clients (D289/D292).
|
|
31
|
-
*/
|
|
32
28
|
export declare function toAnthropicWireMessage(message: LlmMessage): Record<string, unknown>;
|
|
33
29
|
/**
|
|
34
30
|
* Build the common body shape for Anthropic Messages requests. Caller
|
|
@@ -93,4 +89,8 @@ export declare function buildAnthropicCommonBody(request: LlmRequest): {
|
|
|
93
89
|
description: string;
|
|
94
90
|
input_schema: unknown;
|
|
95
91
|
}>;
|
|
92
|
+
thinking?: {
|
|
93
|
+
type: "enabled";
|
|
94
|
+
budget_tokens: number;
|
|
95
|
+
};
|
|
96
96
|
};
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
import type { LlmClient, LlmEvent, LlmFinish, LlmRequest } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
export declare const
|
|
2
|
+
/** Attempt ceiling. Fixed at 3 — M93's DoD names the number. */
|
|
3
|
+
export declare const MAX_ATTEMPTS = 3;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Is the error transient — that is, can retrying change the outcome?
|
|
6
6
|
*
|
|
7
|
-
* ##
|
|
7
|
+
* ## Delegates to `isTransientError`, and states what it subtracts
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* a re-derivation",
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
9
|
+
* The SDK **already** publishes `isTransientError` — documented as "a single source of truth rather
|
|
10
|
+
* than a re-derivation", with the explicit warning that "It never inspects `err.message`". The first
|
|
11
|
+
* version of this function ignored both: it re-derived, by regex over the message (`/\b4\d\d\b/`).
|
|
12
|
+
* Adversarial review measured the cost — `connect ECONNREFUSED 127.0.0.1:443` was classified as NOT
|
|
13
|
+
* transient, because the **port** matches the regex. The network errors retry exists for were
|
|
14
|
+
* exactly the ones excluded.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Reinventing here violated parsimony rung 4 with the part already at hand. What remains of this
|
|
17
|
+
* function are **three subtractions** from the owner's verdict, each with a reason:
|
|
18
18
|
*
|
|
19
|
-
* |
|
|
19
|
+
* | Subtraction | Why |
|
|
20
20
|
* |---|---|
|
|
21
|
-
* | `CredentialPoolExhaustedError` |
|
|
22
|
-
* | `code === "circuit_open"` |
|
|
23
|
-
* | `RateLimitError`
|
|
21
|
+
* | `CredentialPoolExhaustedError` | the pool already spent its own attempt and rotation budget; `nextRetryAt` is tens of seconds out. Retrying would multiply the wait by `MAX_ATTEMPTS` with no chance of success. |
|
|
22
|
+
* | `code === "circuit_open"` | the breaker exists **in order to** fail fast; wrapping it in a retry undoes from outside the decision it just made. |
|
|
23
|
+
* | `RateLimitError` with 402 | a billing quota does not resolve in milliseconds — which is why the pool's `classifyAndDecide` rotates instead of waiting. |
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* The first two came out of the review's measurements: with them treated as transient, the entire
|
|
26
|
+
* pool was retried 3x, and a 30 s wait became ~90 s.
|
|
27
27
|
*/
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function isRetriableError(err: unknown): boolean;
|
|
29
29
|
/**
|
|
30
|
-
* ##
|
|
30
|
+
* ## Why there is NO circuit breaker here
|
|
31
31
|
*
|
|
32
|
-
*
|
|
33
|
-
* `recordTimeout(key)`):
|
|
34
|
-
*
|
|
32
|
+
* The package's `CircuitBreaker` is **keyed by credential** (`recordSuccess(key)` /
|
|
33
|
+
* `recordTimeout(key)`): it exists so the pool can mark a key unhealthy and **skip** to another.
|
|
34
|
+
* With a single key there is nowhere to skip to, so a breaker here would record state nobody reads.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* Parsimony rung 1 — "does this need to exist?". No: it would be ceremony with resilience's name on
|
|
37
|
+
* it. What protects the single-key path is the attempt ceiling and the backoff, and both are below.
|
|
38
38
|
*/
|
|
39
39
|
export declare class RetryingLlmClient implements LlmClient {
|
|
40
40
|
#private;
|
|
@@ -42,10 +42,10 @@ export declare class RetryingLlmClient implements LlmClient {
|
|
|
42
42
|
rng?: () => number;
|
|
43
43
|
});
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* decorators.
|
|
48
|
-
*
|
|
45
|
+
* The decorated client. Public by the same convention as `FaultInjectingLlmClient.inner`: the
|
|
46
|
+
* router's wiring tests assert `instanceof PoolAwareLlmClient` and need to see through the
|
|
47
|
+
* decorators. Without this, adding a decorator breaks tests whose intent is still valid — which is
|
|
48
|
+
* exactly what M93 did to 4 pre-existing tests.
|
|
49
49
|
*/
|
|
50
50
|
get inner(): LlmClient;
|
|
51
51
|
get name(): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Wraps a socket failure in a {@link NetworkError}, preserving the cause.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Returns the original error — unwrapped — when it is an abort or already an SDK error.
|
|
5
5
|
*/
|
|
6
6
|
export declare function wrapTransportError(err: unknown, ctx: {
|
|
7
7
|
providerId: string;
|
|
@@ -43,7 +43,24 @@ export interface LlmImagePart {
|
|
|
43
43
|
url: string;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
/**
|
|
47
|
+
* theokit#122 — an extended-thinking block, carried WITH its provider-issued signature.
|
|
48
|
+
*
|
|
49
|
+
* The signature is the whole reason this part exists. Anthropic requires a resumed conversation to
|
|
50
|
+
* replay each `thinking` block byte-identically, signature included; replaying the text alone is
|
|
51
|
+
* rejected with `400 "thinking blocks cannot be modified"` (anthropics/claude-code#63147). So a
|
|
52
|
+
* session that used extended thinking could be persisted but never resumed.
|
|
53
|
+
*
|
|
54
|
+
* `signature` is optional because not every provider issues one — the OpenAI-compatible reasoning
|
|
55
|
+
* channel streams `reasoning`/`reasoning_content` text with no signature at all. A part without a
|
|
56
|
+
* signature is display-only history; it must not be replayed to Anthropic as a thinking block.
|
|
57
|
+
*/
|
|
58
|
+
export interface LlmThinkingPart {
|
|
59
|
+
type: "thinking";
|
|
60
|
+
text: string;
|
|
61
|
+
signature?: string;
|
|
62
|
+
}
|
|
63
|
+
export type LlmContentPart = LlmTextPart | LlmToolCallPart | LlmToolResultPart | LlmImagePart | LlmThinkingPart;
|
|
47
64
|
export interface LlmMessage {
|
|
48
65
|
role: "system" | "user" | "assistant";
|
|
49
66
|
content: LlmContentPart[];
|
|
@@ -122,20 +139,36 @@ export interface LlmRequest {
|
|
|
122
139
|
*/
|
|
123
140
|
toolChoice?: "auto" | "none" | "required";
|
|
124
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* What a provider stream reports WHILE it is running. Tool calls are deliberately absent.
|
|
144
|
+
*
|
|
145
|
+
* theokit#144: this union used to declare `tool_use` and `stop` variants. Only two providers ever
|
|
146
|
+
* yielded them (`responses.ts`, `fault-injection.ts`), the loop's collector
|
|
147
|
+
* (`loop-llm-stream.ts`) never read them, and the tool calls they carried were duplicates of what
|
|
148
|
+
* `LlmFinish.toolCalls` already returned. So they were not a live tool channel — they were a
|
|
149
|
+
* declaration of one, which is worse: it told implementers a provider-level channel existed and
|
|
150
|
+
* cost `@theokit/agents` a workaround (holding every `text_delta` until the stream drained, which
|
|
151
|
+
* broke live token streaming on text-only turns — issue #47).
|
|
152
|
+
*
|
|
153
|
+
* Wiring them instead of deleting them was rejected: `openai.ts` and `anthropic.ts` cannot produce
|
|
154
|
+
* them at all (their tool calls only resolve at completion), so a live provider-level channel would
|
|
155
|
+
* exist on some providers and not others — a worse contract than a uniform one.
|
|
156
|
+
*
|
|
157
|
+
* **The canonical live tool channel is `onDelta`**: `tool-call-started` / `tool-call-completed`
|
|
158
|
+
* `InteractionUpdate`s, emitted by `runToolWithLifecycle` (`agent-loop/tool-dispatch.ts`) between
|
|
159
|
+
* LLM rounds. It is uniform across providers, carries a `callId` correlating the two ends, and
|
|
160
|
+
* fires before the post-tool answer text. `Run.events()` (theokit#140) merges it with the
|
|
161
|
+
* structural `SDKMessage`s into one ordered timeline.
|
|
162
|
+
*
|
|
163
|
+
* The stop reason is not an event either — it is returned once, on `LlmFinish.stopReason`.
|
|
164
|
+
*/
|
|
125
165
|
export type LlmEvent = {
|
|
126
166
|
type: "text_delta";
|
|
127
167
|
text: string;
|
|
128
168
|
} | {
|
|
129
169
|
type: "reasoning_delta";
|
|
130
170
|
text: string;
|
|
131
|
-
|
|
132
|
-
type: "tool_use";
|
|
133
|
-
id: string;
|
|
134
|
-
name: string;
|
|
135
|
-
input: Record<string, unknown>;
|
|
136
|
-
} | {
|
|
137
|
-
type: "stop";
|
|
138
|
-
reason: LlmStopReason;
|
|
171
|
+
signature?: string;
|
|
139
172
|
} | {
|
|
140
173
|
type: "error";
|
|
141
174
|
message: string;
|
|
@@ -153,6 +186,13 @@ export interface LlmFinish {
|
|
|
153
186
|
cacheWriteTokens?: number;
|
|
154
187
|
/** Reasoning tokens (OpenAI o-series). ADR D376. */
|
|
155
188
|
reasoningTokens?: number;
|
|
189
|
+
/**
|
|
190
|
+
* theokit#122 — the turn's extended-thinking block, with the provider's signature when it issued
|
|
191
|
+
* one. Returned on the finish value rather than reconstructed from the `reasoning_delta` text,
|
|
192
|
+
* because the signature arrives once for the whole block and only the provider adapter knows
|
|
193
|
+
* which block it belongs to.
|
|
194
|
+
*/
|
|
195
|
+
thinking?: LlmThinkingPart;
|
|
156
196
|
}
|
|
157
197
|
export interface LlmClient {
|
|
158
198
|
readonly name: string;
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `buildMcpMap` (`real-local-run.ts`) builds a fresh `McpClient` on every run, so each `send` pays
|
|
5
5
|
* spawn + handshake again: 193 / 138 / 134 ms per turn, measured. The reference anchors this at the
|
|
6
|
-
* session — Codex keeps its `
|
|
7
|
-
* (`core/src/state/service.rs:
|
|
8
|
-
* across turns"*, and REPLACES the runtime rather than rebuilding it.
|
|
6
|
+
* session — Codex keeps its `mcp_runtime: Arc<McpRuntime>` in `SessionServices`
|
|
7
|
+
* (`codex-rs/core/src/state/service.rs:51-58`), next to a field commented *"Session-scoped model
|
|
8
|
+
* client shared across turns"*, and REPLACES the runtime rather than rebuilding it.
|
|
9
|
+
*
|
|
10
|
+
* theokit#155: pooling the client OBJECT was never enough — the turn also has to stop closing what
|
|
11
|
+
* it does not own. See `runOwnsMcpClients` (`real-local-run.ts`) and the idempotent
|
|
12
|
+
* `StdioMcpClient.initialize()`.
|
|
9
13
|
*
|
|
10
14
|
* Generic over the client type on purpose: this file knows about keys, reuse and idleness, and
|
|
11
15
|
* nothing about MCP. That keeps it unit-testable without spawning a server, and keeps `McpClient`'s
|