wave-code 0.17.6 → 0.17.7
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.map +1 -1
- package/dist/acp/agent.js +217 -176
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +4 -1
- package/dist/constants/commands.d.ts.map +1 -1
- package/dist/constants/commands.js +18 -0
- package/dist/contexts/useChat.d.ts +3 -0
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +21 -0
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +13 -1
- package/dist/managers/inputHandlers.d.ts.map +1 -1
- package/dist/managers/inputHandlers.js +9 -0
- package/dist/managers/inputReducer.d.ts +4 -0
- package/dist/managers/inputReducer.d.ts.map +1 -1
- package/dist/managers/inputReducer.js +5 -0
- package/package.json +2 -2
- package/src/acp/agent.ts +258 -205
- package/src/components/InputBox.tsx +6 -0
- package/src/constants/commands.ts +18 -0
- package/src/contexts/useChat.tsx +27 -0
- package/src/hooks/useInputManager.ts +12 -0
- package/src/managers/inputHandlers.ts +6 -0
- package/src/managers/inputReducer.ts +10 -1
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":"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,EA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AC,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,iBAAiB;YAsEjB,gBAAgB;YAyDhB,uBAAuB;IAmNrC,OAAO,CAAC,cAAc;IA6FtB,OAAO,CAAC,gBAAgB;IAmCxB,OAAO,CAAC,WAAW;YAmBL,yBAAyB;IAoIvC,OAAO,CAAC,eAAe;CAkRxB"}
|
package/dist/acp/agent.js
CHANGED
|
@@ -134,13 +134,15 @@ export class WaveAcpAgent {
|
|
|
134
134
|
onModelChange: (model) => callbacks.onModelChange?.(model),
|
|
135
135
|
onUserMessageAdded: (params) => callbacks.onUserMessageAdded?.(params),
|
|
136
136
|
onMcpServersChange: (servers) => callbacks.onMcpServersChange?.(servers),
|
|
137
|
+
onSessionIdChange: (newSessionId) => callbacks.onSessionIdChange?.(newSessionId),
|
|
137
138
|
},
|
|
138
139
|
});
|
|
139
140
|
agentRef.instance = agent;
|
|
140
141
|
const actualSessionId = agent.sessionId;
|
|
141
142
|
this.agents.set(actualSessionId, agent);
|
|
142
143
|
// Update the callbacks object with the correct sessionId
|
|
143
|
-
|
|
144
|
+
const { callbacks: cb } = this.createCallbacks(actualSessionId);
|
|
145
|
+
Object.assign(callbacks, cb);
|
|
144
146
|
// Send initial available commands after agent creation
|
|
145
147
|
// Use setImmediate to ensure the client receives the session response before the update
|
|
146
148
|
setImmediate(() => {
|
|
@@ -391,7 +393,11 @@ export class WaveAcpAgent {
|
|
|
391
393
|
const response = await this.connection.extMethod("wave/create_plan", request);
|
|
392
394
|
const outcome = response.outcome;
|
|
393
395
|
if (outcome === "accepted") {
|
|
394
|
-
|
|
396
|
+
const mode = response.mode;
|
|
397
|
+
return {
|
|
398
|
+
behavior: "allow",
|
|
399
|
+
newPermissionMode: (mode || "default"),
|
|
400
|
+
};
|
|
395
401
|
}
|
|
396
402
|
if (outcome === "rejected") {
|
|
397
403
|
const reason = response.reason;
|
|
@@ -703,15 +709,7 @@ export class WaveAcpAgent {
|
|
|
703
709
|
}
|
|
704
710
|
async replayConversationHistory(agent) {
|
|
705
711
|
const sessionId = agent.sessionId;
|
|
706
|
-
|
|
707
|
-
try {
|
|
708
|
-
const thread = await agent.getFullMessageThread();
|
|
709
|
-
history = thread.messages;
|
|
710
|
-
}
|
|
711
|
-
catch {
|
|
712
|
-
// Fallback to in-memory messages if full thread fails
|
|
713
|
-
history = agent.messages;
|
|
714
|
-
}
|
|
712
|
+
const history = agent.messages;
|
|
715
713
|
for (const message of history) {
|
|
716
714
|
if (message.isMeta)
|
|
717
715
|
continue;
|
|
@@ -810,205 +808,248 @@ export class WaveAcpAgent {
|
|
|
810
808
|
},
|
|
811
809
|
});
|
|
812
810
|
}
|
|
813
|
-
|
|
811
|
+
else if (block.type === "compact") {
|
|
812
|
+
const compactBlock = block;
|
|
813
|
+
this.connection.sessionUpdate({
|
|
814
|
+
sessionId,
|
|
815
|
+
update: {
|
|
816
|
+
sessionUpdate: "agent_message_chunk",
|
|
817
|
+
content: { type: "text", text: compactBlock.content },
|
|
818
|
+
messageId,
|
|
819
|
+
},
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
// Skip: image, bang, error, file_history, task_notification blocks
|
|
814
823
|
}
|
|
815
824
|
}
|
|
816
825
|
}
|
|
817
826
|
createCallbacks(sessionId) {
|
|
818
|
-
const
|
|
827
|
+
const sessionRef = { id: sessionId };
|
|
828
|
+
const getAgent = () => this.agents.get(sessionRef.id);
|
|
819
829
|
const toolStates = new Map();
|
|
820
830
|
return {
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
831
|
+
callbacks: {
|
|
832
|
+
onAssistantContentUpdated: (chunk) => {
|
|
833
|
+
this.connection.sessionUpdate({
|
|
834
|
+
sessionId: sessionRef.id,
|
|
835
|
+
update: {
|
|
836
|
+
sessionUpdate: "agent_message_chunk",
|
|
837
|
+
content: {
|
|
838
|
+
type: "text",
|
|
839
|
+
text: chunk,
|
|
840
|
+
},
|
|
829
841
|
},
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
842
|
+
});
|
|
843
|
+
},
|
|
844
|
+
onAssistantReasoningUpdated: (chunk) => {
|
|
845
|
+
this.connection.sessionUpdate({
|
|
846
|
+
sessionId: sessionRef.id,
|
|
847
|
+
update: {
|
|
848
|
+
sessionUpdate: "agent_thought_chunk",
|
|
849
|
+
content: {
|
|
850
|
+
type: "text",
|
|
851
|
+
text: chunk,
|
|
852
|
+
},
|
|
841
853
|
},
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
toolStates.set(id, state);
|
|
851
|
-
}
|
|
852
|
-
if (name)
|
|
853
|
-
state.name = name;
|
|
854
|
-
if (compactParams)
|
|
855
|
-
state.compactParams = compactParams;
|
|
856
|
-
if (shortResult)
|
|
857
|
-
state.shortResult = shortResult;
|
|
858
|
-
if (startLineNumber !== undefined)
|
|
859
|
-
state.startLineNumber = startLineNumber;
|
|
860
|
-
const effectiveName = state.name || name;
|
|
861
|
-
const effectiveCompactParams = state.compactParams || compactParams;
|
|
862
|
-
const effectiveShortResult = state.shortResult || shortResult;
|
|
863
|
-
const effectiveStartLineNumber = state.startLineNumber !== undefined
|
|
864
|
-
? state.startLineNumber
|
|
865
|
-
: startLineNumber;
|
|
866
|
-
const displayTitle = effectiveName && effectiveCompactParams
|
|
867
|
-
? `${effectiveName}: ${effectiveCompactParams}`
|
|
868
|
-
: effectiveName || "Tool Call";
|
|
869
|
-
let parsedParameters = undefined;
|
|
870
|
-
if (parameters) {
|
|
871
|
-
try {
|
|
872
|
-
const parsed = JSON.parse(parameters);
|
|
873
|
-
parsedParameters = Array.isArray(parsed)
|
|
874
|
-
? { args: parsed }
|
|
875
|
-
: parsed;
|
|
854
|
+
});
|
|
855
|
+
},
|
|
856
|
+
onToolBlockUpdated: (params) => {
|
|
857
|
+
const { id, name, stage, success, error, result, parameters, compactParams, shortResult, startLineNumber, } = params;
|
|
858
|
+
let state = toolStates.get(id);
|
|
859
|
+
if (!state) {
|
|
860
|
+
state = {};
|
|
861
|
+
toolStates.set(id, state);
|
|
876
862
|
}
|
|
877
|
-
|
|
878
|
-
|
|
863
|
+
if (name)
|
|
864
|
+
state.name = name;
|
|
865
|
+
if (compactParams)
|
|
866
|
+
state.compactParams = compactParams;
|
|
867
|
+
if (shortResult)
|
|
868
|
+
state.shortResult = shortResult;
|
|
869
|
+
if (startLineNumber !== undefined)
|
|
870
|
+
state.startLineNumber = startLineNumber;
|
|
871
|
+
const effectiveName = state.name || name;
|
|
872
|
+
const effectiveCompactParams = state.compactParams || compactParams;
|
|
873
|
+
const effectiveShortResult = state.shortResult || shortResult;
|
|
874
|
+
const effectiveStartLineNumber = state.startLineNumber !== undefined
|
|
875
|
+
? state.startLineNumber
|
|
876
|
+
: startLineNumber;
|
|
877
|
+
const displayTitle = effectiveName && effectiveCompactParams
|
|
878
|
+
? `${effectiveName}: ${effectiveCompactParams}`
|
|
879
|
+
: effectiveName || "Tool Call";
|
|
880
|
+
let parsedParameters = undefined;
|
|
881
|
+
if (parameters) {
|
|
882
|
+
try {
|
|
883
|
+
const parsed = JSON.parse(parameters);
|
|
884
|
+
parsedParameters = Array.isArray(parsed)
|
|
885
|
+
? { args: parsed }
|
|
886
|
+
: parsed;
|
|
887
|
+
}
|
|
888
|
+
catch {
|
|
889
|
+
// Ignore parse errors during streaming
|
|
890
|
+
}
|
|
879
891
|
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
892
|
+
const content = effectiveName && (parsedParameters || effectiveShortResult)
|
|
893
|
+
? this.getToolContent(effectiveName, parsedParameters, effectiveShortResult)
|
|
894
|
+
: undefined;
|
|
895
|
+
const locations = effectiveName && parsedParameters
|
|
896
|
+
? this.getToolLocations(effectiveName, parsedParameters, effectiveStartLineNumber)
|
|
897
|
+
: undefined;
|
|
898
|
+
const kind = effectiveName
|
|
899
|
+
? this.getToolKind(effectiveName)
|
|
900
|
+
: undefined;
|
|
901
|
+
if (stage === "start") {
|
|
902
|
+
this.connection.sessionUpdate({
|
|
903
|
+
sessionId: sessionRef.id,
|
|
904
|
+
update: {
|
|
905
|
+
sessionUpdate: "tool_call",
|
|
906
|
+
toolCallId: id,
|
|
907
|
+
title: displayTitle,
|
|
908
|
+
status: "pending",
|
|
909
|
+
content,
|
|
910
|
+
locations,
|
|
911
|
+
kind,
|
|
912
|
+
rawInput: parsedParameters,
|
|
913
|
+
},
|
|
914
|
+
});
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
if (stage === "streaming") {
|
|
918
|
+
// We don't support streaming tool arguments in ACP yet
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
const status = stage === "end"
|
|
922
|
+
? success
|
|
923
|
+
? "completed"
|
|
924
|
+
: "failed"
|
|
925
|
+
: stage === "running"
|
|
926
|
+
? "in_progress"
|
|
927
|
+
: "pending";
|
|
891
928
|
this.connection.sessionUpdate({
|
|
892
|
-
sessionId:
|
|
929
|
+
sessionId: sessionRef.id,
|
|
893
930
|
update: {
|
|
894
|
-
sessionUpdate: "
|
|
931
|
+
sessionUpdate: "tool_call_update",
|
|
895
932
|
toolCallId: id,
|
|
933
|
+
status,
|
|
896
934
|
title: displayTitle,
|
|
897
|
-
|
|
935
|
+
rawOutput: result || error,
|
|
898
936
|
content,
|
|
899
937
|
locations,
|
|
900
938
|
kind,
|
|
901
939
|
rawInput: parsedParameters,
|
|
902
940
|
},
|
|
903
941
|
});
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
const status = stage === "end"
|
|
911
|
-
? success
|
|
912
|
-
? "completed"
|
|
913
|
-
: "failed"
|
|
914
|
-
: stage === "running"
|
|
915
|
-
? "in_progress"
|
|
916
|
-
: "pending";
|
|
917
|
-
this.connection.sessionUpdate({
|
|
918
|
-
sessionId: sessionId,
|
|
919
|
-
update: {
|
|
920
|
-
sessionUpdate: "tool_call_update",
|
|
921
|
-
toolCallId: id,
|
|
922
|
-
status,
|
|
923
|
-
title: displayTitle,
|
|
924
|
-
rawOutput: result || error,
|
|
925
|
-
content,
|
|
926
|
-
locations,
|
|
927
|
-
kind,
|
|
928
|
-
rawInput: parsedParameters,
|
|
929
|
-
},
|
|
930
|
-
});
|
|
931
|
-
if (stage === "end") {
|
|
932
|
-
toolStates.delete(id);
|
|
933
|
-
}
|
|
934
|
-
},
|
|
935
|
-
onTasksChange: (tasks) => {
|
|
936
|
-
this.taskCache.set(sessionId, tasks);
|
|
937
|
-
this.connection.sessionUpdate({
|
|
938
|
-
sessionId: sessionId,
|
|
939
|
-
update: {
|
|
940
|
-
sessionUpdate: "plan",
|
|
941
|
-
entries: tasks
|
|
942
|
-
.filter((t) => t.status !== "deleted")
|
|
943
|
-
.map((task) => ({
|
|
944
|
-
content: task.subject,
|
|
945
|
-
status: task.status === "completed"
|
|
946
|
-
? "completed"
|
|
947
|
-
: task.status === "in_progress"
|
|
948
|
-
? "in_progress"
|
|
949
|
-
: "pending",
|
|
950
|
-
priority: "medium",
|
|
951
|
-
})),
|
|
952
|
-
},
|
|
953
|
-
});
|
|
954
|
-
},
|
|
955
|
-
onPermissionModeChange: (mode) => {
|
|
956
|
-
this.connection.sessionUpdate({
|
|
957
|
-
sessionId: sessionId,
|
|
958
|
-
update: {
|
|
959
|
-
sessionUpdate: "current_mode_update",
|
|
960
|
-
currentModeId: mode,
|
|
961
|
-
},
|
|
962
|
-
});
|
|
963
|
-
const agent = getAgent();
|
|
964
|
-
if (agent) {
|
|
942
|
+
if (stage === "end") {
|
|
943
|
+
toolStates.delete(id);
|
|
944
|
+
}
|
|
945
|
+
},
|
|
946
|
+
onTasksChange: (tasks) => {
|
|
947
|
+
this.taskCache.set(sessionRef.id, tasks);
|
|
965
948
|
this.connection.sessionUpdate({
|
|
966
|
-
sessionId:
|
|
949
|
+
sessionId: sessionRef.id,
|
|
967
950
|
update: {
|
|
968
|
-
sessionUpdate: "
|
|
969
|
-
|
|
951
|
+
sessionUpdate: "plan",
|
|
952
|
+
entries: tasks
|
|
953
|
+
.filter((t) => t.status !== "deleted")
|
|
954
|
+
.map((task) => ({
|
|
955
|
+
content: task.subject,
|
|
956
|
+
status: task.status === "completed"
|
|
957
|
+
? "completed"
|
|
958
|
+
: task.status === "in_progress"
|
|
959
|
+
? "in_progress"
|
|
960
|
+
: "pending",
|
|
961
|
+
priority: "medium",
|
|
962
|
+
})),
|
|
970
963
|
},
|
|
971
964
|
});
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
onModelChange: () => {
|
|
975
|
-
const agent = getAgent();
|
|
976
|
-
if (agent) {
|
|
965
|
+
},
|
|
966
|
+
onPermissionModeChange: (mode) => {
|
|
977
967
|
this.connection.sessionUpdate({
|
|
978
|
-
sessionId:
|
|
968
|
+
sessionId: sessionRef.id,
|
|
979
969
|
update: {
|
|
980
|
-
sessionUpdate: "
|
|
981
|
-
|
|
970
|
+
sessionUpdate: "current_mode_update",
|
|
971
|
+
currentModeId: mode,
|
|
982
972
|
},
|
|
983
973
|
});
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
974
|
+
const agent = getAgent();
|
|
975
|
+
if (agent) {
|
|
976
|
+
this.connection.sessionUpdate({
|
|
977
|
+
sessionId: sessionRef.id,
|
|
978
|
+
update: {
|
|
979
|
+
sessionUpdate: "config_option_update",
|
|
980
|
+
configOptions: this.getSessionConfigOptions(agent),
|
|
981
|
+
},
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
onModelChange: () => {
|
|
986
|
+
const agent = getAgent();
|
|
987
|
+
if (agent) {
|
|
988
|
+
this.connection.sessionUpdate({
|
|
989
|
+
sessionId: sessionRef.id,
|
|
990
|
+
update: {
|
|
991
|
+
sessionUpdate: "config_option_update",
|
|
992
|
+
configOptions: this.getSessionConfigOptions(agent),
|
|
993
|
+
},
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
},
|
|
997
|
+
onUserMessageAdded: (params) => {
|
|
997
998
|
this.connection.sessionUpdate({
|
|
998
|
-
sessionId:
|
|
999
|
+
sessionId: sessionRef.id,
|
|
999
1000
|
update: {
|
|
1000
|
-
sessionUpdate: "
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1001
|
+
sessionUpdate: "user_message_chunk",
|
|
1002
|
+
content: { type: "text", text: params.content },
|
|
1003
|
+
},
|
|
1004
|
+
});
|
|
1005
|
+
},
|
|
1006
|
+
onMcpServersChange: (servers) => {
|
|
1007
|
+
for (const server of servers) {
|
|
1008
|
+
this.connection.sessionUpdate({
|
|
1009
|
+
sessionId: sessionRef.id,
|
|
1010
|
+
update: {
|
|
1011
|
+
sessionUpdate: "ext_notification",
|
|
1012
|
+
method: "mcp_server_status",
|
|
1013
|
+
params: {
|
|
1014
|
+
name: server.name,
|
|
1015
|
+
status: server.status,
|
|
1016
|
+
toolCount: server.toolCount,
|
|
1017
|
+
error: server.error,
|
|
1018
|
+
},
|
|
1007
1019
|
},
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
},
|
|
1023
|
+
onSessionIdChange: (newSessionId) => {
|
|
1024
|
+
const oldSessionId = sessionRef.id;
|
|
1025
|
+
if (oldSessionId === newSessionId)
|
|
1026
|
+
return;
|
|
1027
|
+
// Update agents Map key
|
|
1028
|
+
const agent = this.agents.get(oldSessionId);
|
|
1029
|
+
if (agent) {
|
|
1030
|
+
this.agents.delete(oldSessionId);
|
|
1031
|
+
this.agents.set(newSessionId, agent);
|
|
1032
|
+
}
|
|
1033
|
+
// Update taskCache key
|
|
1034
|
+
const tasks = this.taskCache.get(oldSessionId);
|
|
1035
|
+
if (tasks) {
|
|
1036
|
+
this.taskCache.delete(oldSessionId);
|
|
1037
|
+
this.taskCache.set(newSessionId, tasks);
|
|
1038
|
+
}
|
|
1039
|
+
// Update ref so all subsequent callbacks use new ID
|
|
1040
|
+
sessionRef.id = newSessionId;
|
|
1041
|
+
// Notify ACP client
|
|
1042
|
+
this.connection.sessionUpdate({
|
|
1043
|
+
sessionId: oldSessionId,
|
|
1044
|
+
update: {
|
|
1045
|
+
sessionUpdate: "ext_notification",
|
|
1046
|
+
method: "session_id_change",
|
|
1047
|
+
params: { oldSessionId, newSessionId },
|
|
1008
1048
|
},
|
|
1009
1049
|
});
|
|
1010
|
-
}
|
|
1050
|
+
},
|
|
1011
1051
|
},
|
|
1052
|
+
sessionRef,
|
|
1012
1053
|
};
|
|
1013
1054
|
}
|
|
1014
1055
|
}
|
|
@@ -1 +1 @@
|
|
|
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,K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AAK,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"}
|
|
@@ -21,7 +21,7 @@ import { useChat } from "../contexts/useChat.js";
|
|
|
21
21
|
export const INPUT_PLACEHOLDER_TEXT = "Type your message (use /help for more info)...";
|
|
22
22
|
export const INPUT_PLACEHOLDER_TEXT_PREFIX = INPUT_PLACEHOLDER_TEXT.substring(0, 10);
|
|
23
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();
|
|
24
|
+
const { permissionMode: chatPermissionMode, setPermissionMode: setChatPermissionMode, handleRewindSelect, backgroundCurrentTask, messages, getFullMessageThread, sessionId, workingDirectory, askBtw, clearMessages, compact, goalCommand, currentModel, configuredModels, setModel, recreateAgent, recallQueuedMessage, queuedMessages, } = useChat();
|
|
25
25
|
// Ref to hold setInputText so queue callbacks can access it before useInputManager returns
|
|
26
26
|
const setInputTextRef = useRef(() => { });
|
|
27
27
|
const hasQueuedMessages = (queuedMessages?.length ?? 0) > 0;
|
|
@@ -56,6 +56,9 @@ export const InputBox = ({ sendMessage = () => { }, abortMessage = () => { }, mc
|
|
|
56
56
|
setInputText, } = useInputManager({
|
|
57
57
|
onSendMessage: sendMessage,
|
|
58
58
|
onAskBtw: askBtw,
|
|
59
|
+
onClearMessages: clearMessages,
|
|
60
|
+
onCompact: compact,
|
|
61
|
+
onGoalCommand: goalCommand,
|
|
59
62
|
onHasSlashCommand: hasSlashCommand,
|
|
60
63
|
onAbortMessage: abortMessage,
|
|
61
64
|
onBackgroundCurrentTask: backgroundCurrentTask,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/constants/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,eAAO,MAAM,kBAAkB,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/constants/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,eAAO,MAAM,kBAAkB,EAAE,YAAY,EAsF5C,CAAC"}
|
|
@@ -65,4 +65,22 @@ export const AVAILABLE_COMMANDS = [
|
|
|
65
65
|
description: "View and manage workflow runs",
|
|
66
66
|
handler: () => { }, // Handler here won't be used, actual processing is in the hook
|
|
67
67
|
},
|
|
68
|
+
{
|
|
69
|
+
id: "clear",
|
|
70
|
+
name: "clear",
|
|
71
|
+
description: "Clear conversation history and reset session",
|
|
72
|
+
handler: () => { },
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "compact",
|
|
76
|
+
name: "compact",
|
|
77
|
+
description: "Compact conversation history to reduce context usage",
|
|
78
|
+
handler: () => { },
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "goal",
|
|
82
|
+
name: "goal",
|
|
83
|
+
description: "Set, check, or clear an autonomous goal for the session",
|
|
84
|
+
handler: () => { },
|
|
85
|
+
},
|
|
68
86
|
];
|
|
@@ -16,6 +16,9 @@ export interface ChatContextType {
|
|
|
16
16
|
mimeType: string;
|
|
17
17
|
}>, longTextMap?: Record<string, string>) => Promise<void>;
|
|
18
18
|
askBtw: (question: string) => Promise<string>;
|
|
19
|
+
clearMessages: () => Promise<void>;
|
|
20
|
+
compact: (instructions?: string) => Promise<void>;
|
|
21
|
+
goalCommand: (args?: string) => Promise<void>;
|
|
19
22
|
abortMessage: () => void;
|
|
20
23
|
recallQueuedMessage: () => QueuedMessage | null;
|
|
21
24
|
removeQueuedMessageById: (id: string) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChat.d.ts","sourceRoot":"","sources":["../../src/contexts/useChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EACf,cAAc,EACd,IAAI,EACJ,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAaxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;IAEtB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,oBAAoB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,cAAc,EAAE,aAAa,EAAE,CAAC;IAEhC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CACX,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,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KA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,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,oBAAoB,EAAE,MAAM,OAAO,CAAC;QAClC,QAAQ,EAAE,OAAO,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC,CAAC;IAEH,gBAAgB,EAAE,MAAM,OAAO,gBAAgB,EAAE,aAAa,CAAC;IAC/D,cAAc,EAAE,MAAM,OAAO,gBAAgB,EAAE,WAAW,CAAC;IAC3D,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,aAAa,EAAE,MAAM,IAAI,CAAC;IAE1B,yBAAyB,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnE,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAID,eAAO,MAAM,OAAO,uBAMnB,CAAC;AAEF,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA+uBpD,CAAC"}
|
package/dist/contexts/useChat.js
CHANGED
|
@@ -359,6 +359,24 @@ export const ChatProvider = ({ children, bypassPermissions, permissionMode: init
|
|
|
359
359
|
}
|
|
360
360
|
return await agentRef.current.askBtw(question);
|
|
361
361
|
}, []);
|
|
362
|
+
const clearMessages = useCallback(async () => {
|
|
363
|
+
await agentRef.current?.clearMessages();
|
|
364
|
+
}, []);
|
|
365
|
+
const compact = useCallback(async (instructions) => {
|
|
366
|
+
await agentRef.current?.compact(instructions);
|
|
367
|
+
}, []);
|
|
368
|
+
const goalCommand = useCallback(async (args) => {
|
|
369
|
+
const trimmed = args?.trim() ?? "";
|
|
370
|
+
if (!trimmed) {
|
|
371
|
+
await agentRef.current?.showGoalStatus();
|
|
372
|
+
}
|
|
373
|
+
else if (["clear", "stop", "off", "reset", "none", "cancel"].includes(trimmed)) {
|
|
374
|
+
await agentRef.current?.clearGoal();
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
await agentRef.current?.setGoal(trimmed);
|
|
378
|
+
}
|
|
379
|
+
}, []);
|
|
362
380
|
// Unified interrupt method, interrupt both AI messages and command execution
|
|
363
381
|
const abortMessage = useCallback(() => {
|
|
364
382
|
agentRef.current?.abortMessage();
|
|
@@ -534,6 +552,9 @@ export const ChatProvider = ({ children, bypassPermissions, permissionMode: init
|
|
|
534
552
|
sessionId,
|
|
535
553
|
sendMessage,
|
|
536
554
|
askBtw,
|
|
555
|
+
clearMessages,
|
|
556
|
+
compact,
|
|
557
|
+
goalCommand,
|
|
537
558
|
abortMessage,
|
|
538
559
|
recallQueuedMessage,
|
|
539
560
|
removeQueuedMessageById,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputManager.d.ts","sourceRoot":"","sources":["../../src/hooks/useInputManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAGL,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,cAAc,EACd,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,eAAe,GAC1B,YAAW,OAAO,CAAC,qBAAqB,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;+
|
|
1
|
+
{"version":3,"file":"useInputManager.d.ts","sourceRoot":"","sources":["../../src/hooks/useInputManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAGL,qBAAqB,EACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,cAAc,EACd,WAAW,EAEZ,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,eAAe,GAC1B,YAAW,OAAO,CAAC,qBAAqB,CAAM;;;;;;;;;;;;;;;;;;;;;;;;;;+BA4TA,MAAM;;;;;qCAoBA,MAAM;iCAIV,MAAM;;mCAQJ,MAAM;oCAK1C,MAAM;wCAQmC,MAAM;mCAIX,MAAM;mCAIN,MAAM;;sCAQH,MAAM;uCAK7C,MAAM;uCAMkC,WAAW;;iCASxD,MAAM;yCAcyC,OAAO;8BAIlB,OAAO;iCAIJ,OAAO;wBAIhB,OAAO;iCAIE,OAAO;gCAIR,OAAO;iCAIN,OAAO;iCAIP,OAAO;mCAIL,OAAO;8BAKhD,cAAc;2BAQX,OAAO,CAAC,OAAO,6BAA6B,EAAE,QAAQ,CAAC;0BAM1B,MAAM,YAAY,MAAM;2BAIvB,MAAM;;;8BAatC,MAAM;;uCA2BP,MAAM;;yBAYJ,MAAM,OACR,GAAG,mBACS,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,gBACxD,MAAM,IAAI;yBAtHY,MAAM;kCAIG,MAAM;;CAmOxD,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { searchFiles as searchFilesUtil, PromptHistoryManager, } from "wave-agen
|
|
|
4
4
|
import * as handlers from "../managers/inputHandlers.js";
|
|
5
5
|
export const useInputManager = (callbacks = {}) => {
|
|
6
6
|
const [state, dispatch] = useReducer(inputReducer, initialState);
|
|
7
|
-
const { onInputTextChange, onCursorPositionChange, onFileSelectorStateChange, onCommandSelectorStateChange, onHistorySearchStateChange, onBackgroundTaskManagerStateChange, onMcpManagerStateChange, onRewindManagerStateChange, onHelpStateChange, onStatusCommandStateChange, onPluginManagerStateChange, onModelSelectorStateChange, onWorkflowManagerStateChange, onImagesStateChange, onSendMessage, onHasSlashCommand, onAbortMessage, onBackgroundCurrentTask, onPermissionModeChange, onAskBtw, sessionId, workdir, getFullMessageThread, logger, hasQueuedMessages: hasQueuedMessagesProp, onRecallQueuedMessage, } = callbacks;
|
|
7
|
+
const { onInputTextChange, onCursorPositionChange, onFileSelectorStateChange, onCommandSelectorStateChange, onHistorySearchStateChange, onBackgroundTaskManagerStateChange, onMcpManagerStateChange, onRewindManagerStateChange, onHelpStateChange, onStatusCommandStateChange, onPluginManagerStateChange, onModelSelectorStateChange, onWorkflowManagerStateChange, onImagesStateChange, onSendMessage, onHasSlashCommand, onAbortMessage, onBackgroundCurrentTask, onPermissionModeChange, onAskBtw, sessionId, workdir, getFullMessageThread, logger, hasQueuedMessages: hasQueuedMessagesProp, onRecallQueuedMessage, onClearMessages, onCompact, onGoalCommand, } = callbacks;
|
|
8
8
|
// Handle debounced file search
|
|
9
9
|
useEffect(() => {
|
|
10
10
|
if (state.showFileSelector) {
|
|
@@ -165,6 +165,15 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
165
165
|
else if (command === "workflows") {
|
|
166
166
|
dispatch({ type: "SET_SHOW_WORKFLOW_MANAGER", payload: true });
|
|
167
167
|
}
|
|
168
|
+
else if (command === "clear") {
|
|
169
|
+
await onClearMessages?.();
|
|
170
|
+
}
|
|
171
|
+
else if (command === "compact") {
|
|
172
|
+
await onCompact?.(effect.args);
|
|
173
|
+
}
|
|
174
|
+
else if (command === "goal") {
|
|
175
|
+
await onGoalCommand?.(effect.args);
|
|
176
|
+
}
|
|
168
177
|
}
|
|
169
178
|
break;
|
|
170
179
|
case "RECALL_QUEUED_MESSAGE":
|
|
@@ -190,6 +199,9 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
190
199
|
logger,
|
|
191
200
|
onHasSlashCommand,
|
|
192
201
|
onRecallQueuedMessage,
|
|
202
|
+
onClearMessages,
|
|
203
|
+
onCompact,
|
|
204
|
+
onGoalCommand,
|
|
193
205
|
]);
|
|
194
206
|
useEffect(() => {
|
|
195
207
|
onFileSelectorStateChange?.(state.showFileSelector, state.filteredFiles, state.fileSearchQuery, state.atPosition);
|