@lih-x-x/kmr 1.0.10 → 1.0.11
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/index.js +15 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -924,26 +924,23 @@ var SessionManager = class {
|
|
|
924
924
|
extractReply(output) {
|
|
925
925
|
const lines = output.split("\n");
|
|
926
926
|
const metaPrefixes = ["[client]", "[tool]", "[thinking]", "[done]", "[error]", "[warn]", "[info]"];
|
|
927
|
-
|
|
928
|
-
let
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
if (metaPrefixes.some((p) => t.startsWith(p))) {
|
|
932
|
-
if (current.length > 0) {
|
|
933
|
-
blocks.push(current.join("\n").trim());
|
|
934
|
-
current = [];
|
|
935
|
-
}
|
|
936
|
-
} else {
|
|
937
|
-
current.push(line);
|
|
927
|
+
let lastCompletedIdx = -1;
|
|
928
|
+
for (let i = 0; i < lines.length; i++) {
|
|
929
|
+
if (/\(completed\)/.test(lines[i])) {
|
|
930
|
+
lastCompletedIdx = i;
|
|
938
931
|
}
|
|
939
932
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
933
|
+
const startIdx = lastCompletedIdx >= 0 ? lastCompletedIdx + 1 : 0;
|
|
934
|
+
const reply = lines.slice(startIdx).filter((line) => {
|
|
935
|
+
const t = line.trim();
|
|
936
|
+
return t.length > 0 && !metaPrefixes.some((p) => t.startsWith(p));
|
|
937
|
+
}).join("\n").trim();
|
|
938
|
+
if (reply.length > 0) return reply;
|
|
939
|
+
const filtered = lines.filter((line) => {
|
|
940
|
+
const t = line.trim();
|
|
941
|
+
return t.length > 0 && !metaPrefixes.some((p) => t.startsWith(p));
|
|
942
|
+
}).join("\n").trim();
|
|
943
|
+
return filtered || output.trim();
|
|
947
944
|
}
|
|
948
945
|
async appendSummary(userId, userText, aiReply) {
|
|
949
946
|
const userDir = path5.join(this.sessionDir, userId);
|