Loop Detector
Path:
_archive/loom-stale-pre-sprint-snapshot/src/execution/loop-detector.tsRelative: loom-stale-pre-sprint-snapshot/src/execution/loop-detector.tsSubproject: _archiveCategory: archivedLines: 23Bytes: 687Imports: 0Exports: 1
Content Preview
- /**
- * H3.2 — Action-hash loop detector (P5).
- * sha256(tool + canonicalJSON(args)) over a sliding window of W steps;
- * the L-th identical hash inside the window halts the stage. No 40-step doom loops.
- */
- export class LoopDetector {
- private readonly window: string[] = [];
- constructor(
- private readonly w: number = 10,
- private readonly l: number = 3
- ) {}
- /** Record a hash; returns true when the loop threshold is hit (HALT_LOOP). */
- record(hash: string): boolean {
- this.win