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
68 lines • 2.95 kB
TypeScript
/**
* OrchestratorAdapter — wires ScreenReader + OrchestratorPTY to live PTY sessions
*
* Provides factory functions that connect the orchestrator assess loop to a
* real PTY session from the WebSocket bridge:
*
* createScreenReaderFromSession — attach ScreenReader to a PtySession's output
* createSessionAdapter — implement OrchestratorSession over PtyLike
* attachOrchestrator — full attach: reader + adapter + orchestrator
*
* @issue #756
* @see src/serve/screen-reader.ts — ScreenReader / ScreenState
* @see src/serve/orchestrator-pty.ts — OrchestratorPTY / OrchestratorSession
* @see src/serve/pty-bridge.ts — PtySession / PtyLike
*/
import { ScreenReader } from './screen-reader.js';
import { OrchestratorPTY, type OrchestratorSession, type OrchestratorContext, type LLMAssessor } from './orchestrator-pty.js';
import type { PtySession } from './pty-bridge.js';
/**
* Creates a ScreenReader that consumes data from a PtySession's output.
*
* - Replays session.outputBuffer immediately so the reader has current screen
* state from the moment it is constructed.
* - If the session's PTY is live, registers an onData listener so subsequent
* output continues to flow into the reader.
*
* Callers are responsible for calling reader.dispose() when done.
*/
export declare function createScreenReaderFromSession(session: PtySession, opts?: {
rows?: number;
cols?: number;
}): ScreenReader;
/**
* Creates an OrchestratorSession adapter that writes to a PtySession's PTY stdin.
*
* Translates orchestrator write() and signal() calls into direct PTY operations.
* Rejects if the session's PTY is null (not yet spawned or already cleaned up).
*/
export declare function createSessionAdapter(session: PtySession): OrchestratorSession;
export interface AttachOrchestratorResult {
/** The orchestrator instance — call run() to start the assess loop */
orchestrator: OrchestratorPTY;
/** The ScreenReader feeding screen state to the orchestrator */
screenReader: ScreenReader;
/**
* Stop data flow to the ScreenReader and pause the orchestrator.
* Does NOT kill the underlying PTY session.
*/
detach: () => void;
}
/**
* Attaches an orchestrator to a running PTY session.
*
* Creates a ScreenReader (with outputBuffer replay), creates a session adapter,
* and wires them together in an OrchestratorPTY instance ready to call run() on.
*
* The returned detach() function stops data flow and pauses the orchestrator
* without killing the PTY. Re-attaching is supported by calling attachOrchestrator
* again on the same session — it will replay the updated outputBuffer.
*/
export declare function attachOrchestrator(opts: {
session: PtySession;
llm: LLMAssessor;
context: OrchestratorContext;
rows?: number;
cols?: number;
}): AttachOrchestratorResult;
//# sourceMappingURL=orchestrator-adapter.d.ts.map