@sema-agent/core
Version:
Stateless, task-oriented AI agent core
27 lines (26 loc) • 1.77 kB
TypeScript
/**
* gh rate-limit hint (CC 2.1.198 parity).
*
* CC appends a one-shot <system-reminder> to a FOREGROUND Bash result when a `gh` invocation hits the
* GitHub API rate limit, so the model sleeps/schedules instead of hammering retries. The command gate,
* output gate and 60s throttle below are ported verbatim; a detached/background task is never hinted.
* Registered delta: CC's closing clause names its ScheduleWakeup tool; sema's wait primitive is the
* Monitor tool, so that clause is adapted — everything else is verbatim.
*/
/** Test seam: reset the process-wide throttle window (mirrors CC's module-level timestamp). */
export declare function resetGhRateLimitHintThrottleForTests(): void;
/**
* Returns the rate-limit reminder when `command` is a real gh call AND `output` shows a rate-limit
* error AND the 60s throttle window is open; otherwise undefined. Callers attach it to FOREGROUND
* Bash results only (CC gates on `backgroundTaskId` — a detached/background task is never hinted).
*
* `monitorToolActive`: the closing clause teaches the Monitor tool, but Monitor is mounted by the
* Runner (`backgroundTaskToolsActive`), not by the Bash tool — under handsReadOnly or a background-less
* env the taught tool is not on the roster. `false` drops exactly that clause (the sleep-until-reset
* advice stays); absent/`true` keeps the full wording, so an uninformed caller gets the byte-identical
* sentence rather than a silent rewrite.
*
* `mark`: the session's reminder provenance mark, stamped on the open tag by the mint home (body bytes
* unchanged; absent ⇒ bare tag).
*/
export declare function ghRateLimitHint(command: string, output: string, now?: number, monitorToolActive?: boolean, mark?: string): string | undefined;