@nxuss/lemma 1.9.0 → 1.10.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/README.md +24 -4
- package/dist/cjs/mcp/index.js +14 -0
- package/dist/cjs/mcp/index.js.map +1 -1
- package/dist/cjs/mcp/tool-profiles.d.ts.map +1 -1
- package/dist/cjs/mcp/tool-profiles.js +3 -0
- package/dist/cjs/mcp/tool-profiles.js.map +1 -1
- package/dist/cjs/mcp/tools.d.ts.map +1 -1
- package/dist/cjs/mcp/tools.js +290 -138
- package/dist/cjs/mcp/tools.js.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.d.ts +27 -1
- package/dist/cjs/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/cjs/subconscious/TheBrainV2.js +53 -1
- package/dist/cjs/subconscious/TheBrainV2.js.map +1 -1
- package/dist/cjs/utils/AffectedTests.d.ts +54 -0
- package/dist/cjs/utils/AffectedTests.d.ts.map +1 -0
- package/dist/cjs/utils/AffectedTests.js +195 -0
- package/dist/cjs/utils/AffectedTests.js.map +1 -0
- package/dist/cjs/utils/DepGraph.d.ts +28 -0
- package/dist/cjs/utils/DepGraph.d.ts.map +1 -0
- package/dist/cjs/utils/DepGraph.js +210 -0
- package/dist/cjs/utils/DepGraph.js.map +1 -0
- package/dist/cjs/utils/LocalPrefilter.d.ts +61 -0
- package/dist/cjs/utils/LocalPrefilter.d.ts.map +1 -0
- package/dist/cjs/utils/LocalPrefilter.js +169 -0
- package/dist/cjs/utils/LocalPrefilter.js.map +1 -0
- package/dist/cjs/utils/OutputDelta.d.ts +60 -0
- package/dist/cjs/utils/OutputDelta.d.ts.map +1 -0
- package/dist/cjs/utils/OutputDelta.js +226 -0
- package/dist/cjs/utils/OutputDelta.js.map +1 -0
- package/dist/cjs/utils/OutputLedger.d.ts +60 -0
- package/dist/cjs/utils/OutputLedger.d.ts.map +1 -0
- package/dist/cjs/utils/OutputLedger.js +116 -0
- package/dist/cjs/utils/OutputLedger.js.map +1 -0
- package/dist/cjs/utils/ReadWorkspaceCache.d.ts +8 -2
- package/dist/cjs/utils/ReadWorkspaceCache.d.ts.map +1 -1
- package/dist/cjs/utils/ReadWorkspaceCache.js +58 -3
- package/dist/cjs/utils/ReadWorkspaceCache.js.map +1 -1
- package/dist/esm/mcp/index.js +14 -0
- package/dist/esm/mcp/index.js.map +1 -1
- package/dist/esm/mcp/tool-profiles.d.ts.map +1 -1
- package/dist/esm/mcp/tool-profiles.js +3 -0
- package/dist/esm/mcp/tool-profiles.js.map +1 -1
- package/dist/esm/mcp/tools.d.ts.map +1 -1
- package/dist/esm/mcp/tools.js +288 -136
- package/dist/esm/mcp/tools.js.map +1 -1
- package/dist/esm/subconscious/TheBrainV2.d.ts +27 -1
- package/dist/esm/subconscious/TheBrainV2.d.ts.map +1 -1
- package/dist/esm/subconscious/TheBrainV2.js +53 -1
- package/dist/esm/subconscious/TheBrainV2.js.map +1 -1
- package/dist/esm/utils/AffectedTests.d.ts +54 -0
- package/dist/esm/utils/AffectedTests.d.ts.map +1 -0
- package/dist/esm/utils/AffectedTests.js +186 -0
- package/dist/esm/utils/AffectedTests.js.map +1 -0
- package/dist/esm/utils/DepGraph.d.ts +28 -0
- package/dist/esm/utils/DepGraph.d.ts.map +1 -0
- package/dist/esm/utils/DepGraph.js +169 -0
- package/dist/esm/utils/DepGraph.js.map +1 -0
- package/dist/esm/utils/LocalPrefilter.d.ts +61 -0
- package/dist/esm/utils/LocalPrefilter.d.ts.map +1 -0
- package/dist/esm/utils/LocalPrefilter.js +159 -0
- package/dist/esm/utils/LocalPrefilter.js.map +1 -0
- package/dist/esm/utils/OutputDelta.d.ts +60 -0
- package/dist/esm/utils/OutputDelta.d.ts.map +1 -0
- package/dist/esm/utils/OutputDelta.js +221 -0
- package/dist/esm/utils/OutputDelta.js.map +1 -0
- package/dist/esm/utils/OutputLedger.d.ts +60 -0
- package/dist/esm/utils/OutputLedger.d.ts.map +1 -0
- package/dist/esm/utils/OutputLedger.js +107 -0
- package/dist/esm/utils/OutputLedger.js.map +1 -0
- package/dist/esm/utils/ReadWorkspaceCache.d.ts +8 -2
- package/dist/esm/utils/ReadWorkspaceCache.d.ts.map +1 -1
- package/dist/esm/utils/ReadWorkspaceCache.js +57 -3
- package/dist/esm/utils/ReadWorkspaceCache.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OutputDelta — re-send only what changed, never the whole thing again.
|
|
4
|
+
*
|
|
5
|
+
* The problem: a debug loop reads the same file (or runs the same command) six times.
|
|
6
|
+
* Between two of those calls maybe three lines moved, but the model pays for the entire
|
|
7
|
+
* file or the entire 400-line `tsc` dump each time — and because tool results stay in the
|
|
8
|
+
* transcript, it keeps paying for every copy on every subsequent turn.
|
|
9
|
+
*
|
|
10
|
+
* `ReadWorkspaceCache` already suppresses the *identical* case. This module covers the far
|
|
11
|
+
* more common one: it changed, but barely.
|
|
12
|
+
*
|
|
13
|
+
* Two rules this module is built around:
|
|
14
|
+
*
|
|
15
|
+
* 1. The diff is computed against the exact text the model received. Not the file on
|
|
16
|
+
* disk, not the pre-squeeze source — the final emitted string. A diff against
|
|
17
|
+
* anything else describes a document the model never had, which is worse than
|
|
18
|
+
* re-sending the whole file.
|
|
19
|
+
* 2. A delta is only emitted when it is decisively smaller than the full text. Below
|
|
20
|
+
* that margin, reconstructing from a diff is cognitive work with no token payoff, so
|
|
21
|
+
* the full text wins. See `shouldEmitDelta`.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.computeDiff = computeDiff;
|
|
25
|
+
exports.renderDiff = renderDiff;
|
|
26
|
+
exports.shouldEmitDelta = shouldEmitDelta;
|
|
27
|
+
/**
|
|
28
|
+
* Lines of unchanged context kept around each changed hunk. Three is the unified-diff
|
|
29
|
+
* convention and is enough to locate a hunk unambiguously in almost all real files.
|
|
30
|
+
*/
|
|
31
|
+
const CONTEXT_LINES = 3;
|
|
32
|
+
/**
|
|
33
|
+
* A delta must be at most this fraction of the full text to be worth emitting. At 0.5 a
|
|
34
|
+
* diff that saves only a third of the tokens is rejected: the model still has to
|
|
35
|
+
* mentally apply it, and a near-full-size diff is strictly worse than the real text.
|
|
36
|
+
*/
|
|
37
|
+
const DELTA_MAX_RATIO = 0.5;
|
|
38
|
+
/**
|
|
39
|
+
* Below this size the full text is cheap enough that a diff never pays for its own
|
|
40
|
+
* explanation header, let alone the risk of misapplication.
|
|
41
|
+
*/
|
|
42
|
+
const DELTA_MIN_CHARS = 1200;
|
|
43
|
+
/**
|
|
44
|
+
* Diffing is O(n*m) in the worst case. Past this line count the DP table costs more CPU
|
|
45
|
+
* (and latency the user waits on) than the tokens it could save, so we decline.
|
|
46
|
+
*/
|
|
47
|
+
const MAX_DIFF_LINES = 4000;
|
|
48
|
+
/**
|
|
49
|
+
* Longest-common-subsequence over lines.
|
|
50
|
+
*
|
|
51
|
+
* Real edits touch a handful of lines in a file whose head and tail are untouched, so we
|
|
52
|
+
* strip the common prefix and suffix first. That turns the usual case into a DP over a
|
|
53
|
+
* few dozen lines instead of a few thousand, which is what keeps this affordable enough
|
|
54
|
+
* to run on every read.
|
|
55
|
+
*/
|
|
56
|
+
function diffLines(oldLines, newLines) {
|
|
57
|
+
let start = 0;
|
|
58
|
+
while (start < oldLines.length && start < newLines.length && oldLines[start] === newLines[start]) {
|
|
59
|
+
start++;
|
|
60
|
+
}
|
|
61
|
+
let endOld = oldLines.length;
|
|
62
|
+
let endNew = newLines.length;
|
|
63
|
+
while (endOld > start && endNew > start && oldLines[endOld - 1] === newLines[endNew - 1]) {
|
|
64
|
+
endOld--;
|
|
65
|
+
endNew--;
|
|
66
|
+
}
|
|
67
|
+
const a = oldLines.slice(start, endOld);
|
|
68
|
+
const b = newLines.slice(start, endNew);
|
|
69
|
+
const ops = [];
|
|
70
|
+
for (let i = 0; i < start; i++)
|
|
71
|
+
ops.push({ type: "equal", line: oldLines[i] });
|
|
72
|
+
// DP table of LCS lengths. Sized on the trimmed middle, which is why the trimming above
|
|
73
|
+
// matters: without it this allocates (n+1)*(m+1) numbers for the whole file.
|
|
74
|
+
const n = a.length;
|
|
75
|
+
const m = b.length;
|
|
76
|
+
const table = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
|
|
77
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
78
|
+
for (let j = m - 1; j >= 0; j--) {
|
|
79
|
+
table[i][j] = a[i] === b[j] ? table[i + 1][j + 1] + 1 : Math.max(table[i + 1][j], table[i][j + 1]);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
let i = 0;
|
|
83
|
+
let j = 0;
|
|
84
|
+
while (i < n && j < m) {
|
|
85
|
+
if (a[i] === b[j]) {
|
|
86
|
+
ops.push({ type: "equal", line: a[i] });
|
|
87
|
+
i++;
|
|
88
|
+
j++;
|
|
89
|
+
}
|
|
90
|
+
else if (table[i + 1][j] >= table[i][j + 1]) {
|
|
91
|
+
ops.push({ type: "del", line: a[i] });
|
|
92
|
+
i++;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
ops.push({ type: "ins", line: b[j] });
|
|
96
|
+
j++;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
while (i < n)
|
|
100
|
+
ops.push({ type: "del", line: a[i++] });
|
|
101
|
+
while (j < m)
|
|
102
|
+
ops.push({ type: "ins", line: b[j++] });
|
|
103
|
+
for (let k = endOld; k < oldLines.length; k++)
|
|
104
|
+
ops.push({ type: "equal", line: oldLines[k] });
|
|
105
|
+
return ops;
|
|
106
|
+
}
|
|
107
|
+
/** Group an op stream into unified-diff hunks with `CONTEXT_LINES` of surrounding context. */
|
|
108
|
+
function buildHunks(ops) {
|
|
109
|
+
const changedAt = new Set();
|
|
110
|
+
ops.forEach((op, idx) => {
|
|
111
|
+
if (op.type !== "equal")
|
|
112
|
+
changedAt.add(idx);
|
|
113
|
+
});
|
|
114
|
+
if (changedAt.size === 0)
|
|
115
|
+
return [];
|
|
116
|
+
// Expand each change into a window, then merge windows that touch or overlap so two
|
|
117
|
+
// edits four lines apart render as one hunk rather than two with duplicated context.
|
|
118
|
+
const windows = [];
|
|
119
|
+
for (const idx of Array.from(changedAt).sort((x, y) => x - y)) {
|
|
120
|
+
const lo = Math.max(0, idx - CONTEXT_LINES);
|
|
121
|
+
const hi = Math.min(ops.length - 1, idx + CONTEXT_LINES);
|
|
122
|
+
const last = windows[windows.length - 1];
|
|
123
|
+
if (last && lo <= last[1] + 1)
|
|
124
|
+
last[1] = Math.max(last[1], hi);
|
|
125
|
+
else
|
|
126
|
+
windows.push([lo, hi]);
|
|
127
|
+
}
|
|
128
|
+
// Line counters advance as we scan, so each hunk header reports true positions in both
|
|
129
|
+
// documents rather than positions relative to the hunk before it.
|
|
130
|
+
const hunks = [];
|
|
131
|
+
let oldLine = 1;
|
|
132
|
+
let newLine = 1;
|
|
133
|
+
let cursor = 0;
|
|
134
|
+
for (const [lo, hi] of windows) {
|
|
135
|
+
while (cursor < lo) {
|
|
136
|
+
const op = ops[cursor];
|
|
137
|
+
if (op.type !== "ins")
|
|
138
|
+
oldLine++;
|
|
139
|
+
if (op.type !== "del")
|
|
140
|
+
newLine++;
|
|
141
|
+
cursor++;
|
|
142
|
+
}
|
|
143
|
+
const hunk = { oldStart: oldLine, oldLines: 0, newStart: newLine, newLines: 0, lines: [] };
|
|
144
|
+
for (let idx = lo; idx <= hi; idx++) {
|
|
145
|
+
const op = ops[idx];
|
|
146
|
+
if (op.type === "equal") {
|
|
147
|
+
hunk.lines.push(` ${op.line}`);
|
|
148
|
+
hunk.oldLines++;
|
|
149
|
+
hunk.newLines++;
|
|
150
|
+
oldLine++;
|
|
151
|
+
newLine++;
|
|
152
|
+
}
|
|
153
|
+
else if (op.type === "del") {
|
|
154
|
+
hunk.lines.push(`-${op.line}`);
|
|
155
|
+
hunk.oldLines++;
|
|
156
|
+
oldLine++;
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
hunk.lines.push(`+${op.line}`);
|
|
160
|
+
hunk.newLines++;
|
|
161
|
+
newLine++;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
hunks.push(hunk);
|
|
165
|
+
cursor = hi + 1;
|
|
166
|
+
}
|
|
167
|
+
return hunks;
|
|
168
|
+
}
|
|
169
|
+
/** Line-level diff between the text the model already has and the text we would send now. */
|
|
170
|
+
function computeDiff(previous, next) {
|
|
171
|
+
if (previous === next)
|
|
172
|
+
return { hunks: [], added: 0, removed: 0, identical: true };
|
|
173
|
+
const oldLines = previous.split("\n");
|
|
174
|
+
const newLines = next.split("\n");
|
|
175
|
+
if (oldLines.length > MAX_DIFF_LINES || newLines.length > MAX_DIFF_LINES)
|
|
176
|
+
return null;
|
|
177
|
+
const ops = diffLines(oldLines, newLines);
|
|
178
|
+
const hunks = buildHunks(ops);
|
|
179
|
+
const added = ops.filter((o) => o.type === "ins").length;
|
|
180
|
+
const removed = ops.filter((o) => o.type === "del").length;
|
|
181
|
+
return { hunks, added, removed, identical: false };
|
|
182
|
+
}
|
|
183
|
+
/** Render hunks as a unified diff body (no ---/+++ file headers; the caller supplies context). */
|
|
184
|
+
function renderDiff(diff) {
|
|
185
|
+
return diff.hunks
|
|
186
|
+
.map((h) => [`@@ -${h.oldStart},${h.oldLines} +${h.newStart},${h.newLines} @@`, ...h.lines].join("\n"))
|
|
187
|
+
.join("\n");
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Decide whether to hand the model a delta instead of the full text.
|
|
191
|
+
*
|
|
192
|
+
* Declining is the safe direction: the caller falls back to sending everything, which is
|
|
193
|
+
* always correct. So every uncertain case here resolves to `emit: false`.
|
|
194
|
+
*/
|
|
195
|
+
function shouldEmitDelta(previous, next) {
|
|
196
|
+
const empty = { emit: false, added: 0, removed: 0, hunkCount: 0 };
|
|
197
|
+
if (next.length < DELTA_MIN_CHARS) {
|
|
198
|
+
return { ...empty, reason: "full text is small enough that a diff saves nothing" };
|
|
199
|
+
}
|
|
200
|
+
const diff = computeDiff(previous, next);
|
|
201
|
+
if (!diff)
|
|
202
|
+
return { ...empty, reason: "too large to diff affordably" };
|
|
203
|
+
if (diff.identical)
|
|
204
|
+
return { ...empty, reason: "identical" };
|
|
205
|
+
if (diff.hunks.length === 0)
|
|
206
|
+
return { ...empty, reason: "no hunks" };
|
|
207
|
+
const body = renderDiff(diff);
|
|
208
|
+
const ratio = body.length / next.length;
|
|
209
|
+
if (ratio > DELTA_MAX_RATIO) {
|
|
210
|
+
return {
|
|
211
|
+
...empty,
|
|
212
|
+
added: diff.added,
|
|
213
|
+
removed: diff.removed,
|
|
214
|
+
hunkCount: diff.hunks.length,
|
|
215
|
+
reason: `diff is ${Math.round(ratio * 100)}% of the full text — not worth reconstructing`,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
return {
|
|
219
|
+
emit: true,
|
|
220
|
+
body,
|
|
221
|
+
added: diff.added,
|
|
222
|
+
removed: diff.removed,
|
|
223
|
+
hunkCount: diff.hunks.length,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=OutputDelta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutputDelta.js","sourceRoot":"","sources":["../../../src/utils/OutputDelta.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;AAyKH,kCAYC;AAGD,gCAIC;AAmBD,0CA+BC;AA5OD;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB;;;;GAIG;AACH,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;;GAGG;AACH,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B;;;GAGG;AACH,MAAM,cAAc,GAAG,IAAI,CAAC;AAuB5B;;;;;;;GAOG;AACH,SAAS,SAAS,CAAC,QAAkB,EAAE,QAAkB;IACvD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd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
2
|
+
* OutputLedger — session memory of what each tool already returned.
|
|
3
|
+
*
|
|
4
|
+
* `ReadWorkspaceCache` solves this for file reads, but reads are not where the weight is.
|
|
5
|
+
* A debug loop runs `npm test` six times and `tsc --noEmit` four; each run dumps hundreds
|
|
6
|
+
* of near-identical lines into the transcript, and every one of those copies is re-sent on
|
|
7
|
+
* every later turn. By the end of a session the same failing stack trace can account for
|
|
8
|
+
* more context than the source files being debugged.
|
|
9
|
+
*
|
|
10
|
+
* So: key on (tool, call signature), remember the exact text emitted, and on a repeat
|
|
11
|
+
* answer with `IDENTICAL` or a diff instead of the payload.
|
|
12
|
+
*
|
|
13
|
+
* The correctness rule is the same one that governs the read cache, and it is absolute:
|
|
14
|
+
* a ledger hit may only suppress text the model demonstrably already received in this
|
|
15
|
+
* session. Anything else — a cold start, an evicted entry, a caller that didn't record —
|
|
16
|
+
* resolves to sending the full output. Under-suppressing costs tokens; over-suppressing
|
|
17
|
+
* costs the user a correct answer.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Build a stable key from the arguments that determine the output.
|
|
21
|
+
*
|
|
22
|
+
* Only pass arguments that actually change the result. Including an incidental field
|
|
23
|
+
* (a verbosity flag that doesn't alter the payload, a timestamp) makes every call a
|
|
24
|
+
* fresh key and silently disables the ledger; including too few makes two genuinely
|
|
25
|
+
* different calls collide, which would suppress output the model never saw. When unsure,
|
|
26
|
+
* include the field — a missed saving is recoverable, a wrong suppression is not.
|
|
27
|
+
*/
|
|
28
|
+
export declare function ledgerKey(toolName: string, signature: Record<string, unknown>): string;
|
|
29
|
+
export type LedgerStatus = "new" | "identical" | "changed";
|
|
30
|
+
export interface LedgerResult {
|
|
31
|
+
status: LedgerStatus;
|
|
32
|
+
/** Replacement text to return instead of the payload; null means "send the full output". */
|
|
33
|
+
replacement: string | null;
|
|
34
|
+
/** Characters saved by the replacement, for the savings ledger. 0 when nothing was suppressed. */
|
|
35
|
+
savedChars: number;
|
|
36
|
+
}
|
|
37
|
+
export interface LedgerOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Human-readable description of the call, used in the marker so the model can tell which
|
|
40
|
+
* earlier result it is being pointed at ("npm test", "search for 'foo' in src/").
|
|
41
|
+
*/
|
|
42
|
+
label: string;
|
|
43
|
+
/**
|
|
44
|
+
* Set when re-deriving the suppressed output is not free for the caller — a command that
|
|
45
|
+
* must actually run again. Purely informational; it does not change the decision.
|
|
46
|
+
*/
|
|
47
|
+
rerunHint?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Check a freshly produced output against what this tool last returned for the same call.
|
|
51
|
+
*
|
|
52
|
+
* Always call `record` afterwards with the text you actually emitted, including when this
|
|
53
|
+
* returns `new` — otherwise the next repeat has no base to compare against.
|
|
54
|
+
*/
|
|
55
|
+
export declare function checkOutput(key: string, text: string, options: LedgerOptions): LedgerResult;
|
|
56
|
+
/** Record the text a tool emitted (the full payload, not a marker) as the base for next time. */
|
|
57
|
+
export declare function recordOutput(key: string, text: string): void;
|
|
58
|
+
/** Test seam — the map is process-global and would otherwise leak between test cases. */
|
|
59
|
+
export declare function resetOutputLedger(): void;
|
|
60
|
+
//# sourceMappingURL=OutputLedger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutputLedger.d.ts","sourceRoot":"","sources":["../../../src/utils/OutputLedger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA0BH;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAMtF;AAED,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,WAAW,GAAG,SAAS,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,4FAA4F;IAC5F,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,kGAAkG;IAClG,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,YAAY,CA2B3F;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAsB5D;AAED,yFAAyF;AACzF,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OutputLedger — session memory of what each tool already returned.
|
|
4
|
+
*
|
|
5
|
+
* `ReadWorkspaceCache` solves this for file reads, but reads are not where the weight is.
|
|
6
|
+
* A debug loop runs `npm test` six times and `tsc --noEmit` four; each run dumps hundreds
|
|
7
|
+
* of near-identical lines into the transcript, and every one of those copies is re-sent on
|
|
8
|
+
* every later turn. By the end of a session the same failing stack trace can account for
|
|
9
|
+
* more context than the source files being debugged.
|
|
10
|
+
*
|
|
11
|
+
* So: key on (tool, call signature), remember the exact text emitted, and on a repeat
|
|
12
|
+
* answer with `IDENTICAL` or a diff instead of the payload.
|
|
13
|
+
*
|
|
14
|
+
* The correctness rule is the same one that governs the read cache, and it is absolute:
|
|
15
|
+
* a ledger hit may only suppress text the model demonstrably already received in this
|
|
16
|
+
* session. Anything else — a cold start, an evicted entry, a caller that didn't record —
|
|
17
|
+
* resolves to sending the full output. Under-suppressing costs tokens; over-suppressing
|
|
18
|
+
* costs the user a correct answer.
|
|
19
|
+
*/
|
|
20
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ledgerKey = ledgerKey;
|
|
25
|
+
exports.checkOutput = checkOutput;
|
|
26
|
+
exports.recordOutput = recordOutput;
|
|
27
|
+
exports.resetOutputLedger = resetOutputLedger;
|
|
28
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
29
|
+
const OutputDelta_1 = require("./OutputDelta");
|
|
30
|
+
const entries = new Map();
|
|
31
|
+
/** Mirrors the read cache's bound: this exists to save tokens, not to grow forever. */
|
|
32
|
+
const MAX_LEDGER_CHARS = 2000000;
|
|
33
|
+
const MAX_ENTRY_CHARS = 400000;
|
|
34
|
+
let ledgerChars = 0;
|
|
35
|
+
let callCounter = 0;
|
|
36
|
+
function sha256(text) {
|
|
37
|
+
return crypto_1.default.createHash("sha256").update(text).digest("hex");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Build a stable key from the arguments that determine the output.
|
|
41
|
+
*
|
|
42
|
+
* Only pass arguments that actually change the result. Including an incidental field
|
|
43
|
+
* (a verbosity flag that doesn't alter the payload, a timestamp) makes every call a
|
|
44
|
+
* fresh key and silently disables the ledger; including too few makes two genuinely
|
|
45
|
+
* different calls collide, which would suppress output the model never saw. When unsure,
|
|
46
|
+
* include the field — a missed saving is recoverable, a wrong suppression is not.
|
|
47
|
+
*/
|
|
48
|
+
function ledgerKey(toolName, signature) {
|
|
49
|
+
const normalized = Object.keys(signature)
|
|
50
|
+
.sort()
|
|
51
|
+
.map((k) => `${k}=${JSON.stringify(signature[k]) ?? ""}`)
|
|
52
|
+
.join("&");
|
|
53
|
+
return `${toolName}::${normalized}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Check a freshly produced output against what this tool last returned for the same call.
|
|
57
|
+
*
|
|
58
|
+
* Always call `record` afterwards with the text you actually emitted, including when this
|
|
59
|
+
* returns `new` — otherwise the next repeat has no base to compare against.
|
|
60
|
+
*/
|
|
61
|
+
function checkOutput(key, text, options) {
|
|
62
|
+
const previous = entries.get(key);
|
|
63
|
+
if (!previous)
|
|
64
|
+
return { status: "new", replacement: null, savedChars: 0 };
|
|
65
|
+
const hash = sha256(text);
|
|
66
|
+
if (hash === previous.hash) {
|
|
67
|
+
const marker = [
|
|
68
|
+
`IDENTICAL: ${options.label} produced byte-for-byte the same output as earlier this session (call #${previous.callIndex}).`,
|
|
69
|
+
`Nothing changed. Reuse that result rather than re-reading it here.`,
|
|
70
|
+
...(options.rerunHint ? [options.rerunHint] : []),
|
|
71
|
+
].join("\n");
|
|
72
|
+
return { status: "identical", replacement: marker, savedChars: Math.max(0, text.length - marker.length) };
|
|
73
|
+
}
|
|
74
|
+
const delta = (0, OutputDelta_1.shouldEmitDelta)(previous.text, text);
|
|
75
|
+
if (!delta.emit)
|
|
76
|
+
return { status: "changed", replacement: null, savedChars: 0 };
|
|
77
|
+
const marker = [
|
|
78
|
+
`CHANGED: ${options.label} — ${delta.hunkCount} hunk(s), +${delta.added}/-${delta.removed} vs. call #${previous.callIndex}.`,
|
|
79
|
+
`Everything else is unchanged from that result. Diff:`,
|
|
80
|
+
``,
|
|
81
|
+
delta.body,
|
|
82
|
+
].join("\n");
|
|
83
|
+
// A diff that ended up longer than the payload is a saving of zero, not a negative one;
|
|
84
|
+
// the caller decides what to emit, this only reports what was actually spared.
|
|
85
|
+
return { status: "changed", replacement: marker, savedChars: Math.max(0, text.length - marker.length) };
|
|
86
|
+
}
|
|
87
|
+
/** Record the text a tool emitted (the full payload, not a marker) as the base for next time. */
|
|
88
|
+
function recordOutput(key, text) {
|
|
89
|
+
const previous = entries.get(key);
|
|
90
|
+
if (previous) {
|
|
91
|
+
ledgerChars -= previous.text.length;
|
|
92
|
+
// `set` on an existing key keeps its original insertion position, so delete first to
|
|
93
|
+
// make a refreshed entry count as recently-written for eviction.
|
|
94
|
+
entries.delete(key);
|
|
95
|
+
}
|
|
96
|
+
if (text.length > MAX_ENTRY_CHARS)
|
|
97
|
+
return;
|
|
98
|
+
callCounter++;
|
|
99
|
+
entries.set(key, { text, hash: sha256(text), callIndex: callCounter, at: Date.now() });
|
|
100
|
+
ledgerChars += text.length;
|
|
101
|
+
while (ledgerChars > MAX_LEDGER_CHARS) {
|
|
102
|
+
const oldest = entries.keys().next();
|
|
103
|
+
if (oldest.done)
|
|
104
|
+
break;
|
|
105
|
+
const dropped = entries.get(oldest.value);
|
|
106
|
+
entries.delete(oldest.value);
|
|
107
|
+
ledgerChars -= dropped.text.length;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** Test seam — the map is process-global and would otherwise leak between test cases. */
|
|
111
|
+
function resetOutputLedger() {
|
|
112
|
+
entries.clear();
|
|
113
|
+
ledgerChars = 0;
|
|
114
|
+
callCounter = 0;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=OutputLedger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutputLedger.js","sourceRoot":"","sources":["../../../src/utils/OutputLedger.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;AAmCH,8BAMC;AA+BD,kCA2BC;AAGD,oCAsBC;AAGD,8CAIC;AAjID,oDAA4B;AAC5B,+CAAgD;AAUhD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;AAE/C,uFAAuF;AACvF,MAAM,gBAAgB,GAAG,OAAS,CAAC;AACnC,MAAM,eAAe,GAAG,MAAO,CAAC;AAEhC,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB,SAAS,MAAM,CAAC,IAAY;IAC1B,OAAO,gBAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,SAAS,CAAC,QAAgB,EAAE,SAAkC;IAC5E,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,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AAE,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,MAAM,CAAC,IAAI;YAAE,MAAM;QACvB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAE,CAAC;QAC3C,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IACrC,CAAC;AACH,CAAC;AAED,yFAAyF;AACzF,SAAgB,iBAAiB;IAC/B,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB,WAAW,GAAG,CAAC,CAAC;IAChB,WAAW,GAAG,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -15,8 +15,14 @@ export interface ReadDedupCheck {
|
|
|
15
15
|
}
|
|
16
16
|
/** Check whether this exact (path, view) content was already sent this session. */
|
|
17
17
|
export declare function checkAlreadySent(resolvedPath: string, view: ReadView, rawContent: string): ReadDedupCheck;
|
|
18
|
+
/**
|
|
19
|
+
* The text last emitted for this (path, view), or null if we have none — because this is
|
|
20
|
+
* the first read, or because the entry was evicted under the size cap. A null here means
|
|
21
|
+
* "send the full file", never "assume it is unchanged".
|
|
22
|
+
*/
|
|
23
|
+
export declare function getLastEmitted(resolvedPath: string, view: ReadView): string | null;
|
|
18
24
|
/** Record that this content was just sent, so future identical reads short-circuit. */
|
|
19
|
-
export declare function recordSent(resolvedPath: string, view: ReadView, hash: string): void;
|
|
20
|
-
/** Test seam — the
|
|
25
|
+
export declare function recordSent(resolvedPath: string, view: ReadView, hash: string, emitted?: string): void;
|
|
26
|
+
/** Test seam — the maps are process-global and would otherwise leak between test cases. */
|
|
21
27
|
export declare function resetReadCache(): void;
|
|
22
28
|
//# sourceMappingURL=ReadWorkspaceCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadWorkspaceCache.d.ts","sourceRoot":"","sources":["../../../src/utils/ReadWorkspaceCache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ReadWorkspaceCache.d.ts","sourceRoot":"","sources":["../../../src/utils/ReadWorkspaceCache.ts"],"names":[],"mappings":"AAgCA;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAaD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,GAAG,cAAc,CAKzG;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAElF;AAED,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAiCrG;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,IAAI,IAAI,CAIrC"}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.checkAlreadySent = checkAlreadySent;
|
|
7
|
+
exports.getLastEmitted = getLastEmitted;
|
|
7
8
|
exports.recordSent = recordSent;
|
|
8
9
|
exports.resetReadCache = resetReadCache;
|
|
9
10
|
const crypto_1 = __importDefault(require("crypto"));
|
|
@@ -12,6 +13,22 @@ const crypto_1 = __importDefault(require("crypto"));
|
|
|
12
13
|
// model for a given (filePath, view) pair, so a second identical read doesn't
|
|
13
14
|
// resend content the model already has in its own context.
|
|
14
15
|
const lastSent = new Map();
|
|
16
|
+
/**
|
|
17
|
+
* The exact text emitted for each key, kept so a later read of a *changed* file can be
|
|
18
|
+
* answered with a diff instead of the whole file again. Only what the model actually
|
|
19
|
+
* received is stored — diffing against anything else would describe a document it never
|
|
20
|
+
* had.
|
|
21
|
+
*/
|
|
22
|
+
const lastEmitted = new Map();
|
|
23
|
+
/**
|
|
24
|
+
* Total characters held in `lastEmitted`. This cache exists to save tokens, so it must
|
|
25
|
+
* not grow without bound in a long session; past the cap the least-recently-written
|
|
26
|
+
* entries are dropped and those reads simply fall back to sending the full file.
|
|
27
|
+
*/
|
|
28
|
+
const MAX_EMITTED_CHARS = 2000000;
|
|
29
|
+
/** A single entry larger than this is never stored — one huge file would evict everything else. */
|
|
30
|
+
const MAX_ENTRY_CHARS = 400000;
|
|
31
|
+
let emittedChars = 0;
|
|
15
32
|
function sha256(content) {
|
|
16
33
|
return crypto_1.default.createHash("sha256").update(content).digest("hex");
|
|
17
34
|
}
|
|
@@ -32,12 +49,50 @@ function checkAlreadySent(resolvedPath, view, rawContent) {
|
|
|
32
49
|
const unchanged = lastSent.get(key) === hash;
|
|
33
50
|
return { unchanged, hash };
|
|
34
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The text last emitted for this (path, view), or null if we have none — because this is
|
|
54
|
+
* the first read, or because the entry was evicted under the size cap. A null here means
|
|
55
|
+
* "send the full file", never "assume it is unchanged".
|
|
56
|
+
*/
|
|
57
|
+
function getLastEmitted(resolvedPath, view) {
|
|
58
|
+
return lastEmitted.get(cacheKey(resolvedPath, view)) ?? null;
|
|
59
|
+
}
|
|
35
60
|
/** Record that this content was just sent, so future identical reads short-circuit. */
|
|
36
|
-
function recordSent(resolvedPath, view, hash) {
|
|
37
|
-
|
|
61
|
+
function recordSent(resolvedPath, view, hash, emitted) {
|
|
62
|
+
const key = cacheKey(resolvedPath, view);
|
|
63
|
+
lastSent.set(key, hash);
|
|
64
|
+
if (emitted === undefined)
|
|
65
|
+
return;
|
|
66
|
+
const previous = lastEmitted.get(key);
|
|
67
|
+
if (previous !== undefined) {
|
|
68
|
+
emittedChars -= previous.length;
|
|
69
|
+
// Map keeps insertion order, and `set` on an existing key does not move it. Deleting
|
|
70
|
+
// first is what makes a refreshed entry count as recently-written for eviction.
|
|
71
|
+
lastEmitted.delete(key);
|
|
72
|
+
}
|
|
73
|
+
if (emitted.length > MAX_ENTRY_CHARS) {
|
|
74
|
+
// Too big to keep. Drop any stale copy rather than leaving a diff base that no longer
|
|
75
|
+
// matches what the model holds.
|
|
76
|
+
lastEmitted.delete(key);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
lastEmitted.set(key, emitted);
|
|
80
|
+
emittedChars += emitted.length;
|
|
81
|
+
// Map iteration is insertion-ordered, and re-inserting on every write above moves a
|
|
82
|
+
// refreshed key to the back — so evicting from the front drops the least-recently-written.
|
|
83
|
+
while (emittedChars > MAX_EMITTED_CHARS) {
|
|
84
|
+
const oldest = lastEmitted.keys().next();
|
|
85
|
+
if (oldest.done)
|
|
86
|
+
break;
|
|
87
|
+
const dropped = lastEmitted.get(oldest.value);
|
|
88
|
+
lastEmitted.delete(oldest.value);
|
|
89
|
+
emittedChars -= dropped.length;
|
|
90
|
+
}
|
|
38
91
|
}
|
|
39
|
-
/** Test seam — the
|
|
92
|
+
/** Test seam — the maps are process-global and would otherwise leak between test cases. */
|
|
40
93
|
function resetReadCache() {
|
|
41
94
|
lastSent.clear();
|
|
95
|
+
lastEmitted.clear();
|
|
96
|
+
emittedChars = 0;
|
|
42
97
|
}
|
|
43
98
|
//# sourceMappingURL=ReadWorkspaceCache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReadWorkspaceCache.js","sourceRoot":"","sources":["../../../src/utils/ReadWorkspaceCache.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"ReadWorkspaceCache.js","sourceRoot":"","sources":["../../../src/utils/ReadWork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E,CAAC,IAAI,EAAE,CAAC;QACzC,IAAI,MAAM,CAAC,IAAI;YAAE,MAAM;QACvB,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAE,CAAC;QAC/C,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IACjC,CAAC;AACH,CAAC;AAED,2FAA2F;AAC3F,SAAgB,cAAc;IAC5B,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,WAAW,CAAC,KAAK,EAAE,CAAC;IACpB,YAAY,GAAG,CAAC,CAAC;AACnB,CAAC"}
|
package/dist/esm/mcp/index.js
CHANGED
|
@@ -134,7 +134,17 @@ class LemmaMcpServer {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
// ── Proxy Auto-Start ──────────────────────────────────────────────
|
|
137
|
+
/**
|
|
138
|
+
* Set by the eval harness. The proxy is a detached background process and the handshake
|
|
139
|
+
* is a retry loop against localhost: one is a side effect that outlives the test run, the
|
|
140
|
+
* other adds seconds of latency to every session. Neither is part of any tool's contract.
|
|
141
|
+
*/
|
|
142
|
+
get proxyDisabled() {
|
|
143
|
+
return process.env.LEMMA_MCP_NO_PROXY === "1";
|
|
144
|
+
}
|
|
137
145
|
async ensureProxyRunning() {
|
|
146
|
+
if (this.proxyDisabled)
|
|
147
|
+
return;
|
|
138
148
|
try {
|
|
139
149
|
const cliCandidates = [
|
|
140
150
|
path.join(__dirname, "..", "cli", "lemma-proxy.js"),
|
|
@@ -168,6 +178,8 @@ class LemmaMcpServer {
|
|
|
168
178
|
}
|
|
169
179
|
// ── MCP Event Reporting ───────────────────────────────────────────
|
|
170
180
|
async reportMcpEvent(event) {
|
|
181
|
+
if (this.proxyDisabled)
|
|
182
|
+
return;
|
|
171
183
|
try {
|
|
172
184
|
const port = getProxyPort();
|
|
173
185
|
const projectPath = process.cwd();
|
|
@@ -190,6 +202,8 @@ class LemmaMcpServer {
|
|
|
190
202
|
}
|
|
191
203
|
// ── Proxy Registration ────────────────────────────────────────────
|
|
192
204
|
async registerWithProxy() {
|
|
205
|
+
if (this.proxyDisabled)
|
|
206
|
+
return;
|
|
193
207
|
const maxRetries = 5;
|
|
194
208
|
for (let i = 0; i < maxRetries; i++) {
|
|
195
209
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAiB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAY,OAAO,EAAE,MAAM,SAAS,CAAC;AAElF,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B,SAAS,WAAW;IAClB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAClC,IAAI,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC7C,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EA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ED,MAAM,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;AACpC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-profiles.d.ts","sourceRoot":"","sources":["../../../src/mcp/tool-profiles.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"tool-profiles.d.ts","sourceRoot":"","sources":["../../../src/mcp/tool-profiles.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,EA6BnC,CAAC;AA4DF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,UAAoE,CAAC;AAkBnG,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;IAC7D,OAAO,EAAE,WAAW,CAAC;IACrB,wCAAwC;IACxC,UAAU,EAAE,CAAC,EAAE,CAAC;IAChB,uFAAuF;IACvF,MAAM,EAAE,CAAC,EAAE,CAAC;IACZ,oDAAoD;IACpD,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACxC;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,EACjF,cAAc,EAAE,CAAC,EAAE,EACnB,GAAG,GAAE,MAAsB,EAC3B,OAAO,GAAE,cAAmB,GAC3B,mBAAmB,CAAC,CAAC,CAAC,CA4CxB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EACrD,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAuDR"}
|
|
@@ -23,6 +23,9 @@ export const CORE_TOOL_NAMES = [
|
|
|
23
23
|
"get_ast_hologram",
|
|
24
24
|
"get_symbol_surgical_context",
|
|
25
25
|
"get_project_onboarding",
|
|
26
|
+
// Earns its schema by replacing full-suite runs, whose output is the single largest
|
|
27
|
+
// context sink in an edit/verify loop.
|
|
28
|
+
"affected_tests",
|
|
26
29
|
// Avoid re-deriving what was already derived
|
|
27
30
|
"state_hash_cache",
|
|
28
31
|
"smarter_cache",
|