@visual-z/xeno 0.2.1 → 0.4.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 (282) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +126 -34
  3. package/docs/app-server.md +84 -0
  4. package/docs/install.md +51 -13
  5. package/docs/providers.md +24 -3
  6. package/package.json +7 -5
  7. package/src/apps/app-server.ts +28 -0
  8. package/src/apps/approve.ts +3 -3
  9. package/src/apps/cli.ts +25 -10
  10. package/src/apps/commands.ts +45 -8
  11. package/src/apps/completions.ts +78 -22
  12. package/src/apps/control-transport.ts +89 -0
  13. package/src/apps/image-draft.ts +46 -0
  14. package/src/apps/model-catalog.ts +2 -1
  15. package/src/apps/project-trust.ts +2 -42
  16. package/src/apps/provider-connect.ts +346 -0
  17. package/src/apps/render.ts +22 -47
  18. package/src/apps/resources.ts +5 -2
  19. package/src/apps/shell.ts +333 -1542
  20. package/src/apps/startup-input.ts +45 -9
  21. package/src/apps/startup.ts +149 -94
  22. package/src/apps/ui/app.ts +1553 -0
  23. package/src/apps/ui/control-model.ts +26 -0
  24. package/src/apps/ui/extension-host.ts +194 -0
  25. package/src/apps/ui/image-cache.ts +78 -0
  26. package/src/apps/ui/palette.ts +88 -0
  27. package/src/apps/ui/project.ts +127 -0
  28. package/src/apps/ui/standalone.ts +146 -0
  29. package/src/apps/ui/status-model.ts +68 -0
  30. package/src/apps/ui/surface.ts +86 -0
  31. package/src/apps/ui/theme.ts +86 -0
  32. package/src/core/acceptance.ts +107 -0
  33. package/src/core/action-defaults.ts +47 -295
  34. package/src/core/benchmark.ts +2 -2
  35. package/src/core/branch-receipt.ts +24 -0
  36. package/src/core/checkpoints.ts +64 -0
  37. package/src/core/churn.ts +2 -0
  38. package/src/core/command-artifacts.ts +94 -0
  39. package/src/core/command-contract.ts +35 -0
  40. package/src/core/completion-action.ts +20 -0
  41. package/src/core/completion-review.ts +37 -21
  42. package/src/core/context-detail.ts +37 -0
  43. package/src/core/context-policy.ts +74 -1
  44. package/src/core/continuation.ts +17 -2
  45. package/src/core/control-protocol.ts +62 -0
  46. package/src/core/control-view.ts +42 -0
  47. package/src/core/derive.ts +29 -3
  48. package/src/core/draft-images.ts +56 -0
  49. package/src/core/environment.ts +145 -0
  50. package/src/core/evaluation-coverage.ts +74 -0
  51. package/src/core/event-validation.ts +81 -6
  52. package/src/core/events.ts +99 -3
  53. package/src/core/evidence-links.ts +7 -0
  54. package/src/core/evidence.ts +13 -3
  55. package/src/core/execution.ts +8 -2
  56. package/src/core/experiment.ts +133 -0
  57. package/src/core/export.ts +9 -0
  58. package/src/core/failure-recovery.ts +173 -0
  59. package/src/core/file-precondition.ts +72 -0
  60. package/src/core/handoff.ts +65 -4
  61. package/src/core/harness-diagnostics.ts +206 -0
  62. package/src/core/history-query.ts +38 -2
  63. package/src/core/history.ts +38 -1
  64. package/src/core/integration-health.ts +34 -0
  65. package/src/core/keymap.ts +8 -20
  66. package/src/core/model-picker.ts +64 -0
  67. package/src/core/native-eval.ts +25 -0
  68. package/src/core/note-guidance.ts +34 -0
  69. package/src/core/oauth-fields.ts +44 -0
  70. package/src/core/observation-view.ts +49 -8
  71. package/src/core/permissions.ts +24 -2
  72. package/src/core/process-receipt.ts +105 -0
  73. package/src/core/process-state.ts +37 -0
  74. package/src/core/program-status.ts +31 -0
  75. package/src/core/project.ts +70 -19
  76. package/src/core/prompt-policy.ts +37 -0
  77. package/src/core/query-eval-contract.ts +14 -0
  78. package/src/core/read-observation.ts +82 -0
  79. package/src/core/recovery-corpus.ts +17 -0
  80. package/src/core/recovery-evaluation.ts +60 -0
  81. package/src/core/recovery-sources.ts +74 -0
  82. package/src/core/request-progress.ts +87 -0
  83. package/src/core/request-state.ts +114 -0
  84. package/src/core/runtime-target.ts +94 -0
  85. package/src/core/search-observation.ts +97 -0
  86. package/src/core/session-tree.ts +147 -0
  87. package/src/core/settings.ts +33 -10
  88. package/src/core/skills.ts +44 -0
  89. package/src/core/sql-query.ts +211 -0
  90. package/src/core/theme.ts +36 -58
  91. package/src/core/tool-contract.ts +51 -2
  92. package/src/core/tool-discovery.ts +87 -0
  93. package/src/core/tool-failure.ts +60 -0
  94. package/src/core/tool-input.ts +6 -0
  95. package/src/core/tool-mode-protocol.ts +25 -0
  96. package/src/core/transcript.ts +19 -4
  97. package/src/core/trial-lifecycle.ts +14 -0
  98. package/src/core/tui-mode.ts +29 -0
  99. package/src/core/update-check.ts +97 -0
  100. package/src/core/version.ts +55 -0
  101. package/src/core/work-state.ts +49 -3
  102. package/src/core/working-set.ts +91 -0
  103. package/src/runtime/auth.ts +11 -4
  104. package/src/runtime/branch-jobs.ts +36 -0
  105. package/src/runtime/catalog.ts +13 -3
  106. package/src/runtime/clipboard.ts +15 -4
  107. package/src/runtime/command-artifacts.ts +64 -0
  108. package/src/runtime/control-connection.ts +104 -0
  109. package/src/runtime/environment-tools.ts +60 -0
  110. package/src/runtime/evidence-notes.ts +4 -2
  111. package/src/runtime/exec-sessions.ts +206 -61
  112. package/src/runtime/execution-control.ts +1 -0
  113. package/src/runtime/extension-ui.ts +22 -30
  114. package/src/runtime/extensions.ts +95 -16
  115. package/src/runtime/harness-comparison.ts +27 -7
  116. package/src/runtime/harness-eval.ts +462 -0
  117. package/src/runtime/history-cache.ts +57 -0
  118. package/src/runtime/history-tools.ts +62 -12
  119. package/src/runtime/integrations.ts +210 -0
  120. package/src/runtime/loop.ts +1088 -282
  121. package/src/runtime/model-discovery.ts +208 -0
  122. package/src/runtime/model.ts +9 -0
  123. package/src/runtime/native-eval-fixtures.ts +33 -0
  124. package/src/runtime/native-eval.ts +146 -0
  125. package/src/runtime/oauth.ts +80 -3
  126. package/src/runtime/pi-provider.ts +169 -12
  127. package/src/runtime/program-status.ts +38 -0
  128. package/src/runtime/provider-connect.ts +109 -0
  129. package/src/runtime/provider-presets.ts +87 -0
  130. package/src/runtime/provider-request.ts +13 -2
  131. package/src/runtime/provider.ts +23 -9
  132. package/src/runtime/query-eval-verifier.ts +28 -0
  133. package/src/runtime/recovery-coverage.ts +71 -0
  134. package/src/runtime/recovery-evidence.ts +76 -0
  135. package/src/runtime/recovery-fixtures.ts +116 -0
  136. package/src/runtime/runtime-target.ts +149 -0
  137. package/src/runtime/session-control.ts +198 -0
  138. package/src/runtime/tool-broker.ts +137 -0
  139. package/src/runtime/tool-discovery.ts +57 -0
  140. package/src/runtime/tool-mode-eval.ts +146 -0
  141. package/src/runtime/tool-queue.ts +77 -0
  142. package/src/runtime/tools.ts +628 -183
  143. package/src/runtime/trial-control.ts +45 -0
  144. package/src/runtime/update-check.ts +47 -0
  145. package/src/runtime/window-trial.ts +2 -1
  146. package/src/runtime/working-notes.ts +33 -3
  147. package/src/runtime/workspace-lifecycle.ts +97 -0
  148. package/src/store/acceptance.ts +15 -0
  149. package/src/store/checkpoint-history.ts +43 -0
  150. package/src/store/command-artifacts.ts +96 -0
  151. package/src/store/command.ts +65 -37
  152. package/src/store/file-checkpoints.ts +104 -0
  153. package/src/store/file-index.ts +13 -1
  154. package/src/store/git-checkpoints.ts +67 -0
  155. package/src/store/observations.ts +61 -20
  156. package/src/store/process-receipts.ts +34 -0
  157. package/src/store/query-source.ts +13 -8
  158. package/src/store/recovery.ts +2 -3
  159. package/src/store/replay.ts +16 -4
  160. package/src/store/runtime-target.ts +64 -0
  161. package/src/store/search.ts +171 -132
  162. package/src/store/session-archive.ts +4 -0
  163. package/src/store/source-cancellation.ts +6 -0
  164. package/src/store/update-cache.ts +36 -0
  165. package/src/store/workspace-observation.ts +113 -0
  166. package/src/tui/ansi-spans.ts +126 -0
  167. package/src/tui/style.ts +19 -16
  168. package/src/tui/ui/atomic-draft.ts +121 -0
  169. package/src/tui/ui/canvas.ts +96 -0
  170. package/src/tui/ui/colors.ts +70 -0
  171. package/src/tui/ui/composer.ts +200 -0
  172. package/src/tui/ui/control-panel.ts +23 -0
  173. package/src/tui/ui/dialog.ts +379 -0
  174. package/src/tui/ui/draft.ts +23 -0
  175. package/src/tui/ui/edge.ts +186 -0
  176. package/src/tui/ui/image-size.ts +40 -0
  177. package/src/tui/ui/ink.ts +210 -0
  178. package/src/tui/ui/items.ts +40 -0
  179. package/src/tui/ui/keys.ts +40 -0
  180. package/src/tui/ui/layout.ts +74 -0
  181. package/src/tui/ui/list-model.ts +86 -0
  182. package/src/tui/ui/list-view.ts +172 -0
  183. package/src/tui/ui/mascot.ts +67 -0
  184. package/src/tui/ui/messages.ts +518 -0
  185. package/src/tui/ui/motion.ts +28 -0
  186. package/src/tui/ui/paths.ts +10 -0
  187. package/src/tui/ui/pictures.ts +78 -0
  188. package/src/tui/ui/screen.ts +421 -0
  189. package/src/tui/ui/status.ts +279 -0
  190. package/src/tui/ui/styled.ts +85 -0
  191. package/src/tui/ui/testing.ts +5 -0
  192. package/src/tui/ui/tool-card.ts +150 -0
  193. package/src/apps/extension-ui.ts +0 -330
  194. package/src/apps/resource-browser.ts +0 -75
  195. package/src/apps/session-browser.ts +0 -113
  196. package/src/apps/session-picker.ts +0 -55
  197. package/src/tui/ansi.ts +0 -67
  198. package/src/tui/autocomplete.ts +0 -29
  199. package/src/tui/chat-viewport.ts +0 -47
  200. package/src/tui/complete.ts +0 -87
  201. package/src/tui/editor.ts +0 -940
  202. package/src/tui/host.ts +0 -264
  203. package/src/tui/input.ts +0 -75
  204. package/src/tui/keys.ts +0 -378
  205. package/src/tui/markdown.ts +0 -17
  206. package/src/tui/render.ts +0 -153
  207. package/src/tui/select.ts +0 -258
  208. package/src/tui/settings.ts +0 -44
  209. package/src/tui/statusline.ts +0 -162
  210. package/src/tui/system-theme.ts +0 -700
  211. package/src/tui/terminal.ts +0 -30
  212. package/src/tui/text.ts +0 -52
  213. package/src/tui/toolview.ts +0 -386
  214. package/src/tui/transcript.ts +0 -123
  215. package/src/tui/tree.ts +0 -471
  216. package/src/vendor/pi-tui/LICENSE.upstream +0 -21
  217. package/src/vendor/pi-tui/UPSTREAM.json +0 -50
  218. package/src/vendor/pi-tui/VENDOR.md +0 -25
  219. package/src/vendor/pi-tui/alt-screen-search.ts +0 -327
  220. package/src/vendor/pi-tui/autocomplete.ts +0 -860
  221. package/src/vendor/pi-tui/colors.ts +0 -367
  222. package/src/vendor/pi-tui/components/alt-screen-flash.ts +0 -51
  223. package/src/vendor/pi-tui/components/box.ts +0 -166
  224. package/src/vendor/pi-tui/components/cancellable-loader.ts +0 -40
  225. package/src/vendor/pi-tui/components/editor.ts +0 -2472
  226. package/src/vendor/pi-tui/components/h-stack.ts +0 -44
  227. package/src/vendor/pi-tui/components/image.ts +0 -127
  228. package/src/vendor/pi-tui/components/input.ts +0 -494
  229. package/src/vendor/pi-tui/components/loader.ts +0 -101
  230. package/src/vendor/pi-tui/components/markdown.ts +0 -1021
  231. package/src/vendor/pi-tui/components/mouse-region.ts +0 -33
  232. package/src/vendor/pi-tui/components/scroll-view.ts +0 -224
  233. package/src/vendor/pi-tui/components/select-list.ts +0 -273
  234. package/src/vendor/pi-tui/components/settings-list.ts +0 -328
  235. package/src/vendor/pi-tui/components/spacer.ts +0 -28
  236. package/src/vendor/pi-tui/components/stack.ts +0 -154
  237. package/src/vendor/pi-tui/components/text.ts +0 -107
  238. package/src/vendor/pi-tui/components/truncated-text.ts +0 -65
  239. package/src/vendor/pi-tui/components/v-stack.ts +0 -33
  240. package/src/vendor/pi-tui/editor-component.ts +0 -74
  241. package/src/vendor/pi-tui/fuzzy.ts +0 -138
  242. package/src/vendor/pi-tui/index.ts +0 -186
  243. package/src/vendor/pi-tui/keybindings.ts +0 -320
  244. package/src/vendor/pi-tui/keys.ts +0 -1401
  245. package/src/vendor/pi-tui/kill-ring.ts +0 -46
  246. package/src/vendor/pi-tui/latex.ts +0 -1506
  247. package/src/vendor/pi-tui/layout-node.ts +0 -51
  248. package/src/vendor/pi-tui/layout.ts +0 -449
  249. package/src/vendor/pi-tui/native/UPSTREAM.json +0 -23
  250. package/src/vendor/pi-tui/native/clipboard.h +0 -208
  251. package/src/vendor/pi-tui/native/darwin/README.md +0 -22
  252. package/src/vendor/pi-tui/native/darwin/build.sh +0 -69
  253. package/src/vendor/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
  254. package/src/vendor/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
  255. package/src/vendor/pi-tui/native/darwin/src/darwin-platform.m +0 -132
  256. package/src/vendor/pi-tui/native/linux/README.md +0 -23
  257. package/src/vendor/pi-tui/native/linux/build.sh +0 -65
  258. package/src/vendor/pi-tui/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
  259. package/src/vendor/pi-tui/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
  260. package/src/vendor/pi-tui/native/linux/src/clipboard-worker.h +0 -70
  261. package/src/vendor/pi-tui/native/linux/src/linux-platform-x11.c +0 -274
  262. package/src/vendor/pi-tui/native/napi.h +0 -91
  263. package/src/vendor/pi-tui/native/win32/README.md +0 -31
  264. package/src/vendor/pi-tui/native/win32/build.mjs +0 -232
  265. package/src/vendor/pi-tui/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
  266. package/src/vendor/pi-tui/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
  267. package/src/vendor/pi-tui/native/win32/src/win32-platform.c +0 -241
  268. package/src/vendor/pi-tui/native-modifiers.ts +0 -13
  269. package/src/vendor/pi-tui/native-module-path.ts +0 -31
  270. package/src/vendor/pi-tui/native-platform.ts +0 -65
  271. package/src/vendor/pi-tui/oklab.ts +0 -233
  272. package/src/vendor/pi-tui/stdin-buffer.ts +0 -444
  273. package/src/vendor/pi-tui/terminal-colors.ts +0 -91
  274. package/src/vendor/pi-tui/terminal-image.ts +0 -731
  275. package/src/vendor/pi-tui/terminal.ts +0 -554
  276. package/src/vendor/pi-tui/tui-alt-screen.ts +0 -1750
  277. package/src/vendor/pi-tui/tui-main-screen.ts +0 -655
  278. package/src/vendor/pi-tui/tui.ts +0 -1493
  279. package/src/vendor/pi-tui/undo-stack.ts +0 -28
  280. package/src/vendor/pi-tui/utils.ts +0 -1385
  281. package/src/vendor/pi-tui/wheel-scroll.ts +0 -82
  282. package/src/vendor/pi-tui/word-navigation.ts +0 -117
