pty-manager 1.2.13 → 1.2.15

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/dist/index.d.mts CHANGED
@@ -35,6 +35,8 @@ interface SpawnConfig {
35
35
  timeout?: number;
36
36
  /** Custom adapter configuration */
37
37
  adapterConfig?: Record<string, unknown>;
38
+ /** Per-session stall timeout in ms. Overrides PTYManagerConfig.stallTimeoutMs. */
39
+ stallTimeoutMs?: number;
38
40
  }
39
41
  /**
40
42
  * Handle to a running session
@@ -123,6 +125,10 @@ interface AutoResponseRule {
123
125
  type: BlockingPromptType;
124
126
  /** Response to send automatically */
125
127
  response: string;
128
+ /** How to deliver the response: 'text' writes raw text + CR, 'keys' sends key sequences (default: 'text') */
129
+ responseType?: 'text' | 'keys';
130
+ /** Key names to send when responseType is 'keys' (e.g. ['down', 'enter']) */
131
+ keys?: string[];
126
132
  /** Human-readable description of what this does */
127
133
  description: string;
128
134
  /** Whether this is safe to auto-respond (default: true) */
@@ -139,6 +145,17 @@ interface BlockingPromptInfo {
139
145
  instructions?: string;
140
146
  url?: string;
141
147
  }
148
+ /**
149
+ * Classification result from external stall analysis
150
+ */
151
+ interface StallClassification {
152
+ /** What the external classifier determined */
153
+ state: 'waiting_for_input' | 'still_working' | 'task_complete' | 'error';
154
+ /** Description of the detected prompt (for waiting_for_input) */
155
+ prompt?: string;
156
+ /** Suggested response to send (for waiting_for_input with auto-respond) */
157
+ suggestedResponse?: string;
158
+ }
142
159
  /**
143
160
  * Logger interface (bring your own logger)
144
161
  */
@@ -187,6 +204,18 @@ interface PTYManagerConfig {
187
204
  logger?: Logger;
188
205
  /** Maximum output log lines per session (default: 1000) */
189
206
  maxLogLines?: number;
207
+ /** Enable stall detection (default: false) */
208
+ stallDetectionEnabled?: boolean;
209
+ /** Default stall timeout in ms (default: 8000). Can be overridden per-session via SpawnConfig. */
210
+ stallTimeoutMs?: number;
211
+ /**
212
+ * External classification callback invoked when a stall is detected.
213
+ * Return null or { state: 'still_working' } to reset the timer.
214
+ * Return { state: 'waiting_for_input', suggestedResponse } to auto-respond.
215
+ * Return { state: 'task_complete' } to transition session to ready.
216
+ * Return { state: 'error' } to emit session_error.
217
+ */
218
+ onStallClassify?: (sessionId: string, recentOutput: string, stallDurationMs: number) => Promise<StallClassification | null>;
190
219
  }
191
220
  /**
192
221
  * Configuration for creating an adapter via factory
@@ -246,6 +275,12 @@ interface CLIAdapter {
246
275
  * These are applied automatically during startup and execution.
247
276
  */
248
277
  readonly autoResponseRules?: AutoResponseRule[];
278
+ /**
279
+ * Whether this CLI uses TUI menus that require arrow-key navigation.
280
+ * When true, auto-response rules without an explicit responseType
281
+ * default to sending Enter via sendKeys instead of writeRaw.
282
+ */
283
+ readonly usesTuiMenus?: boolean;
249
284
  /**
250
285
  * Get the CLI command to execute
251
286
  */
@@ -362,6 +397,7 @@ interface PTYSessionEvents {
362
397
  question: (question: string) => void;
363
398
  exit: (code: number) => void;
364
399
  error: (error: Error) => void;
400
+ stall_detected: (recentOutput: string, stallDurationMs: number) => void;
365
401
  }
