@defai.digital/ax-cli 2.8.0 → 3.0.1
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 +85 -9
- package/dist/agent/context-manager.js +9 -0
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/dependency-resolver.js +13 -5
- package/dist/agent/dependency-resolver.js.map +1 -1
- package/dist/agent/llm-agent.d.ts +50 -0
- package/dist/agent/llm-agent.js +539 -3
- package/dist/agent/llm-agent.js.map +1 -1
- package/dist/agent/subagent-orchestrator.d.ts +4 -0
- package/dist/agent/subagent-orchestrator.js +54 -11
- package/dist/agent/subagent-orchestrator.js.map +1 -1
- package/dist/agent/subagent.js +35 -11
- package/dist/agent/subagent.js.map +1 -1
- package/dist/checkpoint/manager.js +4 -0
- package/dist/checkpoint/manager.js.map +1 -1
- package/dist/commands/cache.js +5 -3
- package/dist/commands/cache.js.map +1 -1
- package/dist/commands/memory.js +21 -16
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/plan.d.ts +43 -0
- package/dist/commands/plan.js +385 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/constants.d.ts +32 -0
- package/dist/constants.js +33 -0
- package/dist/constants.js.map +1 -1
- package/dist/hooks/use-enhanced-input.d.ts +5 -1
- package/dist/hooks/use-enhanced-input.js +23 -10
- package/dist/hooks/use-enhanced-input.js.map +1 -1
- package/dist/hooks/use-input-handler.d.ts +11 -1
- package/dist/hooks/use-input-handler.js +270 -2
- package/dist/hooks/use-input-handler.js.map +1 -1
- package/dist/llm/tools.d.ts +5 -0
- package/dist/llm/tools.js +57 -6
- package/dist/llm/tools.js.map +1 -1
- package/dist/mcp/client.js +19 -12
- package/dist/mcp/client.js.map +1 -1
- package/dist/planner/dependency-resolver.d.ts +72 -0
- package/dist/planner/dependency-resolver.js +272 -0
- package/dist/planner/dependency-resolver.js.map +1 -0
- package/dist/planner/index.d.ts +12 -0
- package/dist/planner/index.js +26 -0
- package/dist/planner/index.js.map +1 -0
- package/dist/planner/plan-generator.d.ts +74 -0
- package/dist/planner/plan-generator.js +244 -0
- package/dist/planner/plan-generator.js.map +1 -0
- package/dist/planner/plan-storage.d.ts +98 -0
- package/dist/planner/plan-storage.js +330 -0
- package/dist/planner/plan-storage.js.map +1 -0
- package/dist/planner/prompts/planning-prompt.d.ts +41 -0
- package/dist/planner/prompts/planning-prompt.js +289 -0
- package/dist/planner/prompts/planning-prompt.js.map +1 -0
- package/dist/planner/task-planner.d.ts +135 -0
- package/dist/planner/task-planner.js +497 -0
- package/dist/planner/task-planner.js.map +1 -0
- package/dist/planner/token-estimator.d.ts +63 -0
- package/dist/planner/token-estimator.js +295 -0
- package/dist/planner/token-estimator.js.map +1 -0
- package/dist/planner/types.d.ts +669 -0
- package/dist/planner/types.js +213 -0
- package/dist/planner/types.js.map +1 -0
- package/dist/schemas/confirmation-schemas.d.ts +5 -0
- package/dist/schemas/confirmation-schemas.js +7 -0
- package/dist/schemas/confirmation-schemas.js.map +1 -1
- package/dist/schemas/index.d.ts +4 -4
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/tool-schemas.d.ts +9 -1
- package/dist/schemas/tool-schemas.js +6 -1
- package/dist/schemas/tool-schemas.js.map +1 -1
- package/dist/tools/bash-output.d.ts +25 -0
- package/dist/tools/bash-output.js +145 -0
- package/dist/tools/bash-output.js.map +1 -0
- package/dist/tools/bash.d.ts +46 -2
- package/dist/tools/bash.js +241 -67
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/search.js +15 -2
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/text-editor.js +4 -2
- package/dist/tools/text-editor.js.map +1 -1
- package/dist/ui/components/chat-history.d.ts +1 -0
- package/dist/ui/components/chat-history.js +125 -41
- package/dist/ui/components/chat-history.js.map +1 -1
- package/dist/ui/components/chat-input.js +10 -3
- package/dist/ui/components/chat-input.js.map +1 -1
- package/dist/ui/components/chat-interface.js +152 -44
- package/dist/ui/components/chat-interface.js.map +1 -1
- package/dist/ui/components/collapsible-tool-result.d.ts +26 -0
- package/dist/ui/components/collapsible-tool-result.js +172 -0
- package/dist/ui/components/collapsible-tool-result.js.map +1 -0
- package/dist/ui/components/command-suggestions.js +2 -1
- package/dist/ui/components/command-suggestions.js.map +1 -1
- package/dist/ui/components/confirmation-dialog.js +25 -36
- package/dist/ui/components/confirmation-dialog.js.map +1 -1
- package/dist/ui/components/index.d.ts +8 -0
- package/dist/ui/components/index.js +9 -0
- package/dist/ui/components/index.js.map +1 -1
- package/dist/ui/components/keyboard-hints.d.ts +35 -0
- package/dist/ui/components/keyboard-hints.js +134 -0
- package/dist/ui/components/keyboard-hints.js.map +1 -0
- package/dist/ui/components/loading-spinner.d.ts +2 -1
- package/dist/ui/components/loading-spinner.js +86 -34
- package/dist/ui/components/loading-spinner.js.map +1 -1
- package/dist/ui/components/phase-progress.d.ts +21 -0
- package/dist/ui/components/phase-progress.js +228 -0
- package/dist/ui/components/phase-progress.js.map +1 -0
- package/dist/ui/components/quick-actions.d.ts +12 -0
- package/dist/ui/components/quick-actions.js +124 -0
- package/dist/ui/components/quick-actions.js.map +1 -0
- package/dist/ui/components/reasoning-display.d.ts +0 -80
- package/dist/ui/components/reasoning-display.js +0 -83
- package/dist/ui/components/reasoning-display.js.map +1 -1
- package/dist/ui/components/status-bar.d.ts +25 -0
- package/dist/ui/components/status-bar.js +125 -0
- package/dist/ui/components/status-bar.js.map +1 -0
- package/dist/ui/components/toast-notification.d.ts +123 -0
- package/dist/ui/components/toast-notification.js +148 -0
- package/dist/ui/components/toast-notification.js.map +1 -0
- package/dist/ui/components/welcome-panel.d.ts +10 -0
- package/dist/ui/components/welcome-panel.js +107 -0
- package/dist/ui/components/welcome-panel.js.map +1 -0
- package/dist/utils/background-task-manager.d.ts +95 -0
- package/dist/utils/background-task-manager.js +330 -0
- package/dist/utils/background-task-manager.js.map +1 -0
- package/dist/utils/confirmation-service.js +8 -3
- package/dist/utils/confirmation-service.js.map +1 -1
- package/dist/utils/history-manager.d.ts +2 -0
- package/dist/utils/history-manager.js +8 -1
- package/dist/utils/history-manager.js.map +1 -1
- package/dist/utils/incremental-analyzer.js +11 -3
- package/dist/utils/incremental-analyzer.js.map +1 -1
- package/dist/utils/message-optimizer.d.ts +1 -0
- package/dist/utils/message-optimizer.js +7 -1
- package/dist/utils/message-optimizer.js.map +1 -1
- package/dist/utils/project-analyzer.js +5 -2
- package/dist/utils/project-analyzer.js.map +1 -1
- package/package.json +2 -1
package/dist/constants.d.ts
CHANGED
|
@@ -68,3 +68,35 @@ export declare const ERROR_MESSAGES: {
|
|
|
68
68
|
readonly FILE_NOT_FOUND: (filePath: string) => string;
|
|
69
69
|
readonly DIRECTORY_NOT_FOUND: (dirPath: string) => string;
|
|
70
70
|
};
|
|
71
|
+
export declare const PLANNER_CONFIG: {
|
|
72
|
+
/** Enable multi-phase planning */
|
|
73
|
+
readonly ENABLED: true;
|
|
74
|
+
/** Minimum expected tool calls to trigger auto-planning */
|
|
75
|
+
readonly AUTO_PLAN_THRESHOLD: 3;
|
|
76
|
+
/** Maximum phases per plan */
|
|
77
|
+
readonly MAX_PHASES: 10;
|
|
78
|
+
/** Phase timeout in milliseconds (10 minutes) */
|
|
79
|
+
readonly PHASE_TIMEOUT_MS: 600000;
|
|
80
|
+
/** Maximum parallel phases */
|
|
81
|
+
readonly MAX_PARALLEL_PHASES: 5;
|
|
82
|
+
/** Create checkpoints before each phase */
|
|
83
|
+
readonly AUTO_CHECKPOINT: true;
|
|
84
|
+
/** Require plan approval before executing - false for Claude Code-style seamless execution */
|
|
85
|
+
readonly REQUIRE_PLAN_APPROVAL: false;
|
|
86
|
+
/** Require approval for high-risk phases */
|
|
87
|
+
readonly REQUIRE_HIGH_RISK_APPROVAL: true;
|
|
88
|
+
/** Auto-approve low-risk phases - true for Claude Code-style seamless execution */
|
|
89
|
+
readonly AUTO_APPROVE_LOW_RISK: true;
|
|
90
|
+
/** Prune context between phases */
|
|
91
|
+
readonly PRUNE_AFTER_PHASE: true;
|
|
92
|
+
/** Target context percentage after pruning */
|
|
93
|
+
readonly TARGET_CONTEXT_PERCENTAGE: 50;
|
|
94
|
+
/** Plan retention period in days */
|
|
95
|
+
readonly PLAN_RETENTION_DAYS: 30;
|
|
96
|
+
/** Auto-cleanup old plans */
|
|
97
|
+
readonly AUTO_CLEANUP: true;
|
|
98
|
+
/** Silent mode - use TodoWrite instead of explicit phase announcements */
|
|
99
|
+
readonly SILENT_MODE: true;
|
|
100
|
+
/** Show detailed phase info only in verbose mode */
|
|
101
|
+
readonly VERBOSE_PHASES: false;
|
|
102
|
+
};
|
package/dist/constants.js
CHANGED
|
@@ -86,4 +86,37 @@ export const ERROR_MESSAGES = {
|
|
|
86
86
|
FILE_NOT_FOUND: (filePath) => formatMessage(messagesYaml.errors.file_not_found, { filePath }),
|
|
87
87
|
DIRECTORY_NOT_FOUND: (dirPath) => formatMessage(messagesYaml.errors.directory_not_found, { dirPath }),
|
|
88
88
|
};
|
|
89
|
+
// Multi-Phase Task Planner Configuration
|
|
90
|
+
export const PLANNER_CONFIG = {
|
|
91
|
+
/** Enable multi-phase planning */
|
|
92
|
+
ENABLED: true,
|
|
93
|
+
/** Minimum expected tool calls to trigger auto-planning */
|
|
94
|
+
AUTO_PLAN_THRESHOLD: 3,
|
|
95
|
+
/** Maximum phases per plan */
|
|
96
|
+
MAX_PHASES: 10,
|
|
97
|
+
/** Phase timeout in milliseconds (10 minutes) */
|
|
98
|
+
PHASE_TIMEOUT_MS: 600000,
|
|
99
|
+
/** Maximum parallel phases */
|
|
100
|
+
MAX_PARALLEL_PHASES: 5,
|
|
101
|
+
/** Create checkpoints before each phase */
|
|
102
|
+
AUTO_CHECKPOINT: true,
|
|
103
|
+
/** Require plan approval before executing - false for Claude Code-style seamless execution */
|
|
104
|
+
REQUIRE_PLAN_APPROVAL: false,
|
|
105
|
+
/** Require approval for high-risk phases */
|
|
106
|
+
REQUIRE_HIGH_RISK_APPROVAL: true,
|
|
107
|
+
/** Auto-approve low-risk phases - true for Claude Code-style seamless execution */
|
|
108
|
+
AUTO_APPROVE_LOW_RISK: true,
|
|
109
|
+
/** Prune context between phases */
|
|
110
|
+
PRUNE_AFTER_PHASE: true,
|
|
111
|
+
/** Target context percentage after pruning */
|
|
112
|
+
TARGET_CONTEXT_PERCENTAGE: 50,
|
|
113
|
+
/** Plan retention period in days */
|
|
114
|
+
PLAN_RETENTION_DAYS: 30,
|
|
115
|
+
/** Auto-cleanup old plans */
|
|
116
|
+
AUTO_CLEANUP: true,
|
|
117
|
+
/** Silent mode - use TodoWrite instead of explicit phase announcements */
|
|
118
|
+
SILENT_MODE: true,
|
|
119
|
+
/** Show detailed phase info only in verbose mode */
|
|
120
|
+
VERBOSE_PHASES: false,
|
|
121
|
+
};
|
|
89
122
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEnH,sCAAsC;AACtC,MAAM,UAAU,GAAG,gBAAgB,EAAE,CAAC;AACtC,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAC;AAC1C,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAC;AAE1C,sBAAsB;AACtB,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,eAAe,EAAE,YAAY,CAAC,KAAK,CAAC,eAAe;IACnD,eAAe,EAAE,YAAY,CAAC,KAAK,CAAC,eAAe;IACnD,kBAAkB,EAAE,YAAY,CAAC,KAAK,CAAC,kBAAkB;IACzD,qBAAqB,EAAE,YAAY,CAAC,KAAK,CAAC,qBAAqB;IAC/D,wBAAwB,EAAE,YAAY,CAAC,KAAK,CAAC,wBAAwB;IACrE,qBAAqB,EAAE,YAAY,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string) => void;
|
|
31
31
|
onEscape?: () => void;
|
|
32
32
|
onSpecialKey?: (key: Key) => boolean;
|
|
33
|
+
onVerboseToggle?: () => void;
|
|
34
|
+
onQuickActions?: () => void;
|
|
35
|
+
onBackgroundModeToggle?: () => void;
|
|
36
|
+
onCopyLastResponse?: () => void;
|
|
33
37
|
disabled?: boolean;
|
|
34
38
|
multiline?: boolean;
|
|
35
39
|
}
|
|
36
|
-
export declare function useEnhancedInput({ onSubmit, onEscape, onSpecialKey, disabled, multiline, }?: UseEnhancedInputProps): EnhancedInputHook;
|
|
40
|
+
export declare function useEnhancedInput({ onSubmit, onEscape, onSpecialKey, onVerboseToggle, onQuickActions, onBackgroundModeToggle, onCopyLastResponse, disabled, multiline, }?: UseEnhancedInputProps): EnhancedInputHook;
|
|
37
41
|
export {};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { useState, useCallback, useRef } from "react";
|
|
2
|
-
import { deleteCharBefore, deleteCharAfter, deleteWordBefore, deleteWordAfter, insertText, moveToLineStart,
|
|
2
|
+
import { deleteCharBefore, deleteCharAfter, deleteWordBefore, deleteWordAfter, insertText, moveToLineStart, moveToPreviousWord, moveToNextWord, } from "../utils/text-utils.js";
|
|
3
3
|
import { useInputHistory } from "./use-input-history.js";
|
|
4
|
-
export function useEnhancedInput({ onSubmit, onEscape, onSpecialKey, disabled = false, multiline = false, } = {}) {
|
|
4
|
+
export function useEnhancedInput({ onSubmit, onEscape, onSpecialKey, onVerboseToggle, onQuickActions, onBackgroundModeToggle, onCopyLastResponse, disabled = false, multiline = false, } = {}) {
|
|
5
5
|
const [input, setInputState] = useState("");
|
|
6
6
|
const [cursorPosition, setCursorPositionState] = useState(0);
|
|
7
7
|
const isMultilineRef = useRef(multiline);
|
|
8
8
|
const { addToHistory, navigateHistory, resetHistory, setOriginalInput, isNavigatingHistory, } = useInputHistory();
|
|
9
9
|
const setInput = useCallback((text) => {
|
|
10
10
|
setInputState(text);
|
|
11
|
-
|
|
11
|
+
// Use functional update to get the current cursor position, avoiding stale closure
|
|
12
|
+
setCursorPositionState((currentCursor) => Math.min(text.length, currentCursor));
|
|
12
13
|
if (!isNavigatingHistory()) {
|
|
13
14
|
setOriginalInput(text);
|
|
14
15
|
}
|
|
15
|
-
}, [
|
|
16
|
+
}, [isNavigatingHistory, setOriginalInput]);
|
|
16
17
|
const setCursorPosition = useCallback((position) => {
|
|
17
18
|
setCursorPositionState(Math.max(0, Math.min(input.length, position)));
|
|
18
19
|
}, [input.length]);
|
|
@@ -159,12 +160,9 @@ export function useEnhancedInput({ onSubmit, onEscape, onSpecialKey, disabled =
|
|
|
159
160
|
}
|
|
160
161
|
return;
|
|
161
162
|
}
|
|
162
|
-
// Handle Ctrl+K:
|
|
163
|
+
// Handle Ctrl+K: Open quick actions menu
|
|
163
164
|
if (key.ctrl && inputChar === "k") {
|
|
164
|
-
|
|
165
|
-
const newText = input.slice(0, cursorPosition) + input.slice(lineEnd);
|
|
166
|
-
setInputState(newText);
|
|
167
|
-
setOriginalInput(newText);
|
|
165
|
+
onQuickActions?.();
|
|
168
166
|
return;
|
|
169
167
|
}
|
|
170
168
|
// Handle Ctrl+U: Delete from cursor to start of line
|
|
@@ -184,6 +182,21 @@ export function useEnhancedInput({ onSubmit, onEscape, onSpecialKey, disabled =
|
|
|
184
182
|
setOriginalInput(result.text);
|
|
185
183
|
return;
|
|
186
184
|
}
|
|
185
|
+
// Handle Ctrl+O: Toggle verbose mode
|
|
186
|
+
if (key.ctrl && inputChar === "o") {
|
|
187
|
+
onVerboseToggle?.();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
// Handle Ctrl+B: Toggle background mode
|
|
191
|
+
if (key.ctrl && inputChar === "b") {
|
|
192
|
+
onBackgroundModeToggle?.();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
// Handle Ctrl+Y: Copy last response to clipboard
|
|
196
|
+
if (key.ctrl && inputChar === "y") {
|
|
197
|
+
onCopyLastResponse?.();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
187
200
|
// Handle Ctrl+X: Clear entire input
|
|
188
201
|
if (key.ctrl && inputChar === "x") {
|
|
189
202
|
setInputState("");
|
|
@@ -198,7 +211,7 @@ export function useEnhancedInput({ onSubmit, onEscape, onSpecialKey, disabled =
|
|
|
198
211
|
setCursorPositionState(result.position);
|
|
199
212
|
setOriginalInput(result.text);
|
|
200
213
|
}
|
|
201
|
-
}, [disabled, onSpecialKey, input, cursorPosition, multiline, handleSubmit, navigateHistory, setOriginalInput]);
|
|
214
|
+
}, [disabled, onSpecialKey, onVerboseToggle, onQuickActions, onBackgroundModeToggle, onCopyLastResponse, input, cursorPosition, multiline, handleSubmit, navigateHistory, setOriginalInput]);
|
|
202
215
|
return {
|
|
203
216
|
input,
|
|
204
217
|
cursorPosition,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-enhanced-input.js","sourceRoot":"","sources":["../../src/hooks/use-enhanced-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,eAAe,EACf,
|
|
1
|
+
{"version":3,"file":"use-enhanced-input.js","sourceRoot":"","sources":["../../src/hooks/use-enhanced-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AA4CzD,MAAM,UAAU,gBAAgB,CAAC,EAC/B,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,cAAc,EACd,sBAAsB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,CAAC;YACxC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE7L,OAAO;QACL,KAAK;QACL,cAAc;QACd,WAAW,EAAE,cAAc,CAAC,OAAO;QACnC,QAAQ;QACR,iBAAiB;QACjB,UAAU;QACV,cAAc;QACd,YAAY;QACZ,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -11,6 +11,14 @@ interface UseInputHandlerProps {
|
|
|
11
11
|
isProcessing: boolean;
|
|
12
12
|
isStreaming: boolean;
|
|
13
13
|
isConfirmationActive?: boolean;
|
|
14
|
+
onQuickActionsToggle?: () => void;
|
|
15
|
+
onVerboseModeChange?: (enabled: boolean) => void;
|
|
16
|
+
onBackgroundModeChange?: (enabled: boolean) => void;
|
|
17
|
+
onAutoEditModeChange?: (enabled: boolean) => void;
|
|
18
|
+
onTaskMovedToBackground?: (taskId: string) => void;
|
|
19
|
+
onOperationInterrupted?: () => void;
|
|
20
|
+
onChatCleared?: () => void;
|
|
21
|
+
onCopyLastResponse?: () => void;
|
|
14
22
|
}
|
|
15
23
|
interface CommandSuggestion {
|
|
16
24
|
command: string;
|
|
@@ -19,7 +27,7 @@ interface CommandSuggestion {
|
|
|
19
27
|
interface ModelOption {
|
|
20
28
|
model: string;
|
|
21
29
|
}
|
|
22
|
-
export declare function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsStreaming, setTokenCount, setProcessingTime, processingStartTime, isProcessing, isStreaming, isConfirmationActive, }: UseInputHandlerProps): {
|
|
30
|
+
export declare function useInputHandler({ agent, chatHistory, setChatHistory, setIsProcessing, setIsStreaming, setTokenCount, setProcessingTime, processingStartTime, isProcessing, isStreaming, isConfirmationActive, onQuickActionsToggle, onVerboseModeChange, onBackgroundModeChange, onAutoEditModeChange, onTaskMovedToBackground, onOperationInterrupted, onChatCleared, onCopyLastResponse, }: UseInputHandlerProps): {
|
|
23
31
|
input: string;
|
|
24
32
|
cursorPosition: number;
|
|
25
33
|
showCommandSuggestions: boolean;
|
|
@@ -28,5 +36,7 @@ export declare function useInputHandler({ agent, setChatHistory, setIsProcessing
|
|
|
28
36
|
availableModels: ModelOption[];
|
|
29
37
|
agent: LLMAgent;
|
|
30
38
|
autoEditEnabled: boolean;
|
|
39
|
+
verboseMode: boolean;
|
|
40
|
+
backgroundMode: boolean;
|
|
31
41
|
};
|
|
32
42
|
export {};
|
|
@@ -9,9 +9,12 @@ import { InstructionGenerator } from "../utils/instruction-generator.js";
|
|
|
9
9
|
import { getUsageTracker } from "../utils/usage-tracker.js";
|
|
10
10
|
import { getHistoryManager } from "../utils/history-manager.js";
|
|
11
11
|
import { handleRewindCommand, handleCheckpointsCommand, handleCheckpointCleanCommand } from "../commands/rewind.js";
|
|
12
|
+
import { handlePlansCommand, handlePlanCommand, handlePhasesCommand, handlePauseCommand, handleResumeCommand, handleSkipPhaseCommand, handleAbandonCommand, handleResumableCommand, } from "../commands/plan.js";
|
|
13
|
+
import { BashOutputTool } from "../tools/bash-output.js";
|
|
14
|
+
import { getKeyboardShortcutGuideText } from "../ui/components/keyboard-hints.js";
|
|
12
15
|
import * as fs from "fs";
|
|
13
16
|
import * as path from "path";
|
|
14
|
-
export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsStreaming, setTokenCount, setProcessingTime, processingStartTime, isProcessing, isStreaming, isConfirmationActive = false, }) {
|
|
17
|
+
export function useInputHandler({ agent, chatHistory, setChatHistory, setIsProcessing, setIsStreaming, setTokenCount, setProcessingTime, processingStartTime, isProcessing, isStreaming, isConfirmationActive = false, onQuickActionsToggle, onVerboseModeChange, onBackgroundModeChange, onAutoEditModeChange, onTaskMovedToBackground, onOperationInterrupted, onChatCleared, onCopyLastResponse, }) {
|
|
15
18
|
const [showCommandSuggestions, setShowCommandSuggestions] = useState(false);
|
|
16
19
|
const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);
|
|
17
20
|
const [autoEditEnabled, setAutoEditEnabled] = useState(() => {
|
|
@@ -19,6 +22,8 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
19
22
|
const sessionFlags = confirmationService.getSessionFlags();
|
|
20
23
|
return sessionFlags.allOperations;
|
|
21
24
|
});
|
|
25
|
+
const [verboseMode, setVerboseMode] = useState(false);
|
|
26
|
+
const [backgroundMode, setBackgroundMode] = useState(false);
|
|
22
27
|
const handleSpecialKey = (key) => {
|
|
23
28
|
// Don't handle input if confirmation dialog is active
|
|
24
29
|
if (isConfirmationActive) {
|
|
@@ -37,6 +42,8 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
37
42
|
// Disable auto-edit: reset session flags
|
|
38
43
|
confirmationService.resetSession();
|
|
39
44
|
}
|
|
45
|
+
// Notify parent for toast/flash feedback
|
|
46
|
+
onAutoEditModeChange?.(newAutoEditState);
|
|
40
47
|
return true; // Handled
|
|
41
48
|
}
|
|
42
49
|
// Handle escape key for closing menus
|
|
@@ -53,6 +60,8 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
53
60
|
setTokenCount(0);
|
|
54
61
|
setProcessingTime(0);
|
|
55
62
|
processingStartTime.current = 0;
|
|
63
|
+
// Notify parent for toast feedback
|
|
64
|
+
onOperationInterrupted?.();
|
|
56
65
|
return true;
|
|
57
66
|
}
|
|
58
67
|
return false; // Let default escape handling work
|
|
@@ -115,9 +124,39 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
115
124
|
setSelectedCommandIndex(0);
|
|
116
125
|
}
|
|
117
126
|
}, []);
|
|
127
|
+
const handleVerboseToggle = useCallback(() => {
|
|
128
|
+
setVerboseMode((prev) => {
|
|
129
|
+
const newState = !prev;
|
|
130
|
+
// Notify parent for toast/flash feedback instead of polluting chat history
|
|
131
|
+
onVerboseModeChange?.(newState);
|
|
132
|
+
return newState;
|
|
133
|
+
});
|
|
134
|
+
}, [onVerboseModeChange]);
|
|
135
|
+
const handleBackgroundModeToggle = useCallback(() => {
|
|
136
|
+
// Check if a bash command is currently executing
|
|
137
|
+
if (agent.isBashExecuting()) {
|
|
138
|
+
const taskId = agent.moveBashToBackground();
|
|
139
|
+
if (taskId) {
|
|
140
|
+
// Notify parent for toast feedback
|
|
141
|
+
onTaskMovedToBackground?.(taskId);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Otherwise toggle background mode preference
|
|
146
|
+
setBackgroundMode((prev) => {
|
|
147
|
+
const newState = !prev;
|
|
148
|
+
// Notify parent for toast/flash feedback instead of polluting chat history
|
|
149
|
+
onBackgroundModeChange?.(newState);
|
|
150
|
+
return newState;
|
|
151
|
+
});
|
|
152
|
+
}, [agent, onBackgroundModeChange, onTaskMovedToBackground]);
|
|
118
153
|
const { input, cursorPosition, setInput, setCursorPosition, clearInput, resetHistory, handleInput, } = useEnhancedInput({
|
|
119
154
|
onSubmit: handleInputSubmit,
|
|
120
155
|
onSpecialKey: handleSpecialKey,
|
|
156
|
+
onVerboseToggle: handleVerboseToggle,
|
|
157
|
+
onQuickActions: onQuickActionsToggle,
|
|
158
|
+
onBackgroundModeToggle: handleBackgroundModeToggle,
|
|
159
|
+
onCopyLastResponse,
|
|
121
160
|
disabled: isConfirmationActive,
|
|
122
161
|
});
|
|
123
162
|
// Hook up the actual input handling
|
|
@@ -130,14 +169,26 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
130
169
|
}, [input, handleInputChange]);
|
|
131
170
|
const commandSuggestions = [
|
|
132
171
|
{ command: "/help", description: "Show help information" },
|
|
172
|
+
{ command: "/shortcuts", description: "Show keyboard shortcuts guide" },
|
|
133
173
|
{ command: "/continue", description: "Continue incomplete response" },
|
|
174
|
+
{ command: "/retry", description: "Re-send the last message" },
|
|
134
175
|
{ command: "/clear", description: "Clear chat history" },
|
|
135
176
|
{ command: "/init", description: "Initialize project with smart analysis" },
|
|
136
177
|
{ command: "/usage", description: "Show API usage statistics" },
|
|
178
|
+
{ command: "/tasks", description: "List background tasks" },
|
|
179
|
+
{ command: "/task", description: "View output of a background task" },
|
|
180
|
+
{ command: "/kill", description: "Kill a background task" },
|
|
137
181
|
{ command: "/rewind", description: "Rewind to previous checkpoint" },
|
|
138
182
|
{ command: "/checkpoints", description: "List checkpoint statistics" },
|
|
139
183
|
{ command: "/checkpoint-clean", description: "Clean old checkpoints" },
|
|
140
184
|
{ command: "/commit-and-push", description: "AI commit & push to remote" },
|
|
185
|
+
{ command: "/plans", description: "List all task plans" },
|
|
186
|
+
{ command: "/plan", description: "Show current plan details" },
|
|
187
|
+
{ command: "/phases", description: "Show phases of current plan" },
|
|
188
|
+
{ command: "/pause", description: "Pause current plan execution" },
|
|
189
|
+
{ command: "/resume", description: "Resume paused plan" },
|
|
190
|
+
{ command: "/skip", description: "Skip current phase" },
|
|
191
|
+
{ command: "/abandon", description: "Abandon current plan" },
|
|
141
192
|
{ command: "/exit", description: "Exit the application" },
|
|
142
193
|
];
|
|
143
194
|
// Load models from configuration with fallback to defaults
|
|
@@ -267,7 +318,11 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
267
318
|
break;
|
|
268
319
|
case "done":
|
|
269
320
|
if (streamingEntry) {
|
|
270
|
-
|
|
321
|
+
// Calculate response duration
|
|
322
|
+
const durationMs = processingStartTime.current > 0
|
|
323
|
+
? Date.now() - processingStartTime.current
|
|
324
|
+
: undefined;
|
|
325
|
+
setChatHistory((prev) => prev.map((entry) => entry.isStreaming ? { ...entry, isStreaming: false, durationMs } : entry));
|
|
271
326
|
}
|
|
272
327
|
setIsStreaming(false);
|
|
273
328
|
break;
|
|
@@ -298,6 +353,33 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
298
353
|
resetHistory();
|
|
299
354
|
return true;
|
|
300
355
|
}
|
|
356
|
+
if (trimmedInput === "/retry") {
|
|
357
|
+
// Find the last user message and re-send it
|
|
358
|
+
const lastUserEntry = [...chatHistory].reverse().find(entry => entry.type === "user");
|
|
359
|
+
if (lastUserEntry && lastUserEntry.content) {
|
|
360
|
+
// Store the message content and history state before clearing
|
|
361
|
+
const messageToRetry = lastUserEntry.content;
|
|
362
|
+
const lastUserIndex = chatHistory.lastIndexOf(lastUserEntry);
|
|
363
|
+
const historyBackup = [...chatHistory];
|
|
364
|
+
// Remove the last user message and any assistant responses after it
|
|
365
|
+
setChatHistory(prev => prev.slice(0, lastUserIndex));
|
|
366
|
+
clearInput();
|
|
367
|
+
// Trigger submit after a brief delay to allow state update
|
|
368
|
+
setTimeout(() => {
|
|
369
|
+
try {
|
|
370
|
+
handleInputSubmit(messageToRetry);
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
// Restore history if retry fails
|
|
374
|
+
setChatHistory(historyBackup);
|
|
375
|
+
}
|
|
376
|
+
}, 50);
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
clearInput();
|
|
380
|
+
}
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
301
383
|
if (trimmedInput === "/clear") {
|
|
302
384
|
// Reset chat history
|
|
303
385
|
setChatHistory([]);
|
|
@@ -313,6 +395,8 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
313
395
|
// Reset confirmation service session flags
|
|
314
396
|
const confirmationService = ConfirmationService.getInstance();
|
|
315
397
|
confirmationService.resetSession();
|
|
398
|
+
// Notify parent for toast feedback
|
|
399
|
+
onChatCleared?.();
|
|
316
400
|
clearInput();
|
|
317
401
|
resetHistory();
|
|
318
402
|
return true;
|
|
@@ -420,27 +504,49 @@ Built-in Commands:
|
|
|
420
504
|
/clear - Clear chat history
|
|
421
505
|
/init - Initialize project with smart analysis
|
|
422
506
|
/help - Show this help
|
|
507
|
+
/shortcuts - Show keyboard shortcuts guide
|
|
423
508
|
/usage - Show API usage statistics
|
|
424
509
|
/exit - Exit application
|
|
425
510
|
exit, quit - Exit application
|
|
426
511
|
|
|
512
|
+
Background Task Commands:
|
|
513
|
+
/tasks - List all background tasks
|
|
514
|
+
/task <id> - View output of a background task
|
|
515
|
+
/kill <id> - Kill a running background task
|
|
516
|
+
|
|
517
|
+
Tip: Append ' &' to any bash command to run it in background
|
|
518
|
+
Example: npm run dev &
|
|
519
|
+
|
|
427
520
|
Checkpoint Commands:
|
|
428
521
|
/rewind - Rewind to a previous checkpoint (interactive)
|
|
429
522
|
/checkpoints - Show checkpoint statistics
|
|
430
523
|
/checkpoint-clean - Clean old checkpoints (compress and prune)
|
|
431
524
|
|
|
525
|
+
Plan Commands (Multi-Phase Task Planning):
|
|
526
|
+
/plans - List all task plans
|
|
527
|
+
/plan [id] - Show current or specific plan details
|
|
528
|
+
/phases - Show phases of current plan
|
|
529
|
+
/pause - Pause current plan execution
|
|
530
|
+
/resume [id] - Resume current or specific plan
|
|
531
|
+
/skip - Skip current phase
|
|
532
|
+
/abandon - Abandon current plan
|
|
533
|
+
|
|
432
534
|
Git Commands:
|
|
433
535
|
/commit-and-push - AI-generated commit + push to remote
|
|
434
536
|
|
|
435
537
|
Enhanced Input Features:
|
|
436
538
|
↑/↓ Arrow - Navigate command history
|
|
437
539
|
Ctrl+C - Clear input (press twice to exit)
|
|
540
|
+
Ctrl+X - Clear entire input line
|
|
438
541
|
Ctrl+←/→ - Move by word
|
|
439
542
|
Ctrl+A/E - Move to line start/end
|
|
440
543
|
Ctrl+W - Delete word before cursor
|
|
441
544
|
Ctrl+K - Delete to end of line
|
|
442
545
|
Ctrl+U - Delete to start of line
|
|
546
|
+
Ctrl+O - Toggle verbose mode (show full output, default: concise)
|
|
547
|
+
Ctrl+B - Toggle background mode (run all commands in background)
|
|
443
548
|
Shift+Tab - Toggle auto-edit mode (bypass confirmations)
|
|
549
|
+
1-4 keys - Quick select in confirmation dialogs
|
|
444
550
|
|
|
445
551
|
Direct Commands (executed immediately):
|
|
446
552
|
ls [path] - List directory contents
|
|
@@ -464,6 +570,16 @@ Examples:
|
|
|
464
570
|
clearInput();
|
|
465
571
|
return true;
|
|
466
572
|
}
|
|
573
|
+
if (trimmedInput === "/shortcuts") {
|
|
574
|
+
const shortcutsEntry = {
|
|
575
|
+
type: "assistant",
|
|
576
|
+
content: getKeyboardShortcutGuideText(),
|
|
577
|
+
timestamp: new Date(),
|
|
578
|
+
};
|
|
579
|
+
setChatHistory((prev) => [...prev, shortcutsEntry]);
|
|
580
|
+
clearInput();
|
|
581
|
+
return true;
|
|
582
|
+
}
|
|
467
583
|
if (trimmedInput === "/usage") {
|
|
468
584
|
const tracker = getUsageTracker();
|
|
469
585
|
const stats = tracker.getSessionStats();
|
|
@@ -525,6 +641,65 @@ Examples:
|
|
|
525
641
|
process.exit(0);
|
|
526
642
|
return true;
|
|
527
643
|
}
|
|
644
|
+
// Background task commands
|
|
645
|
+
if (trimmedInput === "/tasks") {
|
|
646
|
+
const bashOutputTool = new BashOutputTool();
|
|
647
|
+
const result = bashOutputTool.listTasks();
|
|
648
|
+
const tasksEntry = {
|
|
649
|
+
type: "assistant",
|
|
650
|
+
content: result.output || "No background tasks",
|
|
651
|
+
timestamp: new Date(),
|
|
652
|
+
};
|
|
653
|
+
setChatHistory((prev) => [...prev, tasksEntry]);
|
|
654
|
+
clearInput();
|
|
655
|
+
return true;
|
|
656
|
+
}
|
|
657
|
+
if (trimmedInput.startsWith("/task ")) {
|
|
658
|
+
const taskId = trimmedInput.substring(6).trim();
|
|
659
|
+
if (!taskId) {
|
|
660
|
+
const errorEntry = {
|
|
661
|
+
type: "assistant",
|
|
662
|
+
content: "Usage: /task <task_id>",
|
|
663
|
+
timestamp: new Date(),
|
|
664
|
+
};
|
|
665
|
+
setChatHistory((prev) => [...prev, errorEntry]);
|
|
666
|
+
clearInput();
|
|
667
|
+
return true;
|
|
668
|
+
}
|
|
669
|
+
const bashOutputTool = new BashOutputTool();
|
|
670
|
+
const result = await bashOutputTool.execute(taskId);
|
|
671
|
+
const taskEntry = {
|
|
672
|
+
type: "assistant",
|
|
673
|
+
content: result.success ? result.output || "No output" : result.error || "Task not found",
|
|
674
|
+
timestamp: new Date(),
|
|
675
|
+
};
|
|
676
|
+
setChatHistory((prev) => [...prev, taskEntry]);
|
|
677
|
+
clearInput();
|
|
678
|
+
return true;
|
|
679
|
+
}
|
|
680
|
+
if (trimmedInput.startsWith("/kill ")) {
|
|
681
|
+
const taskId = trimmedInput.substring(6).trim();
|
|
682
|
+
if (!taskId) {
|
|
683
|
+
const errorEntry = {
|
|
684
|
+
type: "assistant",
|
|
685
|
+
content: "Usage: /kill <task_id>",
|
|
686
|
+
timestamp: new Date(),
|
|
687
|
+
};
|
|
688
|
+
setChatHistory((prev) => [...prev, errorEntry]);
|
|
689
|
+
clearInput();
|
|
690
|
+
return true;
|
|
691
|
+
}
|
|
692
|
+
const bashOutputTool = new BashOutputTool();
|
|
693
|
+
const result = bashOutputTool.killTask(taskId);
|
|
694
|
+
const killEntry = {
|
|
695
|
+
type: "assistant",
|
|
696
|
+
content: result.success ? result.output || "Task killed" : result.error || "Failed to kill task",
|
|
697
|
+
timestamp: new Date(),
|
|
698
|
+
};
|
|
699
|
+
setChatHistory((prev) => [...prev, killEntry]);
|
|
700
|
+
clearInput();
|
|
701
|
+
return true;
|
|
702
|
+
}
|
|
528
703
|
if (trimmedInput === "/rewind") {
|
|
529
704
|
await handleRewindCommand(agent);
|
|
530
705
|
clearInput();
|
|
@@ -540,6 +715,97 @@ Examples:
|
|
|
540
715
|
clearInput();
|
|
541
716
|
return true;
|
|
542
717
|
}
|
|
718
|
+
// Plan commands
|
|
719
|
+
if (trimmedInput === "/plans") {
|
|
720
|
+
const result = await handlePlansCommand();
|
|
721
|
+
const plansEntry = {
|
|
722
|
+
type: "assistant",
|
|
723
|
+
content: result.output,
|
|
724
|
+
timestamp: new Date(),
|
|
725
|
+
};
|
|
726
|
+
setChatHistory((prev) => [...prev, plansEntry]);
|
|
727
|
+
clearInput();
|
|
728
|
+
return true;
|
|
729
|
+
}
|
|
730
|
+
if (trimmedInput === "/plan" || trimmedInput.startsWith("/plan ")) {
|
|
731
|
+
const planId = trimmedInput === "/plan" ? undefined : trimmedInput.substring(6).trim();
|
|
732
|
+
const result = await handlePlanCommand(planId || undefined);
|
|
733
|
+
const planEntry = {
|
|
734
|
+
type: "assistant",
|
|
735
|
+
content: result.output,
|
|
736
|
+
timestamp: new Date(),
|
|
737
|
+
};
|
|
738
|
+
setChatHistory((prev) => [...prev, planEntry]);
|
|
739
|
+
clearInput();
|
|
740
|
+
return true;
|
|
741
|
+
}
|
|
742
|
+
if (trimmedInput === "/phases") {
|
|
743
|
+
const result = await handlePhasesCommand();
|
|
744
|
+
const phasesEntry = {
|
|
745
|
+
type: "assistant",
|
|
746
|
+
content: result.output,
|
|
747
|
+
timestamp: new Date(),
|
|
748
|
+
};
|
|
749
|
+
setChatHistory((prev) => [...prev, phasesEntry]);
|
|
750
|
+
clearInput();
|
|
751
|
+
return true;
|
|
752
|
+
}
|
|
753
|
+
if (trimmedInput === "/pause") {
|
|
754
|
+
const result = await handlePauseCommand();
|
|
755
|
+
const pauseEntry = {
|
|
756
|
+
type: "assistant",
|
|
757
|
+
content: result.output,
|
|
758
|
+
timestamp: new Date(),
|
|
759
|
+
};
|
|
760
|
+
setChatHistory((prev) => [...prev, pauseEntry]);
|
|
761
|
+
clearInput();
|
|
762
|
+
return true;
|
|
763
|
+
}
|
|
764
|
+
if (trimmedInput === "/resume" || trimmedInput.startsWith("/resume ")) {
|
|
765
|
+
const planId = trimmedInput === "/resume" ? undefined : trimmedInput.substring(8).trim();
|
|
766
|
+
const result = await handleResumeCommand(planId || undefined);
|
|
767
|
+
const resumeEntry = {
|
|
768
|
+
type: "assistant",
|
|
769
|
+
content: result.output,
|
|
770
|
+
timestamp: new Date(),
|
|
771
|
+
};
|
|
772
|
+
setChatHistory((prev) => [...prev, resumeEntry]);
|
|
773
|
+
clearInput();
|
|
774
|
+
return true;
|
|
775
|
+
}
|
|
776
|
+
if (trimmedInput === "/skip") {
|
|
777
|
+
const result = await handleSkipPhaseCommand();
|
|
778
|
+
const skipEntry = {
|
|
779
|
+
type: "assistant",
|
|
780
|
+
content: result.output,
|
|
781
|
+
timestamp: new Date(),
|
|
782
|
+
};
|
|
783
|
+
setChatHistory((prev) => [...prev, skipEntry]);
|
|
784
|
+
clearInput();
|
|
785
|
+
return true;
|
|
786
|
+
}
|
|
787
|
+
if (trimmedInput === "/abandon") {
|
|
788
|
+
const result = await handleAbandonCommand();
|
|
789
|
+
const abandonEntry = {
|
|
790
|
+
type: "assistant",
|
|
791
|
+
content: result.output,
|
|
792
|
+
timestamp: new Date(),
|
|
793
|
+
};
|
|
794
|
+
setChatHistory((prev) => [...prev, abandonEntry]);
|
|
795
|
+
clearInput();
|
|
796
|
+
return true;
|
|
797
|
+
}
|
|
798
|
+
if (trimmedInput === "/resumable") {
|
|
799
|
+
const result = await handleResumableCommand();
|
|
800
|
+
const resumableEntry = {
|
|
801
|
+
type: "assistant",
|
|
802
|
+
content: result.output,
|
|
803
|
+
timestamp: new Date(),
|
|
804
|
+
};
|
|
805
|
+
setChatHistory((prev) => [...prev, resumableEntry]);
|
|
806
|
+
clearInput();
|
|
807
|
+
return true;
|
|
808
|
+
}
|
|
543
809
|
if (trimmedInput === "/commit-and-push") {
|
|
544
810
|
const userEntry = {
|
|
545
811
|
type: "user",
|
|
@@ -880,6 +1146,8 @@ Respond with ONLY the commit message, no additional text.`;
|
|
|
880
1146
|
availableModels,
|
|
881
1147
|
agent,
|
|
882
1148
|
autoEditEnabled,
|
|
1149
|
+
verboseMode,
|
|
1150
|
+
backgroundMode,
|
|
883
1151
|
};
|
|
884
1152
|
}
|
|
885
1153
|
//# sourceMappingURL=use-input-handler.js.map
|