wave-code 0.18.2 → 0.18.4
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/CommandSelector.d.ts.map +1 -1
- package/dist/components/CommandSelector.js +9 -13
- package/dist/components/ConfirmationSelector.d.ts.map +1 -1
- package/dist/components/ConfirmationSelector.js +0 -1
- package/dist/components/DiscoverView.d.ts.map +1 -1
- package/dist/components/DiscoverView.js +10 -6
- package/dist/components/FileSelector.js +8 -8
- package/dist/components/HistorySearch.d.ts.map +1 -1
- package/dist/components/HistorySearch.js +6 -13
- package/dist/components/InstalledView.d.ts.map +1 -1
- package/dist/components/InstalledView.js +10 -6
- package/dist/components/LoginCommand.d.ts.map +1 -1
- package/dist/components/LoginCommand.js +14 -11
- package/dist/components/MarketplaceDetail.d.ts.map +1 -1
- package/dist/components/MarketplaceDetail.js +11 -7
- package/dist/components/MarketplaceView.d.ts.map +1 -1
- package/dist/components/MarketplaceView.js +10 -6
- package/dist/components/ModelSelector.d.ts.map +1 -1
- package/dist/components/ModelSelector.js +9 -15
- package/dist/components/SessionSelector.d.ts +5 -3
- package/dist/components/SessionSelector.d.ts.map +1 -1
- package/dist/components/SessionSelector.js +11 -7
- package/dist/components/WorktreeExitPrompt.d.ts.map +1 -1
- package/dist/components/WorktreeExitPrompt.js +3 -3
- package/dist/reducers/questionReducer.d.ts +0 -7
- package/dist/reducers/questionReducer.d.ts.map +1 -1
- package/dist/reducers/questionReducer.js +2 -1
- package/dist/reducers/selectorReducer.d.ts +7 -5
- package/dist/reducers/selectorReducer.d.ts.map +1 -1
- package/dist/reducers/selectorReducer.js +4 -2
- package/package.json +2 -2
- package/src/components/CommandSelector.tsx +11 -15
- package/src/components/ConfirmationSelector.tsx +0 -1
- package/src/components/DiscoverView.tsx +22 -7
- package/src/components/FileSelector.tsx +9 -9
- package/src/components/HistorySearch.tsx +7 -14
- package/src/components/InstalledView.tsx +23 -9
- package/src/components/LoginCommand.tsx +33 -36
- package/src/components/MarketplaceDetail.tsx +25 -10
- package/src/components/MarketplaceView.tsx +16 -7
- package/src/components/ModelSelector.tsx +13 -16
- package/src/components/SessionSelector.tsx +19 -9
- package/src/components/WorktreeExitPrompt.tsx +7 -4
- package/src/reducers/questionReducer.ts +2 -6
- package/src/reducers/selectorReducer.ts +20 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandSelector.d.ts","sourceRoot":"","sources":["../../src/components/CommandSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAOnD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"CommandSelector.d.ts","sourceRoot":"","sources":["../../src/components/CommandSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAE9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAOnD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAgJ1D,CAAC"}
|
|
@@ -5,21 +5,22 @@ import { AVAILABLE_COMMANDS } from "../constants/commands.js";
|
|
|
5
5
|
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
6
6
|
export const CommandSelector = ({ searchQuery, onSelect, onInsert, onCancel, commands = [], }) => {
|
|
7
7
|
const MAX_VISIBLE_ITEMS = 3;
|
|
8
|
-
const [state, dispatch] = useReducer(selectorReducer, {
|
|
8
|
+
const [state, dispatch] = useReducer((selectorReducer), {
|
|
9
9
|
selectedIndex: 0,
|
|
10
10
|
pendingDecision: null,
|
|
11
|
+
items: [],
|
|
11
12
|
});
|
|
12
|
-
const { selectedIndex, pendingDecision } = state;
|
|
13
|
-
// Reset selected index when search query changes
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
dispatch({ type: "RESET_INDEX" });
|
|
16
|
-
}, [searchQuery]);
|
|
13
|
+
const { selectedIndex, pendingDecision, items: filteredCommands } = state;
|
|
17
14
|
// Merge agent commands and local commands, memoized to stabilize useEffect dependencies
|
|
18
|
-
const
|
|
15
|
+
const computedCommands = useMemo(() => {
|
|
19
16
|
const allCommands = [...AVAILABLE_COMMANDS, ...commands];
|
|
20
17
|
return allCommands.filter((command) => !searchQuery ||
|
|
21
18
|
command.id.toLowerCase().includes(searchQuery.toLowerCase()));
|
|
22
19
|
}, [searchQuery, commands]);
|
|
20
|
+
// Sync computed commands into reducer state (SET_ITEMS also resets index)
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
dispatch({ type: "SET_ITEMS", items: computedCommands });
|
|
23
|
+
}, [computedCommands]);
|
|
23
24
|
// Handle decisions from reducer
|
|
24
25
|
useEffect(() => {
|
|
25
26
|
if (!pendingDecision)
|
|
@@ -52,12 +53,7 @@ export const CommandSelector = ({ searchQuery, onSelect, onInsert, onCancel, com
|
|
|
52
53
|
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2), Math.max(0, filteredCommands.length - MAX_VISIBLE_ITEMS)));
|
|
53
54
|
const visibleCommands = filteredCommands.slice(startIndex, startIndex + MAX_VISIBLE_ITEMS);
|
|
54
55
|
useInput((input, key) => {
|
|
55
|
-
dispatch({
|
|
56
|
-
type: "HANDLE_KEY",
|
|
57
|
-
key,
|
|
58
|
-
maxIndex: filteredCommands.length - 1,
|
|
59
|
-
hasInsert: !!onInsert,
|
|
60
|
-
});
|
|
56
|
+
dispatch({ type: "HANDLE_KEY", key, hasInsert: !!onInsert });
|
|
61
57
|
});
|
|
62
58
|
if (filteredCommands.length === 0) {
|
|
63
59
|
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "yellow", borderBottom: false, borderLeft: false, borderRight: false, children: [_jsxs(Text, { color: "yellow", children: ["No commands found for \"", searchQuery, "\""] }), _jsx(Text, { dimColor: true, children: "Press Escape to cancel" })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationSelector.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmationSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,gBAAgB,CAAC;AAmB/E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,
|
|
1
|
+
{"version":3,"file":"ConfirmationSelector.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmationSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,kBAAkB,EAAwB,MAAM,gBAAgB,CAAC;AAmB/E,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAoRpE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscoverView.d.ts","sourceRoot":"","sources":["../../src/components/DiscoverView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DiscoverView.d.ts","sourceRoot":"","sources":["../../src/components/DiscoverView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAgBrD,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAuChC,CAAC"}
|
|
@@ -3,31 +3,35 @@ import { useReducer, useEffect } from "react";
|
|
|
3
3
|
import { Box, useInput } from "ink";
|
|
4
4
|
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
5
|
import { PluginList } from "./PluginList.js";
|
|
6
|
-
import { selectorReducer } from "../reducers/selectorReducer.js";
|
|
6
|
+
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
7
7
|
export const DiscoverView = () => {
|
|
8
8
|
const { discoverablePlugins, actions } = usePluginManagerContext();
|
|
9
|
-
const [state, dispatch] = useReducer(selectorReducer, {
|
|
9
|
+
const [state, dispatch] = useReducer((selectorReducer), {
|
|
10
10
|
selectedIndex: 0,
|
|
11
11
|
pendingDecision: null,
|
|
12
|
+
items: [],
|
|
12
13
|
});
|
|
13
|
-
const { selectedIndex, pendingDecision } = state;
|
|
14
|
+
const { selectedIndex, pendingDecision, items } = state;
|
|
15
|
+
// Sync plugins into reducer state
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
dispatch({ type: "SET_ITEMS", items: discoverablePlugins });
|
|
18
|
+
}, [discoverablePlugins]);
|
|
14
19
|
useInput((_input, key) => {
|
|
15
20
|
dispatch({
|
|
16
21
|
type: "HANDLE_KEY",
|
|
17
22
|
key,
|
|
18
|
-
maxIndex: discoverablePlugins.length - 1,
|
|
19
23
|
hasInsert: false,
|
|
20
24
|
});
|
|
21
25
|
});
|
|
22
26
|
useEffect(() => {
|
|
23
27
|
if (pendingDecision === "select") {
|
|
24
|
-
const plugin =
|
|
28
|
+
const plugin = items[selectedIndex];
|
|
25
29
|
if (plugin) {
|
|
26
30
|
actions.setSelectedId(`${plugin.name}@${plugin.marketplace}`);
|
|
27
31
|
actions.setView("PLUGIN_DETAIL");
|
|
28
32
|
}
|
|
29
33
|
dispatch({ type: "CLEAR_DECISION" });
|
|
30
34
|
}
|
|
31
|
-
}, [pendingDecision, selectedIndex,
|
|
35
|
+
}, [pendingDecision, selectedIndex, items, actions]);
|
|
32
36
|
return (_jsx(Box, { flexDirection: "column", children: _jsx(PluginList, { plugins: discoverablePlugins, selectedIndex: selectedIndex }) }));
|
|
33
37
|
};
|
|
@@ -3,34 +3,34 @@ import { useReducer, useEffect } from "react";
|
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
4
|
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
5
5
|
export const FileSelector = ({ files, searchQuery, isLoading = false, onSelect, onCancel, }) => {
|
|
6
|
-
const [state, dispatch] = useReducer(selectorReducer, {
|
|
6
|
+
const [state, dispatch] = useReducer((selectorReducer), {
|
|
7
7
|
selectedIndex: 0,
|
|
8
8
|
pendingDecision: null,
|
|
9
|
+
items: [],
|
|
9
10
|
});
|
|
10
|
-
const { selectedIndex, pendingDecision } = state;
|
|
11
|
-
//
|
|
11
|
+
const { selectedIndex, pendingDecision, items: filesInState } = state;
|
|
12
|
+
// Sync files from props into reducer state (SET_ITEMS also resets index)
|
|
12
13
|
useEffect(() => {
|
|
13
|
-
dispatch({ type: "
|
|
14
|
+
dispatch({ type: "SET_ITEMS", items: files });
|
|
14
15
|
}, [files]);
|
|
15
16
|
// Handle decisions from reducer
|
|
16
17
|
useEffect(() => {
|
|
17
18
|
if (!pendingDecision)
|
|
18
19
|
return;
|
|
19
20
|
if (pendingDecision === "select" || pendingDecision === "insert") {
|
|
20
|
-
if (
|
|
21
|
-
onSelect(
|
|
21
|
+
if (filesInState.length > 0 && selectedIndex < filesInState.length) {
|
|
22
|
+
onSelect(filesInState[selectedIndex].path);
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
25
|
else if (pendingDecision === "cancel") {
|
|
25
26
|
onCancel();
|
|
26
27
|
}
|
|
27
28
|
dispatch({ type: "CLEAR_DECISION" });
|
|
28
|
-
}, [pendingDecision, selectedIndex,
|
|
29
|
+
}, [pendingDecision, selectedIndex, filesInState, onSelect, onCancel]);
|
|
29
30
|
useInput((input, key) => {
|
|
30
31
|
dispatch({
|
|
31
32
|
type: "HANDLE_KEY",
|
|
32
33
|
key,
|
|
33
|
-
maxIndex: files.length - 1,
|
|
34
34
|
hasInsert: true, // For FileSelector, Tab is also select
|
|
35
35
|
});
|
|
36
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistorySearch.d.ts","sourceRoot":"","sources":["../../src/components/HistorySearch.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"HistorySearch.d.ts","sourceRoot":"","sources":["../../src/components/HistorySearch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMxE,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgJtD,CAAC"}
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useReducer, useEffect
|
|
2
|
+
import { useReducer, useEffect } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
4
|
import { PromptHistoryManager } from "wave-agent-sdk";
|
|
5
5
|
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
6
6
|
export const HistorySearch = ({ searchQuery, onSelect, onCancel, }) => {
|
|
7
7
|
const MAX_VISIBLE_ITEMS = 5;
|
|
8
|
-
const [state, dispatch] = useReducer(selectorReducer, {
|
|
8
|
+
const [state, dispatch] = useReducer((selectorReducer), {
|
|
9
9
|
selectedIndex: 0,
|
|
10
10
|
pendingDecision: null,
|
|
11
|
+
items: [],
|
|
11
12
|
});
|
|
12
|
-
const
|
|
13
|
-
const { selectedIndex, pendingDecision } = state;
|
|
13
|
+
const { selectedIndex, pendingDecision, items: entries } = state;
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
const fetchHistory = async () => {
|
|
16
16
|
const results = await PromptHistoryManager.searchHistory(searchQuery);
|
|
17
|
-
|
|
18
|
-
setEntries(limitedResults);
|
|
19
|
-
dispatch({ type: "RESET_INDEX" });
|
|
17
|
+
dispatch({ type: "SET_ITEMS", items: results.slice(0, 20) });
|
|
20
18
|
};
|
|
21
19
|
fetchHistory();
|
|
22
20
|
}, [searchQuery]);
|
|
@@ -35,12 +33,7 @@ export const HistorySearch = ({ searchQuery, onSelect, onCancel, }) => {
|
|
|
35
33
|
dispatch({ type: "CLEAR_DECISION" });
|
|
36
34
|
}, [pendingDecision, selectedIndex, entries, onSelect, onCancel]);
|
|
37
35
|
useInput((input, key) => {
|
|
38
|
-
dispatch({
|
|
39
|
-
type: "HANDLE_KEY",
|
|
40
|
-
key,
|
|
41
|
-
maxIndex: entries.length - 1,
|
|
42
|
-
hasInsert: false,
|
|
43
|
-
});
|
|
36
|
+
dispatch({ type: "HANDLE_KEY", key, hasInsert: false });
|
|
44
37
|
});
|
|
45
38
|
if (entries.length === 0) {
|
|
46
39
|
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" })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstalledView.d.ts","sourceRoot":"","sources":["../../src/components/InstalledView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"InstalledView.d.ts","sourceRoot":"","sources":["../../src/components/InstalledView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAWrD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAsFjC,CAAC"}
|
|
@@ -2,32 +2,36 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useReducer, useEffect } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
4
|
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
-
import { selectorReducer } from "../reducers/selectorReducer.js";
|
|
5
|
+
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
6
6
|
export const InstalledView = () => {
|
|
7
7
|
const { installedPlugins, actions } = usePluginManagerContext();
|
|
8
|
-
const [state, dispatch] = useReducer(selectorReducer, {
|
|
8
|
+
const [state, dispatch] = useReducer((selectorReducer), {
|
|
9
9
|
selectedIndex: 0,
|
|
10
10
|
pendingDecision: null,
|
|
11
|
+
items: [],
|
|
11
12
|
});
|
|
12
|
-
const { selectedIndex, pendingDecision } = state;
|
|
13
|
+
const { selectedIndex, pendingDecision, items } = state;
|
|
14
|
+
// Sync plugins into reducer state
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
dispatch({ type: "SET_ITEMS", items: installedPlugins });
|
|
17
|
+
}, [installedPlugins]);
|
|
13
18
|
useInput((_input, key) => {
|
|
14
19
|
dispatch({
|
|
15
20
|
type: "HANDLE_KEY",
|
|
16
21
|
key,
|
|
17
|
-
maxIndex: installedPlugins.length - 1,
|
|
18
22
|
hasInsert: false,
|
|
19
23
|
});
|
|
20
24
|
});
|
|
21
25
|
useEffect(() => {
|
|
22
26
|
if (pendingDecision === "select") {
|
|
23
|
-
const plugin =
|
|
27
|
+
const plugin = items[selectedIndex];
|
|
24
28
|
if (plugin) {
|
|
25
29
|
actions.setSelectedId(`${plugin.name}@${plugin.marketplace}`);
|
|
26
30
|
actions.setView("PLUGIN_DETAIL");
|
|
27
31
|
}
|
|
28
32
|
dispatch({ type: "CLEAR_DECISION" });
|
|
29
33
|
}
|
|
30
|
-
}, [pendingDecision, selectedIndex,
|
|
34
|
+
}, [pendingDecision, selectedIndex, items, actions]);
|
|
31
35
|
if (installedPlugins.length === 0) {
|
|
32
36
|
return (_jsx(Box, { padding: 1, children: _jsx(Text, { dimColor: true, children: "No plugins installed." }) }));
|
|
33
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoginCommand.d.ts","sourceRoot":"","sources":["../../src/components/LoginCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAoBhD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"LoginCommand.d.ts","sourceRoot":"","sources":["../../src/components/LoginCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAoBhD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAuMpD,CAAC"}
|
|
@@ -29,17 +29,20 @@ export const LoginCommand = ({ onCancel }) => {
|
|
|
29
29
|
// Resolve/reject refs for the token promise
|
|
30
30
|
const tokenResolveRef = useRef(null);
|
|
31
31
|
const tokenRejectRef = useRef(null);
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
if (key.escape) {
|
|
35
|
-
onCancel();
|
|
36
|
-
}
|
|
37
|
-
if (key.return && !isLoadingRef.current) {
|
|
38
|
-
handleEnter();
|
|
39
|
-
}
|
|
40
|
-
}, { isActive: !isLoading });
|
|
41
|
-
// Token input: capture keystrokes while loading
|
|
32
|
+
// Single useInput handler — branches on isLoading to avoid the
|
|
33
|
+
// isActive transition race that drops stdin between hook swaps.
|
|
42
34
|
useInput((input, key) => {
|
|
35
|
+
if (!isLoadingRef.current) {
|
|
36
|
+
// Pre-loading mode: Enter starts login, Esc cancels
|
|
37
|
+
if (key.escape) {
|
|
38
|
+
onCancel();
|
|
39
|
+
}
|
|
40
|
+
if (key.return) {
|
|
41
|
+
handleEnter();
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// Token input mode: capture keystrokes while loading
|
|
43
46
|
if (key.escape) {
|
|
44
47
|
tokenRejectRef.current?.(new Error("cancelled"));
|
|
45
48
|
onCancel();
|
|
@@ -65,7 +68,7 @@ export const LoginCommand = ({ onCancel }) => {
|
|
|
65
68
|
if (input && !key.ctrl && !key.meta && !key.return && input.length > 0) {
|
|
66
69
|
setTokenInput((prev) => prev + input);
|
|
67
70
|
}
|
|
68
|
-
}
|
|
71
|
+
});
|
|
69
72
|
const handleEnter = async () => {
|
|
70
73
|
if (isLoadingRef.current)
|
|
71
74
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarketplaceDetail.d.ts","sourceRoot":"","sources":["../../src/components/MarketplaceDetail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MarketplaceDetail.d.ts","sourceRoot":"","sources":["../../src/components/MarketplaceDetail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAQ9D,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EA0JrC,CAAC"}
|
|
@@ -2,14 +2,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useReducer, useEffect, useMemo } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
4
|
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
-
import { selectorReducer } from "../reducers/selectorReducer.js";
|
|
5
|
+
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
6
6
|
export const MarketplaceDetail = () => {
|
|
7
7
|
const { state, marketplaces, actions } = usePluginManagerContext();
|
|
8
|
-
const [selectorState, dispatch] = useReducer(selectorReducer, {
|
|
8
|
+
const [selectorState, dispatch] = useReducer((selectorReducer), {
|
|
9
9
|
selectedIndex: 0,
|
|
10
10
|
pendingDecision: null,
|
|
11
|
+
items: [],
|
|
11
12
|
});
|
|
12
|
-
const { selectedIndex: selectedActionIndex, pendingDecision } = selectorState;
|
|
13
|
+
const { selectedIndex: selectedActionIndex, pendingDecision, items: actionsList, } = selectorState;
|
|
13
14
|
const marketplace = marketplaces.find((m) => m.name === state.selectedId);
|
|
14
15
|
const ACTIONS = useMemo(() => [
|
|
15
16
|
{
|
|
@@ -19,13 +20,16 @@ export const MarketplaceDetail = () => {
|
|
|
19
20
|
{ id: "update", label: "Update marketplace" },
|
|
20
21
|
{ id: "remove", label: "Remove marketplace" },
|
|
21
22
|
], [marketplace?.autoUpdate]);
|
|
23
|
+
// Sync ACTIONS into reducer state
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
dispatch({ type: "SET_ITEMS", items: [...ACTIONS] });
|
|
26
|
+
}, [ACTIONS]);
|
|
22
27
|
useInput((_input, key) => {
|
|
23
28
|
if (state.isLoading && !key.escape)
|
|
24
29
|
return;
|
|
25
30
|
dispatch({
|
|
26
31
|
type: "HANDLE_KEY",
|
|
27
32
|
key,
|
|
28
|
-
maxIndex: ACTIONS.length - 1,
|
|
29
33
|
hasInsert: false,
|
|
30
34
|
});
|
|
31
35
|
});
|
|
@@ -33,14 +37,14 @@ export const MarketplaceDetail = () => {
|
|
|
33
37
|
if (!pendingDecision)
|
|
34
38
|
return;
|
|
35
39
|
if (pendingDecision === "select" && marketplace && !state.isLoading) {
|
|
36
|
-
const action =
|
|
40
|
+
const action = actionsList[selectedActionIndex]?.id;
|
|
37
41
|
if (action === "toggle-auto-update") {
|
|
38
42
|
actions.toggleAutoUpdate(marketplace.name, !marketplace.autoUpdate);
|
|
39
43
|
}
|
|
40
44
|
else if (action === "update") {
|
|
41
45
|
actions.updateMarketplace(marketplace.name);
|
|
42
46
|
}
|
|
43
|
-
else {
|
|
47
|
+
else if (action === "remove") {
|
|
44
48
|
actions.removeMarketplace(marketplace.name);
|
|
45
49
|
}
|
|
46
50
|
}
|
|
@@ -51,10 +55,10 @@ export const MarketplaceDetail = () => {
|
|
|
51
55
|
}, [
|
|
52
56
|
pendingDecision,
|
|
53
57
|
selectedActionIndex,
|
|
58
|
+
actionsList,
|
|
54
59
|
marketplace,
|
|
55
60
|
state.isLoading,
|
|
56
61
|
actions,
|
|
57
|
-
ACTIONS,
|
|
58
62
|
]);
|
|
59
63
|
if (!marketplace) {
|
|
60
64
|
return (_jsx(Box, { children: _jsx(Text, { color: "red", children: "Marketplace not found." }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarketplaceView.d.ts","sourceRoot":"","sources":["../../src/components/MarketplaceView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MarketplaceView.d.ts","sourceRoot":"","sources":["../../src/components/MarketplaceView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAWrD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAuDnC,CAAC"}
|
|
@@ -2,15 +2,20 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useReducer, useEffect } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
4
|
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
-
import { selectorReducer } from "../reducers/selectorReducer.js";
|
|
5
|
+
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
6
6
|
import { MarketplaceList } from "./MarketplaceList.js";
|
|
7
7
|
export const MarketplaceView = () => {
|
|
8
8
|
const { marketplaces, actions } = usePluginManagerContext();
|
|
9
|
-
const [state, dispatch] = useReducer(selectorReducer, {
|
|
9
|
+
const [state, dispatch] = useReducer((selectorReducer), {
|
|
10
10
|
selectedIndex: 0,
|
|
11
11
|
pendingDecision: null,
|
|
12
|
+
items: [],
|
|
12
13
|
});
|
|
13
|
-
const { selectedIndex, pendingDecision } = state;
|
|
14
|
+
const { selectedIndex, pendingDecision, items } = state;
|
|
15
|
+
// Sync marketplaces into reducer state
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
dispatch({ type: "SET_ITEMS", items: marketplaces });
|
|
18
|
+
}, [marketplaces]);
|
|
14
19
|
useInput((input, key) => {
|
|
15
20
|
if (input === "a") {
|
|
16
21
|
actions.setView("ADD_MARKETPLACE");
|
|
@@ -19,19 +24,18 @@ export const MarketplaceView = () => {
|
|
|
19
24
|
dispatch({
|
|
20
25
|
type: "HANDLE_KEY",
|
|
21
26
|
key,
|
|
22
|
-
maxIndex: marketplaces.length - 1,
|
|
23
27
|
hasInsert: false,
|
|
24
28
|
});
|
|
25
29
|
});
|
|
26
30
|
useEffect(() => {
|
|
27
31
|
if (pendingDecision === "select") {
|
|
28
|
-
const mk =
|
|
32
|
+
const mk = items[selectedIndex];
|
|
29
33
|
if (mk) {
|
|
30
34
|
actions.setSelectedId(mk.name);
|
|
31
35
|
actions.setView("MARKETPLACE_DETAIL");
|
|
32
36
|
}
|
|
33
37
|
dispatch({ type: "CLEAR_DECISION" });
|
|
34
38
|
}
|
|
35
|
-
}, [pendingDecision, selectedIndex,
|
|
39
|
+
}, [pendingDecision, selectedIndex, items, actions]);
|
|
36
40
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "green", children: "Press 'a' to add a new marketplace" }) }), _jsx(MarketplaceList, { marketplaces: marketplaces, selectedIndex: selectedIndex }), marketplaces.length > 0 && (_jsx(Box, { marginLeft: 4, marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Enter for actions" }) }))] }));
|
|
37
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelSelector.d.ts","sourceRoot":"","sources":["../../src/components/ModelSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ModelSelector.d.ts","sourceRoot":"","sources":["../../src/components/ModelSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAOrD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAID,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoHtD,CAAC"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useReducer, useEffect } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { selectorReducer } from "../reducers/selectorReducer.js";
|
|
4
|
+
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
5
5
|
const MAX_VISIBLE_ITEMS = 5;
|
|
6
6
|
export const ModelSelector = ({ onCancel, currentModel, configuredModels, onSelectModel, }) => {
|
|
7
|
-
const [state, dispatch] = useReducer(selectorReducer, {
|
|
7
|
+
const [state, dispatch] = useReducer((selectorReducer), {
|
|
8
8
|
selectedIndex: configuredModels.indexOf(currentModel) !== -1
|
|
9
9
|
? configuredModels.indexOf(currentModel)
|
|
10
10
|
: 0,
|
|
11
11
|
pendingDecision: null,
|
|
12
|
+
items: configuredModels,
|
|
12
13
|
});
|
|
13
|
-
const { selectedIndex, pendingDecision } = state;
|
|
14
|
+
const { selectedIndex, pendingDecision, items: models } = state;
|
|
14
15
|
useInput((_input, key) => {
|
|
15
16
|
dispatch({
|
|
16
17
|
type: "HANDLE_KEY",
|
|
17
18
|
key,
|
|
18
|
-
maxIndex: configuredModels.length - 1,
|
|
19
19
|
hasInsert: false,
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
useEffect(() => {
|
|
23
23
|
if (pendingDecision === "select") {
|
|
24
|
-
if (
|
|
25
|
-
onSelectModel(
|
|
24
|
+
if (models.length > 0) {
|
|
25
|
+
onSelectModel(models[selectedIndex]);
|
|
26
26
|
}
|
|
27
27
|
onCancel();
|
|
28
28
|
dispatch({ type: "CLEAR_DECISION" });
|
|
@@ -31,16 +31,10 @@ export const ModelSelector = ({ onCancel, currentModel, configuredModels, onSele
|
|
|
31
31
|
onCancel();
|
|
32
32
|
dispatch({ type: "CLEAR_DECISION" });
|
|
33
33
|
}
|
|
34
|
-
}, [
|
|
35
|
-
pendingDecision,
|
|
36
|
-
selectedIndex,
|
|
37
|
-
configuredModels,
|
|
38
|
-
onSelectModel,
|
|
39
|
-
onCancel,
|
|
40
|
-
]);
|
|
34
|
+
}, [pendingDecision, selectedIndex, models, onSelectModel, onCancel]);
|
|
41
35
|
// Calculate visible window
|
|
42
|
-
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2), Math.max(0,
|
|
43
|
-
const visibleModels =
|
|
36
|
+
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2), Math.max(0, models.length - MAX_VISIBLE_ITEMS)));
|
|
37
|
+
const visibleModels = models.slice(startIndex, startIndex + MAX_VISIBLE_ITEMS);
|
|
44
38
|
if (configuredModels.length === 0) {
|
|
45
39
|
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: "Select AI Model" }), _jsx(Text, { children: "No models configured" }), _jsx(Text, { dimColor: true, children: "Press Escape to close" })] }));
|
|
46
40
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SessionMetadata } from "wave-agent-sdk";
|
|
3
|
+
type SessionItem = SessionMetadata & {
|
|
4
|
+
firstMessage?: string;
|
|
5
|
+
};
|
|
3
6
|
export interface SessionSelectorProps {
|
|
4
|
-
sessions:
|
|
5
|
-
firstMessage?: string;
|
|
6
|
-
})[];
|
|
7
|
+
sessions: SessionItem[];
|
|
7
8
|
onSelect: (sessionId: string) => void;
|
|
8
9
|
onCancel: () => void;
|
|
9
10
|
}
|
|
10
11
|
export declare const SessionSelector: React.FC<SessionSelectorProps>;
|
|
12
|
+
export {};
|
|
11
13
|
//# sourceMappingURL=SessionSelector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionSelector.d.ts","sourceRoot":"","sources":["../../src/components/SessionSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionSelector.d.ts","sourceRoot":"","sources":["../../src/components/SessionSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAMtD,KAAK,WAAW,GAAG,eAAe,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,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,CA4I1D,CAAC"}
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useReducer, useEffect } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { selectorReducer } from "../reducers/selectorReducer.js";
|
|
4
|
+
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
5
5
|
export const SessionSelector = ({ sessions, onSelect, onCancel, }) => {
|
|
6
|
-
const [state, dispatch] = useReducer(selectorReducer, {
|
|
6
|
+
const [state, dispatch] = useReducer((selectorReducer), {
|
|
7
7
|
selectedIndex: 0,
|
|
8
8
|
pendingDecision: null,
|
|
9
|
+
items: [],
|
|
9
10
|
});
|
|
10
|
-
const { selectedIndex, pendingDecision } = state;
|
|
11
|
+
const { selectedIndex, pendingDecision, items } = state;
|
|
12
|
+
// Sync sessions into reducer state
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
dispatch({ type: "SET_ITEMS", items: sessions });
|
|
15
|
+
}, [sessions]);
|
|
11
16
|
useInput((_input, key) => {
|
|
12
17
|
dispatch({
|
|
13
18
|
type: "HANDLE_KEY",
|
|
14
19
|
key,
|
|
15
|
-
maxIndex: sessions.length - 1,
|
|
16
20
|
hasInsert: false,
|
|
17
21
|
});
|
|
18
22
|
});
|
|
19
23
|
useEffect(() => {
|
|
20
24
|
if (pendingDecision === "select") {
|
|
21
|
-
if (
|
|
22
|
-
onSelect(
|
|
25
|
+
if (items.length > 0 && selectedIndex < items.length) {
|
|
26
|
+
onSelect(items[selectedIndex].id);
|
|
23
27
|
}
|
|
24
28
|
dispatch({ type: "CLEAR_DECISION" });
|
|
25
29
|
}
|
|
@@ -27,7 +31,7 @@ export const SessionSelector = ({ sessions, onSelect, onCancel, }) => {
|
|
|
27
31
|
onCancel();
|
|
28
32
|
dispatch({ type: "CLEAR_DECISION" });
|
|
29
33
|
}
|
|
30
|
-
}, [pendingDecision, selectedIndex,
|
|
34
|
+
}, [pendingDecision, selectedIndex, items, onSelect, onCancel]);
|
|
31
35
|
if (sessions.length === 0) {
|
|
32
36
|
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "yellow", borderLeft: false, borderRight: false, paddingX: 1, width: "100%", children: [_jsx(Text, { color: "yellow", children: "No sessions found." }), _jsx(Text, { dimColor: true, children: "Press Escape to cancel" })] }));
|
|
33
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorktreeExitPrompt.d.ts","sourceRoot":"","sources":["../../src/components/WorktreeExitPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"WorktreeExitPrompt.d.ts","sourceRoot":"","sources":["../../src/components/WorktreeExitPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAOrD,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAiFhE,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useReducer, useEffect } from "react";
|
|
3
3
|
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { selectorReducer } from "../reducers/selectorReducer.js";
|
|
4
|
+
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
5
5
|
export const WorktreeExitPrompt = ({ name, path: worktreePath, hasUncommittedChanges, hasNewCommits, onKeep, onRemove, onCancel, }) => {
|
|
6
|
-
const [state, dispatch] = useReducer(selectorReducer, {
|
|
6
|
+
const [state, dispatch] = useReducer((selectorReducer), {
|
|
7
7
|
selectedIndex: 0,
|
|
8
8
|
pendingDecision: null,
|
|
9
|
+
items: ["keep", "remove"],
|
|
9
10
|
});
|
|
10
11
|
const { selectedIndex, pendingDecision } = state;
|
|
11
12
|
useInput((_input, key) => {
|
|
12
13
|
dispatch({
|
|
13
14
|
type: "HANDLE_KEY",
|
|
14
15
|
key,
|
|
15
|
-
maxIndex: 1,
|
|
16
16
|
hasInsert: false,
|
|
17
17
|
});
|
|
18
18
|
});
|
|
@@ -71,13 +71,6 @@ export type QuestionAction = {
|
|
|
71
71
|
type: "HANDLE_KEY";
|
|
72
72
|
input: string;
|
|
73
73
|
key: Key;
|
|
74
|
-
currentQuestion: {
|
|
75
|
-
question: string;
|
|
76
|
-
options: Array<{
|
|
77
|
-
label: string;
|
|
78
|
-
}>;
|
|
79
|
-
multiSelect?: boolean;
|
|
80
|
-
};
|
|
81
74
|
questions: Array<{
|
|
82
75
|
question: string;
|
|
83
76
|
options: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questionReducer.d.ts","sourceRoot":"","sources":["../../src/reducers/questionReducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qBAAqB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,qBAAqB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAChD,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC9C;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;CACvB,GACD;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACnD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,eAAe,EAAE;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClC,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC;IACF,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClC,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,KAAK,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QAClC,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAC,CAAC;CACJ,GACD;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,GAAG,CAAC;IACT,
|
|
1
|
+
{"version":3,"file":"questionReducer.d.ts","sourceRoot":"","sources":["../../src/reducers/questionReducer.ts"],"names":[],"mappings":"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"}
|
|
@@ -192,7 +192,8 @@ export function questionReducer(state, action) {
|
|
|
192
192
|
case "CLEAR_DECISION":
|
|
193
193
|
return { ...state, decision: null };
|
|
194
194
|
case "HANDLE_KEY": {
|
|
195
|
-
const { input, key,
|
|
195
|
+
const { input, key, questions } = action;
|
|
196
|
+
const currentQuestion = questions[state.currentQuestionIndex];
|
|
196
197
|
if (!currentQuestion)
|
|
197
198
|
return state;
|
|
198
199
|
const options = [...currentQuestion.options, { label: "Other" }];
|