gsd-pi 2.10.0 → 2.10.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 (157) hide show
  1. package/node_modules/@gsd/native/dist/ast/index.d.ts +4 -0
  2. package/node_modules/@gsd/native/dist/ast/index.js +7 -0
  3. package/node_modules/@gsd/native/dist/ast/types.d.ts +69 -0
  4. package/node_modules/@gsd/native/dist/ast/types.js +1 -0
  5. package/node_modules/@gsd/native/{src/clipboard/index.ts → dist/clipboard/index.d.ts} +3 -15
  6. package/node_modules/@gsd/native/dist/clipboard/index.js +33 -0
  7. package/node_modules/@gsd/native/dist/clipboard/types.d.ts +7 -0
  8. package/node_modules/@gsd/native/dist/clipboard/types.js +1 -0
  9. package/node_modules/@gsd/native/dist/diff/index.d.ts +33 -0
  10. package/node_modules/@gsd/native/dist/diff/index.js +38 -0
  11. package/node_modules/@gsd/native/dist/diff/types.d.ts +23 -0
  12. package/node_modules/@gsd/native/dist/diff/types.js +1 -0
  13. package/node_modules/@gsd/native/{src/fd/index.ts → dist/fd/index.d.ts} +2 -12
  14. package/node_modules/@gsd/native/dist/fd/index.js +26 -0
  15. package/node_modules/@gsd/native/dist/fd/types.d.ts +29 -0
  16. package/node_modules/@gsd/native/dist/fd/types.js +1 -0
  17. package/node_modules/@gsd/native/{src/glob/index.ts → dist/glob/index.d.ts} +3 -19
  18. package/node_modules/@gsd/native/dist/glob/index.js +31 -0
  19. package/node_modules/@gsd/native/dist/glob/types.d.ts +50 -0
  20. package/node_modules/@gsd/native/dist/glob/types.js +1 -0
  21. package/node_modules/@gsd/native/dist/grep/index.d.ts +20 -0
  22. package/node_modules/@gsd/native/dist/grep/index.js +23 -0
  23. package/node_modules/@gsd/native/dist/grep/types.d.ts +99 -0
  24. package/node_modules/@gsd/native/dist/grep/types.js +1 -0
  25. package/node_modules/@gsd/native/dist/gsd-parser/index.d.ts +45 -0
  26. package/node_modules/@gsd/native/dist/gsd-parser/index.js +54 -0
  27. package/node_modules/@gsd/native/dist/gsd-parser/types.d.ts +55 -0
  28. package/node_modules/@gsd/native/dist/gsd-parser/types.js +7 -0
  29. package/node_modules/@gsd/native/{src/highlight/index.ts → dist/highlight/index.d.ts} +3 -19
  30. package/node_modules/@gsd/native/dist/highlight/index.js +33 -0
  31. package/node_modules/@gsd/native/dist/highlight/types.d.ts +25 -0
  32. package/node_modules/@gsd/native/dist/highlight/types.js +1 -0
  33. package/node_modules/@gsd/native/{src/html/index.ts → dist/html/index.d.ts} +1 -10
  34. package/node_modules/@gsd/native/dist/html/index.js +16 -0
  35. package/node_modules/@gsd/native/dist/html/types.d.ts +7 -0
  36. package/node_modules/@gsd/native/dist/html/types.js +1 -0
  37. package/node_modules/@gsd/native/{src/image/index.ts → dist/image/index.d.ts} +1 -14
  38. package/node_modules/@gsd/native/dist/image/index.js +18 -0
  39. package/node_modules/@gsd/native/dist/image/types.d.ts +35 -0
  40. package/node_modules/@gsd/native/dist/image/types.js +26 -0
  41. package/node_modules/@gsd/native/{src/index.ts → dist/index.d.ts} +12 -60
  42. package/node_modules/@gsd/native/dist/index.js +28 -0
  43. package/node_modules/@gsd/native/dist/native.d.ts +44 -0
  44. package/node_modules/@gsd/native/dist/native.js +34 -0
  45. package/node_modules/@gsd/native/dist/ps/index.d.ts +38 -0
  46. package/node_modules/@gsd/native/{src/ps/index.ts → dist/ps/index.js} +8 -13
  47. package/node_modules/@gsd/native/{src/ps/types.ts → dist/ps/types.d.ts} +2 -2
  48. package/node_modules/@gsd/native/dist/ps/types.js +1 -0
  49. package/node_modules/@gsd/native/{src/text/index.ts → dist/text/index.d.ts} +6 -76
  50. package/node_modules/@gsd/native/dist/text/index.js +66 -0
  51. package/node_modules/@gsd/native/dist/text/types.d.ts +27 -0
  52. package/node_modules/@gsd/native/dist/text/types.js +10 -0
  53. package/node_modules/@gsd/native/{src/ttsr/index.ts → dist/ttsr/index.d.ts} +3 -15
  54. package/node_modules/@gsd/native/dist/ttsr/index.js +32 -0
  55. package/node_modules/@gsd/native/{src/ttsr/types.ts → dist/ttsr/types.d.ts} +4 -5
  56. package/node_modules/@gsd/native/dist/ttsr/types.js +1 -0
  57. package/node_modules/@gsd/native/package.json +24 -23
  58. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.d.ts +11 -5
  59. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -1
  60. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.js +19 -142
  61. package/node_modules/@gsd/pi-coding-agent/dist/core/tools/edit-diff.js.map +1 -1
  62. package/node_modules/@gsd/pi-coding-agent/src/core/tools/edit-diff.ts +23 -157
  63. package/package.json +4 -2
  64. package/packages/native/dist/ast/index.d.ts +4 -0
  65. package/packages/native/dist/ast/index.js +7 -0
  66. package/packages/native/dist/ast/types.d.ts +69 -0
  67. package/packages/native/dist/ast/types.js +1 -0
  68. package/packages/native/dist/clipboard/index.d.ts +28 -0
  69. package/packages/native/dist/clipboard/index.js +33 -0
  70. package/packages/native/dist/clipboard/types.d.ts +7 -0
  71. package/packages/native/dist/clipboard/types.js +1 -0
  72. package/packages/native/dist/diff/index.d.ts +33 -0
  73. package/packages/native/dist/diff/index.js +38 -0
  74. package/packages/native/dist/diff/types.d.ts +23 -0
  75. package/packages/native/dist/diff/types.js +1 -0
  76. package/packages/native/dist/fd/index.d.ts +25 -0
  77. package/packages/native/dist/fd/index.js +26 -0
  78. package/packages/native/dist/fd/types.d.ts +29 -0
  79. package/packages/native/dist/fd/types.js +1 -0
  80. package/packages/native/dist/glob/index.d.ts +28 -0
  81. package/packages/native/dist/glob/index.js +31 -0
  82. package/packages/native/dist/glob/types.d.ts +50 -0
  83. package/packages/native/dist/glob/types.js +1 -0
  84. package/packages/native/dist/grep/index.d.ts +20 -0
  85. package/packages/native/dist/grep/index.js +23 -0
  86. package/packages/native/dist/grep/types.d.ts +99 -0
  87. package/packages/native/dist/grep/types.js +1 -0
  88. package/packages/native/dist/gsd-parser/index.d.ts +45 -0
  89. package/packages/native/dist/gsd-parser/index.js +54 -0
  90. package/packages/native/dist/gsd-parser/types.d.ts +55 -0
  91. package/packages/native/dist/gsd-parser/types.js +7 -0
  92. package/packages/native/dist/highlight/index.d.ts +28 -0
  93. package/packages/native/dist/highlight/index.js +33 -0
  94. package/packages/native/dist/highlight/types.d.ts +25 -0
  95. package/packages/native/dist/highlight/types.js +1 -0
  96. package/packages/native/dist/html/index.d.ts +15 -0
  97. package/packages/native/dist/html/index.js +16 -0
  98. package/packages/native/dist/html/types.d.ts +7 -0
  99. package/packages/native/dist/html/types.js +1 -0
  100. package/packages/native/dist/image/index.d.ts +15 -0
  101. package/packages/native/dist/image/index.js +18 -0
  102. package/packages/native/dist/image/types.d.ts +35 -0
  103. package/packages/native/dist/image/types.js +26 -0
  104. package/packages/native/dist/index.d.ts +40 -0
  105. package/packages/native/dist/index.js +28 -0
  106. package/packages/native/dist/native.d.ts +44 -0
  107. package/packages/native/dist/native.js +34 -0
  108. package/packages/native/dist/ps/index.d.ts +38 -0
  109. package/packages/native/dist/ps/index.js +47 -0
  110. package/packages/native/dist/ps/types.d.ts +5 -0
  111. package/packages/native/dist/ps/types.js +1 -0
  112. package/packages/native/dist/text/index.d.ts +55 -0
  113. package/packages/native/dist/text/index.js +66 -0
  114. package/packages/native/dist/text/types.d.ts +27 -0
  115. package/packages/native/dist/text/types.js +10 -0
  116. package/packages/native/dist/ttsr/index.d.ts +27 -0
  117. package/packages/native/dist/ttsr/index.js +32 -0
  118. package/packages/native/dist/ttsr/types.d.ts +9 -0
  119. package/packages/native/dist/ttsr/types.js +1 -0
  120. package/packages/native/package.json +24 -23
  121. package/packages/native/src/__tests__/diff.test.mjs +189 -0
  122. package/packages/native/src/__tests__/ttsr.test.mjs +135 -0
  123. package/packages/native/src/diff/index.ts +61 -0
  124. package/packages/native/src/diff/types.ts +24 -0
  125. package/packages/native/src/gsd-parser/index.ts +98 -0
  126. package/packages/native/src/gsd-parser/types.ts +62 -0
  127. package/packages/native/src/index.ts +23 -0
  128. package/packages/native/src/native.ts +8 -0
  129. package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts +11 -5
  130. package/packages/pi-coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -1
  131. package/packages/pi-coding-agent/dist/core/tools/edit-diff.js +19 -142
  132. package/packages/pi-coding-agent/dist/core/tools/edit-diff.js.map +1 -1
  133. package/packages/pi-coding-agent/src/core/tools/edit-diff.ts +23 -157
  134. package/src/resources/extensions/gsd/files.ts +9 -0
  135. package/src/resources/extensions/gsd/native-parser-bridge.ts +135 -0
  136. package/src/resources/extensions/ttsr/ttsr-manager.ts +86 -0
  137. package/node_modules/@gsd/native/src/__tests__/clipboard.test.mjs +0 -79
  138. package/node_modules/@gsd/native/src/__tests__/fd.test.mjs +0 -164
  139. package/node_modules/@gsd/native/src/__tests__/glob.test.mjs +0 -237
  140. package/node_modules/@gsd/native/src/__tests__/grep.test.mjs +0 -162
  141. package/node_modules/@gsd/native/src/__tests__/highlight.test.mjs +0 -156
  142. package/node_modules/@gsd/native/src/__tests__/html.test.mjs +0 -98
  143. package/node_modules/@gsd/native/src/__tests__/image.test.mjs +0 -137
  144. package/node_modules/@gsd/native/src/__tests__/ps.test.mjs +0 -109
  145. package/node_modules/@gsd/native/src/__tests__/text.test.mjs +0 -262
  146. package/node_modules/@gsd/native/src/ast/index.ts +0 -12
  147. package/node_modules/@gsd/native/src/ast/types.ts +0 -75
  148. package/node_modules/@gsd/native/src/clipboard/types.ts +0 -7
  149. package/node_modules/@gsd/native/src/fd/types.ts +0 -31
  150. package/node_modules/@gsd/native/src/glob/types.ts +0 -53
  151. package/node_modules/@gsd/native/src/grep/index.ts +0 -48
  152. package/node_modules/@gsd/native/src/grep/types.ts +0 -105
  153. package/node_modules/@gsd/native/src/highlight/types.ts +0 -25
  154. package/node_modules/@gsd/native/src/html/types.ts +0 -7
  155. package/node_modules/@gsd/native/src/image/types.ts +0 -41
  156. package/node_modules/@gsd/native/src/native.ts +0 -94
  157. package/node_modules/@gsd/native/src/text/types.ts +0 -29
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Cross-platform process tree management via N-API.
3
+ *
4
+ * Provides efficient process tree enumeration and termination
5
+ * using platform-native APIs (libproc on macOS, /proc on Linux,
6
+ * Toolhelp32 on Windows).
7
+ */
8
+ /**
9
+ * Kill a process tree (the process and all its descendants).
10
+ *
11
+ * Kills children first (bottom-up) to prevent orphan re-parenting issues.
12
+ * @param pid - Root process ID
13
+ * @param signal - Signal to send (e.g. 9 for SIGKILL, 15 for SIGTERM). Ignored on Windows.
14
+ * @returns Number of processes successfully killed.
15
+ */
16
+ export declare function killTree(pid: number, signal: number): number;
17
+ /**
18
+ * List all descendant PIDs of a process.
19
+ *
20
+ * @param pid - Parent process ID
21
+ * @returns Array of descendant PIDs (empty if no children or process doesn't exist).
22
+ */
23
+ export declare function listDescendants(pid: number): number[];
24
+ /**
25
+ * Get the process group ID for a process.
26
+ *
27
+ * @param pid - Process ID
28
+ * @returns Process group ID, or null if the process doesn't exist or on Windows.
29
+ */
30
+ export declare function processGroupId(pid: number): number | null;
31
+ /**
32
+ * Kill an entire process group.
33
+ *
34
+ * @param pgid - Process group ID
35
+ * @param signal - Signal to send
36
+ * @returns true if the signal was delivered, false on failure or Windows.
37
+ */
38
+ export declare function killProcessGroup(pgid: number, signal: number): boolean;
@@ -5,9 +5,7 @@
5
5
  * using platform-native APIs (libproc on macOS, /proc on Linux,
6
6
  * Toolhelp32 on Windows).
