@defai.digital/ax-cli 2.7.0 → 3.0.0
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/.ax-cli/checkpoints/2025-11-20/checkpoint-2dd84869-e62d-46c8-9885-7e45f37f36e2.json +69 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-484dc350-353f-4808-9ed1-ebb3cefdab37.json +24 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-74a18b87-6172-4215-962b-44bb9f46a662.json +69 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-870a5fb9-6e82-4ff2-8ec8-af4c251cc514.json +44 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-93946601-0e83-456c-ba47-def9713124dd.json +24 -0
- package/.ax-cli/checkpoints/metadata.json +62 -0
- package/README.md +87 -11
- package/dist/agent/context-manager.d.ts +2 -2
- package/dist/agent/context-manager.js +37 -15
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/dependency-resolver.d.ts +83 -0
- package/dist/agent/dependency-resolver.js +310 -0
- package/dist/agent/dependency-resolver.js.map +1 -0
- package/dist/agent/llm-agent.d.ts +111 -0
- package/dist/agent/llm-agent.js +625 -3
- package/dist/agent/llm-agent.js.map +1 -1
- package/dist/agent/specialized/analysis-agent.d.ts +11 -0
- package/dist/agent/specialized/analysis-agent.js +33 -0
- package/dist/agent/specialized/analysis-agent.js.map +1 -0
- package/dist/agent/specialized/debug-agent.d.ts +11 -0
- package/dist/agent/specialized/debug-agent.js +33 -0
- package/dist/agent/specialized/debug-agent.js.map +1 -0
- package/dist/agent/specialized/documentation-agent.d.ts +11 -0
- package/dist/agent/specialized/documentation-agent.js +33 -0
- package/dist/agent/specialized/documentation-agent.js.map +1 -0
- package/dist/agent/specialized/index.d.ts +11 -0
- package/dist/agent/specialized/index.js +12 -0
- package/dist/agent/specialized/index.js.map +1 -0
- package/dist/agent/specialized/performance-agent.d.ts +11 -0
- package/dist/agent/specialized/performance-agent.js +33 -0
- package/dist/agent/specialized/performance-agent.js.map +1 -0
- package/dist/agent/specialized/refactoring-agent.d.ts +11 -0
- package/dist/agent/specialized/refactoring-agent.js +33 -0
- package/dist/agent/specialized/refactoring-agent.js.map +1 -0
- package/dist/agent/specialized/testing-agent.d.ts +11 -0
- package/dist/agent/specialized/testing-agent.js +33 -0
- package/dist/agent/specialized/testing-agent.js.map +1 -0
- package/dist/agent/subagent-orchestrator.d.ts +128 -0
- package/dist/agent/subagent-orchestrator.js +388 -0
- package/dist/agent/subagent-orchestrator.js.map +1 -0
- package/dist/agent/subagent-types.d.ts +262 -0
- package/dist/agent/subagent-types.js +152 -0
- package/dist/agent/subagent-types.js.map +1 -0
- package/dist/agent/subagent.d.ts +88 -0
- package/dist/agent/subagent.js +426 -0
- package/dist/agent/subagent.js.map +1 -0
- package/dist/checkpoint/index.d.ts +9 -0
- package/dist/checkpoint/index.js +11 -0
- package/dist/checkpoint/index.js.map +1 -0
- package/dist/checkpoint/manager.d.ts +99 -0
- package/dist/checkpoint/manager.js +281 -0
- package/dist/checkpoint/manager.js.map +1 -0
- package/dist/checkpoint/storage.d.ts +31 -0
- package/dist/checkpoint/storage.js +265 -0
- package/dist/checkpoint/storage.js.map +1 -0
- package/dist/checkpoint/types.d.ts +111 -0
- package/dist/checkpoint/types.js +17 -0
- package/dist/checkpoint/types.js.map +1 -0
- 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/commands/rewind.d.ts +19 -0
- package/dist/commands/rewind.js +221 -0
- package/dist/commands/rewind.js.map +1 -0
- package/dist/constants.d.ts +28 -0
- package/dist/constants.js +29 -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 +294 -2
- package/dist/hooks/use-input-handler.js.map +1 -1
- package/dist/llm/client.js +2 -1
- package/dist/llm/client.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.d.ts +1 -0
- package/dist/mcp/client.js +30 -8
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/transports.d.ts +0 -1
- package/dist/mcp/transports.js +10 -7
- package/dist/mcp/transports.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 +325 -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 +493 -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/api-schemas.js +4 -0
- package/dist/schemas/api-schemas.js.map +1 -1
- 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/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 -42
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/search.js +34 -9
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/text-editor.d.ts +16 -0
- package/dist/tools/text-editor.js +37 -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 +154 -45
- 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 +122 -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/subagent-monitor.d.ts +29 -0
- package/dist/ui/components/subagent-monitor.js +150 -0
- package/dist/ui/components/subagent-monitor.js.map +1 -0
- package/dist/ui/components/toast-notification.d.ts +123 -0
- package/dist/ui/components/toast-notification.js +143 -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 +1 -0
- package/dist/utils/history-manager.js +40 -5
- package/dist/utils/history-manager.js.map +1 -1
- package/dist/utils/json-utils.d.ts +7 -0
- package/dist/utils/json-utils.js +70 -2
- package/dist/utils/json-utils.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/dist/utils/settings-manager.js +12 -10
- package/dist/utils/settings-manager.js.map +1 -1
- package/dist/utils/text-utils.js +3 -3
- package/dist/utils/text-utils.js.map +1 -1
- package/dist/utils/token-counter.d.ts +5 -0
- package/dist/utils/token-counter.js +18 -3
- package/dist/utils/token-counter.js.map +1 -1
- package/package.json +3 -1
package/dist/constants.d.ts
CHANGED
|
@@ -68,3 +68,31 @@ 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 */
|
|
85
|
+
readonly REQUIRE_PLAN_APPROVAL: true;
|
|
86
|
+
/** Require approval for high-risk phases */
|
|
87
|
+
readonly REQUIRE_HIGH_RISK_APPROVAL: true;
|
|
88
|
+
/** Auto-approve low-risk phases */
|
|
89
|
+
readonly AUTO_APPROVE_LOW_RISK: false;
|
|
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
|
+
};
|
package/dist/constants.js
CHANGED
|
@@ -86,4 +86,33 @@ 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 */
|
|
104
|
+
REQUIRE_PLAN_APPROVAL: true,
|
|
105
|
+
/** Require approval for high-risk phases */
|
|
106
|
+
REQUIRE_HIGH_RISK_APPROVAL: true,
|
|
107
|
+
/** Auto-approve low-risk phases */
|
|
108
|
+
AUTO_APPROVE_LOW_RISK: false,
|
|
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
|
+
};
|
|
89
118
|
//# 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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B,6CAA6C;IAC7C,qBAAqB,EAAE,IAAI;IAE3B,4CAA4C;IAC5C,0BAA0B,EAAE,IAAI;IAEhC,mCAAmC;IACnC,qBAAqB,EAAE,KAAK;IAE5B,mCAAmC;IACnC,iBAAiB,EAAE,IAAI;IAEvB,8CAA8C;IAC9C,yBAAyB,EAAE,EAAE;IAE7B,oCAAoC;IACpC,mBAAmB,EAAE,EAAE;IAEvB,6BAA6B;IAC7B,YAAY,EAAE,IAAI;CACV,CAAC"}
|
|
@@ -30,8 +30,12 @@ interface UseEnhancedInputProps {
|
|
|
30
30
|
onSubmit?: (text: 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":[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B,sBAAsB,CAAC,CAAC,CAAC,CAAC;YAC1B,gBAAgB,CAAC,EAAE,CAAC,CAAC;YACrB,OAAO;QACT,CAAC;QAED,iCAAiC;QACjC,IAAI,SAAS,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACxC,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,SAAS,CAAC,CAAC;YAC5D,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3B,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,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 {};
|
|
@@ -8,9 +8,13 @@ import { ProjectAnalyzer } from "../utils/project-analyzer.js";
|
|
|
8
8
|
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
|
+
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";
|
|
11
15
|
import * as fs from "fs";
|
|
12
16
|
import * as path from "path";
|
|
13
|
-
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, }) {
|
|
14
18
|
const [showCommandSuggestions, setShowCommandSuggestions] = useState(false);
|
|
15
19
|
const [selectedCommandIndex, setSelectedCommandIndex] = useState(0);
|
|
16
20
|
const [autoEditEnabled, setAutoEditEnabled] = useState(() => {
|
|
@@ -18,6 +22,8 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
18
22
|
const sessionFlags = confirmationService.getSessionFlags();
|
|
19
23
|
return sessionFlags.allOperations;
|
|
20
24
|
});
|
|
25
|
+
const [verboseMode, setVerboseMode] = useState(false);
|
|
26
|
+
const [backgroundMode, setBackgroundMode] = useState(false);
|
|
21
27
|
const handleSpecialKey = (key) => {
|
|
22
28
|
// Don't handle input if confirmation dialog is active
|
|
23
29
|
if (isConfirmationActive) {
|
|
@@ -36,6 +42,8 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
36
42
|
// Disable auto-edit: reset session flags
|
|
37
43
|
confirmationService.resetSession();
|
|
38
44
|
}
|
|
45
|
+
// Notify parent for toast/flash feedback
|
|
46
|
+
onAutoEditModeChange?.(newAutoEditState);
|
|
39
47
|
return true; // Handled
|
|
40
48
|
}
|
|
41
49
|
// Handle escape key for closing menus
|
|
@@ -52,6 +60,8 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
52
60
|
setTokenCount(0);
|
|
53
61
|
setProcessingTime(0);
|
|
54
62
|
processingStartTime.current = 0;
|
|
63
|
+
// Notify parent for toast feedback
|
|
64
|
+
onOperationInterrupted?.();
|
|
55
65
|
return true;
|
|
56
66
|
}
|
|
57
67
|
return false; // Let default escape handling work
|
|
@@ -114,9 +124,39 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
114
124
|
setSelectedCommandIndex(0);
|
|
115
125
|
}
|
|
116
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]);
|
|
117
153
|
const { input, cursorPosition, setInput, setCursorPosition, clearInput, resetHistory, handleInput, } = useEnhancedInput({
|
|
118
154
|
onSubmit: handleInputSubmit,
|
|
119
155
|
onSpecialKey: handleSpecialKey,
|
|
156
|
+
onVerboseToggle: handleVerboseToggle,
|
|
157
|
+
onQuickActions: onQuickActionsToggle,
|
|
158
|
+
onBackgroundModeToggle: handleBackgroundModeToggle,
|
|
159
|
+
onCopyLastResponse,
|
|
120
160
|
disabled: isConfirmationActive,
|
|
121
161
|
});
|
|
122
162
|
// Hook up the actual input handling
|
|
@@ -129,11 +169,26 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
129
169
|
}, [input, handleInputChange]);
|
|
130
170
|
const commandSuggestions = [
|
|
131
171
|
{ command: "/help", description: "Show help information" },
|
|
172
|
+
{ command: "/shortcuts", description: "Show keyboard shortcuts guide" },
|
|
132
173
|
{ command: "/continue", description: "Continue incomplete response" },
|
|
174
|
+
{ command: "/retry", description: "Re-send the last message" },
|
|
133
175
|
{ command: "/clear", description: "Clear chat history" },
|
|
134
176
|
{ command: "/init", description: "Initialize project with smart analysis" },
|
|
135
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" },
|
|
181
|
+
{ command: "/rewind", description: "Rewind to previous checkpoint" },
|
|
182
|
+
{ command: "/checkpoints", description: "List checkpoint statistics" },
|
|
183
|
+
{ command: "/checkpoint-clean", description: "Clean old checkpoints" },
|
|
136
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" },
|
|
137
192
|
{ command: "/exit", description: "Exit the application" },
|
|
138
193
|
];
|
|
139
194
|
// Load models from configuration with fallback to defaults
|
|
@@ -263,7 +318,11 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
263
318
|
break;
|
|
264
319
|
case "done":
|
|
265
320
|
if (streamingEntry) {
|
|
266
|
-
|
|
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));
|
|
267
326
|
}
|
|
268
327
|
setIsStreaming(false);
|
|
269
328
|
break;
|
|
@@ -294,6 +353,33 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
294
353
|
resetHistory();
|
|
295
354
|
return true;
|
|
296
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
|
+
}
|
|
297
383
|
if (trimmedInput === "/clear") {
|
|
298
384
|
// Reset chat history
|
|
299
385
|
setChatHistory([]);
|
|
@@ -309,6 +395,8 @@ export function useInputHandler({ agent, setChatHistory, setIsProcessing, setIsS
|
|
|
309
395
|
// Reset confirmation service session flags
|
|
310
396
|
const confirmationService = ConfirmationService.getInstance();
|
|
311
397
|
confirmationService.resetSession();
|
|
398
|
+
// Notify parent for toast feedback
|
|
399
|
+
onChatCleared?.();
|
|
312
400
|
clearInput();
|
|
313
401
|
resetHistory();
|
|
314
402
|
return true;
|
|
@@ -416,22 +504,49 @@ Built-in Commands:
|
|
|
416
504
|
/clear - Clear chat history
|
|
417
505
|
/init - Initialize project with smart analysis
|
|
418
506
|
/help - Show this help
|
|
507
|
+
/shortcuts - Show keyboard shortcuts guide
|
|
419
508
|
/usage - Show API usage statistics
|
|
420
509
|
/exit - Exit application
|
|
421
510
|
exit, quit - Exit application
|
|
422
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
|
+
|
|
520
|
+
Checkpoint Commands:
|
|
521
|
+
/rewind - Rewind to a previous checkpoint (interactive)
|
|
522
|
+
/checkpoints - Show checkpoint statistics
|
|
523
|
+
/checkpoint-clean - Clean old checkpoints (compress and prune)
|
|
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
|
+
|
|
423
534
|
Git Commands:
|
|
424
535
|
/commit-and-push - AI-generated commit + push to remote
|
|
425
536
|
|
|
426
537
|
Enhanced Input Features:
|
|
427
538
|
↑/↓ Arrow - Navigate command history
|
|
428
539
|
Ctrl+C - Clear input (press twice to exit)
|
|
540
|
+
Ctrl+X - Clear entire input line
|
|
429
541
|
Ctrl+←/→ - Move by word
|
|
430
542
|
Ctrl+A/E - Move to line start/end
|
|
431
543
|
Ctrl+W - Delete word before cursor
|
|
432
544
|
Ctrl+K - Delete to end of line
|
|
433
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)
|
|
434
548
|
Shift+Tab - Toggle auto-edit mode (bypass confirmations)
|
|
549
|
+
1-4 keys - Quick select in confirmation dialogs
|
|
435
550
|
|
|
436
551
|
Direct Commands (executed immediately):
|
|
437
552
|
ls [path] - List directory contents
|
|
@@ -455,6 +570,16 @@ Examples:
|
|
|
455
570
|
clearInput();
|
|
456
571
|
return true;
|
|
457
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
|
+
}
|
|
458
583
|
if (trimmedInput === "/usage") {
|
|
459
584
|
const tracker = getUsageTracker();
|
|
460
585
|
const stats = tracker.getSessionStats();
|
|
@@ -516,6 +641,171 @@ Examples:
|
|
|
516
641
|
process.exit(0);
|
|
517
642
|
return true;
|
|
518
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
|
+
}
|
|
703
|
+
if (trimmedInput === "/rewind") {
|
|
704
|
+
await handleRewindCommand(agent);
|
|
705
|
+
clearInput();
|
|
706
|
+
return true;
|
|
707
|
+
}
|
|
708
|
+
if (trimmedInput === "/checkpoints") {
|
|
709
|
+
await handleCheckpointsCommand();
|
|
710
|
+
clearInput();
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
713
|
+
if (trimmedInput === "/checkpoint-clean") {
|
|
714
|
+
await handleCheckpointCleanCommand();
|
|
715
|
+
clearInput();
|
|
716
|
+
return true;
|
|
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
|
+
}
|
|
519
809
|
if (trimmedInput === "/commit-and-push") {
|
|
520
810
|
const userEntry = {
|
|
521
811
|
type: "user",
|
|
@@ -856,6 +1146,8 @@ Respond with ONLY the commit message, no additional text.`;
|
|
|
856
1146
|
availableModels,
|
|
857
1147
|
agent,
|
|
858
1148
|
autoEditEnabled,
|
|
1149
|
+
verboseMode,
|
|
1150
|
+
backgroundMode,
|
|
859
1151
|
};
|
|
860
1152
|
}
|
|
861
1153
|
//# sourceMappingURL=use-input-handler.js.map
|