@theokit/sdk 5.9.2 → 5.11.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 +104 -0
- package/dist/{agent-WQ4LLTSY.cjs → agent-5DOR5T3E.cjs} +12 -10
- package/dist/{agent-WQ4LLTSY.cjs.map → agent-5DOR5T3E.cjs.map} +1 -1
- package/dist/{agent-enXXu447.d.ts → agent-CmKwSyyD.d.ts} +27 -0
- package/dist/{agent-GZVZXKME.js → agent-GWKRARAL.js} +11 -9
- package/dist/{agent-GZVZXKME.js.map → agent-GWKRARAL.js.map} +1 -1
- package/dist/{agent-Dh2YHSLj.d.cts → agent-XMkGzff_.d.cts} +27 -0
- package/dist/{chunk-PEIV7LOU.js → chunk-4PHSVR2R.js} +68 -37
- package/dist/chunk-4PHSVR2R.js.map +1 -0
- package/dist/{chunk-KXKT3HSD.cjs → chunk-5H2GJXGC.cjs} +4 -4
- package/dist/{chunk-KXKT3HSD.cjs.map → chunk-5H2GJXGC.cjs.map} +1 -1
- package/dist/{chunk-JU76WCW7.cjs → chunk-5OHB5HJF.cjs} +123 -92
- package/dist/chunk-5OHB5HJF.cjs.map +1 -0
- package/dist/{chunk-EVH3OUMY.js → chunk-74OA5DIM.js} +189 -43
- package/dist/chunk-74OA5DIM.js.map +1 -0
- package/dist/chunk-7KIN3L2S.js +103 -0
- package/dist/chunk-7KIN3L2S.js.map +1 -0
- package/dist/{chunk-EXI7EHDN.js → chunk-7Y23B7XX.js} +3 -3
- package/dist/{chunk-EXI7EHDN.js.map → chunk-7Y23B7XX.js.map} +1 -1
- package/dist/chunk-ASK2OQM5.cjs +84 -0
- package/dist/chunk-ASK2OQM5.cjs.map +1 -0
- package/dist/{chunk-QY3CIMUV.cjs → chunk-BZKF7TXX.cjs} +192 -44
- package/dist/chunk-BZKF7TXX.cjs.map +1 -0
- package/dist/{chunk-ZDF2IJKC.js → chunk-DPY2M74T.js} +3 -3
- package/dist/{chunk-ZDF2IJKC.js.map → chunk-DPY2M74T.js.map} +1 -1
- package/dist/{chunk-X7Z2FEI7.cjs → chunk-FYEHYQ7T.cjs} +8 -8
- package/dist/{chunk-X7Z2FEI7.cjs.map → chunk-FYEHYQ7T.cjs.map} +1 -1
- package/dist/{chunk-OZLQ6ZFM.js → chunk-IZDDSLL2.js} +4 -3
- package/dist/chunk-IZDDSLL2.js.map +1 -0
- package/dist/{chunk-DLUCTZ56.cjs → chunk-L3C6CCBG.cjs} +15 -15
- package/dist/{chunk-DLUCTZ56.cjs.map → chunk-L3C6CCBG.cjs.map} +1 -1
- package/dist/chunk-LZJXEPEQ.js +58 -0
- package/dist/chunk-LZJXEPEQ.js.map +1 -0
- package/dist/{chunk-FR6COQXZ.cjs → chunk-N7ZIPW2N.cjs} +3 -3
- package/dist/{chunk-FR6COQXZ.cjs.map → chunk-N7ZIPW2N.cjs.map} +1 -1
- package/dist/{chunk-RX3CFWQ2.cjs → chunk-NQVWSSX2.cjs} +6 -5
- package/dist/chunk-NQVWSSX2.cjs.map +1 -0
- package/dist/chunk-NWS2CS3Y.cjs +61 -0
- package/dist/chunk-NWS2CS3Y.cjs.map +1 -0
- package/dist/chunk-R5YPDAKD.cjs +108 -0
- package/dist/chunk-R5YPDAKD.cjs.map +1 -0
- package/dist/chunk-RGQICWFU.js +82 -0
- package/dist/chunk-RGQICWFU.js.map +1 -0
- package/dist/{chunk-N7KYUNFO.js → chunk-W2ZVTEOD.js} +3 -3
- package/dist/{chunk-N7KYUNFO.js.map → chunk-W2ZVTEOD.js.map} +1 -1
- package/dist/{chunk-47Z6LP3I.js → chunk-X3LOJJMO.js} +88 -28
- package/dist/chunk-X3LOJJMO.js.map +1 -0
- package/dist/{chunk-M2CCHC66.js → chunk-Z5BAFHPU.js} +3 -3
- package/dist/{chunk-M2CCHC66.js.map → chunk-Z5BAFHPU.js.map} +1 -1
- package/dist/{chunk-VZ2JZ2EH.cjs → chunk-ZD66GFH5.cjs} +89 -27
- package/dist/chunk-ZD66GFH5.cjs.map +1 -0
- package/dist/{compact-session-4QHBBGEY.cjs → compact-session-2AETONOS.cjs} +12 -12
- package/dist/{compact-session-4QHBBGEY.cjs.map → compact-session-2AETONOS.cjs.map} +1 -1
- package/dist/{compact-session-PVAWTKKL.js → compact-session-F2UDGZCN.js} +3 -3
- package/dist/{compact-session-PVAWTKKL.js.map → compact-session-F2UDGZCN.js.map} +1 -1
- package/dist/{cron-DTuaPMVI.d.ts → cron-BPccQCO8.d.ts} +1 -1
- package/dist/{cron-QTgcwcZt.d.cts → cron-Blj6wMYg.d.cts} +1 -1
- package/dist/cron.cjs +11 -9
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +10 -8
- package/dist/eval.cjs +14 -12
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +10 -8
- package/dist/eval.js.map +1 -1
- package/dist/fs-session-store-3VI4CPTX.js +11 -0
- package/dist/{fs-session-store-LCZBM3LT.js.map → fs-session-store-3VI4CPTX.js.map} +1 -1
- package/dist/fs-session-store-IQ6PEHYF.cjs +20 -0
- package/dist/{fs-session-store-SVEMRE4K.cjs.map → fs-session-store-IQ6PEHYF.cjs.map} +1 -1
- package/dist/{index-manager-6B2UF5S3.js → index-manager-JVYIVTZG.js} +5 -4
- package/dist/{index-manager-6B2UF5S3.js.map → index-manager-JVYIVTZG.js.map} +1 -1
- package/dist/{index-manager-M3FHJCHQ.cjs → index-manager-YGXRFJMZ.cjs} +6 -5
- package/dist/{index-manager-M3FHJCHQ.cjs.map → index-manager-YGXRFJMZ.cjs.map} +1 -1
- package/dist/index.cjs +62 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +27 -115
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-O24XGRR6.js → inject-session-E5UDFVLI.js} +3 -3
- package/dist/{inject-session-O24XGRR6.js.map → inject-session-E5UDFVLI.js.map} +1 -1
- package/dist/{inject-session-OMLFL2V3.cjs → inject-session-W4UKACYJ.cjs} +4 -4
- package/dist/{inject-session-OMLFL2V3.cjs.map → inject-session-W4UKACYJ.cjs.map} +1 -1
- package/dist/internal/budget/normalize-usage.d.ts +81 -0
- package/dist/internal/llm/anthropic-shared.d.ts +6 -0
- package/dist/internal/llm/openai.d.ts +3 -5
- package/dist/internal/llm/openrouter-system.d.ts +1 -0
- package/dist/internal/llm/types.d.ts +10 -5
- package/dist/internal/memory/dreaming/phases.d.ts +2 -0
- package/dist/internal/memory/dreaming/run.d.ts +5 -0
- package/dist/internal/memory/sdk-memory-peer-loader.d.ts +2 -0
- package/dist/internal/memory/storage/fact-ceiling.d.cts +19 -0
- package/dist/internal/memory/storage/fact-ceiling.d.ts +19 -0
- package/dist/internal/memory/storage/index.cjs +40 -31
- package/dist/internal/memory/storage/index.d.cts +1 -0
- package/dist/internal/memory/storage/index.d.ts +1 -0
- package/dist/internal/memory/storage/index.js +3 -2
- package/dist/internal/memory/storage/markdown-store.d.cts +3 -1
- package/dist/internal/memory/storage/markdown-store.d.ts +3 -1
- package/dist/internal/memory/types.d.ts +6 -0
- package/dist/internal/persistence/index.cjs +7 -6
- package/dist/internal/persistence/index.cjs.map +1 -1
- package/dist/internal/persistence/index.js +2 -1
- package/dist/internal/persistence/index.js.map +1 -1
- package/dist/internal/runtime/registry/agent-registry-store.d.ts +2 -0
- package/dist/models.cjs +5 -50
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +3 -51
- package/dist/models.js.map +1 -1
- package/dist/persistence.cjs +7 -6
- package/dist/persistence.cjs.map +1 -1
- package/dist/persistence.js +2 -1
- package/dist/persistence.js.map +1 -1
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/types/agent.d.ts +27 -0
- package/docs/error-codes.md +29 -26
- package/docs/harness-capability-map.md +6 -1
- package/package.json +1 -1
- package/dist/chunk-47Z6LP3I.js.map +0 -1
- package/dist/chunk-BKMDRBJ7.js +0 -180
- package/dist/chunk-BKMDRBJ7.js.map +0 -1
- package/dist/chunk-EVH3OUMY.js.map +0 -1
- package/dist/chunk-JU76WCW7.cjs.map +0 -1
- package/dist/chunk-OF2CLCTH.cjs +0 -186
- package/dist/chunk-OF2CLCTH.cjs.map +0 -1
- package/dist/chunk-OZLQ6ZFM.js.map +0 -1
- package/dist/chunk-PEIV7LOU.js.map +0 -1
- package/dist/chunk-QY3CIMUV.cjs.map +0 -1
- package/dist/chunk-RX3CFWQ2.cjs.map +0 -1
- package/dist/chunk-VZ2JZ2EH.cjs.map +0 -1
- package/dist/fs-session-store-LCZBM3LT.js +0 -10
- package/dist/fs-session-store-SVEMRE4K.cjs +0 -19
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { enqueueSessionWrite } from './chunk-
|
|
1
|
+
import { enqueueSessionWrite } from './chunk-7Y23B7XX.js';
|
|
2
2
|
import { invalidateSessionCache } from './chunk-2XC6KDJM.js';
|
|
3
3
|
import './chunk-XERM7PDQ.js';
|
|
4
4
|
import { SessionTranscript } from './chunk-FTZTZBCU.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-E5UDFVLI.js.map
|
|
27
|
+
//# sourceMappingURL=inject-session-E5UDFVLI.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-E5UDFVLI.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 chunkN7ZIPW2N_cjs = require('./chunk-N7ZIPW2N.cjs');
|
|
4
4
|
var chunkYJNYDJ2T_cjs = require('./chunk-YJNYDJ2T.cjs');
|
|
5
5
|
require('./chunk-ZAM7BJXJ.cjs');
|
|
6
6
|
var chunkZWACQM5U_cjs = require('./chunk-ZWACQM5U.cjs');
|
|
@@ -10,7 +10,7 @@ require('./chunk-6LHQPOMI.cjs');
|
|
|
10
10
|
|
|
11
11
|
// src/internal/session/inject-session.ts
|
|
12
12
|
async function injectSessionTurn(opts) {
|
|
13
|
-
await
|
|
13
|
+
await chunkN7ZIPW2N_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
14
14
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
15
15
|
const transcript = chunkZWACQM5U_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-W4UKACYJ.cjs.map
|
|
29
|
+
//# sourceMappingURL=inject-session-W4UKACYJ.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-W4UKACYJ.cjs","sourcesContent":["/**\n * M51 (agent-builder) — inject a SYNTHETIC user+assistant pair into a session's persisted transcript\n * WITHOUT running an LLM turn. This is the Codex review-exit mechanism (`exit_success.xml` appended to\n * the parent thread history so follow-ups like \"fix finding 2\" work): the pair chains onto the DAG\n * leaf (M50 pattern) and the in-memory cache is invalidated so the NEXT send re-hydrates with it.\n */\nimport type { SessionStore } from \"../../types/session-store.js\";\nimport { SessionTranscript } from \"../persistence/session-transcript.js\";\nimport { enqueueSessionWrite, invalidateSessionCache } from \"./agent-session.js\";\nimport type { CompactLocation } from \"./compact-session.js\";\n\nexport async function injectSessionTurn(opts: {\n store: SessionStore;\n loc: CompactLocation;\n sessionId: string;\n userText: string;\n assistantText: string;\n}): Promise<void> {\n await enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {\n const prior = await opts.store.readRecords(opts.loc.agentId);\n const transcript = SessionTranscript.fromRecords(prior, {\n cwd: opts.loc.cwd,\n sessionId: opts.sessionId,\n model: opts.loc.model ?? \"unknown\",\n });\n transcript.appendUserTurn(opts.userText);\n transcript.appendAssistantTurn({ text: opts.assistantText });\n await opts.store.appendRecords(opts.loc.agentId, transcript.records().slice(prior.length));\n invalidateSessionCache(opts.loc.cwd, opts.loc.agentId);\n });\n}\n"]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* normalizeUsage — convert provider-shaped raw `usage` object to
|
|
3
|
+
* canonical `TokenUsage`. Ports Hermes Agent's `normalize_usage`
|
|
4
|
+
* (reference/peer-agent/agent/usage_pricing.py:672-742).
|
|
5
|
+
*
|
|
6
|
+
* Handles 3 API shapes:
|
|
7
|
+
* - Anthropic Messages: 4 explicit buckets (input/output/cache_read/cache_creation).
|
|
8
|
+
* - OpenAI Chat Completions: prompt_tokens INCLUDES cache; subtract cached_tokens.
|
|
9
|
+
* - OpenAI Responses (Codex): input_tokens INCLUDES cache; same subtraction.
|
|
10
|
+
*
|
|
11
|
+
* Edge cases:
|
|
12
|
+
* - a peer#10266 — OpenAI-compat proxies (OpenRouter, a peer vendor AI Gateway,
|
|
13
|
+
* a peer) routing Claude expose Anthropic-style top-level fields
|
|
14
|
+
* (cache_read_input_tokens / cache_creation_input_tokens). Both
|
|
15
|
+
* locations are checked with top-level fallback.
|
|
16
|
+
* - Null/undefined fields → 0 via `int()` coerce.
|
|
17
|
+
* - String token counts → parsed via int.
|
|
18
|
+
* - Negative values → clamped to 0 (defensive against proxy bugs).
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export type ApiMode = "anthropic_messages" | "openai_chat_completions" | "openai_responses";
|
|
23
|
+
/**
|
|
24
|
+
* Guess which usage shape a provider reports, from its name alone.
|
|
25
|
+
*
|
|
26
|
+
* Matching is case-insensitive and exact — `"anthropic"`, `"claude"` and `"bedrock_anthropic"`
|
|
27
|
+
* give `"anthropic_messages"`; `"openai-codex"` and `"codex"` give `"openai_responses"`. Every
|
|
28
|
+
* other name, including ones this SDK has never seen, falls through to
|
|
29
|
+
* `"openai_chat_completions"`. There is no unknown result, so a wrong guess is silent: it is
|
|
30
|
+
* read as a Chat Completions payload, whose fields are absent, and the tokens come back as 0.
|
|
31
|
+
*
|
|
32
|
+
* The default is right for the OpenAI-compatible majority (openai, openrouter, deepseek, and the
|
|
33
|
+
* compat endpoints of google, ollama and lmstudio). When it is not, pass `apiMode` to
|
|
34
|
+
* `normalizeUsage` explicitly instead of relying on the name.
|
|
35
|
+
*/
|
|
36
|
+
export declare function inferApiMode(provider: string): ApiMode;
|
|
37
|
+
/**
|
|
38
|
+
* Convert a provider's raw `usage` object into the SDK's canonical `TokenUsage`.
|
|
39
|
+
*
|
|
40
|
+
* Never throws and never reports failure. `null`, `undefined` and any non-object argument return
|
|
41
|
+
* all-zero usage, which is indistinguishable from a real response that used no tokens — so this
|
|
42
|
+
* is not the place to detect a malformed payload.
|
|
43
|
+
*
|
|
44
|
+
* `opts.apiMode` selects the reader; when omitted it is derived from `opts.provider` via
|
|
45
|
+
* `inferApiMode`, whose fallback is Chat Completions. Pass it explicitly for any provider whose
|
|
46
|
+
* name does not identify its wire shape.
|
|
47
|
+
*
|
|
48
|
+
* The shapes differ in one way that matters: Anthropic reports cache tokens in buckets separate
|
|
49
|
+
* from `input_tokens`, while both OpenAI shapes report a prompt total that already includes
|
|
50
|
+
* them. For the OpenAI readers the cache buckets are subtracted, so `inputTokens` is always the
|
|
51
|
+
* uncached portion and `inputTokens + cacheReadTokens + cacheWriteTokens` reconstructs the
|
|
52
|
+
* provider's prompt total. The subtraction is floored at 0, so a payload whose cache counts
|
|
53
|
+
* exceed its prompt total yields 0 rather than a negative.
|
|
54
|
+
*
|
|
55
|
+
* Every field is coerced: numbers are truncated toward zero, numeric strings are parsed, negative
|
|
56
|
+
* and non-finite values become 0, and anything else becomes 0.
|
|
57
|
+
*
|
|
58
|
+
* `totalTokens` is computed here as input + output + both cache buckets; a `total_tokens` the
|
|
59
|
+
* provider sent is ignored. Reasoning tokens are reported separately but are NOT added again —
|
|
60
|
+
* providers already count them inside output. `cacheReadTokens`, `cacheWriteTokens` and
|
|
61
|
+
* `reasoningTokens` are omitted from the result when they are 0, so absent means zero, not
|
|
62
|
+
* unknown.
|
|
63
|
+
*
|
|
64
|
+
* Chat Completions also accepts Anthropic-style top-level `cache_read_input_tokens` /
|
|
65
|
+
* `cache_creation_input_tokens`, which OpenAI-compatible proxies emit when they route Claude.
|
|
66
|
+
* The nested `prompt_tokens_details` values win; the top-level fields are consulted only when
|
|
67
|
+
* those are 0 or missing.
|
|
68
|
+
*/
|
|
69
|
+
export declare function normalizeUsage(rawUsage: unknown, opts: {
|
|
70
|
+
provider: string;
|
|
71
|
+
apiMode?: ApiMode;
|
|
72
|
+
}): TokenUsage;
|
|
73
|
+
/** The prompt of a Chat Completions `usage` object, split the way {@link splitChatCompletionsPrompt} reports it. */
|
|
74
|
+
export interface ChatCompletionsPromptSplit {
|
|
75
|
+
/** `prompt_tokens` minus both cache buckets, floored at 0; absent when `prompt_tokens` is. */
|
|
76
|
+
readonly inputTokens?: number;
|
|
77
|
+
/** Absent when the payload carries neither cache-read field. */
|
|
78
|
+
readonly cacheReadTokens?: number;
|
|
79
|
+
/** Absent when the payload carries neither cache-write field. */
|
|
80
|
+
readonly cacheWriteTokens?: number;
|
|
81
|
+
}
|
|
@@ -20,6 +20,8 @@ export interface AnthropicResponseLike {
|
|
|
20
20
|
usage?: {
|
|
21
21
|
input_tokens?: number;
|
|
22
22
|
output_tokens?: number;
|
|
23
|
+
cache_read_input_tokens?: number;
|
|
24
|
+
cache_creation_input_tokens?: number;
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
export declare function extractAnthropicText(response: AnthropicResponseLike): string;
|
|
@@ -62,6 +64,8 @@ export declare function handleAnthropicResponse(args: {
|
|
|
62
64
|
stopReason: LlmStopReason;
|
|
63
65
|
inputTokens?: number;
|
|
64
66
|
outputTokens?: number;
|
|
67
|
+
cacheReadTokens?: number;
|
|
68
|
+
cacheWriteTokens?: number;
|
|
65
69
|
}>;
|
|
66
70
|
export declare function consumeAnthropicResponse(response: Response): Promise<{
|
|
67
71
|
text: string;
|
|
@@ -69,6 +73,8 @@ export declare function consumeAnthropicResponse(response: Response): Promise<{
|
|
|
69
73
|
stopReason: LlmStopReason;
|
|
70
74
|
inputTokens?: number;
|
|
71
75
|
outputTokens?: number;
|
|
76
|
+
cacheReadTokens?: number;
|
|
77
|
+
cacheWriteTokens?: number;
|
|
72
78
|
}>;
|
|
73
79
|
export declare function parseHttpErrorBody(response: Response): Promise<unknown>;
|
|
74
80
|
export interface AnthropicTextBlock {
|
|
@@ -70,6 +70,7 @@ interface OpenAIDeltaChunk {
|
|
|
70
70
|
*/
|
|
71
71
|
prompt_tokens_details?: {
|
|
72
72
|
cached_tokens?: number;
|
|
73
|
+
cache_write_tokens?: number;
|
|
73
74
|
};
|
|
74
75
|
completion_tokens_details?: {
|
|
75
76
|
reasoning_tokens?: number;
|
|
@@ -106,11 +107,8 @@ declare class OpenAIStreamAccumulator {
|
|
|
106
107
|
private readonly allowedToolNames?;
|
|
107
108
|
private text;
|
|
108
109
|
private stopReason;
|
|
109
|
-
|
|
110
|
-
private
|
|
111
|
-
private cacheReadTokens?;
|
|
112
|
-
private cacheWriteTokens?;
|
|
113
|
-
private reasoningTokens?;
|
|
110
|
+
/** The stream's `usage` object, a later chunk replacing an earlier one per top-level field. */
|
|
111
|
+
private usage;
|
|
114
112
|
private readonly toolCalls;
|
|
115
113
|
/** R7: present only when recovery is enabled AND the request declares tools — holds suspected
|
|
116
114
|
* leaked-dialect content back from the `text_delta` stream. `undefined` ⇒ stream immediately. */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -83,14 +83,15 @@ export interface LlmMessage {
|
|
|
83
83
|
* annotation in the Anthropic wire body, which lets Anthropic bill
|
|
84
84
|
* subsequent same-content requests at the cache-read rate (1-3x discount).
|
|
85
85
|
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
86
|
+
* OpenRouter receives the blocks as `content` parts of the `system` message,
|
|
87
|
+
* with `cache_control` on each cacheable part. Every other chat-completions
|
|
88
|
+
* provider (OpenAI and the compatible ones) gets the array joined into a
|
|
89
|
+
* single string at the wire boundary. Back-compat: `LlmRequest.system` still
|
|
89
90
|
* accepts a plain `string` (pre-T3.5 callers compile unchanged).
|
|
90
91
|
*/
|
|
91
92
|
export interface LlmSystemBlock {
|
|
92
93
|
text: string;
|
|
93
|
-
/** When `true`, ask the provider to cache this block (Anthropic
|
|
94
|
+
/** When `true`, ask the provider to cache this block (Anthropic, and OpenRouter content parts). */
|
|
94
95
|
cacheable?: boolean;
|
|
95
96
|
}
|
|
96
97
|
/**
|
|
@@ -204,11 +205,15 @@ export interface LlmFinish {
|
|
|
204
205
|
stopReason: LlmStopReason;
|
|
205
206
|
text: string;
|
|
206
207
|
toolCalls: LlmToolCallPart[];
|
|
208
|
+
/**
|
|
209
|
+
* Uncached input tokens, the way Anthropic reports them. The chat-completions client subtracts
|
|
210
|
+
* the cache buckets from the provider's cache-inclusive `prompt_tokens` to match.
|
|
211
|
+
*/
|
|
207
212
|
inputTokens?: number;
|
|
208
213
|
outputTokens?: number;
|
|
209
214
|
/** Cache read tokens (Anthropic prompt caching / OpenAI cached). ADR D376. */
|
|
210
215
|
cacheReadTokens?: number;
|
|
211
|
-
/** Cache creation tokens (Anthropic
|
|
216
|
+
/** Cache creation tokens (Anthropic, and OpenRouter's `cache_write_tokens`). ADR D376. */
|
|
212
217
|
cacheWriteTokens?: number;
|
|
213
218
|
/** Reasoning tokens (OpenAI o-series). ADR D376. */
|
|
214
219
|
reasoningTokens?: number;
|
|
@@ -6,6 +6,8 @@ export interface Cluster {
|
|
|
6
6
|
}
|
|
7
7
|
export interface ClusterResult {
|
|
8
8
|
clusters: Cluster[];
|
|
9
|
+
/** How many input facts past the per-sweep cap were not clustered; 0 when none were. */
|
|
10
|
+
factsLeftOut: number;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Light phase — drop facts whose embedding is too similar to one already kept.
|
|
@@ -6,5 +6,10 @@ export interface DreamingResult {
|
|
|
6
6
|
clustersCreated: number;
|
|
7
7
|
notesWritten: number;
|
|
8
8
|
diaryEntryHash: string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Deduplicated facts past the per-sweep cap that were not clustered. Set on `"ok"`, 0 on
|
|
11
|
+
* `"skipped"`, and absent on `"error"`, where the sweep cannot say how many it left out.
|
|
12
|
+
*/
|
|
13
|
+
factsLeftOut?: number;
|
|
9
14
|
}
|
|
10
15
|
export declare function runDreamingSweep(options: DreamingOptions): Promise<DreamingResult>;
|
|
@@ -44,6 +44,8 @@ export interface SdkMemoryModule {
|
|
|
44
44
|
duplicatesRemoved: number;
|
|
45
45
|
clustersCreated: number;
|
|
46
46
|
notesWritten: number;
|
|
47
|
+
/** Optional: a peer older than the one that reports the count leaves it out. */
|
|
48
|
+
factsLeftOut?: number;
|
|
47
49
|
}>;
|
|
48
50
|
/** Mirrors @theokit/sdk-memory's IndexManager class (static open). */
|
|
49
51
|
readonly IndexManager: {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConfigurationError } from "../../../errors.js";
|
|
2
|
+
/**
|
|
3
|
+
* The ceiling a caller declared, or `undefined` when none was declared.
|
|
4
|
+
*
|
|
5
|
+
* Validated before anything touches disk, because a ceiling that cannot be met (0, a negative or
|
|
6
|
+
* fractional number, a string, `null`) would otherwise surface later as a refusal of every write
|
|
7
|
+
* that names the wrong cause.
|
|
8
|
+
*
|
|
9
|
+
* @throws ConfigurationError with code `invalid_memory_ceiling` when the value is declared and is
|
|
10
|
+
* not a positive safe integer.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveMaxFacts(value: unknown): number | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The refusal of a new fact at a store's declared ceiling: where the store is, how many facts it
|
|
15
|
+
* holds, the ceiling, and what to consolidate. `remedy` is the store-specific way to make room.
|
|
16
|
+
*
|
|
17
|
+
* Returned, not thrown, so each writer throws it at the point where it has written nothing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ceilingReachedError(where: string, count: number, maxFacts: number, remedy: string): ConfigurationError;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConfigurationError } from "../../../errors.js";
|
|
2
|
+
/**
|
|
3
|
+
* The ceiling a caller declared, or `undefined` when none was declared.
|
|
4
|
+
*
|
|
5
|
+
* Validated before anything touches disk, because a ceiling that cannot be met (0, a negative or
|
|
6
|
+
* fractional number, a string, `null`) would otherwise surface later as a refusal of every write
|
|
7
|
+
* that names the wrong cause.
|
|
8
|
+
*
|
|
9
|
+
* @throws ConfigurationError with code `invalid_memory_ceiling` when the value is declared and is
|
|
10
|
+
* not a positive safe integer.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveMaxFacts(value: unknown): number | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The refusal of a new fact at a store's declared ceiling: where the store is, how many facts it
|
|
15
|
+
* holds, the ceiling, and what to consolidate. `remedy` is the store-specific way to make room.
|
|
16
|
+
*
|
|
17
|
+
* Returned, not thrown, so each writer throws it at the point where it has written nothing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ceilingReachedError(where: string, count: number, maxFacts: number, remedy: string): ConfigurationError;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkFYEHYQ7T_cjs = require('../../../chunk-FYEHYQ7T.cjs');
|
|
4
4
|
var chunkTMKTSYDS_cjs = require('../../../chunk-TMKTSYDS.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkZD66GFH5_cjs = require('../../../chunk-ZD66GFH5.cjs');
|
|
6
6
|
require('../../../chunk-KRD3GQAA.cjs');
|
|
7
7
|
require('../../../chunk-MUUQ2WFJ.cjs');
|
|
8
8
|
require('../../../chunk-SWALPLFQ.cjs');
|
|
@@ -10,6 +10,7 @@ require('../../../chunk-GM54F4FE.cjs');
|
|
|
10
10
|
require('../../../chunk-SA6K24NB.cjs');
|
|
11
11
|
require('../../../chunk-ZWACQM5U.cjs');
|
|
12
12
|
require('../../../chunk-P22BZE7G.cjs');
|
|
13
|
+
require('../../../chunk-ASK2OQM5.cjs');
|
|
13
14
|
require('../../../chunk-ZF2LDKQQ.cjs');
|
|
14
15
|
require('../../../chunk-JLRLCBJ4.cjs');
|
|
15
16
|
require('../../../chunk-UNFBHV46.cjs');
|
|
@@ -19,23 +20,23 @@ require('../../../chunk-6LHQPOMI.cjs');
|
|
|
19
20
|
|
|
20
21
|
Object.defineProperty(exports, "appendDiaryEntry", {
|
|
21
22
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkFYEHYQ7T_cjs.appendDiaryEntry; }
|
|
23
24
|
});
|
|
24
25
|
Object.defineProperty(exports, "diaryPath", {
|
|
25
26
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkFYEHYQ7T_cjs.diaryPath; }
|
|
27
28
|
});
|
|
28
29
|
Object.defineProperty(exports, "entryHash", {
|
|
29
30
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkFYEHYQ7T_cjs.entryHash; }
|
|
31
32
|
});
|
|
32
33
|
Object.defineProperty(exports, "readAllSqliteFacts", {
|
|
33
34
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkFYEHYQ7T_cjs.readAllSqliteFacts; }
|
|
35
36
|
});
|
|
36
37
|
Object.defineProperty(exports, "renderDiaryEntry", {
|
|
37
38
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkFYEHYQ7T_cjs.renderDiaryEntry; }
|
|
39
40
|
});
|
|
40
41
|
Object.defineProperty(exports, "persistActiveMemoryTranscript", {
|
|
41
42
|
enumerable: true,
|
|
@@ -43,99 +44,107 @@ Object.defineProperty(exports, "persistActiveMemoryTranscript", {
|
|
|
43
44
|
});
|
|
44
45
|
Object.defineProperty(exports, "MEMORY_INDEX_MAX_BYTES", {
|
|
45
46
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkZD66GFH5_cjs.MEMORY_INDEX_MAX_BYTES; }
|
|
47
48
|
});
|
|
48
49
|
Object.defineProperty(exports, "MEMORY_INDEX_MAX_LINES", {
|
|
49
50
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkZD66GFH5_cjs.MEMORY_INDEX_MAX_LINES; }
|
|
51
52
|
});
|
|
52
53
|
Object.defineProperty(exports, "appendFact", {
|
|
53
54
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkZD66GFH5_cjs.appendFact; }
|
|
55
56
|
});
|
|
56
57
|
Object.defineProperty(exports, "appendFactToMarkdown", {
|
|
57
58
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkZD66GFH5_cjs.appendFactToMarkdown; }
|
|
59
60
|
});
|
|
60
61
|
Object.defineProperty(exports, "asMemoryRoot", {
|
|
61
62
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkZD66GFH5_cjs.asMemoryRoot; }
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, "ceilingReachedError", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () { return chunkZD66GFH5_cjs.ceilingReachedError; }
|
|
63
68
|
});
|
|
64
69
|
Object.defineProperty(exports, "claudeProjectMemoryDir", {
|
|
65
70
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
71
|
+
get: function () { return chunkZD66GFH5_cjs.claudeProjectMemoryDir; }
|
|
67
72
|
});
|
|
68
73
|
Object.defineProperty(exports, "collectMarkdownFiles", {
|
|
69
74
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
75
|
+
get: function () { return chunkZD66GFH5_cjs.collectMarkdownFiles; }
|
|
71
76
|
});
|
|
72
77
|
Object.defineProperty(exports, "defaultIndexPath", {
|
|
73
78
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkZD66GFH5_cjs.defaultIndexPath; }
|
|
75
80
|
});
|
|
76
81
|
Object.defineProperty(exports, "discoverSessionFiles", {
|
|
77
82
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkZD66GFH5_cjs.discoverSessionFiles; }
|
|
79
84
|
});
|
|
80
85
|
Object.defineProperty(exports, "discoverWikiFiles", {
|
|
81
86
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunkZD66GFH5_cjs.discoverWikiFiles; }
|
|
83
88
|
});
|
|
84
89
|
Object.defineProperty(exports, "indexBudgetWarning", {
|
|
85
90
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkZD66GFH5_cjs.indexBudgetWarning; }
|
|
87
92
|
});
|
|
88
93
|
Object.defineProperty(exports, "lanceStoragePath", {
|
|
89
94
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunkZD66GFH5_cjs.lanceStoragePath; }
|
|
91
96
|
});
|
|
92
97
|
Object.defineProperty(exports, "memoryIndexRoot", {
|
|
93
98
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
99
|
+
get: function () { return chunkZD66GFH5_cjs.memoryIndexRoot; }
|
|
95
100
|
});
|
|
96
101
|
Object.defineProperty(exports, "memoryMdPath", {
|
|
97
102
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
103
|
+
get: function () { return chunkZD66GFH5_cjs.memoryMdPath; }
|
|
99
104
|
});
|
|
100
105
|
Object.defineProperty(exports, "memoryReadRoots", {
|
|
101
106
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
107
|
+
get: function () { return chunkZD66GFH5_cjs.memoryReadRoots; }
|
|
103
108
|
});
|
|
104
109
|
Object.defineProperty(exports, "notesDir", {
|
|
105
110
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
111
|
+
get: function () { return chunkZD66GFH5_cjs.notesDir; }
|
|
107
112
|
});
|
|
108
113
|
Object.defineProperty(exports, "projectMemoryDir", {
|
|
109
114
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
115
|
+
get: function () { return chunkZD66GFH5_cjs.projectMemoryDir; }
|
|
111
116
|
});
|
|
112
117
|
Object.defineProperty(exports, "readFacts", {
|
|
113
118
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
119
|
+
get: function () { return chunkZD66GFH5_cjs.readFacts; }
|
|
115
120
|
});
|
|
116
121
|
Object.defineProperty(exports, "readFactsFromMarkdown", {
|
|
117
122
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
123
|
+
get: function () { return chunkZD66GFH5_cjs.readFactsFromMarkdown; }
|
|
124
|
+
});
|
|
125
|
+
Object.defineProperty(exports, "resolveMaxFacts", {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: function () { return chunkZD66GFH5_cjs.resolveMaxFacts; }
|
|
119
128
|
});
|
|
120
129
|
Object.defineProperty(exports, "resolveMemoryRoot", {
|
|
121
130
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
131
|
+
get: function () { return chunkZD66GFH5_cjs.resolveMemoryRoot; }
|
|
123
132
|
});
|
|
124
133
|
Object.defineProperty(exports, "sessionSummaryPath", {
|
|
125
134
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
135
|
+
get: function () { return chunkZD66GFH5_cjs.sessionSummaryPath; }
|
|
127
136
|
});
|
|
128
137
|
Object.defineProperty(exports, "sessionsDir", {
|
|
129
138
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
139
|
+
get: function () { return chunkZD66GFH5_cjs.sessionsDir; }
|
|
131
140
|
});
|
|
132
141
|
Object.defineProperty(exports, "wikiDir", {
|
|
133
142
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
143
|
+
get: function () { return chunkZD66GFH5_cjs.wikiDir; }
|
|
135
144
|
});
|
|
136
145
|
Object.defineProperty(exports, "writeSessionSummary", {
|
|
137
146
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
147
|
+
get: function () { return chunkZD66GFH5_cjs.writeSessionSummary; }
|
|
139
148
|
});
|
|
140
149
|
//# sourceMappingURL=index.cjs.map
|
|
141
150
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -20,6 +20,7 @@ export { defaultIndexPath } from "../index-db.js";
|
|
|
20
20
|
export { collectMarkdownFiles, type DiscoveredFile } from "../index-manager-helpers.js";
|
|
21
21
|
export { lanceStoragePath } from "../lance-index.js";
|
|
22
22
|
export { readAllSqliteFacts, type SqliteFactRow } from "../migrate-sqlite-to-lance.js";
|
|
23
|
+
export { ceilingReachedError, resolveMaxFacts } from "./fact-ceiling.js";
|
|
23
24
|
export { appendFact, appendFactToMarkdown, memoryMdPath, notesDir, readFacts, readFactsFromMarkdown, } from "./markdown-store.js";
|
|
24
25
|
export { asMemoryRoot, claudeProjectMemoryDir, indexBudgetWarning, MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, type MemoryLocationConfig, type MemoryRoot, memoryIndexRoot, memoryReadRoots, projectMemoryDir, resolveMemoryRoot, } from "./memory-root.js";
|
|
25
26
|
export { discoverSessionFiles, type SessionFile } from "./session-loader.js";
|
|
@@ -20,6 +20,7 @@ export { defaultIndexPath } from "../index-db.js";
|
|
|
20
20
|
export { collectMarkdownFiles, type DiscoveredFile } from "../index-manager-helpers.js";
|
|
21
21
|
export { lanceStoragePath } from "../lance-index.js";
|
|
22
22
|
export { readAllSqliteFacts, type SqliteFactRow } from "../migrate-sqlite-to-lance.js";
|
|
23
|
+
export { ceilingReachedError, resolveMaxFacts } from "./fact-ceiling.js";
|
|
23
24
|
export { appendFact, appendFactToMarkdown, memoryMdPath, notesDir, readFacts, readFactsFromMarkdown, } from "./markdown-store.js";
|
|
24
25
|
export { asMemoryRoot, claudeProjectMemoryDir, indexBudgetWarning, MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, type MemoryLocationConfig, type MemoryRoot, memoryIndexRoot, memoryReadRoots, projectMemoryDir, resolveMemoryRoot, } from "./memory-root.js";
|
|
25
26
|
export { discoverSessionFiles, type SessionFile } from "./session-loader.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { appendDiaryEntry, diaryPath, entryHash, readAllSqliteFacts, renderDiaryEntry } from '../../../chunk-
|
|
1
|
+
export { appendDiaryEntry, diaryPath, entryHash, readAllSqliteFacts, renderDiaryEntry } from '../../../chunk-W2ZVTEOD.js';
|
|
2
2
|
export { persistActiveMemoryTranscript } from '../../../chunk-OR6XIWLB.js';
|
|
3
|
-
export { MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, appendFact, appendFactToMarkdown, asMemoryRoot, claudeProjectMemoryDir, collectMarkdownFiles, defaultIndexPath, discoverSessionFiles, discoverWikiFiles, indexBudgetWarning, lanceStoragePath, memoryIndexRoot, memoryMdPath, memoryReadRoots, notesDir, projectMemoryDir, readFacts, readFactsFromMarkdown, 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-X3LOJJMO.js';
|
|
4
4
|
import '../../../chunk-KVNWIAO4.js';
|
|
5
5
|
import '../../../chunk-FD2UT76F.js';
|
|
6
6
|
import '../../../chunk-4QCJAJAG.js';
|
|
@@ -8,6 +8,7 @@ import '../../../chunk-5DD4NJN3.js';
|
|
|
8
8
|
import '../../../chunk-UKMBRMGT.js';
|
|
9
9
|
import '../../../chunk-FTZTZBCU.js';
|
|
10
10
|
import '../../../chunk-XZHJYSPB.js';
|
|
11
|
+
import '../../../chunk-RGQICWFU.js';
|
|
11
12
|
import '../../../chunk-Q5EWJPRY.js';
|
|
12
13
|
import '../../../chunk-3JHIFQ4I.js';
|
|
13
14
|
import '../../../chunk-B5MHRQJZ.js';
|
|
@@ -29,7 +29,9 @@ export declare function readFactsFromMarkdown(cwd: string, config?: MemoryLocati
|
|
|
29
29
|
* `modified` is stamped HERE and never read from `fact`: a timestamp a caller can set is a
|
|
30
30
|
* timestamp that can lie about when something was learned, and weighing recency is the point.
|
|
31
31
|
*/
|
|
32
|
-
export declare function appendFactToMarkdown(cwd: string, fact: MemoryFact, targetDir?: string
|
|
32
|
+
export declare function appendFactToMarkdown(cwd: string, fact: MemoryFact, targetDir?: string, options?: {
|
|
33
|
+
maxFacts?: number;
|
|
34
|
+
}): Promise<void>;
|
|
33
35
|
/**
|
|
34
36
|
* Every memory in the store, honouring the `enabled` gate on {@link MemoryConfig}: when memory is
|
|
35
37
|
* disabled the call resolves to `[]` without touching disk. Configuration-aware entry point;
|
|
@@ -29,7 +29,9 @@ export declare function readFactsFromMarkdown(cwd: string, config?: MemoryLocati
|
|
|
29
29
|
* `modified` is stamped HERE and never read from `fact`: a timestamp a caller can set is a
|
|
30
30
|
* timestamp that can lie about when something was learned, and weighing recency is the point.
|
|
31
31
|
*/
|
|
32
|
-
export declare function appendFactToMarkdown(cwd: string, fact: MemoryFact, targetDir?: string
|
|
32
|
+
export declare function appendFactToMarkdown(cwd: string, fact: MemoryFact, targetDir?: string, options?: {
|
|
33
|
+
maxFacts?: number;
|
|
34
|
+
}): Promise<void>;
|
|
33
35
|
/**
|
|
34
36
|
* Every memory in the store, honouring the `enabled` gate on {@link MemoryConfig}: when memory is
|
|
35
37
|
* disabled the call resolves to `[]` without touching disk. Configuration-aware entry point;
|
|
@@ -9,6 +9,12 @@ export interface MemoryConfig {
|
|
|
9
9
|
* See `storage/memory-root.ts` for why a relative value is refused rather than resolved.
|
|
10
10
|
*/
|
|
11
11
|
directory?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The most facts the write directory may hold. A new fact at the ceiling is refused with
|
|
14
|
+
* `memory_ceiling_reached`; a second observation of a stored fact is still admitted. Absent means
|
|
15
|
+
* no ceiling. The public contract is `MemorySettings.maxFacts` in `types/agent.ts`.
|
|
16
|
+
*/
|
|
17
|
+
maxFacts?: number;
|
|
12
18
|
}
|
|
13
19
|
/**
|
|
14
20
|
* What a fact IS, which is what decides whether it ages (#389).
|
|
@@ -4,7 +4,8 @@ var chunkVTYY7XL5_cjs = require('../../chunk-VTYY7XL5.cjs');
|
|
|
4
4
|
var chunkRQMCOFAI_cjs = require('../../chunk-RQMCOFAI.cjs');
|
|
5
5
|
var chunkA4RAL2ER_cjs = require('../../chunk-A4RAL2ER.cjs');
|
|
6
6
|
var chunkP22BZE7G_cjs = require('../../chunk-P22BZE7G.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkR5YPDAKD_cjs = require('../../chunk-R5YPDAKD.cjs');
|
|
8
|
+
var chunkASK2OQM5_cjs = require('../../chunk-ASK2OQM5.cjs');
|
|
8
9
|
var chunkZF2LDKQQ_cjs = require('../../chunk-ZF2LDKQQ.cjs');
|
|
9
10
|
var chunkJLRLCBJ4_cjs = require('../../chunk-JLRLCBJ4.cjs');
|
|
10
11
|
var chunkTY56BKSK_cjs = require('../../chunk-TY56BKSK.cjs');
|
|
@@ -75,23 +76,23 @@ Object.defineProperty(exports, "openSqliteResilient", {
|
|
|
75
76
|
});
|
|
76
77
|
Object.defineProperty(exports, "JsonlParseError", {
|
|
77
78
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
79
|
+
get: function () { return chunkR5YPDAKD_cjs.JsonlParseError; }
|
|
79
80
|
});
|
|
80
81
|
Object.defineProperty(exports, "appendJsonl", {
|
|
81
82
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
83
|
+
get: function () { return chunkR5YPDAKD_cjs.appendJsonl; }
|
|
83
84
|
});
|
|
84
85
|
Object.defineProperty(exports, "loadJsonl", {
|
|
85
86
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
87
|
+
get: function () { return chunkR5YPDAKD_cjs.loadJsonl; }
|
|
87
88
|
});
|
|
88
89
|
Object.defineProperty(exports, "readJsonlIds", {
|
|
89
90
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
91
|
+
get: function () { return chunkR5YPDAKD_cjs.readJsonlIds; }
|
|
91
92
|
});
|
|
92
93
|
Object.defineProperty(exports, "withFileLock", {
|
|
93
94
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
95
|
+
get: function () { return chunkASK2OQM5_cjs.withFileLock; }
|
|
95
96
|
});
|
|
96
97
|
Object.defineProperty(exports, "withCwdMutex", {
|
|
97
98
|
enumerable: true,
|