import { type LoopRun } from './loop-run.js'; import type { Logger } from 'pino'; /** Prefix that marks a schedule prompt as a Loop wake-up (schedule.ts). */ export declare const LOOP_PROMPT_PREFIX = "loop:"; /** * True when a schedule prompt should wake a Loop instead of running a plain * job. Accepts an optional leading label (`loop:` / `loop:`+space) and is * case-insensitive. */ export declare function isLoopSchedulePrompt(prompt: string): boolean; /** Strip the `loop:` prefix, returning the mission text ('' when absent). */ export declare function loopMissionText(prompt: string): string; /** * Keyword-only headless probe for cron text (no process-global env). * Env AGIM_LOOP_HEADLESS is applied later on the persisted run when * `source === 'scheduled'` — see `isLoopHeadless` in loop-run.ts. */ export declare function isHeadlessLoop(missionText: string): boolean; export interface WakeLoopInput { platform: string; channelId: string; threadId: string; /** IM userId of the originator; used for focus/session attribution. */ userId: string; /** Mission text WITHOUT the `loop:` prefix (objective;退出:…). */ missionText: string; /** Optional abort (Job Board signal / wake timeout). */ signal?: AbortSignal; /** Optional logger override (tests / callers with their own context). */ logger?: Logger; } export type WakeLoopResult = { ok: true; run: LoopRun; started: boolean; skipped: boolean; resumed: boolean; } | { ok: false; error: string; }; /** * Create (or resume) a Loop for a thread from a plain-text mission and start * one parent turn so the Loop actually makes progress without a user message. * * Steps: * 1. Refuse empty / incomplete mission text (R6: do not auto-confirm). * 2. If a Loop is already active: * - parent turn in-flight or pending_user_confirm → skip * - aligning leftover → stop it, then start fresh * - planning / dispatching / verifying / reflecting → resume one turn * 3. startLoop({ source: 'scheduled' }); aligning → rollback + error. * 4. Ensure the sticky agent can parent the Loop (switch to Agim if not). * 5. callAgentWithHistory() with a timeout; the injected Loop snippet + * full Agim toolset drive planning → dispatch → verdict in-turn. * * Never throws; caller-facing errors are `{ ok:false }`. A run created in * THIS wake is rolled back on any failure after startLoop. */ export declare function wakeLoopForThread(input: WakeLoopInput): Promise; //# sourceMappingURL=loop-scheduler.d.ts.map