@sunub/obsidian-mcp-server 0.3.0 → 0.3.2

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 (128) hide show
  1. package/README.md +21 -5
  2. package/build/cli/app.d.ts +1 -0
  3. package/build/cli/colors.d.ts +15 -0
  4. package/build/cli/colors.js +15 -0
  5. package/build/cli/colors.js.map +1 -0
  6. package/build/cli/commands/types.d.ts +19 -0
  7. package/build/cli/commands/types.js +11 -0
  8. package/build/cli/commands/types.js.map +1 -0
  9. package/build/cli/config/mcpServersConfig.d.ts +15 -3
  10. package/build/cli/config/mcpServersConfig.js +1 -1
  11. package/build/cli/config/mcpServersConfig.js.map +1 -1
  12. package/build/cli/constants.d.ts +47 -0
  13. package/build/cli/constants.js +101 -0
  14. package/build/cli/constants.js.map +1 -0
  15. package/build/cli/index.d.ts +1 -0
  16. package/build/cli/index.js +16 -4
  17. package/build/cli/index.js.map +1 -1
  18. package/build/cli/key/input.d.ts +5 -0
  19. package/build/cli/key/input.js +9 -0
  20. package/build/cli/key/input.js.map +1 -0
  21. package/build/cli/key/mouse.d.ts +23 -0
  22. package/build/cli/key/mouse.js +155 -0
  23. package/build/cli/key/mouse.js.map +1 -0
  24. package/build/cli/key/text-buffer-bestcase.d.ts +867 -0
  25. package/build/cli/key/text-buffer.d.ts +509 -0
  26. package/build/cli/main.d.ts +1 -0
  27. package/build/cli/main.js +20 -0
  28. package/build/cli/main.js.map +1 -0
  29. package/build/cli/reference/text-buffer.d.ts +867 -0
  30. package/build/cli/reference/text-buffer.js +2754 -0
  31. package/build/cli/reference/text-buffer.js.map +1 -0
  32. package/build/cli/theme/builtin/default-dark.d.ts +7 -0
  33. package/build/cli/theme/builtin/default-dark.js +143 -0
  34. package/build/cli/theme/builtin/default-dark.js.map +1 -0
  35. package/build/cli/theme/builtin/no-color.d.ts +7 -0
  36. package/build/cli/theme/builtin/tokyonight-dark.d.ts +7 -0
  37. package/build/cli/theme/semantic-colors.d.ts +2 -0
  38. package/build/cli/theme/semantic-tokens.d.ts +42 -0
  39. package/build/cli/theme/theme.d.ts +107 -0
  40. package/build/cli/tmp.d.ts +1 -0
  41. package/build/cli/utils/cache.d.ts +21 -0
  42. package/build/cli/utils/cache.js +56 -0
  43. package/build/cli/utils/cache.js.map +1 -0
  44. package/build/cli/utils/debugLogger.js +5 -5
  45. package/build/cli/utils/debugLogger.js.map +1 -1
  46. package/build/config.d.ts +30 -0
  47. package/build/config.js +1 -1
  48. package/build/config.js.map +1 -1
  49. package/build/db.d.ts +1 -0
  50. package/build/index.d.ts +2 -0
  51. package/build/index.js +4 -2
  52. package/build/index.js.map +1 -1
  53. package/build/server.d.ts +2 -0
  54. package/build/server.js +39 -0
  55. package/build/server.js.map +1 -0
  56. package/build/tools/create_document_with_properties/params.d.ts +2 -2
  57. package/build/tools/create_document_with_properties/params.js +33 -0
  58. package/build/tools/create_document_with_properties/params.js.map +1 -0
  59. package/build/tools/generate_property/index.d.ts +34 -0
  60. package/build/tools/generate_property/params.d.ts +48 -0
  61. package/build/tools/generate_property/params.js +55 -0
  62. package/build/tools/generate_property/params.js.map +1 -0
  63. package/build/tools/index.js +13 -0
  64. package/build/tools/index.js.map +1 -0
  65. package/build/tools/organize_attachments/index.d.ts +32 -0
  66. package/build/tools/organize_attachments/params.d.ts +16 -16
  67. package/build/tools/organize_attachments/params.js +61 -0
  68. package/build/tools/organize_attachments/params.js.map +1 -0
  69. package/build/tools/organize_attachments/utils.d.ts +22 -0
  70. package/build/tools/organize_attachments/utils.js +66 -0
  71. package/build/tools/organize_attachments/utils.js.map +1 -0
  72. package/build/tools/vault/index.d.ts +50 -0
  73. package/build/tools/vault/metrics.d.ts +25 -0
  74. package/build/tools/vault/metrics.js +130 -0
  75. package/build/tools/vault/metrics.js.map +1 -0
  76. package/build/tools/vault/params.d.ts +12 -12
  77. package/build/tools/vault/params.js +148 -0
  78. package/build/tools/vault/params.js.map +1 -0
  79. package/build/tools/vault/types/collect_context.d.ts +249 -249
  80. package/build/tools/vault/types/collect_context.js +103 -0
  81. package/build/tools/vault/types/collect_context.js.map +1 -0
  82. package/build/tools/vault/types/list_all.d.ts +14 -14
  83. package/build/tools/vault/types/list_all.js +53 -0
  84. package/build/tools/vault/types/list_all.js.map +1 -0
  85. package/build/tools/vault/types/read_specific.d.ts +18 -18
  86. package/build/tools/vault/types/read_specific.js +41 -0
  87. package/build/tools/vault/types/read_specific.js.map +1 -0
  88. package/build/tools/vault/types/search.d.ts +22 -22
  89. package/build/tools/vault/types/search.js +59 -0
  90. package/build/tools/vault/types/search.js.map +1 -0
  91. package/build/tools/vault/utils/actions/collect_context.d.ts +4 -0
  92. package/build/tools/vault/utils/actions/index_rag.d.ts +2 -0
  93. package/build/tools/vault/utils/actions/list_all.d.ts +4 -0
  94. package/build/tools/vault/utils/actions/load_memory.d.ts +4 -0
  95. package/build/tools/vault/utils/actions/read.d.ts +4 -0
  96. package/build/tools/vault/utils/actions/search.d.ts +4 -0
  97. package/build/tools/vault/utils/actions/search_semantic.d.ts +3 -0
  98. package/build/tools/vault/utils/actions/search_semantic.js +23 -6
  99. package/build/tools/vault/utils/actions/search_semantic.js.map +1 -1
  100. package/build/tools/vault/utils/actions/stats.d.ts +3 -0
  101. package/build/tools/vault/utils/constants.d.ts +2 -0
  102. package/build/tools/vault/utils/constants.js +3 -0
  103. package/build/tools/vault/utils/constants.js.map +1 -0
  104. package/build/tools/vault/utils/document.d.ts +35 -0
  105. package/build/tools/vault/utils/shared.d.ts +29 -0
  106. package/build/tools/vault/utils/shared.js +75 -0
  107. package/build/tools/vault/utils/shared.js.map +1 -0
  108. package/build/tools/vault/utils.d.ts +8 -0
  109. package/build/tools/vault/utils.js +9 -0
  110. package/build/tools/vault/utils.js.map +1 -0
  111. package/build/tools/write_property/params.d.ts +60 -0
  112. package/build/tools/write_property/params.js +52 -0
  113. package/build/tools/write_property/params.js.map +1 -0
  114. package/build/utils/LLMClient.d.ts +1 -3
  115. package/build/utils/LLMClient.js +18 -4
  116. package/build/utils/LLMClient.js.map +1 -1
  117. package/build/utils/RerankerClient.d.ts +38 -4
  118. package/build/utils/RerankerClient.js +2 -1
  119. package/build/utils/RerankerClient.js.map +1 -1
  120. package/build/utils/VaultWatcher.js +35 -28
  121. package/build/utils/VaultWatcher.js.map +1 -1
  122. package/build/utils/processor/types.d.ts +2 -2
  123. package/build/utils/processor/types.js +21 -0
  124. package/build/utils/processor/types.js.map +1 -0
  125. package/build/utils/semaphore.d.ts +7 -0
  126. package/build/utils/semaphore.js +26 -0
  127. package/build/utils/semaphore.js.map +1 -0
  128. package/package.json +4 -2
