Skip to content

Cassiiopeia/projectops / skills/pro-image

pro-image

Verified

Make image assets (backgrounds, characters, icons, illustrations, items) that fit the project's own style: you write the prompt from a per-repo harness, Codex or Antigravity draws it, the CLI fixes size and transparency. Use for 'make an image', 'draw', 'generate an icon'.

scripts/pro_image/quota.py

View on GitHub
"""Tool quota detection: run log + tool conversation log > quota exhausted or not, time until reset
Separates per-minute limits (retry shortly) from weekly exhaustion (move to the next tool)
"""
from __future__ import annotations

import re
from pathlib import Path

from . import providers

QUOTA_MARKERS = ("429", "RESOURCE_EXHAUSTED", "QUOTA_EXHAUSTED", "Too Many Requests")
# Form "reset after 166h53m17s"
RESET_PATTERN = re.compile(r"reset after ((?:\d+h)?(?:\d+m)?(?:\d+s)?)")
# If more than this remains, go to the next tool instead of retrying (seconds)
WAIT_THRESHOLD_SECONDS = 3600
# Tail length to read from the conversation log (characters)
LOG_TAIL_CHARACTERS = 20000


def _seconds(text: str) -> int:
    hours = re.search(r"(\d+)h", text)
    minutes = re.search(r"(\d+)m", text)
    seconds = re.search(r"(\d+)s", text)
    return sum(int(match.group(1)) * unit for match, unit in ((hours, 3600), (minutes, 60), (seconds, 1)) if match)


def diagnose(definition: dict, run_log_text: str, started_at: float) -> dict | None:
    """{is_quota, reset_in_seconds, reset_in} when quota is exhausted, None if no trace"""
    texts = [run_log_text]
    for path in providers.expand_globs(definition.get("failure_log_globs", [])):
        if path.stat().st_mtime >= started_at:
            texts.append(Path(path).read_text(encoding="utf-8", errors="replace")[-LOG_TAIL_CHARACTERS:])
    joined = "\n".join(texts)
    if not any(marker in joined for marker in QUOTA_MARKERS):
        return None
    resets = [_seconds(match) for match in RESET_PATTERN.findall(joined) if match]
    reset_in_seconds = max(resets) if resets else None
    return {"is_quota": True, "reset_in_seconds": reset_in_seconds,
            "reset_in": RESET_PATTERN.findall(joined)[-1] if resets else None}


def next_hint(diagnosis: dict | None) -> str:
    if diagnosis and diagnosis["reset_in_seconds"] and diagnosis["reset_in_seconds"] > WAIT_THRESHOLD_SECONDS:
        return (f"this tool's quota is used up for {diagnosis['reset_in']}: move to the next provider now "
                "and tell the user when it resets")
    return "free plans hit rate limits (429): retry once after 1-2 minutes, then the next provider"
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall