@theokit/sdk 5.5.0 → 5.7.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 +667 -0
- package/dist/{agent-CjMVbhhY.d.ts → agent-Bqzdhkqr.d.ts} +12 -3
- package/dist/{agent-DyB_lzrx.d.cts → agent-Dya5SmhY.d.cts} +12 -3
- package/dist/{agent-G3T7Q3SQ.js → agent-EQ5HKTWV.js} +15 -14
- package/dist/{agent-G3T7Q3SQ.js.map → agent-EQ5HKTWV.js.map} +1 -1
- package/dist/{agent-YWSIHHFM.cjs → agent-KA63WDQH.cjs} +16 -15
- package/dist/{agent-YWSIHHFM.cjs.map → agent-KA63WDQH.cjs.map} +1 -1
- package/dist/agent.d.ts +11 -0
- package/dist/{chunk-Z2JFX372.cjs → chunk-33A27NFX.cjs} +15 -15
- package/dist/{chunk-Z2JFX372.cjs.map → chunk-33A27NFX.cjs.map} +1 -1
- package/dist/{chunk-N6OOOYFZ.js → chunk-3VXQEQE4.js} +13 -4
- package/dist/chunk-3VXQEQE4.js.map +1 -0
- package/dist/{chunk-DZG77WU7.cjs → chunk-3XSWF5AP.cjs} +3 -3
- package/dist/{chunk-DZG77WU7.cjs.map → chunk-3XSWF5AP.cjs.map} +1 -1
- package/dist/{chunk-M3ZGRGOG.js → chunk-6JG2RFGK.js} +3 -3
- package/dist/{chunk-M3ZGRGOG.js.map → chunk-6JG2RFGK.js.map} +1 -1
- package/dist/{chunk-S6B5XYC3.js → chunk-7C3HWGCW.js} +33 -22
- package/dist/chunk-7C3HWGCW.js.map +1 -0
- package/dist/{chunk-LOHMT36V.cjs → chunk-7KBNBPFK.cjs} +75 -2
- package/dist/chunk-7KBNBPFK.cjs.map +1 -0
- package/dist/{chunk-UKJJRU7C.cjs → chunk-A575WPBL.cjs} +330 -129
- package/dist/chunk-A575WPBL.cjs.map +1 -0
- package/dist/{chunk-2XRAWOZZ.js → chunk-A6PDYH55.js} +74 -3
- package/dist/chunk-A6PDYH55.js.map +1 -0
- package/dist/{chunk-LX7SEXOQ.js → chunk-CA5VUAP3.js} +25 -7
- package/dist/chunk-CA5VUAP3.js.map +1 -0
- package/dist/{chunk-2QKV4CGK.js → chunk-CZWN4C6A.js} +3 -3
- package/dist/{chunk-2QKV4CGK.js.map → chunk-CZWN4C6A.js.map} +1 -1
- package/dist/chunk-DQNI52VV.js +20 -0
- package/dist/chunk-DQNI52VV.js.map +1 -0
- package/dist/{chunk-VPK6PHIE.cjs → chunk-E6QXZZKE.cjs} +8 -8
- package/dist/{chunk-VPK6PHIE.cjs.map → chunk-E6QXZZKE.cjs.map} +1 -1
- package/dist/{chunk-IU5N5224.cjs → chunk-EFETPSJZ.cjs} +17 -8
- package/dist/chunk-EFETPSJZ.cjs.map +1 -0
- package/dist/{chunk-2ZLQZHZC.cjs → chunk-ER5BOIYD.cjs} +4 -4
- package/dist/{chunk-2ZLQZHZC.cjs.map → chunk-ER5BOIYD.cjs.map} +1 -1
- package/dist/{chunk-ODBID5TG.js → chunk-FUUSIT2T.js} +234 -35
- package/dist/chunk-FUUSIT2T.js.map +1 -0
- package/dist/{chunk-VY6NKMOA.cjs → chunk-GK3UG7YQ.cjs} +34 -25
- package/dist/chunk-GK3UG7YQ.cjs.map +1 -0
- package/dist/{chunk-NQTNSHSB.cjs → chunk-HNAYCTX4.cjs} +5 -5
- package/dist/chunk-HNAYCTX4.cjs.map +1 -0
- package/dist/{chunk-QATRS7JD.cjs → chunk-MYJGWS2J.cjs} +26 -8
- package/dist/chunk-MYJGWS2J.cjs.map +1 -0
- package/dist/{chunk-KZSKIUXZ.js → chunk-N7VAE6DZ.js} +31 -3
- package/dist/chunk-N7VAE6DZ.js.map +1 -0
- package/dist/{chunk-7SZAV6QG.js → chunk-P5S3WCSZ.js} +3 -3
- package/dist/{chunk-7SZAV6QG.js.map → chunk-P5S3WCSZ.js.map} +1 -1
- package/dist/{chunk-HW7SEELD.cjs → chunk-QRVS2PRE.cjs} +31 -8
- package/dist/chunk-QRVS2PRE.cjs.map +1 -0
- package/dist/{chunk-SADXXGWU.js → chunk-R3LBRQAN.js} +3 -3
- package/dist/{chunk-NQTNSHSB.cjs.map → chunk-R3LBRQAN.js.map} +1 -1
- package/dist/{chunk-AYA65JA5.cjs → chunk-RWPLWMCZ.cjs} +25 -9
- package/dist/chunk-RWPLWMCZ.cjs.map +1 -0
- package/dist/{chunk-O7L7M42F.js → chunk-T3ZDEYTJ.js} +21 -5
- package/dist/chunk-T3ZDEYTJ.js.map +1 -0
- package/dist/{chunk-43YXGD3P.cjs → chunk-TY56BKSK.cjs} +8 -4
- package/dist/chunk-TY56BKSK.cjs.map +1 -0
- package/dist/chunk-UOLBAPDM.js +66 -0
- package/dist/chunk-UOLBAPDM.js.map +1 -0
- package/dist/{chunk-NSLHPAC7.js → chunk-X7EUUHXU.js} +6 -5
- package/dist/chunk-X7EUUHXU.js.map +1 -0
- package/dist/{chunk-WS5ULCL4.js → chunk-YRLI5DVC.js} +3 -3
- package/dist/{chunk-WS5ULCL4.js.map → chunk-YRLI5DVC.js.map} +1 -1
- package/dist/chunk-YYN6BB7R.cjs +24 -0
- package/dist/chunk-YYN6BB7R.cjs.map +1 -0
- package/dist/{chunk-C4ZQPWXJ.cjs → chunk-ZLMU5EU3.cjs} +33 -4
- package/dist/chunk-ZLMU5EU3.cjs.map +1 -0
- package/dist/{compact-session-7FMYJXQ7.cjs → compact-session-75KD2FCM.cjs} +15 -11
- package/dist/{compact-session-7FMYJXQ7.cjs.map → compact-session-75KD2FCM.cjs.map} +1 -1
- package/dist/{compact-session-YSEK7NQF.js → compact-session-QT6RJOKO.js} +3 -3
- package/dist/{compact-session-YSEK7NQF.js.map → compact-session-QT6RJOKO.js.map} +1 -1
- package/dist/context/index.cjs +11 -7
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.js +7 -3
- package/dist/context/index.js.map +1 -1
- package/dist/context-7RP5JXGM.cjs +24 -0
- package/dist/{context-JTGSBJT6.cjs.map → context-7RP5JXGM.cjs.map} +1 -1
- package/dist/context-OJIIXJCV.js +7 -0
- package/dist/{context-3HPU754C.js.map → context-OJIIXJCV.js.map} +1 -1
- package/dist/{cron-Bgivg88c.d.cts → cron-BwxDUscv.d.cts} +1 -1
- package/dist/{cron-CNUa7PDo.d.ts → cron-D8uB1Xh5.d.ts} +1 -1
- package/dist/cron.cjs +15 -14
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +14 -13
- package/dist/eval.cjs +14 -13
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +13 -12
- package/dist/eval.js.map +1 -1
- package/dist/{index-manager-3UNPYH34.cjs → index-manager-W7RHSL6G.cjs} +6 -6
- package/dist/{index-manager-3UNPYH34.cjs.map → index-manager-W7RHSL6G.cjs.map} +1 -1
- package/dist/{index-manager-W7FDMGEG.js → index-manager-Z4XMRVWQ.js} +5 -5
- package/dist/{index-manager-W7FDMGEG.js.map → index-manager-Z4XMRVWQ.js.map} +1 -1
- package/dist/index.cjs +284 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +197 -5
- package/dist/index.d.ts +197 -5
- package/dist/index.js +249 -25
- package/dist/index.js.map +1 -1
- package/dist/{inject-session-PC73TMP2.cjs → inject-session-L6MIIELT.cjs} +4 -4
- package/dist/{inject-session-PC73TMP2.cjs.map → inject-session-L6MIIELT.cjs.map} +1 -1
- package/dist/{inject-session-J4LBWAPH.js → inject-session-XWWN4DAA.js} +3 -3
- package/dist/{inject-session-J4LBWAPH.js.map → inject-session-XWWN4DAA.js.map} +1 -1
- package/dist/internal/memory/storage/index.cjs +32 -32
- package/dist/internal/memory/storage/index.js +3 -3
- package/dist/internal/memory/storage/memory-root.d.cts +27 -0
- package/dist/internal/memory/storage/memory-root.d.ts +27 -0
- package/dist/internal/persistence/index.cjs +4 -4
- package/dist/internal/persistence/index.js +1 -1
- package/dist/internal/runtime/compat/foreign-config-sources.d.ts +17 -4
- package/dist/internal/runtime/compat/managed-settings.d.ts +80 -0
- package/dist/internal/runtime/context/context-discovery-runner.d.ts +14 -0
- package/dist/internal/runtime/context/context-discovery.d.ts +64 -0
- package/dist/internal/runtime/context/context-manager.d.ts +21 -1
- package/dist/internal/runtime/context/yaml-frontmatter.d.ts +6 -3
- package/dist/internal/runtime/hooks/hooks-executor.d.ts +13 -1
- package/dist/internal/runtime/hooks/hooks-source.d.ts +36 -1
- package/dist/internal/runtime/skills/discover-skills.d.ts +4 -0
- package/dist/internal/session/compact-session.d.ts +36 -0
- package/dist/project.cjs +3 -3
- package/dist/project.js +1 -1
- package/dist/skills.cjs +5 -5
- package/dist/skills.js +2 -2
- package/dist/subagents-loader-CJFYQQU2.js +7 -0
- package/dist/{subagents-loader-AIVDQ2D5.js.map → subagents-loader-CJFYQQU2.js.map} +1 -1
- package/dist/subagents-loader-MOO7DC4E.cjs +16 -0
- package/dist/{subagents-loader-DN4LETGL.cjs.map → subagents-loader-MOO7DC4E.cjs.map} +1 -1
- package/dist/subagents-loader.cjs +4 -4
- package/dist/subagents-loader.d.cts +1 -1
- package/dist/subagents-loader.d.ts +1 -1
- package/dist/subagents-loader.js +3 -3
- package/dist/types/agent.d.ts +7 -2
- package/docs/error-codes.md +20 -18
- package/docs/harness-capability-map.md +9 -1
- package/package.json +1 -1
- package/dist/chunk-2XRAWOZZ.js.map +0 -1
- package/dist/chunk-43YXGD3P.cjs.map +0 -1
- package/dist/chunk-AYA65JA5.cjs.map +0 -1
- package/dist/chunk-C4ZQPWXJ.cjs.map +0 -1
- package/dist/chunk-HW7SEELD.cjs.map +0 -1
- package/dist/chunk-IU5N5224.cjs.map +0 -1
- package/dist/chunk-JNAA4G4H.js +0 -43
- package/dist/chunk-JNAA4G4H.js.map +0 -1
- package/dist/chunk-KZSKIUXZ.js.map +0 -1
- package/dist/chunk-LOHMT36V.cjs.map +0 -1
- package/dist/chunk-LX7SEXOQ.js.map +0 -1
- package/dist/chunk-N6OOOYFZ.js.map +0 -1
- package/dist/chunk-NSLHPAC7.js.map +0 -1
- package/dist/chunk-O7L7M42F.js.map +0 -1
- package/dist/chunk-ODBID5TG.js.map +0 -1
- package/dist/chunk-QATRS7JD.cjs.map +0 -1
- package/dist/chunk-S6B5XYC3.js.map +0 -1
- package/dist/chunk-SADXXGWU.js.map +0 -1
- package/dist/chunk-UKJJRU7C.cjs.map +0 -1
- package/dist/chunk-VY6NKMOA.cjs.map +0 -1
- package/dist/context-3HPU754C.js +0 -6
- package/dist/context-JTGSBJT6.cjs +0 -23
- package/dist/subagents-loader-AIVDQ2D5.js +0 -7
- package/dist/subagents-loader-DN4LETGL.cjs +0 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3XSWF5AP_cjs = require('./chunk-3XSWF5AP.cjs');
|
|
4
4
|
var chunkYJNYDJ2T_cjs = require('./chunk-YJNYDJ2T.cjs');
|
|
5
5
|
require('./chunk-YIFFF23U.cjs');
|
|
6
6
|
var chunkGZV6AVRL_cjs = require('./chunk-GZV6AVRL.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 chunk3XSWF5AP_cjs.enqueueSessionWrite(opts.loc.cwd, opts.loc.agentId, async () => {
|
|
14
14
|
const prior = await opts.store.readRecords(opts.loc.agentId);
|
|
15
15
|
const transcript = chunkGZV6AVRL_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-L6MIIELT.cjs.map
|
|
29
|
+
//# sourceMappingURL=inject-session-L6MIIELT.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-L6MIIELT.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,4 +1,4 @@
|
|
|
1
|
-
import { enqueueSessionWrite } from './chunk-
|
|
1
|
+
import { enqueueSessionWrite } from './chunk-CZWN4C6A.js';
|
|
2
2
|
import { invalidateSessionCache } from './chunk-2XC6KDJM.js';
|
|
3
3
|
import './chunk-2WXHA33T.js';
|
|
4
4
|
import { SessionTranscript } from './chunk-JOFVLOFY.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-XWWN4DAA.js.map
|
|
27
|
+
//# sourceMappingURL=inject-session-XWWN4DAA.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-XWWN4DAA.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,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkE6QXZZKE_cjs = require('../../../chunk-E6QXZZKE.cjs');
|
|
4
4
|
var chunkTMKTSYDS_cjs = require('../../../chunk-TMKTSYDS.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkHNAYCTX4_cjs = require('../../../chunk-HNAYCTX4.cjs');
|
|
6
6
|
require('../../../chunk-KRD3GQAA.cjs');
|
|
7
7
|
require('../../../chunk-MUUQ2WFJ.cjs');
|
|
8
|
-
require('../../../chunk-
|
|
8
|
+
require('../../../chunk-7KBNBPFK.cjs');
|
|
9
9
|
require('../../../chunk-7A6535RA.cjs');
|
|
10
10
|
require('../../../chunk-SA6K24NB.cjs');
|
|
11
11
|
require('../../../chunk-GZV6AVRL.cjs');
|
|
@@ -19,23 +19,23 @@ require('../../../chunk-6LHQPOMI.cjs');
|
|
|
19
19
|
|
|
20
20
|
Object.defineProperty(exports, "appendDiaryEntry", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkE6QXZZKE_cjs.appendDiaryEntry; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "diaryPath", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkE6QXZZKE_cjs.diaryPath; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "entryHash", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkE6QXZZKE_cjs.entryHash; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "readAllSqliteFacts", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkE6QXZZKE_cjs.readAllSqliteFacts; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "renderDiaryEntry", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkE6QXZZKE_cjs.renderDiaryEntry; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "persistActiveMemoryTranscript", {
|
|
41
41
|
enumerable: true,
|
|
@@ -43,99 +43,99 @@ Object.defineProperty(exports, "persistActiveMemoryTranscript", {
|
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "MEMORY_INDEX_MAX_BYTES", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkHNAYCTX4_cjs.MEMORY_INDEX_MAX_BYTES; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "MEMORY_INDEX_MAX_LINES", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkHNAYCTX4_cjs.MEMORY_INDEX_MAX_LINES; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "appendFact", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkHNAYCTX4_cjs.appendFact; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "appendFactToMarkdown", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkHNAYCTX4_cjs.appendFactToMarkdown; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "asMemoryRoot", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkHNAYCTX4_cjs.asMemoryRoot; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "claudeProjectMemoryDir", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkHNAYCTX4_cjs.claudeProjectMemoryDir; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "collectMarkdownFiles", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkHNAYCTX4_cjs.collectMarkdownFiles; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "defaultIndexPath", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkHNAYCTX4_cjs.defaultIndexPath; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "discoverSessionFiles", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkHNAYCTX4_cjs.discoverSessionFiles; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "discoverWikiFiles", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkHNAYCTX4_cjs.discoverWikiFiles; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "indexBudgetWarning", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkHNAYCTX4_cjs.indexBudgetWarning; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "lanceStoragePath", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkHNAYCTX4_cjs.lanceStoragePath; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "memoryIndexRoot", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkHNAYCTX4_cjs.memoryIndexRoot; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "memoryMdPath", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkHNAYCTX4_cjs.memoryMdPath; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "memoryReadRoots", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkHNAYCTX4_cjs.memoryReadRoots; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "notesDir", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunkHNAYCTX4_cjs.notesDir; }
|
|
107
107
|
});
|
|
108
108
|
Object.defineProperty(exports, "projectMemoryDir", {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunkHNAYCTX4_cjs.projectMemoryDir; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "readFacts", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkHNAYCTX4_cjs.readFacts; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "readFactsFromMarkdown", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunkHNAYCTX4_cjs.readFactsFromMarkdown; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "resolveMemoryRoot", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkHNAYCTX4_cjs.resolveMemoryRoot; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "sessionSummaryPath", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunkHNAYCTX4_cjs.sessionSummaryPath; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "sessionsDir", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunkHNAYCTX4_cjs.sessionsDir; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "wikiDir", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunkHNAYCTX4_cjs.wikiDir; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "writeSessionSummary", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunkHNAYCTX4_cjs.writeSessionSummary; }
|
|
139
139
|
});
|
|
140
140
|
//# sourceMappingURL=index.cjs.map
|
|
141
141
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { appendDiaryEntry, diaryPath, entryHash, readAllSqliteFacts, renderDiaryEntry } from '../../../chunk-
|
|
1
|
+
export { appendDiaryEntry, diaryPath, entryHash, readAllSqliteFacts, renderDiaryEntry } from '../../../chunk-YRLI5DVC.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, claudeProjectMemoryDir, collectMarkdownFiles, defaultIndexPath, discoverSessionFiles, discoverWikiFiles, indexBudgetWarning, lanceStoragePath, memoryIndexRoot, memoryMdPath, memoryReadRoots, notesDir, projectMemoryDir, readFacts, readFactsFromMarkdown, resolveMemoryRoot, sessionSummaryPath, sessionsDir, wikiDir, writeSessionSummary } from '../../../chunk-R3LBRQAN.js';
|
|
4
4
|
import '../../../chunk-KVNWIAO4.js';
|
|
5
5
|
import '../../../chunk-FD2UT76F.js';
|
|
6
|
-
import '../../../chunk-
|
|
6
|
+
import '../../../chunk-A6PDYH55.js';
|
|
7
7
|
import '../../../chunk-EH6XD3FY.js';
|
|
8
8
|
import '../../../chunk-UKMBRMGT.js';
|
|
9
9
|
import '../../../chunk-JOFVLOFY.js';
|
|
@@ -50,6 +50,33 @@ export declare function projectMemoryDir(cwd: string): MemoryRoot;
|
|
|
50
50
|
* TRANSCRIPTS ARE THE TRAP, and the reason this went unnoticed: the CLI keys THOSE by `cwd`, and
|
|
51
51
|
* `encodeProjectDir` is right for them. One encoder for two axes made the two indistinguishable in
|
|
52
52
|
* the code. The encoder is still shared — the path it is given is not.
|
|
53
|
+
*
|
|
54
|
+
* ## What is READ here and what is not IMPLEMENTED (B-054)
|
|
55
|
+
*
|
|
56
|
+
* This reads the directory the Claude Code CLI writes its auto-memory into. It does not implement
|
|
57
|
+
* the CLI's auto-memory BEHAVIOUR: `autoMemoryEnabled`, `autoMemoryDirectory`,
|
|
58
|
+
* `CLAUDE_CODE_DISABLE_AUTO_MEMORY`, `cleanupPeriodDays` and the documented 200-line / 25 KB read
|
|
59
|
+
* cap have no counterpart — measured 0 files across this package and `@theokit/agents`.
|
|
60
|
+
*
|
|
61
|
+
* Interop in one direction is the decision, not an oversight: a memory the CLI recorded stays
|
|
62
|
+
* visible, and this runtime does not start writing into a store another product owns the lifecycle
|
|
63
|
+
* of. A `cleanupPeriodDays` implemented here would delete files the CLI expects to find.
|
|
64
|
+
*
|
|
65
|
+
* `CLAUDE_CONFIG_DIR` is honoured HERE and nowhere else, and that is the whole of its scope in this
|
|
66
|
+
* runtime: it names the CLI's home so this reader finds the right directory. It does not relocate a
|
|
67
|
+
* user-level configuration root of this product's own, because there is none to relocate — the
|
|
68
|
+
* config roots resolved elsewhere are PROJECT-relative.
|
|
69
|
+
*
|
|
70
|
+
* ## The filename collision, stated at one of its two ends
|
|
71
|
+
*
|
|
72
|
+
* `MEMORY.md` names two different contracts. The CLI's is a plain file under the directory above,
|
|
73
|
+
* capped and swept by the CLI. This SDK's is the durable-memory subsystem — a SQLite+FTS5 store
|
|
74
|
+
* under `.theokit/memory/` with `memory_search` / `memory_get` tools, no index cap, and a different
|
|
75
|
+
* directory entirely.
|
|
76
|
+
*
|
|
77
|
+
* Same filename, different directory, different semantics. A parity checklist that greps for
|
|
78
|
+
* `MEMORY.md` finds one and concludes the other exists — the third name in this backlog to collide
|
|
79
|
+
* that way, and the reason the statement lives at both ends rather than in a changelog.
|
|
53
80
|
*/
|
|
54
81
|
export declare function claudeProjectMemoryDir(cwd: string): MemoryRoot;
|
|
55
82
|
/**
|
|
@@ -50,6 +50,33 @@ export declare function projectMemoryDir(cwd: string): MemoryRoot;
|
|
|
50
50
|
* TRANSCRIPTS ARE THE TRAP, and the reason this went unnoticed: the CLI keys THOSE by `cwd`, and
|
|
51
51
|
* `encodeProjectDir` is right for them. One encoder for two axes made the two indistinguishable in
|
|
52
52
|
* the code. The encoder is still shared — the path it is given is not.
|
|
53
|
+
*
|
|
54
|
+
* ## What is READ here and what is not IMPLEMENTED (B-054)
|
|
55
|
+
*
|
|
56
|
+
* This reads the directory the Claude Code CLI writes its auto-memory into. It does not implement
|
|
57
|
+
* the CLI's auto-memory BEHAVIOUR: `autoMemoryEnabled`, `autoMemoryDirectory`,
|
|
58
|
+
* `CLAUDE_CODE_DISABLE_AUTO_MEMORY`, `cleanupPeriodDays` and the documented 200-line / 25 KB read
|
|
59
|
+
* cap have no counterpart — measured 0 files across this package and `@theokit/agents`.
|
|
60
|
+
*
|
|
61
|
+
* Interop in one direction is the decision, not an oversight: a memory the CLI recorded stays
|
|
62
|
+
* visible, and this runtime does not start writing into a store another product owns the lifecycle
|
|
63
|
+
* of. A `cleanupPeriodDays` implemented here would delete files the CLI expects to find.
|
|
64
|
+
*
|
|
65
|
+
* `CLAUDE_CONFIG_DIR` is honoured HERE and nowhere else, and that is the whole of its scope in this
|
|
66
|
+
* runtime: it names the CLI's home so this reader finds the right directory. It does not relocate a
|
|
67
|
+
* user-level configuration root of this product's own, because there is none to relocate — the
|
|
68
|
+
* config roots resolved elsewhere are PROJECT-relative.
|
|
69
|
+
*
|
|
70
|
+
* ## The filename collision, stated at one of its two ends
|
|
71
|
+
*
|
|
72
|
+
* `MEMORY.md` names two different contracts. The CLI's is a plain file under the directory above,
|
|
73
|
+
* capped and swept by the CLI. This SDK's is the durable-memory subsystem — a SQLite+FTS5 store
|
|
74
|
+
* under `.theokit/memory/` with `memory_search` / `memory_get` tools, no index cap, and a different
|
|
75
|
+
* directory entirely.
|
|
76
|
+
*
|
|
77
|
+
* Same filename, different directory, different semantics. A parity checklist that greps for
|
|
78
|
+
* `MEMORY.md` finds one and concludes the other exists — the third name in this backlog to collide
|
|
79
|
+
* that way, and the reason the statement lives at both ends rather than in a changelog.
|
|
53
80
|
*/
|
|
54
81
|
export declare function claudeProjectMemoryDir(cwd: string): MemoryRoot;
|
|
55
82
|
/**
|
|
@@ -7,7 +7,7 @@ var chunkDQZU7JK6_cjs = require('../../chunk-DQZU7JK6.cjs');
|
|
|
7
7
|
var chunkBJUJT5ED_cjs = require('../../chunk-BJUJT5ED.cjs');
|
|
8
8
|
var chunkZF2LDKQQ_cjs = require('../../chunk-ZF2LDKQQ.cjs');
|
|
9
9
|
var chunkJLRLCBJ4_cjs = require('../../chunk-JLRLCBJ4.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkTY56BKSK_cjs = require('../../chunk-TY56BKSK.cjs');
|
|
11
11
|
require('../../chunk-J7J7J2GN.cjs');
|
|
12
12
|
require('../../chunk-6LHQPOMI.cjs');
|
|
13
13
|
var promises = require('fs/promises');
|
|
@@ -111,15 +111,15 @@ Object.defineProperty(exports, "replaceFileAtomic", {
|
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "displayTheokitHome", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkTY56BKSK_cjs.displayTheokitHome; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "getProfilesRoot", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunkTY56BKSK_cjs.getProfilesRoot; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "getTheokitHome", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkTY56BKSK_cjs.getTheokitHome; }
|
|
123
123
|
});
|
|
124
124
|
exports.casUpdate = casUpdate;
|
|
125
125
|
exports.createExclusive = createExclusive;
|
|
@@ -5,7 +5,7 @@ export { applyWalWithFallback, isCorruptionError, openSqliteResilient } from '..
|
|
|
5
5
|
export { JsonlParseError, appendJsonl, loadJsonl, readJsonlIds, withFileLock } from '../../chunk-TA3K7SBK.js';
|
|
6
6
|
export { withCwdMutex } from '../../chunk-Q5EWJPRY.js';
|
|
7
7
|
export { atomicWriteJson, atomicWriteText, replaceFileAtomic } from '../../chunk-3JHIFQ4I.js';
|
|
8
|
-
export { displayTheokitHome, getProfilesRoot, getTheokitHome } from '../../chunk-
|
|
8
|
+
export { displayTheokitHome, getProfilesRoot, getTheokitHome } from '../../chunk-X7EUUHXU.js';
|
|
9
9
|
import '../../chunk-ALUN2B4W.js';
|
|
10
10
|
import '../../chunk-CZJ6Q7CW.js';
|
|
11
11
|
import { open } from 'fs/promises';
|
|
@@ -8,14 +8,27 @@ export interface ConfigSourceAdapter {
|
|
|
8
8
|
/** The project-relative directory the dialect keeps its configuration in. */
|
|
9
9
|
readonly dirName: string;
|
|
10
10
|
/**
|
|
11
|
-
* Variables the dialect's own runtime defines for commands it executes
|
|
11
|
+
* Variables the dialect's own runtime defines for commands it executes, under the dialect's own
|
|
12
|
+
* documented spellings.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Every dialect gets a project-directory variable, because none of them can locate a
|
|
15
|
+
* project-relative script without one — the inherited environment says where the PROCESS is, and
|
|
16
|
+
* a hook that has to depend on the process cwd is the dependency #522 removed for the foreign
|
|
17
|
+
* side. Fixing one dialect and leaving the other different was the half-fix.
|
|
18
|
+
*
|
|
19
|
+
* The SPELLINGS differ on purpose: a ported script reaches for the name its own docs use, and a
|
|
20
|
+
* native one for this runtime's.
|
|
15
21
|
*/
|
|
16
22
|
runtimeEnv(cwd: string): Record<string, string>;
|
|
17
23
|
}
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The native source. Always read, never opted into, always first for precedence.
|
|
26
|
+
*
|
|
27
|
+
* `THEOKIT_PROJECT_DIR` is the native counterpart of `CLAUDE_PROJECT_DIR` below. This used to be
|
|
28
|
+
* `{}`, on the reasoning that a `.theokit/` hook "is written against THIS runtime and inherits it
|
|
29
|
+
* already" — true of the runtime's BEHAVIOUR and not of a project PATH. Nothing in the inherited
|
|
30
|
+
* environment says where the project is, so a native hook had to depend on the process cwd.
|
|
31
|
+
*/
|
|
19
32
|
export declare const NATIVE_SOURCE: ConfigSourceAdapter;
|
|
20
33
|
/**
|
|
21
34
|
* Claude Code.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an operator may impose. One key today, and the shape is the point: each addition is a control
|
|
3
|
+
* that already exists somewhere below and is being lifted into a tier the project cannot reach.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately NOT a passthrough of arbitrary keys. A policy file whose unknown keys were carried
|
|
6
|
+
* along would let an organisation believe it had imposed something this runtime never reads — the
|
|
7
|
+
* exact belief-in-an-absent-protection this tier exists to remove.
|
|
8
|
+
*/
|
|
9
|
+
export interface ManagedSettings {
|
|
10
|
+
/**
|
|
11
|
+
* Refuse to execute the `` !`command` `` form in a skill or command body.
|
|
12
|
+
*
|
|
13
|
+
* A skill is a markdown file a repository can carry, and its body can run shell at expansion time.
|
|
14
|
+
* Without this the only way to decline was to stop reading skills entirely.
|
|
15
|
+
*/
|
|
16
|
+
disableSkillShellExecution?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The permission posture the operator imposes on every run.
|
|
19
|
+
*
|
|
20
|
+
* `plan` is the one this exists for: an explore-only posture where edits are structurally refused.
|
|
21
|
+
* A `createPlanModeTool` already existed and it is a tool the MODEL may call — the difference is
|
|
22
|
+
* who decides. A never-prompt posture (`bypass`) is the other end, for a locked-down CI run where
|
|
23
|
+
* there is nobody to ask.
|
|
24
|
+
*
|
|
25
|
+
* It does NOT reach the standing-grant gate. `bypass` allows what the RULES would have asked
|
|
26
|
+
* about; a grant an operator recorded is not the run's to clear.
|
|
27
|
+
*/
|
|
28
|
+
permissionMode?: "default" | "plan" | "acceptEdits" | "bypass";
|
|
29
|
+
/**
|
|
30
|
+
* The permission policy, as rule strings an operator writes and reviews.
|
|
31
|
+
*
|
|
32
|
+
* `{ "permissions": { "deny": ["Read(path:./.env)"] } }` — the spec's own paste-ready
|
|
33
|
+
* secret-exclusion example, which could not be expressed at all while every policy was a compiled
|
|
34
|
+
* predicate. Parsed by `parsePermissionRules` into the rules `PermissionEngine` already evaluates;
|
|
35
|
+
* the engine is unchanged and keeps its fail-closed default and its immune-to-un-deny explicit
|
|
36
|
+
* deny.
|
|
37
|
+
*/
|
|
38
|
+
permissions?: {
|
|
39
|
+
readonly deny?: readonly string[];
|
|
40
|
+
readonly ask?: readonly string[];
|
|
41
|
+
readonly allow?: readonly string[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Refuse to run ANY hook, whatever the project declared.
|
|
45
|
+
*
|
|
46
|
+
* The first control lifted, because it is the one whose absence is hardest to notice: a hook that
|
|
47
|
+
* does not run looks identical to a hook that ran and approved.
|
|
48
|
+
*/
|
|
49
|
+
disableAllHooks?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Where the platform keeps its managed settings.
|
|
53
|
+
*
|
|
54
|
+
* `root` exists so the precedence rule is testable: the real directories are platform-owned and a
|
|
55
|
+
* test must not write to `/etc`. Hard-coding the path inside the reader would make the thing that
|
|
56
|
+
* actually matters — that a project cannot override this file — unreachable by any test not running
|
|
57
|
+
* as root.
|
|
58
|
+
*
|
|
59
|
+
* The paths are Claude Code's own, because the file is Claude Code's format: an organisation that
|
|
60
|
+
* already deployed one should not have to deploy a second copy under a different name to get the
|
|
61
|
+
* same policy honoured here.
|
|
62
|
+
*/
|
|
63
|
+
export declare function managedSettingsPathFor(root?: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Read the deployed policy, or `{}` when none is.
|
|
66
|
+
*
|
|
67
|
+
* Absent is the ordinary case and not an error — most machines have no operator tier, and a reader
|
|
68
|
+
* that failed without one would make the feature a prerequisite for running at all.
|
|
69
|
+
*
|
|
70
|
+
* A file that EXISTS and cannot be read is different, and says so — through `diagFailure`, not
|
|
71
|
+
* `diag`. `diag` returns immediately when no sink is installed, and most consumers never install
|
|
72
|
+
* one: an organisation that deployed a policy with a typo in it would get complete silence, which is
|
|
73
|
+
* the same defect this repository just fixed for dropped hook events. A policy channel that is
|
|
74
|
+
* silent by default reports nothing about the one thing the tier exists to make certain. An organisation that deployed a
|
|
75
|
+
* policy and got silence would believe it applied; that belief is what this tier removes.
|
|
76
|
+
*
|
|
77
|
+
* SYNC for the same reason `readCompatConfigFile` is: the caller resolves this before any submanager
|
|
78
|
+
* exists to await a promise, and a once-per-agent read of one small file is the same class of work.
|
|
79
|
+
*/
|
|
80
|
+
export declare function readManagedSettings(root?: string): ManagedSettings;
|
|
@@ -35,6 +35,20 @@ export interface DiscoveryRunnerOptions {
|
|
|
35
35
|
readonly maxBytesPerFile: number;
|
|
36
36
|
/** Optional override of the default registry. */
|
|
37
37
|
readonly specs?: ReadonlyArray<DiscoverySpec>;
|
|
38
|
+
/**
|
|
39
|
+
* The foreign dialects the consumer granted the `context` surface to — the output of
|
|
40
|
+
* `adaptersForSurface(compatSources, "context")`, mapped to `.kind`.
|
|
41
|
+
*
|
|
42
|
+
* Left unset, every spec runs, which is what every caller before usetheokit/theokit-sdk#652 got.
|
|
43
|
+
* Set, it filters specs carrying a {@link DiscoverySpec.dialect} the list does not name — so an
|
|
44
|
+
* empty array is a real value meaning "no foreign dialect granted", NOT the same as absent.
|
|
45
|
+
*
|
|
46
|
+
* That distinction is the whole option. `resolveCompatSources` returns `[]` for a consumer who
|
|
47
|
+
* declared nothing, and collapsing `[]` into `undefined` here would restore the defect: a
|
|
48
|
+
* repository's `.claude/rules/*.md` entering the system prompt of a consumer who never asked for
|
|
49
|
+
* that dialect.
|
|
50
|
+
*/
|
|
51
|
+
readonly declaredCompatKinds?: ReadonlyArray<string>;
|
|
38
52
|
/** Cursor MDC: file paths the LLM has touched this turn (EC-I: empty at send-time). */
|
|
39
53
|
readonly touchedFiles?: ReadonlyArray<string>;
|
|
40
54
|
/** When true, skip `theokit-context` spec — caller already handles the legacy path. */
|
|
@@ -58,7 +58,71 @@ export interface DiscoverySpec {
|
|
|
58
58
|
readonly parser: DiscoveryParser;
|
|
59
59
|
/** Whether to follow `@path` import directives (CLAUDE.md / GEMINI.md). */
|
|
60
60
|
readonly followImports: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The `CompatSource` kind whose grant gates this file — the name a consumer writes in
|
|
63
|
+
* `local.compatSources` to receive it.
|
|
64
|
+
*
|
|
65
|
+
* Absent means UNGATED, and that covers two different situations which the field deliberately does
|
|
66
|
+
* not distinguish, because the gate treats them identically:
|
|
67
|
+
*
|
|
68
|
+
* 1. **Native.** theokit's own roots. Declaring theokit is what running theokit means, so there is
|
|
69
|
+
* no separate grant to ask for.
|
|
70
|
+
* 2. **A repo-root instruction file.** `AGENTS.md`, `GEMINI.md`, `CLAUDE.md` and
|
|
71
|
+
* `.cursor/rules/*.mdc` are every bit as foreign as `.claude/` is, and every one of them puts
|
|
72
|
+
* a cloned repository's prose into the system prompt. They are ungated anyway, for a reason
|
|
73
|
+
* that is a limit rather than a judgement: `adaptersFor` registers ONE foreign adapter,
|
|
74
|
+
* `claude-code`, so `compatSources` has no spelling that admits `agents`, `gemini` or
|
|
75
|
+
* `cursor`. Labelling them would gate them on a grant nobody can write, making three formats
|
|
76
|
+
* permanently unreachable — a silent loss of capability with no way to restore it, which is a
|
|
77
|
+
* worse defect than the one being fixed and the exact shape this codebase already paid for in
|
|
78
|
+
* usetheokit/theokit-sdk#524.
|
|
79
|
+
*
|
|
80
|
+
* `CLAUDE.md` is ungated for the adjacent reason, and this one IS a judgement: the grant gates
|
|
81
|
+
* the foreign ROOT — the `.claude/` directory whose hooks, skills, subagents and plugins
|
|
82
|
+
* already require it — and `CLAUDE.md` does not live there. It sits at the repository root
|
|
83
|
+
* beside the other three, is widely used as a generic agent-instructions file by projects that
|
|
84
|
+
* have no `.claude/` at all, and gating it would take it from them.
|
|
85
|
+
*
|
|
86
|
+
* So this field closes the door the grant vocabulary already has a key for, and leaves three
|
|
87
|
+
* named. Whether a repo-root instruction file should require an opt-in at all is a product
|
|
88
|
+
* decision affecting every consumer, not a bug fix, and it is tracked separately — writing it
|
|
89
|
+
* down is the point, because an undocumented gap reads as an oversight.
|
|
90
|
+
*
|
|
91
|
+
* Optional because this interface is `@public` and under semver: a caller passing its own array
|
|
92
|
+
* keeps working, and its specs read as ungated — the behaviour they had before this field existed.
|
|
93
|
+
*
|
|
94
|
+
* On the SPEC rather than as a condition at the call site, because the table MIXES dialects.
|
|
95
|
+
* Adding one is adding a row, not editing a branch somebody else has to find.
|
|
96
|
+
*/
|
|
97
|
+
readonly dialect?: string;
|
|
61
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* The mirror of {@link admittedSpecs}: the specs a declaration did NOT admit.
|
|
101
|
+
*
|
|
102
|
+
* It exists because `runDiscovery`'s own docblock admits the gap it closes — *"a shorter result
|
|
103
|
+
* than expected means 'nothing qualified', and this function will not tell you which of those it
|
|
104
|
+
* was"*. After B-081 gates the four repo-root instruction files, a consumer who declares nothing
|
|
105
|
+
* goes from receiving four files to receiving none, and that has to be legible.
|
|
106
|
+
*
|
|
107
|
+
* Returned as a VALUE rather than only logged, because a log line cannot be asserted by a
|
|
108
|
+
* consumer's test, and this repository does not ship controls that cannot be observed. The loud
|
|
109
|
+
* half is the `warnOnce` the caller emits from this list.
|
|
110
|
+
*
|
|
111
|
+
* Each entry carries the grant that WOULD admit it — being told you lost something, without being
|
|
112
|
+
* told what would bring it back, is a diagnosis with no remedy.
|
|
113
|
+
*
|
|
114
|
+
* `undefined` declaredKinds means "no gate configured", which admits everything and therefore
|
|
115
|
+
* withholds nothing. That is NOT the same as `[]`, which is a real declaration of no foreign
|
|
116
|
+
* dialect and withholds every gated spec — the distinction `declaredCompatKinds` already carries,
|
|
117
|
+
* preserved here rather than re-decided.
|
|
118
|
+
*
|
|
119
|
+
* @public — re-exported from `@theokit/sdk/context`, and therefore under semver.
|
|
120
|
+
*/
|
|
121
|
+
export declare function withheldSpecs(specs: ReadonlyArray<DiscoverySpec>, declaredKinds: ReadonlyArray<string> | undefined): ReadonlyArray<{
|
|
122
|
+
readonly id: string;
|
|
123
|
+
readonly pattern: string;
|
|
124
|
+
readonly grant: string;
|
|
125
|
+
}>;
|
|
62
126
|
/**
|
|
63
127
|
* The context files theokit looks for out of the box, in the order they are concatenated.
|
|
64
128
|
*
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ContextSettings, ContextSnapshot, SDKContextManager } from "../../../types/context.js";
|
|
2
|
+
import { type CompatSourceDeclaration } from "../compat/foreign-config-sources.js";
|
|
2
3
|
export declare class FileContextManager implements SDKContextManager {
|
|
3
4
|
private readonly cwd;
|
|
4
5
|
private readonly settings;
|
|
5
6
|
private readonly settingSourcesIncludeProject;
|
|
7
|
+
private readonly compatSources?;
|
|
6
8
|
private state;
|
|
7
9
|
/**
|
|
8
10
|
* The in-scope file set used by the most recent `refresh`. Tracked so
|
|
@@ -11,7 +13,25 @@ export declare class FileContextManager implements SDKContextManager {
|
|
|
11
13
|
* snapshot untouched, at zero per-send cost.
|
|
12
14
|
*/
|
|
13
15
|
private lastScope;
|
|
14
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @param compatSources - What the consumer declared in `local.compatSources` (or
|
|
18
|
+
* `.theokit/config.json`), as `resolveCompatSources` resolved it. `undefined` means the caller
|
|
19
|
+
* did not thread the declaration through at all and every dialect runs — the pre-#652 behaviour,
|
|
20
|
+
* kept so an internal caller constructing this directly does not silently lose content. An empty
|
|
21
|
+
* ARRAY is different and is the fix: it means the consumer declared no foreign dialect, so
|
|
22
|
+
* `.claude/rules/*.md` does not reach the prompt.
|
|
23
|
+
*/
|
|
24
|
+
constructor(cwd: string, settings: ContextSettings, settingSourcesIncludeProject: boolean, compatSources?: readonly CompatSourceDeclaration[] | undefined);
|
|
25
|
+
/**
|
|
26
|
+
* The dialect kinds granted the `context` surface, or `undefined` when nothing was declared to
|
|
27
|
+
* this instance.
|
|
28
|
+
*
|
|
29
|
+
* Routed through `adaptersForSurface` rather than reading `.kind` off the declarations, so the
|
|
30
|
+
* three fail-closed rules #524 established govern this surface identically to the other four: a
|
|
31
|
+
* bare string admits everything, an object with no `import` admits nothing, and an unrecognised
|
|
32
|
+
* surface name narrows rather than widens.
|
|
33
|
+
*/
|
|
34
|
+
private grantedContextDialects;
|
|
15
35
|
initialize(): Promise<void>;
|
|
16
36
|
/**
|
|
17
37
|
* Re-run discovery for a specific per-send in-scope file set (T3). Path-scoped
|
|
@@ -7,13 +7,16 @@
|
|
|
7
7
|
* key: true → true (boolean)
|
|
8
8
|
* key: [a, b, c] → ["a","b","c"](string[])
|
|
9
9
|
* key: → undefined (caller's Zod default kicks in)
|
|
10
|
+
* - a → ["a","b"] (block list, when `- ` items follow a bare key)
|
|
11
|
+
* - b
|
|
10
12
|
*
|
|
11
13
|
* Limitations (intentional — keep parser tiny, no dep):
|
|
12
14
|
* - No nested objects (use flat keys like `providerId` not `provider.id`).
|
|
13
15
|
* - No quoted strings — `match: "1"` becomes the literal 3-char string `"1"`.
|
|
14
|
-
* -
|
|
15
|
-
* `tags: [a,b, c]` splitter is greedy on `,`. Use
|
|
16
|
-
* reword if you need this
|
|
16
|
+
* - Inline list values cannot contain a literal comma inside an element; the
|
|
17
|
+
* `tags: [a,b, c]` splitter is greedy on `,`. Use the block form above or
|
|
18
|
+
* reword if you need this — and note that the block form was, for a while,
|
|
19
|
+
* what this line recommended and the parser could not read.
|
|
17
20
|
*
|
|
18
21
|
* @internal
|
|
19
22
|
*/
|