tycono 0.1.101 → 0.1.102
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/package.json
CHANGED
package/src/tui/app.tsx
CHANGED
|
@@ -605,6 +605,9 @@ export const App: React.FC = () => {
|
|
|
605
605
|
allRoleIds={flatRoleIds}
|
|
606
606
|
systemMessages={systemMessages}
|
|
607
607
|
onSubmit={handleCommandSubmit}
|
|
608
|
+
onQuickAction={(action) => {
|
|
609
|
+
handleCommandSubmit(`/${action}`);
|
|
610
|
+
}}
|
|
608
611
|
/>
|
|
609
612
|
<StatusBar
|
|
610
613
|
companyName={api.company?.name ?? 'Loading...'}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React, { useState, useCallback, useRef } from 'react';
|
|
9
|
-
import { Box, Text, Static } from 'ink';
|
|
9
|
+
import { Box, Text, Static, useInput } from 'ink';
|
|
10
10
|
import TextInput from 'ink-text-input';
|
|
11
11
|
import type { SSEEvent } from '../api';
|
|
12
12
|
import { getRoleColor } from '../theme';
|
|
@@ -29,6 +29,7 @@ interface CommandModeProps {
|
|
|
29
29
|
allRoleIds: string[];
|
|
30
30
|
systemMessages: StreamLine[];
|
|
31
31
|
onSubmit: (input: string) => void;
|
|
32
|
+
onQuickAction?: (action: string) => void;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
let lineCounter = 0;
|
|
@@ -274,16 +275,21 @@ function StreamLineRow({ line }: { line: StreamLine }) {
|
|
|
274
275
|
);
|
|
275
276
|
}
|
|
276
277
|
|
|
278
|
+
const QUICK_ACTIONS = ['waves', 'agents', 'sessions', 'docs'] as const;
|
|
279
|
+
type QuickAction = typeof QUICK_ACTIONS[number];
|
|
280
|
+
|
|
277
281
|
export const CommandMode: React.FC<CommandModeProps> = ({
|
|
278
282
|
events,
|
|
279
283
|
allRoleIds,
|
|
280
284
|
systemMessages,
|
|
281
285
|
onSubmit,
|
|
286
|
+
onQuickAction,
|
|
282
287
|
}) => {
|
|
283
288
|
const [input, setInput] = useState('');
|
|
284
289
|
const committedRef = useRef(0);
|
|
285
|
-
// Immediately committed user inputs (shown in Static before systemMessages arrive)
|
|
286
290
|
const [userInputs, setUserInputs] = useState<StreamLine[]>([]);
|
|
291
|
+
const [quickBarActive, setQuickBarActive] = useState(false);
|
|
292
|
+
const [quickBarIndex, setQuickBarIndex] = useState(0);
|
|
287
293
|
|
|
288
294
|
// Convert events to stream lines
|
|
289
295
|
const eventLines: StreamLine[] = [];
|
|
@@ -307,6 +313,36 @@ export const CommandMode: React.FC<CommandModeProps> = ({
|
|
|
307
313
|
const committedLines = rawCommitted.length > 50 ? rawCommitted.slice(-50) : rawCommitted;
|
|
308
314
|
const liveLines = allLines.slice(committedRef.current);
|
|
309
315
|
|
|
316
|
+
// Quick bar navigation
|
|
317
|
+
useInput((ch, key) => {
|
|
318
|
+
if (quickBarActive) {
|
|
319
|
+
if (key.upArrow || key.escape) {
|
|
320
|
+
setQuickBarActive(false);
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
if (key.leftArrow) {
|
|
324
|
+
setQuickBarIndex(i => Math.max(0, i - 1));
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (key.rightArrow) {
|
|
328
|
+
setQuickBarIndex(i => Math.min(QUICK_ACTIONS.length - 1, i + 1));
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
if (key.return) {
|
|
332
|
+
const action = QUICK_ACTIONS[quickBarIndex];
|
|
333
|
+
setQuickBarActive(false);
|
|
334
|
+
onQuickAction?.(action);
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
} else {
|
|
338
|
+
// Arrow down with empty input → activate quick bar
|
|
339
|
+
if (key.downArrow && !input) {
|
|
340
|
+
setQuickBarActive(true);
|
|
341
|
+
setQuickBarIndex(0);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
|
|
310
346
|
const handleSubmit = useCallback((value: string) => {
|
|
311
347
|
const trimmed = value.trim();
|
|
312
348
|
if (trimmed) {
|
|
@@ -344,14 +380,33 @@ export const CommandMode: React.FC<CommandModeProps> = ({
|
|
|
344
380
|
|
|
345
381
|
{/* Input */}
|
|
346
382
|
<Box paddingX={0} marginTop={0}>
|
|
347
|
-
<Text color=
|
|
383
|
+
<Text color={quickBarActive ? 'gray' : 'yellow'} bold>> </Text>
|
|
348
384
|
<TextInput
|
|
349
385
|
value={input}
|
|
350
386
|
onChange={setInput}
|
|
351
387
|
onSubmit={handleSubmit}
|
|
352
388
|
placeholder=""
|
|
389
|
+
focus={!quickBarActive}
|
|
353
390
|
/>
|
|
354
391
|
</Box>
|
|
392
|
+
|
|
393
|
+
{/* Quick action bar — shown when arrow down from input */}
|
|
394
|
+
{quickBarActive && (
|
|
395
|
+
<Box paddingX={0} marginTop={0}>
|
|
396
|
+
{QUICK_ACTIONS.map((action, i) => (
|
|
397
|
+
<Box key={action} marginRight={1}>
|
|
398
|
+
<Text
|
|
399
|
+
color={i === quickBarIndex ? 'cyan' : 'gray'}
|
|
400
|
+
bold={i === quickBarIndex}
|
|
401
|
+
inverse={i === quickBarIndex}
|
|
402
|
+
>
|
|
403
|
+
{` ${action} `}
|
|
404
|
+
</Text>
|
|
405
|
+
</Box>
|
|
406
|
+
))}
|
|
407
|
+
<Text color="gray" dimColor> \u2190\u2192 select Enter open \u2191 back</Text>
|
|
408
|
+
</Box>
|
|
409
|
+
)}
|
|
355
410
|
</Box>
|
|
356
411
|
);
|
|
357
412
|
};
|