@damiangilgonzalez/harness 1.3.11 → 1.3.12
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/manifest.json +1 -1
- package/package.json +1 -1
- package/targets/session-memory-core.mjs +8 -2
package/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -313,7 +313,13 @@ export function capture(input = {}) {
|
|
|
313
313
|
if (input.event === 'start' && !existing) return { record: null, path: null, notice: null, compactionHint: false };
|
|
314
314
|
|
|
315
315
|
const repo = snapshot(cwd, anchor.baselineHead);
|
|
316
|
-
|
|
316
|
+
// Compaction closes a context window, so the edit budget starts again from zero.
|
|
317
|
+
const previousEdits = input.event === 'compact' ? 0 : (existing?.editCount || 0);
|
|
318
|
+
const editCount = Math.max(0, previousEdits + (finiteOrNull(input.editDelta, true) || 0));
|
|
319
|
+
// Hint once per threshold crossed, and only on the edit that crosses it: re-emitting on
|
|
320
|
+
// every later event (Stop in particular) wakes the model again and loops.
|
|
321
|
+
const crossedThreshold = editCount > previousEdits
|
|
322
|
+
&& Math.floor(editCount / config.editThreshold) > Math.floor(previousEdits / config.editThreshold);
|
|
317
323
|
const baselineFiles = new Set(anchor.baselineFiles || []);
|
|
318
324
|
const newDirtyPath = repo.files.some((path) => !baselineFiles.has(path));
|
|
319
325
|
const baselineFingerprints = anchor.baselineFingerprints || {};
|
|
@@ -356,7 +362,7 @@ export function capture(input = {}) {
|
|
|
356
362
|
record,
|
|
357
363
|
path: recordPath,
|
|
358
364
|
notice: consumeNotice(store),
|
|
359
|
-
compactionHint: Boolean(config.compactionHint &&
|
|
365
|
+
compactionHint: Boolean(config.compactionHint && crossedThreshold),
|
|
360
366
|
};
|
|
361
367
|
}
|
|
362
368
|
|