@ywldan/kiro 0.2.2 → 0.2.3
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/README.md +3 -3
- package/dist/ui/App.js +5 -9
- package/dist/ui/Input.js +9 -12
- package/dist/ui/MessageList.js +42 -3
- package/dist/ui/ModelPicker.js +36 -7
- package/dist/ui/model-picker.js +10 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -292,7 +292,7 @@ Each finished assistant round shows how long it took and, when the endpoint repo
|
|
|
292
292
|
|
|
293
293
|
Assistant replies are rendered as Markdown: headings, bold/italic, inline code, bullet and numbered lists, task checkboxes, blockquotes, links, and fenced code blocks. Unknown or incomplete markers fall back to their literal text, so streaming never breaks the layout.
|
|
294
294
|
|
|
295
|
-
Typing `/` opens a command palette
|
|
295
|
+
Typing `/` opens a command palette. It is drawn over the bottom of the transcript instead of resizing it, so the conversation does not jump when the menu opens or closes. It filters as you type, `↑`/`↓` select a command, `Enter` runs it, and `Tab` completes it. `Esc` clears the input.
|
|
296
296
|
|
|
297
297
|
On a real TTY, `kiro` switches to the terminal's alternate screen: you get a clean page instead of the TUI drawing underneath the command you just ran. When Kiro exits — `/exit`, `Ctrl+C`, or an error — the terminal restores the previous shell contents and prompt. Redirected output (pipes, CI logs) is left untouched. Pass `--no-alt-screen` to stay on the normal screen instead.
|
|
298
298
|
|
|
@@ -305,7 +305,7 @@ Slash commands:
|
|
|
305
305
|
| Command | Action |
|
|
306
306
|
| --- | --- |
|
|
307
307
|
| `/help` | Show commands and keys |
|
|
308
|
-
| `/model` | Open the model picker: profile first, then
|
|
308
|
+
| `/model` | Open the model picker: profile first, then searchable stored models |
|
|
309
309
|
| `/model <name>` | Switch profile without restarting |
|
|
310
310
|
| `/model add` | Guided setup; prompts appear in the input box and the key is masked |
|
|
311
311
|
| `/model edit [name]` | Edit fields, replace the key, re-test, and save |
|
|
@@ -324,7 +324,7 @@ Slash commands:
|
|
|
324
324
|
| `/allow clear` | Ask for approval again for every tool |
|
|
325
325
|
| `/exit` | Quit |
|
|
326
326
|
|
|
327
|
-
`/model` opens a two-step picker. The first step lists profiles grouped by endpoint (the active one is marked `*`); `Enter` opens that profile's models. The second step lists the ids stored in the profile's `models` field with the one in use marked `*`; `Enter` applies it, switches to that profile, and saves the choice to `config.json`.
|
|
327
|
+
`/model` opens a two-step picker. The first step lists profiles grouped by endpoint (the active one is marked `*`); `Enter` opens that profile's models. The second step lists the ids stored in the profile's `models` field with the one in use marked `*`; `Enter` applies it, switches to that profile, and saves the choice to `config.json`. On the model step, type to filter (case-insensitive; space-separated terms must all match), `Backspace` edits the query, `Esc` clears the query first and then goes back, and `↑`/`↓` move through the filtered list. `Ctrl+R` refetches `GET /models` from that endpoint and stores the result; later switches need no network. `Ctrl+C` closes the picker. A profile with no stored list still shows its current model, and adding a profile through the wizard stores whatever discovery returned for it.
|
|
328
328
|
|
|
329
329
|
## Sessions
|
|
330
330
|
|
package/dist/ui/App.js
CHANGED
|
@@ -27,7 +27,7 @@ import { loadPromptHistory, recordPrompt } from './prompt-history.js';
|
|
|
27
27
|
import { StatusBar } from './StatusBar.js';
|
|
28
28
|
import { summarizeToolArgs } from './text.js';
|
|
29
29
|
import { undoLastCheckpoint } from '../tools/checkpoint.js';
|
|
30
|
-
import { MAX_EXPANDED_TOOL_CHARS, MAX_REASONING_CHARS } from './types.js';
|
|
30
|
+
import { MAX_EXPANDED_TOOL_CHARS, MAX_REASONING_CHARS, } from './types.js';
|
|
31
31
|
function useTerminalSize() {
|
|
32
32
|
const { stdout } = useStdout();
|
|
33
33
|
const read = useCallback(() => ({
|
|
@@ -78,7 +78,7 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
|
|
|
78
78
|
const [cancelling, setCancelling] = useState(false);
|
|
79
79
|
const [pendingApproval, setPendingApproval] = useState(null);
|
|
80
80
|
const [pickerOpen, setPickerOpen] = useState(false);
|
|
81
|
-
const [
|
|
81
|
+
const [palette, setPalette] = useState(null);
|
|
82
82
|
const [mouseOn, setMouseOn] = useState(mouseEnabled);
|
|
83
83
|
const [expandedToolId, setExpandedToolId] = useState(null);
|
|
84
84
|
const messagesRef = useRef((initialSession?.messages ?? []).filter((message) => message.role !== 'system'));
|
|
@@ -134,9 +134,6 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
|
|
|
134
134
|
contextTokensRef.current = rounded;
|
|
135
135
|
setContextTokens(rounded);
|
|
136
136
|
}, []);
|
|
137
|
-
const handleMenuRowsChange = useCallback((rows) => {
|
|
138
|
-
setSlashMenuRows((current) => (current === rows ? current : rows));
|
|
139
|
-
}, []);
|
|
140
137
|
const recomputeContext = useCallback(() => {
|
|
141
138
|
const messages = messagesRef.current;
|
|
142
139
|
const usage = usageRef.current;
|
|
@@ -1206,9 +1203,8 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
|
|
|
1206
1203
|
: null;
|
|
1207
1204
|
const activeProfile = runtimeConfig.profiles[profileName];
|
|
1208
1205
|
const contextWindow = contextWindowFor(activeProfile);
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
return (_jsxs(Box, { flexDirection: "column", width: columns, paddingX: 1, children: [_jsx(MessageList, { items: items, width: width, height: viewportHeight, resetSignal: resetSignal, expandedToolId: expandedToolId, interactive: !pendingApproval && !pickerOpen && !wizardActive && wizardPrompt === null }), pendingApproval ? (_jsx(ApprovalPrompt, { request: pendingApproval, width: width, onDecision: resolveApproval })) : pickerOpen ? (_jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: width, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) })) : (_jsx(Input, { disabled: false, width: width, mask: wizardPrompt?.mask, allowEmpty: wizardPrompt?.allowEmpty, history: wizardPrompt || wizardActive ? undefined : promptHistory, placeholder: wizardPrompt
|
|
1206
|
+
const viewportHeight = Math.max(3, rows - 5 - (pendingApproval ? 12 : 0) - (pickerOpen ? 13 : 0));
|
|
1207
|
+
return (_jsxs(Box, { flexDirection: "column", width: columns, paddingX: 1, children: [_jsx(MessageList, { items: items, width: width, height: viewportHeight, resetSignal: resetSignal, expandedToolId: expandedToolId, palette: palette, interactive: !pendingApproval && !pickerOpen && !wizardActive && wizardPrompt === null }), pendingApproval ? (_jsx(ApprovalPrompt, { request: pendingApproval, width: width, onDecision: resolveApproval })) : pickerOpen ? (_jsx(ModelPicker, { config: runtimeConfig, activeProfile: profileName, width: width, onSelect: (name, model) => void selectModel(name, model), onRefresh: refreshProfileModels, onCancel: () => setPickerOpen(false) })) : (_jsx(Input, { disabled: false, width: width, mask: wizardPrompt?.mask, allowEmpty: wizardPrompt?.allowEmpty, history: wizardPrompt || wizardActive ? undefined : promptHistory, onPaletteChange: setPalette, placeholder: wizardPrompt
|
|
1212
1208
|
? wizardPrompt.defaultValue && !wizardPrompt.mask
|
|
1213
1209
|
? `${wizardPrompt.label} [${wizardPrompt.defaultValue}]`
|
|
1214
1210
|
: wizardPrompt.label
|
|
@@ -1216,6 +1212,6 @@ export function App({ config, baseConfig, overrides, configPath, configCreated,
|
|
|
1216
1212
|
? 'Kiro is working… type ahead, or Ctrl+C to cancel'
|
|
1217
1213
|
: wizardActive
|
|
1218
1214
|
? 'Working… Esc to cancel'
|
|
1219
|
-
: 'Ask Kiro to build or change something…', slashMenu: !wizardActive && !wizardPrompt,
|
|
1215
|
+
: 'Ask Kiro to build or change something…', slashMenu: !wizardActive && !wizardPrompt, onSubmit: handleSubmit, onCancel: wizardActive ? cancelWizard : undefined }, wizardPrompt?.id ?? 0)), _jsx(StatusBar, { width: width, profile: profileName, model: activeProfile?.model ?? 'unknown', cwd: cwd, activity: activity, toolName: activeTool ?? undefined, busySince: busySince ?? undefined, queued: queuedCount > 0 ? queuedCount : undefined, yolo: yolo, autoAllowed: autoAllowed, contextTokens: contextTokens, contextWindow: contextWindow })] }));
|
|
1220
1216
|
}
|
|
1221
1217
|
//# sourceMappingURL=App.js.map
|
package/dist/ui/Input.js
CHANGED
|
@@ -7,7 +7,7 @@ import { isMouseSequence } from './mouse.js';
|
|
|
7
7
|
import { applyInputOps, parseEditSequence, parseInputChunk, } from './text.js';
|
|
8
8
|
const MAX_INPUT_CHARS = 20_000;
|
|
9
9
|
const MAX_MENU_ROWS = 6;
|
|
10
|
-
export function Input({ disabled, placeholder, width, mask = false, allowEmpty = false, slashMenu = true, history, onSubmit, onCancel,
|
|
10
|
+
export function Input({ disabled, placeholder, width, mask = false, allowEmpty = false, slashMenu = true, history, onSubmit, onCancel, onPaletteChange, }) {
|
|
11
11
|
const { stdin } = useStdin();
|
|
12
12
|
const [state, setState] = useState({ chars: [], cursor: 0 });
|
|
13
13
|
const [selected, setSelected] = useState(0);
|
|
@@ -31,13 +31,13 @@ export function Input({ disabled, placeholder, width, mask = false, allowEmpty =
|
|
|
31
31
|
setSelected(0);
|
|
32
32
|
}, [text]);
|
|
33
33
|
useEffect(() => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
onPaletteChange?.(menuOpen
|
|
35
|
+
? { commands: visibleCommands, activeIndex: Math.max(0, activeIndex - menuStart) }
|
|
36
|
+
: null);
|
|
37
|
+
// visibleCommands is derived from text, activeIndex and menuStart.
|
|
38
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
+
}, [menuOpen, text, activeIndex, menuStart, onPaletteChange]);
|
|
40
|
+
useEffect(() => () => onPaletteChange?.(null), [onPaletteChange]);
|
|
41
41
|
const update = (chars, cursor) => {
|
|
42
42
|
const next = { chars, cursor: Math.max(0, Math.min(cursor, chars.length)) };
|
|
43
43
|
stateRef.current = next;
|
|
@@ -246,9 +246,6 @@ export function Input({ disabled, placeholder, width, mask = false, allowEmpty =
|
|
|
246
246
|
const at = displayChars[cursor] ?? ' ';
|
|
247
247
|
const after = displayChars.slice(cursor + 1, end).join('');
|
|
248
248
|
const showPlaceholder = chars.length === 0;
|
|
249
|
-
return (_jsxs(Box, {
|
|
250
|
-
const active = menuStart + offset === activeIndex;
|
|
251
|
-
return (_jsxs(Text, { inverse: active, bold: active, wrap: "truncate-end", children: [active ? '› ' : ' ', command.name, command.usage ? _jsx(Text, { dimColor: !active, children: ` ${command.usage}` }) : null, _jsx(Text, { dimColor: !active, children: ` ${command.description}` })] }, command.name));
|
|
252
|
-
}), Array.from({ length: MAX_MENU_ROWS - visibleCommands.length }, (_, index) => (_jsx(Text, { children: " " }, `empty-${index}`)))] })) : null, _jsxs(Box, { flexShrink: 0, children: [_jsx(Text, { color: disabled ? 'gray' : 'cyan', bold: true, children: '› ' }), disabled ? (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: placeholder })) : showPlaceholder ? (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { inverse: true, children: " " }), _jsxs(Text, { dimColor: true, children: [" ", placeholder] })] })) : (_jsxs(Text, { wrap: "truncate-end", children: [before, _jsx(Text, { inverse: true, children: at }), after] }))] })] }));
|
|
249
|
+
return (_jsxs(Box, { flexShrink: 0, children: [_jsx(Text, { color: disabled ? 'gray' : 'cyan', bold: true, children: '› ' }), disabled ? (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: placeholder })) : showPlaceholder ? (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Text, { inverse: true, children: " " }), _jsxs(Text, { dimColor: true, children: [" ", placeholder] })] })) : (_jsxs(Text, { wrap: "truncate-end", children: [before, _jsx(Text, { inverse: true, children: at }), after] }))] }));
|
|
253
250
|
}
|
|
254
251
|
//# sourceMappingURL=Input.js.map
|
package/dist/ui/MessageList.js
CHANGED
|
@@ -183,7 +183,45 @@ export function buildLines(items, width, expandedToolId = null) {
|
|
|
183
183
|
}
|
|
184
184
|
return lines;
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
const PALETTE_ROWS = 6;
|
|
187
|
+
/** Header plus the visible command rows; padded so filtering never changes its height. */
|
|
188
|
+
export function buildPaletteLines(palette, width) {
|
|
189
|
+
const header = {
|
|
190
|
+
prefix: ' ',
|
|
191
|
+
text: truncateToWidth('commands · ↑/↓ move · Tab complete · Enter run', width),
|
|
192
|
+
dim: true,
|
|
193
|
+
};
|
|
194
|
+
const rows = palette.commands.slice(0, PALETTE_ROWS).map((command, index) => {
|
|
195
|
+
const active = index === palette.activeIndex;
|
|
196
|
+
const label = command.usage ? `${command.name} ${command.usage}` : command.name;
|
|
197
|
+
return {
|
|
198
|
+
prefix: active ? '› ' : ' ',
|
|
199
|
+
prefixColor: active ? 'cyan' : undefined,
|
|
200
|
+
text: '',
|
|
201
|
+
segments: [
|
|
202
|
+
{ text: label, bold: active },
|
|
203
|
+
{ text: ` ${command.description}`, dim: !active },
|
|
204
|
+
],
|
|
205
|
+
inverse: active,
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
while (rows.length < PALETTE_ROWS)
|
|
209
|
+
rows.push({ prefix: '', text: '' });
|
|
210
|
+
return [header, ...rows];
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Replaces the last rows of the visible transcript with the palette, so opening
|
|
214
|
+
* the menu never resizes the transcript or moves the conversation.
|
|
215
|
+
*/
|
|
216
|
+
export function applyPalette(lines, palette, width, maxRows) {
|
|
217
|
+
if (!palette)
|
|
218
|
+
return lines;
|
|
219
|
+
const height = Math.max(1, maxRows);
|
|
220
|
+
const overlay = buildPaletteLines(palette, width).slice(0, height);
|
|
221
|
+
const keep = Math.max(0, Math.min(lines.length, height) - overlay.length);
|
|
222
|
+
return [...lines.slice(0, keep), ...overlay];
|
|
223
|
+
}
|
|
224
|
+
export function MessageList({ items, width, height, resetSignal, expandedToolId = null, palette = null, interactive = true, }) {
|
|
187
225
|
const { stdin } = useStdin();
|
|
188
226
|
const lines = buildLines(items, width, expandedToolId);
|
|
189
227
|
const maxScroll = Math.max(0, lines.length - height);
|
|
@@ -237,9 +275,10 @@ export function MessageList({ items, width, height, resetSignal, expandedToolId
|
|
|
237
275
|
}
|
|
238
276
|
}, { isActive: interactive });
|
|
239
277
|
const visible = lines.slice(scrollTop, scrollTop + height);
|
|
240
|
-
|
|
278
|
+
const shown = applyPalette(visible, palette, width, height);
|
|
279
|
+
return (_jsx(Box, { flexDirection: "column", height: height, overflowY: "hidden", flexShrink: 0, justifyContent: "flex-end", children: shown.map((line, index) => {
|
|
241
280
|
const hasSuffix = line.suffix !== undefined;
|
|
242
|
-
return (_jsxs(Text, { wrap: "truncate-end", color: line.color, dimColor: line.dim, bold: line.bold, children: [line.prefix ? (_jsx(Text, { color: line.prefixColor, dimColor: line.prefixDim, bold: line.prefixColor === 'cyan', children: line.prefix })) : null, line.segments
|
|
281
|
+
return (_jsxs(Text, { wrap: "truncate-end", color: line.color, dimColor: line.dim, bold: line.bold, inverse: line.inverse, children: [line.prefix ? (_jsx(Text, { color: line.prefixColor, dimColor: line.prefixDim, bold: line.prefixColor === 'cyan', children: line.prefix })) : null, line.segments
|
|
243
282
|
? line.segments.map((segment, segmentIndex) => (_jsx(Text, { color: segment.color, dimColor: segment.dim, bold: segment.bold, italic: segment.italic, underline: segment.underline, strikethrough: segment.strikethrough, children: segment.text }, segmentIndex)))
|
|
244
283
|
: line.text || (hasSuffix ? '' : ' '), line.suffix ? (_jsx(Text, { color: line.suffix.color, dimColor: line.suffix.dim, bold: line.suffix.bold, children: line.suffix.text })) : null] }, `${scrollTop}-${index}`));
|
|
245
284
|
}) }));
|
package/dist/ui/ModelPicker.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { Box, Text, useInput } from 'ink';
|
|
4
|
-
import { modelIds, pickerWindow, profileRows, selectableLines, selectableNames, } from './model-picker.js';
|
|
4
|
+
import { filterModelIds, modelIds, pickerWindow, profileRows, selectableLines, selectableNames, } from './model-picker.js';
|
|
5
5
|
/** Keys are highlighted so the hint reads at a glance; the rest stays dim. */
|
|
6
6
|
const KEY_COLOR = '#ff9e64';
|
|
7
7
|
function Key({ children }) {
|
|
@@ -19,11 +19,13 @@ export function ModelPicker({ config, activeProfile, width, maxRows = 8, onSelec
|
|
|
19
19
|
const [index, setIndex] = useState(0);
|
|
20
20
|
const [refreshing, setRefreshing] = useState(false);
|
|
21
21
|
const [error, setError] = useState(null);
|
|
22
|
+
const [query, setQuery] = useState('');
|
|
22
23
|
const rows = profileRows(config, activeProfile);
|
|
23
24
|
const names = selectableNames(rows);
|
|
24
25
|
const lines = selectableLines(rows);
|
|
25
26
|
const profile = step.kind === 'model' ? config.profiles[step.profile] : undefined;
|
|
26
|
-
const
|
|
27
|
+
const allModels = modelIds(profile);
|
|
28
|
+
const models = step.kind === 'model' ? filterModelIds(allModels, query) : allModels;
|
|
27
29
|
const count = step.kind === 'profile' ? names.length : models.length;
|
|
28
30
|
const selected = Math.min(index, Math.max(0, count - 1));
|
|
29
31
|
const selectedLine = step.kind === 'profile' ? (lines[selected] ?? 0) : selected;
|
|
@@ -42,10 +44,21 @@ export function ModelPicker({ config, activeProfile, width, maxRows = 8, onSelec
|
|
|
42
44
|
useInput((input, key) => {
|
|
43
45
|
if (refreshing)
|
|
44
46
|
return;
|
|
47
|
+
if (step.kind === 'model' && key.ctrl && input === 'r') {
|
|
48
|
+
void refresh(step.profile);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
45
51
|
if (key.escape) {
|
|
52
|
+
if (step.kind === 'model' && query) {
|
|
53
|
+
setQuery('');
|
|
54
|
+
setIndex(0);
|
|
55
|
+
setError(null);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
46
58
|
if (step.kind === 'model') {
|
|
47
59
|
setStep({ kind: 'profile' });
|
|
48
60
|
setIndex(0);
|
|
61
|
+
setQuery('');
|
|
49
62
|
setError(null);
|
|
50
63
|
}
|
|
51
64
|
else {
|
|
@@ -60,8 +73,21 @@ export function ModelPicker({ config, activeProfile, width, maxRows = 8, onSelec
|
|
|
60
73
|
setIndex(Math.min(count - 1, Math.max(0, selected + delta)));
|
|
61
74
|
return;
|
|
62
75
|
}
|
|
63
|
-
if (step.kind === 'model' &&
|
|
64
|
-
|
|
76
|
+
if (step.kind === 'model' && !key.return) {
|
|
77
|
+
if (key.backspace || key.delete) {
|
|
78
|
+
if (query) {
|
|
79
|
+
setQuery(query.slice(0, -1));
|
|
80
|
+
setIndex(0);
|
|
81
|
+
}
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (key.ctrl || key.meta || key.tab || key.pageUp || key.pageDown)
|
|
85
|
+
return;
|
|
86
|
+
const typed = input.replace(/[\u0000-\u001f\u007f]/g, '');
|
|
87
|
+
if (typed) {
|
|
88
|
+
setQuery(query + typed);
|
|
89
|
+
setIndex(0);
|
|
90
|
+
}
|
|
65
91
|
return;
|
|
66
92
|
}
|
|
67
93
|
if (!key.return)
|
|
@@ -72,6 +98,7 @@ export function ModelPicker({ config, activeProfile, width, maxRows = 8, onSelec
|
|
|
72
98
|
return;
|
|
73
99
|
setStep({ kind: 'model', profile: name });
|
|
74
100
|
setIndex(0);
|
|
101
|
+
setQuery('');
|
|
75
102
|
setError(null);
|
|
76
103
|
return;
|
|
77
104
|
}
|
|
@@ -81,8 +108,10 @@ export function ModelPicker({ config, activeProfile, width, maxRows = 8, onSelec
|
|
|
81
108
|
});
|
|
82
109
|
const title = step.kind === 'profile'
|
|
83
110
|
? `Model · ${names.length} profile${names.length === 1 ? '' : 's'}`
|
|
84
|
-
:
|
|
85
|
-
|
|
111
|
+
: query.trim()
|
|
112
|
+
? `Models · ${step.profile} (${models.length}/${allModels.length} match)`
|
|
113
|
+
: `Models · ${step.profile} (${models.length})`;
|
|
114
|
+
return (_jsxs(Box, { flexDirection: "column", width: width, borderStyle: "round", borderColor: "cyan", paddingX: 1, flexShrink: 0, children: [_jsx(Text, { bold: true, color: "cyan", wrap: "truncate-end", children: title }), step.kind === 'model' ? (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Said, { children: "Search: " }), query || _jsx(Said, { children: "type to filter" })] })) : null, step.kind === 'profile'
|
|
86
115
|
? rows.slice(start, end).map((row, offset) => {
|
|
87
116
|
const line = start + offset;
|
|
88
117
|
if (row.kind === 'header') {
|
|
@@ -95,6 +124,6 @@ export function ModelPicker({ config, activeProfile, width, maxRows = 8, onSelec
|
|
|
95
124
|
const line = start + offset;
|
|
96
125
|
const focused = line === selectedLine;
|
|
97
126
|
return (_jsx(Text, { color: focused ? 'cyan' : undefined, bold: focused, wrap: "truncate-end", children: ` ${id === profile?.model ? '*' : ' '} ${id}` }, `m${line}`));
|
|
98
|
-
}), step.kind === 'model' && profile && !profile.models?.length ? (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Said, { children: "Only the active model is stored; press " }), _jsx(Key, { children: "
|
|
127
|
+
}), step.kind === 'model' && models.length === 0 ? (_jsxs(Text, { dimColor: true, wrap: "truncate-end", children: ["No models match \"", query, "\". Backspace to edit, Esc to clear."] })) : null, step.kind === 'model' && profile && !profile.models?.length ? (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Said, { children: "Only the active model is stored; press " }), _jsx(Key, { children: "Ctrl+R" }), _jsx(Said, { children: " to fetch this endpoint." })] })) : null, error ? (_jsx(Text, { color: "red", wrap: "truncate-end", children: error })) : null, step.kind === 'profile' ? (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Key, { children: "\u2191/\u2193" }), _jsx(Said, { children: " move \u00B7 " }), _jsx(Key, { children: "Enter" }), _jsx(Said, { children: " choose profile \u00B7 " }), _jsx(Key, { children: "Esc" }), _jsx(Said, { children: " close" })] })) : refreshing ? (_jsx(Text, { dimColor: true, wrap: "truncate-end", children: "Fetching models\u2026" })) : (_jsxs(Text, { wrap: "truncate-end", children: [_jsx(Key, { children: "\u2191/\u2193" }), _jsx(Said, { children: " move \u00B7 " }), _jsx(Key, { children: "Enter" }), _jsx(Said, { children: " use \u00B7 type to filter \u00B7 " }), _jsx(Key, { children: "Ctrl+R" }), _jsx(Said, { children: " refetch \u00B7 " }), _jsx(Key, { children: "Esc" }), _jsx(Said, { children: query ? ' clear search' : ' back' })] }))] }));
|
|
99
128
|
}
|
|
100
129
|
//# sourceMappingURL=ModelPicker.js.map
|
package/dist/ui/model-picker.js
CHANGED
|
@@ -26,6 +26,16 @@ export function modelIds(profile) {
|
|
|
26
26
|
const stored = profile.models ?? [];
|
|
27
27
|
return stored.includes(profile.model) ? stored : [profile.model, ...stored];
|
|
28
28
|
}
|
|
29
|
+
/** Case-insensitive multi-term search: every whitespace-separated term must match. */
|
|
30
|
+
export function filterModelIds(ids, query) {
|
|
31
|
+
const terms = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
32
|
+
if (terms.length === 0)
|
|
33
|
+
return ids;
|
|
34
|
+
return ids.filter((id) => {
|
|
35
|
+
const haystack = id.toLowerCase();
|
|
36
|
+
return terms.every((term) => haystack.includes(term));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
29
39
|
/** Keeps the highlighted line inside a window of `maxRows` entries. */
|
|
30
40
|
export function pickerWindow(index, count, maxRows) {
|
|
31
41
|
if (count <= 0)
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.2.
|
|
1
|
+
export const VERSION = '0.2.3';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|