tycono 0.1.107-beta.1 → 0.1.107
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 +1 -1
- package/src/tui/components/CommandMode.tsx +11 -12
- package/src/tui/hooks/useApi.ts +17 -10
package/package.json
CHANGED
|
@@ -396,18 +396,17 @@ export const CommandMode: React.FC<CommandModeProps> = ({
|
|
|
396
396
|
{/* Quick action bar — shown when arrow down from input */}
|
|
397
397
|
{quickBarActive && (
|
|
398
398
|
<Box paddingX={0} marginTop={0}>
|
|
399
|
-
{QUICK_ACTIONS.map((action, i) =>
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
<Text color="gray" dimColor> \u2190\u2192 select Enter open \u2191 back</Text>
|
|
399
|
+
{QUICK_ACTIONS.map((action, i) => {
|
|
400
|
+
const selected = i === quickBarIndex;
|
|
401
|
+
return (
|
|
402
|
+
<Box key={action} marginRight={1}>
|
|
403
|
+
<Text color={selected ? 'cyan' : 'gray'} bold={selected}>
|
|
404
|
+
{selected ? `[ ${action} ]` : ` ${action} `}
|
|
405
|
+
</Text>
|
|
406
|
+
</Box>
|
|
407
|
+
);
|
|
408
|
+
})}
|
|
409
|
+
<Text color="gray" dimColor> \u2190\u2192 Enter \u2191back</Text>
|
|
411
410
|
</Box>
|
|
412
411
|
)}
|
|
413
412
|
</Box>
|
package/src/tui/hooks/useApi.ts
CHANGED
|
@@ -59,13 +59,22 @@ export function useApi(): ApiState {
|
|
|
59
59
|
|
|
60
60
|
const refresh = useCallback(async () => {
|
|
61
61
|
try {
|
|
62
|
-
const
|
|
62
|
+
const promises: [
|
|
63
|
+
Promise<CompanyInfo | null>,
|
|
64
|
+
Promise<SessionInfo[]>,
|
|
65
|
+
Promise<ExecStatus | null>,
|
|
66
|
+
Promise<{ waves: Array<{ waveId: string; sessionIds: string[] }> }>,
|
|
67
|
+
Promise<{ sessions: ActiveSessionInfo[]; summary: { active: number; totalPorts: number } }>,
|
|
68
|
+
Promise<PastWaveInfo[]>,
|
|
69
|
+
] = [
|
|
63
70
|
fetchCompany().catch(() => null),
|
|
64
71
|
fetchSessions().catch(() => []),
|
|
65
72
|
fetchExecStatus().catch(() => null),
|
|
66
73
|
fetchActiveWaves().catch(() => ({ waves: [] })),
|
|
67
74
|
fetchActiveSessions().catch(() => ({ sessions: [], summary: { active: 0, totalPorts: 0 } })),
|
|
68
|
-
|
|
75
|
+
!pastWavesLoadedRef.current ? fetchPastWaves(20).catch(() => []) : Promise.resolve([]),
|
|
76
|
+
];
|
|
77
|
+
const [comp, sess, exec, waves, activeSess, pastWavesResult] = await Promise.all(promises);
|
|
69
78
|
|
|
70
79
|
if (!mountedRef.current) return;
|
|
71
80
|
|
|
@@ -85,6 +94,12 @@ export function useApi(): ApiState {
|
|
|
85
94
|
setActiveSessions(activeSess.sessions ?? []);
|
|
86
95
|
setPortSummary(activeSess.summary ?? { active: 0, totalPorts: 0 });
|
|
87
96
|
|
|
97
|
+
// Past waves (load once, included in Promise.all)
|
|
98
|
+
if (!pastWavesLoadedRef.current && pastWavesResult.length > 0) {
|
|
99
|
+
pastWavesLoadedRef.current = true;
|
|
100
|
+
setPastWaves(pastWavesResult);
|
|
101
|
+
}
|
|
102
|
+
|
|
88
103
|
// KB docs (load once, not every poll)
|
|
89
104
|
if (!kbLoadedRef.current) {
|
|
90
105
|
kbLoadedRef.current = true;
|
|
@@ -93,14 +108,6 @@ export function useApi(): ApiState {
|
|
|
93
108
|
}).catch(() => {});
|
|
94
109
|
}
|
|
95
110
|
|
|
96
|
-
// Past waves (load once)
|
|
97
|
-
if (!pastWavesLoadedRef.current) {
|
|
98
|
-
pastWavesLoadedRef.current = true;
|
|
99
|
-
fetchPastWaves(20).then(pw => {
|
|
100
|
-
if (mountedRef.current) setPastWaves(pw);
|
|
101
|
-
}).catch(() => {});
|
|
102
|
-
}
|
|
103
|
-
|
|
104
111
|
setError(null);
|
|
105
112
|
setLoaded(true);
|
|
106
113
|
} catch (err) {
|