7
7
  */
8
-
9
8
  import { native } from "../native.js";
10
-
11
9
  /**
12
10
  * Kill a process tree (the process and all its descendants).
13
11
  *
@@ -16,30 +14,27 @@ import { native } from "../native.js";
16
14
  * @param signal - Signal to send (e.g. 9 for SIGKILL, 15 for SIGTERM). Ignored on Windows.
17
15
  * @returns Number of processes successfully killed.
18
16
  */
19
- export function killTree(pid: number, signal: number): number {
20
- return native.killTree(pid, signal);
17
+ export function killTree(pid, signal) {
18
+ return native.killTree(pid, signal);
21
19
  }
22
-
23
20
  /**
24
21
  * List all descendant PIDs of a process.
25
22
  *
26
23
  * @param pid - Parent process ID
27
24
  * @returns Array of descendant PIDs (empty if no children or process doesn't exist).
28
25
  */
29
- export function listDescendants(pid: number): number[] {
30
- return native.listDescendants(pid);
26
+ export function listDescendants(pid) {
27
+ return native.listDescendants(pid);
31
28
  }
32
-
33
29
  /**
34
30
  * Get the process group ID for a process.
35
31
  *
36
32
  * @param pid - Process ID
37
33
  * @returns Process group ID, or null if the process doesn't exist or on Windows.
38
34
  */
39
- export function processGroupId(pid: number): number | null {
40
- return native.processGroupId(pid);
35
+ export function processGroupId(pid) {
36
+ return native.processGroupId(pid);
41
37
  }
42
-
43
38
  /**
44
39
  * Kill an entire process group.
45
40
  *
@@ -47,6 +42,6 @@ export function processGroupId(pid: number): number | null {
47
42
  * @param signal - Signal to send
48
43
  * @returns true if the signal was delivered, false on failure or Windows.
49
44
  */
50
- export function killProcessGroup(pgid: number, signal: number): boolean {
51
- return native.killProcessGroup(pgid, signal);
45
+ export function killProcessGroup(pgid, signal) {
46
+ return native.killProcessGroup(pgid, signal);
52
47
  }
@@ -1,5 +1,5 @@
1
1
  /** Result of a process tree kill operation. */
2
2
  export interface KillTreeResult {
3
- /** Number of processes successfully killed. */
4
- killed: number;
3
+ /** Number of processes successfully killed. */
4
+ killed: number;
5
5
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -4,13 +4,9 @@
4
4
  * High-performance UTF-16 native implementation with ASCII fast-paths,
5
5
  * single-pass ANSI scanning, and proper Unicode grapheme cluster support.
6
6
  */
7
-
8
- import { native } from "../native.js";
9
7
  import type { ExtractSegmentsResult, SliceResult } from "./types.js";
10
-
11
8
  export type { ExtractSegmentsResult, SliceResult };
12
9
  export { EllipsisKind } from "./types.js";
13
-
14
10
  /**
15
11
  * Word-wrap text to a visible width, preserving ANSI escape codes across
16
12
  * line breaks.
@@ -19,18 +15,7 @@ export { EllipsisKind } from "./types.js";
19
15
  * Underline and strikethrough are reset at line ends and restored on the
20
16
  * next line.
21
17
  */
22
- export function wrapTextWithAnsi(
23
- text: string,
24
- width: number,
25
- tabWidth?: number,
26
- ): string[] {
27
- return (native as Record<string, Function>).wrapTextWithAnsi(
28
- text,
29
- width,
30
- tabWidth,
31
- ) as string[];
32
- }
33
-
18
+ export declare function wrapTextWithAnsi(text: string, width: number, tabWidth?: number): string[];
34
19
  /**
35
20
  * Truncate text to a visible width with an optional ellipsis.
36
21
  *
@@ -40,86 +25,31 @@ export function wrapTextWithAnsi(
40
25
  * @param pad When true, pad with spaces to exactly `maxWidth`.
41
26
  * @param tabWidth Tab stop width (default 3, range 1-16).
42
27
  */
43
- export function truncateToWidth(
44
- text: string,
45
- maxWidth: number,
46
- ellipsisKind: number,
47
- pad: boolean,
48
- tabWidth?: number,
49
- ): string {
50
- return (native as Record<string, Function>).truncateToWidth(
51
- text,
52
- maxWidth,
53
- ellipsisKind,
54
- pad,
55
- tabWidth,
56
- ) as string;
57
- }
58
-
28
+ export declare function truncateToWidth(text: string, maxWidth: number, ellipsisKind: number, pad: boolean, tabWidth?: number): string;
59
29
  /**
60
30
  * Slice a range of visible columns from a line.
61
31
  *
62
32
  * Counts terminal cells (skipping ANSI escapes). When `strict` is true,
63
33
  * wide characters that would exceed the range are excluded.
64
34
  */
65
- export function sliceWithWidth(
66
- line: string,
67
- startCol: number,
68
- length: number,
69
- strict: boolean,
70
- tabWidth?: number,
71
- ): SliceResult {
72
- return (native as Record<string, Function>).sliceWithWidth(
73
- line,
74
- startCol,
75
- length,
76
- strict,
77
- tabWidth,
78
- ) as SliceResult;
79
- }
80
-
35
+ export declare function sliceWithWidth(line: string, startCol: number, length: number, strict: boolean, tabWidth?: number): SliceResult;
81
36
  /**
82
37
  * Extract the before/after segments around an overlay region.
83
38
  *
84
39
  * ANSI state is tracked so the `after` segment renders correctly even when
85
40
  * the overlay truncates styled text.
86
41
  */
87
- export function extractSegments(
88
- line: string,
89
- beforeEnd: number,
90
- afterStart: number,
91
- afterLen: number,
92
- strictAfter: boolean,
93
- tabWidth?: number,
94
- ): ExtractSegmentsResult {
95
- return (native as Record<string, Function>).extractSegments(
96
- line,
97
- beforeEnd,
98
- afterStart,
99
- afterLen,
100
- strictAfter,
101
- tabWidth,
102
- ) as ExtractSegmentsResult;
103
- }
104
-
42
+ export declare function extractSegments(line: string, beforeEnd: number, afterStart: number, afterLen: number, strictAfter: boolean, tabWidth?: number): ExtractSegmentsResult;
105
43
  /**
106
44
  * Strip ANSI escape sequences, remove control characters and lone
107
45
  * surrogates, and normalize line endings (CR removed).
108
46
  *
109
47
  * Returns the original string when no changes are needed (zero-copy).
110
48
  */
111
- export function sanitizeText(text: string): string {
112
- return (native as Record<string, Function>).sanitizeText(text) as string;
113
- }
114
-
49
+ export declare function sanitizeText(text: string): string;
115
50
  /**
116
51
  * Calculate visible width of text excluding ANSI escape sequences.
117
52
  *
118
53
  * Tabs count as `tabWidth` cells (default 3).
119
54
  */
120
- export function visibleWidth(text: string, tabWidth?: number): number {
121
- return (native as Record<string, Function>).visibleWidth(
122
- text,
123
- tabWidth,
124
- ) as number;
125
- }
55
+ export declare function visibleWidth(text: string, tabWidth?: number): number;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * ANSI-aware text measurement and slicing.
3
+ *
4
+ * High-performance UTF-16 native implementation with ASCII fast-paths,
5
+ * single-pass ANSI scanning, and proper Unicode grapheme cluster support.
6
+ */
7
+ import { native } from "../native.js";
8
+ export { EllipsisKind } from "./types.js";
9
+ /**
10
+ * Word-wrap text to a visible width, preserving ANSI escape codes across
11
+ * line breaks.
12
+ *
13
+ * Active SGR codes (colors, bold, etc.) are carried to continuation lines.
14
+ * Underline and strikethrough are reset at line ends and restored on the
15
+ * next line.
16
+ */
17
+ export function wrapTextWithAnsi(text, width, tabWidth) {
18
+ return native.wrapTextWithAnsi(text, width, tabWidth);
19
+ }
20
+ /**
21
+ * Truncate text to a visible width with an optional ellipsis.
22
+ *
23
+ * @param text Input string (may contain ANSI codes).
24
+ * @param maxWidth Maximum visible width in terminal cells.
25
+ * @param ellipsisKind 0 = "\u2026", 1 = "...", 2 = none.
26
+ * @param pad When true, pad with spaces to exactly `maxWidth`.
27
+ * @param tabWidth Tab stop width (default 3, range 1-16).
28
+ */
29
+ export function truncateToWidth(text, maxWidth, ellipsisKind, pad, tabWidth) {
30
+ return native.truncateToWidth(text, maxWidth, ellipsisKind, pad, tabWidth);
31
+ }
32
+ /**
33
+ * Slice a range of visible columns from a line.
34
+ *
35
+ * Counts terminal cells (skipping ANSI escapes). When `strict` is true,
36
+ * wide characters that would exceed the range are excluded.
37
+ */
38
+ export function sliceWithWidth(line, startCol, length, strict, tabWidth) {
39
+ return native.sliceWithWidth(line, startCol, length, strict, tabWidth);
40
+ }
41
+ /**
42
+ * Extract the before/after segments around an overlay region.
43
+ *
44
+ * ANSI state is tracked so the `after` segment renders correctly even when
45
+ * the overlay truncates styled text.
46
+ */
47
+ export function extractSegments(line, beforeEnd, afterStart, afterLen, strictAfter, tabWidth) {
48
+ return native.extractSegments(line, beforeEnd, afterStart, afterLen, strictAfter, tabWidth);
49
+ }
50
+ /**
51
+ * Strip ANSI escape sequences, remove control characters and lone
52
+ * surrogates, and normalize line endings (CR removed).
53
+ *
54
+ * Returns the original string when no changes are needed (zero-copy).
55
+ */
56
+ export function sanitizeText(text) {
57
+ return native.sanitizeText(text);
58
+ }
59
+ /**
60
+ * Calculate visible width of text excluding ANSI escape sequences.
61
+ *
62
+ * Tabs count as `tabWidth` cells (default 3).
63
+ */
64
+ export function visibleWidth(text, tabWidth) {
65
+ return native.visibleWidth(text, tabWidth);
66
+ }
@@ -0,0 +1,27 @@
1
+ /** Result of slicing a line by visible column range. */
2
+ export interface SliceResult {
3
+ /** The extracted text (may include ANSI codes). */
4
+ text: string;
5
+ /** Visible width of the extracted slice in terminal cells. */
6
+ width: number;
7
+ }
8
+ /** Result of extracting before/after segments around an overlay. */
9
+ export interface ExtractSegmentsResult {
10
+ /** Text content before the overlay region. */
11
+ before: string;
12
+ /** Visible width of the `before` segment. */
13
+ beforeWidth: number;
14
+ /** Text content after the overlay region. */
15
+ after: string;
16
+ /** Visible width of the `after` segment. */
17
+ afterWidth: number;
18
+ }
19
+ /** Ellipsis style for truncation. */
20
+ export declare enum EllipsisKind {
21
+ /** Unicode ellipsis character: \u2026 (width 1) */
22
+ Unicode = 0,
23
+ /** ASCII ellipsis: "..." (width 3) */
24
+ Ascii = 1,
25
+ /** No ellipsis (hard truncate) */
26
+ None = 2
27
+ }
@@ -0,0 +1,10 @@
1
+ /** Ellipsis style for truncation. */
2
+ export var EllipsisKind;
3
+ (function (EllipsisKind) {
4
+ /** Unicode ellipsis character: \u2026 (width 1) */
5
+ EllipsisKind[EllipsisKind["Unicode"] = 0] = "Unicode";
6
+ /** ASCII ellipsis: "..." (width 3) */
7
+ EllipsisKind[EllipsisKind["Ascii"] = 1] = "Ascii";
8
+ /** No ellipsis (hard truncate) */
9
+ EllipsisKind[EllipsisKind["None"] = 2] = "None";
10
+ })(EllipsisKind || (EllipsisKind = {}));
@@ -4,36 +4,24 @@
4
4
  * Pre-compiles all rule condition patterns into a single Rust RegexSet for
5
5
  * O(1)-style matching per buffer check, replacing per-rule JS regex iteration.
6
6
  */
7
-
8
- import { native } from "../native.js";
9
7
  import type { TtsrHandle, TtsrRuleInput } from "./types.js";
10
-
11
8
  export type { TtsrHandle, TtsrRuleInput };
12
-
13
9
  /**
14
10
  * Compile TTSR rules into an optimized native regex engine.
15
11
  *
16
12
  * Returns an opaque handle for use with `ttsrCheckBuffer` and `ttsrFreeRules`.
17
13
  */
18
- export function ttsrCompileRules(rules: TtsrRuleInput[]): TtsrHandle {
19
- return native.ttsrCompileRules(rules) as TtsrHandle;
20
- }
21
-
14
+ export declare function ttsrCompileRules(rules: TtsrRuleInput[]): TtsrHandle;
22
15
  /**
23
16
  * Check a buffer against compiled TTSR rules.
24
17
  *
25
18
  * Returns an array of unique rule names whose conditions matched.
26
19
  * All patterns are tested in a single pass via Rust's RegexSet.
27
20
  */
28
- export function ttsrCheckBuffer(handle: TtsrHandle, buffer: string): string[] {
29
- return native.ttsrCheckBuffer(handle, buffer) as string[];
30
- }
31
-
21
+ export declare function ttsrCheckBuffer(handle: TtsrHandle, buffer: string): string[];
32
22
  /**
33
23
  * Free a compiled TTSR rule set, releasing native memory.
34
24
  *
35
25
  * Call when rules are no longer needed (e.g., session end).
36
26
  */
37
- export function ttsrFreeRules(handle: TtsrHandle): void {
38
- native.ttsrFreeRules(handle);
39
- }
27
+ export declare function ttsrFreeRules(handle: TtsrHandle): void;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Native TTSR regex engine.
3
+ *
4
+ * Pre-compiles all rule condition patterns into a single Rust RegexSet for
5
+ * O(1)-style matching per buffer check, replacing per-rule JS regex iteration.
6
+ */
7
+ import { native } from "../native.js";
8
+ /**
9
+ * Compile TTSR rules into an optimized native regex engine.
10
+ *
11
+ * Returns an opaque handle for use with `ttsrCheckBuffer` and `ttsrFreeRules`.
12
+ */
13
+ export function ttsrCompileRules(rules) {
14
+ return native.ttsrCompileRules(rules);
15
+ }
16
+ /**
17
+ * Check a buffer against compiled TTSR rules.
18
+ *
19
+ * Returns an array of unique rule names whose conditions matched.
20
+ * All patterns are tested in a single pass via Rust's RegexSet.
21
+ */
22
+ export function ttsrCheckBuffer(handle, buffer) {
23
+ return native.ttsrCheckBuffer(handle, buffer);
24
+ }
25
+ /**
26
+ * Free a compiled TTSR rule set, releasing native memory.
27
+ *
28
+ * Call when rules are no longer needed (e.g., session end).
29
+ */
30
+ export function ttsrFreeRules(handle) {
31
+ native.ttsrFreeRules(handle);
32
+ }
@@ -1,10 +1,9 @@
1
1
  /** Input rule for TTSR regex compilation. */
2
2
  export interface TtsrRuleInput {
3
- /** Unique rule name. */
4
- name: string;
5
- /** Regex condition patterns (any match triggers the rule). */
6
- conditions: string[];
3
+ /** Unique rule name. */
4
+ name: string;
5
+ /** Regex condition patterns (any match triggers the rule). */
6
+ conditions: string[];
7
7
  }
8
-
9
8
  /** Opaque handle to a compiled TTSR rule set. */
10
9
  export type TtsrHandle = number;
@@ -0,0 +1 @@
1
+ export {};
@@ -3,57 +3,58 @@
3
3
  "version": "0.1.0",
4
4
  "description": "Native Rust bindings for GSD \u2014 high-performance native modules via N-API",
5
5
  "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "scripts": {
9
+ "build": "tsc -p tsconfig.json",
9
10
  "build:native": "node ../../native/scripts/build.js",
10
11
  "build:native:dev": "node ../../native/scripts/build.js --dev",
11
12
  "test": "node --test src/__tests__/grep.test.mjs src/__tests__/ps.test.mjs src/__tests__/glob.test.mjs src/__tests__/clipboard.test.mjs src/__tests__/highlight.test.mjs src/__tests__/html.test.mjs src/__tests__/text.test.mjs src/__tests__/fd.test.mjs src/__tests__/image.test.mjs"
12
13
  },
13
14
  "exports": {
14
15
  ".": {
15
- "types": "./src/index.ts",
16
- "import": "./src/index.ts"
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
17
18
  },
18
19
  "./grep": {
19
- "types": "./src/grep/index.ts",
20
- "import": "./src/grep/index.ts"
20
+ "types": "./dist/grep/index.d.ts",
21
+ "import": "./dist/grep/index.js"
21
22
  },
22
23
  "./ps": {
23
- "types": "./src/ps/index.ts",
24
- "import": "./src/ps/index.ts"
24
+ "types": "./dist/ps/index.d.ts",
25
+ "import": "./dist/ps/index.js"
25
26
  },
26
27
  "./glob": {
27
- "types": "./src/glob/index.ts",
28
- "import": "./src/glob/index.ts"
28
+ "types": "./dist/glob/index.d.ts",
29
+ "import": "./dist/glob/index.js"
29
30
  },
30
31
  "./clipboard": {
31
- "types": "./src/clipboard/index.ts",
32
- "import": "./src/clipboard/index.ts"
32
+ "types": "./dist/clipboard/index.d.ts",
33
+ "import": "./dist/clipboard/index.js"
33
34
  },
34
35
  "./ast": {
35
- "types": "./src/ast/index.ts",
36
- "import": "./src/ast/index.ts"
36
+ "types": "./dist/ast/index.d.ts",
37
+ "import": "./dist/ast/index.js"
37
38
  },
38
39
  "./html": {
39
- "types": "./src/html/index.ts",
40
- "import": "./src/html/index.ts"
40
+ "types": "./dist/html/index.d.ts",
41
+ "import": "./dist/html/index.js"
41
42
  },
42
43
  "./text": {
43
- "types": "./src/text/index.ts",
44
- "import": "./src/text/index.ts"
44
+ "types": "./dist/text/index.d.ts",
45
+ "import": "./dist/text/index.js"
45
46
  },
46
47
  "./fd": {
47
- "types": "./src/fd/index.ts",
48
- "import": "./src/fd/index.ts"
48
+ "types": "./dist/fd/index.d.ts",
49
+ "import": "./dist/fd/index.js"
49
50
  },
50
51
  "./image": {
51
- "types": "./src/image/index.ts",
52
- "import": "./src/image/index.ts"
52
+ "types": "./dist/image/index.d.ts",
53
+ "import": "./dist/image/index.js"
53
54
  }
54
55
  },
55
56
  "files": [
56
- "src"
57
+ "dist"
57
58
  ],
58
59
  "license": "MIT"
59
60
  }
@@ -1,12 +1,15 @@
1
1
  /**
2
2
  * Shared diff computation utilities for the edit tool.
3
3
  * Used by both edit.ts (for execution) and tool-execution.ts (for preview rendering).
4
+ *
5
+ * Hot-path functions (fuzzyFindText, normalizeForFuzzyMatch, generateDiffString)
6
+ * delegate to the native Rust engine for performance on large files.
4
7
  */
5
8
  export declare function detectLineEnding(content: string): "\r\n" | "\n";
6
9
  export declare function normalizeToLF(text: string): string;
7
10
  export declare function restoreLineEndings(text: string, ending: "\r\n" | "\n"): string;
8
11
  /**
9
- * Normalize text for fuzzy matching. Applies progressive transformations:
12
+ * Normalize text for fuzzy matching (native Rust implementation).
10
13
  * - Strip trailing whitespace from each line
11
14
  * - Normalize smart quotes to ASCII equivalents
12
15
  * - Normalize Unicode dashes/hyphens to ASCII hyphen
@@ -29,10 +32,11 @@ export interface FuzzyMatchResult {
29
32
  contentForReplacement: string;
30
33
  }
31
34
  /**
32
- * Find oldText in content, trying exact match first, then fuzzy match.
35
+ * Find oldText in content, trying exact match first, then fuzzy match
36
+ * (native Rust implementation).
37
+ *
33
38
  * When fuzzy matching is used, the returned contentForReplacement is the
34
- * fuzzy-normalized version of the content (trailing whitespace stripped,
35
- * Unicode quotes/dashes normalized to ASCII).
39
+ * fuzzy-normalized version of the content.
36
40
  */
37
41
  export declare function fuzzyFindText(content: string, oldText: string): FuzzyMatchResult;
38
42
  /** Strip UTF-8 BOM if present, return both the BOM (if any) and the text without it */
@@ -41,7 +45,9 @@ export declare function stripBom(content: string): {
41
45
  text: string;
42
46
  };
43
47
  /**
44
- * Generate a unified diff string with line numbers and context.
48
+ * Generate a unified diff string with line numbers and context
49
+ * (native Rust implementation using Myers' algorithm via the `similar` crate).
50
+ *
45
51
  * Returns both the diff string and the first changed line number (in the new file).
46
52
  */
47
53
  export declare function generateDiffString(oldContent: string, newContent: string, contextLines?: number): {
@@ -1 +1 @@
1
- {"version":3,"file":"edit-diff.d.ts","sourceRoot":"","sources":["../../../src/core/tools/edit-diff.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM/D;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE9E;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoB3D;AAED,MAAM,WAAW,gBAAgB;IAChC,gCAAgC;IAChC,KAAK,EAAE,OAAO,CAAC;IACf,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,cAAc,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,wBAAg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