@lih-x-x/kmr 1.0.11 → 1.0.13
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.
|
@@ -38,10 +38,19 @@ function loadConfig() {
|
|
|
38
38
|
const raw = fs.readFileSync(configPath, "utf-8");
|
|
39
39
|
return JSON.parse(raw);
|
|
40
40
|
}
|
|
41
|
+
function getAgentProvider() {
|
|
42
|
+
try {
|
|
43
|
+
const config = loadConfig();
|
|
44
|
+
return config.agent.provider || "claude-code";
|
|
45
|
+
} catch {
|
|
46
|
+
return "claude-code";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
41
49
|
|
|
42
50
|
export {
|
|
43
51
|
getKmrDir,
|
|
44
52
|
KMR_DIR,
|
|
45
53
|
initConfig,
|
|
46
|
-
loadConfig
|
|
54
|
+
loadConfig,
|
|
55
|
+
getAgentProvider
|
|
47
56
|
};
|
package/dist/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ async function checkUpdate() {
|
|
|
20
20
|
}
|
|
21
21
|
var command = argv[2];
|
|
22
22
|
if (command === "init") {
|
|
23
|
-
const { initConfig, getKmrDir } = await import("./config-
|
|
23
|
+
const { initConfig, getKmrDir } = await import("./config-RQEJ5HZN.js");
|
|
24
24
|
const path = await import("path");
|
|
25
25
|
const kmrDir = getKmrDir();
|
|
26
26
|
console.log(`\u521D\u59CB\u5316 KMR \u914D\u7F6E\u76EE\u5F55: ${kmrDir}`);
|
|
@@ -32,22 +32,25 @@ if (command === "init") {
|
|
|
32
32
|
console.log("\n\u914D\u7F6E\u5B8C\u6210\u540E\u8FD0\u884C kmr \u542F\u52A8\u670D\u52A1");
|
|
33
33
|
} else if (command === "--help" || command === "-h") {
|
|
34
34
|
console.log(`
|
|
35
|
-
KMR\uFF08Key Meetings Record\uFF09\u2014 \
|
|
36
|
-
|
|
37
|
-
\u7528\u6CD5:
|
|
38
|
-
kmr \u542F\u52A8\u670D\u52A1\uFF08\u98DE\u4E66\u673A\u5668\u4EBA + Web \u7BA1\u7406\u754C\u9762\uFF09
|
|
39
|
-
kmr init \u521D\u59CB\u5316\u914D\u7F6E\u76EE\u5F55 ~/.kmr/
|
|
40
|
-
kmr --help \u663E\u793A\u5E2E\u52A9
|
|
35
|
+
KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
|
|
41
36
|
|
|
42
37
|
\u524D\u7F6E\u6761\u4EF6:
|
|
43
38
|
- acpx \u5DF2\u5168\u5C40\u5B89\u88C5\uFF08npm install -g acpx@latest\uFF09
|
|
44
|
-
|
|
45
|
-
- \
|
|
39
|
+
- \u9A8C\u8BC1acpx\u662F\u5426\u53EF\u7528: \u8FD0\u884C "acpx --version" \u8F93\u51FA\u7248\u672C\u53F7
|
|
40
|
+
- Claude Code/Codex\u7B49agent \u53EF\u901A\u8FC7 acpx \u8C03\u7528
|
|
41
|
+
- \u9A8C\u8BC1claude\u662F\u5426\u53EF\u7528: \u8FD0\u884C "acpx claude status" \u8F93\u51FA\u72B6\u6001\u4FE1\u606F, \u8FD0\u884C "acpx claude exec 'say hello'" \u8F93\u51FA\u6D4B\u8BD5\u7ED3\u679C
|
|
42
|
+
- \u9A8C\u8BC1codex\u662F\u5426\u53EF\u7528: \u8FD0\u884C "acpx codex status" \u8F93\u51FA\u72B6\u6001\u4FE1\u606F, \u8FD0\u884C "acpx codex exec 'say hello'" \u8F93\u51FA\u6D4B\u8BD5\u7ED3\u679C
|
|
43
|
+
- \u98DE\u4E66\u81EA\u5EFA\u5E94\u7528\u5DF2\u521B\u5EFA\u5E76\u914D\u7F6E\u6743\u9650,\u5F00\u542F\u957F\u8FDE\u63A5\u56DE\u8C03
|
|
46
44
|
|
|
47
45
|
\u5FEB\u901F\u5F00\u59CB:
|
|
48
46
|
1. kmr init
|
|
49
|
-
2. \u7F16\u8F91 ~/.kmr/config.json \u586B\u5165\u98DE\u4E66\u51ED\u8BC1
|
|
47
|
+
2. \u7F16\u8F91 ~/.kmr/config.json \u586B\u5165\u98DE\u4E66\u51ED\u8BC1, agent\u914D\u7F6E(\u9ED8\u8BA4\u662Fclaude)
|
|
50
48
|
3. kmr
|
|
49
|
+
|
|
50
|
+
\u7528\u6CD5:
|
|
51
|
+
kmr init \u521D\u59CB\u5316\u914D\u7F6E\u76EE\u5F55 ~/.kmr/
|
|
52
|
+
kmr --help \u663E\u793A\u5E2E\u52A9
|
|
53
|
+
kmr \u542F\u52A8\u670D\u52A1\uFF08\u98DE\u4E66\u673A\u5668\u4EBA + Web \u7BA1\u7406\u754C\u9762\uFF09
|
|
51
54
|
`);
|
|
52
55
|
} else if (command === "--version" || command === "-v") {
|
|
53
56
|
const { createRequire } = await import("module");
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KMR_DIR,
|
|
3
|
+
getAgentProvider,
|
|
3
4
|
loadConfig
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-HN3ZXS6B.js";
|
|
5
6
|
|
|
6
7
|
// src/lark/client.ts
|
|
7
8
|
import * as lark from "@larksuiteoapi/node-sdk";
|
|
@@ -485,8 +486,11 @@ ${prompt}
|
|
|
485
486
|
return rankedIds.map((id) => indexed.get(id)).filter(Boolean);
|
|
486
487
|
}
|
|
487
488
|
async callAcpx(prompt) {
|
|
489
|
+
const provider = getAgentProvider();
|
|
490
|
+
const agentCmd = provider === "codex" ? "codex" : "claude";
|
|
491
|
+
console.log(`[agent] \u4F7F\u7528 ${agentCmd} \u6267\u884C\u63D0\u53D6`);
|
|
488
492
|
try {
|
|
489
|
-
const { stdout } = await execFileAsync("acpx", ["--allowed-tools", "",
|
|
493
|
+
const { stdout } = await execFileAsync("acpx", ["--allowed-tools", "", agentCmd, "exec", prompt], {
|
|
490
494
|
timeout: this.timeout,
|
|
491
495
|
maxBuffer: 1024 * 1024,
|
|
492
496
|
env: getExecEnv()
|
|
@@ -868,6 +872,10 @@ var SessionManager = class {
|
|
|
868
872
|
await this.appendSummary(userId, text, reply);
|
|
869
873
|
return reply;
|
|
870
874
|
}
|
|
875
|
+
getAgentCmd() {
|
|
876
|
+
const provider = getAgentProvider();
|
|
877
|
+
return provider === "codex" ? "codex" : "claude";
|
|
878
|
+
}
|
|
871
879
|
async ensureSession(userId) {
|
|
872
880
|
const existing = this.activeSessions.get(userId);
|
|
873
881
|
if (existing) {
|
|
@@ -880,8 +888,9 @@ var SessionManager = class {
|
|
|
880
888
|
const skillPath = path5.join(userDir, "skill.md");
|
|
881
889
|
fs5.writeFileSync(skillPath, SESSION_SKILL, "utf-8");
|
|
882
890
|
console.log(`[session] \u521B\u5EFA\u65B0 session: ${sessionName}`);
|
|
891
|
+
const agentCmd = this.getAgentCmd();
|
|
883
892
|
try {
|
|
884
|
-
await execFileAsync2("acpx", [
|
|
893
|
+
await execFileAsync2("acpx", [agentCmd, "sessions", "ensure", "--name", sessionName], {
|
|
885
894
|
timeout: this.timeout,
|
|
886
895
|
maxBuffer: 1024 * 1024,
|
|
887
896
|
env: getExecEnv()
|
|
@@ -894,7 +903,7 @@ var SessionManager = class {
|
|
|
894
903
|
try {
|
|
895
904
|
await execFileAsync2(
|
|
896
905
|
"acpx",
|
|
897
|
-
["--approve-all",
|
|
906
|
+
["--approve-all", agentCmd, "-s", sessionName, SESSION_SKILL],
|
|
898
907
|
{ timeout: this.timeout, maxBuffer: 1024 * 1024, env: getExecEnv() }
|
|
899
908
|
);
|
|
900
909
|
} catch (err) {
|
|
@@ -907,10 +916,11 @@ var SessionManager = class {
|
|
|
907
916
|
return sessionName;
|
|
908
917
|
}
|
|
909
918
|
async sendToSession(sessionName, text) {
|
|
919
|
+
const agentCmd = this.getAgentCmd();
|
|
910
920
|
try {
|
|
911
921
|
const { stdout } = await execFileAsync2(
|
|
912
922
|
"acpx",
|
|
913
|
-
["--approve-all",
|
|
923
|
+
["--approve-all", agentCmd, "-s", sessionName, text],
|
|
914
924
|
{ timeout: this.timeout, maxBuffer: 1024 * 1024, env: getExecEnv() }
|
|
915
925
|
);
|
|
916
926
|
return this.extractReply(stdout);
|
|
@@ -924,23 +934,31 @@ var SessionManager = class {
|
|
|
924
934
|
extractReply(output) {
|
|
925
935
|
const lines = output.split("\n");
|
|
926
936
|
const metaPrefixes = ["[client]", "[tool]", "[thinking]", "[done]", "[error]", "[warn]", "[info]"];
|
|
927
|
-
let
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
937
|
+
let endIdx = lines.length - 1;
|
|
938
|
+
while (endIdx >= 0) {
|
|
939
|
+
const t = lines[endIdx].trim();
|
|
940
|
+
if (t.length === 0 || metaPrefixes.some((p) => t.startsWith(p))) {
|
|
941
|
+
endIdx--;
|
|
942
|
+
} else {
|
|
943
|
+
break;
|
|
931
944
|
}
|
|
932
945
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
946
|
+
if (endIdx < 0) return output.trim();
|
|
947
|
+
let startIdx = endIdx;
|
|
948
|
+
while (startIdx > 0) {
|
|
949
|
+
const prevLine = lines[startIdx - 1];
|
|
950
|
+
const prevTrimmed = prevLine.trim();
|
|
951
|
+
const isToolOrMeta = metaPrefixes.some((p) => prevTrimmed.startsWith(p)) || /^\s{2,}(kind|input|output):/.test(prevLine) || /\(completed\)/.test(prevLine) || /^\s{2,}```/.test(prevLine) || prevLine.startsWith(" ") && /^\s{2,}\S/.test(prevLine);
|
|
952
|
+
if (isToolOrMeta) break;
|
|
953
|
+
if (prevTrimmed.length === 0) {
|
|
954
|
+
startIdx--;
|
|
955
|
+
continue;
|
|
956
|
+
}
|
|
957
|
+
startIdx--;
|
|
958
|
+
}
|
|
959
|
+
const reply = lines.slice(startIdx, endIdx + 1).join("\n").trim();
|
|
938
960
|
if (reply.length > 0) return reply;
|
|
939
|
-
|
|
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();
|
|
961
|
+
return output.trim();
|
|
944
962
|
}
|
|
945
963
|
async appendSummary(userId, userText, aiReply) {
|
|
946
964
|
const userDir = path5.join(this.sessionDir, userId);
|
|
@@ -956,7 +974,8 @@ var SessionManager = class {
|
|
|
956
974
|
const info = this.activeSessions.get(userId);
|
|
957
975
|
if (!info) return;
|
|
958
976
|
try {
|
|
959
|
-
|
|
977
|
+
const agentCmd = this.getAgentCmd();
|
|
978
|
+
await execFileAsync2("acpx", [agentCmd, "sessions", "close", info.name], {
|
|
960
979
|
timeout: 1e4,
|
|
961
980
|
env: getExecEnv()
|
|
962
981
|
});
|
package/dist/public/app.js
CHANGED
|
@@ -285,6 +285,7 @@ async function renderSettings() {
|
|
|
285
285
|
'<label class="form-label">Provider</label>' +
|
|
286
286
|
'<select class="form-select" id="cfg-provider">' +
|
|
287
287
|
'<option value="claude-code"' + (config.agent.provider === 'claude-code' ? ' selected' : '') + '>Claude Code</option>' +
|
|
288
|
+
'<option value="codex"' + (config.agent.provider === 'codex' ? ' selected' : '') + '>Codex</option>' +
|
|
288
289
|
'</select>' +
|
|
289
290
|
'</div>' +
|
|
290
291
|
'<div class="form-field">' +
|