@code-yeongyu/senpi-tui 2026.9.28 → 2026.9.29-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.
- package/dist/autocomplete.d.ts +5 -0
- package/dist/autocomplete.d.ts.map +1 -1
- package/dist/autocomplete.js +6 -4
- package/dist/autocomplete.js.map +1 -1
- package/dist/components/editor.d.ts +7 -1
- package/dist/components/editor.d.ts.map +1 -1
- package/dist/components/editor.js +34 -2
- package/dist/components/editor.js.map +1 -1
- package/dist/editor-component.d.ts +9 -2
- package/dist/editor-component.d.ts.map +1 -1
- package/dist/editor-component.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/slash-command-autocomplete.d.ts +5 -0
- package/dist/slash-command-autocomplete.d.ts.map +1 -1
- package/dist/slash-command-autocomplete.js +10 -0
- package/dist/slash-command-autocomplete.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,6 +2,11 @@ import type { AutocompleteProvider } from "./autocomplete.ts";
|
|
|
2
2
|
import type { EditorImageState } from "./image-markers.ts";
|
|
3
3
|
import type { EditorPasteState } from "./paste-markers.ts";
|
|
4
4
|
import type { Component } from "./tui.ts";
|
|
5
|
+
/** What a submission carried before the editor trimmed it for `onSubmit`. */
|
|
6
|
+
export interface EditorSubmitDetails {
|
|
7
|
+
/** The submitted text with paste markers expanded, before trimming. */
|
|
8
|
+
readonly rawText: string;
|
|
9
|
+
}
|
|
5
10
|
/**
|
|
6
11
|
* Interface for custom editor components.
|
|
7
12
|
*
|
|
@@ -16,14 +21,16 @@ export interface EditorComponent extends Component {
|
|
|
16
21
|
setText(text: string): void;
|
|
17
22
|
/** Handle raw terminal input (key presses, paste sequences, etc.) */
|
|
18
23
|
handleInput(data: string): void;
|
|
19
|
-
/** Called when user submits (e.g., Enter key) */
|
|
20
|
-
onSubmit?: (text: string) => void;
|
|
24
|
+
/** Called when user submits (e.g., Enter key); `details` is absent when an editor does not report it. */
|
|
25
|
+
onSubmit?: (text: string, details?: EditorSubmitDetails) => void;
|
|
21
26
|
/** Called when text changes */
|
|
22
27
|
onChange?: (text: string) => void;
|
|
23
28
|
/** Add text to history for up/down navigation */
|
|
24
29
|
addToHistory?(text: string): void;
|
|
25
30
|
/** Insert text at current cursor position */
|
|
26
31
|
insertTextAtCursor?(text: string): void;
|
|
32
|
+
/** Request autocomplete suggestions at the cursor, as typing would. */
|
|
33
|
+
openAutocomplete?(): void;
|
|
27
34
|
/**
|
|
28
35
|
* Get text with any markers expanded (e.g., paste markers).
|
|
29
36
|
* Falls back to getText() if not implemented.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-component.d.ts","sourceRoot":"","sources":["../src/editor-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAKjD,mCAAmC;IACnC,OAAO,IAAI,MAAM,CAAC;IAElB,2BAA2B;IAC3B,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,qEAAqE;IACrE,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAMhC,
|
|
1
|
+
{"version":3,"file":"editor-component.d.ts","sourceRoot":"","sources":["../src/editor-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBA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;;;;;;;;OAYG;IACH,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAElD;;;;;;;;;OASG;IACH,uBAAuB,CAAC,EAAE,MAAM,OAAO,CAAC;IAExC;;;;;;OAMG;IACH,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAMlD,oCAAoC;IACpC,uBAAuB,CAAC,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAM/D,4BAA4B;IAC5B,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtC,6BAA6B;IAC7B,WAAW,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpC,qDAAqD;IACrD,yBAAyB,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-component.js","sourceRoot":"","sources":["../src/editor-component.ts"],"names":[],"mappings":"","sourcesContent":["import type { AutocompleteProvider } from \"./autocomplete.ts\";\nimport type { EditorImageState } from \"./image-markers.ts\";\nimport type { EditorPasteState } from \"./paste-markers.ts\";\nimport type { Component } from \"./tui.ts\";\n\n/**\n * Interface for custom editor components.\n *\n * This allows extensions to provide their own editor implementation\n * (e.g., vim mode, emacs mode, custom keybindings) while maintaining\n * compatibility with the core application.\n */\nexport interface EditorComponent extends Component {\n\t// =========================================================================\n\t// Core text access (required)\n\t// =========================================================================\n\n\t/** Get the current text content */\n\tgetText(): string;\n\n\t/** Set the text content */\n\tsetText(text: string): void;\n\n\t/** Handle raw terminal input (key presses, paste sequences, etc.) */\n\thandleInput(data: string): void;\n\n\t// =========================================================================\n\t// Callbacks (required)\n\t// =========================================================================\n\n\t/** Called when user submits (e.g., Enter key) */\n\tonSubmit?: (text: string) => void;\n\n\t/** Called when text changes */\n\tonChange?: (text: string) => void;\n\n\t// =========================================================================\n\t// History support (optional)\n\t// =========================================================================\n\n\t/** Add text to history for up/down navigation */\n\taddToHistory?(text: string): void;\n\n\t// =========================================================================\n\t// Advanced text manipulation (optional)\n\t// =========================================================================\n\n\t/** Insert text at current cursor position */\n\tinsertTextAtCursor?(text: string): void;\n\n\t/**\n\t * Get text with any markers expanded (e.g., paste markers).\n\t * Falls back to getText() if not implemented.\n\t */\n\tgetExpandedText?(): string;\n\n\t/**\n\t * Snapshot the paste-marker registry so collapsed markers can be\n\t * transferred to another editor instance alongside getText().\n\t *\n\t * Paired contract: implement getPasteState and setPasteState together.\n\t * Callers only hand collapsed markers to an editor that can export them\n\t * again; an editor implementing setPasteState without getPasteState is\n\t * treated as paste-unaware and receives expanded text instead.\n\t */\n\tgetPasteState?(): EditorPasteState;\n\n\t/**\n\t * Install a paste-marker registry snapshot taken from another editor\n\t * instance. Called after setText() with that editor's raw (marker) text.\n\t * Paired contract: implement together with getPasteState (see above).\n\t * When not implemented, callers must transfer the expanded text instead.\n\t */\n\tsetPasteState?(state: EditorPasteState): void;\n\n\t// =========================================================================\n\t// Image markers (optional)\n\t// =========================================================================\n\n\t/**\n\t * Insert the next atomic `[Image #N]` marker at the cursor and return its id.\n\t * The editor stores ids only; the caller keeps the image payload keyed by id.\n\t *\n\t * The returned id is the marker's FINAL canonical number - its 1-based\n\t * reading position after the editor renumbers the visible markers to stay\n\t * 1..k in reading order - and `onImageMarkersChanged` fires (with the\n\t * PRE-renumber ids) before the id is returned, so the caller registering its\n\t * payload under the returned id immediately after the call always lands on\n\t * a vacant slot.\n\t *\n\t * Paired contract: implement insertImageMarker together with\n\t * onImageMarkersChanged. Callers must be told when markers are removed or\n\t * renumbered, otherwise their payload map desynchronizes from the visible\n\t * numbers; an editor exposing insertImageMarker without the callback is\n\t * treated as image-unaware and receives the plain text path instead.\n\t */\n\tinsertImageMarker?(): number;\n\n\t/**\n\t * Snapshot the image-marker registry (ids only, never image bytes) so markers\n\t * can be transferred to another editor instance alongside getText().\n\t *\n\t * Paired contract: implement getImageMarkerState and setImageMarkerState\n\t * together. Callers only hand markers to an editor that can export them\n\t * again; an editor implementing setImageMarkerState without\n\t * getImageMarkerState is treated as marker-unaware and its markers are\n\t * dropped on transfer.\n\t */\n\tgetImageMarkerState?(): EditorImageState;\n\n\t/**\n\t * Install an image-marker registry snapshot taken from another editor\n\t * instance. Called after setText() with that editor's raw (marker) text.\n\t * Paired contract: implement together with getImageMarkerState (see above).\n\t */\n\tsetImageMarkerState?(state: EditorImageState): void;\n\n\t/**\n\t * Called with the image-marker ids in text reading order whenever markers are\n\t * added, removed, pruned or renumbered.\n\t *\n\t * The reported ids are the keys the caller currently keys its payloads by\n\t * (the PRE-renumber ids), and after every change the visible numbers are\n\t * canonical 1..k in reading order, so the caller re-keys payload\n\t * `order[i]` onto slot `i + 1`.\n\t *\n\t * Paired contract: required whenever insertImageMarker is implemented (see\n\t * above) - the reported order is the only signal that keeps the caller's\n\t * payload map aligned with the displayed `[Image #N]` numbers.\n\t */\n\tonImageMarkersChanged?: (order: number[]) => void;\n\n\t/**\n\t * Snapshot the attachment payloads keyed by marker id so the editor's undo\n\t * stack can restore them together with the marker text and registry ids.\n\t * The editor stores the returned value opaquely; return `undefined` to store\n\t * nothing.\n\t *\n\t * Paired contract: implement together with restoreAttachmentState. Without\n\t * these hooks an undo that revives a deleted marker displays it with no (or\n\t * the wrong) payload behind it, because the delete re-keyed the survivors.\n\t */\n\tsnapshotAttachmentState?: () => unknown;\n\n\t/**\n\t * Restore the attachment payloads captured by {@link snapshotAttachmentState}\n\t * when the editor's undo pops the matching snapshot. Called before\n\t * `onImageMarkersChanged` fires for that undo.\n\t *\n\t * Paired contract: implement together with snapshotAttachmentState.\n\t */\n\trestoreAttachmentState?: (state: unknown) => void;\n\n\t// =========================================================================\n\t// Autocomplete support (optional)\n\t// =========================================================================\n\n\t/** Set the autocomplete provider */\n\tsetAutocompleteProvider?(provider: AutocompleteProvider): void;\n\n\t// =========================================================================\n\t// Appearance (optional)\n\t// =========================================================================\n\n\t/** Border color function */\n\tborderColor?: (str: string) => string;\n\n\t/** Set horizontal padding */\n\tsetPaddingX?(padding: number): void;\n\n\t/** Set max visible items in autocomplete dropdown */\n\tsetAutocompleteMaxVisible?(maxVisible: number): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"editor-component.js","sourceRoot":"","sources":["../src/editor-component.ts"],"names":[],"mappings":"","sourcesContent":["import type { AutocompleteProvider } from \"./autocomplete.ts\";\nimport type { EditorImageState } from \"./image-markers.ts\";\nimport type { EditorPasteState } from \"./paste-markers.ts\";\nimport type { Component } from \"./tui.ts\";\n\n/** What a submission carried before the editor trimmed it for `onSubmit`. */\nexport interface EditorSubmitDetails {\n\t/** The submitted text with paste markers expanded, before trimming. */\n\treadonly rawText: string;\n}\n\n/**\n * Interface for custom editor components.\n *\n * This allows extensions to provide their own editor implementation\n * (e.g., vim mode, emacs mode, custom keybindings) while maintaining\n * compatibility with the core application.\n */\nexport interface EditorComponent extends Component {\n\t// =========================================================================\n\t// Core text access (required)\n\t// =========================================================================\n\n\t/** Get the current text content */\n\tgetText(): string;\n\n\t/** Set the text content */\n\tsetText(text: string): void;\n\n\t/** Handle raw terminal input (key presses, paste sequences, etc.) */\n\thandleInput(data: string): void;\n\n\t// =========================================================================\n\t// Callbacks (required)\n\t// =========================================================================\n\n\t/** Called when user submits (e.g., Enter key); `details` is absent when an editor does not report it. */\n\tonSubmit?: (text: string, details?: EditorSubmitDetails) => void;\n\n\t/** Called when text changes */\n\tonChange?: (text: string) => void;\n\n\t// =========================================================================\n\t// History support (optional)\n\t// =========================================================================\n\n\t/** Add text to history for up/down navigation */\n\taddToHistory?(text: string): void;\n\n\t// =========================================================================\n\t// Advanced text manipulation (optional)\n\t// =========================================================================\n\n\t/** Insert text at current cursor position */\n\tinsertTextAtCursor?(text: string): void;\n\n\t/** Request autocomplete suggestions at the cursor, as typing would. */\n\topenAutocomplete?(): void;\n\n\t/**\n\t * Get text with any markers expanded (e.g., paste markers).\n\t * Falls back to getText() if not implemented.\n\t */\n\tgetExpandedText?(): string;\n\n\t/**\n\t * Snapshot the paste-marker registry so collapsed markers can be\n\t * transferred to another editor instance alongside getText().\n\t *\n\t * Paired contract: implement getPasteState and setPasteState together.\n\t * Callers only hand collapsed markers to an editor that can export them\n\t * again; an editor implementing setPasteState without getPasteState is\n\t * treated as paste-unaware and receives expanded text instead.\n\t */\n\tgetPasteState?(): EditorPasteState;\n\n\t/**\n\t * Install a paste-marker registry snapshot taken from another editor\n\t * instance. Called after setText() with that editor's raw (marker) text.\n\t * Paired contract: implement together with getPasteState (see above).\n\t * When not implemented, callers must transfer the expanded text instead.\n\t */\n\tsetPasteState?(state: EditorPasteState): void;\n\n\t// =========================================================================\n\t// Image markers (optional)\n\t// =========================================================================\n\n\t/**\n\t * Insert the next atomic `[Image #N]` marker at the cursor and return its id.\n\t * The editor stores ids only; the caller keeps the image payload keyed by id.\n\t *\n\t * The returned id is the marker's FINAL canonical number - its 1-based\n\t * reading position after the editor renumbers the visible markers to stay\n\t * 1..k in reading order - and `onImageMarkersChanged` fires (with the\n\t * PRE-renumber ids) before the id is returned, so the caller registering its\n\t * payload under the returned id immediately after the call always lands on\n\t * a vacant slot.\n\t *\n\t * Paired contract: implement insertImageMarker together with\n\t * onImageMarkersChanged. Callers must be told when markers are removed or\n\t * renumbered, otherwise their payload map desynchronizes from the visible\n\t * numbers; an editor exposing insertImageMarker without the callback is\n\t * treated as image-unaware and receives the plain text path instead.\n\t */\n\tinsertImageMarker?(): number;\n\n\t/**\n\t * Snapshot the image-marker registry (ids only, never image bytes) so markers\n\t * can be transferred to another editor instance alongside getText().\n\t *\n\t * Paired contract: implement getImageMarkerState and setImageMarkerState\n\t * together. Callers only hand markers to an editor that can export them\n\t * again; an editor implementing setImageMarkerState without\n\t * getImageMarkerState is treated as marker-unaware and its markers are\n\t * dropped on transfer.\n\t */\n\tgetImageMarkerState?(): EditorImageState;\n\n\t/**\n\t * Install an image-marker registry snapshot taken from another editor\n\t * instance. Called after setText() with that editor's raw (marker) text.\n\t * Paired contract: implement together with getImageMarkerState (see above).\n\t */\n\tsetImageMarkerState?(state: EditorImageState): void;\n\n\t/**\n\t * Called with the image-marker ids in text reading order whenever markers are\n\t * added, removed, pruned or renumbered.\n\t *\n\t * The reported ids are the keys the caller currently keys its payloads by\n\t * (the PRE-renumber ids), and after every change the visible numbers are\n\t * canonical 1..k in reading order, so the caller re-keys payload\n\t * `order[i]` onto slot `i + 1`.\n\t *\n\t * Paired contract: required whenever insertImageMarker is implemented (see\n\t * above) - the reported order is the only signal that keeps the caller's\n\t * payload map aligned with the displayed `[Image #N]` numbers.\n\t */\n\tonImageMarkersChanged?: (order: number[]) => void;\n\n\t/**\n\t * Snapshot the attachment payloads keyed by marker id so the editor's undo\n\t * stack can restore them together with the marker text and registry ids.\n\t * The editor stores the returned value opaquely; return `undefined` to store\n\t * nothing.\n\t *\n\t * Paired contract: implement together with restoreAttachmentState. Without\n\t * these hooks an undo that revives a deleted marker displays it with no (or\n\t * the wrong) payload behind it, because the delete re-keyed the survivors.\n\t */\n\tsnapshotAttachmentState?: () => unknown;\n\n\t/**\n\t * Restore the attachment payloads captured by {@link snapshotAttachmentState}\n\t * when the editor's undo pops the matching snapshot. Called before\n\t * `onImageMarkersChanged` fires for that undo.\n\t *\n\t * Paired contract: implement together with snapshotAttachmentState.\n\t */\n\trestoreAttachmentState?: (state: unknown) => void;\n\n\t// =========================================================================\n\t// Autocomplete support (optional)\n\t// =========================================================================\n\n\t/** Set the autocomplete provider */\n\tsetAutocompleteProvider?(provider: AutocompleteProvider): void;\n\n\t// =========================================================================\n\t// Appearance (optional)\n\t// =========================================================================\n\n\t/** Border color function */\n\tborderColor?: (str: string) => string;\n\n\t/** Set horizontal padding */\n\tsetPaddingX?(padding: number): void;\n\n\t/** Set max visible items in autocomplete dropdown */\n\tsetAutocompleteMaxVisible?(maxVisible: number): void;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export { Spacer } from "./components/spacer.ts";
|
|
|
18
18
|
export { Text } from "./components/text.ts";
|
|
19
19
|
export { TruncatedText } from "./components/truncated-text.ts";
|
|
20
20
|
export { type StackChild, type StackEntry, type StackEntryOptions, type StackOptions, VStack, } from "./components/v-stack.ts";
|
|
21
|
-
export type { EditorComponent } from "./editor-component.ts";
|
|
21
|
+
export type { EditorComponent, EditorSubmitDetails } from "./editor-component.ts";
|
|
22
22
|
export { type FuzzyMatch, fuzzyFilter, fuzzyMatch, fuzzyMatchLower } from "./fuzzy.ts";
|
|
23
23
|
export { type EditorImageState, formatImageMarker, IMAGE_MARKER_REGEX, IMAGE_MARKER_SINGLE, type ImageMarkerCanonicalization, ImageMarkerRegistry, type ImageMarkerRemoval, imageMarkerId, isImageMarker, } from "./image-markers.ts";
|
|
24
24
|
export { getKeybindings, type Keybinding, type KeybindingConflict, type KeybindingDefinition, type KeybindingDefinitions, type Keybindings, type KeybindingsConfig, KeybindingsManager, setKeybindings, TUI_KEYBINDINGS, } from "./keybindings.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAG3E,OAAO,EAAE,MAAM,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEzD,OAAO,EACN,wBAAwB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,4BAA4B,EAC5B,KAAK,YAAY,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC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ACtB,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,mBAAmB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,KAAK,SAAS,EACd,WAAW,EACX,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,GAAG,EACH,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,WAAW,GAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,KAAK,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEpF,OAAO,EACN,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,YAAY,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAA2B,MAAM,QAAQ,CAAC;AACzD,+BAA+B;AAC/B,OAAO,EACN,wBAAwB,EAGxB,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,wBAAwB,CAAC;AAChC,uBA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B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAEN,SAAS,EACT,aAAa,EACb,gBAAgB,EAEhB,WAAW,EACX,aAAa,EAQb,GAAG,GAUH,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAA4B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAiC,MAAM,sBAAsB,CAAC;AACpF,YAAY;AACZ,OAAO,EACN,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,YAAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\nimport type { CellDimensions, ImageDimensions } from \"./terminal-image.ts\";\nimport { calculateImageCellSize } from \"./terminal-image.ts\";\n\nexport { Marked, type Token, type Tokens } from \"marked\";\n// Fullscreen transcript search\nexport {\n\tAltScreenSearchComponent,\n\ttype AltScreenSearchMatch,\n\ttype AltScreenSearchSegment,\n\tfindAltScreenSearchMatches,\n\tgetAltScreenSearchMatchKey,\n} from \"./alt-screen-search.ts\";\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.ts\";\n// Components\nexport { Box } from \"./components/box.ts\";\nexport { CancellableLoader } from \"./components/cancellable-loader.ts\";\nexport {\n\tEditor,\n\ttype EditorOptions,\n\ttype EditorTheme,\n} from \"./components/editor.ts\";\nexport { HStack } from \"./components/h-stack.ts\";\nexport { Image, type ImageOptions, type ImageTheme } from \"./components/image.ts\";\nexport { Input } from \"./components/input.ts\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.ts\";\nexport {\n\tclearRenderCache,\n\ttype DefaultTextStyle,\n\tgetMarkdownHighlightCallCount,\n\tMarkdown,\n\ttype MarkdownOptions,\n\ttype MarkdownTheme,\n\tresetMarkdownHighlightCallCount,\n} from \"./components/markdown.ts\";\nexport { MouseRegion, type MouseRegionHandler } from \"./components/mouse-region.ts\";\nexport {\n\tScrollView,\n\ttype ScrollViewOptions,\n\ttype ScrollViewScrollbar,\n\ttype ScrollViewScrollToOptions,\n} from \"./components/scroll-view.ts\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListRenderRow,\n\ttype SelectListRowParts,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.ts\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.ts\";\nexport { Spacer } from \"./components/spacer.ts\";\nexport { Text } from \"./components/text.ts\";\nexport { TruncatedText } from \"./components/truncated-text.ts\";\nexport {\n\ttype StackChild,\n\ttype StackEntry,\n\ttype StackEntryOptions,\n\ttype StackOptions,\n\tVStack,\n} from \"./components/v-stack.ts\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent } from \"./editor-component.ts\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch, fuzzyMatchLower } from \"./fuzzy.ts\";\n// Atomic image markers (ids only - never image bytes)\nexport {\n\ttype EditorImageState,\n\tformatImageMarker,\n\tIMAGE_MARKER_REGEX,\n\tIMAGE_MARKER_SINGLE,\n\ttype ImageMarkerCanonicalization,\n\tImageMarkerRegistry,\n\ttype ImageMarkerRemoval,\n\timageMarkerId,\n\tisImageMarker,\n} from \"./image-markers.ts\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\ttype Keybinding,\n\ttype KeybindingConflict,\n\ttype KeybindingDefinition,\n\ttype KeybindingDefinitions,\n\ttype Keybindings,\n\ttype KeybindingsConfig,\n\tKeybindingsManager,\n\tsetKeybindings,\n\tTUI_KEYBINDINGS,\n} from \"./keybindings.ts\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.ts\";\nexport {\n\tdecodeMouseButton,\n\tisMouseSequence,\n\tMOUSE_TRACKING,\n\tMouseClickSynthesizer,\n\tparseSgrMouseEvent,\n\tparseWheelEvent,\n\ttype SgrMouseEvent,\n\ttoTuiMouseEvent,\n\ttype WheelEvent,\n} from \"./mouse-input.ts\";\n// Native platform integration\nexport { getNativeClipboard, type NativeClipboard } from \"./native-platform.ts\";\nexport { type EditorPasteState, expandPasteMarkers } from \"./paste-markers.ts\";\n// Input buffering for batch splitting\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.ts\";\n// Terminal interface and implementations\nexport { type CursorPosition, ProcessTerminal, type ProcessTerminalOptions, type Terminal } from \"./terminal.ts\";\n// Terminal colors\nexport {\n\tparseOsc11BackgroundColor,\n\tparseTerminalColorSchemeReport,\n\ttype RgbColor,\n\ttype TerminalColorScheme,\n} from \"./terminal-colors.ts\";\n// Terminal image support\nexport function calculateImageRows(\n\timageDimensions: ImageDimensions,\n\ttargetWidthCells: number,\n\tcellDimensions: CellDimensions = { widthPx: 9, heightPx: 18 },\n): number {\n\treturn calculateImageCellSize(imageDimensions, targetWidthCells, undefined, cellDimensions).rows;\n}\nexport {\n\tallocateImageId,\n\tbuildKittyPlaceholderRow,\n\ttype CellDimensions,\n\tdeleteAllKittyImages,\n\tdeleteKittyImage,\n\tdetectCapabilities,\n\tencodeITerm2,\n\tencodeKitty,\n\tgetCapabilities,\n\tgetCellDimensions,\n\tgetGifDimensions,\n\tgetImageDimensions,\n\tgetJpegDimensions,\n\tgetPngDimensions,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\tKITTY_PLACEHOLDER_MAX,\n\touterKittyGraphicsMode,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCapabilityOverrides,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n\ttype TmuxPassthroughState,\n\twrapTmuxPassthrough,\n} from \"./terminal-image.ts\";\nexport { sanitizeTerminalLabel, shortenImagePath } from \"./terminal-text.ts\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\tcompositeTuiLine,\n\ttype Focusable,\n\tisFocusable,\n\tisViewportTUI,\n\ttype OverlayAnchor,\n\ttype OverlayBounds,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype OverlayUnfocusOptions,\n\ttype SizeValue,\n\tTUI,\n\ttype TuiInputListener,\n\ttype TuiInputListenerResult,\n\ttype TuiMode,\n\ttype TuiMouseButton,\n\ttype TuiMouseEvent,\n\ttype TuiMouseEventResult,\n\ttype TuiMouseEventType,\n\ttype TuiStopOptions,\n\ttype ViewportTUI,\n} from \"./tui.ts\";\nexport { TuiAltScreen, type TuiAltScreenOptions } from \"./tui-alt-screen.ts\";\nexport { TuiMainScreen, type TuiMainScreenRenderState } from \"./tui-main-screen.ts\";\n// Utilities\nexport {\n\tgetGraphemeSegmenter,\n\tgetOsc8LinkAtColumn,\n\tgetWordSegmenter,\n\tsliceByColumn,\n\tstripTerminalSequences,\n\ttruncateToWidth,\n\tvisibleWidth,\n\twrapTextWithAnsi,\n} from \"./utils.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAGlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAA2B,MAAM,QAAQ,CAAC;AACzD,+BAA+B;AAC/B,OAAO,EACN,wBAAwB,EAGxB,0BAA0B,EAC1B,0BAA0B,GAC1B,MAAM,wBAAwB,CAAC;AAChC,uBAAuB;AACvB,OAAO,EAIN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;AAC7B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAEN,SAAS,EACT,aAAa,EACb,gBAAgB,EAEhB,WAAW,EACX,aAAa,EAQb,GAAG,GAUH,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAA4B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAiC,MAAM,sBAAsB,CAAC;AACpF,YAAY;AACZ,OAAO,EACN,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,YAAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\nimport type { CellDimensions, ImageDimensions } from \"./terminal-image.ts\";\nimport { calculateImageCellSize } from \"./terminal-image.ts\";\n\nexport { Marked, type Token, type Tokens } from \"marked\";\n// Fullscreen transcript search\nexport {\n\tAltScreenSearchComponent,\n\ttype AltScreenSearchMatch,\n\ttype AltScreenSearchSegment,\n\tfindAltScreenSearchMatches,\n\tgetAltScreenSearchMatchKey,\n} from \"./alt-screen-search.ts\";\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.ts\";\n// Components\nexport { Box } from \"./components/box.ts\";\nexport { CancellableLoader } from \"./components/cancellable-loader.ts\";\nexport {\n\tEditor,\n\ttype EditorOptions,\n\ttype EditorTheme,\n} from \"./components/editor.ts\";\nexport { HStack } from \"./components/h-stack.ts\";\nexport { Image, type ImageOptions, type ImageTheme } from \"./components/image.ts\";\nexport { Input } from \"./components/input.ts\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.ts\";\nexport {\n\tclearRenderCache,\n\ttype DefaultTextStyle,\n\tgetMarkdownHighlightCallCount,\n\tMarkdown,\n\ttype MarkdownOptions,\n\ttype MarkdownTheme,\n\tresetMarkdownHighlightCallCount,\n} from \"./components/markdown.ts\";\nexport { MouseRegion, type MouseRegionHandler } from \"./components/mouse-region.ts\";\nexport {\n\tScrollView,\n\ttype ScrollViewOptions,\n\ttype ScrollViewScrollbar,\n\ttype ScrollViewScrollToOptions,\n} from \"./components/scroll-view.ts\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListRenderRow,\n\ttype SelectListRowParts,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.ts\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.ts\";\nexport { Spacer } from \"./components/spacer.ts\";\nexport { Text } from \"./components/text.ts\";\nexport { TruncatedText } from \"./components/truncated-text.ts\";\nexport {\n\ttype StackChild,\n\ttype StackEntry,\n\ttype StackEntryOptions,\n\ttype StackOptions,\n\tVStack,\n} from \"./components/v-stack.ts\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent, EditorSubmitDetails } from \"./editor-component.ts\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch, fuzzyMatchLower } from \"./fuzzy.ts\";\n// Atomic image markers (ids only - never image bytes)\nexport {\n\ttype EditorImageState,\n\tformatImageMarker,\n\tIMAGE_MARKER_REGEX,\n\tIMAGE_MARKER_SINGLE,\n\ttype ImageMarkerCanonicalization,\n\tImageMarkerRegistry,\n\ttype ImageMarkerRemoval,\n\timageMarkerId,\n\tisImageMarker,\n} from \"./image-markers.ts\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\ttype Keybinding,\n\ttype KeybindingConflict,\n\ttype KeybindingDefinition,\n\ttype KeybindingDefinitions,\n\ttype Keybindings,\n\ttype KeybindingsConfig,\n\tKeybindingsManager,\n\tsetKeybindings,\n\tTUI_KEYBINDINGS,\n} from \"./keybindings.ts\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.ts\";\nexport {\n\tdecodeMouseButton,\n\tisMouseSequence,\n\tMOUSE_TRACKING,\n\tMouseClickSynthesizer,\n\tparseSgrMouseEvent,\n\tparseWheelEvent,\n\ttype SgrMouseEvent,\n\ttoTuiMouseEvent,\n\ttype WheelEvent,\n} from \"./mouse-input.ts\";\n// Native platform integration\nexport { getNativeClipboard, type NativeClipboard } from \"./native-platform.ts\";\nexport { type EditorPasteState, expandPasteMarkers } from \"./paste-markers.ts\";\n// Input buffering for batch splitting\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.ts\";\n// Terminal interface and implementations\nexport { type CursorPosition, ProcessTerminal, type ProcessTerminalOptions, type Terminal } from \"./terminal.ts\";\n// Terminal colors\nexport {\n\tparseOsc11BackgroundColor,\n\tparseTerminalColorSchemeReport,\n\ttype RgbColor,\n\ttype TerminalColorScheme,\n} from \"./terminal-colors.ts\";\n// Terminal image support\nexport function calculateImageRows(\n\timageDimensions: ImageDimensions,\n\ttargetWidthCells: number,\n\tcellDimensions: CellDimensions = { widthPx: 9, heightPx: 18 },\n): number {\n\treturn calculateImageCellSize(imageDimensions, targetWidthCells, undefined, cellDimensions).rows;\n}\nexport {\n\tallocateImageId,\n\tbuildKittyPlaceholderRow,\n\ttype CellDimensions,\n\tdeleteAllKittyImages,\n\tdeleteKittyImage,\n\tdetectCapabilities,\n\tencodeITerm2,\n\tencodeKitty,\n\tgetCapabilities,\n\tgetCellDimensions,\n\tgetGifDimensions,\n\tgetImageDimensions,\n\tgetJpegDimensions,\n\tgetPngDimensions,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\tKITTY_PLACEHOLDER_MAX,\n\touterKittyGraphicsMode,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCapabilityOverrides,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n\ttype TmuxPassthroughState,\n\twrapTmuxPassthrough,\n} from \"./terminal-image.ts\";\nexport { sanitizeTerminalLabel, shortenImagePath } from \"./terminal-text.ts\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\tcompositeTuiLine,\n\ttype Focusable,\n\tisFocusable,\n\tisViewportTUI,\n\ttype OverlayAnchor,\n\ttype OverlayBounds,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype OverlayUnfocusOptions,\n\ttype SizeValue,\n\tTUI,\n\ttype TuiInputListener,\n\ttype TuiInputListenerResult,\n\ttype TuiMode,\n\ttype TuiMouseButton,\n\ttype TuiMouseEvent,\n\ttype TuiMouseEventResult,\n\ttype TuiMouseEventType,\n\ttype TuiStopOptions,\n\ttype ViewportTUI,\n} from \"./tui.ts\";\nexport { TuiAltScreen, type TuiAltScreenOptions } from \"./tui-alt-screen.ts\";\nexport { TuiMainScreen, type TuiMainScreenRenderState } from \"./tui-main-screen.ts\";\n// Utilities\nexport {\n\tgetGraphemeSegmenter,\n\tgetOsc8LinkAtColumn,\n\tgetWordSegmenter,\n\tsliceByColumn,\n\tstripTerminalSequences,\n\ttruncateToWidth,\n\tvisibleWidth,\n\twrapTextWithAnsi,\n} from \"./utils.ts\";\n"]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { AutocompleteItem, SlashCommand } from "./autocomplete.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A slash item whose value ends in `:` names a command namespace (`skill:` = "Browse available
|
|
4
|
+
* skills"), not a command: choosing it drills into that namespace's list instead of submitting.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isSlashNamespaceItem(value: string): boolean;
|
|
2
7
|
export declare function getSlashCommandSuggestions(commands: readonly (SlashCommand | AutocompleteItem)[], prefix: string): AutocompleteItem[];
|
|
3
8
|
//# sourceMappingURL=slash-command-autocomplete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash-command-autocomplete.d.ts","sourceRoot":"","sources":["../src/slash-command-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"slash-command-autocomplete.d.ts","sourceRoot":"","sources":["../src/slash-command-autocomplete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKxE;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE3D;AA6BD,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,SAAS,CAAC,YAAY,GAAG,gBAAgB,CAAC,EAAE,EACtD,MAAM,EAAE,MAAM,GACZ,gBAAgB,EAAE,CA0DpB"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { fuzzyFilter } from "./fuzzy.js";
|
|
2
2
|
const SKILL_COMMAND_PREFIX = "skill:";
|
|
3
|
+
/**
|
|
4
|
+
* A slash item whose value ends in `:` names a command namespace (`skill:` = "Browse available
|
|
5
|
+
* skills"), not a command: choosing it drills into that namespace's list instead of submitting.
|
|
6
|
+
*/
|
|
7
|
+
export function isSlashNamespaceItem(value) {
|
|
8
|
+
return value.endsWith(":");
|
|
9
|
+
}
|
|
3
10
|
function compareSlashCommandSuggestion(prefix, left, right) {
|
|
4
11
|
const leftExact = left.value === prefix;
|
|
5
12
|
const rightExact = right.value === prefix;
|
|
@@ -39,6 +46,7 @@ export function getSlashCommandSuggestions(commands, prefix) {
|
|
|
39
46
|
label: name,
|
|
40
47
|
description: fullDesc || undefined,
|
|
41
48
|
searchText: isSkill && !explicitSkillNamespace ? skillName : name,
|
|
49
|
+
awaitsArguments: hint !== undefined,
|
|
42
50
|
},
|
|
43
51
|
];
|
|
44
52
|
});
|
|
@@ -51,6 +59,7 @@ export function getSlashCommandSuggestions(commands, prefix) {
|
|
|
51
59
|
label: SKILL_COMMAND_PREFIX,
|
|
52
60
|
description: "Browse available skills",
|
|
53
61
|
searchText: SKILL_COMMAND_PREFIX,
|
|
62
|
+
awaitsArguments: false,
|
|
54
63
|
});
|
|
55
64
|
}
|
|
56
65
|
return fuzzyFilter(commandItems, prefix, (item) => item.searchText)
|
|
@@ -58,6 +67,7 @@ export function getSlashCommandSuggestions(commands, prefix) {
|
|
|
58
67
|
value: item.name,
|
|
59
68
|
label: item.label,
|
|
60
69
|
...(item.description && { description: item.description }),
|
|
70
|
+
...(item.awaitsArguments && { awaitsArguments: true }),
|
|
61
71
|
index,
|
|
62
72
|
}))
|
|
63
73
|
.sort((left, right) => compareSlashCommandSuggestion(normalizedPrefix, left, right))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slash-command-autocomplete.js","sourceRoot":"","sources":["../src/slash-command-autocomplete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"slash-command-autocomplete.js","sourceRoot":"","sources":["../src/slash-command-autocomplete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IACjD,OAAO,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAcD,SAAS,6BAA6B,CAAC,MAAc,EAAE,IAAuB,EAAE,KAAwB;IACvG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC;IACxC,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,KAAK,MAAM,CAAC;IAC1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CAAC;QACF,YAAY,CAAC,IAAI,CAAC;YACjB,IAAI,EAAE,oBAAoB;YAC1B,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EAAE,yBAAyB;YACtC,UAAU,EAAE,oBAAoB;YAChC,eAAe,EAAE,KAAK;SACtB,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;SACjE,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QACtB,KAAK,EAAE,IAAI,CAAC,IAAI;QAChB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1D,GAAG,CAAC,IAAI,CAAC,eAAe,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;QACtD,KAAK;KACL,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,6BAA6B,CAAC,gBAAgB,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;SACnF,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["import type { AutocompleteItem, SlashCommand } from \"./autocomplete.ts\";\nimport { fuzzyFilter } from \"./fuzzy.ts\";\n\nconst SKILL_COMMAND_PREFIX = \"skill:\";\n\n/**\n * A slash item whose value ends in `:` names a command namespace (`skill:` = \"Browse available\n * skills\"), not a command: choosing it drills into that namespace's list instead of submitting.\n */\nexport function isSlashNamespaceItem(value: string): boolean {\n\treturn value.endsWith(\":\");\n}\n\ntype CommandItem = {\n\treadonly name: string;\n\treadonly label: string;\n\treadonly description?: string;\n\treadonly searchText: string;\n\treadonly awaitsArguments: boolean;\n};\n\ntype RankedCommandItem = AutocompleteItem & {\n\treadonly index: number;\n};\n\nfunction compareSlashCommandSuggestion(prefix: string, left: RankedCommandItem, right: RankedCommandItem): number {\n\tconst leftExact = left.value === prefix;\n\tconst rightExact = right.value === prefix;\n\tif (leftExact !== rightExact) return leftExact ? -1 : 1;\n\n\tconst leftPrefix = left.value.startsWith(prefix);\n\tconst rightPrefix = right.value.startsWith(prefix);\n\tif (leftPrefix !== rightPrefix) return leftPrefix ? -1 : 1;\n\tif (leftPrefix && rightPrefix && left.value.length !== right.value.length) {\n\t\treturn right.value.length - left.value.length;\n\t}\n\n\treturn left.index - right.index;\n}\n\nexport function getSlashCommandSuggestions(\n\tcommands: readonly (SlashCommand | AutocompleteItem)[],\n\tprefix: string,\n): AutocompleteItem[] {\n\tconst normalizedPrefix = prefix.toLowerCase();\n\tconst explicitSkillNamespace = normalizedPrefix.startsWith(SKILL_COMMAND_PREFIX);\n\tconst hasSkillCommands = commands.some((cmd) => {\n\t\tconst name = \"name\" in cmd ? cmd.name : cmd.value;\n\t\treturn name.startsWith(SKILL_COMMAND_PREFIX);\n\t});\n\tconst commandItems: CommandItem[] = commands.flatMap((cmd) => {\n\t\tconst name = \"name\" in cmd ? cmd.name : cmd.value;\n\t\tconst isSkill = name.startsWith(SKILL_COMMAND_PREFIX);\n\t\tconst skillName = isSkill ? name.slice(SKILL_COMMAND_PREFIX.length) : \"\";\n\t\tif (\n\t\t\tisSkill &&\n\t\t\t!explicitSkillNamespace &&\n\t\t\t(normalizedPrefix.length === 0 || !skillName.toLowerCase().startsWith(normalizedPrefix))\n\t\t) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst hint = \"argumentHint\" in cmd && cmd.argumentHint ? cmd.argumentHint : undefined;\n\t\tconst desc = cmd.description ?? \"\";\n\t\tconst fullDesc = hint ? (desc ? `${hint} — ${desc}` : hint) : desc;\n\t\treturn [\n\t\t\t{\n\t\t\t\tname,\n\t\t\t\tlabel: name,\n\t\t\t\tdescription: fullDesc || undefined,\n\t\t\t\tsearchText: isSkill && !explicitSkillNamespace ? skillName : name,\n\t\t\t\tawaitsArguments: hint !== undefined,\n\t\t\t},\n\t\t];\n\t});\n\n\tif (\n\t\thasSkillCommands &&\n\t\t!explicitSkillNamespace &&\n\t\tnormalizedPrefix.length > 0 &&\n\t\tSKILL_COMMAND_PREFIX.startsWith(normalizedPrefix)\n\t) {\n\t\tcommandItems.push({\n\t\t\tname: SKILL_COMMAND_PREFIX,\n\t\t\tlabel: SKILL_COMMAND_PREFIX,\n\t\t\tdescription: \"Browse available skills\",\n\t\t\tsearchText: SKILL_COMMAND_PREFIX,\n\t\t\tawaitsArguments: false,\n\t\t});\n\t}\n\n\treturn fuzzyFilter(commandItems, prefix, (item) => item.searchText)\n\t\t.map((item, index) => ({\n\t\t\tvalue: item.name,\n\t\t\tlabel: item.label,\n\t\t\t...(item.description && { description: item.description }),\n\t\t\t...(item.awaitsArguments && { awaitsArguments: true }),\n\t\t\tindex,\n\t\t}))\n\t\t.sort((left, right) => compareSlashCommandSuggestion(normalizedPrefix, left, right))\n\t\t.map(({ index: _index, ...item }) => item);\n}\n"]}
|
package/package.json
CHANGED