mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-19 14:31:50 +02:00
feat(gateguard): improve first-touch signal quality and session efficiency
- Ask class-specific first-touch questions (instruction, test, prose, config, code); code questions are unchanged. - Credit a completed Glob/Grep/LS or shell search from the current human turn that covered the target; Read and exclusion globs never count. - Collapse same-class new-file creations in one directory within a turn. - Add opt-in GATEGUARD_FACT_FORCE_MAX_DENIALS session cap (from #2755). - Always gate sensitive targets, judged on lexical and real paths. - Canonicalize checked-path keys. Closes #2608 Co-authored-by: SulimanAbdulrazzaq <suliman9000a@gmail.com>
This commit is contained in:
co-authored by
SulimanAbdulrazzaq
parent
c70874fae9
commit
e98a9da288
@@ -18,6 +18,8 @@ const {
|
||||
DEFAULT_CONTEXT_THRESHOLD_STANDARD,
|
||||
DEFAULT_CONTEXT_THRESHOLD_LARGE,
|
||||
DEFAULT_CONTEXT_INTERVAL_TOKENS,
|
||||
DEFAULT_TRANSCRIPT_TAIL_BYTES,
|
||||
readFileTail,
|
||||
readLatestContextTokens,
|
||||
resolveContextWindowTokens,
|
||||
resolveContextThreshold,
|
||||
@@ -323,6 +325,20 @@ test('returns -1 for non-finite token counts', () => {
|
||||
assert.strictEqual(computeContextBucket(NaN, 160000, 60000), -1);
|
||||
});
|
||||
|
||||
// ── readFileTail ──
|
||||
console.log('\nreadFileTail:');
|
||||
|
||||
test('is exported and returns the trailing bytes with a truncation flag', () => {
|
||||
assert.strictEqual(typeof readFileTail, 'function');
|
||||
assert.strictEqual(DEFAULT_TRANSCRIPT_TAIL_BYTES, 256 * 1024);
|
||||
const file = tracked(writeTranscript(['first-line', 'second', 'third']));
|
||||
const whole = readFileTail(file, 1024);
|
||||
assert.deepStrictEqual(whole, { text: 'first-line\nsecond\nthird\n', truncated: false });
|
||||
const tail = readFileTail(file, 6);
|
||||
assert.deepStrictEqual(tail, { text: 'third\n', truncated: true });
|
||||
assert.strictEqual(readFileTail(path.join(os.tmpdir(), `missing-${process.pid}.jsonl`), 10), null);
|
||||
});
|
||||
|
||||
// ── formatWindowLabel ──
|
||||
console.log('\nformatWindowLabel:');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user