@cerebriline/agents 4.100.250 → 4.100.252

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.
@@ -31,7 +31,7 @@
31
31
  * 2 of 5 healthy blocks from a successful run -- fine for offline labelling,
32
32
  * unusable for a guard that aborts live turns.
33
33
  */
34
- import type { ReasoningLoopDetectionConfig } from "@cerebriline/shared";
34
+ import type { AgentMessage, ReasoningLoopDetectionConfig } from "@cerebriline/shared";
35
35
  /**
36
36
  * The detector's thresholds. Defined in `@cerebriline/shared` so a host can set them
37
37
  * through `execution.reasoningLoopDetection` without depending on this package.
@@ -56,13 +56,41 @@ export interface ReasoningLoopVerdict {
56
56
  * tool-call loop detector follows.
57
57
  */
58
58
  export declare function describeReasoningLoop(v: ReasoningLoopVerdict): string;
59
+ /**
60
+ * What the model was handed in this conversation: the user's text and every
61
+ * tool result, as plain text. Not its own earlier turns -- a loop the model
62
+ * wrote last turn must not excuse the same loop this turn.
63
+ */
64
+ export declare function contentGivenToModel(messages: readonly AgentMessage[]): string;
65
+ export interface ReasoningLoopGuardOptions {
66
+ /**
67
+ * The content the model was given, asked for only when the guard is about
68
+ * to trip. Repetition that is already in it, at least as long, is the model
69
+ * restating what it read and not a collapse.
70
+ *
71
+ * The run it comes from (pandorum, session 91q5q, 2026-08-03): asked to
72
+ * embed a sound in a page, the model read `coin.mp3` as base64 and copied
73
+ * it into its reasoning. The file's padding is 484 `V` characters in a row,
74
+ * and thirteen `VVVV` is a phrase cycle. Four blocks of that session are
75
+ * that; a fifth ran on to 2,942 where the file has 484, and is the collapse
76
+ * the guard exists for. So the measure is length against the source, never
77
+ * "it appears in the source". Replayed over 22,252 stored reasoning blocks
78
+ * and 65,716 recorded ones, this excuses those four blocks and no other.
79
+ */
80
+ given?: () => string;
81
+ }
59
82
  export declare class ReasoningLoopGuard {
60
83
  private readonly cfg;
84
+ private readonly given;
61
85
  private chars;
62
86
  private lines;
87
+ /** Every completed line of the block, kept only when there is a source. */
88
+ private history;
63
89
  private pending;
64
90
  private verdict;
65
- constructor(config?: Partial<ReasoningLoopGuardConfig>);
91
+ private source;
92
+ private readonly sourceRuns;
93
+ constructor(config?: Partial<ReasoningLoopGuardConfig>, options?: ReasoningLoopGuardOptions);
66
94
  get tripped(): ReasoningLoopVerdict | null;
67
95
  /**
68
96
  * Feed one reasoning delta. Returns a verdict the first time the block is
@@ -70,6 +98,15 @@ export declare class ReasoningLoopGuard {
70
98
  * caller that keeps streaming does not act on it twice.
71
99
  */
72
100
  push(delta: string): ReasoningLoopVerdict | null;
101
+ /** The source, read once, and only when a verdict is about to be given. */
102
+ private readSource;
103
+ private remembered;
104
+ /** Longest run of `unit` back to back in the source, in repeats. */
105
+ private phraseRunInSource;
106
+ /** Longest run of this block of lines back to back in the source. */
107
+ private blockRunInSource;
108
+ /** Longest stretch of source lines drawn only from `distinct`. */
109
+ private stretchInSource;
73
110
  private detectLowUniqueness;
74
111
  private detectLineCycle;
75
112
  private detectPhraseCycle;
@@ -1 +1 @@
1
- {"version":3,"file":"reasoning-loop-guard.d.ts","sourceRoot":"","sources":["../src/reasoning-loop-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAElE;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,4BAA4B,CAAC;AAEpE,eAAO,MAAM,4BAA4B,EAAE,wBAU1C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAC1B,gBAAgB,GAChB,YAAY,GACZ,cAAc,CAAC;AAElB,MAAM,WAAW,oBAAoB;IACpC,IAAI,EAAE,iBAAiB,CAAC;IACxB,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM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100.250",
3
+ "version": "4.100.252",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/mann1x/cline.git",
@@ -9,8 +9,8 @@
9
9
  "main": "dist/index.js",
10
10
  "dependencies": {
11
11
  "nanoid": "^5.1.7",
12
- "@cerebriline/llms": "4.100.250",
13
- "@cerebriline/shared": "4.100.250"
12
+ "@cerebriline/llms": "4.100.252",
13
+ "@cerebriline/shared": "4.100.252"
14
14
  },
15
15
  "exports": {
16
16
  ".": {