wave-code 0.7.1 → 0.7.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/components/BackgroundTaskManager.d.ts.map +1 -1
- package/dist/components/BackgroundTaskManager.js +12 -20
- package/dist/components/HistorySearch.d.ts.map +1 -1
- package/dist/components/HistorySearch.js +19 -25
- package/dist/components/SessionSelector.d.ts.map +1 -1
- package/dist/components/SessionSelector.js +5 -8
- package/package.json +2 -2
- package/src/components/BackgroundTaskManager.tsx +12 -20
- package/src/components/HistorySearch.tsx +25 -30
- package/src/components/SessionSelector.tsx +5 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundTaskManager.d.ts","sourceRoot":"","sources":["../../src/components/BackgroundTaskManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,
|
|
1
|
+
{"version":3,"file":"BackgroundTaskManager.d.ts","sourceRoot":"","sources":["../../src/components/BackgroundTaskManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CA8TtE,CAAC"}
|
|
@@ -51,14 +51,11 @@ export const BackgroundTaskManager = ({ onCancel, }) => {
|
|
|
51
51
|
if (viewMode === "list") {
|
|
52
52
|
// List mode navigation
|
|
53
53
|
if (key.return) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
return prev;
|
|
61
|
-
});
|
|
54
|
+
if (tasks.length > 0 && selectedIndex < tasks.length) {
|
|
55
|
+
const selectedTask = tasks[selectedIndex];
|
|
56
|
+
setDetailTaskId(selectedTask.id);
|
|
57
|
+
setViewMode("detail");
|
|
58
|
+
}
|
|
62
59
|
return;
|
|
63
60
|
}
|
|
64
61
|
if (key.escape) {
|
|
@@ -66,23 +63,18 @@ export const BackgroundTaskManager = ({ onCancel, }) => {
|
|
|
66
63
|
return;
|
|
67
64
|
}
|
|
68
65
|
if (key.upArrow) {
|
|
69
|
-
setSelectedIndex(
|
|
66
|
+
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
70
67
|
return;
|
|
71
68
|
}
|
|
72
69
|
if (key.downArrow) {
|
|
73
|
-
setSelectedIndex(
|
|
70
|
+
setSelectedIndex(Math.min(tasks.length - 1, selectedIndex + 1));
|
|
74
71
|
return;
|
|
75
72
|
}
|
|
76
|
-
if (input === "k") {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
stopTask(selectedTask.id);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return prev;
|
|
85
|
-
});
|
|
73
|
+
if (input === "k" && tasks.length > 0 && selectedIndex < tasks.length) {
|
|
74
|
+
const selectedTask = tasks[selectedIndex];
|
|
75
|
+
if (selectedTask.status === "running") {
|
|
76
|
+
stopTask(selectedTask.id);
|
|
77
|
+
}
|
|
86
78
|
return;
|
|
87
79
|
}
|
|
88
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistorySearch.d.ts","sourceRoot":"","sources":["../../src/components/HistorySearch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"HistorySearch.d.ts","sourceRoot":"","sources":["../../src/components/HistorySearch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAkKtD,CAAC"}
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
2
|
+
import React, { useState, useEffect } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
4
|
import { PromptHistoryManager } from "wave-agent-sdk";
|
|
5
5
|
export const HistorySearch = ({ searchQuery, onSelect, onCancel, }) => {
|
|
6
6
|
const MAX_VISIBLE_ITEMS = 5;
|
|
7
|
-
const [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
8
|
+
const [entries, setEntries] = useState([]);
|
|
9
|
+
const entriesRef = React.useRef([]);
|
|
10
|
+
const selectedIndexRef = React.useRef(0);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
entriesRef.current = entries;
|
|
13
|
+
}, [entries]);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
selectedIndexRef.current = selectedIndex;
|
|
16
|
+
}, [selectedIndex]);
|
|
11
17
|
useEffect(() => {
|
|
12
18
|
const fetchHistory = async () => {
|
|
13
19
|
const results = await PromptHistoryManager.searchHistory(searchQuery);
|
|
14
20
|
const limitedResults = results.slice(0, 20);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
selectedIndex: 0,
|
|
18
|
-
});
|
|
21
|
+
setEntries(limitedResults); // Limit to 20 results
|
|
22
|
+
setSelectedIndex(0);
|
|
19
23
|
};
|
|
20
24
|
fetchHistory();
|
|
21
25
|
}, [searchQuery]);
|
|
22
26
|
useInput((input, key) => {
|
|
23
27
|
if (key.return) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
return prev;
|
|
30
|
-
});
|
|
28
|
+
if (entriesRef.current.length > 0 &&
|
|
29
|
+
selectedIndexRef.current < entriesRef.current.length) {
|
|
30
|
+
onSelect(entriesRef.current[selectedIndexRef.current].prompt);
|
|
31
|
+
}
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
if (key.escape) {
|
|
@@ -35,21 +36,14 @@ export const HistorySearch = ({ searchQuery, onSelect, onCancel, }) => {
|
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
37
38
|
if (key.upArrow) {
|
|
38
|
-
|
|
39
|
-
...prev,
|
|
40
|
-
selectedIndex: Math.max(0, prev.selectedIndex - 1),
|
|
41
|
-
}));
|
|
39
|
+
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
42
40
|
return;
|
|
43
41
|
}
|
|
44
42
|
if (key.downArrow) {
|
|
45
|
-
|
|
46
|
-
...prev,
|
|
47
|
-
selectedIndex: Math.min(prev.entries.length - 1, prev.selectedIndex + 1),
|
|
48
|
-
}));
|
|
43
|
+
setSelectedIndex((prev) => Math.min(entriesRef.current.length - 1, prev + 1));
|
|
49
44
|
return;
|
|
50
45
|
}
|
|
51
46
|
});
|
|
52
|
-
const { entries, selectedIndex } = state;
|
|
53
47
|
if (entries.length === 0) {
|
|
54
48
|
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "yellow", borderBottom: false, borderLeft: false, borderRight: false, children: [_jsxs(Text, { color: "yellow", children: ["No history found ", searchQuery && `for "${searchQuery}"`] }), _jsx(Text, { dimColor: true, children: "Press Escape to cancel" })] }));
|
|
55
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionSelector.d.ts","sourceRoot":"","sources":["../../src/components/SessionSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,eAAe,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC1D,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"SessionSelector.d.ts","sourceRoot":"","sources":["../../src/components/SessionSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,eAAe,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC1D,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoH1D,CAAC"}
|
|
@@ -5,12 +5,9 @@ export const SessionSelector = ({ sessions, onSelect, onCancel, }) => {
|
|
|
5
5
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
6
6
|
useInput((input, key) => {
|
|
7
7
|
if (key.return) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
return prev;
|
|
13
|
-
});
|
|
8
|
+
if (sessions.length > 0 && selectedIndex < sessions.length) {
|
|
9
|
+
onSelect(sessions[selectedIndex].id);
|
|
10
|
+
}
|
|
14
11
|
return;
|
|
15
12
|
}
|
|
16
13
|
if (key.escape) {
|
|
@@ -18,11 +15,11 @@ export const SessionSelector = ({ sessions, onSelect, onCancel, }) => {
|
|
|
18
15
|
return;
|
|
19
16
|
}
|
|
20
17
|
if (key.upArrow) {
|
|
21
|
-
setSelectedIndex(
|
|
18
|
+
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
22
19
|
return;
|
|
23
20
|
}
|
|
24
21
|
if (key.downArrow) {
|
|
25
|
-
setSelectedIndex(
|
|
22
|
+
setSelectedIndex(Math.min(sessions.length - 1, selectedIndex + 1));
|
|
26
23
|
return;
|
|
27
24
|
}
|
|
28
25
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wave-code",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "CLI-based code assistant powered by AI, built with React and Ink",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react": "^19.2.4",
|
|
40
40
|
"react-dom": "19.2.4",
|
|
41
41
|
"yargs": "^17.7.2",
|
|
42
|
-
"wave-agent-sdk": "0.7.
|
|
42
|
+
"wave-agent-sdk": "0.7.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/react": "^19.1.8",
|
|
@@ -85,14 +85,11 @@ export const BackgroundTaskManager: React.FC<BackgroundTaskManagerProps> = ({
|
|
|
85
85
|
if (viewMode === "list") {
|
|
86
86
|
// List mode navigation
|
|
87
87
|
if (key.return) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
return prev;
|
|
95
|
-
});
|
|
88
|
+
if (tasks.length > 0 && selectedIndex < tasks.length) {
|
|
89
|
+
const selectedTask = tasks[selectedIndex];
|
|
90
|
+
setDetailTaskId(selectedTask.id);
|
|
91
|
+
setViewMode("detail");
|
|
92
|
+
}
|
|
96
93
|
return;
|
|
97
94
|
}
|
|
98
95
|
|
|
@@ -102,25 +99,20 @@ export const BackgroundTaskManager: React.FC<BackgroundTaskManagerProps> = ({
|
|
|
102
99
|
}
|
|
103
100
|
|
|
104
101
|
if (key.upArrow) {
|
|
105
|
-
setSelectedIndex(
|
|
102
|
+
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
106
103
|
return;
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
if (key.downArrow) {
|
|
110
|
-
setSelectedIndex(
|
|
107
|
+
setSelectedIndex(Math.min(tasks.length - 1, selectedIndex + 1));
|
|
111
108
|
return;
|
|
112
109
|
}
|
|
113
110
|
|
|
114
|
-
if (input === "k") {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
stopTask(selectedTask.id);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return prev;
|
|
123
|
-
});
|
|
111
|
+
if (input === "k" && tasks.length > 0 && selectedIndex < tasks.length) {
|
|
112
|
+
const selectedTask = tasks[selectedIndex];
|
|
113
|
+
if (selectedTask.status === "running") {
|
|
114
|
+
stopTask(selectedTask.id);
|
|
115
|
+
}
|
|
124
116
|
return;
|
|
125
117
|
}
|
|
126
118
|
} else if (viewMode === "detail") {
|
|
@@ -14,34 +14,38 @@ export const HistorySearch: React.FC<HistorySearchProps> = ({
|
|
|
14
14
|
onCancel,
|
|
15
15
|
}) => {
|
|
16
16
|
const MAX_VISIBLE_ITEMS = 5;
|
|
17
|
-
const [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
18
|
+
const [entries, setEntries] = useState<PromptEntry[]>([]);
|
|
19
|
+
|
|
20
|
+
const entriesRef = React.useRef<PromptEntry[]>([]);
|
|
21
|
+
const selectedIndexRef = React.useRef(0);
|
|
22
|
+
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
entriesRef.current = entries;
|
|
25
|
+
}, [entries]);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
selectedIndexRef.current = selectedIndex;
|
|
29
|
+
}, [selectedIndex]);
|
|
21
30
|
|
|
22
31
|
useEffect(() => {
|
|
23
32
|
const fetchHistory = async () => {
|
|
24
33
|
const results = await PromptHistoryManager.searchHistory(searchQuery);
|
|
25
34
|
const limitedResults = results.slice(0, 20);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
selectedIndex: 0,
|
|
29
|
-
});
|
|
35
|
+
setEntries(limitedResults); // Limit to 20 results
|
|
36
|
+
setSelectedIndex(0);
|
|
30
37
|
};
|
|
31
38
|
fetchHistory();
|
|
32
39
|
}, [searchQuery]);
|
|
33
40
|
|
|
34
41
|
useInput((input, key) => {
|
|
35
42
|
if (key.return) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
return prev;
|
|
44
|
-
});
|
|
43
|
+
if (
|
|
44
|
+
entriesRef.current.length > 0 &&
|
|
45
|
+
selectedIndexRef.current < entriesRef.current.length
|
|
46
|
+
) {
|
|
47
|
+
onSelect(entriesRef.current[selectedIndexRef.current].prompt);
|
|
48
|
+
}
|
|
45
49
|
return;
|
|
46
50
|
}
|
|
47
51
|
|
|
@@ -51,27 +55,18 @@ export const HistorySearch: React.FC<HistorySearchProps> = ({
|
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
if (key.upArrow) {
|
|
54
|
-
|
|
55
|
-
...prev,
|
|
56
|
-
selectedIndex: Math.max(0, prev.selectedIndex - 1),
|
|
57
|
-
}));
|
|
58
|
+
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
58
59
|
return;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
if (key.downArrow) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
prev.entries.length - 1,
|
|
66
|
-
prev.selectedIndex + 1,
|
|
67
|
-
),
|
|
68
|
-
}));
|
|
63
|
+
setSelectedIndex((prev) =>
|
|
64
|
+
Math.min(entriesRef.current.length - 1, prev + 1),
|
|
65
|
+
);
|
|
69
66
|
return;
|
|
70
67
|
}
|
|
71
68
|
});
|
|
72
69
|
|
|
73
|
-
const { entries, selectedIndex } = state;
|
|
74
|
-
|
|
75
70
|
if (entries.length === 0) {
|
|
76
71
|
return (
|
|
77
72
|
<Box
|
|
@@ -17,12 +17,9 @@ export const SessionSelector: React.FC<SessionSelectorProps> = ({
|
|
|
17
17
|
|
|
18
18
|
useInput((input, key) => {
|
|
19
19
|
if (key.return) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
return prev;
|
|
25
|
-
});
|
|
20
|
+
if (sessions.length > 0 && selectedIndex < sessions.length) {
|
|
21
|
+
onSelect(sessions[selectedIndex].id);
|
|
22
|
+
}
|
|
26
23
|
return;
|
|
27
24
|
}
|
|
28
25
|
|
|
@@ -32,12 +29,12 @@ export const SessionSelector: React.FC<SessionSelectorProps> = ({
|
|
|
32
29
|
}
|
|
33
30
|
|
|
34
31
|
if (key.upArrow) {
|
|
35
|
-
setSelectedIndex(
|
|
32
|
+
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
36
33
|
return;
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
if (key.downArrow) {
|
|
40
|
-
setSelectedIndex(
|
|
37
|
+
setSelectedIndex(Math.min(sessions.length - 1, selectedIndex + 1));
|
|
41
38
|
return;
|
|
42
39
|
}
|
|
43
40
|
});
|