@theokit/sdk 4.55.0 → 4.57.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 +134 -0
- package/dist/a2a/index.cjs +13 -4
- package/dist/a2a/index.cjs.map +1 -1
- package/dist/a2a/index.d.cts +1 -1
- package/dist/a2a/index.d.ts +1 -1
- package/dist/a2a/index.js +13 -5
- package/dist/a2a/index.js.map +1 -1
- package/dist/a2a/message-bus.d.cts +33 -4
- package/dist/a2a/message-bus.d.ts +33 -4
- package/dist/{agent-R2HOJFZJ.cjs → agent-2T2EJIP6.cjs} +12 -11
- package/dist/{agent-R2HOJFZJ.cjs.map → agent-2T2EJIP6.cjs.map} +1 -1
- package/dist/{agent-HDEVVUBS.js → agent-ZIYCVEZL.js} +11 -10
- package/dist/{agent-HDEVVUBS.js.map → agent-ZIYCVEZL.js.map} +1 -1
- package/dist/agent-session-store-G2BMUZQV.js +7 -0
- package/dist/{agent-session-store-P6V3FINW.js.map → agent-session-store-G2BMUZQV.js.map} +1 -1
- package/dist/agent-session-store-WAKLOKWK.cjs +24 -0
- package/dist/{agent-session-store-ZJ3JSRS4.cjs.map → agent-session-store-WAKLOKWK.cjs.map} +1 -1
- package/dist/{chunk-HLPSLDGL.cjs → chunk-43GFJ5SD.cjs} +7 -7
- package/dist/{chunk-HLPSLDGL.cjs.map → chunk-43GFJ5SD.cjs.map} +1 -1
- package/dist/{chunk-5PHVENFV.js → chunk-7FHZ4VQX.js} +3 -55
- package/dist/chunk-7FHZ4VQX.js.map +1 -0
- package/dist/{chunk-I5BE5M5L.js → chunk-7TCRNXNK.js} +51 -31
- package/dist/chunk-7TCRNXNK.js.map +1 -0
- package/dist/{chunk-JHPGF3FP.cjs → chunk-BUIK7GUA.cjs} +22 -2
- package/dist/chunk-BUIK7GUA.cjs.map +1 -0
- package/dist/{chunk-Q47R5E2X.cjs → chunk-E3WZ6Y4H.cjs} +7 -59
- package/dist/chunk-E3WZ6Y4H.cjs.map +1 -0
- package/dist/{chunk-5UOVYM3P.cjs → chunk-E7JHD6QJ.cjs} +132 -54
- package/dist/chunk-E7JHD6QJ.cjs.map +1 -0
- package/dist/{chunk-DZBSJX6J.js → chunk-FKMUFNQE.js} +21 -4
- package/dist/chunk-FKMUFNQE.js.map +1 -0
- package/dist/{chunk-BMAZLQQ4.js → chunk-G24KZRSA.js} +3 -3
- package/dist/{chunk-BMAZLQQ4.js.map → chunk-G24KZRSA.js.map} +1 -1
- package/dist/{chunk-DAPSQZT4.js → chunk-G6EEYRDD.js} +132 -55
- package/dist/chunk-G6EEYRDD.js.map +1 -0
- package/dist/{chunk-MVAPK2BX.js → chunk-IACR5LEM.js} +3 -3
- package/dist/{chunk-MVAPK2BX.js.map → chunk-IACR5LEM.js.map} +1 -1
- package/dist/{chunk-V2UUGUY4.cjs → chunk-KKK3FZ4A.cjs} +6 -6
- package/dist/{chunk-V2UUGUY4.cjs.map → chunk-KKK3FZ4A.cjs.map} +1 -1
- package/dist/chunk-KRD3GQAA.cjs +71 -0
- package/dist/chunk-KRD3GQAA.cjs.map +1 -0
- package/dist/chunk-KVNWIAO4.js +68 -0
- package/dist/chunk-KVNWIAO4.js.map +1 -0
- package/dist/{chunk-IVNNSANC.js → chunk-LEM2GOMI.js} +3 -3
- package/dist/{chunk-IVNNSANC.js.map → chunk-LEM2GOMI.js.map} +1 -1
- package/dist/{chunk-F5WMX4EA.cjs → chunk-M2JWHKO6.cjs} +107 -87
- package/dist/chunk-M2JWHKO6.cjs.map +1 -0
- package/dist/{chunk-YPJ5NH5N.cjs → chunk-QI7WE46I.cjs} +29 -6
- package/dist/chunk-QI7WE46I.cjs.map +1 -0
- package/dist/{chunk-OHBIUXKM.js → chunk-WG7R5W6R.js} +4 -4
- package/dist/{chunk-OHBIUXKM.js.map → chunk-WG7R5W6R.js.map} +1 -1
- package/dist/{chunk-ITSSOVOB.cjs → chunk-X7O4255I.cjs} +4 -4
- package/dist/{chunk-ITSSOVOB.cjs.map → chunk-X7O4255I.cjs.map} +1 -1
- package/dist/{chunk-GJ6RK75E.js → chunk-YJDH3CKG.js} +29 -6
- package/dist/chunk-YJDH3CKG.js.map +1 -0
- package/dist/{chunk-CTCGWIUD.cjs → chunk-Z4BCLVTI.cjs} +5 -5
- package/dist/{chunk-CTCGWIUD.cjs.map → chunk-Z4BCLVTI.cjs.map} +1 -1
- package/dist/{compact-session-FUJDVF7B.js → compact-session-QGDNP45U.js} +4 -4
- package/dist/{compact-session-FUJDVF7B.js.map → compact-session-QGDNP45U.js.map} +1 -1
- package/dist/{compact-session-LEWF554G.cjs → compact-session-YHFQIXV5.cjs} +12 -12
- package/dist/{compact-session-LEWF554G.cjs.map → compact-session-YHFQIXV5.cjs.map} +1 -1
- package/dist/context/index.cjs +6 -5
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.js +3 -2
- package/dist/context/index.js.map +1 -1
- package/dist/cron.cjs +11 -10
- package/dist/cron.js +10 -9
- package/dist/eval.cjs +10 -9
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +9 -8
- package/dist/eval.js.map +1 -1
- package/dist/{fs-session-store-IN7JTTXD.js → fs-session-store-4BHGIWRE.js} +4 -4
- package/dist/{fs-session-store-IN7JTTXD.js.map → fs-session-store-4BHGIWRE.js.map} +1 -1
- package/dist/{fs-session-store-3MOJQGP2.cjs → fs-session-store-XZ7ZTB3A.cjs} +5 -5
- package/dist/{fs-session-store-3MOJQGP2.cjs.map → fs-session-store-XZ7ZTB3A.cjs.map} +1 -1
- package/dist/{index-manager-NG5YENWO.cjs → index-manager-AO4LJQZ4.cjs} +5 -4
- package/dist/{index-manager-NG5YENWO.cjs.map → index-manager-AO4LJQZ4.cjs.map} +1 -1
- package/dist/{index-manager-ZMRJ6ZII.js → index-manager-QDPIYIGV.js} +4 -3
- package/dist/{index-manager-ZMRJ6ZII.js.map → index-manager-QDPIYIGV.js.map} +1 -1
- package/dist/index.cjs +40 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-WQGGMCQY.cjs → inject-session-MLCJMYDG.cjs} +7 -7
- package/dist/{inject-session-WQGGMCQY.cjs.map → inject-session-MLCJMYDG.cjs.map} +1 -1
- package/dist/{inject-session-BJMJH5BX.js → inject-session-RBQZ45UM.js} +5 -5
- package/dist/{inject-session-BJMJH5BX.js.map → inject-session-RBQZ45UM.js.map} +1 -1
- package/dist/internal/memory/storage/markdown-store.d.ts +14 -2
- package/dist/internal/memory/storage/memory-file.d.ts +54 -0
- package/dist/internal/memory/types.d.ts +28 -0
- package/dist/internal/persistence/session-transcript.d.cts +40 -1
- package/dist/internal/persistence/session-transcript.d.ts +40 -1
- package/dist/persistence.cjs +4 -4
- package/dist/persistence.js +1 -1
- package/dist/sandbox/index.cjs +1 -1
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.js +1 -1
- package/dist/sandbox/index.js.map +1 -1
- package/dist/session-transcript-HF5GEU5M.cjs +63 -0
- package/dist/{session-transcript-JXHFTB7G.cjs.map → session-transcript-HF5GEU5M.cjs.map} +1 -1
- package/dist/session-transcript-P462ZRHX.js +6 -0
- package/dist/{session-transcript-AKDYYGXQ.js.map → session-transcript-P462ZRHX.js.map} +1 -1
- package/docs/error-codes.md +7 -5
- package/docs/harness-capability-map.md +3 -2
- package/package.json +5 -9
- package/dist/agent-session-store-P6V3FINW.js +0 -7
- package/dist/agent-session-store-ZJ3JSRS4.cjs +0 -24
- package/dist/chunk-5PHVENFV.js.map +0 -1
- package/dist/chunk-5UOVYM3P.cjs.map +0 -1
- package/dist/chunk-DAPSQZT4.js.map +0 -1
- package/dist/chunk-DZBSJX6J.js.map +0 -1
- package/dist/chunk-F5WMX4EA.cjs.map +0 -1
- package/dist/chunk-GJ6RK75E.js.map +0 -1
- package/dist/chunk-I5BE5M5L.js.map +0 -1
- package/dist/chunk-JHPGF3FP.cjs.map +0 -1
- package/dist/chunk-Q47R5E2X.cjs.map +0 -1
- package/dist/chunk-YPJ5NH5N.cjs.map +0 -1
- package/dist/session-transcript-AKDYYGXQ.js +0 -6
- package/dist/session-transcript-JXHFTB7G.cjs +0 -51
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkKKK3FZ4A_cjs = require('./chunk-KKK3FZ4A.cjs');
|
|
4
4
|
var chunk4OTIXDMU_cjs = require('./chunk-4OTIXDMU.cjs');
|
|
5
|
-
require('./chunk-
|
|
6
|
-
var
|
|
5
|
+
require('./chunk-Z4BCLVTI.cjs');
|
|
6
|
+
var chunkBUIK7GUA_cjs = require('./chunk-BUIK7GUA.cjs');
|
|
7
7
|
require('./chunk-I6TGFUCO.cjs');
|
|
8
8
|
require('./chunk-JTB5Q42C.cjs');
|
|
9
9
|
require('./chunk-NUKRL3I6.cjs');
|
|
10
10
|
|
|
11
11
|
// src/internal/session/inject-session.ts
|
|
12
12
|
async function injectSessionTurn(opts) {
|
|
13
|
-
await
|
|
13
|
+
await chunkKKK3FZ4A_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
14
14
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
15
|
-
const transcript =
|
|
15
|
+
const transcript = chunkBUIK7GUA_cjs.SessionTranscript.fromRecords(prior, {
|
|
16
16
|
cwd: opts.loc.cwd,
|
|
17
17
|
sessionId: opts.sessionId,
|
|
18
18
|
model: opts.loc.model ?? "unknown"
|
|
@@ -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-MLCJMYDG.cjs.map
|
|
29
|
+
//# sourceMappingURL=inject-session-MLCJMYDG.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-MLCJMYDG.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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { enqueueSessionWrite } from './chunk-
|
|
1
|
+
import { enqueueSessionWrite } from './chunk-WG7R5W6R.js';
|
|
2
2
|
import { invalidateSessionCache } from './chunk-WTMU7J4U.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import { SessionTranscript } from './chunk-
|
|
3
|
+
import './chunk-G24KZRSA.js';
|
|
4
|
+
import { SessionTranscript } from './chunk-FKMUFNQE.js';
|
|
5
5
|
import './chunk-VF7EWVDG.js';
|
|
6
6
|
import './chunk-T7XEKOVW.js';
|
|
7
7
|
import './chunk-T7O6K6PX.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-RBQZ45UM.js.map
|
|
27
|
+
//# sourceMappingURL=inject-session-RBQZ45UM.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-RBQZ45UM.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"]}
|
|
@@ -2,9 +2,21 @@ import { type MemoryConfig, type MemoryFact } from "../types.js";
|
|
|
2
2
|
export declare function memoryDir(cwd: string): string;
|
|
3
3
|
export declare function memoryMdPath(cwd: string): string;
|
|
4
4
|
export declare function notesDir(cwd: string): string;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Every memory in the store: the per-memory files, plus any legacy `## Facts` bullets still in
|
|
7
|
+
* `MEMORY.md`. Returns `[]` when the directory does not exist.
|
|
8
|
+
*
|
|
9
|
+
* Reading both is not transitional politeness. Those bullets are already on disk in consumers'
|
|
10
|
+
* repositories, and the store's own header invites editing them by hand — a converged writer that
|
|
11
|
+
* stopped reading them would delete what someone recorded, which is worse than the format it fixes.
|
|
12
|
+
*/
|
|
6
13
|
export declare function readFactsFromMarkdown(cwd: string): Promise<MemoryFact[]>;
|
|
7
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Write a fact as its own memory file and point the `MEMORY.md` index at it. Atomic + serialized.
|
|
16
|
+
*
|
|
17
|
+
* `modified` is stamped HERE and never read from `fact`: a timestamp a caller can set is a
|
|
18
|
+
* timestamp that can lie about when something was learned, and weighing recency is the point.
|
|
19
|
+
*/
|
|
8
20
|
export declare function appendFactToMarkdown(cwd: string, fact: MemoryFact): Promise<void>;
|
|
9
21
|
/** Configuration-aware accessors honoring the existing MemoryConfig contract. */
|
|
10
22
|
export declare function readFacts(cwd: string, config: MemoryConfig): Promise<MemoryFact[]>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One memory as a file, in the shape the Claude Code CLI reads.
|
|
3
|
+
*
|
|
4
|
+
* `@theokit/sdk` already writes native Claude Code `.jsonl` sessions — the README's differentiator
|
|
5
|
+
* is "point `local.sessionDir` at `~/.claude` and the Claude Code CLI can `--continue` a session
|
|
6
|
+
* your agent wrote". Memory had no such convergence: a fact was a bullet under `## Facts` with its
|
|
7
|
+
* kind in an HTML comment (#389), which that CLI reads as prose. Pointing a memory directory at
|
|
8
|
+
* `~/.claude/projects/<project>/memory/` produced nothing it could open.
|
|
9
|
+
*
|
|
10
|
+
* The contract here was measured against a real store rather than inferred from documentation. Of
|
|
11
|
+
* nine files, all nine carry `name`, `description` and `metadata.type`; six also carry
|
|
12
|
+
* `node_type`, `originSessionId` and `modified`, which the runtime stamps on write. So the minimum
|
|
13
|
+
* a reader must accept is the first three — refusing the rest would refuse memories the CLI itself
|
|
14
|
+
* accepts.
|
|
15
|
+
*
|
|
16
|
+
* `originSessionId` is deliberately not written. It identifies the session that learned the fact,
|
|
17
|
+
* and the append path has no session in scope; inventing one would be worse than omitting a field
|
|
18
|
+
* the format already treats as optional.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
import { type MemoryKind } from "../types.js";
|
|
23
|
+
/** The fields one memory file carries. */
|
|
24
|
+
export interface MemoryFileFields {
|
|
25
|
+
/** Slug, and the file's basename. */
|
|
26
|
+
readonly name: string;
|
|
27
|
+
/** One-line summary — what the index shows and what recall ranks. */
|
|
28
|
+
readonly description: string;
|
|
29
|
+
/** `metadata.type`, absent when the file does not declare one this contract admits. */
|
|
30
|
+
readonly kind?: MemoryKind;
|
|
31
|
+
/** `metadata.modified`, an ISO 8601 instant stamped by whoever wrote the file. */
|
|
32
|
+
readonly modified?: string;
|
|
33
|
+
/** The markdown after the frontmatter. */
|
|
34
|
+
readonly body: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A readable, filesystem-safe slug for `text`.
|
|
38
|
+
*
|
|
39
|
+
* Readability is the goal — a directory of `h-3f2a…` files is a directory nobody browses — but it
|
|
40
|
+
* is not the floor. The text comes from whatever a caller learned, so anything that fails the safe
|
|
41
|
+
* grammar falls back to {@link safeFilenameForId}, which is total and always yields a valid
|
|
42
|
+
* component.
|
|
43
|
+
*/
|
|
44
|
+
export declare function slugForFact(text: string): string;
|
|
45
|
+
/** Render one memory file. `description` is quoted so a colon in the text cannot break the block. */
|
|
46
|
+
export declare function renderMemoryFile(fields: MemoryFileFields): string;
|
|
47
|
+
/**
|
|
48
|
+
* Read one memory file, or `undefined` when the content is not one.
|
|
49
|
+
*
|
|
50
|
+
* `undefined` rather than a throw, and rather than a best-effort object: the directory holds
|
|
51
|
+
* hand-written notes and a `MEMORY.md` index alongside the memories, and turning any of those into
|
|
52
|
+
* a fact would put text into recall that nobody recorded as one.
|
|
53
|
+
*/
|
|
54
|
+
export declare function parseMemoryFile(raw: string): MemoryFileFields | undefined;
|
|
@@ -5,8 +5,36 @@ export interface MemoryConfig {
|
|
|
5
5
|
scope?: "agent" | "user" | "team";
|
|
6
6
|
storePath?: string;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* What a fact IS, which is what decides whether it ages (#389).
|
|
10
|
+
*
|
|
11
|
+
* The four are the distinctions that matter for retention and recall: a preference stays true until
|
|
12
|
+
* the user changes their mind, a project fact goes stale when the code moves, a reference either
|
|
13
|
+
* resolves or 404s, and feedback records a correction that was given. Without them, recall ranks one
|
|
14
|
+
* undifferentiated corpus and pruning has no basis to prefer a durable fact over a transient one.
|
|
15
|
+
*
|
|
16
|
+
* A kind is never INFERRED. A wrong kind is worse than none, because it makes retention and recall
|
|
17
|
+
* confident about the wrong thing — so a fact whose author did not say stays untyped.
|
|
18
|
+
*/
|
|
19
|
+
export type MemoryKind = "user" | "feedback" | "project" | "reference";
|
|
20
|
+
/** The four values {@link MemoryKind} admits, for runtime validation at the storage boundary. */
|
|
21
|
+
export declare const MEMORY_KINDS: readonly MemoryKind[];
|
|
8
22
|
export interface MemoryFact {
|
|
9
23
|
text: string;
|
|
24
|
+
/**
|
|
25
|
+
* What this fact is (#389). Absent means untyped, which is what a hand-written bullet under
|
|
26
|
+
* `## Facts` stays — those files are already on disk in consumers' repositories and the store's
|
|
27
|
+
* own header invites editing them.
|
|
28
|
+
*/
|
|
29
|
+
kind?: MemoryKind;
|
|
30
|
+
/**
|
|
31
|
+
* ISO 8601 instant this fact was last written, stamped BY THE SDK.
|
|
32
|
+
*
|
|
33
|
+
* Supplying it does nothing: a timestamp a caller can set is a timestamp that can lie about when
|
|
34
|
+
* something was learned, and the whole point is to weigh a note from this morning against one
|
|
35
|
+
* from four months ago. Absent on a fact written before this existed, or hand-added.
|
|
36
|
+
*/
|
|
37
|
+
modified?: string;
|
|
10
38
|
}
|
|
11
39
|
export { redactSecrets } from "../security/index.js";
|
|
12
40
|
/**
|
|
@@ -81,8 +81,47 @@ export declare function defaultBaseDir(): string;
|
|
|
81
81
|
* paths without a leading tilde pass through untouched.
|
|
82
82
|
*/
|
|
83
83
|
export declare function expandTilde(p: string): string;
|
|
84
|
-
/**
|
|
84
|
+
/** Is this id already a canonical UUID, and therefore usable as a filename verbatim? */
|
|
85
|
+
export declare function isSessionUuid(id: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The transcript filename for an agent id — always a UUID.
|
|
88
|
+
*
|
|
89
|
+
* #400: the Claude Code CLI resumes a transcript ONLY when its basename is a UUID. Measured against
|
|
90
|
+
* CLI 2.1.236: `<uuid>.jsonl` resumes; `agent-<uuid>.jsonl` and `billing-bot.jsonl` are both ignored,
|
|
91
|
+
* with no error — the session simply is not offered. So a session written under a human-readable
|
|
92
|
+
* agent id was invisible to `claude --continue`, which is the interoperability this project claims
|
|
93
|
+
* as its difference from a proprietary session store.
|
|
94
|
+
*
|
|
95
|
+
* An id that is ALREADY a UUID passes through verbatim, so a transcript Claude Code wrote keeps its
|
|
96
|
+
* own name and the two directions stay symmetric. Anything else is derived with a UUIDv8, which is
|
|
97
|
+
* deterministic: the same agent id always yields the same filename, so nothing has to be persisted
|
|
98
|
+
* to map one back to the other.
|
|
99
|
+
*
|
|
100
|
+
* A DERIVED name is version 8 — RFC 9562's slot for a UUID whose bits come from an
|
|
101
|
+
* implementation-defined scheme, which is exactly what this is. The obvious alternative was v5, but
|
|
102
|
+
* RFC 4122 fixes v5's hash to SHA-1, and reaching for SHA-1 in 2026 means either shipping a weak
|
|
103
|
+
* primitive or arguing with every scanner that flags it, forever. v8 lets the hash be SHA-256 and
|
|
104
|
+
* lets the version nibble say honestly that this is our scheme rather than a standard one.
|
|
105
|
+
*
|
|
106
|
+
* There is no security claim here either way — no secret, no signature, and nothing an attacker
|
|
107
|
+
* gains by colliding two agent ids inside one consumer's own directory. The hash is a naming
|
|
108
|
+
* function. The point of preferring SHA-256 is not that SHA-1 was exploitable here; it is that a
|
|
109
|
+
* weak primitive in the tree costs a permanent argument with every scanner that sees it.
|
|
110
|
+
*
|
|
111
|
+
* The version nibble was measured, not assumed: CLI 2.1.236 resumes a v8-named transcript exactly as
|
|
112
|
+
* it does a v4 one.
|
|
113
|
+
*/
|
|
114
|
+
export declare function sessionUuidFor(id: string): string;
|
|
115
|
+
/** The `.jsonl` path for a session: `<baseDir>/projects/<encoded-cwd>/<session-uuid>.jsonl`. */
|
|
85
116
|
export declare function transcriptPath(baseDir: string, cwd: string, sessionId: string): string;
|
|
117
|
+
/**
|
|
118
|
+
* The path this session used BEFORE #400 made transcript filenames UUIDs.
|
|
119
|
+
*
|
|
120
|
+
* Kept so an existing transcript is never orphaned: {@link FsSessionStore} prefers this file when it
|
|
121
|
+
* exists, so history written under the old scheme keeps accumulating in the same file instead of
|
|
122
|
+
* being silently abandoned for a fresh one under the new name.
|
|
123
|
+
*/
|
|
124
|
+
export declare function legacyTranscriptPath(baseDir: string, cwd: string, sessionId: string): string;
|
|
86
125
|
/** Write records as one JSONL line each (atomic; parent dir created). Returns the path. */
|
|
87
126
|
export declare function writeTranscript(path: string, records: readonly SessionRecord[]): Promise<string>;
|
|
88
127
|
/** Parse a transcript `.jsonl` into records; a missing file yields `[]`; malformed lines are skipped. */
|
|
@@ -81,8 +81,47 @@ export declare function defaultBaseDir(): string;
|
|
|
81
81
|
* paths without a leading tilde pass through untouched.
|
|
82
82
|
*/
|
|
83
83
|
export declare function expandTilde(p: string): string;
|
|
84
|
-
/**
|
|
84
|
+
/** Is this id already a canonical UUID, and therefore usable as a filename verbatim? */
|
|
85
|
+
export declare function isSessionUuid(id: string): boolean;
|
|
86
|
+
/**
|
|
87
|
+
* The transcript filename for an agent id — always a UUID.
|
|
88
|
+
*
|
|
89
|
+
* #400: the Claude Code CLI resumes a transcript ONLY when its basename is a UUID. Measured against
|
|
90
|
+
* CLI 2.1.236: `<uuid>.jsonl` resumes; `agent-<uuid>.jsonl` and `billing-bot.jsonl` are both ignored,
|
|
91
|
+
* with no error — the session simply is not offered. So a session written under a human-readable
|
|
92
|
+
* agent id was invisible to `claude --continue`, which is the interoperability this project claims
|
|
93
|
+
* as its difference from a proprietary session store.
|
|
94
|
+
*
|
|
95
|
+
* An id that is ALREADY a UUID passes through verbatim, so a transcript Claude Code wrote keeps its
|
|
96
|
+
* own name and the two directions stay symmetric. Anything else is derived with a UUIDv8, which is
|
|
97
|
+
* deterministic: the same agent id always yields the same filename, so nothing has to be persisted
|
|
98
|
+
* to map one back to the other.
|
|
99
|
+
*
|
|
100
|
+
* A DERIVED name is version 8 — RFC 9562's slot for a UUID whose bits come from an
|
|
101
|
+
* implementation-defined scheme, which is exactly what this is. The obvious alternative was v5, but
|
|
102
|
+
* RFC 4122 fixes v5's hash to SHA-1, and reaching for SHA-1 in 2026 means either shipping a weak
|
|
103
|
+
* primitive or arguing with every scanner that flags it, forever. v8 lets the hash be SHA-256 and
|
|
104
|
+
* lets the version nibble say honestly that this is our scheme rather than a standard one.
|
|
105
|
+
*
|
|
106
|
+
* There is no security claim here either way — no secret, no signature, and nothing an attacker
|
|
107
|
+
* gains by colliding two agent ids inside one consumer's own directory. The hash is a naming
|
|
108
|
+
* function. The point of preferring SHA-256 is not that SHA-1 was exploitable here; it is that a
|
|
109
|
+
* weak primitive in the tree costs a permanent argument with every scanner that sees it.
|
|
110
|
+
*
|
|
111
|
+
* The version nibble was measured, not assumed: CLI 2.1.236 resumes a v8-named transcript exactly as
|
|
112
|
+
* it does a v4 one.
|
|
113
|
+
*/
|
|
114
|
+
export declare function sessionUuidFor(id: string): string;
|
|
115
|
+
/** The `.jsonl` path for a session: `<baseDir>/projects/<encoded-cwd>/<session-uuid>.jsonl`. */
|
|
85
116
|
export declare function transcriptPath(baseDir: string, cwd: string, sessionId: string): string;
|
|
117
|
+
/**
|
|
118
|
+
* The path this session used BEFORE #400 made transcript filenames UUIDs.
|
|
119
|
+
*
|
|
120
|
+
* Kept so an existing transcript is never orphaned: {@link FsSessionStore} prefers this file when it
|
|
121
|
+
* exists, so history written under the old scheme keeps accumulating in the same file instead of
|
|
122
|
+
* being silently abandoned for a fresh one under the new name.
|
|
123
|
+
*/
|
|
124
|
+
export declare function legacyTranscriptPath(baseDir: string, cwd: string, sessionId: string): string;
|
|
86
125
|
/** Write records as one JSONL line each (atomic; parent dir created). Returns the path. */
|
|
87
126
|
export declare function writeTranscript(path: string, records: readonly SessionRecord[]): Promise<string>;
|
|
88
127
|
/** Parse a transcript `.jsonl` into records; a missing file yields `[]`; malformed lines are skipped. */
|
package/dist/persistence.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkVTYY7XL5_cjs = require('./chunk-VTYY7XL5.cjs');
|
|
4
4
|
var chunk4I55V454_cjs = require('./chunk-4I55V454.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkBUIK7GUA_cjs = require('./chunk-BUIK7GUA.cjs');
|
|
6
6
|
var chunkSKXBJ2NU_cjs = require('./chunk-SKXBJ2NU.cjs');
|
|
7
7
|
var chunk2ADR2GSO_cjs = require('./chunk-2ADR2GSO.cjs');
|
|
8
8
|
var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
|
|
@@ -114,15 +114,15 @@ Object.defineProperty(exports, "sessionHasWriter", {
|
|
|
114
114
|
});
|
|
115
115
|
Object.defineProperty(exports, "encodeProjectDir", {
|
|
116
116
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunkBUIK7GUA_cjs.encodeProjectDir; }
|
|
118
118
|
});
|
|
119
119
|
Object.defineProperty(exports, "transcriptPath", {
|
|
120
120
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunkBUIK7GUA_cjs.transcriptPath; }
|
|
122
122
|
});
|
|
123
123
|
Object.defineProperty(exports, "transcriptRoot", {
|
|
124
124
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunkBUIK7GUA_cjs.transcriptRoot; }
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "applyWalWithFallback", {
|
|
128
128
|
enumerable: true,
|
package/dist/persistence.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { PersistenceSchema } from './chunk-HY66GLM6.js';
|
|
2
2
|
export { SessionBusyError, acquireSessionWriter, sessionHasWriter } from './chunk-44JAAH4X.js';
|
|
3
|
-
export { encodeProjectDir, transcriptPath, transcriptRoot } from './chunk-
|
|
3
|
+
export { encodeProjectDir, transcriptPath, transcriptRoot } from './chunk-FKMUFNQE.js';
|
|
4
4
|
export { applyWalWithFallback, isCorruptionError, openSqliteResilient, sanitizeFts5Query } from './chunk-CQ2TQ32Y.js';
|
|
5
5
|
export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds, withFileLock } from './chunk-CV7XMBHP.js';
|
|
6
6
|
export { withCwdMutex } from './chunk-Q5EWJPRY.js';
|
package/dist/sandbox/index.cjs
CHANGED
|
@@ -154,7 +154,7 @@ var RET_EPERM = SECCOMP_RET_ERRNO | EPERM & 65535;
|
|
|
154
154
|
var SECCOMP_RET_KILL_PROCESS = 2147483648;
|
|
155
155
|
var AF_UNIX = 1;
|
|
156
156
|
var ALWAYS_DENIED = [101, 310, 311, 425, 426, 427];
|
|
157
|
-
var NETWORK_DENIED = [42, 43, 288, 49, 50,
|
|
157
|
+
var NETWORK_DENIED = [42, 43, 288, 49, 50, 48, 44, 307, 299];
|
|
158
158
|
var SOCKET_SYSCALLS = [41, 53];
|
|
159
159
|
var stmt = (code, k) => ({ code, jt: 0, jf: 0, k });
|
|
160
160
|
var jmp = (code, k, jt, jf) => ({ code, jt, jf, k });
|