366
402
  /**
367
403
  * Special key mappings to escape sequences
@@ -381,9 +417,14 @@ declare class PTYSession extends EventEmitter {
381
417
  private logger;
382
418
  private sessionRules;
383
419
  private _lastBlockingPromptHash;
420
+ private _stallTimer;
421
+ private _stallTimeoutMs;
422
+ private _stallDetectionEnabled;
423
+ private _lastStallHash;
424
+ private _stallStartedAt;
384
425
  readonly id: string;
385
426
  readonly config: SpawnConfig;
386
- constructor(adapter: CLIAdapter, config: SpawnConfig, logger?: Logger);
427
+ constructor(adapter: CLIAdapter, config: SpawnConfig, logger?: Logger, stallDetectionEnabled?: boolean, defaultStallTimeoutMs?: number);
387
428
  get status(): SessionStatus;
388
429
  get pid(): number | undefined;
389
430
  get startedAt(): Date | undefined;
@@ -410,6 +451,37 @@ declare class PTYSession extends EventEmitter {
410
451
  * Clear all session auto-response rules.
411
452
  */
412
453
  clearAutoResponseRules(): void;
454
+ /**
455
+ * Start or reset the stall detection timer.
456
+ * Only active when status is "busy" and stall detection is enabled.
457
+ */
458
+ private resetStallTimer;
459
+ /**
460
+ * Clear the stall detection timer.
461
+ */
462
+ private clearStallTimer;
463
+ /**
464
+ * Called when the stall timer fires (no output for stallTimeoutMs).
465
+ */
466
+ private onStallTimerFired;
467
+ /**
468
+ * Promise-based delay helper.
469
+ */
470
+ private delay;
471
+ /**
472
+ * Simple string hash for deduplication.
473
+ */
474
+ private simpleHash;
475
+ /**
476
+ * Strip ANSI codes for stall detection output.
477
+ * Replaces cursor-forward sequences with spaces first.
478
+ */
479
+ private stripAnsiForStall;
480
+ /**
481
+ * Handle external stall classification result.
482
+ * Called by the manager after onStallClassify resolves.
483
+ */
484
+ handleStallClassification(classification: StallClassification | null): void;
413
485
  /**
414
486
  * Start the PTY session
415
487
  */
