@visual-z/xeno 0.2.1 → 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.
- package/CHANGELOG.md +9 -0
- package/README.md +106 -26
- package/docs/install.md +51 -13
- package/docs/providers.md +11 -0
- package/package.json +5 -4
- package/src/apps/approve.ts +3 -3
- package/src/apps/commands.ts +38 -5
- package/src/apps/completions.ts +73 -19
- package/src/apps/image-draft.ts +46 -0
- package/src/apps/project-trust.ts +2 -42
- package/src/apps/provider-connect.ts +346 -0
- package/src/apps/render.ts +22 -47
- package/src/apps/resources.ts +5 -2
- package/src/apps/shell.ts +298 -1526
- package/src/apps/startup-input.ts +45 -9
- package/src/apps/startup.ts +128 -86
- package/src/apps/ui/app.ts +1383 -0
- package/src/apps/ui/extension-host.ts +194 -0
- package/src/apps/ui/image-cache.ts +78 -0
- package/src/apps/ui/palette.ts +88 -0
- package/src/apps/ui/project.ts +127 -0
- package/src/apps/ui/standalone.ts +146 -0
- package/src/apps/ui/status-model.ts +68 -0
- package/src/apps/ui/surface.ts +84 -0
- package/src/apps/ui/theme.ts +86 -0
- package/src/core/acceptance.ts +107 -0
- package/src/core/action-defaults.ts +47 -295
- package/src/core/benchmark.ts +2 -2
- package/src/core/branch-receipt.ts +24 -0
- package/src/core/checkpoints.ts +64 -0
- package/src/core/churn.ts +2 -0
- package/src/core/command-artifacts.ts +94 -0
- package/src/core/command-contract.ts +35 -0
- package/src/core/completion-review.ts +21 -5
- package/src/core/context-detail.ts +37 -0
- package/src/core/context-policy.ts +74 -1
- package/src/core/continuation.ts +17 -2
- package/src/core/derive.ts +29 -3
- package/src/core/draft-images.ts +56 -0
- package/src/core/environment.ts +145 -0
- package/src/core/evaluation-coverage.ts +74 -0
- package/src/core/event-validation.ts +80 -5
- package/src/core/events.ts +97 -3
- package/src/core/evidence-links.ts +7 -0
- package/src/core/evidence.ts +13 -3
- package/src/core/execution.ts +8 -2
- package/src/core/experiment.ts +133 -0
- package/src/core/export.ts +9 -0
- package/src/core/failure-recovery.ts +173 -0
- package/src/core/file-precondition.ts +72 -0
- package/src/core/handoff.ts +65 -4
- package/src/core/history-query.ts +38 -2
- package/src/core/history.ts +38 -1
- package/src/core/integration-health.ts +34 -0
- package/src/core/keymap.ts +8 -20
- package/src/core/model-picker.ts +64 -0
- package/src/core/native-eval.ts +25 -0
- package/src/core/note-guidance.ts +34 -0
- package/src/core/observation-view.ts +49 -8
- package/src/core/permissions.ts +24 -2
- package/src/core/process-receipt.ts +105 -0
- package/src/core/process-state.ts +37 -0
- package/src/core/project.ts +45 -18
- package/src/core/prompt-policy.ts +37 -0
- package/src/core/query-eval-contract.ts +14 -0
- package/src/core/read-observation.ts +82 -0
- package/src/core/recovery-corpus.ts +17 -0
- package/src/core/recovery-evaluation.ts +60 -0
- package/src/core/recovery-sources.ts +74 -0
- package/src/core/runtime-target.ts +94 -0
- package/src/core/search-observation.ts +97 -0
- package/src/core/session-tree.ts +147 -0
- package/src/core/settings.ts +26 -10
- package/src/core/skills.ts +44 -0
- package/src/core/sql-query.ts +211 -0
- package/src/core/theme.ts +36 -58
- package/src/core/tool-contract.ts +51 -2
- package/src/core/tool-discovery.ts +87 -0
- package/src/core/tool-failure.ts +60 -0
- package/src/core/tool-mode-protocol.ts +25 -0
- package/src/core/transcript.ts +19 -4
- package/src/core/trial-lifecycle.ts +14 -0
- package/src/core/tui-mode.ts +29 -0
- package/src/core/update-check.ts +97 -0
- package/src/core/version.ts +55 -0
- package/src/core/work-state.ts +49 -3
- package/src/core/working-set.ts +91 -0
- package/src/runtime/auth.ts +2 -2
- package/src/runtime/branch-jobs.ts +36 -0
- package/src/runtime/clipboard.ts +15 -4
- package/src/runtime/command-artifacts.ts +64 -0
- package/src/runtime/environment-tools.ts +60 -0
- package/src/runtime/evidence-notes.ts +4 -2
- package/src/runtime/exec-sessions.ts +206 -61
- package/src/runtime/execution-control.ts +1 -0
- package/src/runtime/extension-ui.ts +22 -30
- package/src/runtime/extensions.ts +95 -16
- package/src/runtime/harness-comparison.ts +27 -7
- package/src/runtime/harness-eval.ts +460 -0
- package/src/runtime/history-cache.ts +57 -0
- package/src/runtime/history-tools.ts +62 -12
- package/src/runtime/integrations.ts +210 -0
- package/src/runtime/loop.ts +1021 -268
- package/src/runtime/model-discovery.ts +208 -0
- package/src/runtime/native-eval-fixtures.ts +33 -0
- package/src/runtime/native-eval.ts +143 -0
- package/src/runtime/oauth.ts +1 -1
- package/src/runtime/provider-connect.ts +109 -0
- package/src/runtime/provider-presets.ts +87 -0
- package/src/runtime/query-eval-verifier.ts +28 -0
- package/src/runtime/recovery-coverage.ts +71 -0
- package/src/runtime/recovery-evidence.ts +76 -0
- package/src/runtime/recovery-fixtures.ts +116 -0
- package/src/runtime/runtime-target.ts +149 -0
- package/src/runtime/tool-broker.ts +137 -0
- package/src/runtime/tool-discovery.ts +57 -0
- package/src/runtime/tool-mode-eval.ts +146 -0
- package/src/runtime/tool-queue.ts +77 -0
- package/src/runtime/tools.ts +628 -183
- package/src/runtime/trial-control.ts +45 -0
- package/src/runtime/update-check.ts +47 -0
- package/src/runtime/window-trial.ts +2 -1
- package/src/runtime/working-notes.ts +33 -3
- package/src/runtime/workspace-lifecycle.ts +97 -0
- package/src/store/acceptance.ts +15 -0
- package/src/store/checkpoint-history.ts +43 -0
- package/src/store/command-artifacts.ts +96 -0
- package/src/store/command.ts +65 -37
- package/src/store/file-checkpoints.ts +104 -0
- package/src/store/file-index.ts +13 -1
- package/src/store/git-checkpoints.ts +67 -0
- package/src/store/observations.ts +61 -20
- package/src/store/process-receipts.ts +34 -0
- package/src/store/query-source.ts +13 -8
- package/src/store/recovery.ts +2 -3
- package/src/store/replay.ts +16 -4
- package/src/store/runtime-target.ts +64 -0
- package/src/store/search.ts +171 -132
- package/src/store/session-archive.ts +4 -0
- package/src/store/source-cancellation.ts +6 -0
- package/src/store/update-cache.ts +36 -0
- package/src/store/workspace-observation.ts +113 -0
- package/src/tui/ansi-spans.ts +126 -0
- package/src/tui/style.ts +19 -16
- package/src/tui/ui/atomic-draft.ts +121 -0
- package/src/tui/ui/canvas.ts +96 -0
- package/src/tui/ui/colors.ts +70 -0
- package/src/tui/ui/composer.ts +199 -0
- package/src/tui/ui/dialog.ts +379 -0
- package/src/tui/ui/draft.ts +23 -0
- package/src/tui/ui/edge.ts +186 -0
- package/src/tui/ui/image-size.ts +40 -0
- package/src/tui/ui/ink.ts +210 -0
- package/src/tui/ui/items.ts +40 -0
- package/src/tui/ui/keys.ts +40 -0
- package/src/tui/ui/layout.ts +74 -0
- package/src/tui/ui/list-model.ts +86 -0
- package/src/tui/ui/list-view.ts +172 -0
- package/src/tui/ui/mascot.ts +67 -0
- package/src/tui/ui/messages.ts +518 -0
- package/src/tui/ui/motion.ts +28 -0
- package/src/tui/ui/paths.ts +10 -0
- package/src/tui/ui/pictures.ts +78 -0
- package/src/tui/ui/screen.ts +421 -0
- package/src/tui/ui/status.ts +271 -0
- package/src/tui/ui/styled.ts +85 -0
- package/src/tui/ui/testing.ts +5 -0
- package/src/tui/ui/tool-card.ts +150 -0
- package/src/apps/extension-ui.ts +0 -330
- package/src/apps/resource-browser.ts +0 -75
- package/src/apps/session-browser.ts +0 -113
- package/src/apps/session-picker.ts +0 -55
- package/src/tui/ansi.ts +0 -67
- package/src/tui/autocomplete.ts +0 -29
- package/src/tui/chat-viewport.ts +0 -47
- package/src/tui/complete.ts +0 -87
- package/src/tui/editor.ts +0 -940
- package/src/tui/host.ts +0 -264
- package/src/tui/input.ts +0 -75
- package/src/tui/keys.ts +0 -378
- package/src/tui/markdown.ts +0 -17
- package/src/tui/render.ts +0 -153
- package/src/tui/select.ts +0 -258
- package/src/tui/settings.ts +0 -44
- package/src/tui/statusline.ts +0 -162
- package/src/tui/system-theme.ts +0 -700
- package/src/tui/terminal.ts +0 -30
- package/src/tui/text.ts +0 -52
- package/src/tui/toolview.ts +0 -386
- package/src/tui/transcript.ts +0 -123
- package/src/tui/tree.ts +0 -471
- package/src/vendor/pi-tui/LICENSE.upstream +0 -21
- package/src/vendor/pi-tui/UPSTREAM.json +0 -50
- package/src/vendor/pi-tui/VENDOR.md +0 -25
- package/src/vendor/pi-tui/alt-screen-search.ts +0 -327
- package/src/vendor/pi-tui/autocomplete.ts +0 -860
- package/src/vendor/pi-tui/colors.ts +0 -367
- package/src/vendor/pi-tui/components/alt-screen-flash.ts +0 -51
- package/src/vendor/pi-tui/components/box.ts +0 -166
- package/src/vendor/pi-tui/components/cancellable-loader.ts +0 -40
- package/src/vendor/pi-tui/components/editor.ts +0 -2472
- package/src/vendor/pi-tui/components/h-stack.ts +0 -44
- package/src/vendor/pi-tui/components/image.ts +0 -127
- package/src/vendor/pi-tui/components/input.ts +0 -494
- package/src/vendor/pi-tui/components/loader.ts +0 -101
- package/src/vendor/pi-tui/components/markdown.ts +0 -1021
- package/src/vendor/pi-tui/components/mouse-region.ts +0 -33
- package/src/vendor/pi-tui/components/scroll-view.ts +0 -224
- package/src/vendor/pi-tui/components/select-list.ts +0 -273
- package/src/vendor/pi-tui/components/settings-list.ts +0 -328
- package/src/vendor/pi-tui/components/spacer.ts +0 -28
- package/src/vendor/pi-tui/components/stack.ts +0 -154
- package/src/vendor/pi-tui/components/text.ts +0 -107
- package/src/vendor/pi-tui/components/truncated-text.ts +0 -65
- package/src/vendor/pi-tui/components/v-stack.ts +0 -33
- package/src/vendor/pi-tui/editor-component.ts +0 -74
- package/src/vendor/pi-tui/fuzzy.ts +0 -138
- package/src/vendor/pi-tui/index.ts +0 -186
- package/src/vendor/pi-tui/keybindings.ts +0 -320
- package/src/vendor/pi-tui/keys.ts +0 -1401
- package/src/vendor/pi-tui/kill-ring.ts +0 -46
- package/src/vendor/pi-tui/latex.ts +0 -1506
- package/src/vendor/pi-tui/layout-node.ts +0 -51
- package/src/vendor/pi-tui/layout.ts +0 -449
- package/src/vendor/pi-tui/native/UPSTREAM.json +0 -23
- package/src/vendor/pi-tui/native/clipboard.h +0 -208
- package/src/vendor/pi-tui/native/darwin/README.md +0 -22
- package/src/vendor/pi-tui/native/darwin/build.sh +0 -69
- package/src/vendor/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
- package/src/vendor/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
- package/src/vendor/pi-tui/native/darwin/src/darwin-platform.m +0 -132
- package/src/vendor/pi-tui/native/linux/README.md +0 -23
- package/src/vendor/pi-tui/native/linux/build.sh +0 -65
- package/src/vendor/pi-tui/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
- package/src/vendor/pi-tui/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
- package/src/vendor/pi-tui/native/linux/src/clipboard-worker.h +0 -70
- package/src/vendor/pi-tui/native/linux/src/linux-platform-x11.c +0 -274
- package/src/vendor/pi-tui/native/napi.h +0 -91
- package/src/vendor/pi-tui/native/win32/README.md +0 -31
- package/src/vendor/pi-tui/native/win32/build.mjs +0 -232
- package/src/vendor/pi-tui/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
- package/src/vendor/pi-tui/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
- package/src/vendor/pi-tui/native/win32/src/win32-platform.c +0 -241
- package/src/vendor/pi-tui/native-modifiers.ts +0 -13
- package/src/vendor/pi-tui/native-module-path.ts +0 -31
- package/src/vendor/pi-tui/native-platform.ts +0 -65
- package/src/vendor/pi-tui/oklab.ts +0 -233
- package/src/vendor/pi-tui/stdin-buffer.ts +0 -444
- package/src/vendor/pi-tui/terminal-colors.ts +0 -91
- package/src/vendor/pi-tui/terminal-image.ts +0 -731
- package/src/vendor/pi-tui/terminal.ts +0 -554
- package/src/vendor/pi-tui/tui-alt-screen.ts +0 -1750
- package/src/vendor/pi-tui/tui-main-screen.ts +0 -655
- package/src/vendor/pi-tui/tui.ts +0 -1493
- package/src/vendor/pi-tui/undo-stack.ts +0 -28
- package/src/vendor/pi-tui/utils.ts +0 -1385
- package/src/vendor/pi-tui/wheel-scroll.ts +0 -82
- 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";
|