/** * Shared types and helpers for the PTY service layer. * * Extracted from pty-service.ts to keep that module lean and allow * other modules (pty-spawn, pty-init, actions) to import lightweight * type-only dependencies without pulling in the full PTYService class. * * @module services/pty-types */ import type { AdapterType, AgentCredentials, ApprovalPreset } from "coding-agent-adapters"; import type { SessionHandle } from "pty-manager"; export interface PTYServiceConfig { /** Maximum output lines to keep per session (default: 1000) */ maxLogLines?: number; /** Enable debug logging */ debug?: boolean; /** Auto-register coding agent adapters (default: true) */ registerCodingAdapters?: boolean; /** Maximum concurrent PTY sessions (default: 8) */ maxConcurrentSessions?: number; /** * Default approval preset for coding agents when not specified per-spawn. * Controls what tools the agent can use without asking for permission. * - "readonly" — Read-only tools only * - "standard" — Read + write, asks for shell/network * - "permissive" — Most tools auto-approved, asks for destructive ops * - "autonomous" — All tools auto-approved (yolo mode) * Default: "permissive" */ defaultApprovalPreset?: ApprovalPreset; } /** Available coding agent types */ export type CodingAgentType = "shell" | "pi" | AdapterType; /** True when the user requested the Pi coding agent. */ export declare const isPiAgentType: (input: string | undefined | null) => boolean; /** Normalize user-provided agent type string to a valid CodingAgentType */ export declare const normalizeAgentType: (input: string) => CodingAgentType; /** Build the initial shell command for Pi agent sessions. */ export declare const toPiCommand: (task: string | undefined) => string; export interface SpawnSessionOptions { /** Human-readable session name */ name: string; /** Adapter type: "shell" | "pi" | "claude" | "gemini" | "codex" | "aider" */ agentType: CodingAgentType; /** Working directory for the session */ workdir?: string; /** Initial command/task to send */ initialTask?: string; /** Environment variables */ env?: Record; /** Session metadata for tracking */ metadata?: Record; /** Credentials for coding agents (API keys, tokens) */ credentials?: AgentCredentials; /** Memory/instructions content to write to the agent's memory file before spawning */ memoryContent?: string; /** Approval preset controlling tool permissions (readonly, standard, permissive, autonomous) */ approvalPreset?: ApprovalPreset; /** Custom credentials for MCP servers or other integrations */ customCredentials?: Record; /** When true, adapter-level blocking prompts (tool permissions, file access) * are emitted with autoResponded=false instead of being auto-handled. * Used by the swarm coordinator to route decisions through its LLM loop. */ skipAdapterAutoResponse?: boolean; } export interface SessionInfo { id: string; name: string; agentType: string; workdir: string; status: SessionHandle["status"]; createdAt: Date; lastActivityAt: Date; metadata?: Record; } /** Known event names emitted by the PTY layer. */ export type SessionEventName = "ready" | "blocked" | "login_required" | "task_complete" | "tool_running" | "stopped" | "error" | "message"; type SessionEventCallback = (sessionId: string, event: string, data: unknown) => void; export type { SessionEventCallback }; //# sourceMappingURL=pty-types.d.ts.map