@@ -465,6 +537,16 @@ declare class PTYSession extends EventEmitter {
465
537
  * @param keys - Key name(s) to send, e.g. "ctrl+c" or ["up", "up", "enter"]
466
538
  */
467
539
  sendKeys(keys: string | string[]): void;
540
+ /**
541
+ * Select a TUI menu option by index (0-based).
542
+ * Sends Down arrow `optionIndex` times, then Enter, with 50ms delays.
543
+ */
544
+ selectMenuOption(optionIndex: number): Promise<void>;
545
+ /**
546
+ * Send a sequence of keys with staggered timing.
547
+ * Each key is sent 50ms apart using setTimeout to keep the caller synchronous.
548
+ */
549
+ private sendKeySequence;
468
550
  /**
469
551
  * Paste text using bracketed paste mode
470
552
  *
@@ -510,6 +592,7 @@ interface PTYManagerEvents {
510
592
  blocking_prompt: (session: SessionHandle, promptInfo: BlockingPromptInfo, autoResponded: boolean) => void;
511
593
  message: (message: SessionMessage) => void;
512
594
  question: (session: SessionHandle, question: string) => void;
595
+ stall_detected: (session: SessionHandle, recentOutput: string, stallDurationMs: number) => void;
513
596
  }
514
597
  declare class PTYManager extends EventEmitter {
515
598
  private sessions;
@@ -517,6 +600,9 @@ declare class PTYManager extends EventEmitter {
517
600
  private maxLogLines;
518
601
  private logger;
519
602
  readonly adapters: AdapterRegistry;
603
+ private _stallDetectionEnabled;
604
+ private _stallTimeoutMs;
605
+ private _onStallClassify?;
520
606
  constructor(config?: PTYManagerConfig);
521
607
  /**
522
608
  * Register a CLI adapter
@@ -581,6 +667,11 @@ declare class PTYManager extends EventEmitter {
581
667
  * Get the underlying PTYSession (for advanced use)
582
668
  */
583
669
  getSession(sessionId: string): PTYSession | undefined;
670
+ /**
671
+ * Configure stall detection at runtime.
672
+ * Affects newly spawned sessions only — existing sessions keep their config.
673
+ */
674
+ configureStallDetection(enabled: boolean, timeoutMs?: number, classify?: (sessionId: string, recentOutput: string, stallDurationMs: number) => Promise<StallClassification | null>): void;
584
675
  /**
585
676
  * Add an auto-response rule to a session.
586
677
  * Session rules are checked before adapter rules.
@@ -622,6 +713,11 @@ declare abstract class BaseCLIAdapter implements CLIAdapter {
622
713
  * Subclasses should override this to add CLI-specific rules.
623
714
  */
624
715
  readonly autoResponseRules: AutoResponseRule[];
716
+ /**
717
+ * Whether this CLI uses TUI menus requiring arrow-key navigation.
718
+ * Defaults to false; coding agent adapters override to true.
719
+ */
720
+ readonly usesTuiMenus: boolean;
625
721
  abstract getCommand(): string;
626
722
  abstract getArgs(config: SpawnConfig): string[];
627
723
  abstract getEnv(config: SpawnConfig): Record<string, string>;
@@ -755,6 +851,15 @@ interface BunPTYManagerOptions {
755
851
  * Example: ['coding-agent-adapters']
756
852
  */
757
853
  adapterModules?: string[];
854
+ /** Enable stall detection (default: false) */
855
+ stallDetectionEnabled?: boolean;
856
+ /** Default stall timeout in ms (default: 8000) */
857
+ stallTimeoutMs?: number;
858
+ /**
859
+ * External classification callback invoked when a stall is detected.
860
+ * The worker emits stall_detected; this callback runs on the parent side.
861
+ */
862
+ onStallClassify?: (sessionId: string, recentOutput: string, stallDurationMs: number) => Promise<StallClassification | null>;
758
863
  }
759
864
  /**
760
865
  * PTY Manager that works with Bun and other non-Node runtimes
@@ -771,6 +876,9 @@ declare class BunCompatiblePTYManager extends EventEmitter {
771
876
  private workerPath;
772
877
  private env;
773
878
  private adapterModules;
879
+ private _stallDetectionEnabled;
880
+ private _stallTimeoutMs;
881
+ private _onStallClassify?;
774
882
  constructor(options?: BunPTYManagerOptions);
775
883
  private findWorkerPath;
776
884
  private startWorker;
@@ -847,6 +955,10 @@ declare class BunCompatiblePTYManager extends EventEmitter {
847
955
  * Get all auto-response rules for a session.
848
956
  */
849
957
  getAutoResponseRules(sessionId: string): Promise<AutoResponseRule[]>;
958
+ /**
959
+ * Select a TUI menu option by index (0-based) in a session.
960
+ */
961
+ selectMenuOption(id: string, optionIndex: number): Promise<void>;
850
962
  /**
851
963
  * Clear all auto-response rules for a session.
852
964
  */
@@ -869,4 +981,4 @@ declare function isBun(): boolean;
869
981
  */
870
982
  declare function createPTYManager(options?: BunPTYManagerOptions): BunCompatiblePTYManager;
871
983
 
872
- export { type AdapterFactoryConfig, AdapterRegistry, type AutoResponseRule, BaseCLIAdapter, type BlockingPromptDetection, type BlockingPromptInfo, type BlockingPromptType, BunCompatiblePTYManager, type BunPTYManagerOptions, type CLIAdapter, type LogOptions, type Logger, type LoginDetection, type MessageType, PTYManager, type PTYManagerConfig, type PTYManagerEvents, PTYSession, type PTYSessionEvents, type ParsedOutput, SPECIAL_KEYS, type SessionFilter, type SessionHandle, type SessionMessage, type SessionStatus, ShellAdapter, type ShellAdapterOptions, type SpawnConfig, type StopOptions, type TerminalAttachment, type WorkerSessionHandle, createAdapter, createPTYManager, isBun };
984
+ export { type AdapterFactoryConfig, AdapterRegistry, type AutoResponseRule, BaseCLIAdapter, type BlockingPromptDetection, type BlockingPromptInfo, type BlockingPromptType, BunCompatiblePTYManager, type BunPTYManagerOptions, type CLIAdapter, type LogOptions, type Logger, type LoginDetection, type MessageType, PTYManager, type PTYManagerConfig, type PTYManagerEvents, PTYSession, type PTYSessionEvents, type ParsedOutput, SPECIAL_KEYS, type SessionFilter, type SessionHandle, type SessionMessage, type SessionStatus, ShellAdapter, type ShellAdapterOptions, type SpawnConfig, type StallClassification, type StopOptions, type TerminalAttachment, type WorkerSessionHandle, createAdapter, createPTYManager, isBun };
package/dist/index.d.ts CHANGED
@@ -35,6 +35,8 @@ interface SpawnConfig {
35
35
  timeout?: number;
36
36
  /** Custom adapter configuration */
37
37
  adapterConfig?: Record<string, unknown>;
38
+ /** Per-session stall timeout in ms. Overrides PTYManagerConfig.stallTimeoutMs. */
39
+ stallTimeoutMs?: number;
38
40
  }
39
41
  /**
40
42
  * Handle to a running session
@@ -123,6 +125,10 @@ interface AutoResponseRule {
123
125
  type: BlockingPromptType;
124
126
  /** Response to send automatically */
125
127
  response: string;
128
+ /** How to deliver the response: 'text' writes raw text + CR, 'keys' sends key sequences (default: 'text') */
129
+ responseType?: 'text' | 'keys';
130
+ /** Key names to send when responseType is 'keys' (e.g. ['down', 'enter']) */
131
+ keys?: string[];
126
132
  /** Human-readable description of what this does */
127
133
  description: string;
128
134
  /** Whether this is safe to auto-respond (default: true) */
@@ -139,6 +145,17 @@ interface BlockingPromptInfo {
139
145
  instructions?: string;
140
146
  url?: string;
141
147
  }
148
+ /**
149
+ * Classification result from external stall analysis
150
+ */
151
+ interface StallClassification {
152
+ /** What the external classifier determined */
153
+ state: 'waiting_for_input' | 'still_working' | 'task_complete' | 'error';
154
+ /** Description of the detected prompt (for waiting_for_input) */
155
+ prompt?: string;
156
+ /** Suggested response to send (for waiting_for_input with auto-respond) */
157
+ suggestedResponse?: string;
158
+ }
142
159
  /**
143
160
  * Logger interface (bring your own logger)
144
161
  */
@@ -187,6 +204,18 @@ interface PTYManagerConfig {
187
204
  logger?: Logger;
188
205
  /** Maximum output log lines per session (default: 1000) */
189
206
  maxLogLines?: number;
207
+ /** Enable stall detection (default: false) */
208
+ stallDetectionEnabled?: boolean;
209
+ /** Default stall timeout in ms (default: 8000). Can be overridden per-session via SpawnConfig. */
210
+ stallTimeoutMs?: number;
211
+ /**
212
+ * External classification callback invoked when a stall is detected.
213
+ * Return null or { state: 'still_working' } to reset the timer.
214
+ * Return { state: 'waiting_for_input', suggestedResponse } to auto-respond.
215
+ * Return { state: 'task_complete' } to transition session to ready.
216
+ * Return { state: 'error' } to emit session_error.
217
+ */
218
+ onStallClassify?: (sessionId: string, recentOutput: string, stallDurationMs: number) => Promise<StallClassification | null>;
190
219
  }
191
220
  /**
192
221
  * Configuration for creating an adapter via factory
@@ -246,6 +275,12 @@ interface CLIAdapter {
246
275
  * These are applied automatically during startup and execution.
247
276
  */
248
277
  readonly autoResponseRules?: AutoResponseRule[];
278
+ /**
279
+ * Whether this CLI uses TUI menus that require arrow-key navigation.
280
+ * When true, auto-response rules without an explicit responseType
281
+ * default to sending Enter via sendKeys instead of writeRaw.
282
+ */
283
+ readonly usesTuiMenus?: boolean;
249
284
  /**
250
285
  * Get the CLI command to execute
251
286
  */
@@ -362,6 +397,7 @@ interface PTYSessionEvents {
362
397
  question: (question: string) => void;
363
398
  exit: (code: number) => void;
364
399
  error: (error: Error) => void;
400
+ stall_detected: (recentOutput: string, stallDurationMs: number) => void;
365
401
  }
366
402
  /**
367
403
  * Special key mappings to escape sequences
@@ -381,9 +417,14 @@ declare class PTYSession extends EventEmitter {
381
417
  private logger;
382
418
  private sessionRules;
383
419
  private _lastBlockingPromptHash;
420
+ private _stallTimer;
421
+ private _stallTimeoutMs;
422
+ private _stallDetectionEnabled;
423
+ private _lastStallHash;
424
+ private _stallStartedAt;
384
425
  readonly id: string;
385
426
  readonly config: SpawnConfig;
386
- constructor(adapter: CLIAdapter, config: SpawnConfig, logger?: Logger);
427
+ constructor(adapter: CLIAdapter, config: SpawnConfig, logger?: Logger, stallDetectionEnabled?: boolean, defaultStallTimeoutMs?: number);
387
428
  get status(): SessionStatus;
388
429
  get pid(): number | undefined;
389
430
  get startedAt(): Date | undefined;
@@ -410,6 +451,37 @@ declare class PTYSession extends EventEmitter {
410
451
  * Clear all session auto-response rules.
411
452
  */
412
453
  clearAutoResponseRules(): void;
454
+ /**
455
+ * Start or reset the stall detection timer.
456
+ * Only active when status is "busy" and stall detection is enabled.
457
+ */
458
+ private resetStallTimer;
459
+ /**
460
+ * Clear the stall detection timer.
461
+ */
462
+ private clearStallTimer;
463
+ /**
464
+ * Called when the stall timer fires (no output for stallTimeoutMs).
465
+ */
466
+ private onStallTimerFired;
467
+ /**
468
+ * Promise-based delay helper.
469
+ */
470
+ private delay;
471
+ /**
472
+ * Simple string hash for deduplication.
473
+ */
474
+ private simpleHash;
475
+ /**
476
+ * Strip ANSI codes for stall detection output.
477
+ * Replaces cursor-forward sequences with spaces first.
478
+ */
479
+ private stripAnsiForStall;
480
+ /**
481
+ * Handle external stall classification result.
482
+ * Called by the manager after onStallClassify resolves.
483
+ */
484
+ handleStallClassification(classification: StallClassification | null): void;
413
485
  /**
414
486
  * Start the PTY session
415
487
  */
@@ -465,6 +537,16 @@ declare class PTYSession extends EventEmitter {
465
537
  * @param keys - Key name(s) to send, e.g. "ctrl+c" or ["up", "up", "enter"]
466
538
  */
467
539
  sendKeys(keys: string | string[]): void;
540
+ /**
541
+ * Select a TUI menu option by index (0-based).
542
+ * Sends Down arrow `optionIndex` times, then Enter, with 50ms delays.
543
+ */
544
+ selectMenuOption(optionIndex: number): Promise<void>;
545
+ /**
546
+ * Send a sequence of keys with staggered timing.
547
+ * Each key is sent 50ms apart using setTimeout to keep the caller synchronous.
548
+ */
549
+ private sendKeySequence;
468
550
  /**
469
551
  * Paste text using bracketed paste mode
470
552
  *
@@ -510,6 +592,7 @@ interface PTYManagerEvents {
510
592
  blocking_prompt: (session: SessionHandle, promptInfo: BlockingPromptInfo, autoResponded: boolean) => void;
511
593
  message: (message: SessionMessage) => void;
512
594
  question: (session: SessionHandle, question: string) => void;
595
+ stall_detected: (session: SessionHandle, recentOutput: string, stallDurationMs: number) => void;
513
596
  }
514
597
  declare class PTYManager extends EventEmitter {
515
598
  private sessions;
@@ -517,6 +600,9 @@ declare class PTYManager extends EventEmitter {
517
600
  private maxLogLines;
518
601
  private logger;
519
602
  readonly adapters: AdapterRegistry;
603
+ private _stallDetectionEnabled;
604
+ private _stallTimeoutMs;
605
+ private _onStallClassify?;
520
606
  constructor(config?: PTYManagerConfig);
521
607
  /**
522
608
  * Register a CLI adapter
@@ -581,6 +667,11 @@ declare class PTYManager extends EventEmitter {
581
667
  * Get the underlying PTYSession (for advanced use)
582
668
  */
583
669
  getSession(sessionId: string): PTYSession | undefined;
670
+ /**
671
+ * Configure stall detection at runtime.
672
+ * Affects newly spawned sessions only — existing sessions keep their config.
673
+ */
674
+ configureStallDetection(enabled: boolean, timeoutMs?: number, classify?: (sessionId: string, recentOutput: string, stallDurationMs: number) => Promise<StallClassification | null>): void;
584
675
  /**
585
676
  * Add an auto-response rule to a session.
586
677
  * Session rules are checked before adapter rules.
@@ -622,6 +713,11 @@ declare abstract class BaseCLIAdapter implements CLIAdapter {
622
713
  * Subclasses should override this to add CLI-specific rules.
623
714
  */
624
715
  readonly autoResponseRules: AutoResponseRule[];
716
+ /**
717
+ * Whether this CLI uses TUI menus requiring arrow-key navigation.
718
+ * Defaults to false; coding agent adapters override to true.
719
+ */
720
+ readonly usesTuiMenus: boolean;
625
721
  abstract getCommand(): string;
626
722
  abstract getArgs(config: SpawnConfig): string[];
627
723
  abstract getEnv(config: SpawnConfig): Record<string, string>;
@@ -755,6 +851,15 @@ interface BunPTYManagerOptions {
755
851
  * Example: ['coding-agent-adapters']
756
852
  */
757
853
  adapterModules?: string[];
854
+ /** Enable stall detection (default: false) */
855
+ stallDetectionEnabled?: boolean;
856
+ /** Default stall timeout in ms (default: 8000) */
857
+ stallTimeoutMs?: number;
858
+ /**
859
+ * External classification callback invoked when a stall is detected.
860
+ * The worker emits stall_detected; this callback runs on the parent side.
861
+ */
862
+ onStallClassify?: (sessionId: string, recentOutput: string, stallDurationMs: number) => Promise<StallClassification | null>;
758
863
  }
759
864
  /**
760
865
  * PTY Manager that works with Bun and other non-Node runtimes
@@ -771,6 +876,9 @@ declare class BunCompatiblePTYManager extends EventEmitter {
771
876
  private workerPath;
772
877
  private env;
773
878
  private adapterModules;
879
+ private _stallDetectionEnabled;
880
+ private _stallTimeoutMs;
881
+ private _onStallClassify?;
774
882
  constructor(options?: BunPTYManagerOptions);
775
883
  private findWorkerPath;
776
884
  private startWorker;
@@ -847,6 +955,10 @@ declare class BunCompatiblePTYManager extends EventEmitter {
847
955
  * Get all auto-response rules for a session.
848
956
  */
849
957
  getAutoResponseRules(sessionId: string): Promise<AutoResponseRule[]>;
958
+ /**
959
+ * Select a TUI menu option by index (0-based) in a session.
960
+ */
961
+ selectMenuOption(id: string, optionIndex: number): Promise<void>;
850
962
  /**
851
963
  * Clear all auto-response rules for a session.
852
964
  */
@@ -869,4 +981,4 @@ declare function isBun(): boolean;
869
981
  */
870
982
  declare function createPTYManager(options?: BunPTYManagerOptions): BunCompatiblePTYManager;
871
983
 
872
- export { type AdapterFactoryConfig, AdapterRegistry, type AutoResponseRule, BaseCLIAdapter, type BlockingPromptDetection, type BlockingPromptInfo, type BlockingPromptType, BunCompatiblePTYManager, type BunPTYManagerOptions, type CLIAdapter, type LogOptions, type Logger, type LoginDetection, type MessageType, PTYManager, type PTYManagerConfig, type PTYManagerEvents, PTYSession, type PTYSessionEvents, type ParsedOutput, SPECIAL_KEYS, type SessionFilter, type SessionHandle, type SessionMessage, type SessionStatus, ShellAdapter, type ShellAdapterOptions, type SpawnConfig, type StopOptions, type TerminalAttachment, type WorkerSessionHandle, createAdapter, createPTYManager, isBun };
984
+ export { type AdapterFactoryConfig, AdapterRegistry, type AutoResponseRule, BaseCLIAdapter, type BlockingPromptDetection, type BlockingPromptInfo, type BlockingPromptType, BunCompatiblePTYManager, type BunPTYManagerOptions, type CLIAdapter, type LogOptions, type Logger, type LoginDetection, type MessageType, PTYManager, type PTYManagerConfig, type PTYManagerEvents, PTYSession, type PTYSessionEvents, type ParsedOutput, SPECIAL_KEYS, type SessionFilter, type SessionHandle, type SessionMessage, type SessionStatus, ShellAdapter, type ShellAdapterOptions, type SpawnConfig, type StallClassification, type StopOptions, type TerminalAttachment, type WorkerSessionHandle, createAdapter, createPTYManager, isBun };