@@ -0,0 +1,509 @@
1
+ import type { Key } from "../context/KeypressContext.js";
2
+ export declare const PASTED_TEXT_PLACEHOLDER_REGEX: RegExp;
3
+ export interface TextBuffer {
4
+ lines: string[];
5
+ text: string;
6
+ cursor: [number, number];
7
+ /**
8
+ * When the user moves the caret vertically we try to keep their original
9
+ * horizontal column even when passing through shorter lines. We remember
10
+ * that *preferred* column in this field while the user is still travelling
11
+ * vertically. Any explicit horizontal movement resets the preference.
12
+ */
13
+ preferredCol: number | null;
14
+ selectionAnchor: [number, number] | null;
15
+ pastedContent: Record<string, string>;
16
+ allVisualLines: string[];
17
+ viewportVisualLines: string[];
18
+ visualCursor: [number, number];
19
+ visualScrollRow: number;
20
+ viewportHeight: number;
21
+ /**
22
+ * For each visual line (by absolute index in allVisualLines) provides a tuple
23
+ * [logicalLineIndex, startColInLogical] that maps where that visual line
24
+ * begins within the logical buffer. Indices are code-point based.
25
+ */
26
+ visualToLogicalMap: Array<[number, number]>;
27
+ /**
28
+ * For each logical line, an array mapping transformed positions (in the transformed
29
+ * line) back to logical column indices.
30
+ */
31
+ transformedToLogicalMaps: number[][];
32
+ /**
33
+ * For each visual line (absolute index across all visual lines), the start index
34
+ * within that logical line's transformed content.
35
+ */
36
+ visualToTransformedMap: number[];
37
+ /** Cached transformations per logical line */
38
+ visualLayout: VisualLayout;
39
+ /**
40
+ * Replaces the entire buffer content with the provided text.
41
+ * The operation is undoable.
42
+ */
43
+ setText: (text: string, cursorPosition?: "start" | "end" | number) => void;
44
+ /**
45
+ * Insert a single character or string without newlines.
46
+ */
47
+ insert: (ch: string, opts?: {
48
+ paste?: boolean;
49
+ }) => void;
50
+ newline: () => void;
51
+ backspace: () => void;
52
+ del: () => void;
53
+ move: (dir: Direction) => void;
54
+ undo: () => void;
55
+ redo: () => void;
56
+ /**
57
+ * Replaces the text within the specified range with new text.
58
+ * Handles both single-line and multi-line ranges.
59
+ *
60
+ * @param startRow The starting row index (inclusive).
61
+ * @param startCol The starting column index (inclusive, code-point based).
62
+ * @param endRow The ending row index (inclusive).
63
+ * @param endCol The ending column index (exclusive, code-point based).
64
+ * @param text The new text to insert.
65
+ * @returns True if the buffer was modified, false otherwise.
66
+ */
67
+ replaceRange: (startRow: number, startCol: number, endRow: number, endCol: number, text: string) => void;
68
+ /**
69
+ * Delete the word to the *left* of the caret, mirroring common
70
+ * Ctrl/Alt+Backspace behaviour in editors & terminals. Both the adjacent
71
+ * whitespace *and* the word characters immediately preceding the caret are
72
+ * removed. If the caret is already at column‑0 this becomes a no-op.
73
+ */
74
+ deleteWordLeft: () => void;
75
+ /**
76
+ * Delete the word to the *right* of the caret, akin to many editors'
77
+ * Ctrl/Alt+Delete shortcut. Removes any whitespace/punctuation that
78
+ * follows the caret and the next contiguous run of word characters.
79
+ */
80
+ deleteWordRight: () => void;
81
+ /**
82
+ * Deletes text from the cursor to the end of the current line.
83
+ */
84
+ killLineRight: () => void;
85
+ /**
86
+ * Deletes text from the start of the current line to the cursor.
87
+ */
88
+ killLineLeft: () => void;
89
+ /**
90
+ * High level "handleInput" – receives what Ink gives us.
91
+ */
92
+ handleInput: (key: Key) => boolean;
93
+ /**
94
+ * Opens the current buffer contents in the user's preferred terminal text
95
+ * editor ($VISUAL or $EDITOR, falling back to "vi"). The method blocks
96
+ * until the editor exits, then reloads the file and replaces the in‑memory
97
+ * buffer with whatever the user saved.
98
+ *
99
+ * The operation is treated as a single undoable edit – we snapshot the
100
+ * previous state *once* before launching the editor so one `undo()` will
101
+ * revert the entire change set.
102
+ *
103
+ * Note: We purposefully rely on the *synchronous* spawn API so that the
104
+ * calling process genuinely waits for the editor to close before
105
+ * continuing. This mirrors Git's behaviour and simplifies downstream
106
+ * control‑flow (callers can simply `await` the Promise).
107
+ */
108
+ openInExternalEditor: () => Promise<void>;
109
+ replaceRangeByOffset: (startOffset: number, endOffset: number, replacementText: string) => void;
110
+ getOffset: () => number;
111
+ moveToOffset(offset: number): void;
112
+ moveToVisualPosition(visualRow: number, visualCol: number): void;
113
+ /**
114
+ * Convert visual coordinates to logical position without moving cursor.
115
+ * Returns null if the position is out of bounds.
116
+ */
117
+ getLogicalPositionFromVisual(visualRow: number, visualCol: number): {
118
+ row: number;
119
+ col: number;
120
+ } | null;
121
+ /**
122
+ * Check if a line index falls within an expanded paste region.
123
+ * Returns the paste placeholder ID if found, null otherwise.
124
+ */
125
+ getExpandedPasteAtLine(lineIndex: number): string | null;
126
+ /**
127
+ * Toggle expansion state for a paste placeholder.
128
+ * If collapsed, expands to show full content inline.
129
+ * If expanded, collapses back to placeholder.
130
+ */
131
+ togglePasteExpansion(id: string, row: number, col: number): void;
132
+ /**
133
+ * The current expanded paste info (read-only).
134
+ */
135
+ /**
136
+ * Delete N words forward from cursor position (vim 'dw' command)
137
+ */
138
+ vimDeleteWordForward: (count: number) => void;
139
+ /**
140
+ * Delete N words backward from cursor position (vim 'db' command)
141
+ */
142
+ vimDeleteWordBackward: (count: number) => void;
143
+ /**
144
+ * Delete to end of N words from cursor position (vim 'de' command)
145
+ */
146
+ vimDeleteWordEnd: (count: number) => void;
147
+ /**
148
+ * Delete N big words forward from cursor position (vim 'dW' command)
149
+ */
150
+ vimDeleteBigWordForward: (count: number) => void;
151
+ /**
152
+ * Delete N big words backward from cursor position (vim 'dB' command)
153
+ */
154
+ vimDeleteBigWordBackward: (count: number) => void;
155
+ /**
156
+ * Delete to end of N big words from cursor position (vim 'dE' command)
157
+ */
158
+ vimDeleteBigWordEnd: (count: number) => void;
159
+ /**
160
+ * Change N words forward from cursor position (vim 'cw' command)
161
+ */
162
+ vimChangeWordForward: (count: number) => void;
163
+ /**
164
+ * Change N words backward from cursor position (vim 'cb' command)
165
+ */
166
+ vimChangeWordBackward: (count: number) => void;
167
+ /**
168
+ * Change to end of N words from cursor position (vim 'ce' command)
169
+ */
170
+ vimChangeWordEnd: (count: number) => void;
171
+ /**
172
+ * Change N big words forward from cursor position (vim 'cW' command)
173
+ */
174
+ vimChangeBigWordForward: (count: number) => void;
175
+ /**
176
+ * Change N big words backward from cursor position (vim 'cB' command)
177
+ */
178
+ vimChangeBigWordBackward: (count: number) => void;
179
+ /**
180
+ * Change to end of N big words from cursor position (vim 'cE' command)
181
+ */
182
+ vimChangeBigWordEnd: (count: number) => void;
183
+ /**
184
+ * Delete N lines from cursor position (vim 'dd' command)
185
+ */
186
+ vimDeleteLine: (count: number) => void;
187
+ /**
188
+ * Change N lines from cursor position (vim 'cc' command)
189
+ */
190
+ vimChangeLine: (count: number) => void;
191
+ /**
192
+ * Delete from cursor to end of line (vim 'D' command)
193
+ * With count > 1, deletes to end of current line plus (count-1) additional lines
194
+ */
195
+ vimDeleteToEndOfLine: (count?: number) => void;
196
+ /**
197
+ * Delete from start of line to cursor (vim 'd0' command)
198
+ */
199
+ vimDeleteToStartOfLine: () => void;
200
+ /**
201
+ * Change from cursor to end of line (vim 'C' command)
202
+ * With count > 1, changes to end of current line plus (count-1) additional lines
203
+ */
204
+ vimChangeToEndOfLine: (count?: number) => void;
205
+ /**
206
+ * Delete from cursor to first non-whitespace character (vim 'd^' command)
207
+ */
208
+ vimDeleteToFirstNonWhitespace: () => void;
209
+ /**
210
+ * Change from cursor to start of line (vim 'c0' command)
211
+ */
212
+ vimChangeToStartOfLine: () => void;
213
+ /**
214
+ * Change from cursor to first non-whitespace character (vim 'c^' command)
215
+ */
216
+ vimChangeToFirstNonWhitespace: () => void;
217
+ /**
218
+ * Delete from current line to first line (vim 'dgg' command)
219
+ */
220
+ vimDeleteToFirstLine: (count: number) => void;
221
+ /**
222
+ * Delete from current line to last line (vim 'dG' command)
223
+ */
224
+ vimDeleteToLastLine: (count: number) => void;
225
+ /**
226
+ * Change movement operations (vim 'ch', 'cj', 'ck', 'cl' commands)
227
+ */
228
+ vimChangeMovement: (movement: "h" | "j" | "k" | "l", count: number) => void;
229
+ /**
230
+ * Move cursor left N times (vim 'h' command)
231
+ */
232
+ vimMoveLeft: (count: number) => void;
233
+ /**
234
+ * Move cursor right N times (vim 'l' command)
235
+ */
236
+ vimMoveRight: (count: number) => void;
237
+ /**
238
+ * Move cursor up N times (vim 'k' command)
239
+ */
240
+ vimMoveUp: (count: number) => void;
241
+ /**
242
+ * Move cursor down N times (vim 'j' command)
243
+ */
244
+ vimMoveDown: (count: number) => void;
245
+ /**
246
+ * Move cursor forward N words (vim 'w' command)
247
+ */
248
+ vimMoveWordForward: (count: number) => void;
249
+ /**
250
+ * Move cursor backward N words (vim 'b' command)
251
+ */
252
+ vimMoveWordBackward: (count: number) => void;
253
+ /**
254
+ * Move cursor to end of Nth word (vim 'e' command)
255
+ */
256
+ vimMoveWordEnd: (count: number) => void;
257
+ /**
258
+ * Move cursor forward N big words (vim 'W' command)
259
+ */
260
+ vimMoveBigWordForward: (count: number) => void;
261
+ /**
262
+ * Move cursor backward N big words (vim 'B' command)
263
+ */
264
+ vimMoveBigWordBackward: (count: number) => void;
265
+ /**
266
+ * Move cursor to end of Nth big word (vim 'E' command)
267
+ */
268
+ vimMoveBigWordEnd: (count: number) => void;
269
+ /**
270
+ * Delete N characters at cursor (vim 'x' command)
271
+ */
272
+ vimDeleteChar: (count: number) => void;
273
+ /** Delete N characters before cursor (vim 'X') */
274
+ vimDeleteCharBefore: (count: number) => void;
275
+ /** Toggle case of N characters at cursor (vim '~') */
276
+ vimToggleCase: (count: number) => void;
277
+ /** Replace N characters at cursor with char, stay in NORMAL mode (vim 'r') */
278
+ vimReplaceChar: (char: string, count: number) => void;
279
+ /** Move to Nth occurrence of char forward on line; till=true stops before it (vim 'f'/'t') */
280
+ vimFindCharForward: (char: string, count: number, till: boolean) => void;
281
+ /** Move to Nth occurrence of char backward on line; till=true stops after it (vim 'F'/'T') */
282
+ vimFindCharBackward: (char: string, count: number, till: boolean) => void;
283
+ /** Delete from cursor to Nth occurrence of char forward; till=true excludes the char (vim 'df'/'dt') */
284
+ vimDeleteToCharForward: (char: string, count: number, till: boolean) => void;
285
+ /** Delete from Nth occurrence of char backward to cursor; till=true excludes the char (vim 'dF'/'dT') */
286
+ vimDeleteToCharBackward: (char: string, count: number, till: boolean) => void;
287
+ /**
288
+ * Enter insert mode at cursor (vim 'i' command)
289
+ */
290
+ vimInsertAtCursor: () => void;
291
+ /**
292
+ * Enter insert mode after cursor (vim 'a' command)
293
+ */
294
+ vimAppendAtCursor: () => void;
295
+ /**
296
+ * Open new line below and enter insert mode (vim 'o' command)
297
+ */
298
+ vimOpenLineBelow: () => void;
299
+ /**
300
+ * Open new line above and enter insert mode (vim 'O' command)
301
+ */
302
+ vimOpenLineAbove: () => void;
303
+ /**
304
+ * Move to end of line and enter insert mode (vim 'A' command)
305
+ */
306
+ vimAppendAtLineEnd: () => void;
307
+ /**
308
+ * Move to first non-whitespace and enter insert mode (vim 'I' command)
309
+ */
310
+ vimInsertAtLineStart: () => void;
311
+ /**
312
+ * Move cursor to beginning of line (vim '0' command)
313
+ */
314
+ vimMoveToLineStart: () => void;
315
+ /**
316
+ * Move cursor to end of line (vim '$' command)
317
+ */
318
+ vimMoveToLineEnd: () => void;
319
+ /**
320
+ * Move cursor to first non-whitespace character (vim '^' command)
321
+ */
322
+ vimMoveToFirstNonWhitespace: () => void;
323
+ /**
324
+ * Move cursor to first line (vim 'gg' command)
325
+ */
326
+ vimMoveToFirstLine: () => void;
327
+ /**
328
+ * Move cursor to last line (vim 'G' command)
329
+ */
330
+ vimMoveToLastLine: () => void;
331
+ /**
332
+ * Move cursor to specific line number (vim '[N]G' command)
333
+ */
334
+ vimMoveToLine: (lineNumber: number) => void;
335
+ /**
336
+ * Handle escape from insert mode (moves cursor left if not at line start)
337
+ */
338
+ vimEscapeInsertMode: () => void;
339
+ /** Yank N lines into the unnamed register (vim 'yy' / 'Nyy') */
340
+ vimYankLine: (count: number) => void;
341
+ /** Yank forward N words into the unnamed register (vim 'yw') */
342
+ vimYankWordForward: (count: number) => void;
343
+ /** Yank forward N big words into the unnamed register (vim 'yW') */
344
+ vimYankBigWordForward: (count: number) => void;
345
+ /** Yank to end of N words into the unnamed register (vim 'ye') */
346
+ vimYankWordEnd: (count: number) => void;
347
+ /** Yank to end of N big words into the unnamed register (vim 'yE') */
348
+ vimYankBigWordEnd: (count: number) => void;
349
+ /** Yank from cursor to end of line into the unnamed register (vim 'y$') */
350
+ vimYankToEndOfLine: (count: number) => void;
351
+ /** Paste the unnamed register after cursor (vim 'p') */
352
+ vimPasteAfter: (count: number) => void;
353
+ /** Paste the unnamed register before cursor (vim 'P') */
354
+ vimPasteBefore: (count: number) => void;
355
+ }
356
+ export type Direction = "left" | "right" | "up" | "down" | "home" | "end";
357
+ /**
358
+ * Visual layout maps logical lines to visual (wrapped) lines.
359
+ */
360
+ export interface VisualLayout {
361
+ transformedToLogicalMaps: number[][];
362
+ visualLines: string[];
363
+ logicalToVisualMap: Array<Array<[number, number]>>;
364
+ visualToLogicalMap: Array<[number, number]>;
365
+ visualToTransformedMap: number[];
366
+ }
367
+ export interface TextBufferState {
368
+ lines: string[];
369
+ cursorRow: number;
370
+ cursorCol: number;
371
+ preferredCol: number | null;
372
+ undoStack: string[][];
373
+ redoStack: string[][];
374
+ viewportWidth: number;
375
+ viewportHeight: number;
376
+ visualScrollRow: number;
377
+ visualLayout: VisualLayout;
378
+ }
379
+ /**
380
+ * Helper: Converts logical row/col position to absolute text offset
381
+ */
382
+ export declare function logicalPosToOffset(lines: string[], row: number, col: number): number;
383
+ /**
384
+ * Helper: Converts absolute text offset to logical row/col position
385
+ */
386
+ export declare function offsetToLogicalPos(text: string, offset: number): [number, number];
387
+ export interface Transformation {
388
+ logStart: number;
389
+ logEnd: number;
390
+ logicalText: string;
391
+ collapsedText: string;
392
+ type: "image" | "paste";
393
+ id?: string;
394
+ }
395
+ export declare function calculateTransformationsForLine(line: string): Transformation[];
396
+ export declare function calculateTransformedLine(logLine: string, logIndex: number, logicalCursor: [number, number], transformations: Transformation[]): {
397
+ transformedLine: string;
398
+ transformedToLogMap: number[];
399
+ };
400
+ /**
401
+ * A simplified multi-line text buffer hook with viewport management.
402
+ */
403
+ export declare function useTextBuffer({ initialText, viewportWidth, viewportHeight, }: {
404
+ initialText: string;
405
+ viewportWidth: number;
406
+ viewportHeight: number;
407
+ }): {
408
+ lines: string[];
409
+ text: string;
410
+ cursor: [number, number];
411
+ preferredCol: number | null;
412
+ selectionAnchor: null;
413
+ pastedContent: {};
414
+ allVisualLines: string[];
415
+ viewportVisualLines: string[];
416
+ visualCursor: [number, number];
417
+ visualScrollRow: number;
418
+ viewportHeight: number;
419
+ visualToLogicalMap: [number, number][];
420
+ transformedToLogicalMaps: number[][];
421
+ visualToTransformedMap: number[];
422
+ visualLayout: VisualLayout;
423
+ insert: (text: string, opts?: {
424
+ paste?: boolean;
425
+ }) => void;
426
+ setText: (text: string, cursorPosition?: "start" | "end" | number) => void;
427
+ newline: () => void;
428
+ backspace: () => void;
429
+ del: () => void;
430
+ move: (dir: Direction) => void;
431
+ undo: () => void;
432
+ redo: () => void;
433
+ replaceRange: (startRow: number, startCol: number, endRow: number, endCol: number, text: string) => void;
434
+ deleteWordLeft: () => void;
435
+ deleteWordRight: () => void;
436
+ killLineRight: () => void;
437
+ killLineLeft: () => void;
438
+ handleInput: (key: Key) => boolean;
439
+ getOffset: () => number;
440
+ openInExternalEditor: () => Promise<void>;
441
+ replaceRangeByOffset: (_s: number, _e: number, _t: string) => void;
442
+ moveToOffset: (_offset: number) => void;
443
+ moveToVisualPosition: (_vr: number, _vc: number) => void;
444
+ getLogicalPositionFromVisual: (_vr: number, _vc: number) => null;
445
+ getExpandedPasteAtLine: (_lineIndex: number) => null;
446
+ togglePasteExpansion: (_id: string, _row: number, _col: number) => void;
447
+ vimDeleteWordForward: (_count: number) => void;
448
+ vimDeleteWordBackward: (_count: number) => void;
449
+ vimDeleteWordEnd: (_count: number) => void;
450
+ vimDeleteBigWordForward: (_count: number) => void;
451
+ vimDeleteBigWordBackward: (_count: number) => void;
452
+ vimDeleteBigWordEnd: (_count: number) => void;
453
+ vimChangeWordForward: (_count: number) => void;
454
+ vimChangeWordBackward: (_count: number) => void;
455
+ vimChangeWordEnd: (_count: number) => void;
456
+ vimChangeBigWordForward: (_count: number) => void;
457
+ vimChangeBigWordBackward: (_count: number) => void;
458
+ vimChangeBigWordEnd: (_count: number) => void;
459
+ vimDeleteLine: (_count: number) => void;
460
+ vimChangeLine: (_count: number) => void;
461
+ vimDeleteToEndOfLine: (_count?: number) => void;
462
+ vimDeleteToStartOfLine: () => void;
463
+ vimChangeToEndOfLine: (_count?: number) => void;
464
+ vimDeleteToFirstNonWhitespace: () => void;
465
+ vimChangeToStartOfLine: () => void;
466
+ vimChangeToFirstNonWhitespace: () => void;
467
+ vimDeleteToFirstLine: (_count: number) => void;
468
+ vimDeleteToLastLine: (_count: number) => void;
469
+ vimChangeMovement: (_m: "h" | "j" | "k" | "l", _count: number) => void;
470
+ vimMoveLeft: (_count: number) => void;
471
+ vimMoveRight: (_count: number) => void;
472
+ vimMoveUp: (_count: number) => void;
473
+ vimMoveDown: (_count: number) => void;
474
+ vimMoveWordForward: (_count: number) => void;
475
+ vimMoveWordBackward: (_count: number) => void;
476
+ vimMoveWordEnd: (_count: number) => void;
477
+ vimMoveBigWordForward: (_count: number) => void;
478
+ vimMoveBigWordBackward: (_count: number) => void;
479
+ vimMoveBigWordEnd: (_count: number) => void;
480
+ vimDeleteChar: (_count: number) => void;
481
+ vimDeleteCharBefore: (_count: number) => void;
482
+ vimToggleCase: (_count: number) => void;
483
+ vimReplaceChar: (_char: string, _count: number) => void;
484
+ vimFindCharForward: (_char: string, _count: number, _till: boolean) => void;
485
+ vimFindCharBackward: (_char: string, _count: number, _till: boolean) => void;
486
+ vimDeleteToCharForward: (_char: string, _count: number, _till: boolean) => void;
487
+ vimDeleteToCharBackward: (_char: string, _count: number, _till: boolean) => void;
488
+ vimInsertAtCursor: () => void;
489
+ vimAppendAtCursor: () => void;
490
+ vimOpenLineBelow: () => void;
491
+ vimOpenLineAbove: () => void;
492
+ vimAppendAtLineEnd: () => void;
493
+ vimInsertAtLineStart: () => void;
494
+ vimMoveToLineStart: () => void;
495
+ vimMoveToLineEnd: () => void;
496
+ vimMoveToFirstNonWhitespace: () => void;
497
+ vimMoveToFirstLine: () => void;
498
+ vimMoveToLastLine: () => void;
499
+ vimMoveToLine: (_count: number) => void;
500
+ vimEscapeInsertMode: () => void;
501
+ vimYankLine: (_count: number) => void;
502
+ vimYankWordForward: (_count: number) => void;
503
+ vimYankBigWordForward: (_count: number) => void;
504
+ vimYankWordEnd: (_count: number) => void;
505
+ vimYankBigWordEnd: (_count: number) => void;
506
+ vimYankToEndOfLine: (_count: number) => void;
507
+ vimPasteAfter: (_count: number) => void;
508
+ vimPasteBefore: (_count: number) => void;
509
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ process.on("uncaughtException", (error) => {
2
+ if (process.platform === "win32" &&
3
+ error instanceof Error &&
4
+ error.message === "Cannot resize a pty that has already exited.") {
5
+ // This error happens on Windows with node-pty when resizing a pty that has just exited.
6
+ // It is a race condition in node-pty that we cannot prevent, so we silence it.
7
+ return;
8
+ }
9
+ if (error instanceof Error) {
10
+ process.stderr.write(`${error.stack} + '\n'`);
11
+ }
12
+ else {
13
+ process.stderr.write(`${error} + '\n'`);
14
+ }
15
+ process.exit(1);
16
+ });
17
+ async function run() { }
18
+ run();
19
+ export {};
20
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE;IACzC,IACC,OAAO,CAAC,QAAQ,KAAK,OAAO;QAC5B,KAAK,YAAY,KAAK;QACtB,KAAK,CAAC,OAAO,KAAK,8CAA8C,EAC/D,CAAC;QACF,wFAAwF;QACxF,+EAA+E;QAC/E,OAAO;IACR,CAAC;IAED,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC;IAC/C,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,GAAG,KAAI,CAAC;AAEvB,GAAG,EAAE,CAAC"}