@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
44 lines • 1.99 kB
TypeScript
import type { ExtensionContext } from "../../types.ts";
import type { Goal } from "./types.ts";
/** Footer live-elapsed refresh cadence while a goal is actively pursued. */
export declare const GOAL_ELAPSED_TICK_INTERVAL_MS = 1000;
/** Renders the goal footer segment for the current live elapsed second count. */
export type GoalElapsedRender = (ctx: ExtensionContext, goal: Goal, liveElapsedSeconds: number) => void;
export interface GoalElapsedTickerOptions {
readonly render: GoalElapsedRender;
/** Injectable clock for tests; defaults to Date.now. */
readonly now?: () => number;
}
/**
* Live elapsed seconds for an actively pursued goal: the committed
* `timeUsedSeconds` plus whole seconds since the current measurement window
* opened. Mirrors the rounding in `accountCurrentAgentTurn` so the footer never
* disagrees with what the next turn commits.
*/
export declare function goalLiveElapsedSeconds(goal: Goal, measuredFromMilliseconds: number, nowMilliseconds: number): number;
/**
* Drives a once-per-second footer refresh while a goal is active so the
* "Pursuing goal (…)" elapsed time advances live instead of freezing between
* usage-accounting checkpoints. The interval is unref'd so it never keeps the
* process alive.
*/
export declare class GoalElapsedTicker {
private readonly render;
private readonly now;
private intervalId;
private ctx;
private goal;
private measuredFromMilliseconds;
private lastRenderedElapsedLabel;
constructor(options: GoalElapsedTickerOptions);
get running(): boolean;
/**
* Point the ticker at the current goal and measurement window, render once
* immediately, and start the interval if it is not already running.
*/
sync(ctx: ExtensionContext, goal: Goal, measuredFromMilliseconds: number): void;
/** Stop the interval and drop the retained context/goal snapshot. */
stop(): void;
private tick;
}
//# sourceMappingURL=elapsed-ticker.d.ts.map