MCPcopy Create free account
hub / github.com/MatterAIOrg/OrbCode / shouldContinueAfterStop

Method shouldContinueAfterStop

src/core/agent.ts:432–443  ·  view source on GitHub ↗

Ask Stop hooks whether the turn should keep going. Forces at most one * continuation per turn (stop_hook_active) so a hook can't loop forever.

()

Source from the content-addressed store, hash-verified

430 /** Ask Stop hooks whether the turn should keep going. Forces at most one
431 * continuation per turn (stop_hook_active) so a hook can't loop forever. */
432 private async shouldContinueAfterStop(): Promise<boolean> {
433 if (!this.hooks.hasHooks("Stop")) return false
434 const result = await this.hooks.run("Stop", { stop_hook_active: this.stopHookActive })
435 if (result.stopAll) return false
436 if (result.blocked && !this.stopHookActive) {
437 this.stopHookActive = true
438 const reason = result.blockReason || "A Stop hook asked you to keep going."
439 this.messages.push({ role: "user", content: `System reminder (Stop hook): ${reason}` })
440 return true
441 }
442 return false
443 }
444
445 /** Track a fire-and-forget hook promise so it can be awaited on exit. */
446 private trackBackground(p: Promise<unknown>): void {

Callers 1

runTurnMethod · 0.95

Calls 2

hasHooksMethod · 0.80
runMethod · 0.80

Tested by

no test coverage detected