MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / parseAgentLoopPolicy

Function parseAgentLoopPolicy

src/core/bridge_coordinator.ts:14662–14676  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

14660}
14661
14662function parseAgentLoopPolicy(value: unknown): AgentJobLoopPolicy {
14663 const parsed = value && typeof value === 'object' && !Array.isArray(value)
14664 ? value as Record<string, unknown>
14665 : {};
14666 const defaults = buildDefaultAgentLoopPolicy();
14667 return {
14668 maxAttempts: normalizeAgentLoopBudget(parsed.maxAttempts ?? parsed.max_attempts, defaults.maxAttempts ?? null),
14669 maxTurns: normalizeAgentLoopBudget(parsed.maxTurns ?? parsed.max_turns, defaults.maxTurns ?? null),
14670 maxCycles: normalizeAgentLoopBudget(parsed.maxCycles ?? parsed.max_cycles, defaults.maxCycles ?? null),
14671 maxNoProgressCycles: normalizeAgentLoopBudget(
14672 parsed.maxNoProgressCycles ?? parsed.max_no_progress_cycles,
14673 defaults.maxNoProgressCycles ?? null,
14674 ),
14675 };
14676}
14677
14678function normalizeAgentLoopBudget(value: unknown, fallback: number | null): number | null {
14679 if (value === null || value === undefined || value === '') {

Callers 1

parseAgentDraftCandidateFunction · 0.85

Calls 2

normalizeAgentLoopBudgetFunction · 0.85

Tested by

no test coverage detected