@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk7U2HAAWB_cjs = require('../../../chunk-7U2HAAWB.cjs');
|
|
4
|
+
require('../../../chunk-6YNYA7GD.cjs');
|
|
5
|
+
var chunk2RW7K6FN_cjs = require('../../../chunk-2RW7K6FN.cjs');
|
|
6
|
+
require('../../../chunk-MUUQ2WFJ.cjs');
|
|
7
|
+
require('../../../chunk-7OLG7VI4.cjs');
|
|
8
|
+
require('../../../chunk-TIMPJL5V.cjs');
|
|
9
|
+
require('../../../chunk-7YBJZS5P.cjs');
|
|
10
|
+
require('../../../chunk-IHFNRNTJ.cjs');
|
|
11
|
+
require('../../../chunk-BCQ3E2ZG.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Object.defineProperty(exports, "createOpenAiCompatibleRuntime", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunk7U2HAAWB_cjs.createOpenAiCompatibleRuntime; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "LruEmbeddingCache", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunk2RW7K6FN_cjs.LruEmbeddingCache; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "globalEmbeddingCache", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunk2RW7K6FN_cjs.globalEmbeddingCache; }
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.cjs.map
|
|
28
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* theokit#160 — the ONE embedding runtime, shared with `@theokit/sdk-memory`.
|
|
3
|
+
*
|
|
4
|
+
* The satellite used to carry a full copy of `createOpenAiCompatibleRuntime`, and the peer's catalog
|
|
5
|
+
* REPLACES core's at runtime when installed — so the copy that ran was not the copy most people
|
|
6
|
+
* read. That duplication produced theokit#128 (four adapters present in one copy, missing from the
|
|
7
|
+
* other, for two months), and every fix since had to be applied twice by hand: the `{model}` path
|
|
8
|
+
* substitution, then all three provider dialects.
|
|
9
|
+
*
|
|
10
|
+
* This is the shared leaf both packages now import. Semver-exempt, exactly like the
|
|
11
|
+
* `internal/persistence` and `internal/security` sub-paths that exist for the same reason: extracted
|
|
12
|
+
* packages need primitives that are not part of the stable public contract.
|
|
13
|
+
*
|
|
14
|
+
* @internal — semver-exempt. Not part of the stable `@theokit/sdk` API.
|
|
15
|
+
*/
|
|
16
|
+
export { createOpenAiCompatibleRuntime, type EmbeddingDialect, type OpenAiCompatibleConfig, } from "./openai-compatible.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* theokit#160 — the ONE embedding runtime, shared with `@theokit/sdk-memory`.
|
|
3
|
+
*
|
|
4
|
+
* The satellite used to carry a full copy of `createOpenAiCompatibleRuntime`, and the peer's catalog
|
|
5
|
+
* REPLACES core's at runtime when installed — so the copy that ran was not the copy most people
|
|
6
|
+
* read. That duplication produced theokit#128 (four adapters present in one copy, missing from the
|
|
7
|
+
* other, for two months), and every fix since had to be applied twice by hand: the `{model}` path
|
|
8
|
+
* substitution, then all three provider dialects.
|
|
9
|
+
*
|
|
10
|
+
* This is the shared leaf both packages now import. Semver-exempt, exactly like the
|
|
11
|
+
* `internal/persistence` and `internal/security` sub-paths that exist for the same reason: extracted
|
|
12
|
+
* packages need primitives that are not part of the stable public contract.
|
|
13
|
+
*
|
|
14
|
+
* @internal — semver-exempt. Not part of the stable `@theokit/sdk` API.
|
|
15
|
+
*/
|
|
16
|
+
export { createOpenAiCompatibleRuntime, type EmbeddingDialect, type OpenAiCompatibleConfig, } from "./openai-compatible.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { createOpenAiCompatibleRuntime } from '../../../chunk-QKE556YD.js';
|
|
2
|
+
import '../../../chunk-SCFW5MJZ.js';
|
|
3
|
+
export { LruEmbeddingCache, globalEmbeddingCache } from '../../../chunk-OXNYIMZZ.js';
|
|
4
|
+
import '../../../chunk-FD2UT76F.js';
|
|
5
|
+
import '../../../chunk-LGILIGV3.js';
|
|
6
|
+
import '../../../chunk-PI4RO4GR.js';
|
|
7
|
+
import '../../../chunk-J3UK2GMN.js';
|
|
8
|
+
import '../../../chunk-SG5ZWT6C.js';
|
|
9
|
+
import '../../../chunk-IVSD7L22.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ollama embedding adapter (T3.1, ADR D183).
|
|
3
|
+
*
|
|
4
|
+
* Targets Ollama's OpenAI-compatible `/v1/embeddings` endpoint and reuses
|
|
5
|
+
* the shared `createOpenAiCompatibleRuntime` factory. The differentiating
|
|
6
|
+
* bits:
|
|
7
|
+
*
|
|
8
|
+
* - `authType: "none"` — Ollama local ignores `Authorization`. Sentinel
|
|
9
|
+
* `"ollama-local"` is passed as apiKey to satisfy the factory contract
|
|
10
|
+
* (mirrors peer-project `OLLAMA_DEFAULT_API_KEY = "ollama-local"`).
|
|
11
|
+
* - `OLLAMA_HOST` overrides the default `http://localhost:11434`.
|
|
12
|
+
* - `OLLAMA_API_KEY` (optional) overrides the sentinel for Ollama Cloud
|
|
13
|
+
* or reverse-proxy auth setups.
|
|
14
|
+
* - Default model: `nomic-embed-text` (768 dim, ~274MB). User can opt
|
|
15
|
+
* into `all-minilm` (384 dim, ~45MB) or any other locally-installed
|
|
16
|
+
* embedding model.
|
|
17
|
+
*
|
|
18
|
+
* EC-B MUST FIX (edge-case review 2026-05-21): empty text is rejected
|
|
19
|
+
* upstream in the shared factory (`classifyEntry` short-circuits to a
|
|
20
|
+
* zero vector). That behavior is acceptable here because the zero
|
|
21
|
+
* vector is identical for any empty input — downstream similarity
|
|
22
|
+
* calcs ignore zero-norm vectors via the existing `cosineSimilarity`
|
|
23
|
+
* guard. No additional fail-fast needed.
|
|
24
|
+
*
|
|
25
|
+
* EC-A MUST FIX (edge-case review 2026-05-21): dimension is locked
|
|
26
|
+
* by the `DIMENSION_BY_MODEL` table; an unknown model id throws
|
|
27
|
+
* `ConfigurationError(code: "embedding_unknown_model")` per the
|
|
28
|
+
* factory's EC-4 contract. Future model versions with different
|
|
29
|
+
* dimensions are added to the table here without breaking changes.
|
|
30
|
+
*
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_OLLAMA_EMBEDDING_MODEL = "nomic-embed-text";
|
|
34
|
+
export declare const ollamaMemoryEmbeddingProviderAdapter: MemoryEmbeddingProviderAdapter;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CreateAdapterOptions, EmbeddingRuntime } from "../embedding-adapter.js";
|
|
2
|
+
export interface OpenAiCompatibleConfig {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultBaseUrl: string;
|
|
5
|
+
apiKeyEnv: string;
|
|
6
|
+
baseUrlEnv?: string;
|
|
7
|
+
defaultModel: string;
|
|
8
|
+
/**
|
|
9
|
+
* Dimension hint by model id. The chosen model MUST be in this table —
|
|
10
|
+
* unknown models throw `ConfigurationError(code: "embedding_unknown_model")`
|
|
11
|
+
* (EC-4 fix). This prevents vec0 virtual-table dimension mismatches that
|
|
12
|
+
* surface as cryptic errors downstream.
|
|
13
|
+
*/
|
|
14
|
+
dimensionByModel: Record<string, number>;
|
|
15
|
+
/**
|
|
16
|
+
* Path component appended to `baseUrl` for the embeddings endpoint.
|
|
17
|
+
* Default `"/v1/embeddings"` (OpenAI canonical). REPLACES the default —
|
|
18
|
+
* does NOT concatenate. Used by DeepInfra (`"/v1/openai/embeddings"`),
|
|
19
|
+
* etc. (EC-2 fix).
|
|
20
|
+
*/
|
|
21
|
+
embeddingsPath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* theokit#159 — per-provider deviations from the OpenAI wire.
|
|
24
|
+
*
|
|
25
|
+
* The runtime was rigidly OpenAI-shaped: one auth header, one body, one response shape. Three of
|
|
26
|
+
* the ten catalog providers do not speak it, so every call they made was rejected — Azure
|
|
27
|
+
* authenticates with an `api-key` header and puts the deployment in the path, Cohere's `/v2/embed`
|
|
28
|
+
* takes `texts` and answers `{embeddings:{float}}`. Advertising a provider that cannot work is
|
|
29
|
+
* worse than not advertising it.
|
|
30
|
+
*
|
|
31
|
+
* Every hook is optional and its default is exactly the previous behaviour, so the seven
|
|
32
|
+
* providers that DO speak OpenAI are untouched.
|
|
33
|
+
*/
|
|
34
|
+
dialect?: EmbeddingDialect;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* theokit#159 — the three points where a provider may deviate from the OpenAI embedding wire.
|
|
38
|
+
*
|
|
39
|
+
* Deliberately three narrow hooks rather than a general "transform the request" seam: these are the
|
|
40
|
+
* only axes on which the supported providers actually differ, and a wider seam would invite
|
|
41
|
+
* per-provider logic that belongs in the adapter.
|
|
42
|
+
*/
|
|
43
|
+
export interface EmbeddingDialect {
|
|
44
|
+
/** Replaces `authorization: Bearer <key>`. */
|
|
45
|
+
authHeaders?: (apiKey: string) => Record<string, string>;
|
|
46
|
+
/** Replaces the `{ model, input }` request body. */
|
|
47
|
+
body?: (model: string, inputs: ReadonlyArray<string>) => Record<string, unknown>;
|
|
48
|
+
/** Replaces reading vectors from `json.data[].embedding`. Return `undefined` when unparseable. */
|
|
49
|
+
vectors?: (json: unknown) => number[][] | undefined;
|
|
50
|
+
}
|
|
51
|
+
export declare function createOpenAiCompatibleRuntime(cfg: OpenAiCompatibleConfig, options: CreateAdapterOptions): Promise<EmbeddingRuntime>;
|
|
@@ -19,5 +19,33 @@ export interface OpenAiCompatibleConfig {
|
|
|
19
19
|
* etc. (EC-2 fix).
|
|
20
20
|
*/
|
|
21
21
|
embeddingsPath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* theokit#159 — per-provider deviations from the OpenAI wire.
|
|
24
|
+
*
|
|
25
|
+
* The runtime was rigidly OpenAI-shaped: one auth header, one body, one response shape. Three of
|
|
26
|
+
* the ten catalog providers do not speak it, so every call they made was rejected — Azure
|
|
27
|
+
* authenticates with an `api-key` header and puts the deployment in the path, Cohere's `/v2/embed`
|
|
28
|
+
* takes `texts` and answers `{embeddings:{float}}`. Advertising a provider that cannot work is
|
|
29
|
+
* worse than not advertising it.
|
|
30
|
+
*
|
|
31
|
+
* Every hook is optional and its default is exactly the previous behaviour, so the seven
|
|
32
|
+
* providers that DO speak OpenAI are untouched.
|
|
33
|
+
*/
|
|
34
|
+
dialect?: EmbeddingDialect;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* theokit#159 — the three points where a provider may deviate from the OpenAI embedding wire.
|
|
38
|
+
*
|
|
39
|
+
* Deliberately three narrow hooks rather than a general "transform the request" seam: these are the
|
|
40
|
+
* only axes on which the supported providers actually differ, and a wider seam would invite
|
|
41
|
+
* per-provider logic that belongs in the adapter.
|
|
42
|
+
*/
|
|
43
|
+
export interface EmbeddingDialect {
|
|
44
|
+
/** Replaces `authorization: Bearer <key>`. */
|
|
45
|
+
authHeaders?: (apiKey: string) => Record<string, string>;
|
|
46
|
+
/** Replaces the `{ model, input }` request body. */
|
|
47
|
+
body?: (model: string, inputs: ReadonlyArray<string>) => Record<string, unknown>;
|
|
48
|
+
/** Replaces reading vectors from `json.data[].embedding`. Return `undefined` when unparseable. */
|
|
49
|
+
vectors?: (json: unknown) => number[][] | undefined;
|
|
22
50
|
}
|
|
23
51
|
export declare function createOpenAiCompatibleRuntime(cfg: OpenAiCompatibleConfig, options: CreateAdapterOptions): Promise<EmbeddingRuntime>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function diaryPath(cwd: string): string;
|
|
2
|
+
export declare function renderDiaryEntry(entry: DiaryEntry): string;
|
|
3
|
+
export declare function appendDiaryEntry(cwd: string, entry: DiaryEntry): Promise<void>;
|
|
4
|
+
export declare function entryHash(entry: DiaryEntry): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EmbeddingRuntime } from "../embedding-adapter.js";
|
|
2
|
+
import type { MemoryFact } from "../types.js";
|
|
3
|
+
export interface Cluster {
|
|
4
|
+
representativeText: string;
|
|
5
|
+
members: ReadonlyArray<MemoryFact>;
|
|
6
|
+
}
|
|
7
|
+
export interface ClusterResult {
|
|
8
|
+
clusters: Cluster[];
|
|
9
|
+
}
|
|
10
|
+
/** Light phase — drop facts whose embedding is too similar to one already kept. */
|
|
11
|
+
export declare function lightPhase(facts: ReadonlyArray<MemoryFact>, embedding: EmbeddingRuntime, threshold?: number): Promise<DedupResult>;
|
|
12
|
+
/** REM phase — single-link agglomerative clustering by cosine similarity. */
|
|
13
|
+
export declare function remPhase(facts: ReadonlyArray<MemoryFact>, embedding: EmbeddingRuntime, threshold?: number, maxFactsPerSweep?: number): Promise<ClusterResult>;
|
|
14
|
+
/** Deep phase — render consolidated markdown for the dreamed note. */
|
|
15
|
+
export declare function deepPhase(clusters: ReadonlyArray<Cluster>, timestampMs: number): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface DreamingResult {
|
|
2
|
+
status: "ok" | "skipped" | "error";
|
|
3
|
+
factsBefore: number;
|
|
4
|
+
factsAfter: number;
|
|
5
|
+
duplicatesRemoved: number;
|
|
6
|
+
clustersCreated: number;
|
|
7
|
+
notesWritten: number;
|
|
8
|
+
diaryEntryHash: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function runDreamingSweep(options: DreamingOptions): Promise<DreamingResult>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface MigrateResult {
|
|
2
|
+
countSqlite: number;
|
|
3
|
+
countLance: number;
|
|
4
|
+
/** Set when validation succeeded (or dryRun); false on validation failure. */
|
|
5
|
+
validated: boolean;
|
|
6
|
+
/** Per-fact compare results (size = sample count, up to 10). */
|
|
7
|
+
sampleComparisons: ReadonlyArray<{
|
|
8
|
+
id: string;
|
|
9
|
+
match: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
/** Lance storage location (final, after migration). */
|
|
12
|
+
lancePath: string;
|
|
13
|
+
/** Was the migration committed (false for dry-run). */
|
|
14
|
+
committed: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK 2.0 Phase 4 (Stage 4) — Optional peer loader for
|
|
3
|
+
* `@theokit/sdk-memory`.
|
|
4
|
+
*
|
|
5
|
+
* The Memory class public API in `src/memory.ts` keeps its surface
|
|
6
|
+
* stable but routes through sdk-memory when installed. When sdk-memory
|
|
7
|
+
* is NOT installed, methods fall back to sdk-core's legacy
|
|
8
|
+
* `internal/memory/*` implementations — preserving v1.x back-compat.
|
|
9
|
+
*
|
|
10
|
+
* Pattern mirrors sdk-handoff's optional-peer dynamic import: try
|
|
11
|
+
* `await import("@theokit/sdk-memory")` once, cache the result (the
|
|
12
|
+
* module OR `null` for "definitively missing"), and let the caller
|
|
13
|
+
* route.
|
|
14
|
+
*
|
|
15
|
+
* Iter 76 (Stage 4 #1): foundation helper for the Memory class
|
|
16
|
+
* delegation refactor. No behavior changes yet — this iter only
|
|
17
|
+
* adds the loader; iter 77+ wires Memory class methods to use it.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* readable 0o644 under typical umask 022. Callers writing non-sensitive
|
|
12
12
|
* files can pass `mode: 0o644` explicitly.
|
|
13
13
|
*
|
|
14
|
-
* NFS
|
|
15
|
-
* `withFileLock`); SDK target
|
|
14
|
+
* NFS not honoring O_EXCL is documented (D61 — same stance as
|
|
15
|
+
* `withFileLock`); the SDK target is ext4/APFS/NTFS.
|
|
16
16
|
*
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* readable 0o644 under typical umask 022. Callers writing non-sensitive
|
|
12
12
|
* files can pass `mode: 0o644` explicitly.
|
|
13
13
|
*
|
|
14
|
-
* NFS
|
|
15
|
-
* `withFileLock`); SDK target
|
|
14
|
+
* NFS not honoring O_EXCL is documented (D61 — same stance as
|
|
15
|
+
* `withFileLock`); the SDK target is ext4/APFS/NTFS.
|
|
16
16
|
*
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
@@ -32,34 +32,34 @@ export declare class FsSessionStore implements SessionStore {
|
|
|
32
32
|
readRecords(agentId: string): Promise<SessionRecord[]>;
|
|
33
33
|
appendRecords(agentId: string, records: readonly SessionRecord[]): Promise<void>;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Takes the session's writer lease. Throws `SessionBusyError` when another process holds it.
|
|
36
36
|
*
|
|
37
|
-
* **
|
|
38
|
-
*
|
|
39
|
-
* stderr, NOT thrown to the caller (best-effort write)".
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* stderr
|
|
37
|
+
* **Explicit, and NOT inside `appendRecords`** — M95's adversarial review measured why that
|
|
38
|
+
* matters: the `SessionStore` contract states that "an `appendRecords` rejection is logged to
|
|
39
|
+
* stderr, NOT thrown to the caller (best-effort write)". Acquiring there made the
|
|
40
|
+
* `SessionBusyError` get **swallowed**, and the result was worse than the original problem:
|
|
41
|
+
* instead of two writers interleaving lines, the loser **lost the turn silently** — nothing on
|
|
42
|
+
* disk, a stderr warning invisible under the TUI, and no way for the caller to react.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* At init the error reaches someone who can act: `exec` forks to a new id, which is exactly what
|
|
45
|
+
* the error message itself prescribes. It is the difference between failing where a decision is
|
|
46
|
+
* possible and failing where only loss is.
|
|
47
47
|
*/
|
|
48
48
|
acquire(agentId: string): Promise<void>;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Releases ONE agent's lease.
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* lease
|
|
52
|
+
* It exists because `dispose()` releases **every** lease the store holds, and a store injected by
|
|
53
|
+
* the consumer may serve several agents: an init that fails for agent B must not free agent A's
|
|
54
|
+
* lease, which is still live and writing.
|
|
55
55
|
*/
|
|
56
56
|
release(agentId: string): Promise<void>;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Releases every lease this store holds.
|
|
59
59
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
60
|
+
* Without it the `.writer.lock` outlives the process and the next open would have to wait out the
|
|
61
|
+
* heartbeat window — recoverable, but 30 s of waiting after a CLEAN shutdown would be an avoidable
|
|
62
|
+
* defect. Idempotent: calling it twice is not an error.
|
|
63
63
|
*/
|
|
64
64
|
dispose(): Promise<void>;
|
|
65
65
|
}
|
|
@@ -32,34 +32,34 @@ export declare class FsSessionStore implements SessionStore {
|
|
|
32
32
|
readRecords(agentId: string): Promise<SessionRecord[]>;
|
|
33
33
|
appendRecords(agentId: string, records: readonly SessionRecord[]): Promise<void>;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Takes the session's writer lease. Throws `SessionBusyError` when another process holds it.
|
|
36
36
|
*
|
|
37
|
-
* **
|
|
38
|
-
*
|
|
39
|
-
* stderr, NOT thrown to the caller (best-effort write)".
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* stderr
|
|
37
|
+
* **Explicit, and NOT inside `appendRecords`** — M95's adversarial review measured why that
|
|
38
|
+
* matters: the `SessionStore` contract states that "an `appendRecords` rejection is logged to
|
|
39
|
+
* stderr, NOT thrown to the caller (best-effort write)". Acquiring there made the
|
|
40
|
+
* `SessionBusyError` get **swallowed**, and the result was worse than the original problem:
|
|
41
|
+
* instead of two writers interleaving lines, the loser **lost the turn silently** — nothing on
|
|
42
|
+
* disk, a stderr warning invisible under the TUI, and no way for the caller to react.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
44
|
+
* At init the error reaches someone who can act: `exec` forks to a new id, which is exactly what
|
|
45
|
+
* the error message itself prescribes. It is the difference between failing where a decision is
|
|
46
|
+
* possible and failing where only loss is.
|
|
47
47
|
*/
|
|
48
48
|
acquire(agentId: string): Promise<void>;
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* Releases ONE agent's lease.
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* lease
|
|
52
|
+
* It exists because `dispose()` releases **every** lease the store holds, and a store injected by
|
|
53
|
+
* the consumer may serve several agents: an init that fails for agent B must not free agent A's
|
|
54
|
+
* lease, which is still live and writing.
|
|
55
55
|
*/
|
|
56
56
|
release(agentId: string): Promise<void>;
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Releases every lease this store holds.
|
|
59
59
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
60
|
+
* Without it the `.writer.lock` outlives the process and the next open would have to wait out the
|
|
61
|
+
* heartbeat window — recoverable, but 30 s of waiting after a CLEAN shutdown would be an avoidable
|
|
62
|
+
* defect. Idempotent: calling it twice is not an error.
|
|
63
63
|
*/
|
|
64
64
|
dispose(): Promise<void>;
|
|
65
65
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkPNVDQL5Y_cjs = require('../../chunk-PNVDQL5Y.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var chunkLALG2K33_cjs = require('../../chunk-LALG2K33.cjs');
|
|
5
|
+
var chunkDMTZ3FII_cjs = require('../../chunk-DMTZ3FII.cjs');
|
|
6
|
+
var chunk75DSEWTJ_cjs = require('../../chunk-75DSEWTJ.cjs');
|
|
7
7
|
var chunkYLQQX5W2_cjs = require('../../chunk-YLQQX5W2.cjs');
|
|
8
|
-
var
|
|
9
|
-
require('../../chunk-
|
|
10
|
-
require('../../chunk-
|
|
8
|
+
var chunkDGLLVCNB_cjs = require('../../chunk-DGLLVCNB.cjs');
|
|
9
|
+
require('../../chunk-IHFNRNTJ.cjs');
|
|
10
|
+
require('../../chunk-BCQ3E2ZG.cjs');
|
|
11
11
|
var promises = require('fs/promises');
|
|
12
12
|
|
|
13
13
|
async function createExclusive(path, data, options) {
|
|
@@ -41,67 +41,67 @@ Object.defineProperty(exports, "PersistenceSchema", {
|
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "displayTheokitHome", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkLALG2K33_cjs.displayTheokitHome; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "getProfilesRoot", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkLALG2K33_cjs.getProfilesRoot; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "getTheokitHome", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkLALG2K33_cjs.getTheokitHome; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "migrateSchema", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkLALG2K33_cjs.migrateSchema; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "readVersionedJson", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkLALG2K33_cjs.readVersionedJson; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "writeVersionedJson", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function () { return
|
|
64
|
+
get: function () { return chunkLALG2K33_cjs.writeVersionedJson; }
|
|
65
65
|
});
|
|
66
66
|
Object.defineProperty(exports, "JsonlParseError", {
|
|
67
67
|
enumerable: true,
|
|
68
|
-
get: function () { return
|
|
68
|
+
get: function () { return chunkDMTZ3FII_cjs.JsonlParseError; }
|
|
69
69
|
});
|
|
70
70
|
Object.defineProperty(exports, "appendJsonl", {
|
|
71
71
|
enumerable: true,
|
|
72
|
-
get: function () { return
|
|
72
|
+
get: function () { return chunkDMTZ3FII_cjs.appendJsonl; }
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "loadJsonl", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function () { return
|
|
76
|
+
get: function () { return chunkDMTZ3FII_cjs.loadJsonl; }
|
|
77
77
|
});
|
|
78
78
|
Object.defineProperty(exports, "readJsonlIds", {
|
|
79
79
|
enumerable: true,
|
|
80
|
-
get: function () { return
|
|
80
|
+
get: function () { return chunkDMTZ3FII_cjs.readJsonlIds; }
|
|
81
81
|
});
|
|
82
82
|
Object.defineProperty(exports, "withFileLock", {
|
|
83
83
|
enumerable: true,
|
|
84
|
-
get: function () { return
|
|
84
|
+
get: function () { return chunkDMTZ3FII_cjs.withFileLock; }
|
|
85
85
|
});
|
|
86
86
|
Object.defineProperty(exports, "applyWalWithFallback", {
|
|
87
87
|
enumerable: true,
|
|
88
|
-
get: function () { return
|
|
88
|
+
get: function () { return chunk75DSEWTJ_cjs.applyWalWithFallback; }
|
|
89
89
|
});
|
|
90
90
|
Object.defineProperty(exports, "containsCjk", {
|
|
91
91
|
enumerable: true,
|
|
92
|
-
get: function () { return
|
|
92
|
+
get: function () { return chunk75DSEWTJ_cjs.containsCjk; }
|
|
93
93
|
});
|
|
94
94
|
Object.defineProperty(exports, "isCorruptionError", {
|
|
95
95
|
enumerable: true,
|
|
96
|
-
get: function () { return
|
|
96
|
+
get: function () { return chunk75DSEWTJ_cjs.isCorruptionError; }
|
|
97
97
|
});
|
|
98
98
|
Object.defineProperty(exports, "openSqliteResilient", {
|
|
99
99
|
enumerable: true,
|
|
100
|
-
get: function () { return
|
|
100
|
+
get: function () { return chunk75DSEWTJ_cjs.openSqliteResilient; }
|
|
101
101
|
});
|
|
102
102
|
Object.defineProperty(exports, "sanitizeFts5Query", {
|
|
103
103
|
enumerable: true,
|
|
104
|
-
get: function () { return
|
|
104
|
+
get: function () { return chunk75DSEWTJ_cjs.sanitizeFts5Query; }
|
|
105
105
|
});
|
|
106
106
|
Object.defineProperty(exports, "withCwdMutex", {
|
|
107
107
|
enumerable: true,
|
|
@@ -109,15 +109,15 @@ Object.defineProperty(exports, "withCwdMutex", {
|
|
|
109
109
|
});
|
|
110
110
|
Object.defineProperty(exports, "atomicWriteJson", {
|
|
111
111
|
enumerable: true,
|
|
112
|
-
get: function () { return
|
|
112
|
+
get: function () { return chunkDGLLVCNB_cjs.atomicWriteJson; }
|
|
113
113
|
});
|
|
114
114
|
Object.defineProperty(exports, "atomicWriteText", {
|
|
115
115
|
enumerable: true,
|
|
116
|
-
get: function () { return
|
|
116
|
+
get: function () { return chunkDGLLVCNB_cjs.atomicWriteText; }
|
|
117
117
|
});
|
|
118
118
|
Object.defineProperty(exports, "replaceFileAtomic", {
|
|
119
119
|
enumerable: true,
|
|
120
|
-
get: function () { return
|
|
120
|
+
get: function () { return chunkDGLLVCNB_cjs.replaceFileAtomic; }
|
|
121
121
|
});
|
|
122
122
|
exports.casUpdate = casUpdate;
|
|
123
123
|
exports.createExclusive = createExclusive;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/internal/persistence/exclusive-create.ts","../../../src/internal/persistence/sqlite-cas.ts"],"names":["open"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,eAAA,CACpB,IAAA,EACA,IAAA,EACA,OAAA,EACkB;AAClB,EAAA,MAAM,IAAA,GAAO,SAAS,IAAA,IAAQ,GAAA;AAC9B,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,MAAMA,aAAA,CAAK,IAAA,EAAM,MAAM,IAAI,CAAA;AAC1C,IAAA,IAAI;AACF,MAAA,MAAM,MAAA,CAAO,UAAU,IAAI,CAAA;AAC3B,MAAA,OAAO,IAAA;AAAA,IACT,CAAA,SAAE;AACA,MAAA,MAAM,OAAO,KAAA,EAAM;AAAA,IACrB;AAAA,EACF,SAAS,GAAA,EAAK;AACZ,IAAA,IAAK,GAAA,CAA8B,SAAS,QAAA,EAAU;AACpD,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,MAAM,GAAA;AAAA,EACR;AACF;;;ACjBO,SAAS,SAAA,CACd,EAAA,EACA,GAAA,EACA,MAAA,EACA,kBAA0B,CAAA,EACjB;AACT,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AAC3B,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,GAAA,CAAI,GAAI,MAAoB,CAAA;AAChD,EAAA,OAAO,OAAO,OAAA,KAAY,eAAA;AAC5B","file":"index.cjs","sourcesContent":["/**\n * O_EXCL exclusive file creation (ADR D82).\n *\n * `createExclusive(path, data, { mode })` creates a file in a single\n * syscall (`open(path, \"wx\", mode)`). Returns `true` if created, `false`\n * if it already existed (EEXIST swallowed — caller decides). All other\n * errors propagate.\n *\n * Default mode is 0o600 (owner-only) — EC-2 fix from edge-case review:\n * token files, lockfiles, and PID files MUST NOT default to world-\n * readable 0o644 under typical umask 022. Callers writing non-sensitive\n * files can pass `mode: 0o644` explicitly.\n *\n * NFS
|
|
1
|
+
{"version":3,"sources":["../../../src/internal/persistence/exclusive-create.ts","../../../src/internal/persistence/sqlite-cas.ts"],"names":["open"],"mappings":";;;;;;;;;;;;AAgCA,eAAsB,eAAA,CACpB,IAAA,EACA,IAAA,EACA,OAAA,EACkB;AAClB,EAAA,MAAM,IAAA,GAAO,SAAS,IAAA,IAAQ,GAAA;AAC9B,EAAA,IAAI;AACF,IAAA,MAAM,MAAA,GAAS,MAAMA,aAAA,CAAK,IAAA,EAAM,MAAM,IAAI,CAAA;AAC1C,IAAA,IAAI;AACF,MAAA,MAAM,MAAA,CAAO,UAAU,IAAI,CAAA;AAC3B,MAAA,OAAO,IAAA;AAAA,IACT,CAAA,SAAE;AACA,MAAA,MAAM,OAAO,KAAA,EAAM;AAAA,IACrB;AAAA,EACF,SAAS,GAAA,EAAK;AACZ,IAAA,IAAK,GAAA,CAA8B,SAAS,QAAA,EAAU;AACpD,MAAA,OAAO,KAAA;AAAA,IACT;AACA,IAAA,MAAM,GAAA;AAAA,EACR;AACF;;;ACjBO,SAAS,SAAA,CACd,EAAA,EACA,GAAA,EACA,MAAA,EACA,kBAA0B,CAAA,EACjB;AACT,EAAA,MAAM,IAAA,GAAO,EAAA,CAAG,OAAA,CAAQ,GAAG,CAAA;AAC3B,EAAA,MAAM,MAAA,GAAS,IAAA,CAAK,GAAA,CAAI,GAAI,MAAoB,CAAA;AAChD,EAAA,OAAO,OAAO,OAAA,KAAY,eAAA;AAC5B","file":"index.cjs","sourcesContent":["/**\n * O_EXCL exclusive file creation (ADR D82).\n *\n * `createExclusive(path, data, { mode })` creates a file in a single\n * syscall (`open(path, \"wx\", mode)`). Returns `true` if created, `false`\n * if it already existed (EEXIST swallowed — caller decides). All other\n * errors propagate.\n *\n * Default mode is 0o600 (owner-only) — EC-2 fix from edge-case review:\n * token files, lockfiles, and PID files MUST NOT default to world-\n * readable 0o644 under typical umask 022. Callers writing non-sensitive\n * files can pass `mode: 0o644` explicitly.\n *\n * NFS not honoring O_EXCL is documented (D61 — same stance as\n * `withFileLock`); the SDK target is ext4/APFS/NTFS.\n *\n * @internal\n */\n\nimport { open } from \"node:fs/promises\";\n\nexport interface CreateExclusiveOptions {\n /** Unix mode for the new file (default 0o600 — owner-only). */\n mode?: number;\n}\n\n/**\n * Atomically create `path` with `data`. Returns true iff this call\n * created the file (race-free under POSIX-compliant filesystems).\n *\n * @internal\n */\nexport async function createExclusive(\n path: string,\n data: string | Uint8Array,\n options?: CreateExclusiveOptions,\n): Promise<boolean> {\n const mode = options?.mode ?? 0o600;\n try {\n const handle = await open(path, \"wx\", mode);\n try {\n await handle.writeFile(data);\n return true;\n } finally {\n await handle.close();\n }\n } catch (err) {\n if ((err as NodeJS.ErrnoException).code === \"EEXIST\") {\n return false;\n }\n throw err;\n }\n}\n","/**\n * SQLite optimistic compare-and-swap (ADR D83).\n *\n * `casUpdate(db, sql, params, expectedChanges)` executes a prepared\n * UPDATE and returns true if `result.changes === expectedChanges`.\n * Caller provides the full SQL (including `WHERE version = ?` predicate);\n * helper does NOT generate SQL — DRY at the level of \"wrap the\n * convention\", not \"build queries\".\n *\n * Use case canonical (Hermes `kanban_db.py:1922-1934`):\n *\n * const won = casUpdate(\n * db,\n * \"UPDATE registry SET status = ?, version = version + 1 WHERE id = ? AND version = ?\",\n * [\"running\", \"agent-foo\", 3],\n * );\n * if (!won) { ... re-read and retry ... }\n *\n * Helper does NOT retry — caller responsible for backoff (avoids hidden\n * loops). Helper does NOT cache prepared statements — `better-sqlite3`\n * caches internally; SDK use is one-shot per mutation, not hot loops.\n *\n * @internal\n */\n\nimport type Database from \"better-sqlite3\";\n\ntype DatabaseInstance = InstanceType<typeof Database>;\n\n/**\n * Execute a CAS UPDATE. Returns true iff the actual changes count matches\n * `expectedChanges`. SQL errors (invalid syntax, closed db) propagate.\n *\n * @internal\n */\nexport function casUpdate(\n db: DatabaseInstance,\n sql: string,\n params: ReadonlyArray<unknown>,\n expectedChanges: number = 1,\n): boolean {\n const stmt = db.prepare(sql);\n const result = stmt.run(...(params as unknown[]));\n return result.changes === expectedChanges;\n}\n"]}
|