openpaean 0.2.0 → 0.3.0

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 (42) hide show
  1. package/dist/agent/chat.ink.d.ts +5 -0
  2. package/dist/agent/chat.ink.d.ts.map +1 -1
  3. package/dist/agent/chat.ink.js +9 -0
  4. package/dist/agent/chat.ink.js.map +1 -1
  5. package/dist/cli.js +3 -3
  6. package/dist/cli.js.map +1 -1
  7. package/dist/commands/agent.d.ts.map +1 -1
  8. package/dist/commands/agent.js +6 -5
  9. package/dist/commands/agent.js.map +1 -1
  10. package/dist/ui/terminal/ErrorDisplay.d.ts +63 -0
  11. package/dist/ui/terminal/ErrorDisplay.d.ts.map +1 -0
  12. package/dist/ui/terminal/ErrorDisplay.js +113 -0
  13. package/dist/ui/terminal/ErrorDisplay.js.map +1 -0
  14. package/dist/ui/terminal/HelpDisplay.d.ts +21 -0
  15. package/dist/ui/terminal/HelpDisplay.d.ts.map +1 -0
  16. package/dist/ui/terminal/HelpDisplay.js +89 -0
  17. package/dist/ui/terminal/HelpDisplay.js.map +1 -0
  18. package/dist/ui/terminal/Spinner.d.ts +65 -0
  19. package/dist/ui/terminal/Spinner.d.ts.map +1 -0
  20. package/dist/ui/terminal/Spinner.js +130 -0
  21. package/dist/ui/terminal/Spinner.js.map +1 -0
  22. package/dist/ui/terminal/StatusBar.d.ts +27 -0
  23. package/dist/ui/terminal/StatusBar.d.ts.map +1 -0
  24. package/dist/ui/terminal/StatusBar.js +79 -0
  25. package/dist/ui/terminal/StatusBar.js.map +1 -0
  26. package/dist/ui/terminal/TerminalApp.d.ts +137 -0
  27. package/dist/ui/terminal/TerminalApp.d.ts.map +1 -0
  28. package/dist/ui/terminal/TerminalApp.js +450 -0
  29. package/dist/ui/terminal/TerminalApp.js.map +1 -0
  30. package/dist/ui/terminal/output.d.ts +91 -0
  31. package/dist/ui/terminal/output.d.ts.map +1 -0
  32. package/dist/ui/terminal/output.js +138 -0
  33. package/dist/ui/terminal/output.js.map +1 -0
  34. package/dist/ui/theme/index.d.ts +157 -0
  35. package/dist/ui/theme/index.d.ts.map +1 -0
  36. package/dist/ui/theme/index.js +236 -0
  37. package/dist/ui/theme/index.js.map +1 -0
  38. package/dist/utils/inputHistory.d.ts +88 -0
  39. package/dist/utils/inputHistory.d.ts.map +1 -0
  40. package/dist/utils/inputHistory.js +206 -0
  41. package/dist/utils/inputHistory.js.map +1 -0
  42. package/package.json +2 -2
