greprag 5.49.0 → 5.49.3
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/dist/commands/checkpoint-helpers.js +6 -1
- package/dist/commands/checkpoint-helpers.js.map +1 -1
- package/dist/commands/fix.js +7 -3
- package/dist/commands/fix.js.map +1 -1
- package/dist/commands/frontdesk-reminder.js +4 -1
- package/dist/commands/frontdesk-reminder.js.map +1 -1
- package/dist/commands/inbox-primer-reminder.d.ts +22 -0
- package/dist/commands/inbox-primer-reminder.js +44 -0
- package/dist/commands/inbox-primer-reminder.js.map +1 -0
- package/dist/commands/init.js +1 -1
- package/dist/commands/opencode-relay.d.ts +14 -23
- package/dist/commands/opencode-relay.js +16 -71
- package/dist/commands/opencode-relay.js.map +1 -1
- package/dist/commands/reminder-registry.js +2 -0
- package/dist/commands/reminder-registry.js.map +1 -1
- package/dist/crush/code-compressor.d.ts +61 -0
- package/dist/crush/code-compressor.js +359 -0
- package/dist/crush/code-compressor.js.map +1 -0
- package/dist/crush/crush-types.d.ts +1 -1
- package/dist/crush/index.d.ts +1 -0
- package/dist/crush/index.js +6 -1
- package/dist/crush/index.js.map +1 -1
- package/dist/index.js +4 -8
- package/dist/index.js.map +1 -1
- package/dist/opencode-plugin-crush.d.ts +51 -2
- package/dist/opencode-plugin-crush.js +94 -9
- package/dist/opencode-plugin-crush.js.map +1 -1
- package/dist/opencode-plugin.bundle.js +325 -10
- package/dist/opencode-plugin.js +0 -21
- package/dist/opencode-plugin.js.map +1 -1
- package/dist/session-id.d.ts +9 -0
- package/dist/session-id.js +17 -2
- package/dist/session-id.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MIRRORED FILE — canonical source: packages/core/src/crush/code-compressor.ts.
|
|
4
|
+
* Byte-identical copy lives at packages/cli/src/crush/code-compressor.ts (the CLI is a
|
|
5
|
+
* zero-dep artifact and cannot import @greprag/core). KEEP IN SYNC —
|
|
6
|
+
* the sync guard in tests/test-crush.cjs fails the build on drift.
|
|
7
|
+
*
|
|
8
|
+
* Source-code compressor — the 4th type-aware transform, a faithful
|
|
9
|
+
* (dependency-free) port of Headroom's CodeCompressor
|
|
10
|
+
* (github.com/chopratejas/headroom, transforms/code_compressor.py).
|
|
11
|
+
*
|
|
12
|
+
* Headroom's compressor is AST-aware (tree-sitter for py/js/ts/go/rust/java/
|
|
13
|
+
* c/c++). The crush engine forbids runtime deps (adr/crush-engine.md: core is
|
|
14
|
+
* zero-dep), so this is a structural port of Headroom's OWN Phase-3 fallback —
|
|
15
|
+
* regex + brace/indent tracking instead of a parse tree. It preserves the same
|
|
16
|
+
* high-signal skeleton and elides the same bulk:
|
|
17
|
+
*
|
|
18
|
+
* PRESERVE — imports / use / include / package, top-level (module) code,
|
|
19
|
+
* decorators/attributes, and class / interface / struct / enum / type and
|
|
20
|
+
* function/method SIGNATURES (the line up to and including the opening brace
|
|
21
|
+
* or `def ...:`), plus the matching close.
|
|
22
|
+
* ELIDE — function/method BODIES past a small per-function budget,
|
|
23
|
+
* replaced by ONE `<comment-prefix> [N lines omitted]` marker (Headroom's
|
|
24
|
+
* omission-comment format). Lossy-but-structural; the byte-exact original is
|
|
25
|
+
* recoverable through the CCR layer exactly like the other compressors.
|
|
26
|
+
*
|
|
27
|
+
* Two body models, picked by `detectCodeLanguage`:
|
|
28
|
+
* - brace mode (js/ts/go/rust/java/c/c++): a block stack tracks which braces
|
|
29
|
+
* open a FUNCTION body (vs a class/object/control block); only function
|
|
30
|
+
* bodies are elided, so class member signatures survive.
|
|
31
|
+
* - indent mode (python): a def-indent stack; bodies indented under a `def`
|
|
32
|
+
* are elided, class bodies and module code survive.
|
|
33
|
+
*
|
|
34
|
+
* Like its siblings: pure (string in → { output, stats } out), no I/O, no deps;
|
|
35
|
+
* passes input through unchanged when it can't help.
|
|
36
|
+
*/
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.DEFAULT_CODE_CONFIG = void 0;
|
|
39
|
+
exports.detectCodeLanguage = detectCodeLanguage;
|
|
40
|
+
exports.looksLikeCode = looksLikeCode;
|
|
41
|
+
exports.crushCode = crushCode;
|
|
42
|
+
const crush_types_1 = require("./crush-types");
|
|
43
|
+
exports.DEFAULT_CODE_CONFIG = {
|
|
44
|
+
minLines: 8,
|
|
45
|
+
maxBodyLines: 3,
|
|
46
|
+
};
|
|
47
|
+
// --- Language detection ------------------------------------------------------
|
|
48
|
+
/** Brace-light + `def`/colon-block heavy → python; else the brace family. */
|
|
49
|
+
function detectCodeLanguage(content) {
|
|
50
|
+
const braces = (content.match(/[{}]/g) || []).length;
|
|
51
|
+
let pyDef = 0;
|
|
52
|
+
let colonBlock = 0;
|
|
53
|
+
for (const raw of content.split('\n')) {
|
|
54
|
+
const t = raw.trim();
|
|
55
|
+
if (/^(?:async\s+def|def)\s+\w+\s*\(/.test(t))
|
|
56
|
+
pyDef++;
|
|
57
|
+
if (/:\s*(?:#.*)?$/.test(t) && /^(?:def|class|if|elif|else|for|while|try|except|finally|with|async\s+def|match|case)\b/.test(t)) {
|
|
58
|
+
colonBlock++;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (pyDef > 0 && braces <= pyDef)
|
|
62
|
+
return 'python';
|
|
63
|
+
if (braces === 0 && colonBlock > 0)
|
|
64
|
+
return 'python';
|
|
65
|
+
return 'cfamily';
|
|
66
|
+
}
|
|
67
|
+
// --- Content classification (used by the inline crusher's classifyContent) ---
|
|
68
|
+
/** A declaration / structural code line (anchored — logs/prose rarely match). */
|
|
69
|
+
const DECL_RE = /^\s*(?:export\s+|default\s+|pub\s+|public\s+|private\s+|protected\s+|static\s+|final\s+|abstract\s+|async\s+)*(?:import\b|from\s+\S+\s+import\b|require\s*\(|use\s+\w|#include\b|package\s+\w|using\s+\w|namespace\s+\w|function\b|func\s+\w|fn\s+\w|def\s+\w|class\s+\w|interface\s+\w|type\s+\w+\s*[=<]|struct\s+\w|enum\s+\w|impl\b|trait\s+\w|const\s+\w|let\s+\w|var\s+\w|val\s+\w)|^\s*@\w[\w.]*\s*(?:\(|$)/;
|
|
70
|
+
/** A log/build line — the negative signal that keeps logs out of `code`. */
|
|
71
|
+
const LOG_LINE_RE = /^\s*(?:\[?\d{4}-\d\d-\d\d|\d\d:\d\d:\d\d|(?:INFO|DEBUG|WARN|WARNING|ERROR|TRACE|FATAL|CRITICAL)\b|npm (?:ERR!|WARN|info)|at\s+\S+\s*\(|Traceback\b|File ")/;
|
|
72
|
+
/** A natural-language line: word-heavy, sentence-terminated, no code punctuation. */
|
|
73
|
+
function looksProse(t) {
|
|
74
|
+
if (/[{};=<>]/.test(t))
|
|
75
|
+
return false;
|
|
76
|
+
if (!/[.!?]['")]?$/.test(t))
|
|
77
|
+
return false;
|
|
78
|
+
return t.split(/\s+/).filter(Boolean).length >= 5;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* True when `text` reads as source code (NOT prose, a log, JSON, or grep
|
|
82
|
+
* output). Used by the inline crusher's classifier to route a field to the
|
|
83
|
+
* code compressor. Conservative on purpose: needs ≥2 declaration lines, a high
|
|
84
|
+
* structural-punctuation density, and few log/prose lines — a misclassified
|
|
85
|
+
* field only compresses LESS, never wrongly, so we'd rather under-claim code.
|
|
86
|
+
*/
|
|
87
|
+
function looksLikeCode(text) {
|
|
88
|
+
const lines = text.split('\n').filter((l) => l.trim() !== '').slice(0, 100);
|
|
89
|
+
const n = lines.length;
|
|
90
|
+
if (n < 4)
|
|
91
|
+
return false;
|
|
92
|
+
let decl = 0;
|
|
93
|
+
let struct = 0;
|
|
94
|
+
let log = 0;
|
|
95
|
+
let prose = 0;
|
|
96
|
+
for (const l of lines) {
|
|
97
|
+
const t = l.trim();
|
|
98
|
+
if (DECL_RE.test(l))
|
|
99
|
+
decl++;
|
|
100
|
+
if (/[{};]\s*$/.test(t) ||
|
|
101
|
+
/=>\s*\{?\s*$/.test(t) ||
|
|
102
|
+
(/:\s*(?:#.*)?$/.test(t) && /^(?:def|class|if|elif|else|for|while|try|except|finally|with|async\s+def|match|case)\b/.test(t))) {
|
|
103
|
+
struct++;
|
|
104
|
+
}
|
|
105
|
+
if (LOG_LINE_RE.test(l))
|
|
106
|
+
log++;
|
|
107
|
+
if (looksProse(t))
|
|
108
|
+
prose++;
|
|
109
|
+
}
|
|
110
|
+
if (log / n >= 0.3)
|
|
111
|
+
return false;
|
|
112
|
+
if (prose / n >= 0.5)
|
|
113
|
+
return false;
|
|
114
|
+
if (decl < 2)
|
|
115
|
+
return false;
|
|
116
|
+
return (decl + struct) / n >= 0.4;
|
|
117
|
+
}
|
|
118
|
+
// --- Function-signature detection (brace mode) -------------------------------
|
|
119
|
+
const CONTROL_HEAD_RE = /^(?:if|for|while|switch|catch|do|else|try|finally|with|when|return|throw|=>)\b/;
|
|
120
|
+
/** Does this line open a FUNCTION body (vs a class/object/control block)? */
|
|
121
|
+
function lineOpensFunc(line) {
|
|
122
|
+
const t = line.trim();
|
|
123
|
+
const brace = t.indexOf('{');
|
|
124
|
+
if (brace === -1)
|
|
125
|
+
return false;
|
|
126
|
+
const sig = t.slice(0, brace).trim();
|
|
127
|
+
if (sig === '')
|
|
128
|
+
return false; // a bare `{` opens an object/block, not a function
|
|
129
|
+
if (sig.startsWith('}'))
|
|
130
|
+
return false; // `} else {`, `}, {` — a continuation, not a fresh function
|
|
131
|
+
if (CONTROL_HEAD_RE.test(sig))
|
|
132
|
+
return false;
|
|
133
|
+
if (/\bfunction\b/.test(sig))
|
|
134
|
+
return true;
|
|
135
|
+
if (/^(?:pub\s+|async\s+|public\s+|private\s+|protected\s+|static\s+|final\s+|export\s+|default\s+|unsafe\s+|inline\s+|virtual\s+|override\s+)*(?:func|fn)\b/.test(sig)) {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
if (/=>\s*$/.test(sig))
|
|
139
|
+
return true; // arrow: const f = (x) => {
|
|
140
|
+
// `name(params) [: ret] {` (methods, java/c declarations) or a multiline-sig `) {`.
|
|
141
|
+
if (/\)\s*(?::\s*[^{]+)?$/.test(sig) && (/\w\s*\(/.test(sig) || sig === ')'))
|
|
142
|
+
return true;
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
/** Ordered list of significant brace events on one line, skipping braces inside
|
|
146
|
+
* string/char/template literals and `//` / block comments. */
|
|
147
|
+
function braceEvents(line, st) {
|
|
148
|
+
const events = [];
|
|
149
|
+
let inBlock = st.inBlockComment;
|
|
150
|
+
let quote = null;
|
|
151
|
+
let i = 0;
|
|
152
|
+
const n = line.length;
|
|
153
|
+
while (i < n) {
|
|
154
|
+
const c = line[i];
|
|
155
|
+
const c2 = i + 1 < n ? line[i + 1] : '';
|
|
156
|
+
if (inBlock) {
|
|
157
|
+
if (c === '*' && c2 === '/') {
|
|
158
|
+
inBlock = false;
|
|
159
|
+
i += 2;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
i++;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (quote) {
|
|
166
|
+
if (c === '\\') {
|
|
167
|
+
i += 2;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
if (c === quote)
|
|
171
|
+
quote = null;
|
|
172
|
+
i++;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (c === '/' && c2 === '/')
|
|
176
|
+
break; // line comment — ignore the rest
|
|
177
|
+
if (c === '/' && c2 === '*') {
|
|
178
|
+
inBlock = true;
|
|
179
|
+
i += 2;
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (c === '"' || c === "'" || c === '`') {
|
|
183
|
+
quote = c;
|
|
184
|
+
i++;
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (c === '{') {
|
|
188
|
+
events.push('{');
|
|
189
|
+
i++;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (c === '}') {
|
|
193
|
+
events.push('}');
|
|
194
|
+
i++;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
i++;
|
|
198
|
+
}
|
|
199
|
+
return { events, st: { inBlockComment: inBlock } };
|
|
200
|
+
}
|
|
201
|
+
// --- Marker-emitting line collector ------------------------------------------
|
|
202
|
+
function leadingWhitespace(line) {
|
|
203
|
+
return line.slice(0, line.length - line.trimStart().length);
|
|
204
|
+
}
|
|
205
|
+
/** Accumulates kept lines + collapses runs of elided lines into one marker. */
|
|
206
|
+
class CodeOutput {
|
|
207
|
+
constructor(commentPrefix) {
|
|
208
|
+
this.commentPrefix = commentPrefix;
|
|
209
|
+
this.lines = [];
|
|
210
|
+
this.kept = 0;
|
|
211
|
+
this.omitted = [];
|
|
212
|
+
}
|
|
213
|
+
keep(line) {
|
|
214
|
+
this.flush();
|
|
215
|
+
this.lines.push(line);
|
|
216
|
+
this.kept++;
|
|
217
|
+
}
|
|
218
|
+
drop(line) {
|
|
219
|
+
this.omitted.push(line);
|
|
220
|
+
}
|
|
221
|
+
flush() {
|
|
222
|
+
if (this.omitted.length === 0)
|
|
223
|
+
return;
|
|
224
|
+
const anchor = this.omitted.find((l) => l.trim() !== '') ?? this.omitted[0];
|
|
225
|
+
const indent = leadingWhitespace(anchor);
|
|
226
|
+
this.lines.push(`${indent}${this.commentPrefix} [${this.omitted.length} lines omitted]`);
|
|
227
|
+
this.omitted = [];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function compressBraces(lines, cfg, commentPrefix) {
|
|
231
|
+
const out = new CodeOutput(commentPrefix);
|
|
232
|
+
const stack = [];
|
|
233
|
+
let scan = { inBlockComment: false };
|
|
234
|
+
for (const line of lines) {
|
|
235
|
+
const innermost = innermostFunc(stack);
|
|
236
|
+
const insideFunc = innermost !== null;
|
|
237
|
+
const trimmed = line.trim();
|
|
238
|
+
const inComment = scan.inBlockComment;
|
|
239
|
+
// Apply this line's braces; record whether it closes a function body.
|
|
240
|
+
const { events, st } = braceEvents(line, scan);
|
|
241
|
+
scan = st;
|
|
242
|
+
let firstPush = true;
|
|
243
|
+
let closedFunc = false;
|
|
244
|
+
const opensFunc = lineOpensFunc(line);
|
|
245
|
+
for (const ev of events) {
|
|
246
|
+
if (ev === '{') {
|
|
247
|
+
const kind = firstPush && opensFunc ? 'func' : 'other';
|
|
248
|
+
firstPush = false;
|
|
249
|
+
stack.push({ kind, budget: kind === 'func' ? cfg.maxBodyLines : 0 });
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
const f = stack.pop();
|
|
253
|
+
if (f && f.kind === 'func')
|
|
254
|
+
closedFunc = true;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
let keep;
|
|
258
|
+
if (!insideFunc || inComment)
|
|
259
|
+
keep = true;
|
|
260
|
+
else if (closedFunc)
|
|
261
|
+
keep = true; // the function's closing brace — keep the skeleton's `}`
|
|
262
|
+
else if (trimmed === '')
|
|
263
|
+
keep = innermost.budget > 0;
|
|
264
|
+
else if (innermost.budget > 0) {
|
|
265
|
+
keep = true;
|
|
266
|
+
innermost.budget--;
|
|
267
|
+
}
|
|
268
|
+
else
|
|
269
|
+
keep = false;
|
|
270
|
+
if (keep)
|
|
271
|
+
out.keep(line);
|
|
272
|
+
else
|
|
273
|
+
out.drop(line);
|
|
274
|
+
}
|
|
275
|
+
out.flush();
|
|
276
|
+
return out;
|
|
277
|
+
}
|
|
278
|
+
function innermostFunc(stack) {
|
|
279
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
280
|
+
if (stack[i].kind === 'func')
|
|
281
|
+
return stack[i];
|
|
282
|
+
}
|
|
283
|
+
return null;
|
|
284
|
+
}
|
|
285
|
+
const PY_STRUCT_RE = /^(?:@|async\s+def\b|def\b|class\b|import\b|from\b)/;
|
|
286
|
+
const PY_DEF_RE = /^(?:async\s+def|def)\b/;
|
|
287
|
+
function compressPython(lines, cfg, commentPrefix) {
|
|
288
|
+
const out = new CodeOutput(commentPrefix);
|
|
289
|
+
const stack = [];
|
|
290
|
+
for (const line of lines) {
|
|
291
|
+
const stripped = line.trim();
|
|
292
|
+
if (stripped === '') {
|
|
293
|
+
const top = stack[stack.length - 1];
|
|
294
|
+
out_keepOrDrop(out, line, top ? top.budget > 0 : true);
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
const indent = leadingWhitespace(line).length;
|
|
298
|
+
while (stack.length && indent <= stack[stack.length - 1].indent)
|
|
299
|
+
stack.pop();
|
|
300
|
+
const inside = stack.length > 0;
|
|
301
|
+
let keep;
|
|
302
|
+
if (PY_STRUCT_RE.test(stripped))
|
|
303
|
+
keep = true; // decorators, signatures, imports
|
|
304
|
+
else if (!inside)
|
|
305
|
+
keep = true; // module-level code
|
|
306
|
+
else {
|
|
307
|
+
const top = stack[stack.length - 1];
|
|
308
|
+
if (top.budget > 0) {
|
|
309
|
+
keep = true;
|
|
310
|
+
top.budget--;
|
|
311
|
+
}
|
|
312
|
+
else
|
|
313
|
+
keep = false;
|
|
314
|
+
}
|
|
315
|
+
out_keepOrDrop(out, line, keep);
|
|
316
|
+
if (PY_DEF_RE.test(stripped))
|
|
317
|
+
stack.push({ indent, budget: cfg.maxBodyLines });
|
|
318
|
+
}
|
|
319
|
+
out.flush();
|
|
320
|
+
return out;
|
|
321
|
+
}
|
|
322
|
+
function out_keepOrDrop(out, line, keep) {
|
|
323
|
+
if (keep)
|
|
324
|
+
out.keep(line);
|
|
325
|
+
else
|
|
326
|
+
out.drop(line);
|
|
327
|
+
}
|
|
328
|
+
// --- Entry -------------------------------------------------------------------
|
|
329
|
+
/** Compress a source-code block — preserve structure, elide bodies. Inputs
|
|
330
|
+
* below the min line count, or that yield no elision, pass through verbatim. */
|
|
331
|
+
function crushCode(content, config = {}) {
|
|
332
|
+
const cfg = { ...exports.DEFAULT_CODE_CONFIG, ...config };
|
|
333
|
+
const lines = content.split('\n');
|
|
334
|
+
if (lines.length < cfg.minLines) {
|
|
335
|
+
return (0, crush_types_1.makePassthrough)(content, 'code', 'below min line count', lines.length);
|
|
336
|
+
}
|
|
337
|
+
const lang = cfg.language ?? detectCodeLanguage(content);
|
|
338
|
+
const commentPrefix = cfg.commentPrefix ?? (lang === 'python' ? '#' : '//');
|
|
339
|
+
const out = lang === 'python'
|
|
340
|
+
? compressPython(lines, cfg, commentPrefix)
|
|
341
|
+
: compressBraces(lines, cfg, commentPrefix);
|
|
342
|
+
if (out.kept >= lines.length) {
|
|
343
|
+
return (0, crush_types_1.makePassthrough)(content, 'code', 'no compressible bodies', lines.length);
|
|
344
|
+
}
|
|
345
|
+
const output = out.lines.join('\n');
|
|
346
|
+
return {
|
|
347
|
+
output,
|
|
348
|
+
stats: {
|
|
349
|
+
sourceType: 'code',
|
|
350
|
+
originalChars: content.length,
|
|
351
|
+
compressedChars: output.length,
|
|
352
|
+
compressionRatio: output.length / Math.max(content.length, 1),
|
|
353
|
+
originalUnits: lines.length,
|
|
354
|
+
keptUnits: out.kept,
|
|
355
|
+
passthrough: false,
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
//# sourceMappingURL=code-compressor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-compressor.js","sourceRoot":"","sources":["../../src/crush/code-compressor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;AAyBH,gDAcC;AA0BD,sCA2BC;AAqMD,8BA8BC;AA7TD,+CAA6D;AAahD,QAAA,mBAAmB,GAAyB;IACvD,QAAQ,EAAE,CAAC;IACX,YAAY,EAAE,CAAC;CAChB,CAAC;AAIF,gFAAgF;AAEhF,6EAA6E;AAC7E,SAAgB,kBAAkB,CAAC,OAAe;IAChD,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IACrD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,KAAK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,GAAG,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QAC7B,OAAO,IAAA,6BAAe,EAAC,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO;QACL,MAAM;QACN,KAAK,EAAE;YACL,UAAU,EAAE,MAAM;YAClB,aAAa,EAAE,OAAO,CAAC,MAAM;YAC7B,eAAe,EAAE,MAAM,CAAC,MAAM;YAC9B,gBAAgB,EAAE,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;YAC7D,aAAa,EAAE,KAAK,CAAC,MAAM;YAC3B,SAAS,EAAE,GAAG,CAAC,IAAI;YACnB,WAAW,EAAE,KAAK;SACnB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Every compressor is a pure function: string in → { output, stats } out.
|
|
11
11
|
* No I/O, no deps. CCR storage and CLI plumbing live in packages/cli.
|
|
12
12
|
*/
|
|
13
|
-
export type CrushSourceType = 'search' | 'log' | 'json';
|
|
13
|
+
export type CrushSourceType = 'search' | 'log' | 'json' | 'code';
|
|
14
14
|
export interface CrushStats {
|
|
15
15
|
/** Source type the compressor handled. */
|
|
16
16
|
sourceType: CrushSourceType;
|
package/dist/crush/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { CrushResult, CrushStats, CrushSourceType, estimateTokens, makePassthrou
|
|
|
11
11
|
export { crushSearch, parseMatchLine, DEFAULT_SEARCH_CONFIG, SearchCompressorConfig } from './search-compressor';
|
|
12
12
|
export { crushLog, detectFormat, classifyLevel, isSummaryLine, parseLogLines, normalizeForDedupe, DEFAULT_LOG_CONFIG, LogCompressorConfig, LogFormat, LogLevel, LogLine, } from './log-compressor';
|
|
13
13
|
export { crushJson, computeKSplit, DEFAULT_JSON_CONFIG, JsonCrusherConfig } from './json-crusher';
|
|
14
|
+
export { crushCode, detectCodeLanguage, looksLikeCode, DEFAULT_CODE_CONFIG, CodeCompressorConfig, CodeLanguage, } from './code-compressor';
|
|
14
15
|
export { classifyArray, detectErrorItems, detectRareStatusValues, detectSequentialPattern, detectStructuralOutliers, ArrayType, JsonValue, } from './json-detectors';
|
|
15
16
|
export { computeOptimalK, computeUniqueBigramCurve, findKnee } from './adaptive-sizer';
|
|
16
17
|
export { ERROR_KEYWORDS, JSON_ERROR_KEYWORDS, containsKeyword, containsAnyKeyword, classifyImportance, } from './crush-keywords';
|
package/dist/crush/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* String in -> { output, stats } out. Zero deps, no I/O.
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.classifyImportance = exports.containsAnyKeyword = exports.containsKeyword = exports.JSON_ERROR_KEYWORDS = exports.ERROR_KEYWORDS = exports.findKnee = exports.computeUniqueBigramCurve = exports.computeOptimalK = exports.detectStructuralOutliers = exports.detectSequentialPattern = exports.detectRareStatusValues = exports.detectErrorItems = exports.classifyArray = exports.DEFAULT_JSON_CONFIG = exports.computeKSplit = exports.crushJson = exports.DEFAULT_LOG_CONFIG = exports.normalizeForDedupe = exports.parseLogLines = exports.isSummaryLine = exports.classifyLevel = exports.detectFormat = exports.crushLog = exports.DEFAULT_SEARCH_CONFIG = exports.parseMatchLine = exports.crushSearch = exports.makePassthrough = exports.estimateTokens = void 0;
|
|
12
|
+
exports.classifyImportance = exports.containsAnyKeyword = exports.containsKeyword = exports.JSON_ERROR_KEYWORDS = exports.ERROR_KEYWORDS = exports.findKnee = exports.computeUniqueBigramCurve = exports.computeOptimalK = exports.detectStructuralOutliers = exports.detectSequentialPattern = exports.detectRareStatusValues = exports.detectErrorItems = exports.classifyArray = exports.DEFAULT_CODE_CONFIG = exports.looksLikeCode = exports.detectCodeLanguage = exports.crushCode = exports.DEFAULT_JSON_CONFIG = exports.computeKSplit = exports.crushJson = exports.DEFAULT_LOG_CONFIG = exports.normalizeForDedupe = exports.parseLogLines = exports.isSummaryLine = exports.classifyLevel = exports.detectFormat = exports.crushLog = exports.DEFAULT_SEARCH_CONFIG = exports.parseMatchLine = exports.crushSearch = exports.makePassthrough = exports.estimateTokens = void 0;
|
|
13
13
|
var crush_types_1 = require("./crush-types");
|
|
14
14
|
Object.defineProperty(exports, "estimateTokens", { enumerable: true, get: function () { return crush_types_1.estimateTokens; } });
|
|
15
15
|
Object.defineProperty(exports, "makePassthrough", { enumerable: true, get: function () { return crush_types_1.makePassthrough; } });
|
|
@@ -29,6 +29,11 @@ var json_crusher_1 = require("./json-crusher");
|
|
|
29
29
|
Object.defineProperty(exports, "crushJson", { enumerable: true, get: function () { return json_crusher_1.crushJson; } });
|
|
30
30
|
Object.defineProperty(exports, "computeKSplit", { enumerable: true, get: function () { return json_crusher_1.computeKSplit; } });
|
|
31
31
|
Object.defineProperty(exports, "DEFAULT_JSON_CONFIG", { enumerable: true, get: function () { return json_crusher_1.DEFAULT_JSON_CONFIG; } });
|
|
32
|
+
var code_compressor_1 = require("./code-compressor");
|
|
33
|
+
Object.defineProperty(exports, "crushCode", { enumerable: true, get: function () { return code_compressor_1.crushCode; } });
|
|
34
|
+
Object.defineProperty(exports, "detectCodeLanguage", { enumerable: true, get: function () { return code_compressor_1.detectCodeLanguage; } });
|
|
35
|
+
Object.defineProperty(exports, "looksLikeCode", { enumerable: true, get: function () { return code_compressor_1.looksLikeCode; } });
|
|
36
|
+
Object.defineProperty(exports, "DEFAULT_CODE_CONFIG", { enumerable: true, get: function () { return code_compressor_1.DEFAULT_CODE_CONFIG; } });
|
|
32
37
|
var json_detectors_1 = require("./json-detectors");
|
|
33
38
|
Object.defineProperty(exports, "classifyArray", { enumerable: true, get: function () { return json_detectors_1.classifyArray; } });
|
|
34
39
|
Object.defineProperty(exports, "detectErrorItems", { enumerable: true, get: function () { return json_detectors_1.detectErrorItems; } });
|
package/dist/crush/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crush/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,6CAA0G;AAAvD,6GAAA,cAAc,OAAA;AAAE,8GAAA,eAAe,OAAA;AAClF,yDAAiH;AAAxG,gHAAA,WAAW,OAAA;AAAE,mHAAA,cAAc,OAAA;AAAE,0HAAA,qBAAqB,OAAA;AAC3D,mDAY0B;AAXxB,0GAAA,QAAQ,OAAA;AACR,8GAAA,YAAY,OAAA;AACZ,+GAAA,aAAa,OAAA;AACb,+GAAA,aAAa,OAAA;AACb,+GAAA,aAAa,OAAA;AACb,oHAAA,kBAAkB,OAAA;AAClB,oHAAA,kBAAkB,OAAA;AAMpB,+CAAkG;AAAzF,yGAAA,SAAS,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AACtD,mDAQ0B;AAPxB,+GAAA,aAAa,OAAA;AACb,kHAAA,gBAAgB,OAAA;AAChB,wHAAA,sBAAsB,OAAA;AACtB,yHAAA,uBAAuB,OAAA;AACvB,0HAAA,wBAAwB,OAAA;AAI1B,mDAAuF;AAA9E,iHAAA,eAAe,OAAA;AAAE,0HAAA,wBAAwB,OAAA;AAAE,0GAAA,QAAQ,OAAA;AAC5D,mDAM0B;AALxB,gHAAA,cAAc,OAAA;AACd,qHAAA,mBAAmB,OAAA;AACnB,iHAAA,eAAe,OAAA;AACf,oHAAA,kBAAkB,OAAA;AAClB,oHAAA,kBAAkB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crush/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,6CAA0G;AAAvD,6GAAA,cAAc,OAAA;AAAE,8GAAA,eAAe,OAAA;AAClF,yDAAiH;AAAxG,gHAAA,WAAW,OAAA;AAAE,mHAAA,cAAc,OAAA;AAAE,0HAAA,qBAAqB,OAAA;AAC3D,mDAY0B;AAXxB,0GAAA,QAAQ,OAAA;AACR,8GAAA,YAAY,OAAA;AACZ,+GAAA,aAAa,OAAA;AACb,+GAAA,aAAa,OAAA;AACb,+GAAA,aAAa,OAAA;AACb,oHAAA,kBAAkB,OAAA;AAClB,oHAAA,kBAAkB,OAAA;AAMpB,+CAAkG;AAAzF,yGAAA,SAAS,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,mHAAA,mBAAmB,OAAA;AACtD,qDAO2B;AANzB,4GAAA,SAAS,OAAA;AACT,qHAAA,kBAAkB,OAAA;AAClB,gHAAA,aAAa,OAAA;AACb,sHAAA,mBAAmB,OAAA;AAIrB,mDAQ0B;AAPxB,+GAAA,aAAa,OAAA;AACb,kHAAA,gBAAgB,OAAA;AAChB,wHAAA,sBAAsB,OAAA;AACtB,yHAAA,uBAAuB,OAAA;AACvB,0HAAA,wBAAwB,OAAA;AAI1B,mDAAuF;AAA9E,iHAAA,eAAe,OAAA;AAAE,0HAAA,wBAAwB,OAAA;AAAE,0GAAA,QAAQ,OAAA;AAC5D,mDAM0B;AALxB,gHAAA,cAAc,OAAA;AACd,qHAAA,mBAAmB,OAAA;AACnB,iHAAA,eAAe,OAAA;AACf,oHAAA,kBAAkB,OAAA;AAClB,oHAAA,kBAAkB,OAAA"}
|
package/dist/index.js
CHANGED
|
@@ -425,8 +425,7 @@ async function inbox(args) {
|
|
|
425
425
|
console.error('Usage: greprag inbox claim <front-desk-id> [--session <8-hex>]');
|
|
426
426
|
process.exit(1);
|
|
427
427
|
}
|
|
428
|
-
const claimant = getFlag(args, '--session')
|
|
429
|
-
|| process.env.CLAUDE_SESSION_ID || process.env.GREPRAG_SESSION_ID;
|
|
428
|
+
const claimant = getFlag(args, '--session') || (0, session_id_1.readSessionEnv)();
|
|
430
429
|
if (!claimant) {
|
|
431
430
|
console.error('No session id to claim as. Pass --session <8-hex>, or run inside a Claude Code session.');
|
|
432
431
|
process.exit(1);
|
|
@@ -459,7 +458,7 @@ async function inbox(args) {
|
|
|
459
458
|
// sessions' private session↔session lines are hidden. `--all` drops the scope
|
|
460
459
|
// for a tenant-wide audit peek across every session. An explicit `--session`
|
|
461
460
|
// always scopes to that id. adr: adr/address-grammar.md
|
|
462
|
-
const autoSession =
|
|
461
|
+
const autoSession = (0, session_id_1.readSessionEnv)();
|
|
463
462
|
const sessionId = frontDesk ? null : (explicitSession || (includeAll ? null : autoSession));
|
|
464
463
|
const scopedToSelf = !frontDesk && !explicitSession && !includeAll && !!autoSession;
|
|
465
464
|
const params = new URLSearchParams();
|
|
@@ -1074,14 +1073,11 @@ async function discord(args) {
|
|
|
1074
1073
|
}
|
|
1075
1074
|
// Resolve session id: --session <id> overrides CLAUDE_SESSION_ID env.
|
|
1076
1075
|
const sessionFlag = getFlag(args, '--session');
|
|
1077
|
-
const rawSession = sessionFlag
|
|
1078
|
-
|| process.env.CLAUDE_SESSION_ID
|
|
1079
|
-
|| process.env.GREPRAG_SESSION_ID
|
|
1080
|
-
|| '';
|
|
1076
|
+
const rawSession = sessionFlag || (0, session_id_1.readSessionEnv)() || '';
|
|
1081
1077
|
const sessionId = (0, session_id_1.truncateSessionId)(rawSession);
|
|
1082
1078
|
if (!sessionId) {
|
|
1083
1079
|
console.error('No session id available. Pass --session <8-hex>, or run inside a Claude Code session\n' +
|
|
1084
|
-
'(
|
|
1080
|
+
'(Claude Code sets CLAUDE_CODE_SESSION_ID).');
|
|
1085
1081
|
process.exit(1);
|
|
1086
1082
|
}
|
|
1087
1083
|
// Optional TTL.
|