tg-claude 0.3.3 → 0.3.4
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/package.json +2 -3
- package/dist/claude/ClaudeProcess.d.ts +0 -77
- package/dist/claude/ClaudeProcess.d.ts.map +0 -1
- package/dist/claude/ClaudeProcess.js +0 -270
- package/dist/claude/ClaudeProcess.js.map +0 -1
- package/dist/claude/EventAdapter.d.ts +0 -44
- package/dist/claude/EventAdapter.d.ts.map +0 -1
- package/dist/claude/EventAdapter.js +0 -135
- package/dist/claude/EventAdapter.js.map +0 -1
- package/dist/claude/index.d.ts +0 -10
- package/dist/claude/index.d.ts.map +0 -1
- package/dist/claude/index.js +0 -9
- package/dist/claude/index.js.map +0 -1
- package/dist/claude/types.d.ts +0 -244
- package/dist/claude/types.d.ts.map +0 -1
- package/dist/claude/types.js +0 -8
- package/dist/claude/types.js.map +0 -1
- package/dist/env.d.ts +0 -21
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -49
- package/dist/env.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -415
- package/dist/index.js.map +0 -1
- package/dist/parser/AnsiStripper.d.ts +0 -54
- package/dist/parser/AnsiStripper.d.ts.map +0 -1
- package/dist/parser/AnsiStripper.js +0 -115
- package/dist/parser/AnsiStripper.js.map +0 -1
- package/dist/parser/OptionExtractor.d.ts +0 -31
- package/dist/parser/OptionExtractor.d.ts.map +0 -1
- package/dist/parser/OptionExtractor.js +0 -91
- package/dist/parser/OptionExtractor.js.map +0 -1
- package/dist/parser/OutputParser.d.ts +0 -121
- package/dist/parser/OutputParser.d.ts.map +0 -1
- package/dist/parser/OutputParser.js +0 -306
- package/dist/parser/OutputParser.js.map +0 -1
- package/dist/parser/PromptDetector.d.ts +0 -20
- package/dist/parser/PromptDetector.d.ts.map +0 -1
- package/dist/parser/PromptDetector.js +0 -68
- package/dist/parser/PromptDetector.js.map +0 -1
- package/dist/parser/index.d.ts +0 -7
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js +0 -5
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/types.d.ts +0 -73
- package/dist/parser/types.d.ts.map +0 -1
- package/dist/parser/types.js +0 -2
- package/dist/parser/types.js.map +0 -1
- package/dist/pty/OutputBuffer.d.ts +0 -39
- package/dist/pty/OutputBuffer.d.ts.map +0 -1
- package/dist/pty/OutputBuffer.js +0 -55
- package/dist/pty/OutputBuffer.js.map +0 -1
- package/dist/pty/PtyProcess.d.ts +0 -47
- package/dist/pty/PtyProcess.d.ts.map +0 -1
- package/dist/pty/PtyProcess.js +0 -94
- package/dist/pty/PtyProcess.js.map +0 -1
- package/dist/pty/PtyService.d.ts +0 -55
- package/dist/pty/PtyService.d.ts.map +0 -1
- package/dist/pty/PtyService.js +0 -115
- package/dist/pty/PtyService.js.map +0 -1
- package/dist/pty/index.d.ts +0 -5
- package/dist/pty/index.d.ts.map +0 -1
- package/dist/pty/index.js +0 -4
- package/dist/pty/index.js.map +0 -1
- package/dist/pty/types.d.ts +0 -36
- package/dist/pty/types.d.ts.map +0 -1
- package/dist/pty/types.js +0 -2
- package/dist/pty/types.js.map +0 -1
- package/dist/router/BoundedQueue.d.ts +0 -57
- package/dist/router/BoundedQueue.d.ts.map +0 -1
- package/dist/router/BoundedQueue.js +0 -86
- package/dist/router/BoundedQueue.js.map +0 -1
- package/dist/router/EventRouter.d.ts +0 -103
- package/dist/router/EventRouter.d.ts.map +0 -1
- package/dist/router/EventRouter.js +0 -169
- package/dist/router/EventRouter.js.map +0 -1
- package/dist/router/index.d.ts +0 -13
- package/dist/router/index.d.ts.map +0 -1
- package/dist/router/index.js +0 -12
- package/dist/router/index.js.map +0 -1
- package/dist/router/types.d.ts +0 -104
- package/dist/router/types.d.ts.map +0 -1
- package/dist/router/types.js +0 -6
- package/dist/router/types.js.map +0 -1
- package/dist/setup/envWriter.d.ts +0 -22
- package/dist/setup/envWriter.d.ts.map +0 -1
- package/dist/setup/envWriter.js +0 -68
- package/dist/setup/envWriter.js.map +0 -1
- package/dist/setup/index.d.ts +0 -4
- package/dist/setup/index.d.ts.map +0 -1
- package/dist/setup/index.js +0 -4
- package/dist/setup/index.js.map +0 -1
- package/dist/setup/validators.d.ts +0 -22
- package/dist/setup/validators.d.ts.map +0 -1
- package/dist/setup/validators.js +0 -47
- package/dist/setup/validators.js.map +0 -1
- package/dist/setup/wizard.d.ts +0 -7
- package/dist/setup/wizard.d.ts.map +0 -1
- package/dist/setup/wizard.js +0 -56
- package/dist/setup/wizard.js.map +0 -1
- package/dist/telegram/TelegramBot.d.ts +0 -163
- package/dist/telegram/TelegramBot.d.ts.map +0 -1
- package/dist/telegram/TelegramBot.js +0 -634
- package/dist/telegram/TelegramBot.js.map +0 -1
- package/dist/telegram/index.d.ts +0 -7
- package/dist/telegram/index.d.ts.map +0 -1
- package/dist/telegram/index.js +0 -6
- package/dist/telegram/index.js.map +0 -1
- package/dist/telegram/types.d.ts +0 -30
- package/dist/telegram/types.d.ts.map +0 -1
- package/dist/telegram/types.js +0 -5
- package/dist/telegram/types.js.map +0 -1
- package/dist/terminal/TerminalInterface.d.ts +0 -61
- package/dist/terminal/TerminalInterface.d.ts.map +0 -1
- package/dist/terminal/TerminalInterface.js +0 -218
- package/dist/terminal/TerminalInterface.js.map +0 -1
- package/dist/terminal/index.d.ts +0 -3
- package/dist/terminal/index.d.ts.map +0 -1
- package/dist/terminal/index.js +0 -2
- package/dist/terminal/index.js.map +0 -1
- package/dist/terminal/types.d.ts +0 -17
- package/dist/terminal/types.d.ts.map +0 -1
- package/dist/terminal/types.js +0 -2
- package/dist/terminal/types.js.map +0 -1
package/dist/parser/types.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Claude's current operational status
|
|
3
|
-
*/
|
|
4
|
-
export type ClaudeStatus = 'idle' | 'working' | 'blocking' | 'completed';
|
|
5
|
-
/**
|
|
6
|
-
* A single chunk of parsed output from the PTY
|
|
7
|
-
*/
|
|
8
|
-
export interface ParsedChunk {
|
|
9
|
-
/** Original raw data including ANSI codes */
|
|
10
|
-
raw: string;
|
|
11
|
-
/** Cleaned text with ANSI codes stripped */
|
|
12
|
-
text: string;
|
|
13
|
-
/** Timestamp when chunk was received */
|
|
14
|
-
timestamp: number;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* A single option extracted from a prompt
|
|
18
|
-
*/
|
|
19
|
-
export interface PromptOption {
|
|
20
|
-
/** Option number (1, 2, 3...) */
|
|
21
|
-
index: number;
|
|
22
|
-
/** Option text (e.g., "Yes, continue") */
|
|
23
|
-
text: string;
|
|
24
|
-
/** Whether this option has the cursor/selection marker */
|
|
25
|
-
selected: boolean;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Event emitted when a blocking prompt is detected
|
|
29
|
-
*/
|
|
30
|
-
export interface PromptEvent {
|
|
31
|
-
/** Event type identifier */
|
|
32
|
-
type: 'blocking-prompt';
|
|
33
|
-
/** The question or prompt text */
|
|
34
|
-
question: string;
|
|
35
|
-
/** Extracted options (empty if freeform input) */
|
|
36
|
-
options: PromptOption[];
|
|
37
|
-
/** Raw context (last N characters for debugging) */
|
|
38
|
-
rawContext: string;
|
|
39
|
-
/** Timestamp when prompt was detected */
|
|
40
|
-
timestamp: number;
|
|
41
|
-
/** Whether multiple options can be selected */
|
|
42
|
-
multiSelect?: boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Event emitted when Claude completes a work cycle
|
|
46
|
-
*/
|
|
47
|
-
export interface CompletionEvent {
|
|
48
|
-
/** Event type identifier */
|
|
49
|
-
type: 'completion';
|
|
50
|
-
/** Summary of final output (last few lines) */
|
|
51
|
-
summary: string;
|
|
52
|
-
/** Duration from work start to completion (ms) */
|
|
53
|
-
duration?: number;
|
|
54
|
-
/** Timestamp when completion was detected */
|
|
55
|
-
timestamp: number;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Union type for all parser events
|
|
59
|
-
*/
|
|
60
|
-
export type ParserEvent = PromptEvent | CompletionEvent;
|
|
61
|
-
/**
|
|
62
|
-
* Callback for parser events (union type)
|
|
63
|
-
*/
|
|
64
|
-
export type ParserEventHandler = (event: ParserEvent) => void;
|
|
65
|
-
/**
|
|
66
|
-
* Callback specifically for prompt events
|
|
67
|
-
*/
|
|
68
|
-
export type PromptEventHandler = (event: PromptEvent) => void;
|
|
69
|
-
/**
|
|
70
|
-
* Callback specifically for completion events
|
|
71
|
-
*/
|
|
72
|
-
export type CompletionEventHandler = (event: CompletionEvent) => void;
|
|
73
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/parser/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,4BAA4B;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,IAAI,EAAE,YAAY,CAAC;IACnB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,eAAe,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC"}
|
package/dist/parser/types.js
DELETED
package/dist/parser/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/parser/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bounded buffer for accumulating output chunks without unbounded memory growth.
|
|
3
|
-
* Prevents memory issues from fast-producing processes by limiting chunk count.
|
|
4
|
-
*/
|
|
5
|
-
export declare class OutputBuffer {
|
|
6
|
-
private buffer;
|
|
7
|
-
private readonly maxChunks;
|
|
8
|
-
/**
|
|
9
|
-
* Create a new OutputBuffer
|
|
10
|
-
* @param maxChunks - Maximum number of chunks to retain (default: 1000)
|
|
11
|
-
*/
|
|
12
|
-
constructor(maxChunks?: number);
|
|
13
|
-
/**
|
|
14
|
-
* Append a data chunk to the buffer.
|
|
15
|
-
* If buffer exceeds maxChunks, oldest chunk is removed.
|
|
16
|
-
* @param data - String data to append
|
|
17
|
-
*/
|
|
18
|
-
append(data: string): void;
|
|
19
|
-
/**
|
|
20
|
-
* Get all buffered content joined together
|
|
21
|
-
* @returns All chunks concatenated
|
|
22
|
-
*/
|
|
23
|
-
getAll(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Get the most recent n chunks joined together
|
|
26
|
-
* @param n - Number of recent chunks to retrieve
|
|
27
|
-
* @returns Last n chunks concatenated
|
|
28
|
-
*/
|
|
29
|
-
getRecent(n: number): string;
|
|
30
|
-
/**
|
|
31
|
-
* Clear all buffered content
|
|
32
|
-
*/
|
|
33
|
-
clear(): void;
|
|
34
|
-
/**
|
|
35
|
-
* Get the current number of chunks in the buffer
|
|
36
|
-
*/
|
|
37
|
-
get length(): number;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=OutputBuffer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OutputBuffer.d.ts","sourceRoot":"","sources":["../../src/pty/OutputBuffer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC;;;OAGG;gBACS,SAAS,GAAE,MAAa;IAIpC;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAO1B;;;OAGG;IACH,MAAM,IAAI,MAAM;IAIhB;;;;OAIG;IACH,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAK5B;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;CACF"}
|
package/dist/pty/OutputBuffer.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bounded buffer for accumulating output chunks without unbounded memory growth.
|
|
3
|
-
* Prevents memory issues from fast-producing processes by limiting chunk count.
|
|
4
|
-
*/
|
|
5
|
-
export class OutputBuffer {
|
|
6
|
-
buffer = [];
|
|
7
|
-
maxChunks;
|
|
8
|
-
/**
|
|
9
|
-
* Create a new OutputBuffer
|
|
10
|
-
* @param maxChunks - Maximum number of chunks to retain (default: 1000)
|
|
11
|
-
*/
|
|
12
|
-
constructor(maxChunks = 1000) {
|
|
13
|
-
this.maxChunks = maxChunks;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Append a data chunk to the buffer.
|
|
17
|
-
* If buffer exceeds maxChunks, oldest chunk is removed.
|
|
18
|
-
* @param data - String data to append
|
|
19
|
-
*/
|
|
20
|
-
append(data) {
|
|
21
|
-
this.buffer.push(data);
|
|
22
|
-
if (this.buffer.length > this.maxChunks) {
|
|
23
|
-
this.buffer.shift();
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Get all buffered content joined together
|
|
28
|
-
* @returns All chunks concatenated
|
|
29
|
-
*/
|
|
30
|
-
getAll() {
|
|
31
|
-
return this.buffer.join('');
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Get the most recent n chunks joined together
|
|
35
|
-
* @param n - Number of recent chunks to retrieve
|
|
36
|
-
* @returns Last n chunks concatenated
|
|
37
|
-
*/
|
|
38
|
-
getRecent(n) {
|
|
39
|
-
const start = Math.max(0, this.buffer.length - n);
|
|
40
|
-
return this.buffer.slice(start).join('');
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Clear all buffered content
|
|
44
|
-
*/
|
|
45
|
-
clear() {
|
|
46
|
-
this.buffer = [];
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Get the current number of chunks in the buffer
|
|
50
|
-
*/
|
|
51
|
-
get length() {
|
|
52
|
-
return this.buffer.length;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=OutputBuffer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OutputBuffer.js","sourceRoot":"","sources":["../../src/pty/OutputBuffer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,YAAY;IACf,MAAM,GAAa,EAAE,CAAC;IACb,SAAS,CAAS;IAEnC;;;OAGG;IACH,YAAY,YAAoB,IAAI;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAY;QACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YACxC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,CAAS;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;CACF"}
|
package/dist/pty/PtyProcess.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { PtyEvents, PtyOptions, PtyProcessInfo } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper around node-pty that provides a clean typed interface
|
|
4
|
-
* for managing a single PTY process instance.
|
|
5
|
-
*/
|
|
6
|
-
export declare class PtyProcess {
|
|
7
|
-
private ptyInstance;
|
|
8
|
-
private disposed;
|
|
9
|
-
private readonly processInfo;
|
|
10
|
-
/**
|
|
11
|
-
* Creates and spawns a new PTY process
|
|
12
|
-
* @param command - The command to execute (e.g., 'claude', 'bash')
|
|
13
|
-
* @param args - Arguments to pass to the command
|
|
14
|
-
* @param options - PTY options (cwd, env, cols, rows)
|
|
15
|
-
* @param events - Event handlers for data and exit
|
|
16
|
-
*/
|
|
17
|
-
constructor(command: string, args: string[], options: PtyOptions, events: PtyEvents);
|
|
18
|
-
/**
|
|
19
|
-
* Write data to the PTY input
|
|
20
|
-
* @param data - Data to write (e.g., keystrokes, commands)
|
|
21
|
-
*/
|
|
22
|
-
write(data: string): void;
|
|
23
|
-
/**
|
|
24
|
-
* Resize the PTY terminal dimensions
|
|
25
|
-
* @param cols - Number of columns
|
|
26
|
-
* @param rows - Number of rows
|
|
27
|
-
*/
|
|
28
|
-
resize(cols: number, rows: number): void;
|
|
29
|
-
/**
|
|
30
|
-
* Kill the PTY process
|
|
31
|
-
* @param signal - Signal to send (default: SIGTERM)
|
|
32
|
-
*/
|
|
33
|
-
kill(signal?: string): void;
|
|
34
|
-
/**
|
|
35
|
-
* Get the process ID of the PTY
|
|
36
|
-
*/
|
|
37
|
-
get pid(): number;
|
|
38
|
-
/**
|
|
39
|
-
* Get information about the PTY process
|
|
40
|
-
*/
|
|
41
|
-
get info(): PtyProcessInfo;
|
|
42
|
-
/**
|
|
43
|
-
* Check if the PTY process has been disposed (exited or killed)
|
|
44
|
-
*/
|
|
45
|
-
get isDisposed(): boolean;
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=PtyProcess.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PtyProcess.d.ts","sourceRoot":"","sources":["../../src/pty/PtyProcess.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAExE;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,WAAW,CAAO;IAC1B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiB;IAE7C;;;;;;OAMG;gBAED,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,SAAS;IAqCnB;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAMzB;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAMxC;;;OAGG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAM3B;;OAEG;IACH,IAAI,GAAG,IAAI,MAAM,CAEhB;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,cAAc,CAEzB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,OAAO,CAExB;CACF"}
|
package/dist/pty/PtyProcess.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import * as pty from 'node-pty';
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper around node-pty that provides a clean typed interface
|
|
4
|
-
* for managing a single PTY process instance.
|
|
5
|
-
*/
|
|
6
|
-
export class PtyProcess {
|
|
7
|
-
ptyInstance;
|
|
8
|
-
disposed = false;
|
|
9
|
-
processInfo;
|
|
10
|
-
/**
|
|
11
|
-
* Creates and spawns a new PTY process
|
|
12
|
-
* @param command - The command to execute (e.g., 'claude', 'bash')
|
|
13
|
-
* @param args - Arguments to pass to the command
|
|
14
|
-
* @param options - PTY options (cwd, env, cols, rows)
|
|
15
|
-
* @param events - Event handlers for data and exit
|
|
16
|
-
*/
|
|
17
|
-
constructor(command, args, options, events) {
|
|
18
|
-
const cols = options.cols ?? 120;
|
|
19
|
-
const rows = options.rows ?? 30;
|
|
20
|
-
this.processInfo = {
|
|
21
|
-
pid: 0, // Will be set after spawn
|
|
22
|
-
command,
|
|
23
|
-
args,
|
|
24
|
-
cwd: options.cwd,
|
|
25
|
-
};
|
|
26
|
-
this.ptyInstance = pty.spawn(command, args, {
|
|
27
|
-
name: 'xterm-256color',
|
|
28
|
-
cols,
|
|
29
|
-
rows,
|
|
30
|
-
cwd: options.cwd,
|
|
31
|
-
env: options.env ?? process.env,
|
|
32
|
-
});
|
|
33
|
-
// Update PID after spawn
|
|
34
|
-
this.processInfo.pid = this.ptyInstance.pid;
|
|
35
|
-
// Attach data handler
|
|
36
|
-
this.ptyInstance.onData((data) => {
|
|
37
|
-
if (!this.disposed) {
|
|
38
|
-
events.onData(data);
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
// Attach exit handler
|
|
42
|
-
this.ptyInstance.onExit(({ exitCode, signal }) => {
|
|
43
|
-
this.disposed = true;
|
|
44
|
-
events.onExit(exitCode, signal);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Write data to the PTY input
|
|
49
|
-
* @param data - Data to write (e.g., keystrokes, commands)
|
|
50
|
-
*/
|
|
51
|
-
write(data) {
|
|
52
|
-
if (!this.disposed) {
|
|
53
|
-
this.ptyInstance.write(data);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Resize the PTY terminal dimensions
|
|
58
|
-
* @param cols - Number of columns
|
|
59
|
-
* @param rows - Number of rows
|
|
60
|
-
*/
|
|
61
|
-
resize(cols, rows) {
|
|
62
|
-
if (!this.disposed) {
|
|
63
|
-
this.ptyInstance.resize(cols, rows);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Kill the PTY process
|
|
68
|
-
* @param signal - Signal to send (default: SIGTERM)
|
|
69
|
-
*/
|
|
70
|
-
kill(signal) {
|
|
71
|
-
if (!this.disposed) {
|
|
72
|
-
this.ptyInstance.kill(signal);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Get the process ID of the PTY
|
|
77
|
-
*/
|
|
78
|
-
get pid() {
|
|
79
|
-
return this.ptyInstance.pid;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Get information about the PTY process
|
|
83
|
-
*/
|
|
84
|
-
get info() {
|
|
85
|
-
return { ...this.processInfo };
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Check if the PTY process has been disposed (exited or killed)
|
|
89
|
-
*/
|
|
90
|
-
get isDisposed() {
|
|
91
|
-
return this.disposed;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
//# sourceMappingURL=PtyProcess.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PtyProcess.js","sourceRoot":"","sources":["../../src/pty/PtyProcess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAIhC;;;GAGG;AACH,MAAM,OAAO,UAAU;IACb,WAAW,CAAO;IAClB,QAAQ,GAAG,KAAK,CAAC;IACR,WAAW,CAAiB;IAE7C;;;;;;OAMG;IACH,YACE,OAAe,EACf,IAAc,EACd,OAAmB,EACnB,MAAiB;QAEjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC;QACjC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC;QAEhC,IAAI,CAAC,WAAW,GAAG;YACjB,GAAG,EAAE,CAAC,EAAE,0BAA0B;YAClC,OAAO;YACP,IAAI;YACJ,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC;QAEF,IAAI,CAAC,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YAC1C,IAAI,EAAE,gBAAgB;YACtB,IAAI;YACJ,IAAI;YACJ,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG;SAChC,CAAC,CAAC;QAEH,yBAAyB;QACzB,IAAI,CAAC,WAAW,CAAC,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;QAE5C,sBAAsB;QACtB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YAC/B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,sBAAsB;QACtB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE;YAC/C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAY;QAChB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,IAAY,EAAE,IAAY;QAC/B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,MAAe;QAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
package/dist/pty/PtyService.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { PtyProcess } from './PtyProcess.js';
|
|
2
|
-
import type { PtyEvents, PtyOptions } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Service for managing multiple PTY process instances.
|
|
5
|
-
* Handles lifecycle management and graceful shutdown on process signals.
|
|
6
|
-
*/
|
|
7
|
-
export declare class PtyService {
|
|
8
|
-
private processes;
|
|
9
|
-
private isShuttingDown;
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Spawn a new PTY process and track it by session ID
|
|
13
|
-
* @param sessionId - Unique identifier for this session
|
|
14
|
-
* @param command - Command to execute
|
|
15
|
-
* @param args - Command arguments
|
|
16
|
-
* @param options - PTY options
|
|
17
|
-
* @param events - Event handlers
|
|
18
|
-
* @returns The spawned PtyProcess instance
|
|
19
|
-
*/
|
|
20
|
-
spawn(sessionId: string, command: string, args: string[], options: PtyOptions, events: PtyEvents): PtyProcess;
|
|
21
|
-
/**
|
|
22
|
-
* Get a PTY process by session ID
|
|
23
|
-
* @param sessionId - Session identifier
|
|
24
|
-
* @returns The PtyProcess or undefined if not found
|
|
25
|
-
*/
|
|
26
|
-
get(sessionId: string): PtyProcess | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Kill a PTY process by session ID
|
|
29
|
-
* @param sessionId - Session identifier
|
|
30
|
-
* @returns true if process was found and killed, false otherwise
|
|
31
|
-
*/
|
|
32
|
-
kill(sessionId: string): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Kill all tracked PTY processes
|
|
35
|
-
*/
|
|
36
|
-
killAll(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Get all tracked PTY processes
|
|
39
|
-
* @returns Map of session IDs to PtyProcess instances
|
|
40
|
-
*/
|
|
41
|
-
getAll(): Map<string, PtyProcess>;
|
|
42
|
-
/**
|
|
43
|
-
* Get the number of active PTY processes
|
|
44
|
-
*/
|
|
45
|
-
get size(): number;
|
|
46
|
-
/**
|
|
47
|
-
* Handle graceful shutdown on signals
|
|
48
|
-
*/
|
|
49
|
-
private shutdown;
|
|
50
|
-
/**
|
|
51
|
-
* Clean up all PTY processes
|
|
52
|
-
*/
|
|
53
|
-
private cleanup;
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=PtyService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PtyService.d.ts","sourceRoot":"","sources":["../../src/pty/PtyService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD;;;GAGG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,cAAc,CAAS;;IAS/B;;;;;;;;OAQG;IACH,KAAK,CACH,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,SAAS,GAChB,UAAU;IAuBb;;;;OAIG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI9C;;;;OAIG;IACH,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAUhC;;OAEG;IACH,OAAO,IAAI,IAAI;IAWf;;;OAGG;IACH,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC;IAIjC;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,OAAO,CAAC,QAAQ;IAWhB;;OAEG;IACH,OAAO,CAAC,OAAO;CAOhB"}
|
package/dist/pty/PtyService.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { PtyProcess } from './PtyProcess.js';
|
|
2
|
-
/**
|
|
3
|
-
* Service for managing multiple PTY process instances.
|
|
4
|
-
* Handles lifecycle management and graceful shutdown on process signals.
|
|
5
|
-
*/
|
|
6
|
-
export class PtyService {
|
|
7
|
-
processes = new Map();
|
|
8
|
-
isShuttingDown = false;
|
|
9
|
-
constructor() {
|
|
10
|
-
// Register signal handlers for graceful shutdown
|
|
11
|
-
process.on('SIGTERM', () => this.shutdown('SIGTERM'));
|
|
12
|
-
process.on('SIGINT', () => this.shutdown('SIGINT'));
|
|
13
|
-
process.on('exit', () => this.cleanup());
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Spawn a new PTY process and track it by session ID
|
|
17
|
-
* @param sessionId - Unique identifier for this session
|
|
18
|
-
* @param command - Command to execute
|
|
19
|
-
* @param args - Command arguments
|
|
20
|
-
* @param options - PTY options
|
|
21
|
-
* @param events - Event handlers
|
|
22
|
-
* @returns The spawned PtyProcess instance
|
|
23
|
-
*/
|
|
24
|
-
spawn(sessionId, command, args, options, events) {
|
|
25
|
-
// Clean up any existing process with this session ID
|
|
26
|
-
if (this.processes.has(sessionId)) {
|
|
27
|
-
this.kill(sessionId);
|
|
28
|
-
}
|
|
29
|
-
// Wrap the exit handler to clean up our tracking
|
|
30
|
-
const wrappedEvents = {
|
|
31
|
-
onData: events.onData,
|
|
32
|
-
onExit: (exitCode, signal) => {
|
|
33
|
-
// Remove from tracking on exit
|
|
34
|
-
this.processes.delete(sessionId);
|
|
35
|
-
// Call the original handler
|
|
36
|
-
events.onExit(exitCode, signal);
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
const ptyProcess = new PtyProcess(command, args, options, wrappedEvents);
|
|
40
|
-
this.processes.set(sessionId, ptyProcess);
|
|
41
|
-
return ptyProcess;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Get a PTY process by session ID
|
|
45
|
-
* @param sessionId - Session identifier
|
|
46
|
-
* @returns The PtyProcess or undefined if not found
|
|
47
|
-
*/
|
|
48
|
-
get(sessionId) {
|
|
49
|
-
return this.processes.get(sessionId);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Kill a PTY process by session ID
|
|
53
|
-
* @param sessionId - Session identifier
|
|
54
|
-
* @returns true if process was found and killed, false otherwise
|
|
55
|
-
*/
|
|
56
|
-
kill(sessionId) {
|
|
57
|
-
const ptyProcess = this.processes.get(sessionId);
|
|
58
|
-
if (ptyProcess) {
|
|
59
|
-
ptyProcess.kill('SIGTERM');
|
|
60
|
-
this.processes.delete(sessionId);
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Kill all tracked PTY processes
|
|
67
|
-
*/
|
|
68
|
-
killAll() {
|
|
69
|
-
for (const [sessionId, ptyProcess] of this.processes) {
|
|
70
|
-
try {
|
|
71
|
-
ptyProcess.kill('SIGTERM');
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
// Process may already be dead
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
this.processes.clear();
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get all tracked PTY processes
|
|
81
|
-
* @returns Map of session IDs to PtyProcess instances
|
|
82
|
-
*/
|
|
83
|
-
getAll() {
|
|
84
|
-
return new Map(this.processes);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Get the number of active PTY processes
|
|
88
|
-
*/
|
|
89
|
-
get size() {
|
|
90
|
-
return this.processes.size;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Handle graceful shutdown on signals
|
|
94
|
-
*/
|
|
95
|
-
shutdown(signal) {
|
|
96
|
-
if (this.isShuttingDown) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
this.isShuttingDown = true;
|
|
100
|
-
process.stderr.write(`\nReceived ${signal}, cleaning up PTY processes...\n`);
|
|
101
|
-
this.cleanup();
|
|
102
|
-
process.exit(0);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Clean up all PTY processes
|
|
106
|
-
*/
|
|
107
|
-
cleanup() {
|
|
108
|
-
const count = this.processes.size;
|
|
109
|
-
if (count > 0) {
|
|
110
|
-
process.stderr.write(`Terminating ${count} PTY process(es)...\n`);
|
|
111
|
-
}
|
|
112
|
-
this.killAll();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=PtyService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PtyService.js","sourceRoot":"","sources":["../../src/pty/PtyService.ts"],"names":[],"mappings":"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"}
|
package/dist/pty/index.d.ts
DELETED
package/dist/pty/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pty/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/pty/index.js
DELETED
package/dist/pty/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/pty/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/pty/types.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PTY event handlers interface
|
|
3
|
-
*/
|
|
4
|
-
export interface PtyEvents {
|
|
5
|
-
/** Called when data is received from the PTY */
|
|
6
|
-
onData: (data: string) => void;
|
|
7
|
-
/** Called when the PTY process exits */
|
|
8
|
-
onExit: (exitCode: number, signal?: number) => void;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Options for spawning a PTY process
|
|
12
|
-
*/
|
|
13
|
-
export interface PtyOptions {
|
|
14
|
-
/** Working directory for the spawned process */
|
|
15
|
-
cwd: string;
|
|
16
|
-
/** Environment variables (defaults to process.env) */
|
|
17
|
-
env?: NodeJS.ProcessEnv;
|
|
18
|
-
/** Terminal columns (default: 120) */
|
|
19
|
-
cols?: number;
|
|
20
|
-
/** Terminal rows (default: 30) */
|
|
21
|
-
rows?: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Information about a running PTY process
|
|
25
|
-
*/
|
|
26
|
-
export interface PtyProcessInfo {
|
|
27
|
-
/** Process ID */
|
|
28
|
-
pid: number;
|
|
29
|
-
/** Command that was executed */
|
|
30
|
-
command: string;
|
|
31
|
-
/** Arguments passed to the command */
|
|
32
|
-
args: string[];
|
|
33
|
-
/** Working directory */
|
|
34
|
-
cwd: string;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/pty/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pty/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,gDAAgD;IAChD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,wCAAwC;IACxC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iBAAiB;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;CACb"}
|
package/dist/pty/types.js
DELETED
package/dist/pty/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/pty/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic bounded queue with configurable overflow behavior.
|
|
3
|
-
* Drops oldest items when capacity exceeded (matches OutputBuffer pattern).
|
|
4
|
-
*/
|
|
5
|
-
export declare class BoundedQueue<T> {
|
|
6
|
-
private items;
|
|
7
|
-
private readonly maxSize;
|
|
8
|
-
private droppedCount;
|
|
9
|
-
/**
|
|
10
|
-
* Create a new BoundedQueue
|
|
11
|
-
* @param maxSize - Maximum number of items the queue can hold (must be >= 1)
|
|
12
|
-
* @throws Error if maxSize is less than 1
|
|
13
|
-
*/
|
|
14
|
-
constructor(maxSize: number);
|
|
15
|
-
/**
|
|
16
|
-
* Add item to queue. If full, drops oldest item.
|
|
17
|
-
* @param item - Item to add to the queue
|
|
18
|
-
* @returns true if item was added without dropping, false if overflow occurred
|
|
19
|
-
*/
|
|
20
|
-
push(item: T): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Remove and return oldest item, or undefined if empty.
|
|
23
|
-
* @returns The oldest item in the queue, or undefined if queue is empty
|
|
24
|
-
*/
|
|
25
|
-
shift(): T | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Peek at oldest item without removing.
|
|
28
|
-
* @returns The oldest item in the queue, or undefined if queue is empty
|
|
29
|
-
*/
|
|
30
|
-
peek(): T | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Current number of items in queue.
|
|
33
|
-
*/
|
|
34
|
-
get size(): number;
|
|
35
|
-
/**
|
|
36
|
-
* Whether queue is at capacity.
|
|
37
|
-
*/
|
|
38
|
-
get isFull(): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Whether queue is empty.
|
|
41
|
-
*/
|
|
42
|
-
get isEmpty(): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Total items dropped due to overflow since creation.
|
|
45
|
-
*/
|
|
46
|
-
get totalDropped(): number;
|
|
47
|
-
/**
|
|
48
|
-
* Clear all items from queue.
|
|
49
|
-
*/
|
|
50
|
-
clear(): void;
|
|
51
|
-
/**
|
|
52
|
-
* Get all items as array (for debugging).
|
|
53
|
-
* @returns A copy of the internal items array
|
|
54
|
-
*/
|
|
55
|
-
toArray(): T[];
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=BoundedQueue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BoundedQueue.d.ts","sourceRoot":"","sources":["../../src/router/BoundedQueue.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,YAAY,CAAC,CAAC;IACzB,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,YAAY,CAAK;IAEzB;;;;OAIG;gBACS,OAAO,EAAE,MAAM;IAO3B;;;;OAIG;IACH,IAAI,CAAC,IAAI,EAAE,CAAC,GAAG,OAAO;IAUtB;;;OAGG;IACH,KAAK,IAAI,CAAC,GAAG,SAAS;IAItB;;;OAGG;IACH,IAAI,IAAI,CAAC,GAAG,SAAS;IAIrB;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;IACH,OAAO,IAAI,CAAC,EAAE;CAGf"}
|