@lih-x-x/kmr 1.0.9 → 1.0.10
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 +20 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -923,11 +923,27 @@ var SessionManager = class {
|
|
|
923
923
|
}
|
|
924
924
|
extractReply(output) {
|
|
925
925
|
const lines = output.split("\n");
|
|
926
|
-
const
|
|
926
|
+
const metaPrefixes = ["[client]", "[tool]", "[thinking]", "[done]", "[error]", "[warn]", "[info]"];
|
|
927
|
+
const blocks = [];
|
|
928
|
+
let current = [];
|
|
929
|
+
for (const line of lines) {
|
|
927
930
|
const t = line.trim();
|
|
928
|
-
|
|
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);
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
if (current.length > 0) {
|
|
941
|
+
blocks.push(current.join("\n").trim());
|
|
942
|
+
}
|
|
943
|
+
for (let i = blocks.length - 1; i >= 0; i--) {
|
|
944
|
+
if (blocks[i].length > 0) return blocks[i];
|
|
945
|
+
}
|
|
946
|
+
return output.trim();
|
|
931
947
|
}
|
|
932
948
|
async appendSummary(userId, userText, aiReply) {
|
|
933
949
|
const userDir = path5.join(this.sessionDir, userId);
|