@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
50 lines • 3.2 kB
TypeScript
/**
* `schedule_prompt`: the model-callable surface for durable scheduled prompts.
*
* Unlike `/loop` (in-process timers, interactive only) this works in every run mode, including
* `--print`: the tool only WRITES a job file and returns. Firing happens later in a separate
* `senpi schedule run` process, so the job survives the scheduling process exiting.
*
* The TypeBox schema is a flat object with no root union (provider schema conversions rebuild tools
* from top-level `properties`); per-action requirements are enforced in `execute`.
*/
import { Type } from "typebox";
import type { ExtensionAPI } from "../../types.ts";
import type { LiveDelivery } from "./live-delivery.ts";
import { type ScheduledJobState } from "./store.ts";
import { type ScheduledJob } from "./types.ts";
export declare const SCHEDULE_PROMPT_TOOL = "schedule_prompt";
export declare const SCHEDULE_PROMPT_DESCRIPTION = "Schedule a prompt to run later in THIS session: a reminder, a follow-up check, or a recurring task. The job is stored on disk and survives this process exiting (works in --print/headless runs). When it is due, a `senpi schedule run` runner delivers it back to this session as a new message that starts with \"[Scheduled prompt <id> ...]\".\n\n- action \"create\": pass `prompt` (what to do or say when it fires, written as an instruction to your future self) and exactly one of `delaySeconds` or `at` (ISO 8601 date-time; include the UTC offset, e.g. 2026-09-28T09:00:00+09:00). Optional `everySeconds` (>= 60) repeats it.\n- action \"list\": this session's scheduled jobs.\n- action \"cancel\": pass `id`. A delivery that has already started cannot be recalled; nothing after it runs.\n\nIf this session is open in another senpi process when a job is due, the default runner waits until it closes. Limits: prompt 16384 bytes, 50 pending jobs per session.";
export declare const schedulePromptSchema: Type.TObject<{
action: Type.TUnion<[Type.TLiteral<"create">, Type.TLiteral<"list">, Type.TLiteral<"cancel">]>;
prompt: Type.TOptional<Type.TString>;
delaySeconds: Type.TOptional<Type.TInteger>;
at: Type.TOptional<Type.TString>;
everySeconds: Type.TOptional<Type.TInteger>;
id: Type.TOptional<Type.TString>;
}>;
export interface SchedulePromptParams {
readonly action: "create" | "list" | "cancel";
readonly prompt?: string;
readonly delaySeconds?: number;
readonly at?: string;
readonly everySeconds?: number;
readonly id?: string;
}
export interface SchedulePromptDetails {
readonly action: SchedulePromptParams["action"];
readonly jobs: readonly {
readonly state: ScheduledJobState;
readonly job: ScheduledJob;
}[];
/** create: whether a live `senpi schedule run --watch` runner will pick the job up. */
readonly runnerAvailable?: boolean;
/** cancel: an occurrence was already being delivered and may still complete. */
readonly inFlight?: boolean;
}
export interface SchedulePromptDeps {
readonly now: () => number;
readonly liveDelivery?: LiveDelivery;
}
export declare function registerScheduleTool(pi: ExtensionAPI, deps: SchedulePromptDeps): void;
//# sourceMappingURL=tool.d.ts.map