@volter/supercode-terminal 0.2.72 → 0.2.73

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.
Files changed (3) hide show
  1. package/index.d.ts +1 -1
  2. package/index.mjs +18 -8
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -58,7 +58,7 @@ export class TmuxTerminalHost {
58
58
  env?: Record<string, string>;
59
59
  name?: string;
60
60
  }): Promise<TerminalSession>;
61
- capture(sessionId: string, options?: { lines?: number; preserveEscapes?: boolean }): string;
61
+ capture(sessionId: string, options?: { lines?: number; preserveEscapes?: boolean }): Promise<string>;
62
62
  sendInput(
63
63
  sessionId: string,
64
64
  data: string,
package/index.mjs CHANGED
@@ -293,14 +293,24 @@ export class TmuxTerminalHost {
293
293
  return created;
294
294
  }
295
295
 
296
- capture(sessionId, options = {}) {
297
- const entry = this.#entry(sessionId);
298
- return this.#tmux.capturePane({
299
- lines: options.lines,
300
- preserveEscapes: options.preserveEscapes === true,
301
- socket: this.#socket,
302
- target: `${entry.name}:0.0`,
303
- });
296
+ // Asynchronous, and one tmux process: the daemon reads every pane's screen each time it judges attention, and a
297
+ // synchronous read (a session listing and a capture per pane, each a spawnSync) held its event loop for all of them
298
+ // back to back, so a local client's hello waited behind the whole pass. A session that is gone is told from the
299
+ // failed capture, by the same listing as before.
300
+ async capture(sessionId, options = {}) {
301
+ const entry = this.#catalog.get(sessionId);
302
+ if (!entry) throw new TerminalHostError('session_not_found', 'The tmux session no longer exists.');
303
+ try {
304
+ return await this.#tmux.capturePaneAsync({
305
+ lines: options.lines,
306
+ preserveEscapes: options.preserveEscapes === true,
307
+ socket: this.#socket,
308
+ target: `${entry.name}:0.0`,
309
+ });
310
+ } catch (error) {
311
+ this.#entry(sessionId);
312
+ throw error;
313
+ }
304
314
  }
305
315
 
306
316
  async sendInput(sessionId, data, options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-terminal",
3
- "version": "0.2.72",
3
+ "version": "0.2.73",
4
4
  "type": "module",
5
5
  "description": "Optional leak-safe terminal and tmux host adapter for Volter Harness frontends",
6
6
  "exports": {