@theokit/sdk 5.13.0 → 5.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/dist/{agent-DSMuwADp.d.ts → agent-B6C9i_qu.d.ts} +31 -213
- package/dist/{agent-iW5kPpfT.d.cts → agent-B6FQad6P.d.cts} +31 -213
- package/dist/{agent-5DSDDH7K.js → agent-DRDGUU6T.js} +21 -20
- package/dist/{agent-5DSDDH7K.js.map → agent-DRDGUU6T.js.map} +1 -1
- package/dist/{agent-WOMRT3KX.cjs → agent-VI2HITPT.cjs} +22 -21
- package/dist/{agent-WOMRT3KX.cjs.map → agent-VI2HITPT.cjs.map} +1 -1
- package/dist/agent.d.ts +2 -3
- package/dist/auth/index.cjs +17 -16
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +5 -4
- package/dist/auth/index.js.map +1 -1
- package/dist/{batch-EP3FCL6D.js → batch-N2XDYZED.js} +4 -4
- package/dist/{batch-EP3FCL6D.js.map → batch-N2XDYZED.js.map} +1 -1
- package/dist/{batch-IZ5EDKJ5.cjs → batch-VFR2MAUE.cjs} +7 -7
- package/dist/{batch-IZ5EDKJ5.cjs.map → batch-VFR2MAUE.cjs.map} +1 -1
- package/dist/{chunk-XOYNB3YN.js → chunk-23SS4ID4.js} +3 -3
- package/dist/{chunk-XOYNB3YN.js.map → chunk-23SS4ID4.js.map} +1 -1
- package/dist/{chunk-NHOEXFZT.js → chunk-2HXTNVLM.js} +5 -2
- package/dist/chunk-2HXTNVLM.js.map +1 -0
- package/dist/{chunk-2C24NSNV.js → chunk-3BBTHFGJ.js} +3 -3
- package/dist/{chunk-2C24NSNV.js.map → chunk-3BBTHFGJ.js.map} +1 -1
- package/dist/{chunk-NP362THY.cjs → chunk-3F53FLQ7.cjs} +5 -7
- package/dist/chunk-3F53FLQ7.cjs.map +1 -0
- package/dist/{chunk-3FSBE4PS.js → chunk-3GTN4HOO.js} +10 -6
- package/dist/chunk-3GTN4HOO.js.map +1 -0
- package/dist/{chunk-7WARNHWW.cjs → chunk-3UMPP553.cjs} +5 -2
- package/dist/chunk-3UMPP553.cjs.map +1 -0
- package/dist/{chunk-SXH37C7X.cjs → chunk-55LLQFHW.cjs} +6 -6
- package/dist/{chunk-SXH37C7X.cjs.map → chunk-55LLQFHW.cjs.map} +1 -1
- package/dist/{chunk-QISSETTG.cjs → chunk-5645PMVU.cjs} +6 -4
- package/dist/chunk-5645PMVU.cjs.map +1 -0
- package/dist/{chunk-JX4LB6XO.js → chunk-5M5GQYBM.js} +617 -250
- package/dist/chunk-5M5GQYBM.js.map +1 -0
- package/dist/{chunk-KL7ZUMK3.cjs → chunk-64ECM3XM.cjs} +704 -337
- package/dist/chunk-64ECM3XM.cjs.map +1 -0
- package/dist/{chunk-ZJAYFSVI.js → chunk-7ACS6P5Z.js} +5 -7
- package/dist/chunk-7ACS6P5Z.js.map +1 -0
- package/dist/{chunk-5A4UFBHW.cjs → chunk-A77UMVMD.cjs} +15 -11
- package/dist/chunk-A77UMVMD.cjs.map +1 -0
- package/dist/{chunk-ZTP6ZACR.js → chunk-ARC2V7NY.js} +3 -3
- package/dist/{chunk-ZTP6ZACR.js.map → chunk-ARC2V7NY.js.map} +1 -1
- package/dist/{chunk-WDVG5R2Q.cjs → chunk-AUH2EVWY.cjs} +4 -3
- package/dist/chunk-AUH2EVWY.cjs.map +1 -0
- package/dist/chunk-BNEUB52I.cjs +55 -0
- package/dist/chunk-BNEUB52I.cjs.map +1 -0
- package/dist/chunk-BPL5CVZ5.js +53 -0
- package/dist/chunk-BPL5CVZ5.js.map +1 -0
- package/dist/{chunk-2SFLLOMN.js → chunk-CBBT42VX.js} +3 -3
- package/dist/{chunk-2SFLLOMN.js.map → chunk-CBBT42VX.js.map} +1 -1
- package/dist/chunk-CHKV2L2Y.cjs +416 -0
- package/dist/chunk-CHKV2L2Y.cjs.map +1 -0
- package/dist/{chunk-4UYHP6NF.cjs → chunk-DJKGDLYZ.cjs} +93 -63
- package/dist/chunk-DJKGDLYZ.cjs.map +1 -0
- package/dist/{chunk-354F3OF5.js → chunk-FGGVSHDW.js} +3 -3
- package/dist/{chunk-354F3OF5.js.map → chunk-FGGVSHDW.js.map} +1 -1
- package/dist/{chunk-6OCJWGVD.cjs → chunk-FTXY4D44.cjs} +4 -4
- package/dist/{chunk-6OCJWGVD.cjs.map → chunk-FTXY4D44.cjs.map} +1 -1
- package/dist/chunk-INVEGVGO.js +405 -0
- package/dist/chunk-INVEGVGO.js.map +1 -0
- package/dist/{chunk-2PRGRYEQ.js → chunk-IOBHFP2E.js} +50 -20
- package/dist/chunk-IOBHFP2E.js.map +1 -0
- package/dist/{chunk-47EACDOC.cjs → chunk-KMFBNKCT.cjs} +4 -4
- package/dist/{chunk-47EACDOC.cjs.map → chunk-KMFBNKCT.cjs.map} +1 -1
- package/dist/{chunk-DF77RBF4.js → chunk-LCCT5ZXJ.js} +6 -6
- package/dist/{chunk-DF77RBF4.js.map → chunk-LCCT5ZXJ.js.map} +1 -1
- package/dist/{chunk-G7XBVM3T.cjs → chunk-MHUOVS5I.cjs} +5 -5
- package/dist/{chunk-G7XBVM3T.cjs.map → chunk-MHUOVS5I.cjs.map} +1 -1
- package/dist/{chunk-CWQPQTUZ.cjs → chunk-NEH3BPFD.cjs} +15 -15
- package/dist/{chunk-CWQPQTUZ.cjs.map → chunk-NEH3BPFD.cjs.map} +1 -1
- package/dist/{chunk-5AR6O7GW.js → chunk-NK5EOTDY.js} +3 -3
- package/dist/{chunk-5AR6O7GW.js.map → chunk-NK5EOTDY.js.map} +1 -1
- package/dist/{chunk-S46WJTDL.cjs → chunk-P7QYG4RZ.cjs} +27 -19
- package/dist/chunk-P7QYG4RZ.cjs.map +1 -0
- package/dist/chunk-PPU2D4FZ.js +19 -0
- package/dist/chunk-PPU2D4FZ.js.map +1 -0
- package/dist/{chunk-MS3TQSXU.js → chunk-QD6B6W6I.js} +6 -4
- package/dist/chunk-QD6B6W6I.js.map +1 -0
- package/dist/{chunk-AB4OPJLD.js → chunk-RGVMJU57.js} +3 -3
- package/dist/{chunk-AB4OPJLD.js.map → chunk-RGVMJU57.js.map} +1 -1
- package/dist/{chunk-NWWTYBD3.cjs → chunk-RTDVSHJR.cjs} +5 -5
- package/dist/{chunk-NWWTYBD3.cjs.map → chunk-RTDVSHJR.cjs.map} +1 -1
- package/dist/{chunk-5HSMH2ZZ.js → chunk-RZL2W4C3.js} +25 -17
- package/dist/chunk-RZL2W4C3.js.map +1 -0
- package/dist/chunk-SPEN7RJU.cjs +18 -0
- package/dist/{chunk-LO6LIUZ6.cjs.map → chunk-SPEN7RJU.cjs.map} +1 -1
- package/dist/{chunk-ZF2LDKQQ.cjs → chunk-U3DW3WDE.cjs} +9 -8
- package/dist/chunk-U3DW3WDE.cjs.map +1 -0
- package/dist/{chunk-DVP3YMDA.cjs → chunk-U7PRI3XM.cjs} +3 -3
- package/dist/{chunk-DVP3YMDA.cjs.map → chunk-U7PRI3XM.cjs.map} +1 -1
- package/dist/{chunk-H7G65PNI.js → chunk-VCQ37TC5.js} +3 -3
- package/dist/{chunk-H7G65PNI.js.map → chunk-VCQ37TC5.js.map} +1 -1
- package/dist/{chunk-SDZ4XDWS.cjs → chunk-VWYFGE27.cjs} +9 -9
- package/dist/{chunk-SDZ4XDWS.cjs.map → chunk-VWYFGE27.cjs.map} +1 -1
- package/dist/{chunk-RN3XDZGS.js → chunk-WM646HEN.js} +4 -3
- package/dist/chunk-WM646HEN.js.map +1 -0
- package/dist/chunk-X7CE7Y5W.js +305 -0
- package/dist/chunk-X7CE7Y5W.js.map +1 -0
- package/dist/{chunk-CGH4BCIY.cjs → chunk-XE3CAY6Z.cjs} +5 -5
- package/dist/{chunk-CGH4BCIY.cjs.map → chunk-XE3CAY6Z.cjs.map} +1 -1
- package/dist/chunk-XOU3CL7S.cjs +312 -0
- package/dist/chunk-XOU3CL7S.cjs.map +1 -0
- package/dist/{chunk-NKQVLWDF.js → chunk-YKNBTHMD.js} +3 -3
- package/dist/{chunk-NKQVLWDF.js.map → chunk-YKNBTHMD.js.map} +1 -1
- package/dist/{compact-session-B7P6EU3Z.cjs → compact-session-NX7HUNTB.cjs} +18 -18
- package/dist/{compact-session-B7P6EU3Z.cjs.map → compact-session-NX7HUNTB.cjs.map} +1 -1
- package/dist/{compact-session-5HMX6KYT.js → compact-session-Q5IGNFPW.js} +9 -9
- package/dist/{compact-session-5HMX6KYT.js.map → compact-session-Q5IGNFPW.js.map} +1 -1
- package/dist/{cron-BvxrLW5J.d.cts → cron-Bh3aWgQ2.d.cts} +2 -2
- package/dist/{cron-DdKzwJqK.d.ts → cron-CCDxeeFZ.d.ts} +2 -2
- package/dist/cron.cjs +21 -20
- package/dist/cron.d.cts +4 -3
- package/dist/cron.d.ts +4 -3
- package/dist/cron.js +20 -19
- package/dist/eval.cjs +20 -19
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +19 -18
- package/dist/eval.js.map +1 -1
- package/dist/fs-session-store-CYNTEPJZ.cjs +20 -0
- package/dist/{fs-session-store-S2AXVJIX.cjs.map → fs-session-store-CYNTEPJZ.cjs.map} +1 -1
- package/dist/fs-session-store-MYQEVUFL.js +11 -0
- package/dist/{fs-session-store-6ZCCJX3K.js.map → fs-session-store-MYQEVUFL.js.map} +1 -1
- package/dist/{index-manager-HO456AVW.cjs → index-manager-2KH75BRW.cjs} +7 -7
- package/dist/{index-manager-HO456AVW.cjs.map → index-manager-2KH75BRW.cjs.map} +1 -1
- package/dist/{index-manager-QDH56FER.js → index-manager-NF2WRLOU.js} +6 -6
- package/dist/{index-manager-QDH56FER.js.map → index-manager-NF2WRLOU.js.map} +1 -1
- package/dist/index.cjs +93 -273
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -46
- package/dist/index.d.ts +13 -46
- package/dist/index.js +52 -236
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-75L3NCNL.js → inject-session-4ROYLZHY.js} +3 -3
- package/dist/{inject-session-75L3NCNL.js.map → inject-session-4ROYLZHY.js.map} +1 -1
- package/dist/{inject-session-WOH7TPDX.cjs → inject-session-AWKDCGHV.cjs} +4 -4
- package/dist/{inject-session-WOH7TPDX.cjs.map → inject-session-AWKDCGHV.cjs.map} +1 -1
- package/dist/internal/agent-loop/doom-loop-tracker.d.ts +3 -0
- package/dist/internal/agent-loop/prune-tool-results.d.ts +37 -0
- package/dist/internal/agent-loop/types.d.ts +6 -0
- package/dist/internal/auth/credential-store.d.ts +1 -1
- package/dist/internal/auth/types.d.ts +4 -0
- package/dist/internal/error-mappers/anthropic.d.ts +3 -0
- package/dist/internal/error-mappers/openai-compatible.d.ts +2 -3
- package/dist/internal/local-agent/local-agent-dispatch.d.ts +3 -1
- package/dist/internal/local-agent/send-queue.d.ts +31 -0
- package/dist/internal/mcp/client.d.ts +2 -0
- package/dist/internal/mcp/oauth-bearer.d.ts +2 -0
- package/dist/internal/memory/adapters/index.cjs +3 -3
- package/dist/internal/memory/adapters/index.js +2 -2
- package/dist/internal/memory/dreaming/phases.d.ts +15 -0
- package/dist/internal/memory/dreaming/run.d.ts +29 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +2 -0
- package/dist/internal/memory/storage/index.cjs +51 -35
- package/dist/internal/memory/storage/index.d.cts +2 -0
- package/dist/internal/memory/storage/index.d.ts +2 -0
- package/dist/internal/memory/storage/index.js +4 -4
- package/dist/internal/persistence/cwd-mutex.d.cts +4 -2
- package/dist/internal/persistence/cwd-mutex.d.ts +4 -2
- package/dist/internal/persistence/index.cjs +4 -4
- package/dist/internal/persistence/index.js +2 -2
- package/dist/internal/persistence/sqlite-session-store.d.cts +25 -0
- package/dist/internal/persistence/sqlite-session-store.d.ts +25 -0
- package/dist/internal/providers/registry.d.ts +5 -1
- package/dist/internal/runtime/skills/binary-on-path.d.ts +1 -0
- package/dist/internal/runtime/skills/discover-skills.d.ts +2 -0
- package/dist/mcp-auth.cjs +25 -307
- package/dist/mcp-auth.cjs.map +1 -1
- package/dist/mcp-auth.js +5 -305
- package/dist/mcp-auth.js.map +1 -1
- package/dist/models.cjs +11 -11
- package/dist/models.js +4 -4
- package/dist/persistence.cjs +9 -4
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.d.cts +744 -40
- package/dist/persistence.d.ts +744 -40
- package/dist/persistence.js +3 -2
- package/dist/persistence.js.map +1 -1
- package/dist/providers.cjs +6 -6
- package/dist/providers.js +4 -4
- package/dist/sandbox/docker-sandbox.d.cts +58 -0
- package/dist/sandbox/docker-sandbox.d.ts +58 -0
- package/dist/sandbox/index.cjs +129 -1
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +1 -0
- package/dist/sandbox/index.d.ts +1 -0
- package/dist/sandbox/index.js +132 -5
- package/dist/sandbox/index.js.map +1 -1
- package/dist/{sdk-agent-4-dXI2GS.d.cts → sdk-agent-BA_6_wtc.d.cts} +57 -4
- package/dist/{sdk-agent-CTOJlWA_.d.ts → sdk-agent-CnwPODYH.d.ts} +57 -4
- package/dist/session-store-Dh07jr9N.d.cts +209 -0
- package/dist/session-store-Dh07jr9N.d.ts +209 -0
- package/dist/skills.cjs +4 -4
- package/dist/skills.js +1 -1
- package/dist/sqlite-session-store-BbcpKY1L.d.ts +64 -0
- package/dist/sqlite-session-store-TKXtT4ON.d.cts +64 -0
- package/dist/subagents-loader-KLWF4QPD.cjs +16 -0
- package/dist/{subagents-loader-TXOA5EJJ.cjs.map → subagents-loader-KLWF4QPD.cjs.map} +1 -1
- package/dist/subagents-loader-SXETS2F2.js +7 -0
- package/dist/{subagents-loader-Z744TAKD.js.map → subagents-loader-SXETS2F2.js.map} +1 -1
- package/dist/subagents-loader.cjs +2 -2
- package/dist/subagents-loader.d.cts +3 -2
- package/dist/subagents-loader.d.ts +3 -2
- package/dist/subagents-loader.js +1 -1
- package/dist/types/agent.d.ts +20 -1
- package/dist/types/budget-tracker.d.ts +6 -2
- package/dist/types/mcp.d.ts +14 -0
- package/dist/types/run.d.ts +42 -3
- package/dist/workflow.d.cts +1 -1
- package/dist/workflow.d.ts +1 -1
- package/docs/adr/mutation-testing-scope.md +66 -0
- package/docs/error-codes.md +48 -45
- package/docs/harness-capability-map.md +60 -6
- package/package.json +1 -1
- package/dist/chunk-2PRGRYEQ.js.map +0 -1
- package/dist/chunk-3FSBE4PS.js.map +0 -1
- package/dist/chunk-4UYHP6NF.cjs.map +0 -1
- package/dist/chunk-5A4UFBHW.cjs.map +0 -1
- package/dist/chunk-5HSMH2ZZ.js.map +0 -1
- package/dist/chunk-6CXRYPG7.cjs +0 -211
- package/dist/chunk-6CXRYPG7.cjs.map +0 -1
- package/dist/chunk-7WARNHWW.cjs.map +0 -1
- package/dist/chunk-JX4LB6XO.js.map +0 -1
- package/dist/chunk-KL7ZUMK3.cjs.map +0 -1
- package/dist/chunk-LO6LIUZ6.cjs +0 -18
- package/dist/chunk-MS3TQSXU.js.map +0 -1
- package/dist/chunk-MSEL5E5P.js +0 -204
- package/dist/chunk-MSEL5E5P.js.map +0 -1
- package/dist/chunk-NHOEXFZT.js.map +0 -1
- package/dist/chunk-NP362THY.cjs.map +0 -1
- package/dist/chunk-Q5EWJPRY.js +0 -18
- package/dist/chunk-Q5EWJPRY.js.map +0 -1
- package/dist/chunk-QISSETTG.cjs.map +0 -1
- package/dist/chunk-RN3XDZGS.js.map +0 -1
- package/dist/chunk-S46WJTDL.cjs.map +0 -1
- package/dist/chunk-WDVG5R2Q.cjs.map +0 -1
- package/dist/chunk-ZF2LDKQQ.cjs.map +0 -1
- package/dist/chunk-ZJAYFSVI.js.map +0 -1
- package/dist/fs-session-store-6ZCCJX3K.js +0 -11
- package/dist/fs-session-store-S2AXVJIX.cjs +0 -20
- package/dist/subagents-loader-TXOA5EJJ.cjs +0 -16
- package/dist/subagents-loader-Z744TAKD.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { enqueueSessionWrite } from './chunk-
|
|
1
|
+
import { enqueueSessionWrite } from './chunk-23SS4ID4.js';
|
|
2
2
|
import { invalidateSessionCache } from './chunk-2XC6KDJM.js';
|
|
3
3
|
import './chunk-AGO5S5WD.js';
|
|
4
4
|
import { SessionTranscript } from './chunk-XESYJ4JC.js';
|
|
@@ -23,5 +23,5 @@ async function injectSessionTurn(opts) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { injectSessionTurn };
|
|
26
|
-
//# sourceMappingURL=inject-session-
|
|
27
|
-
//# sourceMappingURL=inject-session-
|
|
26
|
+
//# sourceMappingURL=inject-session-4ROYLZHY.js.map
|
|
27
|
+
//# sourceMappingURL=inject-session-4ROYLZHY.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-
|
|
1
|
+
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":[],"mappings":";;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAM,oBAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAA,sBAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-4ROYLZHY.js","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkU7PRI3XM_cjs = require('./chunk-U7PRI3XM.cjs');
|
|
4
4
|
var chunkYJNYDJ2T_cjs = require('./chunk-YJNYDJ2T.cjs');
|
|
5
5
|
require('./chunk-MSW7LB2V.cjs');
|
|
6
6
|
var chunk3WKWBYPO_cjs = require('./chunk-3WKWBYPO.cjs');
|
|
@@ -10,7 +10,7 @@ require('./chunk-RNXXYF22.cjs');
|
|
|
10
10
|
|
|
11
11
|
// src/internal/session/inject-session.ts
|
|
12
12
|
async function injectSessionTurn(opts) {
|
|
13
|
-
await
|
|
13
|
+
await chunkU7PRI3XM_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
14
14
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
15
15
|
const transcript = chunk3WKWBYPO_cjs.SessionTranscript.fromRecords(prior, {
|
|
16
16
|
cwd: opts.loc.cwd,
|
|
@@ -25,5 +25,5 @@ async function injectSessionTurn(opts) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
exports.injectSessionTurn = injectSessionTurn;
|
|
28
|
-
//# sourceMappingURL=inject-session-
|
|
29
|
-
//# sourceMappingURL=inject-session-
|
|
28
|
+
//# sourceMappingURL=inject-session-AWKDCGHV.cjs.map
|
|
29
|
+
//# sourceMappingURL=inject-session-AWKDCGHV.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-
|
|
1
|
+
{"version":3,"sources":["../src/internal/session/inject-session.ts"],"names":["enqueueSessionWrite","SessionTranscript","invalidateSessionCache"],"mappings":";;;;;;;;;;;AAWA,eAAsB,kBAAkB,IAAA,EAMtB;AAChB,EAAA,MAAMA,sCAAoB,IAAA,CAAK,GAAA,CAAI,KAAK,IAAA,CAAK,GAAA,CAAI,SAAS,YAAY;AACpE,IAAA,MAAM,QAAQ,MAAM,IAAA,CAAK,MAAM,WAAA,CAAY,IAAA,CAAK,IAAI,OAAO,CAAA;AAC3D,IAAA,MAAM,UAAA,GAAaC,mCAAA,CAAkB,WAAA,CAAY,KAAA,EAAO;AAAA,MACtD,GAAA,EAAK,KAAK,GAAA,CAAI,GAAA;AAAA,MACd,WAAW,IAAA,CAAK,SAAA;AAAA,MAChB,KAAA,EAAO,IAAA,CAAK,GAAA,CAAI,KAAA,IAAS;AAAA,KAC1B,CAAA;AACD,IAAA,UAAA,CAAW,cAAA,CAAe,KAAK,QAAQ,CAAA;AACvC,IAAA,UAAA,CAAW,mBAAA,CAAoB,EAAE,IAAA,EAAM,IAAA,CAAK,eAAe,CAAA;AAC3D,IAAA,MAAM,IAAA,CAAK,KAAA,CAAM,aAAA,CAAc,IAAA,CAAK,GAAA,CAAI,OAAA,EAAS,UAAA,CAAW,OAAA,EAAQ,CAAE,KAAA,CAAM,KAAA,CAAM,MAAM,CAAC,CAAA;AACzF,IAAAC,wCAAA,CAAuB,IAAA,CAAK,GAAA,CAAI,GAAA,EAAK,IAAA,CAAK,IAAI,OAAO,CAAA;AAAA,EACvD,CAAC,CAAA;AACH","file":"inject-session-AWKDCGHV.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
|
|
@@ -17,6 +17,9 @@ export interface DoomLoopVerdict {
|
|
|
17
17
|
export interface DoomLoopConfig {
|
|
18
18
|
softThreshold: number;
|
|
19
19
|
hardThreshold: number;
|
|
20
|
+
/** Consecutive same-tool calls with CHANGING arguments but an unchanged result (argument churn).
|
|
21
|
+
* Soft nudge at `churnThreshold - 2`, hard stop at `churnThreshold`. */
|
|
22
|
+
churnThreshold: number;
|
|
20
23
|
}
|
|
21
24
|
/** Public config on a send: `false` disables the guard; an object tunes the thresholds; absent = on. */
|
|
22
25
|
export type DoomLoopOption = false | Partial<DoomLoopConfig>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* B-564 — opt-in pruning of aged tool results from the next LLM request.
|
|
3
|
+
*
|
|
4
|
+
* The loop resends every tool result of a run on every later call; with
|
|
5
|
+
* `SendOptions.pruneToolResults` set, results older than `olderThanRounds` tool rounds are
|
|
6
|
+
* replaced by a short stub in the REQUEST copy only. The transcript the loop keeps, persists and
|
|
7
|
+
* resumes from is never touched, so a pruned result can always be recovered (plan D1).
|
|
8
|
+
*
|
|
9
|
+
* Position among tool-result messages is the round distance: at call n the newest tool-result
|
|
10
|
+
* message is round n - 1. So no round counter is threaded through the loop. Text-only feedback
|
|
11
|
+
* messages the loop pushes between rounds carry no `tool_result` part and do not count.
|
|
12
|
+
*
|
|
13
|
+
* A pruned part keeps its `toolUseId` and `isError`: every `tool_use` must still have a paired
|
|
14
|
+
* `tool_result` on both wires, so the result is shortened, never removed.
|
|
15
|
+
*/
|
|
16
|
+
import type { PruneToolResultsOptions } from "../../types/run.js";
|
|
17
|
+
import type { LlmMessage } from "../llm/types.js";
|
|
18
|
+
export type { PruneToolResultsOptions } from "../../types/run.js";
|
|
19
|
+
/**
|
|
20
|
+
* Build the messages for one LLM request with aged tool results replaced by a stub.
|
|
21
|
+
*
|
|
22
|
+
* Each new round stubs one more previously sent result, so on providers that cache message
|
|
23
|
+
* prefixes the cached prefix ends earlier; that cost was not measured.
|
|
24
|
+
*
|
|
25
|
+
* @param messages - The loop transcript. Never mutated.
|
|
26
|
+
* @param options - Absent means no pruning: the input array itself is returned, so the
|
|
27
|
+
* option-off request is byte-identical to the transcript.
|
|
28
|
+
* @returns A new array when `options` is set; untouched messages are the same objects.
|
|
29
|
+
*/
|
|
30
|
+
export declare function pruneToolResultsForRequest(messages: LlmMessage[], options: PruneToolResultsOptions | undefined): LlmMessage[];
|
|
31
|
+
/**
|
|
32
|
+
* Fail fast on an option that cannot describe an age in rounds.
|
|
33
|
+
*
|
|
34
|
+
* @throws ConfigurationError with code `invalid_prune_tool_results` when `olderThanRounds` is
|
|
35
|
+
* not an integer of at least 1.
|
|
36
|
+
*/
|
|
37
|
+
export declare function validatePruneToolResults(options: PruneToolResultsOptions | undefined): void;
|
|
@@ -3,6 +3,12 @@ import type { SDKMessage } from "../../types/messages.js";
|
|
|
3
3
|
import type { RunStatus } from "../../types/run.js";
|
|
4
4
|
/** SE7 — what a custom tool handler may return: a string or structured content blocks. */
|
|
5
5
|
export type ToolHandlerResult = string | import("../../types/content-blocks.js").ToolResultContentBlock[];
|
|
6
|
+
export interface SteerQueue {
|
|
7
|
+
/** Take every pending message. */
|
|
8
|
+
drain(): string[];
|
|
9
|
+
/** Like `drain`, but atomically refuses further pushes when nothing was pending. */
|
|
10
|
+
drainOrClose(): string[];
|
|
11
|
+
}
|
|
6
12
|
export interface AgentLoopOutput {
|
|
7
13
|
events: SDKMessage[];
|
|
8
14
|
finalStatus: RunStatus;
|
|
@@ -69,7 +69,7 @@ export declare function readStoredOAuth(config: CredentialStoreConfig, env?: Rec
|
|
|
69
69
|
* file in the same directory with `wx` (O_EXCL), fsync, close, chmod, then `rename` (atomic on POSIX) —
|
|
70
70
|
* so a crash mid-write leaves whatever was there untouched, and a pre-planted symlink cannot capture the
|
|
71
71
|
* key. The api variant persists the unchanged `{provider, api_key}` (back-compat, no `type` key); the
|
|
72
|
-
* oauth variant persists `{type:'oauth', provider, access, refresh, expires, account_id?}`.
|
|
72
|
+
* oauth variant persists `{type:'oauth', provider, access, refresh, expires, account_id?, id_token?}`.
|
|
73
73
|
*/
|
|
74
74
|
export declare function writeCredential(cred: {
|
|
75
75
|
provider: string;
|
|
@@ -109,6 +109,8 @@ export interface StoredOAuthCredential {
|
|
|
109
109
|
/** Epoch ms the access token expires. */
|
|
110
110
|
expires: number;
|
|
111
111
|
account_id?: string;
|
|
112
|
+
/** The provider's OpenID ID token, when its token endpoint returned one (#821). */
|
|
113
|
+
id_token?: string;
|
|
112
114
|
}
|
|
113
115
|
/**
|
|
114
116
|
* Whatever the credential file turned out to hold — the two variants are discriminated by `type`.
|
|
@@ -137,6 +139,8 @@ export interface OAuthTokens {
|
|
|
137
139
|
/** Epoch ms the access token expires. */
|
|
138
140
|
expires: number;
|
|
139
141
|
accountId?: string;
|
|
142
|
+
/** The OpenID ID token, when the token endpoint returned one (#821). */
|
|
143
|
+
idToken?: string;
|
|
140
144
|
}
|
|
141
145
|
/** Injected HTTP + clock effects — deterministic in tests, real in production. */
|
|
142
146
|
export interface HttpDeps {
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* mentions context length, else
|
|
11
11
|
* `"invalid_request"`; or
|
|
12
12
|
* `"content_filtered"` for policy.)
|
|
13
|
+
* 404 → `ConfigurationError` (`code: "model_unavailable"` when the
|
|
14
|
+
* body is a `not_found_error` naming a
|
|
15
|
+
* model; other 404s stay `unknown`.)
|
|
13
16
|
* 408 → `NetworkError` (`code: "timeout"`)
|
|
14
17
|
* 5xx → `NetworkError` (`code: "server_error"` — covers 529
|
|
15
18
|
* overloaded_error common at peak
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
* Body inspection: looks at `body.error.code` / `body.error.type` to detect
|
|
9
9
|
* `context_too_long`, `content_filtered`, `model_unavailable` semantics, and at
|
|
10
10
|
* `body.error.message` for a 404 that says no endpoint serves the model
|
|
11
|
-
* (OpenRouter's numeric-code body for a retired model id).
|
|
12
|
-
*
|
|
13
|
-
* characters; every other status keeps the bare message.
|
|
11
|
+
* (OpenRouter's numeric-code body for a retired model id). Every message
|
|
12
|
+
* ends with the provider's text, redacted and capped at 512 characters.
|
|
14
13
|
* Falls back to status-based mapping when body doesn't expose `.error`
|
|
15
14
|
* (e.g., HTML server error page, DeepInfra's `{message: "..."}` shape).
|
|
16
15
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { AgentDefinition, AgentOptions, ModelSelection } from "../../types/agent.js";
|
|
8
8
|
import type { Run, SDKUserMessage, SendOptions } from "../../types/run.js";
|
|
9
|
-
import type { MemoryToolSpec } from "../agent-loop/types.js";
|
|
9
|
+
import type { MemoryToolSpec, SteerQueue } from "../agent-loop/types.js";
|
|
10
10
|
import type { PersonalityPreset } from "../personality/types.js";
|
|
11
11
|
import type { PluginManager } from "../plugins/manager.js";
|
|
12
12
|
import type { HooksExecutor } from "../runtime/hooks/hooks-executor.js";
|
|
@@ -34,6 +34,7 @@ export declare function buildRealRunOptions(args: {
|
|
|
34
34
|
memoryTools: ReadonlyArray<MemoryToolSpec> | undefined;
|
|
35
35
|
personalityToolWhitelist?: ReadonlyArray<string>;
|
|
36
36
|
personalityName?: string;
|
|
37
|
+
steerQueue?: SteerQueue;
|
|
37
38
|
}): Parameters<typeof createRealLocalRun>[0];
|
|
38
39
|
export declare function createFixtureRunHelper(args: {
|
|
39
40
|
inputs: DispatchInputs;
|
|
@@ -54,4 +55,5 @@ export declare function dispatchLocalRun(args: {
|
|
|
54
55
|
}>;
|
|
55
56
|
memoryTools: ReadonlyArray<MemoryToolSpec> | undefined;
|
|
56
57
|
activePreset: PersonalityPreset | undefined;
|
|
58
|
+
steerQueue?: SteerQueue;
|
|
57
59
|
}): Promise<Run>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue-mode state for `LocalAgent.send` (`SendOptions.queueMode`): the steer queue of the turn in
|
|
3
|
+
* flight and the pending collect batch.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
import type { SteerQueue } from "../agent-loop/types.js";
|
|
8
|
+
/** Steer queue of one turn. Refuses pushes once closed so a late message is never silently lost. */
|
|
9
|
+
export declare class TurnSteerQueue implements SteerQueue {
|
|
10
|
+
private pending;
|
|
11
|
+
private closed;
|
|
12
|
+
/** @returns false when the turn can no longer pick the message up. */
|
|
13
|
+
push(text: string): boolean;
|
|
14
|
+
drain(): string[];
|
|
15
|
+
drainOrClose(): string[];
|
|
16
|
+
/** Stop accepting and hand back what no loop iteration picked up. */
|
|
17
|
+
closeAndTake(): string[];
|
|
18
|
+
}
|
|
19
|
+
/** The turn currently holding the send lock. */
|
|
20
|
+
export interface ActiveTurn {
|
|
21
|
+
readonly steer: TurnSteerQueue;
|
|
22
|
+
readonly run: Promise<Run>;
|
|
23
|
+
}
|
|
24
|
+
/** Messages waiting to become one followup turn. */
|
|
25
|
+
export interface CollectBatch {
|
|
26
|
+
readonly messages: Array<string | SDKUserMessage>;
|
|
27
|
+
readonly run: Promise<Run>;
|
|
28
|
+
}
|
|
29
|
+
/** Join a collected batch into the single message the batched turn sends. */
|
|
30
|
+
export declare function joinCollected(messages: ReadonlyArray<string | SDKUserMessage>): string | SDKUserMessage;
|
|
31
|
+
export declare function hasImages(message: string | SDKUserMessage): boolean;
|
|
@@ -8,6 +8,8 @@ export interface McpToolCallResult {
|
|
|
8
8
|
}
|
|
9
9
|
export interface McpClient {
|
|
10
10
|
readonly name: string;
|
|
11
|
+
/** `true` when the server's config sets `sequential`: the loop runs its calls one at a time. */
|
|
12
|
+
readonly sequential?: boolean;
|
|
11
13
|
initialize(): Promise<void>;
|
|
12
14
|
listTools(): Promise<McpTool[]>;
|
|
13
15
|
callTool(name: string, args: Record<string, unknown>): Promise<McpToolCallResult>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkXE3CAY6Z_cjs = require('../../../chunk-XE3CAY6Z.cjs');
|
|
4
4
|
var chunkGHX4P3V2_cjs = require('../../../chunk-GHX4P3V2.cjs');
|
|
5
|
-
require('../../../chunk-
|
|
5
|
+
require('../../../chunk-3F53FLQ7.cjs');
|
|
6
6
|
require('../../../chunk-QOGNZMHD.cjs');
|
|
7
7
|
require('../../../chunk-MUUQ2WFJ.cjs');
|
|
8
8
|
require('../../../chunk-3KIUY67P.cjs');
|
|
@@ -17,7 +17,7 @@ require('../../../chunk-RNXXYF22.cjs');
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "createOpenAiCompatibleRuntime", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkXE3CAY6Z_cjs.createOpenAiCompatibleRuntime; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "LruEmbeddingCache", {
|
|
23
23
|
enumerable: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { createOpenAiCompatibleRuntime } from '../../../chunk-
|
|
1
|
+
export { createOpenAiCompatibleRuntime } from '../../../chunk-VCQ37TC5.js';
|
|
2
2
|
export { LruEmbeddingCache, globalEmbeddingCache } from '../../../chunk-H73MEMQB.js';
|
|
3
|
-
import '../../../chunk-
|
|
3
|
+
import '../../../chunk-7ACS6P5Z.js';
|
|
4
4
|
import '../../../chunk-24MGQDK3.js';
|
|
5
5
|
import '../../../chunk-FD2UT76F.js';
|
|
6
6
|
import '../../../chunk-PKRPV3R7.js';
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import type { EmbeddingRuntime } from "../embedding-adapter.js";
|
|
2
2
|
import type { MemoryFact } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Dreaming/REM phase logic.
|
|
5
|
+
*
|
|
6
|
+
* Three phases:
|
|
7
|
+
* - **light** — drop near-duplicate facts (cosine similarity > 0.95).
|
|
8
|
+
* - **REM** — cluster thematically related facts (cosine ≥ 0.75).
|
|
9
|
+
* - **deep** — pick a representative bullet per cluster (longest text
|
|
10
|
+
* wins) and emit consolidated markdown notes.
|
|
11
|
+
*/
|
|
12
|
+
export interface DedupResult {
|
|
13
|
+
kept: MemoryFact[];
|
|
14
|
+
duplicatesRemoved: number;
|
|
15
|
+
}
|
|
16
|
+
/** A group of semantically similar facts, with the text chosen to represent them. */
|
|
3
17
|
export interface Cluster {
|
|
4
18
|
representativeText: string;
|
|
5
19
|
members: ReadonlyArray<MemoryFact>;
|
|
6
20
|
}
|
|
21
|
+
/** What clustering produced: the clusters and how many facts the per-sweep cap left out. */
|
|
7
22
|
export interface ClusterResult {
|
|
8
23
|
clusters: Cluster[];
|
|
9
24
|
/** How many input facts past the per-sweep cap were not clustered; 0 when none were. */
|
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
import type { EmbeddingRuntime } from "../embedding-adapter.js";
|
|
2
|
+
import { type MemoryRoot } from "../storage/memory-root.js";
|
|
3
|
+
/**
|
|
4
|
+
* Dreaming sweep orchestrator (ADR D7 of memory-system-peer-project-parity).
|
|
5
|
+
*
|
|
6
|
+
* Phases:
|
|
7
|
+
* 1. **light** — drop near-duplicate facts via cosine similarity.
|
|
8
|
+
* 2. **REM** — cluster thematically related facts.
|
|
9
|
+
* 3. **deep** — write a `notes/dreamed-<ts>.md` per sweep with consolidated
|
|
10
|
+
* clusters; append a diary entry.
|
|
11
|
+
*
|
|
12
|
+
* All file writes go through `replaceFileAtomic` (EC-3) and the entire sweep
|
|
13
|
+
* holds the per-cwd mutex so a `Remember:` append can't race it.
|
|
14
|
+
*/
|
|
15
|
+
export interface DreamingOptions {
|
|
16
|
+
cwd: string;
|
|
17
|
+
/**
|
|
18
|
+
* The memory root to sweep. Defaults to the project store — right for a caller with no
|
|
19
|
+
* `memory.directory`, and wrong for one that has it, which is why it is passable (#463).
|
|
20
|
+
*/
|
|
21
|
+
memoryRoot?: MemoryRoot;
|
|
22
|
+
embedding: EmbeddingRuntime;
|
|
23
|
+
dedupThreshold?: number;
|
|
24
|
+
clusterThreshold?: number;
|
|
25
|
+
/** Test hook — fixed timestamp for the run. */
|
|
26
|
+
now?: () => number;
|
|
27
|
+
}
|
|
28
|
+
/** Outcome of one dreaming sweep: counts before and after, and the note written. */
|
|
1
29
|
export interface DreamingResult {
|
|
2
30
|
status: "ok" | "skipped" | "error";
|
|
3
31
|
factsBefore: number;
|
|
@@ -12,4 +40,5 @@ export interface DreamingResult {
|
|
|
12
40
|
*/
|
|
13
41
|
factsLeftOut?: number;
|
|
14
42
|
}
|
|
43
|
+
/** Run one dreaming sweep (dedupe, cluster, write a consolidated note), serialised per `cwd`. */
|
|
15
44
|
export declare function runDreamingSweep(options: DreamingOptions): Promise<DreamingResult>;
|
|
@@ -34,6 +34,8 @@ export interface SdkMemoryModule {
|
|
|
34
34
|
/** Mirrors @theokit/sdk-memory's runDreamingSweep entrypoint. */
|
|
35
35
|
runDreamingSweep(opts: {
|
|
36
36
|
cwd: string;
|
|
37
|
+
/** The resolved memory root: facts, notes and diary live here (B-442). Absent means `<cwd>/.theokit/memory`. */
|
|
38
|
+
memoryRoot?: string;
|
|
37
39
|
embedding: any;
|
|
38
40
|
dedupThreshold?: number;
|
|
39
41
|
clusterThreshold?: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCHKV2L2Y_cjs = require('../../../chunk-CHKV2L2Y.cjs');
|
|
4
4
|
var chunkRS7YQR4X_cjs = require('../../../chunk-RS7YQR4X.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkVWYFGE27_cjs = require('../../../chunk-VWYFGE27.cjs');
|
|
6
6
|
require('../../../chunk-KRD3GQAA.cjs');
|
|
7
7
|
require('../../../chunk-MUUQ2WFJ.cjs');
|
|
8
8
|
require('../../../chunk-SWALPLFQ.cjs');
|
|
@@ -10,8 +10,8 @@ require('../../../chunk-3KIUY67P.cjs');
|
|
|
10
10
|
require('../../../chunk-SA6K24NB.cjs');
|
|
11
11
|
require('../../../chunk-3WKWBYPO.cjs');
|
|
12
12
|
require('../../../chunk-AT2PESXB.cjs');
|
|
13
|
-
require('../../../chunk-
|
|
14
|
-
require('../../../chunk-
|
|
13
|
+
require('../../../chunk-MHUOVS5I.cjs');
|
|
14
|
+
require('../../../chunk-U3DW3WDE.cjs');
|
|
15
15
|
require('../../../chunk-ZOFRNNZD.cjs');
|
|
16
16
|
require('../../../chunk-CEGU5AVD.cjs');
|
|
17
17
|
require('../../../chunk-RNXXYF22.cjs');
|
|
@@ -20,23 +20,39 @@ require('../../../chunk-RNXXYF22.cjs');
|
|
|
20
20
|
|
|
21
21
|
Object.defineProperty(exports, "appendDiaryEntry", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkCHKV2L2Y_cjs.appendDiaryEntry; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "deepPhase", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkCHKV2L2Y_cjs.deepPhase; }
|
|
24
28
|
});
|
|
25
29
|
Object.defineProperty(exports, "diaryPath", {
|
|
26
30
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkCHKV2L2Y_cjs.diaryPath; }
|
|
28
32
|
});
|
|
29
33
|
Object.defineProperty(exports, "entryHash", {
|
|
30
34
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkCHKV2L2Y_cjs.entryHash; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "lightPhase", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkCHKV2L2Y_cjs.lightPhase; }
|
|
32
40
|
});
|
|
33
41
|
Object.defineProperty(exports, "readAllSqliteFacts", {
|
|
34
42
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkCHKV2L2Y_cjs.readAllSqliteFacts; }
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "remPhase", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return chunkCHKV2L2Y_cjs.remPhase; }
|
|
36
48
|
});
|
|
37
49
|
Object.defineProperty(exports, "renderDiaryEntry", {
|
|
38
50
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkCHKV2L2Y_cjs.renderDiaryEntry; }
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "runDreamingSweep", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return chunkCHKV2L2Y_cjs.runDreamingSweep; }
|
|
40
56
|
});
|
|
41
57
|
Object.defineProperty(exports, "persistActiveMemoryTranscript", {
|
|
42
58
|
enumerable: true,
|
|
@@ -44,107 +60,107 @@ Object.defineProperty(exports, "persistActiveMemoryTranscript", {
|
|
|
44
60
|
});
|
|
45
61
|
Object.defineProperty(exports, "MEMORY_INDEX_MAX_BYTES", {
|
|
46
62
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkVWYFGE27_cjs.MEMORY_INDEX_MAX_BYTES; }
|
|
48
64
|
});
|
|
49
65
|
Object.defineProperty(exports, "MEMORY_INDEX_MAX_LINES", {
|
|
50
66
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkVWYFGE27_cjs.MEMORY_INDEX_MAX_LINES; }
|
|
52
68
|
});
|
|
53
69
|
Object.defineProperty(exports, "appendFact", {
|
|
54
70
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkVWYFGE27_cjs.appendFact; }
|
|
56
72
|
});
|
|
57
73
|
Object.defineProperty(exports, "appendFactToMarkdown", {
|
|
58
74
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkVWYFGE27_cjs.appendFactToMarkdown; }
|
|
60
76
|
});
|
|
61
77
|
Object.defineProperty(exports, "asMemoryRoot", {
|
|
62
78
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkVWYFGE27_cjs.asMemoryRoot; }
|
|
64
80
|
});
|
|
65
81
|
Object.defineProperty(exports, "ceilingReachedError", {
|
|
66
82
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkVWYFGE27_cjs.ceilingReachedError; }
|
|
68
84
|
});
|
|
69
85
|
Object.defineProperty(exports, "claudeProjectMemoryDir", {
|
|
70
86
|
enumerable: true,
|
|
71
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunkVWYFGE27_cjs.claudeProjectMemoryDir; }
|
|
72
88
|
});
|
|
73
89
|
Object.defineProperty(exports, "collectMarkdownFiles", {
|
|
74
90
|
enumerable: true,
|
|
75
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkVWYFGE27_cjs.collectMarkdownFiles; }
|
|
76
92
|
});
|
|
77
93
|
Object.defineProperty(exports, "defaultIndexPath", {
|
|
78
94
|
enumerable: true,
|
|
79
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunkVWYFGE27_cjs.defaultIndexPath; }
|
|
80
96
|
});
|
|
81
97
|
Object.defineProperty(exports, "discoverSessionFiles", {
|
|
82
98
|
enumerable: true,
|
|
83
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunkVWYFGE27_cjs.discoverSessionFiles; }
|
|
84
100
|
});
|
|
85
101
|
Object.defineProperty(exports, "discoverWikiFiles", {
|
|
86
102
|
enumerable: true,
|
|
87
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkVWYFGE27_cjs.discoverWikiFiles; }
|
|
88
104
|
});
|
|
89
105
|
Object.defineProperty(exports, "indexBudgetWarning", {
|
|
90
106
|
enumerable: true,
|
|
91
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkVWYFGE27_cjs.indexBudgetWarning; }
|
|
92
108
|
});
|
|
93
109
|
Object.defineProperty(exports, "lanceStoragePath", {
|
|
94
110
|
enumerable: true,
|
|
95
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunkVWYFGE27_cjs.lanceStoragePath; }
|
|
96
112
|
});
|
|
97
113
|
Object.defineProperty(exports, "memoryIndexRoot", {
|
|
98
114
|
enumerable: true,
|
|
99
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunkVWYFGE27_cjs.memoryIndexRoot; }
|
|
100
116
|
});
|
|
101
117
|
Object.defineProperty(exports, "memoryMdPath", {
|
|
102
118
|
enumerable: true,
|
|
103
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunkVWYFGE27_cjs.memoryMdPath; }
|
|
104
120
|
});
|
|
105
121
|
Object.defineProperty(exports, "memoryReadRoots", {
|
|
106
122
|
enumerable: true,
|
|
107
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunkVWYFGE27_cjs.memoryReadRoots; }
|
|
108
124
|
});
|
|
109
125
|
Object.defineProperty(exports, "notesDir", {
|
|
110
126
|
enumerable: true,
|
|
111
|
-
get: function () { return
|
|
127
|
+
get: function () { return chunkVWYFGE27_cjs.notesDir; }
|
|
112
128
|
});
|
|
113
129
|
Object.defineProperty(exports, "projectMemoryDir", {
|
|
114
130
|
enumerable: true,
|
|
115
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunkVWYFGE27_cjs.projectMemoryDir; }
|
|
116
132
|
});
|
|
117
133
|
Object.defineProperty(exports, "readFacts", {
|
|
118
134
|
enumerable: true,
|
|
119
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunkVWYFGE27_cjs.readFacts; }
|
|
120
136
|
});
|
|
121
137
|
Object.defineProperty(exports, "readFactsFromMarkdown", {
|
|
122
138
|
enumerable: true,
|
|
123
|
-
get: function () { return
|
|
139
|
+
get: function () { return chunkVWYFGE27_cjs.readFactsFromMarkdown; }
|
|
124
140
|
});
|
|
125
141
|
Object.defineProperty(exports, "resolveMaxFacts", {
|
|
126
142
|
enumerable: true,
|
|
127
|
-
get: function () { return
|
|
143
|
+
get: function () { return chunkVWYFGE27_cjs.resolveMaxFacts; }
|
|
128
144
|
});
|
|
129
145
|
Object.defineProperty(exports, "resolveMemoryRoot", {
|
|
130
146
|
enumerable: true,
|
|
131
|
-
get: function () { return
|
|
147
|
+
get: function () { return chunkVWYFGE27_cjs.resolveMemoryRoot; }
|
|
132
148
|
});
|
|
133
149
|
Object.defineProperty(exports, "sessionSummaryPath", {
|
|
134
150
|
enumerable: true,
|
|
135
|
-
get: function () { return
|
|
151
|
+
get: function () { return chunkVWYFGE27_cjs.sessionSummaryPath; }
|
|
136
152
|
});
|
|
137
153
|
Object.defineProperty(exports, "sessionsDir", {
|
|
138
154
|
enumerable: true,
|
|
139
|
-
get: function () { return
|
|
155
|
+
get: function () { return chunkVWYFGE27_cjs.sessionsDir; }
|
|
140
156
|
});
|
|
141
157
|
Object.defineProperty(exports, "wikiDir", {
|
|
142
158
|
enumerable: true,
|
|
143
|
-
get: function () { return
|
|
159
|
+
get: function () { return chunkVWYFGE27_cjs.wikiDir; }
|
|
144
160
|
});
|
|
145
161
|
Object.defineProperty(exports, "writeSessionSummary", {
|
|
146
162
|
enumerable: true,
|
|
147
|
-
get: function () { return
|
|
163
|
+
get: function () { return chunkVWYFGE27_cjs.writeSessionSummary; }
|
|
148
164
|
});
|
|
149
165
|
//# sourceMappingURL=index.cjs.map
|
|
150
166
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* `package.json` `exports`, so the names below must survive into the published declarations.
|
|
17
17
|
*/
|
|
18
18
|
export { appendDiaryEntry, type DiaryEntry, diaryPath, entryHash, renderDiaryEntry, } from "../dreaming/diary.js";
|
|
19
|
+
export { type Cluster, type ClusterResult, type DedupResult, deepPhase, lightPhase, remPhase, } from "../dreaming/phases.js";
|
|
20
|
+
export { type DreamingOptions, type DreamingResult, runDreamingSweep, } from "../dreaming/run.js";
|
|
19
21
|
export { defaultIndexPath } from "../index-db.js";
|
|
20
22
|
export { collectMarkdownFiles, type DiscoveredFile } from "../index-manager-helpers.js";
|
|
21
23
|
export { lanceStoragePath } from "../lance-index.js";
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
* `package.json` `exports`, so the names below must survive into the published declarations.
|
|
17
17
|
*/
|
|
18
18
|
export { appendDiaryEntry, type DiaryEntry, diaryPath, entryHash, renderDiaryEntry, } from "../dreaming/diary.js";
|
|
19
|
+
export { type Cluster, type ClusterResult, type DedupResult, deepPhase, lightPhase, remPhase, } from "../dreaming/phases.js";
|
|
20
|
+
export { type DreamingOptions, type DreamingResult, runDreamingSweep, } from "../dreaming/run.js";
|
|
19
21
|
export { defaultIndexPath } from "../index-db.js";
|
|
20
22
|
export { collectMarkdownFiles, type DiscoveredFile } from "../index-manager-helpers.js";
|
|
21
23
|
export { lanceStoragePath } from "../lance-index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { appendDiaryEntry, diaryPath, entryHash, readAllSqliteFacts, renderDiaryEntry } from '../../../chunk-
|
|
1
|
+
export { appendDiaryEntry, deepPhase, diaryPath, entryHash, lightPhase, readAllSqliteFacts, remPhase, renderDiaryEntry, runDreamingSweep } from '../../../chunk-INVEGVGO.js';
|
|
2
2
|
export { persistActiveMemoryTranscript } from '../../../chunk-QK2ERTO3.js';
|
|
3
|
-
export { MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, appendFact, appendFactToMarkdown, asMemoryRoot, ceilingReachedError, claudeProjectMemoryDir, collectMarkdownFiles, defaultIndexPath, discoverSessionFiles, discoverWikiFiles, indexBudgetWarning, lanceStoragePath, memoryIndexRoot, memoryMdPath, memoryReadRoots, notesDir, projectMemoryDir, readFacts, readFactsFromMarkdown, resolveMaxFacts, resolveMemoryRoot, sessionSummaryPath, sessionsDir, wikiDir, writeSessionSummary } from '../../../chunk-
|
|
3
|
+
export { MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, appendFact, appendFactToMarkdown, asMemoryRoot, ceilingReachedError, claudeProjectMemoryDir, collectMarkdownFiles, defaultIndexPath, discoverSessionFiles, discoverWikiFiles, indexBudgetWarning, lanceStoragePath, memoryIndexRoot, memoryMdPath, memoryReadRoots, notesDir, projectMemoryDir, readFacts, readFactsFromMarkdown, resolveMaxFacts, resolveMemoryRoot, sessionSummaryPath, sessionsDir, wikiDir, writeSessionSummary } from '../../../chunk-LCCT5ZXJ.js';
|
|
4
4
|
import '../../../chunk-KVNWIAO4.js';
|
|
5
5
|
import '../../../chunk-FD2UT76F.js';
|
|
6
6
|
import '../../../chunk-4QCJAJAG.js';
|
|
@@ -8,8 +8,8 @@ import '../../../chunk-PKRPV3R7.js';
|
|
|
8
8
|
import '../../../chunk-UKMBRMGT.js';
|
|
9
9
|
import '../../../chunk-XESYJ4JC.js';
|
|
10
10
|
import '../../../chunk-MLJDW2YK.js';
|
|
11
|
-
import '../../../chunk-
|
|
12
|
-
import '../../../chunk-
|
|
11
|
+
import '../../../chunk-FGGVSHDW.js';
|
|
12
|
+
import '../../../chunk-PPU2D4FZ.js';
|
|
13
13
|
import '../../../chunk-M4U24U6G.js';
|
|
14
14
|
import '../../../chunk-TNFOU6SB.js';
|
|
15
15
|
import '../../../chunk-3OY6H3I7.js';
|
|
@@ -26,10 +26,12 @@
|
|
|
26
26
|
* `@theokit/sdk` rather than reimplementing it, precisely so the Map is the same one: a per-package
|
|
27
27
|
* copy would give each package its own queue and let their writes race.
|
|
28
28
|
*
|
|
29
|
-
* The Map is module-scoped, so nothing survives a process restart or a fresh module instance
|
|
30
|
-
*
|
|
29
|
+
* The Map is module-scoped, so nothing survives a process restart or a fresh module instance.
|
|
30
|
+
* An entry is dropped as soon as its key has no call pending.
|
|
31
31
|
* Signature and semantics will not change before sdk-core v3.0.
|
|
32
32
|
*
|
|
33
33
|
* @public
|
|
34
34
|
*/
|
|
35
35
|
export declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
|
|
36
|
+
/** Number of keys with a call pending. Test-only observation of the queue map. */
|
|
37
|
+
export declare function pendingCwdMutexKeyCount(): number;
|
|
@@ -26,10 +26,12 @@
|
|
|
26
26
|
* `@theokit/sdk` rather than reimplementing it, precisely so the Map is the same one: a per-package
|
|
27
27
|
* copy would give each package its own queue and let their writes race.
|
|
28
28
|
*
|
|
29
|
-
* The Map is module-scoped, so nothing survives a process restart or a fresh module instance
|
|
30
|
-
*
|
|
29
|
+
* The Map is module-scoped, so nothing survives a process restart or a fresh module instance.
|
|
30
|
+
* An entry is dropped as soon as its key has no call pending.
|
|
31
31
|
* Signature and semantics will not change before sdk-core v3.0.
|
|
32
32
|
*
|
|
33
33
|
* @public
|
|
34
34
|
*/
|
|
35
35
|
export declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
|
|
36
|
+
/** Number of keys with a call pending. Test-only observation of the queue map. */
|
|
37
|
+
export declare function pendingCwdMutexKeyCount(): number;
|