@@ -1,33 +0,0 @@
1
- import { allocateStackSizes, Stack, type StackChild, type StackOptions, visibleStackEntries } from "./stack.ts";
2
-
3
- export class VStack extends Stack {
4
- protected readonly layoutType = "vstack" as const;
5
-
6
- constructor(children: StackChild[] = [], options: StackOptions = {}) {
7
- super(children, options);
8
- }
9
-
10
- override render(width: number): string[] {
11
- const viewport = { width: Math.max(1, width), height: Number.MAX_SAFE_INTEGER };
12
- const entries = visibleStackEntries(this.entries, viewport);
13
- const rendered = entries.map((entry) => entry.component.render(viewport.width));
14
- const sizes = allocateStackSizes(
15
- entries,
16
- rendered.map((lines) => lines.length),
17
- undefined,
18
- this.gap,
19
- );
20
- const lines: string[] = [];
21
- for (let index = 0; index < entries.length; index++) {
22
- if (index > 0) {
23
- for (let gap = 0; gap < this.gap; gap++) lines.push("");
24
- }
25
- const childLines = rendered[index]!.slice(0, sizes[index]);
26
- lines.push(...childLines);
27
- for (let padding = childLines.length; padding < sizes[index]!; padding++) lines.push("");
28
- }
29
- return lines;
30
- }
31
- }
32
-
33
- export type { StackChild, StackEntry, StackEntryOptions, StackOptions } from "./stack.ts";
@@ -1,74 +0,0 @@
1
- import type { AutocompleteProvider } from "./autocomplete.ts";
2
- import type { Component } from "./tui.ts";
3
-
4
- /**
5
- * Interface for custom editor components.
6
- *
7
- * This allows extensions to provide their own editor implementation
8
- * (e.g., vim mode, emacs mode, custom keybindings) while maintaining
9
- * compatibility with the core application.
10
- */
11
- export interface EditorComponent extends Component {
12
- // =========================================================================
13
- // Core text access (required)
14
- // =========================================================================
15
-
16
- /** Get the current text content */
17
- getText(): string;
18
-
19
- /** Set the text content */
20
- setText(text: string): void;
21
-
22
- /** Handle raw terminal input (key presses, paste sequences, etc.) */
23
- handleInput(data: string): void;
24
-
25
- // =========================================================================
26
- // Callbacks (required)
27
- // =========================================================================
28
-
29
- /** Called when user submits (e.g., Enter key) */
30
- onSubmit?: (text: string) => void;
31
-
32
- /** Called when text changes */
33
- onChange?: (text: string) => void;
34
-
35
- // =========================================================================
36
- // History support (optional)
37
- // =========================================================================
38
-
39
- /** Add text to history for up/down navigation */
40
- addToHistory?(text: string): void;
41
-
42
- // =========================================================================
43
- // Advanced text manipulation (optional)
44
- // =========================================================================
45
-
46
- /** Insert text at current cursor position */
47
- insertTextAtCursor?(text: string): void;
48
-
49
- /**
50
- * Get text with any markers expanded (e.g., paste markers).
51
- * Falls back to getText() if not implemented.
52
- */
53
- getExpandedText?(): string;
54
-
55
- // =========================================================================
56
- // Autocomplete support (optional)
57
- // =========================================================================
58
-
59
- /** Set the autocomplete provider */
60
- setAutocompleteProvider?(provider: AutocompleteProvider): void;
61
-
62
- // =========================================================================
63
- // Appearance (optional)
64
- // =========================================================================
65
-
66
- /** Border color function */
67
- borderColor?: (str: string) => string;
68
-
69
- /** Set horizontal padding */
70
- setPaddingX?(padding: number): void;
71
-
72
- /** Set max visible items in autocomplete dropdown */
73
- setAutocompleteMaxVisible?(maxVisible: number): void;
74
- }
@@ -1,138 +0,0 @@
1
- /**
2
- * Fuzzy matching utilities.
3
- * Matches if all query characters appear in order (not necessarily consecutive).
4
- * Lower score = better match.
5
- */
6
-
7
- export interface FuzzyMatch {
8
- matches: boolean;
9
- score: number;
10
- }
11
-
12
- export function fuzzyMatch(query: string, text: string): FuzzyMatch {
13
- const queryLower = query.toLowerCase();
14
- const textLower = text.toLowerCase();
15
-
16
- const matchQuery = (normalizedQuery: string): FuzzyMatch => {
17
- if (normalizedQuery.length === 0) {
18
- return { matches: true, score: 0 };
19
- }
20
-
21
- if (normalizedQuery.length > textLower.length) {
22
- return { matches: false, score: 0 };
23
- }
24
-
25
- let queryIndex = 0;
26
- let score = 0;
27
- let lastMatchIndex = -1;
28
- let consecutiveMatches = 0;
29
-
30
- while (queryIndex < normalizedQuery.length) {
31
- const i = textLower.indexOf(normalizedQuery[queryIndex]!, lastMatchIndex + 1);
32
- if (i === -1) break;
33
-
34
- const isWordBoundary = i === 0 || /[\s\-_./:]/.test(textLower[i - 1]!);
35
-
36
- // Reward consecutive matches
37
- if (lastMatchIndex === i - 1) {
38
- consecutiveMatches++;
39
- score -= consecutiveMatches * 5;
40
- } else {
41
- consecutiveMatches = 0;
42
- // Penalize gaps
43
- if (lastMatchIndex >= 0) {
44
- score += (i - lastMatchIndex - 1) * 2;
45
- }
46
- }
47
-
48
- // Reward word boundary matches
49
- if (isWordBoundary) {
50
- score -= 10;
51
- }
52
-
53
- // Slight penalty for later matches
54
- score += i * 0.1;
55
-
56
- lastMatchIndex = i;
57
- queryIndex++;
58
- }
59
-
60
- if (queryIndex < normalizedQuery.length) {
61
- return { matches: false, score: 0 };
62
- }
63
-
64
- if (normalizedQuery === textLower) {
65
- score -= 100;
66
- }
67
-
68
- return { matches: true, score };
69
- };
70
-
71
- const primaryMatch = matchQuery(queryLower);
72
- if (primaryMatch.matches) {
73
- return primaryMatch;
74
- }
75
-
76
- const alphaNumericMatch = queryLower.match(/^(?<letters>[a-z]+)(?<digits>[0-9]+)$/);
77
- const numericAlphaMatch = queryLower.match(/^(?<digits>[0-9]+)(?<letters>[a-z]+)$/);
78
- const swappedQuery = alphaNumericMatch
79
- ? `${alphaNumericMatch.groups?.digits ?? ""}${alphaNumericMatch.groups?.letters ?? ""}`
80
- : numericAlphaMatch
81
- ? `${numericAlphaMatch.groups?.letters ?? ""}${numericAlphaMatch.groups?.digits ?? ""}`
82
- : "";
83
-
84
- if (!swappedQuery) {
85
- return primaryMatch;
86
- }
87
-
88
- const swappedMatch = matchQuery(swappedQuery);
89
- if (!swappedMatch.matches) {
90
- return primaryMatch;
91
- }
92
-
93
- return { matches: true, score: swappedMatch.score + 5 };
94
- }
95
-
96
- /**
97
- * Filter and sort items by fuzzy match quality (best matches first).
98
- * Supports whitespace- and slash-separated tokens: all tokens must match.
99
- */
100
- export function fuzzyFilter<T>(items: T[], query: string, getText: (item: T) => string): T[] {
101
- if (!query.trim()) {
102
- return items;
103
- }
104
-
105
- const tokens = query
106
- .trim()
107
- .split(/[\s/]+/)
108
- .filter((t) => t.length > 0);
109
-
110
- if (tokens.length === 0) {
111
- return items;
112
- }
113
-
114
- const results: { item: T; totalScore: number }[] = [];
115
-
116
- for (const item of items) {
117
- const text = getText(item);
118
- let totalScore = 0;
119
- let allMatch = true;
120
-
121
- for (const token of tokens) {
122
- const match = fuzzyMatch(token, text);
123
- if (match.matches) {
124
- totalScore += match.score;
125
- } else {
126
- allMatch = false;
127
- break;
128
- }
129
- }
130
-
131
- if (allMatch) {
132
- results.push({ item, totalScore });
133
- }
134
- }
135
-
136
- results.sort((a, b) => a.totalScore - b.totalScore);
137
- return results.map((r) => r.item);
138
- }
@@ -1,186 +0,0 @@
1
- // Core TUI interfaces and classes
2
-
3
- export { Marked, type Token, type Tokens } from "marked";
4
- // Autocomplete support
5
- export {
6
- type AutocompleteItem,
7
- type AutocompleteProvider,
8
- type AutocompleteSuggestions,
9
- CombinedAutocompleteProvider,
10
- type SlashCommand,
11
- } from "./autocomplete.ts";
12
- // Colors and styling
13
- export {
14
- backgroundAnsi,
15
- type Color,
16
- type ColorMixSpace,
17
- colorToHex,
18
- colorToOkhsl,
19
- colorToOklch,
20
- colorToRgb,
21
- foregroundAnsi,
22
- type IndexedColor,
23
- indexedColor,
24
- mixColors,
25
- type OkhslChannels,
26
- type OklchChannels,
27
- type OklchColorValue,
28
- okhslColor,
29
- oklchColor,
30
- parseColor,
31
- type RgbColorValue,
32
- rgbColor,
33
- styleText,
34
- styleTextWithAnsi,
35
- type TerminalColorMode,
36
- type TextAttributes,
37
- type TextStyle,
38
- } from "./colors.ts";
39
- // Components
40
- export { Box } from "./components/box.ts";
41
- export { CancellableLoader } from "./components/cancellable-loader.ts";
42
- export { Editor, type EditorOptions, type EditorTheme } from "./components/editor.ts";
43
- export { HStack } from "./components/h-stack.ts";
44
- export { Image, type ImageOptions, type ImageTheme } from "./components/image.ts";
45
- export { Input } from "./components/input.ts";
46
- export { Loader, type LoaderIndicatorOptions } from "./components/loader.ts";
47
- export { type DefaultTextStyle, Markdown, type MarkdownOptions, type MarkdownTheme } from "./components/markdown.ts";
48
- export { MouseRegion, type MouseRegionHandler } from "./components/mouse-region.ts";
49
- export {
50
- ScrollView,
51
- type ScrollViewOptions,
52
- type ScrollViewScrollbar,
53
- type ScrollViewScrollToOptions,
54
- } from "./components/scroll-view.ts";
55
- export {
56
- type SelectItem,
57
- SelectList,
58
- type SelectListLayoutOptions,
59
- type SelectListTheme,
60
- type SelectListTruncatePrimaryContext,
61
- } from "./components/select-list.ts";
62
- export { type SettingItem, SettingsList, type SettingsListTheme } from "./components/settings-list.ts";
63
- export { Spacer } from "./components/spacer.ts";
64
- export { Text } from "./components/text.ts";
65
- export { TruncatedText } from "./components/truncated-text.ts";
66
- export {
67
- type StackChild,
68
- type StackEntry,
69
- type StackEntryOptions,
70
- type StackOptions,
71
- VStack,
72
- } from "./components/v-stack.ts";
73
- // Editor component interface (for custom editors)
74
- export type { EditorComponent } from "./editor-component.ts";
75
- // Fuzzy matching
76
- export { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from "./fuzzy.ts";
77
- // Keybindings
78
- export {
79
- getKeybindings,
80
- type Keybinding,
81
- type KeybindingConflict,
82
- type KeybindingDefinition,
83
- type KeybindingDefinitions,
84
- type Keybindings,
85
- type KeybindingsConfig,
86
- KeybindingsManager,
87
- setKeybindings,
88
- TUI_KEYBINDINGS,
89
- } from "./keybindings.ts";
90
- // Keyboard input handling
91
- export {
92
- decodeKittyPrintable,
93
- isKeyRelease,
94
- isKeyRepeat,
95
- isKittyProtocolActive,
96
- Key,
97
- type KeyEventType,
98
- type KeyId,
99
- matchesKey,
100
- parseKey,
101
- setKittyProtocolActive,
102
- } from "./keys.ts";
103
- // LaTeX rendering
104
- export { type RenderLatexOptions, renderLatex } from "./latex.ts";
105
- // Native platform integration
106
- export { getNativeClipboard, type NativeClipboard } from "./native-platform.ts";
107
- export { oklabToOkhslLightness } from "./oklab.ts";
108
- // Input buffering for batch splitting
109
- export { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from "./stdin-buffer.ts";
110
- // Terminal interface and implementations
111
- export { ProcessTerminal, type Terminal } from "./terminal.ts";
112
- // Terminal colors
113
- export {
114
- parseTerminalColorSchemeReport,
115
- type RgbColor,
116
- type TerminalColorScheme,
117
- type TerminalColors,
118
- } from "./terminal-colors.ts";
119
- // Terminal image support
120
- export {
121
- allocateImageId,
122
- type CellDimensions,
123
- calculateImageRows,
124
- deleteAllKittyImages,
125
- deleteKittyImage,
126
- detectCapabilities,
127
- encodeITerm2,
128
- encodeKitty,
129
- getCapabilities,
130
- getCellDimensions,
131
- getGifDimensions,
132
- getImageDimensions,
133
- getJpegDimensions,
134
- getPngDimensions,
135
- getTerminalColorMode,
136
- getWebpDimensions,
137
- hyperlink,
138
- type ImageDimensions,
139
- type ImageProtocol,
140
- type ImageRenderOptions,
141
- imageFallback,
142
- renderImage,
143
- resetCapabilitiesCache,
144
- setCapabilities,
145
- setCapabilityOverrides,
146
- setCellDimensions,
147
- type TerminalCapabilities,
148
- } from "./terminal-image.ts";
149
- export {
150
- type Component,
151
- Container,
152
- CURSOR_MARKER,
153
- compositeTuiLine,
154
- type Focusable,
155
- isFocusable,
156
- isViewportTUI,
157
- type OverlayAnchor,
158
- type OverlayBounds,
159
- type OverlayHandle,
160
- type OverlayMargin,
161
- type OverlayOptions,
162
- type OverlayUnfocusOptions,
163
- type SizeValue,
164
- type TUI,
165
- type TuiInputListener,
166
- type TuiInputListenerResult,
167
- type TuiMode,
168
- type TuiMouseButton,
169
- type TuiMouseEvent,
170
- type TuiMouseEventResult,
171
- type TuiMouseEventType,
172
- type TuiStopOptions,
173
- type ViewportTUI,
174
- } from "./tui.ts";
175
- export { TuiAltScreen, type TuiAltScreenOptions } from "./tui-alt-screen.ts";
176
- export { TuiMainScreen, type TuiMainScreenRenderState } from "./tui-main-screen.ts";
177
- // Utilities
178
- export {
179
- getOsc8LinkAtColumn,
180
- sliceByColumn,
181
- stripTerminalSequences,
182
- truncateToWidth,
183
- visibleWidth,
184
- wrapTextWithAnsi,
185
- } from "./utils.ts";
186
- export type { WheelScrollLines } from "./wheel-scroll.ts";