Skip to content

Commit ad6252d

Browse files
Use interfaces for the new repetition detector types
Amp-Thread-ID: https://ampcode.com/threads/T-01a02c68-0d8d-777b-b717-81fb9a282023 Co-authored-by: Amp <amp@ampcode.com>
1 parent c50eadb commit ad6252d

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/subagent/repetition.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ export const DEFAULT_TEXT_FOLDED_REPETITION_CONFIG: RepetitionConfig = {
9999
maxFoldedPeriodChars: 16,
100100
};
101101

102-
export type RepetitionHit = {
102+
export interface RepetitionHit {
103103
/** The normalized window that repeats. */
104104
window: string;
105105
repeats: number;
106-
};
106+
}
107107

108108
// Whitespace runs collapse so wrapping and indentation differences do not
109109
// break periodicity. Digits are deliberately NOT normalized: tables, numbered
@@ -182,12 +182,12 @@ export function detectRepetition(
182182
}
183183

184184
/** Tunables for the contentless-growth guard. */
185-
export type ContentlessGrowthConfig = {
185+
export interface ContentlessGrowthConfig {
186186
/** Raw streamed chars per measurement window. */
187187
rawWindowChars: number;
188188
/** A window with fewer visible chars than this counts as contentless. */
189189
minVisibleChars: number;
190-
};
190+
}
191191

192192
// detectRepetition can never see a zero-width flood: normalize() strips
193193
// invisibles *before* the periodicity check, so thousands of U+200C/U+200D
@@ -203,12 +203,12 @@ export const DEFAULT_CONTENTLESS_GROWTH_CONFIG: ContentlessGrowthConfig = {
203203
minVisibleChars: 32,
204204
};
205205

206-
export type ContentlessGrowthState = {
206+
export interface ContentlessGrowthState {
207207
/** Raw chars accumulated in the current window. */
208208
rawChars: number;
209209
/** Visible (invisible-stripped, whitespace-removed) chars in the window. */
210210
visibleChars: number;
211-
};
211+
}
212212

213213
export const INITIAL_CONTENTLESS_GROWTH_STATE: ContentlessGrowthState = {
214214
rawChars: 0,

src/subagent/run.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,13 @@ function applyCapabilityFilter(tools: AgentTool[], capabilities: CapabilityFilte
176176
return tools.filter((t) => nameSet.has(t.definition.name));
177177
}
178178

179-
export type SubAgentRunController = {
179+
export interface SubAgentRunController {
180180
signal: AbortSignal;
181181
deadlineHit: () => boolean;
182182
/** Abort the run from inside (e.g. repetition detection), distinct from parent cancel and deadline. */
183183
abort: (reason: Error) => void;
184184
dispose: () => void;
185-
};
185+
}
186186

187187
/**
188188
* Combines an optional caller cancel signal with an optional opt-in wall-clock

0 commit comments

Comments
 (0)