@theokit/sdk 5.4.0 → 5.6.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 +642 -0
- package/dist/{agent-AUVD4TI4.cjs → agent-47NS6ZVL.cjs} +13 -13
- package/dist/{agent-AUVD4TI4.cjs.map → agent-47NS6ZVL.cjs.map} +1 -1
- package/dist/{agent-C1Efo7PI.d.cts → agent-82d_DrCL.d.cts} +33 -2
- package/dist/{agent-Bmy2G_ml.d.ts → agent-G6g-uwcB.d.ts} +33 -2
- package/dist/{agent-MNINE73R.js → agent-JJZM2VIK.js} +12 -12
- package/dist/{agent-MNINE73R.js.map → agent-JJZM2VIK.js.map} +1 -1
- package/dist/{chunk-IKBLU7ZS.js → chunk-2UXQASTX.js} +232 -32
- package/dist/chunk-2UXQASTX.js.map +1 -0
- package/dist/{chunk-VPK6PHIE.cjs → chunk-52FDUJSV.cjs} +8 -8
- package/dist/{chunk-VPK6PHIE.cjs.map → chunk-52FDUJSV.cjs.map} +1 -1
- package/dist/{chunk-2XRAWOZZ.js → chunk-5NELQ6LB.js} +65 -3
- package/dist/chunk-5NELQ6LB.js.map +1 -0
- package/dist/{chunk-3FDU5JFE.cjs → chunk-7IZKTQ5G.cjs} +35 -7
- package/dist/chunk-7IZKTQ5G.cjs.map +1 -0
- package/dist/{chunk-7SZAV6QG.js → chunk-7MMTZBTT.js} +3 -3
- package/dist/{chunk-7SZAV6QG.js.map → chunk-7MMTZBTT.js.map} +1 -1
- package/dist/{chunk-SADXXGWU.js → chunk-BZ3YMAMP.js} +3 -3
- package/dist/{chunk-NQTNSHSB.cjs.map → chunk-BZ3YMAMP.js.map} +1 -1
- package/dist/{chunk-LX7SEXOQ.js → chunk-CA5VUAP3.js} +25 -7
- package/dist/chunk-CA5VUAP3.js.map +1 -0
- package/dist/{chunk-IU5N5224.cjs → chunk-EIOMN5VA.cjs} +8 -8
- package/dist/chunk-EIOMN5VA.cjs.map +1 -0
- package/dist/{chunk-KWGSBZ2Q.js → chunk-FPIY5CLV.js} +3 -3
- package/dist/{chunk-KWGSBZ2Q.js.map → chunk-FPIY5CLV.js.map} +1 -1
- package/dist/{chunk-UALC6Q3J.cjs → chunk-GCHZMH42.cjs} +290 -88
- package/dist/chunk-GCHZMH42.cjs.map +1 -0
- package/dist/{chunk-NQTNSHSB.cjs → chunk-GFFBXSQT.cjs} +5 -5
- package/dist/chunk-GFFBXSQT.cjs.map +1 -0
- package/dist/{chunk-J6KZE2ZQ.cjs → chunk-HG4UN4MN.cjs} +4 -4
- package/dist/{chunk-J6KZE2ZQ.cjs.map → chunk-HG4UN4MN.cjs.map} +1 -1
- package/dist/{chunk-N6OOOYFZ.js → chunk-HUDNLFY4.js} +4 -4
- package/dist/chunk-HUDNLFY4.js.map +1 -0
- package/dist/{chunk-LOHMT36V.cjs → chunk-LD6HASA5.cjs} +65 -2
- package/dist/chunk-LD6HASA5.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-XD3FS5OI.js → chunk-N2KAIZ5D.js} +34 -7
- package/dist/chunk-N2KAIZ5D.js.map +1 -0
- package/dist/{chunk-HW7SEELD.cjs → chunk-QRVS2PRE.cjs} +31 -8
- package/dist/chunk-QRVS2PRE.cjs.map +1 -0
- package/dist/{chunk-AYA65JA5.cjs → chunk-RWPLWMCZ.cjs} +25 -9
- package/dist/chunk-RWPLWMCZ.cjs.map +1 -0
- package/dist/{chunk-WS5ULCL4.js → chunk-STGSMJMJ.js} +3 -3
- package/dist/{chunk-WS5ULCL4.js.map → chunk-STGSMJMJ.js.map} +1 -1
- 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-Z2JFX372.cjs → chunk-VUHXC74Q.cjs} +15 -15
- package/dist/{chunk-Z2JFX372.cjs.map → chunk-VUHXC74Q.cjs.map} +1 -1
- package/dist/{chunk-NSLHPAC7.js → chunk-X7EUUHXU.js} +6 -5
- package/dist/chunk-X7EUUHXU.js.map +1 -0
- package/dist/context/index.cjs +7 -7
- package/dist/context/index.js +3 -3
- package/dist/{context-4AIK26QB.cjs → context-HR4KMXMA.cjs} +7 -7
- package/dist/{context-4AIK26QB.cjs.map → context-HR4KMXMA.cjs.map} +1 -1
- package/dist/context-J5BJ3LBS.js +6 -0
- package/dist/{context-EGM6CHXD.js.map → context-J5BJ3LBS.js.map} +1 -1
- package/dist/{cron-DSMdlhyF.d.cts → cron-DWv69ZSD.d.cts} +1 -1
- package/dist/{cron-Dcdrdv_T.d.ts → cron-GynWtAax.d.ts} +1 -1
- package/dist/cron.cjs +12 -12
- package/dist/cron.d.cts +2 -2
- package/dist/cron.d.ts +2 -2
- package/dist/cron.js +11 -11
- package/dist/eval.cjs +11 -11
- package/dist/eval.js +10 -10
- package/dist/{index-manager-W7FDMGEG.js → index-manager-27WLNQEE.js} +5 -5
- package/dist/{index-manager-W7FDMGEG.js.map → index-manager-27WLNQEE.js.map} +1 -1
- package/dist/{index-manager-3UNPYH34.cjs → index-manager-BBHDKMQS.cjs} +6 -6
- package/dist/{index-manager-3UNPYH34.cjs.map → index-manager-BBHDKMQS.cjs.map} +1 -1
- package/dist/index.cjs +274 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +168 -5
- package/dist/index.d.ts +168 -5
- package/dist/index.js +246 -23
- package/dist/index.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 +37 -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 +23 -1
- package/dist/internal/runtime/hooks/hooks-source.d.ts +46 -1
- package/dist/internal/runtime/skills/discover-skills.d.ts +4 -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 +6 -1
- package/dist/types/hooks.d.ts +22 -0
- 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-3FDU5JFE.cjs.map +0 -1
- package/dist/chunk-43YXGD3P.cjs.map +0 -1
- package/dist/chunk-AYA65JA5.cjs.map +0 -1
- package/dist/chunk-HW7SEELD.cjs.map +0 -1
- package/dist/chunk-IKBLU7ZS.js.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-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-QATRS7JD.cjs.map +0 -1
- package/dist/chunk-SADXXGWU.js.map +0 -1
- package/dist/chunk-UALC6Q3J.cjs.map +0 -1
- package/dist/chunk-XD3FS5OI.js.map +0 -1
- package/dist/context-EGM6CHXD.js +0 -6
- package/dist/subagents-loader-AIVDQ2D5.js +0 -7
- package/dist/subagents-loader-DN4LETGL.cjs +0 -16
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk52FDUJSV_cjs = require('../../../chunk-52FDUJSV.cjs');
|
|
4
4
|
var chunkTMKTSYDS_cjs = require('../../../chunk-TMKTSYDS.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkGFFBXSQT_cjs = require('../../../chunk-GFFBXSQT.cjs');
|
|
6
6
|
require('../../../chunk-KRD3GQAA.cjs');
|
|
7
7
|
require('../../../chunk-MUUQ2WFJ.cjs');
|
|
8
|
-
require('../../../chunk-
|
|
8
|
+
require('../../../chunk-LD6HASA5.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 chunk52FDUJSV_cjs.appendDiaryEntry; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "diaryPath", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunk52FDUJSV_cjs.diaryPath; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "entryHash", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunk52FDUJSV_cjs.entryHash; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "readAllSqliteFacts", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunk52FDUJSV_cjs.readAllSqliteFacts; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "renderDiaryEntry", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunk52FDUJSV_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 chunkGFFBXSQT_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 chunkGFFBXSQT_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 chunkGFFBXSQT_cjs.appendFact; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "appendFactToMarkdown", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkGFFBXSQT_cjs.appendFactToMarkdown; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "asMemoryRoot", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkGFFBXSQT_cjs.asMemoryRoot; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "claudeProjectMemoryDir", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkGFFBXSQT_cjs.claudeProjectMemoryDir; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "collectMarkdownFiles", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkGFFBXSQT_cjs.collectMarkdownFiles; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "defaultIndexPath", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkGFFBXSQT_cjs.defaultIndexPath; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "discoverSessionFiles", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkGFFBXSQT_cjs.discoverSessionFiles; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "discoverWikiFiles", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkGFFBXSQT_cjs.discoverWikiFiles; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "indexBudgetWarning", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkGFFBXSQT_cjs.indexBudgetWarning; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "lanceStoragePath", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkGFFBXSQT_cjs.lanceStoragePath; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "memoryIndexRoot", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkGFFBXSQT_cjs.memoryIndexRoot; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "memoryMdPath", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkGFFBXSQT_cjs.memoryMdPath; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "memoryReadRoots", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkGFFBXSQT_cjs.memoryReadRoots; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "notesDir", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunkGFFBXSQT_cjs.notesDir; }
|
|
107
107
|
});
|
|
108
108
|
Object.defineProperty(exports, "projectMemoryDir", {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunkGFFBXSQT_cjs.projectMemoryDir; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "readFacts", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkGFFBXSQT_cjs.readFacts; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "readFactsFromMarkdown", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunkGFFBXSQT_cjs.readFactsFromMarkdown; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "resolveMemoryRoot", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkGFFBXSQT_cjs.resolveMemoryRoot; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "sessionSummaryPath", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunkGFFBXSQT_cjs.sessionSummaryPath; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "sessionsDir", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunkGFFBXSQT_cjs.sessionsDir; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "wikiDir", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunkGFFBXSQT_cjs.wikiDir; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "writeSessionSummary", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunkGFFBXSQT_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-STGSMJMJ.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-BZ3YMAMP.js';
|
|
4
4
|
import '../../../chunk-KVNWIAO4.js';
|
|
5
5
|
import '../../../chunk-FD2UT76F.js';
|
|
6
|
-
import '../../../chunk-
|
|
6
|
+
import '../../../chunk-5NELQ6LB.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,6 +58,43 @@ 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
|
}
|
|
62
99
|
/**
|
|
63
100
|
* The context files theokit looks for out of the box, in the order they are concatenated.
|
|
@@ -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
|
*/
|
|
@@ -6,6 +6,16 @@ export interface HookCommand {
|
|
|
6
6
|
matcher?: string;
|
|
7
7
|
/** Optional timeout in ms; defaults to 30s. */
|
|
8
8
|
timeoutMs?: number;
|
|
9
|
+
/**
|
|
10
|
+
* #637 — the event key as the config file spelled it (`PreToolUse`), for the approval gate.
|
|
11
|
+
*
|
|
12
|
+
* Declared here AND in `hooks-source.ts`, because this interface has two independent copies —
|
|
13
|
+
* the same duplication `types/hooks.ts` records for `HookEvent`. Adding the field to one only
|
|
14
|
+
* would break at the assignment boundary in one direction and pass silently in the other.
|
|
15
|
+
* Consolidating the pair is a separate change with its own blast radius, per the decision
|
|
16
|
+
* recorded at the head of `types/hooks.ts`.
|
|
17
|
+
*/
|
|
18
|
+
sourceEvent: string;
|
|
9
19
|
/**
|
|
10
20
|
* The config file this command was declared in.
|
|
11
21
|
*
|
|
@@ -40,12 +50,24 @@ export declare class HooksExecutor {
|
|
|
40
50
|
private readonly compatSources;
|
|
41
51
|
/** #631 — the consumer's chance to refuse a command before it is spawned. */
|
|
42
52
|
private readonly gate;
|
|
53
|
+
/**
|
|
54
|
+
* B-026 — the operator tier. `managedSettingsRoot` exists so the precedence rule is testable;
|
|
55
|
+
* production passes nothing and the platform path is resolved.
|
|
56
|
+
*/
|
|
57
|
+
private readonly policy;
|
|
43
58
|
private config;
|
|
44
59
|
constructor(cwd: string,
|
|
45
60
|
/** Declared foreign dialects (#524). Empty reads `.theokit/` only. */
|
|
46
61
|
compatSources?: readonly CompatSourceDeclaration[],
|
|
47
62
|
/** #631 — the consumer's chance to refuse a command before it is spawned. */
|
|
48
|
-
gate?: HookApprovalGate | undefined
|
|
63
|
+
gate?: HookApprovalGate | undefined,
|
|
64
|
+
/**
|
|
65
|
+
* B-026 — the operator tier. `managedSettingsRoot` exists so the precedence rule is testable;
|
|
66
|
+
* production passes nothing and the platform path is resolved.
|
|
67
|
+
*/
|
|
68
|
+
policy?: {
|
|
69
|
+
readonly managedSettingsRoot?: string;
|
|
70
|
+
});
|
|
49
71
|
initialize(settingSourcesIncludeProject: boolean): Promise<void>;
|
|
50
72
|
/** Fire every hook registered for `event` and aggregate the decisions. */
|
|
51
73
|
run(payload: HookPayload): Promise<HookExecutionResult>;
|
|
@@ -8,18 +8,63 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Consumed by `hooks-executor.ts` (runtime dispatch).
|
|
10
10
|
*
|
|
11
|
-
* Config
|
|
11
|
+
* Config SHAPE is Claude Code's `settings.json` hooks:
|
|
12
12
|
* { "hooks": { "PreToolUse": [ { "matcher": "shell",
|
|
13
13
|
* "hooks": [ { "type": "command", "command": "…", "timeout": 30 } ] } ] } }
|
|
14
14
|
*
|
|
15
|
+
* The shape, not the event COVERAGE. Four of the thirty-three documented events are fired by this
|
|
16
|
+
* runtime — see {@link CLAUDE_CODE_EVENT_MAP} for which, why the rest are refused rather than
|
|
17
|
+
* mapped, and the order in which they should be added. An event outside the set is reported to the
|
|
18
|
+
* operator rather than skipped in silence.
|
|
19
|
+
*
|
|
15
20
|
* @internal
|
|
16
21
|
*/
|
|
17
22
|
/** The five lifecycle events the SDK runtime actually fires. */
|
|
18
23
|
export type HookEvent = "preRun" | "postRun" | "preToolUse" | "postToolUse" | "stop";
|
|
24
|
+
/**
|
|
25
|
+
* The Claude Code event names this runtime actually FIRES, and the internal event each becomes.
|
|
26
|
+
*
|
|
27
|
+
* Exported so the supported set is stated rather than implied. It used to be private, and the
|
|
28
|
+
* docblock above claimed a shape "identical to Claude Code's `settings.json` hooks" while accepting
|
|
29
|
+
* four of the thirty-three documented events — a claim nothing could contradict.
|
|
30
|
+
*
|
|
31
|
+
* A Claude Code event with no firing point here — `SessionStart`, `SubagentStop`, `PreCompact`,
|
|
32
|
+
* `Notification`, `SessionEnd` among them — is skipped with a report rather than silently accepted,
|
|
33
|
+
* because it would never run.
|
|
34
|
+
*
|
|
35
|
+
* ## Why this map is not simply grown
|
|
36
|
+
*
|
|
37
|
+
* Mapping a name the runtime does not fire is strictly WORSE than refusing it. An operator declaring
|
|
38
|
+
* `PreCompact` today gets a report saying it will not fire; with the name mapped they would get
|
|
39
|
+
* silence and a guard that never runs — a declared veto that does not exist. The map grows when the
|
|
40
|
+
* seam exists, one event at a time.
|
|
41
|
+
*
|
|
42
|
+
* ## Priority, when it does grow
|
|
43
|
+
*
|
|
44
|
+
* The blocking events first. An unwired veto loses a CAPABILITY; an unwired observer loses a
|
|
45
|
+
* SIGNAL. Thirteen of the sixteen the spec marks "Can block? Yes" are unwired, and
|
|
46
|
+
* `tests/internal/runtime/hooks/the-supported-event-set-is-stated.test.ts` lists them in the order
|
|
47
|
+
* they should be taken, so the next person does not re-derive which is which.
|
|
48
|
+
*
|
|
49
|
+
* `postRun` is reachable through this SDK's own config and has no entry here on purpose: it fires
|
|
50
|
+
* per RUN, and no documented Claude Code event means that. `SessionEnd` is the near miss, and a
|
|
51
|
+
* session is not a run.
|
|
52
|
+
*/
|
|
53
|
+
export declare const CLAUDE_CODE_EVENT_MAP: Readonly<Record<string, HookEvent>>;
|
|
19
54
|
export interface HookCommand {
|
|
20
55
|
command: string;
|
|
21
56
|
matcher?: string;
|
|
22
57
|
timeoutMs?: number;
|
|
58
|
+
/**
|
|
59
|
+
* #637 — the event key as written in the config file (`PreToolUse`), carried so the approval
|
|
60
|
+
* gate can report the vocabulary the consumer's stored fingerprint was taken against.
|
|
61
|
+
*
|
|
62
|
+
* REQUIRED, not optional: `parseClaudeCodeCommand` is the only producer of a `HookCommand` in
|
|
63
|
+
* this package, so every command has one. An optional field would hand every reader a fallback
|
|
64
|
+
* branch for a case that cannot occur — and if an in-memory producer is added later, required is
|
|
65
|
+
* what forces it to supply a value instead of inheriting a silent `undefined`.
|
|
66
|
+
*/
|
|
67
|
+
sourceEvent: string;
|
|
23
68
|
/**
|
|
24
69
|
* The config file this command was declared in.
|
|
25
70
|
*
|