pty-manager 1.9.8 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.d.mts +6 -416
- package/dist/index.d.ts +6 -416
- package/dist/index.js +9 -405
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -401
- package/dist/index.mjs.map +1 -1
- package/dist/pty-worker.js +8 -46
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
PTY session manager with lifecycle management, pluggable adapters, and blocking prompt detection.
|
|
4
4
|
|
|
5
|
+
> Need crash-resilient sessions without native compilation? See [tmux-manager](../tmux-manager) — same adapter interface, backed by tmux instead of node-pty.
|
|
6
|
+
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
9
|
- **Multi-session management** - Spawn and manage multiple PTY sessions concurrently
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
+
import * as adapter_types from 'adapter-types';
|
|
3
|
+
import { SpawnConfig, CLIAdapter, AutoResponseRule, ToolRunningInfo, AdapterRegistry, LoginDetection, BlockingPromptDetection, ParsedOutput } from 'adapter-types';
|
|
4
|
+
export { AdapterFactoryConfig, AdapterRegistry, AutoResponseRule, BaseCLIAdapter, BlockingPromptDetection, BlockingPromptType, CLIAdapter, LoginDetection, MessageType, ParsedOutput, SpawnConfig, ToolRunningInfo, createAdapter } from 'adapter-types';
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
7
|
* Lazy runtime check for node-pty native addon.
|
|
@@ -25,70 +28,10 @@ import { EventEmitter } from 'events';
|
|
|
25
28
|
*/
|
|
26
29
|
declare function ensurePty(log?: (msg: string) => void): void;
|
|
27
30
|
|
|
28
|
-
/**
|
|
29
|
-
* PTY Agent Manager Types
|
|
30
|
-
*
|
|
31
|
-
* Standalone type definitions for PTY session and adapter management.
|
|
32
|
-
*/
|
|
33
31
|
/**
|
|
34
32
|
* Session lifecycle states
|
|
35
33
|
*/
|
|
36
34
|
type SessionStatus = 'pending' | 'starting' | 'authenticating' | 'ready' | 'busy' | 'stopping' | 'stopped' | 'error';
|
|
37
|
-
/**
|
|
38
|
-
* Message types for session communication
|
|
39
|
-
*/
|
|
40
|
-
type MessageType = 'task' | 'response' | 'question' | 'answer' | 'status' | 'error';
|
|
41
|
-
/**
|
|
42
|
-
* Configuration for spawning a PTY session
|
|
43
|
-
*/
|
|
44
|
-
interface SpawnConfig {
|
|
45
|
-
/** Optional unique ID (auto-generated if not provided) */
|
|
46
|
-
id?: string;
|
|
47
|
-
/** Human-readable name */
|
|
48
|
-
name: string;
|
|
49
|
-
/** Adapter type to use */
|
|
50
|
-
type: string;
|
|
51
|
-
/** Working directory */
|
|
52
|
-
workdir?: string;
|
|
53
|
-
/** Environment variables */
|
|
54
|
-
env?: Record<string, string>;
|
|
55
|
-
/** Initial terminal columns (default: 120) */
|
|
56
|
-
cols?: number;
|
|
57
|
-
/** Initial terminal rows (default: 40) */
|
|
58
|
-
rows?: number;
|
|
59
|
-
/** Session timeout in ms */
|
|
60
|
-
timeout?: number;
|
|
61
|
-
/** Custom adapter configuration */
|
|
62
|
-
adapterConfig?: Record<string, unknown>;
|
|
63
|
-
/** Per-session stall timeout in ms. Overrides PTYManagerConfig.stallTimeoutMs. */
|
|
64
|
-
stallTimeoutMs?: number;
|
|
65
|
-
/** Override adapter's readySettleMs for this session.
|
|
66
|
-
* Ms of output silence after detectReady match before emitting session_ready. */
|
|
67
|
-
readySettleMs?: number;
|
|
68
|
-
/** Enable verbose task-completion trace logs.
|
|
69
|
-
* Disabled by default; set true to enable. */
|
|
70
|
-
traceTaskCompletion?: boolean;
|
|
71
|
-
/** Override or disable specific adapter auto-response rules for this session.
|
|
72
|
-
* Keys are regex source strings (from rule.pattern.source).
|
|
73
|
-
* - null value disables that rule entirely
|
|
74
|
-
* - Object value merges fields into the matching adapter rule */
|
|
75
|
-
ruleOverrides?: Record<string, Partial<Omit<AutoResponseRule, 'pattern'>> | null>;
|
|
76
|
-
/** When true, adapter detectBlockingPrompt() results with suggestedResponse
|
|
77
|
-
* are emitted as autoResponded=false instead of being auto-responded.
|
|
78
|
-
* Auto-response rules (ruleOverrides) are unaffected. */
|
|
79
|
-
skipAdapterAutoResponse?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Whether to inherit the parent process environment variables.
|
|
82
|
-
* When `true` (default), `process.env` is spread as the base of the spawned
|
|
83
|
-
* process environment. When `false`, only `adapter.getEnv()` output and
|
|
84
|
-
* `config.env` are used — the caller is responsible for providing any
|
|
85
|
-
* necessary system vars (PATH, HOME, etc.) via `config.env`.
|
|
86
|
-
*
|
|
87
|
-
* Set to `false` for security-sensitive contexts where the host process has
|
|
88
|
-
* secrets that spawned agents should not access.
|
|
89
|
-
*/
|
|
90
|
-
inheritProcessEnv?: boolean;
|
|
91
|
-
}
|
|
92
35
|
/**
|
|
93
36
|
* Handle to a running session
|
|
94
37
|
*/
|
|
@@ -110,7 +53,7 @@ interface SessionMessage {
|
|
|
110
53
|
id: string;
|
|
111
54
|
sessionId: string;
|
|
112
55
|
direction: 'inbound' | 'outbound';
|
|
113
|
-
type: MessageType;
|
|
56
|
+
type: adapter_types.MessageType;
|
|
114
57
|
content: string;
|
|
115
58
|
metadata?: Record<string, unknown>;
|
|
116
59
|
timestamp: Date;
|
|
@@ -122,26 +65,6 @@ interface SessionFilter {
|
|
|
122
65
|
status?: SessionStatus | SessionStatus[];
|
|
123
66
|
type?: string | string[];
|
|
124
67
|
}
|
|
125
|
-
/**
|
|
126
|
-
* Parsed output from a CLI
|
|
127
|
-
*/
|
|
128
|
-
interface ParsedOutput {
|
|
129
|
-
type: MessageType;
|
|
130
|
-
content: string;
|
|
131
|
-
isComplete: boolean;
|
|
132
|
-
isQuestion: boolean;
|
|
133
|
-
metadata?: Record<string, unknown>;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Login/auth detection result
|
|
137
|
-
*/
|
|
138
|
-
interface LoginDetection {
|
|
139
|
-
required: boolean;
|
|
140
|
-
type?: 'api_key' | 'oauth' | 'browser' | 'device_code' | 'cli_auth';
|
|
141
|
-
url?: string;
|
|
142
|
-
deviceCode?: string;
|
|
143
|
-
instructions?: string;
|
|
144
|
-
}
|
|
145
68
|
/**
|
|
146
69
|
* Normalized authentication methods for runtime event consumers.
|
|
147
70
|
*/
|
|
@@ -156,57 +79,11 @@ interface AuthRequiredInfo {
|
|
|
156
79
|
instructions?: string;
|
|
157
80
|
promptSnippet?: string;
|
|
158
81
|
}
|
|
159
|
-
/**
|
|
160
|
-
* Types of blocking prompts that can occur
|
|
161
|
-
*/
|
|
162
|
-
type BlockingPromptType = 'login' | 'update' | 'config' | 'tos' | 'model_select' | 'project_select' | 'permission' | 'tool_wait' | 'unknown';
|
|
163
|
-
/**
|
|
164
|
-
* Blocking prompt detection result
|
|
165
|
-
*/
|
|
166
|
-
interface BlockingPromptDetection {
|
|
167
|
-
/** Whether a blocking prompt was detected */
|
|
168
|
-
detected: boolean;
|
|
169
|
-
/** Type of blocking prompt */
|
|
170
|
-
type?: BlockingPromptType;
|
|
171
|
-
/** The prompt text shown to the user */
|
|
172
|
-
prompt?: string;
|
|
173
|
-
/** Available options/choices if detected */
|
|
174
|
-
options?: string[];
|
|
175
|
-
/** Suggested auto-response (if safe to auto-respond) */
|
|
176
|
-
suggestedResponse?: string;
|
|
177
|
-
/** Whether it's safe to auto-respond without user confirmation */
|
|
178
|
-
canAutoRespond?: boolean;
|
|
179
|
-
/** Instructions for the user if manual intervention needed */
|
|
180
|
-
instructions?: string;
|
|
181
|
-
/** URL to open if browser action needed */
|
|
182
|
-
url?: string;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Auto-response rule for handling known blocking prompts
|
|
186
|
-
*/
|
|
187
|
-
interface AutoResponseRule {
|
|
188
|
-
/** Pattern to match in output */
|
|
189
|
-
pattern: RegExp;
|
|
190
|
-
/** Type of prompt this handles */
|
|
191
|
-
type: BlockingPromptType;
|
|
192
|
-
/** Response to send automatically */
|
|
193
|
-
response: string;
|
|
194
|
-
/** How to deliver the response: 'text' writes raw text + CR, 'keys' sends key sequences (default: 'text') */
|
|
195
|
-
responseType?: 'text' | 'keys';
|
|
196
|
-
/** Key names to send when responseType is 'keys' (e.g. ['down', 'enter']) */
|
|
197
|
-
keys?: string[];
|
|
198
|
-
/** Human-readable description of what this does */
|
|
199
|
-
description: string;
|
|
200
|
-
/** Whether this is safe to auto-respond (default: true) */
|
|
201
|
-
safe?: boolean;
|
|
202
|
-
/** Fire this rule at most once per session (prevents thrashing on TUI re-renders) */
|
|
203
|
-
once?: boolean;
|
|
204
|
-
}
|
|
205
82
|
/**
|
|
206
83
|
* Blocking prompt info for events
|
|
207
84
|
*/
|
|
208
85
|
interface BlockingPromptInfo {
|
|
209
|
-
type: BlockingPromptType | string;
|
|
86
|
+
type: adapter_types.BlockingPromptType | string;
|
|
210
87
|
prompt?: string;
|
|
211
88
|
options?: string[];
|
|
212
89
|
canAutoRespond: boolean;
|
|
@@ -224,17 +101,6 @@ interface StallClassification {
|
|
|
224
101
|
/** Suggested response to send (for waiting_for_input with auto-respond) */
|
|
225
102
|
suggestedResponse?: string;
|
|
226
103
|
}
|
|
227
|
-
/**
|
|
228
|
-
* Information about an external tool/process running within a session.
|
|
229
|
-
* Emitted when the adapter detects a tool is actively executing (e.g. browser,
|
|
230
|
-
* bash command, Node process). Suppresses stall detection while active.
|
|
231
|
-
*/
|
|
232
|
-
interface ToolRunningInfo {
|
|
233
|
-
/** Name of the tool (e.g. "Chrome", "bash", "node", "python") */
|
|
234
|
-
toolName: string;
|
|
235
|
-
/** Optional description of what the tool is doing */
|
|
236
|
-
description?: string;
|
|
237
|
-
}
|
|
238
104
|
/**
|
|
239
105
|
* Logger interface (bring your own logger)
|
|
240
106
|
*/
|
|
@@ -296,201 +162,6 @@ interface PTYManagerConfig {
|
|
|
296
162
|
*/
|
|
297
163
|
onStallClassify?: (sessionId: string, recentOutput: string, stallDurationMs: number) => Promise<StallClassification | null>;
|
|
298
164
|
}
|
|
299
|
-
/**
|
|
300
|
-
* Configuration for creating an adapter via factory
|
|
301
|
-
*/
|
|
302
|
-
interface AdapterFactoryConfig {
|
|
303
|
-
/** Command to execute */
|
|
304
|
-
command: string;
|
|
305
|
-
/** Default arguments */
|
|
306
|
-
args?: string[] | ((config: SpawnConfig) => string[]);
|
|
307
|
-
/** Environment variables */
|
|
308
|
-
env?: Record<string, string> | ((config: SpawnConfig) => Record<string, string>);
|
|
309
|
-
/** Login detection configuration */
|
|
310
|
-
loginDetection?: {
|
|
311
|
-
patterns: RegExp[];
|
|
312
|
-
extractUrl?: (output: string) => string | null;
|
|
313
|
-
extractInstructions?: (output: string) => string | null;
|
|
314
|
-
};
|
|
315
|
-
/** Blocking prompt configuration */
|
|
316
|
-
blockingPrompts?: Array<{
|
|
317
|
-
pattern: RegExp;
|
|
318
|
-
type: BlockingPromptType;
|
|
319
|
-
autoResponse?: string;
|
|
320
|
-
safe?: boolean;
|
|
321
|
-
description?: string;
|
|
322
|
-
}>;
|
|
323
|
-
/** Ready state indicators */
|
|
324
|
-
readyIndicators?: RegExp[];
|
|
325
|
-
/** Exit indicators */
|
|
326
|
-
exitIndicators?: Array<{
|
|
327
|
-
pattern: RegExp;
|
|
328
|
-
codeExtractor?: (match: RegExpMatchArray) => number;
|
|
329
|
-
}>;
|
|
330
|
-
/** Output parser */
|
|
331
|
-
parseOutput?: (output: string) => ParsedOutput | null;
|
|
332
|
-
/** Input formatter */
|
|
333
|
-
formatInput?: (message: string) => string;
|
|
334
|
-
/** Prompt pattern for detecting input readiness */
|
|
335
|
-
promptPattern?: RegExp;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* CLI Adapter Interface
|
|
340
|
-
*
|
|
341
|
-
* Defines how to interact with different CLI tools via PTY.
|
|
342
|
-
*/
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Interface that CLI adapters must implement
|
|
346
|
-
*/
|
|
347
|
-
interface CLIAdapter {
|
|
348
|
-
/** Adapter type identifier */
|
|
349
|
-
readonly adapterType: string;
|
|
350
|
-
/** Display name for the CLI */
|
|
351
|
-
readonly displayName: string;
|
|
352
|
-
/**
|
|
353
|
-
* Auto-response rules for handling known blocking prompts.
|
|
354
|
-
* These are applied automatically during startup and execution.
|
|
355
|
-
*/
|
|
356
|
-
readonly autoResponseRules?: AutoResponseRule[];
|
|
357
|
-
/**
|
|
358
|
-
* Whether this CLI uses TUI menus that require arrow-key navigation.
|
|
359
|
-
* When true, auto-response rules without an explicit responseType
|
|
360
|
-
* default to sending Enter via sendKeys instead of writeRaw.
|
|
361
|
-
*/
|
|
362
|
-
readonly usesTuiMenus?: boolean;
|
|
363
|
-
/**
|
|
364
|
-
* Get the CLI command to execute
|
|
365
|
-
*/
|
|
366
|
-
getCommand(): string;
|
|
367
|
-
/**
|
|
368
|
-
* Get command arguments
|
|
369
|
-
*/
|
|
370
|
-
getArgs(config: SpawnConfig): string[];
|
|
371
|
-
/**
|
|
372
|
-
* Get environment variables needed
|
|
373
|
-
*/
|
|
374
|
-
getEnv(config: SpawnConfig): Record<string, string>;
|
|
375
|
-
/**
|
|
376
|
-
* Detect if output indicates login is required
|
|
377
|
-
* @deprecated Use detectBlockingPrompt() instead for comprehensive detection
|
|
378
|
-
*/
|
|
379
|
-
detectLogin(output: string): LoginDetection;
|
|
380
|
-
/**
|
|
381
|
-
* Detect any blocking prompt that requires user input or auto-response.
|
|
382
|
-
*/
|
|
383
|
-
detectBlockingPrompt?(output: string): BlockingPromptDetection;
|
|
384
|
-
/**
|
|
385
|
-
* Detect if CLI is ready to receive input
|
|
386
|
-
*/
|
|
387
|
-
detectReady(output: string): boolean;
|
|
388
|
-
/**
|
|
389
|
-
* Detect if CLI has exited or crashed
|
|
390
|
-
*/
|
|
391
|
-
detectExit(output: string): {
|
|
392
|
-
exited: boolean;
|
|
393
|
-
code?: number;
|
|
394
|
-
error?: string;
|
|
395
|
-
};
|
|
396
|
-
/**
|
|
397
|
-
* Parse structured response from output buffer
|
|
398
|
-
* Returns null if output is incomplete
|
|
399
|
-
*/
|
|
400
|
-
parseOutput(output: string): ParsedOutput | null;
|
|
401
|
-
/**
|
|
402
|
-
* Format a message/task for this CLI
|
|
403
|
-
*/
|
|
404
|
-
formatInput(message: string): string;
|
|
405
|
-
/**
|
|
406
|
-
* Get prompt pattern to detect when CLI is waiting for input
|
|
407
|
-
*/
|
|
408
|
-
getPromptPattern(): RegExp;
|
|
409
|
-
/**
|
|
410
|
-
* Optional: Detect if the CLI has completed a task and returned to its idle prompt.
|
|
411
|
-
* More specific than detectReady — matches high-confidence completion indicators
|
|
412
|
-
* (e.g. duration summaries, explicit "done" messages) alongside the idle prompt.
|
|
413
|
-
*
|
|
414
|
-
* Used as a fast-path in stall detection to avoid expensive LLM classifier calls.
|
|
415
|
-
* If not implemented, the stall classifier is used as the fallback.
|
|
416
|
-
*/
|
|
417
|
-
detectTaskComplete?(output: string): boolean;
|
|
418
|
-
/**
|
|
419
|
-
* Optional: Validate that the CLI is installed and accessible
|
|
420
|
-
*/
|
|
421
|
-
validateInstallation?(): Promise<{
|
|
422
|
-
installed: boolean;
|
|
423
|
-
version?: string;
|
|
424
|
-
error?: string;
|
|
425
|
-
}>;
|
|
426
|
-
/** Ms of output silence after detectReady match before emitting session_ready (default: 100) */
|
|
427
|
-
readonly readySettleMs?: number;
|
|
428
|
-
/**
|
|
429
|
-
* Optional: Detect if the CLI is actively loading/processing (thinking spinner,
|
|
430
|
-
* file reading, model streaming, etc.). When true, stall detection is suppressed
|
|
431
|
-
* because the agent is provably working — just not producing new visible text.
|
|
432
|
-
*
|
|
433
|
-
* Patterns should match active loading indicators like "esc to interrupt",
|
|
434
|
-
* "Reading N files", "Waiting for LLM", etc.
|
|
435
|
-
*/
|
|
436
|
-
detectLoading?(output: string): boolean;
|
|
437
|
-
/**
|
|
438
|
-
* Optional: Detect if an external tool/process is currently running within
|
|
439
|
-
* the session (e.g. browser, bash command, Node server, Python script).
|
|
440
|
-
*
|
|
441
|
-
* When a tool is detected, stall detection is suppressed (the agent is
|
|
442
|
-
* working, just through an external process) and a `tool_running` event
|
|
443
|
-
* is emitted so the UI can display the active tool.
|
|
444
|
-
*
|
|
445
|
-
* Return null when no tool is detected.
|
|
446
|
-
*/
|
|
447
|
-
detectToolRunning?(output: string): ToolRunningInfo | null;
|
|
448
|
-
/**
|
|
449
|
-
* Optional: Get health check command
|
|
450
|
-
*/
|
|
451
|
-
getHealthCheckCommand?(): string;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* Adapter Registry
|
|
456
|
-
*
|
|
457
|
-
* Registry for managing CLI adapters.
|
|
458
|
-
*/
|
|
459
|
-
|
|
460
|
-
/**
|
|
461
|
-
* Registry of available CLI adapters
|
|
462
|
-
*/
|
|
463
|
-
declare class AdapterRegistry {
|
|
464
|
-
private adapters;
|
|
465
|
-
/**
|
|
466
|
-
* Register an adapter
|
|
467
|
-
*/
|
|
468
|
-
register(adapter: CLIAdapter): void;
|
|
469
|
-
/**
|
|
470
|
-
* Get adapter for type
|
|
471
|
-
*/
|
|
472
|
-
get(adapterType: string): CLIAdapter | undefined;
|
|
473
|
-
/**
|
|
474
|
-
* Check if adapter exists for type
|
|
475
|
-
*/
|
|
476
|
-
has(adapterType: string): boolean;
|
|
477
|
-
/**
|
|
478
|
-
* Unregister an adapter
|
|
479
|
-
*/
|
|
480
|
-
unregister(adapterType: string): boolean;
|
|
481
|
-
/**
|
|
482
|
-
* List all registered adapter types
|
|
483
|
-
*/
|
|
484
|
-
list(): string[];
|
|
485
|
-
/**
|
|
486
|
-
* Get all adapters
|
|
487
|
-
*/
|
|
488
|
-
all(): CLIAdapter[];
|
|
489
|
-
/**
|
|
490
|
-
* Clear all adapters
|
|
491
|
-
*/
|
|
492
|
-
clear(): void;
|
|
493
|
-
}
|
|
494
165
|
|
|
495
166
|
/**
|
|
496
167
|
* PTY Session
|
|
@@ -972,87 +643,6 @@ declare function extractTaskCompletionTraceRecords(entries: Array<string | Recor
|
|
|
972
643
|
*/
|
|
973
644
|
declare function buildTaskCompletionTimeline(records: TaskCompletionTraceRecord[], options?: BuildTimelineOptions): TaskCompletionTimelineResult;
|
|
974
645
|
|
|
975
|
-
/**
|
|
976
|
-
* Base CLI Adapter
|
|
977
|
-
*
|
|
978
|
-
* Abstract base class with common functionality for CLI adapters.
|
|
979
|
-
*/
|
|
980
|
-
|
|
981
|
-
/**
|
|
982
|
-
* Abstract base class for CLI adapters with common functionality
|
|
983
|
-
*/
|
|
984
|
-
declare abstract class BaseCLIAdapter implements CLIAdapter {
|
|
985
|
-
abstract readonly adapterType: string;
|
|
986
|
-
abstract readonly displayName: string;
|
|
987
|
-
/**
|
|
988
|
-
* Auto-response rules for handling known blocking prompts.
|
|
989
|
-
* Subclasses should override this to add CLI-specific rules.
|
|
990
|
-
*/
|
|
991
|
-
readonly autoResponseRules: AutoResponseRule[];
|
|
992
|
-
/**
|
|
993
|
-
* Whether this CLI uses TUI menus requiring arrow-key navigation.
|
|
994
|
-
* Defaults to false; coding agent adapters override to true.
|
|
995
|
-
*/
|
|
996
|
-
readonly usesTuiMenus: boolean;
|
|
997
|
-
abstract getCommand(): string;
|
|
998
|
-
abstract getArgs(config: SpawnConfig): string[];
|
|
999
|
-
abstract getEnv(config: SpawnConfig): Record<string, string>;
|
|
1000
|
-
abstract detectLogin(output: string): LoginDetection;
|
|
1001
|
-
abstract detectReady(output: string): boolean;
|
|
1002
|
-
abstract parseOutput(output: string): ParsedOutput | null;
|
|
1003
|
-
abstract getPromptPattern(): RegExp;
|
|
1004
|
-
/**
|
|
1005
|
-
* Default exit detection - look for common exit patterns
|
|
1006
|
-
*/
|
|
1007
|
-
detectExit(output: string): {
|
|
1008
|
-
exited: boolean;
|
|
1009
|
-
code?: number;
|
|
1010
|
-
error?: string;
|
|
1011
|
-
};
|
|
1012
|
-
/**
|
|
1013
|
-
* Default blocking prompt detection - looks for common prompt patterns.
|
|
1014
|
-
* Subclasses should override for CLI-specific detection.
|
|
1015
|
-
*/
|
|
1016
|
-
detectBlockingPrompt(output: string): BlockingPromptDetection;
|
|
1017
|
-
/**
|
|
1018
|
-
* Default task completion detection — delegates to detectReady().
|
|
1019
|
-
* Subclasses should override to match high-confidence completion patterns
|
|
1020
|
-
* (e.g. duration summaries) that short-circuit the LLM stall classifier.
|
|
1021
|
-
*/
|
|
1022
|
-
detectTaskComplete(output: string): boolean;
|
|
1023
|
-
/**
|
|
1024
|
-
* Default input formatting - just return as-is
|
|
1025
|
-
*/
|
|
1026
|
-
formatInput(message: string): string;
|
|
1027
|
-
/**
|
|
1028
|
-
* Validate CLI installation by running --version or --help
|
|
1029
|
-
*/
|
|
1030
|
-
validateInstallation(): Promise<{
|
|
1031
|
-
installed: boolean;
|
|
1032
|
-
version?: string;
|
|
1033
|
-
error?: string;
|
|
1034
|
-
}>;
|
|
1035
|
-
/**
|
|
1036
|
-
* Helper to check if output contains a question
|
|
1037
|
-
*/
|
|
1038
|
-
protected containsQuestion(output: string): boolean;
|
|
1039
|
-
/**
|
|
1040
|
-
* Helper to strip ANSI escape codes from output
|
|
1041
|
-
*/
|
|
1042
|
-
protected stripAnsi(str: string): string;
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
/**
|
|
1046
|
-
* Adapter Factory
|
|
1047
|
-
*
|
|
1048
|
-
* Factory function for creating CLI adapters from configuration.
|
|
1049
|
-
*/
|
|
1050
|
-
|
|
1051
|
-
/**
|
|
1052
|
-
* Creates a CLI adapter from configuration
|
|
1053
|
-
*/
|
|
1054
|
-
declare function createAdapter(config: AdapterFactoryConfig): CLIAdapter;
|
|
1055
|
-
|
|
1056
646
|
/**
|
|
1057
647
|
* Shell Adapter
|
|
1058
648
|
*
|
|
@@ -1276,4 +866,4 @@ declare function isBun(): boolean;
|
|
|
1276
866
|
*/
|
|
1277
867
|
declare function createPTYManager(options?: BunPTYManagerOptions): BunCompatiblePTYManager;
|
|
1278
868
|
|
|
1279
|
-
export { type
|
|
869
|
+
export { type AuthRequiredInfo, type AuthRequiredMethod, type BlockingPromptInfo, type BuildTimelineOptions, BunCompatiblePTYManager, type BunPTYManagerOptions, type LogOptions, type Logger, PTYManager, type PTYManagerConfig, type PTYManagerEvents, PTYSession, type PTYSessionEvents, SPECIAL_KEYS, type SessionFilter, type SessionHandle, type SessionMessage, type SessionStatus, ShellAdapter, type ShellAdapterOptions, type StallClassification, type StopOptions, type TaskCompletionTimelineResult, type TaskCompletionTimelineStep, type TaskCompletionTraceRecord, type TaskCompletionTurnTimeline, type TerminalAttachment, type WorkerSessionHandle, buildTaskCompletionTimeline, createPTYManager, ensurePty, extractTaskCompletionTraceRecords, isBun };
|