wave-code 0.17.0 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp/agent.d.ts +1 -0
- package/dist/acp/agent.d.ts.map +1 -1
- package/dist/acp/agent.js +116 -1
- package/dist/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +5 -2
- package/dist/components/InputBox.d.ts +2 -0
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +29 -8
- package/dist/components/LoadingIndicator.d.ts +2 -1
- package/dist/components/LoadingIndicator.d.ts.map +1 -1
- package/dist/components/LoadingIndicator.js +2 -2
- package/dist/components/QueuedMessageList.d.ts.map +1 -1
- package/dist/components/QueuedMessageList.js +10 -10
- package/dist/components/StatusLine.d.ts +2 -0
- package/dist/components/StatusLine.d.ts.map +1 -1
- package/dist/components/StatusLine.js +6 -6
- package/dist/components/TaskList.d.ts +3 -0
- package/dist/components/TaskList.d.ts.map +1 -1
- package/dist/components/TaskList.js +171 -28
- package/dist/components/TaskNotificationMessage.d.ts.map +1 -1
- package/dist/components/TaskNotificationMessage.js +1 -0
- package/dist/components/WorkflowManager.d.ts +6 -0
- package/dist/components/WorkflowManager.d.ts.map +1 -0
- package/dist/components/WorkflowManager.js +102 -0
- package/dist/constants/commands.d.ts.map +1 -1
- package/dist/constants/commands.js +6 -0
- package/dist/contexts/useChat.d.ts +8 -1
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +68 -4
- package/dist/hooks/useInputManager.d.ts +2 -0
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +22 -13
- package/dist/managers/inputHandlers.d.ts.map +1 -1
- package/dist/managers/inputHandlers.js +6 -3
- package/dist/managers/inputReducer.d.ts +10 -0
- package/dist/managers/inputReducer.d.ts.map +1 -1
- package/dist/managers/inputReducer.js +41 -4
- package/dist/print-cli.d.ts.map +1 -1
- package/dist/print-cli.js +3 -31
- package/dist/reducers/workflowManagerReducer.d.ts +41 -0
- package/dist/reducers/workflowManagerReducer.d.ts.map +1 -0
- package/dist/reducers/workflowManagerReducer.js +100 -0
- package/package.json +2 -2
- package/src/acp/agent.ts +137 -1
- package/src/components/ChatInterface.tsx +10 -1
- package/src/components/InputBox.tsx +43 -3
- package/src/components/LoadingIndicator.tsx +4 -1
- package/src/components/QueuedMessageList.tsx +7 -3
- package/src/components/StatusLine.tsx +28 -16
- package/src/components/TaskList.tsx +213 -19
- package/src/components/TaskNotificationMessage.tsx +1 -0
- package/src/components/WorkflowManager.tsx +320 -0
- package/src/constants/commands.ts +6 -0
- package/src/contexts/useChat.tsx +83 -4
- package/src/hooks/useInputManager.ts +25 -13
- package/src/managers/inputHandlers.ts +5 -4
- package/src/managers/inputReducer.ts +54 -6
- package/src/print-cli.ts +3 -37
- package/src/reducers/workflowManagerReducer.ts +143 -0
package/dist/acp/agent.d.ts
CHANGED
package/dist/acp/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/acp/agent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/acp/agent.ts"],"names":[],"mappings":"AAyBA,OAAO,EACL,KAAK,KAAK,IAAI,QAAQ,EACtB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EAUzB,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EAOpC,MAAM,0BAA0B,CAAC;AAGlC,qBAAa,YAAa,YAAW,QAAQ;IAC3C,OAAO,CAAC,MAAM,CAAqC;IACnD,OAAO,CAAC,UAAU,CAAsB;gBAE5B,UAAU,EAAE,mBAAmB;IAI3C,OAAO,CAAC,mBAAmB;IAkC3B,OAAO,CAAC,uBAAuB;YAmCjB,gBAAgB;IASxB,UAAU,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAyBzC,YAAY,IAAI,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;YAI5C,WAAW;IA2EnB,UAAU,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAalE,WAAW,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAcrE,YAAY,CAChB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,oBAAoB,CAAC;IAuB1B,qBAAqB,CACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAc7B,SAAS,CACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAO7B,cAAc,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc5D,sBAAsB,CAC1B,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,8BAA8B,CAAC;IAuBpC,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAyDtD,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IASvD,OAAO,CAAC,kBAAkB;YA2BZ,uBAAuB;IA8LrC,OAAO,CAAC,cAAc;IAwGtB,OAAO,CAAC,gBAAgB;IAmCxB,OAAO,CAAC,WAAW;YAmBL,yBAAyB;IAiIvC,OAAO,CAAC,eAAe;CAyOxB"}
|
package/dist/acp/agent.js
CHANGED
|
@@ -40,7 +40,7 @@ export class WaveAcpAgent {
|
|
|
40
40
|
}
|
|
41
41
|
getSessionConfigOptions(agent) {
|
|
42
42
|
const configuredModels = agent.getConfiguredModels();
|
|
43
|
-
const currentModel = agent.getModelConfig().model;
|
|
43
|
+
const currentModel = agent.getModelConfig().model || "";
|
|
44
44
|
return [
|
|
45
45
|
{
|
|
46
46
|
id: "permission_mode",
|
|
@@ -174,6 +174,8 @@ export class WaveAcpAgent {
|
|
|
174
174
|
const { sessionId, cwd, mcpServers } = params;
|
|
175
175
|
logger.info(`Loading session: ${sessionId} in ${cwd}`);
|
|
176
176
|
const agent = await this.createAgent(sessionId, cwd, mcpServers);
|
|
177
|
+
// Replay conversation history via session/update notifications per ACP spec
|
|
178
|
+
await this.replayConversationHistory(agent);
|
|
177
179
|
return {
|
|
178
180
|
modes: this.getSessionModeState(agent),
|
|
179
181
|
configOptions: this.getSessionConfigOptions(agent),
|
|
@@ -618,6 +620,119 @@ export class WaveAcpAgent {
|
|
|
618
620
|
return "other";
|
|
619
621
|
}
|
|
620
622
|
}
|
|
623
|
+
async replayConversationHistory(agent) {
|
|
624
|
+
const sessionId = agent.sessionId;
|
|
625
|
+
let history;
|
|
626
|
+
try {
|
|
627
|
+
const thread = await agent.getFullMessageThread();
|
|
628
|
+
history = thread.messages;
|
|
629
|
+
}
|
|
630
|
+
catch {
|
|
631
|
+
// Fallback to in-memory messages if full thread fails
|
|
632
|
+
history = agent.messages;
|
|
633
|
+
}
|
|
634
|
+
for (const message of history) {
|
|
635
|
+
if (message.isMeta)
|
|
636
|
+
continue;
|
|
637
|
+
const messageId = message.id;
|
|
638
|
+
for (const block of message.blocks) {
|
|
639
|
+
if (block.type === "text") {
|
|
640
|
+
const textBlock = block;
|
|
641
|
+
const update = message.role === "user"
|
|
642
|
+
? {
|
|
643
|
+
sessionUpdate: "user_message_chunk",
|
|
644
|
+
content: { type: "text", text: textBlock.content },
|
|
645
|
+
messageId,
|
|
646
|
+
}
|
|
647
|
+
: {
|
|
648
|
+
sessionUpdate: "agent_message_chunk",
|
|
649
|
+
content: { type: "text", text: textBlock.content },
|
|
650
|
+
messageId,
|
|
651
|
+
};
|
|
652
|
+
this.connection.sessionUpdate({ sessionId, update });
|
|
653
|
+
}
|
|
654
|
+
else if (block.type === "reasoning") {
|
|
655
|
+
const reasoningBlock = block;
|
|
656
|
+
this.connection.sessionUpdate({
|
|
657
|
+
sessionId,
|
|
658
|
+
update: {
|
|
659
|
+
sessionUpdate: "agent_thought_chunk",
|
|
660
|
+
content: { type: "text", text: reasoningBlock.content },
|
|
661
|
+
messageId,
|
|
662
|
+
},
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
else if (block.type === "tool") {
|
|
666
|
+
const toolBlock = block;
|
|
667
|
+
const toolCallId = toolBlock.id ||
|
|
668
|
+
"replay-" + Math.random().toString(36).substring(2, 9);
|
|
669
|
+
const effectiveName = toolBlock.name || "Tool";
|
|
670
|
+
const effectiveCompactParams = toolBlock.compactParams;
|
|
671
|
+
const displayTitle = effectiveName && effectiveCompactParams
|
|
672
|
+
? `${effectiveName}: ${effectiveCompactParams}`
|
|
673
|
+
: effectiveName;
|
|
674
|
+
let parsedParameters;
|
|
675
|
+
if (toolBlock.parameters) {
|
|
676
|
+
try {
|
|
677
|
+
const parsed = JSON.parse(toolBlock.parameters);
|
|
678
|
+
parsedParameters = Array.isArray(parsed)
|
|
679
|
+
? { args: parsed }
|
|
680
|
+
: parsed;
|
|
681
|
+
}
|
|
682
|
+
catch {
|
|
683
|
+
// Ignore parse errors
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
const content = effectiveName && (parsedParameters || toolBlock.shortResult)
|
|
687
|
+
? this.getToolContent(effectiveName, parsedParameters, toolBlock.shortResult)
|
|
688
|
+
: undefined;
|
|
689
|
+
const locations = effectiveName && parsedParameters
|
|
690
|
+
? this.getToolLocations(effectiveName, parsedParameters)
|
|
691
|
+
: undefined;
|
|
692
|
+
const kind = effectiveName
|
|
693
|
+
? this.getToolKind(effectiveName)
|
|
694
|
+
: undefined;
|
|
695
|
+
// Emit tool_call (creation)
|
|
696
|
+
this.connection.sessionUpdate({
|
|
697
|
+
sessionId,
|
|
698
|
+
update: {
|
|
699
|
+
sessionUpdate: "tool_call",
|
|
700
|
+
toolCallId,
|
|
701
|
+
title: displayTitle,
|
|
702
|
+
status: "pending",
|
|
703
|
+
content,
|
|
704
|
+
locations,
|
|
705
|
+
kind,
|
|
706
|
+
rawInput: parsedParameters,
|
|
707
|
+
},
|
|
708
|
+
});
|
|
709
|
+
// Emit tool_call_update with final status
|
|
710
|
+
const status = toolBlock.stage === "end"
|
|
711
|
+
? toolBlock.success
|
|
712
|
+
? "completed"
|
|
713
|
+
: "failed"
|
|
714
|
+
: toolBlock.stage === "running"
|
|
715
|
+
? "in_progress"
|
|
716
|
+
: "pending";
|
|
717
|
+
this.connection.sessionUpdate({
|
|
718
|
+
sessionId,
|
|
719
|
+
update: {
|
|
720
|
+
sessionUpdate: "tool_call_update",
|
|
721
|
+
toolCallId,
|
|
722
|
+
status,
|
|
723
|
+
title: displayTitle,
|
|
724
|
+
rawOutput: toolBlock.result || toolBlock.error,
|
|
725
|
+
content,
|
|
726
|
+
locations,
|
|
727
|
+
kind,
|
|
728
|
+
rawInput: parsedParameters,
|
|
729
|
+
},
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
// Skip: image, bang, compact, error, file_history, task_notification blocks
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
621
736
|
createCallbacks(sessionId) {
|
|
622
737
|
const getAgent = () => this.agents.get(sessionId);
|
|
623
738
|
const toolStates = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatInterface.d.ts","sourceRoot":"","sources":["../../src/components/ChatInterface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAa3D,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"ChatInterface.d.ts","sourceRoot":"","sources":["../../src/components/ChatInterface.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAa3D,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EA2IjC,CAAC"}
|
|
@@ -10,7 +10,7 @@ import { ConfirmationDetails } from "./ConfirmationDetails.js";
|
|
|
10
10
|
import { ConfirmationSelector } from "./ConfirmationSelector.js";
|
|
11
11
|
import { useChat } from "../contexts/useChat.js";
|
|
12
12
|
export const ChatInterface = () => {
|
|
13
|
-
const { messages, isLoading, isCommandRunning, isCompacting, sendMessage, abortMessage, mcpServers, connectMcpServer, disconnectMcpServer, isExpanded, sessionId, latestTotalTokens, maxInputTokens, slashCommands, hasSlashCommand, isConfirmationVisible, hasPendingConfirmations, confirmingTool, handleConfirmationDecision, handleConfirmationCancel, version, workdir, remountKey, requestRemount, } = useChat();
|
|
13
|
+
const { messages, isLoading, isCommandRunning, isCompacting, sendMessage, abortMessage, mcpServers, connectMcpServer, disconnectMcpServer, isExpanded, sessionId, latestTotalTokens, maxInputTokens, slashCommands, hasSlashCommand, isConfirmationVisible, hasPendingConfirmations, confirmingTool, handleConfirmationDecision, handleConfirmationCancel, version, workdir, remountKey, requestRemount, isGoalActive, goalElapsed, isGoalEvaluating, } = useChat();
|
|
14
14
|
const displayMessages = messages;
|
|
15
15
|
const [forceStatic, setForceStatic] = useState(false);
|
|
16
16
|
const { stdout } = useStdout();
|
|
@@ -37,5 +37,8 @@ export const ChatInterface = () => {
|
|
|
37
37
|
]);
|
|
38
38
|
if (!sessionId)
|
|
39
39
|
return null;
|
|
40
|
-
return (_jsxs(Box, { ref: chatInterfaceRef, flexDirection: "column", children: [_jsx(MessageList, { messages: displayMessages, isExpanded: isExpanded, version: version, workdir: workdir, forceStatic: forceStatic }, remountKey), !isConfirmationVisible && !isExpanded && (_jsxs(_Fragment, { children: [(isLoading ||
|
|
40
|
+
return (_jsxs(Box, { ref: chatInterfaceRef, flexDirection: "column", children: [_jsx(MessageList, { messages: displayMessages, isExpanded: isExpanded, version: version, workdir: workdir, forceStatic: forceStatic }, remountKey), !isConfirmationVisible && !isExpanded && (_jsxs(_Fragment, { children: [(isLoading ||
|
|
41
|
+
isCommandRunning ||
|
|
42
|
+
isCompacting ||
|
|
43
|
+
isGoalEvaluating) && (_jsx(LoadingIndicator, { isLoading: isLoading, isCommandRunning: isCommandRunning, isCompacting: isCompacting, isGoalEvaluating: isGoalEvaluating, latestTotalTokens: latestTotalTokens })), _jsx(TaskList, {}), _jsx(QueuedMessageList, {}), _jsx(InputBox, { isLoading: isLoading, isCommandRunning: isCommandRunning, sendMessage: sendMessage, abortMessage: abortMessage, mcpServers: mcpServers, connectMcpServer: connectMcpServer, disconnectMcpServer: disconnectMcpServer, slashCommands: slashCommands, hasSlashCommand: hasSlashCommand, latestTotalTokens: latestTotalTokens, maxInputTokens: maxInputTokens, isGoalActive: isGoalActive, goalElapsed: goalElapsed })] })), isConfirmationVisible && (_jsxs(_Fragment, { children: [forceStatic ? (_jsx(Static, { items: [{ key: "confirmation-details" }], children: () => (_jsx(ConfirmationDetails, { toolName: confirmingTool.name, toolInput: confirmingTool.input, planContent: confirmingTool.planContent, isExpanded: isExpanded }, "confirmation-details")) })) : (_jsx(ConfirmationDetails, { toolName: confirmingTool.name, toolInput: confirmingTool.input, planContent: confirmingTool.planContent, isExpanded: isExpanded })), _jsx(ConfirmationSelector, { toolName: confirmingTool.name, toolInput: confirmingTool.input, suggestedPrefix: confirmingTool.suggestedPrefix, hidePersistentOption: confirmingTool.hidePersistentOption, isExpanded: isExpanded, onDecision: handleConfirmationDecision, onCancel: handleConfirmationCancel })] }))] }));
|
|
41
44
|
};
|
|
@@ -18,6 +18,8 @@ export interface InputBoxProps {
|
|
|
18
18
|
hasSlashCommand?: (commandId: string) => boolean;
|
|
19
19
|
latestTotalTokens?: number;
|
|
20
20
|
maxInputTokens?: number;
|
|
21
|
+
isGoalActive?: boolean;
|
|
22
|
+
goalElapsed?: string;
|
|
21
23
|
}
|
|
22
24
|
export declare const InputBox: React.FC<InputBoxProps>;
|
|
23
25
|
//# sourceMappingURL=InputBox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputBox.d.ts","sourceRoot":"","sources":["../../src/components/InputBox.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"InputBox.d.ts","sourceRoot":"","sources":["../../src/components/InputBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAoB9D,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEpE,eAAO,MAAM,sBAAsB,mDACe,CAAC;AAEnD,eAAO,MAAM,6BAA6B,QAGzC,CAAC;AAEF,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,EAClD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KACjC,IAAI,CAAC;IACV,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAE1B,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5D,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/D,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IAEjD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAoU5C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
2
|
+
import { useEffect, useRef, useCallback } from "react";
|
|
3
3
|
import { Box, Text } from "ink";
|
|
4
4
|
import { useInput } from "ink";
|
|
5
5
|
import { FileSelector } from "./FileSelector.js";
|
|
@@ -13,14 +13,25 @@ import { StatusCommand } from "./StatusCommand.js";
|
|
|
13
13
|
import { LoginCommand } from "./LoginCommand.js";
|
|
14
14
|
import { PluginManagerShell } from "./PluginManagerShell.js";
|
|
15
15
|
import { ModelSelector } from "./ModelSelector.js";
|
|
16
|
+
import { WorkflowManager } from "./WorkflowManager.js";
|
|
16
17
|
import { StatusLine } from "./StatusLine.js";
|
|
17
18
|
import { BtwDisplay } from "./BtwDisplay.js";
|
|
18
19
|
import { useInputManager } from "../hooks/useInputManager.js";
|
|
19
20
|
import { useChat } from "../contexts/useChat.js";
|
|
20
21
|
export const INPUT_PLACEHOLDER_TEXT = "Type your message (use /help for more info)...";
|
|
21
22
|
export const INPUT_PLACEHOLDER_TEXT_PREFIX = INPUT_PLACEHOLDER_TEXT.substring(0, 10);
|
|
22
|
-
export const InputBox = ({ sendMessage = () => { }, abortMessage = () => { }, mcpServers = [], connectMcpServer = async () => false, disconnectMcpServer = async () => false, slashCommands = [], hasSlashCommand = () => false, latestTotalTokens = 0, maxInputTokens = 128000, }) => {
|
|
23
|
-
const { permissionMode: chatPermissionMode, setPermissionMode: setChatPermissionMode, handleRewindSelect, backgroundCurrentTask, messages, getFullMessageThread, sessionId, workingDirectory, askBtw, currentModel, configuredModels, setModel, recreateAgent, } = useChat();
|
|
23
|
+
export const InputBox = ({ sendMessage = () => { }, abortMessage = () => { }, mcpServers = [], connectMcpServer = async () => false, disconnectMcpServer = async () => false, slashCommands = [], hasSlashCommand = () => false, latestTotalTokens = 0, maxInputTokens = 128000, isGoalActive, goalElapsed, }) => {
|
|
24
|
+
const { permissionMode: chatPermissionMode, setPermissionMode: setChatPermissionMode, handleRewindSelect, backgroundCurrentTask, messages, getFullMessageThread, sessionId, workingDirectory, askBtw, currentModel, configuredModels, setModel, recreateAgent, recallQueuedMessage, queuedMessages, } = useChat();
|
|
25
|
+
// Ref to hold setInputText so queue callbacks can access it before useInputManager returns
|
|
26
|
+
const setInputTextRef = useRef(() => { });
|
|
27
|
+
const hasQueuedMessages = (queuedMessages?.length ?? 0) > 0;
|
|
28
|
+
const onRecallQueuedMessage = useCallback(() => {
|
|
29
|
+
const msg = recallQueuedMessage();
|
|
30
|
+
if (msg) {
|
|
31
|
+
const prefix = msg.type === "bang" ? "!" : "";
|
|
32
|
+
setInputTextRef.current(prefix + msg.content);
|
|
33
|
+
}
|
|
34
|
+
}, [recallQueuedMessage]);
|
|
24
35
|
// Input manager with all input state and functionality (including images)
|
|
25
36
|
const { inputText, cursorPosition,
|
|
26
37
|
// Image management
|
|
@@ -32,7 +43,7 @@ export const InputBox = ({ sendMessage = () => { }, abortMessage = () => { }, mc
|
|
|
32
43
|
// History search
|
|
33
44
|
showHistorySearch, historySearchQuery,
|
|
34
45
|
// Task/MCP Manager
|
|
35
|
-
showBackgroundTaskManager, showMcpManager, showRewindManager, showHelp, showStatusCommand, showLoginCommand, showPluginManager, showModelSelector, setShowBackgroundTaskManager, setShowMcpManager, setShowRewindManager, setShowHelp, setShowStatusCommand, setShowLoginCommand, setShowPluginManager, setShowModelSelector,
|
|
46
|
+
showBackgroundTaskManager, showMcpManager, showRewindManager, showHelp, showStatusCommand, showLoginCommand, showPluginManager, showModelSelector, showWorkflowManager, setShowBackgroundTaskManager, setShowMcpManager, setShowRewindManager, setShowHelp, setShowStatusCommand, setShowLoginCommand, setShowPluginManager, setShowModelSelector, setShowWorkflowManager,
|
|
36
47
|
// Permission mode
|
|
37
48
|
permissionMode, setPermissionMode,
|
|
38
49
|
// BTW state
|
|
@@ -40,7 +51,9 @@ export const InputBox = ({ sendMessage = () => { }, abortMessage = () => { }, mc
|
|
|
40
51
|
// Main handler
|
|
41
52
|
handleInput,
|
|
42
53
|
// Manager ready state
|
|
43
|
-
isManagerReady,
|
|
54
|
+
isManagerReady,
|
|
55
|
+
// Direct state setters
|
|
56
|
+
setInputText, } = useInputManager({
|
|
44
57
|
onSendMessage: sendMessage,
|
|
45
58
|
onAskBtw: askBtw,
|
|
46
59
|
onHasSlashCommand: hasSlashCommand,
|
|
@@ -50,7 +63,13 @@ export const InputBox = ({ sendMessage = () => { }, abortMessage = () => { }, mc
|
|
|
50
63
|
sessionId,
|
|
51
64
|
workdir: workingDirectory,
|
|
52
65
|
getFullMessageThread,
|
|
66
|
+
hasQueuedMessages,
|
|
67
|
+
onRecallQueuedMessage,
|
|
53
68
|
});
|
|
69
|
+
// Keep setInputText ref updated for queue callbacks
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
setInputTextRef.current = setInputText;
|
|
72
|
+
}, [setInputText]);
|
|
54
73
|
// Sync permission mode from useChat to InputManager
|
|
55
74
|
useEffect(() => {
|
|
56
75
|
setPermissionMode(chatPermissionMode);
|
|
@@ -67,7 +86,8 @@ export const InputBox = ({ sendMessage = () => { }, abortMessage = () => { }, mc
|
|
|
67
86
|
showPluginManager ||
|
|
68
87
|
showModelSelector ||
|
|
69
88
|
showBackgroundTaskManager ||
|
|
70
|
-
showMcpManager
|
|
89
|
+
showMcpManager ||
|
|
90
|
+
showWorkflowManager) {
|
|
71
91
|
return;
|
|
72
92
|
}
|
|
73
93
|
await handleInput(input, key, attachedImages, clearImages);
|
|
@@ -116,11 +136,12 @@ export const InputBox = ({ sendMessage = () => { }, abortMessage = () => { }, mc
|
|
|
116
136
|
if (showModelSelector) {
|
|
117
137
|
return (_jsx(ModelSelector, { onCancel: () => setShowModelSelector(false), currentModel: currentModel, configuredModels: configuredModels, onSelectModel: setModel }));
|
|
118
138
|
}
|
|
119
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(BtwDisplay, { btwState: btwState }), showFileSelector && (_jsx(FileSelector, { files: filteredFiles, searchQuery: searchQuery, isLoading: isFileSearching, onSelect: handleFileSelect, onCancel: handleCancelFileSelect })), showCommandSelector && (_jsx(CommandSelector, { searchQuery: commandSearchQuery, onSelect: handleCommandSelect, onInsert: handleCommandInsert, onCancel: handleCancelCommandSelect, commands: slashCommands })), showHistorySearch && (_jsx(HistorySearch, { searchQuery: historySearchQuery, onSelect: handleHistorySearchSelect, onCancel: handleCancelHistorySearch })), showBackgroundTaskManager && (_jsx(BackgroundTaskManager, { onCancel: () => setShowBackgroundTaskManager(false) })), showMcpManager && (_jsx(McpManager, { onCancel: () => setShowMcpManager(false), servers: mcpServers, onConnectServer: connectMcpServer, onDisconnectServer: disconnectMcpServer })), showBackgroundTaskManager ||
|
|
139
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(BtwDisplay, { btwState: btwState }), showFileSelector && (_jsx(FileSelector, { files: filteredFiles, searchQuery: searchQuery, isLoading: isFileSearching, onSelect: handleFileSelect, onCancel: handleCancelFileSelect })), showCommandSelector && (_jsx(CommandSelector, { searchQuery: commandSearchQuery, onSelect: handleCommandSelect, onInsert: handleCommandInsert, onCancel: handleCancelCommandSelect, commands: slashCommands })), showHistorySearch && (_jsx(HistorySearch, { searchQuery: historySearchQuery, onSelect: handleHistorySearchSelect, onCancel: handleCancelHistorySearch })), showBackgroundTaskManager && (_jsx(BackgroundTaskManager, { onCancel: () => setShowBackgroundTaskManager(false) })), showMcpManager && (_jsx(McpManager, { onCancel: () => setShowMcpManager(false), servers: mcpServers, onConnectServer: connectMcpServer, onDisconnectServer: disconnectMcpServer })), showWorkflowManager && (_jsx(WorkflowManager, { onCancel: () => setShowWorkflowManager(false) })), showBackgroundTaskManager ||
|
|
120
140
|
showMcpManager ||
|
|
121
141
|
showRewindManager ||
|
|
122
142
|
showHelp ||
|
|
123
143
|
showStatusCommand ||
|
|
124
144
|
showLoginCommand ||
|
|
125
|
-
showPluginManager ||
|
|
145
|
+
showPluginManager ||
|
|
146
|
+
showWorkflowManager || (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { borderStyle: "single", borderColor: btwState.isActive ? "cyan" : "gray", borderLeft: false, borderRight: false, children: _jsx(Text, { color: isPlaceholder ? "gray" : "white", children: btwState.isActive && isPlaceholder ? (_jsxs(_Fragment, { children: [_jsx(Text, { backgroundColor: "white", color: "black", children: " " }), _jsx(Text, { color: "cyan", children: "Type your side question..." })] })) : shouldShowCursor ? (_jsxs(_Fragment, { children: [beforeCursor, _jsx(Text, { backgroundColor: "white", color: "black", children: atCursor }), afterCursor] })) : (displayText) }) }), _jsx(StatusLine, { permissionMode: permissionMode, isShellCommand: isShellCommand, isBtwActive: btwState.isActive, isGoalActive: isGoalActive, goalElapsed: goalElapsed, latestTotalTokens: latestTotalTokens, maxInputTokens: maxInputTokens })] }))] }));
|
|
126
147
|
};
|
|
@@ -2,10 +2,11 @@ export interface LoadingIndicatorProps {
|
|
|
2
2
|
isLoading?: boolean;
|
|
3
3
|
isCommandRunning?: boolean;
|
|
4
4
|
isCompacting?: boolean;
|
|
5
|
+
isGoalEvaluating?: boolean;
|
|
5
6
|
latestTotalTokens?: number;
|
|
6
7
|
}
|
|
7
8
|
export declare const LoadingIndicator: {
|
|
8
|
-
({ isLoading, isCommandRunning, isCompacting, latestTotalTokens, }: LoadingIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
({ isLoading, isCommandRunning, isCompacting, isGoalEvaluating, latestTotalTokens, }: LoadingIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|
|
11
12
|
//# sourceMappingURL=LoadingIndicator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../src/components/LoadingIndicator.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,gBAAgB;
|
|
1
|
+
{"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../src/components/LoadingIndicator.tsx"],"names":[],"mappings":"AAGA,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,gBAAgB;0FAM1B,qBAAqB;;CAuCvB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
-
export const LoadingIndicator = ({ isLoading = false, isCommandRunning = false, isCompacting = false, latestTotalTokens = 0, }) => {
|
|
4
|
-
return (_jsxs(Box, { flexDirection: "column", children: [isLoading && !isCompacting && (_jsxs(Box, { children: [_jsx(Text, { color: "yellow", children: "\u273B AI is thinking... " }), latestTotalTokens > 0 && (_jsxs(_Fragment, { children: [_jsxs(Text, { color: "gray", dimColor: true, children: ["|", " "] }), _jsx(Text, { color: "blue", bold: true, children: latestTotalTokens.toLocaleString() }), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", "tokens", " "] })] })), _jsxs(Text, { color: "gray", dimColor: true, children: ["|", " "] }), _jsx(Text, { color: "red", bold: true, children: "Esc" }), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", "to abort"] })] })), isCommandRunning && _jsx(Text, { color: "blue", children: "\u273B Command is running..." }), isCompacting && (_jsx(Text, { color: "magenta", children: "\u273B Compacting message history..." }))] }));
|
|
3
|
+
export const LoadingIndicator = ({ isLoading = false, isCommandRunning = false, isCompacting = false, isGoalEvaluating = false, latestTotalTokens = 0, }) => {
|
|
4
|
+
return (_jsxs(Box, { flexDirection: "column", children: [isLoading && !isCompacting && !isGoalEvaluating && (_jsxs(Box, { children: [_jsx(Text, { color: "yellow", children: "\u273B AI is thinking... " }), latestTotalTokens > 0 && (_jsxs(_Fragment, { children: [_jsxs(Text, { color: "gray", dimColor: true, children: ["|", " "] }), _jsx(Text, { color: "blue", bold: true, children: latestTotalTokens.toLocaleString() }), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", "tokens", " "] })] })), _jsxs(Text, { color: "gray", dimColor: true, children: ["|", " "] }), _jsx(Text, { color: "red", bold: true, children: "Esc" }), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", "to abort"] })] })), isCommandRunning && _jsx(Text, { color: "blue", children: "\u273B Command is running..." }), isCompacting && (_jsx(Text, { color: "magenta", children: "\u273B Compacting message history..." })), isGoalEvaluating && _jsx(Text, { color: "cyan", children: "\u273B Evaluating goal..." })] }));
|
|
5
5
|
};
|
|
6
6
|
LoadingIndicator.displayName = "LoadingIndicator";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueuedMessageList.d.ts","sourceRoot":"","sources":["../../src/components/QueuedMessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"QueuedMessageList.d.ts","sourceRoot":"","sources":["../../src/components/QueuedMessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EA+BrC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useChat } from "../contexts/useChat.js";
|
|
3
3
|
import { Box, Text } from "ink";
|
|
4
4
|
export const QueuedMessageList = () => {
|
|
@@ -6,13 +6,13 @@ export const QueuedMessageList = () => {
|
|
|
6
6
|
if (queuedMessages.length === 0) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
|
-
return (
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
return (_jsxs(Box, { flexDirection: "column", children: [queuedMessages.map((msg, index) => {
|
|
10
|
+
const content = msg.content.trim();
|
|
11
|
+
const hasImages = msg.images && msg.images.length > 0;
|
|
12
|
+
const prefix = msg.type === "bang" ? "! " : "";
|
|
13
|
+
const displayText = prefix + (content || (hasImages ? "[Images]" : ""));
|
|
14
|
+
return (_jsxs(Box, { children: [_jsxs(Text, { color: "gray", children: ["[", index + 1, "] "] }), _jsx(Text, { color: "gray", italic: true, children: displayText.length > 55
|
|
15
|
+
? `${displayText.substring(0, 52)}...`
|
|
16
|
+
: displayText })] }, msg.id ?? index));
|
|
17
|
+
}), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", "\u2191 recall"] })] }));
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusLine.d.ts","sourceRoot":"","sources":["../../src/components/StatusLine.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"StatusLine.d.ts","sourceRoot":"","sources":["../../src/components/StatusLine.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA0DhD,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
|
-
export const StatusLine = ({ permissionMode, isShellCommand, isBtwActive, latestTotalTokens = 0, maxInputTokens = 128000, }) => {
|
|
3
|
+
export const StatusLine = ({ permissionMode, isShellCommand, isBtwActive, isGoalActive, goalElapsed, latestTotalTokens = 0, maxInputTokens = 128000, }) => {
|
|
4
4
|
const percentage = latestTotalTokens > 0
|
|
5
5
|
? Math.min(Math.round((latestTotalTokens / maxInputTokens) * 100), 100)
|
|
6
6
|
: 0;
|
|
7
7
|
const contextColor = percentage > 95 ? "red" : percentage > 80 ? "yellow" : "gray";
|
|
8
|
-
return (_jsxs(Box, { paddingRight: 1, justifyContent: "space-between", width: "100%", children: [isBtwActive ? (_jsxs(Text, { color: "gray", children: ["Mode: ", _jsx(Text, { color: "cyan", children: "BTW" }), " (ESC to dismiss)"] })) : isShellCommand ? (_jsxs(Text, { color: "gray", children: ["Shell: ", _jsx(Text, { color: "yellow", children: "Run shell command" })] })) : (_jsxs(Text, { color: "gray", children: ["Mode:", " ", _jsx(Text, { color: permissionMode === "plan"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
return (_jsxs(Box, { paddingRight: 1, justifyContent: "space-between", width: "100%", children: [isBtwActive ? (_jsxs(Text, { color: "gray", children: ["Mode: ", _jsx(Text, { color: "cyan", children: "BTW" }), " (ESC to dismiss)"] })) : isShellCommand ? (_jsxs(Text, { color: "gray", children: ["Shell: ", _jsx(Text, { color: "yellow", children: "Run shell command" })] })) : (_jsxs(Box, { children: [isGoalActive && (_jsxs(Text, { color: "gray", children: [_jsx(Text, { color: "cyan", children: "\u25CE /goal" }), " active", " ", goalElapsed && _jsxs(Text, { children: ["(", goalElapsed, ")"] }), " |", " "] })), _jsxs(Text, { color: "gray", children: ["Mode:", " ", _jsx(Text, { color: permissionMode === "plan"
|
|
9
|
+
? "yellow"
|
|
10
|
+
: permissionMode === "bypassPermissions"
|
|
11
|
+
? "red"
|
|
12
|
+
: "cyan", bold: permissionMode === "bypassPermissions", children: permissionMode }), " ", "(Shift+Tab to cycle)"] })] })), percentage > 0 && (_jsxs(Text, { color: contextColor, children: [percentage, "% context"] }))] }));
|
|
13
13
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { Task, TaskStatus } from "wave-agent-sdk";
|
|
3
|
+
export declare const getStatusIcon: (status: TaskStatus) => React.ReactNode;
|
|
4
|
+
export declare function sortTasksByPriority(tasks: Task[], completionTimestamps: Map<string, number>, now: number, needsTruncation: boolean): Task[];
|
|
2
5
|
export declare const TaskList: React.FC;
|
|
3
6
|
//# sourceMappingURL=TaskList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskList.d.ts","sourceRoot":"","sources":["../../src/components/TaskList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TaskList.d.ts","sourceRoot":"","sources":["../../src/components/TaskList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAKvD,eAAO,MAAM,aAAa,GAAI,QAAQ,UAAU,KAAG,KAAK,CAAC,SAaxD,CAAC;AAWF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,IAAI,EAAE,EACb,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,GAAG,EAAE,MAAM,EACX,eAAe,EAAE,OAAO,GACvB,IAAI,EAAE,CA8CR;AAOD,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EA6J5B,CAAC"}
|