fix(ralph-loop): scope completion detection to messages since loop start
This commit is contained in:
@@ -23,6 +23,7 @@ export function createLoopStateController(options: {
|
||||
loopOptions?: {
|
||||
maxIterations?: number
|
||||
completionPromise?: string
|
||||
messageCountAtStart?: number
|
||||
ultrawork?: boolean
|
||||
strategy?: "reset" | "continue"
|
||||
},
|
||||
@@ -34,6 +35,7 @@ export function createLoopStateController(options: {
|
||||
loopOptions?.maxIterations ??
|
||||
config?.default_max_iterations ??
|
||||
DEFAULT_MAX_ITERATIONS,
|
||||
message_count_at_start: loopOptions?.messageCountAtStart,
|
||||
completion_promise:
|
||||
loopOptions?.completionPromise ??
|
||||
DEFAULT_COMPLETION_PROMISE,
|
||||
@@ -93,5 +95,19 @@ export function createLoopStateController(options: {
|
||||
|
||||
return state
|
||||
},
|
||||
|
||||
setMessageCountAtStart(sessionID: string, messageCountAtStart: number): RalphLoopState | null {
|
||||
const state = readState(directory, stateDir)
|
||||
if (!state || state.session_id !== sessionID) {
|
||||
return null
|
||||
}
|
||||
|
||||
state.message_count_at_start = messageCountAtStart
|
||||
if (!writeState(directory, state, stateDir)) {
|
||||
return null
|
||||
}
|
||||
|
||||
return state
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user