claude-cli: pause until reset on session-limit; harden capability-set loader
- On a Claude Code session/usage limit ('resets 7:10pm'), _call_claude_cli now
pauses IN PLACE until the stated reset time + CLAUDE_CLI_LIMIT_BUFFER_SECONDS
(default 60s past), then retries — up to CLAUDE_CLI_LIMIT_MAX_WAITS windows.
Parses 12-hour reset times to their next occurrence; falls back to a fixed
wait when no time is present. Makes long unattended runs survive reset windows.
- load_library() reports invalid capability-set JSON as a clean SystemExit
(line number + reason) instead of a traceback; fixed a trailing-comma typo in
data/capability_sets/dx02.json.
- Docs: USAGE.md + .env.example document the claude-cli provider and its knobs.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -50,11 +50,16 @@ def active_set() -> str:
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def load_library() -> dict:
|
||||
if _active_set == "ALL":
|
||||
return json.loads((config.DATA_DIR / "capabilities.json").read_text())
|
||||
return json.loads(
|
||||
(config.DATA_DIR / "capability_sets" / f"{_active_set}.json").read_text()
|
||||
)
|
||||
path = (config.DATA_DIR / "capabilities.json" if _active_set == "ALL"
|
||||
else config.DATA_DIR / "capability_sets" / f"{_active_set}.json")
|
||||
try:
|
||||
lib = json.loads(path.read_text())
|
||||
except json.JSONDecodeError as e:
|
||||
raise SystemExit(f"Capability set '{_active_set}' has invalid JSON "
|
||||
f"({path.name}, line {e.lineno}): {e.msg}. Fix the file and re-run.")
|
||||
if not lib.get("capabilities"):
|
||||
raise SystemExit(f"Capability set '{_active_set}' ({path.name}) has no 'capabilities'.")
|
||||
return lib
|
||||
|
||||
|
||||
def capability_by_id(cap_id: str) -> dict | None:
|
||||
|
||||
Reference in New Issue
Block a user