@@ -0,0 +1,138 @@
1
+ /**
2
+ * Terminal Output Utilities
3
+ * Handles ANSI escape codes for terminal control
4
+ */
5
+ /**
6
+ * ANSI escape codes
7
+ */
8
+ export const ANSI = {
9
+ // Cursor movement
10
+ saveCursor: '\x1b[s',
11
+ restoreCursor: '\x1b[u',
12
+ moveCursorUp: (n) => `\x1b[${n}A`,
13
+ moveCursorDown: (n) => `\x1b[${n}B`,
14
+ moveCursorLeft: (n) => `\x1b[${n}D`,
15
+ moveCursorRight: (n) => `\x1b[${n}C`,
16
+ moveToColumn: (n) => `\x1b[${n}G`,
17
+ moveToStart: '\x1b[H',
18
+ // Screen clearing
19
+ clearLine: '\x1b[2K',
20
+ clearScreen: '\x1b[2J',
21
+ clearToEnd: '\x1b[0J',
22
+ // Styles
23
+ reset: '\x1b[0m',
24
+ bold: '\x1b[1m',
25
+ dim: '\x1b[2m',
26
+ italic: '\x1b[3m',
27
+ underline: '\x1b[4m',
28
+ // Colors (foreground) - keeping for compatibility
29
+ black: '\x1b[30m',
30
+ red: '\x1b[31m',
31
+ green: '\x1b[32m',
32
+ yellow: '\x1b[33m',
33
+ blue: '\x1b[34m',
34
+ magenta: '\x1b[35m',
35
+ cyan: '\x1b[36m',
36
+ white: '\x1b[37m',
37
+ brightBlack: '\x1b[90m',
38
+ brightRed: '\x1b[91m',
39
+ brightGreen: '\x1b[92m',
40
+ brightYellow: '\x1b[93m',
41
+ brightBlue: '\x1b[94m',
42
+ brightMagenta: '\x1b[95m',
43
+ brightCyan: '\x1b[96m',
44
+ brightWhite: '\x1b[97m',
45
+ };
46
+ /**
47
+ * Get terminal width
48
+ */
49
+ export function getTerminalWidth() {
50
+ return process.stdout.columns || 80;
51
+ }
52
+ /**
53
+ * Get terminal height
54
+ */
55
+ export function getTerminalHeight() {
56
+ return process.stdout.rows || 24;
57
+ }
58
+ /**
59
+ * Apply color to text (only if supported)
60
+ * Note: For semantic colors, use the theme system instead
61
+ */
62
+ export function colorize(text, ansiCode) {
63
+ if (process.env.NO_COLOR !== undefined || !process.stdout.isTTY) {
64
+ return text;
65
+ }
66
+ return `${ansiCode}${text}${ANSI.reset}`;
67
+ }
68
+ /**
69
+ * Apply multiple styles
70
+ */
71
+ export function style(text, ...styles) {
72
+ if (process.env.NO_COLOR !== undefined || !process.stdout.isTTY) {
73
+ return text;
74
+ }
75
+ return `${styles.join('')}${text}${ANSI.reset}`;
76
+ }
77
+ /**
78
+ * Clear current line and move cursor to start
79
+ */
80
+ export function clearLine() {
81
+ process.stdout.write(ANSI.clearLine + ANSI.moveToColumn(1));
82
+ }
83
+ /**
84
+ * Clear lines above (for redraw)
85
+ */
86
+ export function clearLinesAbove(count) {
87
+ for (let i = 0; i < count; i++) {
88
+ process.stdout.write(ANSI.moveCursorUp(1) + ANSI.clearLine);
89
+ }
90
+ }
91
+ /**
92
+ * Write a line that doesn't affect the input area
93
+ */
94
+ export function writeLine(text) {
95
+ // Save cursor, move to start of line, clear, write, restore
96
+ process.stdout.write(ANSI.saveCursor +
97
+ ANSI.clearLine +
98
+ text +
99
+ '\n' +
100
+ ANSI.restoreCursor);
101
+ }
102
+ /**
103
+ * Write text at a specific position
104
+ */
105
+ export function writeAt(row, col, text) {
106
+ process.stdout.write(ANSI.moveToStart +
107
+ `\x1b[${row};${col}H` +
108
+ text);
109
+ }
110
+ /**
111
+ * Hide cursor
112
+ */
113
+ export function hideCursor() {
114
+ process.stdout.write('\x1b[?25l');
115
+ }
116
+ /**
117
+ * Show cursor
118
+ */
119
+ export function showCursor() {
120
+ process.stdout.write('\x1b[?25h');
121
+ }
122
+ /**
123
+ * Enable raw mode (for special key handling)
124
+ */
125
+ export function enableRawMode() {
126
+ if (process.stdin.isTTY) {
127
+ process.stdin.setRawMode(true);
128
+ }
129
+ }
130
+ /**
131
+ * Disable raw mode
132
+ */
133
+ export function disableRawMode() {
134
+ if (process.stdin.isTTY) {
135
+ process.stdin.setRawMode(false);
136
+ }
137
+ }
138
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../../src/ui/terminal/output.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAChB,kBAAkB;IAClB,UAAU,EAAE,QAAQ;IACpB,aAAa,EAAE,QAAQ;IACvB,YAAY,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG;IACzC,cAAc,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG;IAC3C,cAAc,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG;IAC3C,eAAe,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG;IAC5C,YAAY,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG;IACzC,WAAW,EAAE,QAAQ;IAErB,kBAAkB;IAClB,SAAS,EAAE,SAAS;IACpB,WAAW,EAAE,SAAS;IACtB,UAAU,EAAE,SAAS;IAErB,SAAS;IACT,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,SAAS;IAEpB,kDAAkD;IAClD,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,E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CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;AACL,CAAC"}
@@ -0,0 +1,157 @@
1
+ /**
2
+ * Color Theme System
3
+ * Unified semantic color definitions with NO_COLOR support
4
+ */
5
+ /**
6
+ * Check if colors are supported
7
+ */
8
+ export declare function supportsColor(): boolean;
9
+ /**
10
+ * Semantic color definitions
11
+ */
12
+ export declare const COLORS: {
13
+ success: {
14
+ code: string;
15
+ symbol: string;
16
+ };
17
+ error: {
18
+ code: string;
19
+ symbol: string;
20
+ };
21
+ warning: {
22
+ code: string;
23
+ symbol: string;
24
+ };
25
+ info: {
26
+ code: string;
27
+ symbol: string;
28
+ };
29
+ primary: {
30
+ code: string;
31
+ symbol: string;
32
+ };
33
+ secondary: {
34
+ code: string;
35
+ symbol: string;
36
+ };
37
+ text: {
38
+ code: string;
39
+ };
40
+ textDim: {
41
+ code: string;
42
+ };
43
+ mcp: {
44
+ code: string;
45
+ symbol: string;
46
+ };
47
+ tool: {
48
+ code: string;
49
+ symbol: string;
50
+ };
51
+ thinking: {
52
+ code: string;
53
+ symbol: string;
54
+ };
55
+ };
56
+ /**
57
+ * Color utility functions
58
+ */
59
+ /**
60
+ * Apply a color code to text (only if colors are supported)
61
+ */
62
+ export declare function colorize(text: string, colorCode: string): string;
63
+ /**
64
+ * Apply bold style
65
+ */
66
+ export declare function bold(text: string): string;
67
+ /**
68
+ * Apply dim style
69
+ */
70
+ export declare function dim(text: string): string;
71
+ /**
72
+ * Semantic color functions
73
+ */
74
+ /**
75
+ * Style text as success
76
+ */
77
+ export declare function success(text: string): string;
78
+ /**
79
+ * Style text as error
80
+ */
81
+ export declare function error(text: string): string;
82
+ /**
83
+ * Style text as warning
84
+ */
85
+ export declare function warning(text: string): string;
86
+ /**
87
+ * Style text as info
88
+ */
89
+ export declare function info(text: string): string;
90
+ /**
91
+ * Style text as primary (brand)
92
+ */
93
+ export declare function primary(text: string): string;
94
+ /**
95
+ * Style text as secondary (accent)
96
+ */
97
+ export declare function secondary(text: string): string;
98
+ /**
99
+ * Style text as dim
100
+ */
101
+ export declare function muted(text: string): string;
102
+ /**
103
+ * Get success symbol (with or without color)
104
+ */
105
+ export declare function successSymbol(): string;
106
+ /**
107
+ * Get error symbol (with or without color)
108
+ */
109
+ export declare function errorSymbol(): string;
110
+ /**
111
+ * Get warning symbol (with or without color)
112
+ */
113
+ export declare function warningSymbol(): string;
114
+ /**
115
+ * Get info symbol (with or without color)
116
+ */
117
+ export declare function infoSymbol(): string;
118
+ /**
119
+ * Get MCP tool symbol
120
+ */
121
+ export declare function mcpSymbol(): string;
122
+ /**
123
+ * Get tool symbol
124
+ */
125
+ export declare function toolSymbol(): string;
126
+ /**
127
+ * Get thinking symbol
128
+ */
129
+ export declare function thinkingSymbol(): string;
130
+ /**
131
+ * Create a styled message with dual encoding (color + symbol)
132
+ */
133
+ export declare function styledMessage(type: 'success' | 'error' | 'warning' | 'info', message: string): string;
134
+ /**
135
+ * Export theme as object for convenience
136
+ */
137
+ export declare const theme: {
138
+ colorize: typeof colorize;
139
+ bold: typeof bold;
140
+ dim: typeof dim;
141
+ success: typeof success;
142
+ error: typeof error;
143
+ warning: typeof warning;
144
+ info: typeof info;
145
+ primary: typeof primary;
146
+ secondary: typeof secondary;
147
+ muted: typeof muted;
148
+ successSymbol: typeof successSymbol;
149
+ errorSymbol: typeof errorSymbol;
150
+ warningSymbol: typeof warningSymbol;
151
+ infoSymbol: typeof infoSymbol;
152
+ mcpSymbol: typeof mcpSymbol;
153
+ toolSymbol: typeof toolSymbol;
154
+ thinkingSymbol: typeof thinkingSymbol;
155
+ styledMessage: typeof styledMessage;
156
+ };
157
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/theme/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAIvC;AA6BD;;GAEG;AACH,eAAO,MAAM,M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;AACH,wBAAgB,aAAa,CACzB,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,EAC9C,OAAO,EAAE,MAAM,GAChB,MAAM,CAGR;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;CAmBjB,CAAC"}
@@ -0,0 +1,236 @@
1
+ /**
2
+ * Color Theme System
3
+ * Unified semantic color definitions with NO_COLOR support
4
+ */
5
+ /**
6
+ * Check if colors are supported
7
+ */
8
+ export function supportsColor() {
9
+ return process.env.NO_COLOR === undefined &&
10
+ process.stdout.isTTY &&
11
+ process.env.TERM !== 'dumb';
12
+ }
13
+ /**
14
+ * ANSI color codes
15
+ */
16
+ const ANSI = {
17
+ reset: '\x1b[0m',
18
+ bold: '\x1b[1m',
19
+ dim: '\x1b[2m',
20
+ // Foreground colors
21
+ black: '\x1b[30m',
22
+ red: '\x1b[31m',
23
+ green: '\x1b[32m',
24
+ yellow: '\x1b[33m',
25
+ blue: '\x1b[34m',
26
+ magenta: '\x1b[35m',
27
+ cyan: '\x1b[36m',
28
+ white: '\x1b[37m',
29
+ brightBlack: '\x1b[90m',
30
+ brightRed: '\x1b[91m',
31
+ brightGreen: '\x1b[92m',
32
+ brightYellow: '\x1b[93m',
33
+ brightBlue: '\x1b[94m',
34
+ brightMagenta: '\x1b[95m',
35
+ brightCyan: '\x1b[96m',
36
+ brightWhite: '\x1b[97m',
37
+ };
38
+ /**
39
+ * Semantic color definitions
40
+ */
41
+ export const COLORS = {
42
+ // Status colors with semantic meaning
43
+ success: {
44
+ code: ANSI.brightGreen,
45
+ symbol: '✓',
46
+ },
47
+ error: {
48
+ code: ANSI.brightRed,
49
+ symbol: '✗',
50
+ },
51
+ warning: {
52
+ code: ANSI.brightYellow,
53
+ symbol: '⚠',
54
+ },
55
+ info: {
56
+ code: ANSI.brightCyan,
57
+ symbol: 'ℹ',
58
+ },
59
+ // Brand colors
60
+ primary: {
61
+ code: ANSI.brightMagenta, // AI brand color
62
+ symbol: '◆',
63
+ },
64
+ secondary: {
65
+ code: ANSI.brightBlue, // Accent color
66
+ symbol: '◇',
67
+ },
68
+ // Text colors
69
+ text: {
70
+ code: ANSI.white,
71
+ },
72
+ textDim: {
73
+ code: ANSI.brightBlack,
74
+ },
75
+ // Special indicators
76
+ mcp: {
77
+ code: ANSI.brightMagenta,
78
+ symbol: '🔗',
79
+ },
80
+ tool: {
81
+ code: ANSI.brightYellow,
82
+ symbol: '⚙',
83
+ },
84
+ thinking: {
85
+ code: ANSI.brightCyan,
86
+ symbol: '⋯',
87
+ },
88
+ };
89
+ /**
90
+ * Color utility functions
91
+ */
92
+ /**
93
+ * Apply a color code to text (only if colors are supported)
94
+ */
95
+ export function colorize(text, colorCode) {
96
+ if (!supportsColor()) {
97
+ return text;
98
+ }
99
+ return `${colorCode}${text}${ANSI.reset}`;
100
+ }
101
+ /**
102
+ * Apply bold style
103
+ */
104
+ export function bold(text) {
105
+ if (!supportsColor()) {
106
+ return text;
107
+ }
108
+ return `${ANSI.bold}${text}${ANSI.reset}`;
109
+ }
110
+ /**
111
+ * Apply dim style
112
+ */
113
+ export function dim(text) {
114
+ if (!supportsColor()) {
115
+ return text;
116
+ }
117
+ return `${ANSI.dim}${text}${ANSI.reset}`;
118
+ }
119
+ /**
120
+ * Semantic color functions
121
+ */
122
+ /**
123
+ * Style text as success
124
+ */
125
+ export function success(text) {
126
+ return colorize(text, COLORS.success.code);
127
+ }
128
+ /**
129
+ * Style text as error
130
+ */
131
+ export function error(text) {
132
+ return colorize(text, COLORS.error.code);
133
+ }
134
+ /**
135
+ * Style text as warning
136
+ */
137
+ export function warning(text) {
138
+ return colorize(text, COLORS.warning.code);
139
+ }
140
+ /**
141
+ * Style text as info
142
+ */
143
+ export function info(text) {
144
+ return colorize(text, COLORS.info.code);
145
+ }
146
+ /**
147
+ * Style text as primary (brand)
148
+ */
149
+ export function primary(text) {
150
+ return colorize(text, COLORS.primary.code);
151
+ }
152
+ /**
153
+ * Style text as secondary (accent)
154
+ */
155
+ export function secondary(text) {
156
+ return colorize(text, COLORS.secondary.code);
157
+ }
158
+ /**
159
+ * Style text as dim
160
+ */
161
+ export function muted(text) {
162
+ return dim(text);
163
+ }
164
+ /**
165
+ * Get success symbol (with or without color)
166
+ */
167
+ export function successSymbol() {
168
+ return colorize(COLORS.success.symbol, COLORS.success.code);
169
+ }
170
+ /**
171
+ * Get error symbol (with or without color)
172
+ */
173
+ export function errorSymbol() {
174
+ return colorize(COLORS.error.symbol, COLORS.error.code);
175
+ }
176
+ /**
177
+ * Get warning symbol (with or without color)
178
+ */
179
+ export function warningSymbol() {
180
+ return colorize(COLORS.warning.symbol, COLORS.warning.code);
181
+ }
182
+ /**
183
+ * Get info symbol (with or without color)
184
+ */
185
+ export function infoSymbol() {
186
+ return colorize(COLORS.info.symbol, COLORS.info.code);
187
+ }
188
+ /**
189
+ * Get MCP tool symbol
190
+ */
191
+ export function mcpSymbol() {
192
+ return colorize(COLORS.mcp.symbol, COLORS.mcp.code);
193
+ }
194
+ /**
195
+ * Get tool symbol
196
+ */
197
+ export function toolSymbol() {
198
+ return colorize(COLORS.tool.symbol, COLORS.tool.code);
199
+ }
200
+ /**
201
+ * Get thinking symbol
202
+ */
203
+ export function thinkingSymbol() {
204
+ return colorize(COLORS.thinking.symbol, COLORS.thinking.code);
205
+ }
206
+ /**
207
+ * Create a styled message with dual encoding (color + symbol)
208
+ */
209
+ export function styledMessage(type, message) {
210
+ const color = COLORS[type];
211
+ return colorize(`${color.symbol} ${message}`, color.code);
212
+ }
213
+ /**
214
+ * Export theme as object for convenience
215
+ */
216
+ export const theme = {
217
+ colorize,
218
+ bold,
219
+ dim,
220
+ success,
221
+ error,
222
+ warning,
223
+ info,
224
+ primary,
225
+ secondary,
226
+ muted,
227
+ successSymbol,
228
+ errorSymbol,
229
+ warningSymbol,
230
+ infoSymbol,
231
+ mcpSymbol,
232
+ toolSymbol,
233
+ thinkingSymbol,
234
+ styledMessage,
235
+ };
236
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ui/theme/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,UAAU,aAAa;IACzB,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS;QACrC,OAAO,CAAC,MAAM,CAAC,KAAK;QACpB,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,IAAI,GAAG;IACT,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IAEd,oBAAoB;IACpB,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,UAAU;IACvB,SAAS,EAAE,UAAU;IACrB,WAAW,EAAE,UAAU;IACvB,YAAY,EAAE,UAAU;IACxB,UAAU,EAAE,UAAU;IACtB,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,UAAU;IACtB,WAAW,EAAE,UAAU;CAC1B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,sCAAsC;IACtC,OAAO,EAAE;QACL,IAAI,EAAE,IAAI,CAAC,WAAW;QACtB,MAAM,EAAE,GAAG;KACd;IACD,KAAK,EAAE;QACH,IAAI,EAAE,IAAI,CAAC,SAAS;QACpB,MAAM,EAAE,GAAG;KACd;IACD,OAAO,EAAE;QACL,IAAI,EAAE,IAAI,CAAC,YAAY;QACvB,MAAM,EAAE,GAAG;KACd;IACD,IAAI,EAAE;QACF,IAAI,EAAE,IAAI,CAAC,UAAU;QACrB,MAAM,EAAE,GAAG;KACd;IAED,eAAe;IACf,OA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aAAa;IACb,UAAU;IACV,SAAS;IACT,UAAU;IACV,cAAc;IACd,aAAa;CAChB,CAAC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Input History Management
3
+ * Persistent command history with search capabilities
4
+ */
5
+ /**
6
+ * History entry
7
+ */
8
+ export interface HistoryEntry {
9
+ command: string;
10
+ timestamp: number;
11
+ }
12
+ /**
13
+ * History options
14
+ */
15
+ export interface HistoryOptions {
16
+ maxSize?: number;
17
+ historyPath?: string;
18
+ }
19
+ /**
20
+ * Input History class
21
+ */
22
+ export declare class InputHistory {
23
+ private history;
24
+ private index;
25
+ private tempInput;
26
+ private options;
27
+ constructor(options?: HistoryOptions);
28
+ /**
29
+ * Load history from file
30
+ */
31
+ private load;
32
+ /**
33
+ * Save history to file
34
+ */
35
+ private save;
36
+ /**
37
+ * Add a command to history
38
+ */
39
+ add(command: string): void;
40
+ /**
41
+ * Get previous command (up arrow)
42
+ */
43
+ getPrevious(currentInput: string): string | null;
44
+ /**
45
+ * Get next command (down arrow)
46
+ */
47
+ getNext(): string | null;
48
+ /**
49
+ * Search backwards for matching command
50
+ */
51
+ search(prefix: string, startIndex?: number): {
52
+ command: string;
53
+ index: number;
54
+ } | null;
55
+ /**
56
+ * Fuzzy search in history
57
+ */
58
+ fuzzySearch(query: string, limit?: number): HistoryEntry[];
59
+ /**
60
+ * Get all history entries
61
+ */
62
+ getAll(): HistoryEntry[];
63
+ /**
64
+ * Get history entry at index
65
+ */
66
+ getAt(index: number): string | null;
67
+ /**
68
+ * Clear history
69
+ */
70
+ clear(): void;
71
+ /**
72
+ * Reset navigation index
73
+ */
74
+ resetIndex(): void;
75
+ /**
76
+ * Get size
77
+ */
78
+ get size(): number;
79
+ }
80
+ /**
81
+ * Get the history singleton
82
+ */
83
+ export declare function getHistory(): InputHistory;
84
+ /**
85
+ * Reset the history singleton (for testing)
86
+ */
87
+ export declare function resetHistory(): void;
88
+ //# sourceMappingURL=inputHistory.d.ts.map
@@ -0,0 +1 @@
1
+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