@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
52 lines • 2.68 kB
TypeScript
/**
* One session's job widgets: the jobs hosts registered, the request controller their spec requests
* share, and the refresh loop. New output schedules a refresh at most every
* {@link INGEST_MIN_INTERVAL_MS}; a 1 s unref'd ticker covers time-based work (a job turning old
* enough to author) and runs only while some job is still open. Every refresh offers the session's
* state to the publisher, which sends it only when it changed and at most once a second.
*/
import { type JobWidgetObfuscator } from "./author-redact.ts";
import type { JobWidgetAuthor } from "./author-types.ts";
import type { LineMatcher } from "./matcher.ts";
import { type JobWidgetBriefText, type JobWidgetJobInput } from "./registry-job.ts";
import type { JobWidgetRequestLimits } from "./request-policy.ts";
import type { JobWidgetState } from "./view-types.ts";
/** A host's hold on one registered job. Every call is a no-op once the job is forgotten. */
export interface JobWidgetSourceHandle {
/** New text arrived on one of the job's sources. */
notify(): void;
/** The job's own words changed (a task's `watch` hint or `stage`). */
update(brief: JobWidgetBriefText): void;
/** The job finished: its widget freezes as `done`. */
settle(): void;
/** The job is gone (evicted, or no longer a widget candidate): its entry leaves the state. */
dispose(): void;
}
export interface JobWidgetRegistryOptions {
readonly sessionId: string;
readonly author: JobWidgetAuthor;
readonly publish: (state: JobWidgetState) => void;
readonly limits?: Partial<JobWidgetRequestLimits>;
readonly obfuscate?: JobWidgetObfuscator;
readonly matcher?: LineMatcher;
}
export declare class JobWidgetRegistry {
#private;
readonly sessionId: string;
constructor(options: JobWidgetRegistryOptions);
add(input: JobWidgetJobInput): JobWidgetSourceHandle;
/** The session's state as clients receive it: every view redacted. */
state(): JobWidgetState;
snapshot(): JobWidgetState;
/**
* Applies settings re-read on a re-bind (a reload): the author's start delay from the next request
* on, the session's obfuscation for every state sent, every author request and every runtime started
* after it. A reader already running keeps its own stateful source redactor, so a key block it is
* inside is never split between two redactors.
*/
configure(options: Pick<JobWidgetRegistryOptions, "limits" | "obfuscate">): void;
/** Sends the current state on the next offer even if unchanged, for a listener that just bound. */
republish(): void;
dispose(): void;
}
//# sourceMappingURL=registry.d.ts.map