UNPKG

aiwg

Version:

Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo

77 lines 2.78 kB
/** * OrchestratorPTY — Assess loop for Orchestrator-over-PTY * * Drives a PTY session via an LLM assessor using a read→assess→plan→act→wait * loop. The LLM observes the current screen state and decides whether to type, * wait, send a signal, or declare the mission complete. * * The LLMAssessor interface is generic — no Anthropic SDK is imported here — * which keeps this class fully testable with mock assessors. * * @issue #755 * @see src/serve/screen-reader.ts — ScreenReader / ScreenState * @see src/serve/pty-bridge.ts — PtyLike and session interfaces */ import type { ScreenReader } from './screen-reader.js'; export interface OrchestratorAction { action: 'type' | 'wait' | 'signal' | 'complete'; text?: string; signal?: string; reasoning: string; } export interface OrchestratorContext { /** What the orchestrator is trying to accomplish */ mission: string; /** Seed actions (usually empty; advanced use-cases may pre-populate) */ recentActions: OrchestratorAction[]; /** Hard cap on loop iterations. Default: 100 */ maxCycles?: number; } /** Minimal session interface for writing to PTY */ export interface OrchestratorSession { write(data: string): Promise<void>; signal(sig: string): Promise<void>; } /** Minimal LLM client interface for the assess step */ export interface LLMAssessor { assess(input: { screen_state: string; prompt_detected: boolean; prompt_text?: string; context: OrchestratorContext; history: OrchestratorAction[]; }): Promise<OrchestratorAction>; } export declare class OrchestratorPTY { private readonly session; private readonly screenReader; private readonly llm; private readonly context; private readonly maxCycles; private _history; private _done; private _paused; constructor(session: OrchestratorSession, screenReader: ScreenReader, llm: LLMAssessor, context: OrchestratorContext); /** * Run the assess loop until: * - the LLM returns `complete` * - `maxCycles` iterations are exhausted * - `pause()` is called */ run(): Promise<void>; /** Pause the loop at the next iteration boundary. */ pause(): void; /** * Clear the pause flag and re-enter the assess loop. * Resolves when the loop exits again (complete or paused again). */ resume(): Promise<void>; /** Returns a copy of the full action history. */ getHistory(): OrchestratorAction[]; /** Whether the orchestrator has reached a terminal `complete` state. */ get done(): boolean; /** Whether the orchestrator is currently paused. */ get paused(): boolean; private _execute; } //# sourceMappingURL=orchestrator-pty.d.ts.map