generated from coulomb/repo-seed
feat: WP-0001 foundation + WP-0002 core extensions
WP-0001 — Foundation & GAAF Baseline - SCOPE.md, ARCHITECTURE-LAYERS.md, contracts/ tree - .claude/rules/ stubs filled (architecture, stack, boundary) - 57 tests (pytest), pyproject.toml with ruff+mypy, CI workflow WP-0002 — Core Extensions (FR-4 + FR-3) - FR-4: BudgetTracker (thread-safe) + LLMBudgetExceededError + optional RunConfig.budget_tracker + enforcement in all adapters - FR-3: async_execute_prompt on LLMAdapter ABC (asyncio.to_thread fallback) + native asyncio.create_subprocess_exec in ClaudeCodeAdapter 81 tests passing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -64,6 +64,30 @@ class LLMTimeoutError(LLMError):
|
||||
pass
|
||||
|
||||
|
||||
class LLMBudgetExceededError(LLMError):
|
||||
"""Token budget cap exceeded during a call or delegation chain.
|
||||
|
||||
Attributes:
|
||||
total: The configured token cap.
|
||||
spent: Tokens already consumed before this call.
|
||||
requested: Tokens this call would have consumed.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
message: str,
|
||||
total: int = 0,
|
||||
spent: int = 0,
|
||||
requested: int = 0,
|
||||
cause: Optional[Exception] = None,
|
||||
context: Optional[Dict[str, Any]] = None,
|
||||
):
|
||||
super().__init__(message, cause=cause, context=context)
|
||||
self.total = total
|
||||
self.spent = spent
|
||||
self.requested = requested
|
||||
|
||||
|
||||
class LLMSubprocessError(LLMError):
|
||||
"""Claude Code CLI subprocess failed.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user