@lih-x-x/kmr 1.0.45 → 1.0.46
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/cli.js +3 -3
- package/dist/index.js +34 -29
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6,9 +6,9 @@ async function checkUpdate() {
|
|
|
6
6
|
try {
|
|
7
7
|
const res = await fetch(`https://registry.npmjs.org/${"@lih-x-x/kmr"}/latest`, { signal: AbortSignal.timeout(3e3) });
|
|
8
8
|
const data = await res.json();
|
|
9
|
-
if (data.version && data.version !== "1.0.
|
|
9
|
+
if (data.version && data.version !== "1.0.46") {
|
|
10
10
|
console.log(`
|
|
11
|
-
\u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.
|
|
11
|
+
\u2B06\uFE0F \u65B0\u7248\u672C\u53EF\u7528: ${"1.0.46"} \u2192 ${data.version}`);
|
|
12
12
|
console.log(` \u8FD0\u884C npm install -g ${"@lih-x-x/kmr"} \u66F4\u65B0
|
|
13
13
|
`);
|
|
14
14
|
}
|
|
@@ -56,7 +56,7 @@ KMR\uFF08Key Meetings Record\uFF09\u2014 \u4F1A\u8BAE\u6316\u6398\u673A
|
|
|
56
56
|
kmr --help \u663E\u793A\u5E2E\u52A9
|
|
57
57
|
`);
|
|
58
58
|
} else if (command === "--version" || command === "-v") {
|
|
59
|
-
console.log("1.0.
|
|
59
|
+
console.log("1.0.46");
|
|
60
60
|
} else if (command === "list") {
|
|
61
61
|
const { loadConfig } = await import("./config-L2SVVMAR.js");
|
|
62
62
|
const { JsonStore } = await import("./jsonStore-AL73KEUG.js");
|
package/dist/index.js
CHANGED
|
@@ -664,46 +664,51 @@ var SessionManager = class {
|
|
|
664
664
|
const userDir = path2.join(this.sessionDir, userId);
|
|
665
665
|
fs2.mkdirSync(userDir, { recursive: true });
|
|
666
666
|
const agentCmd = this.getAgentCmd();
|
|
667
|
-
let sessionExists = false;
|
|
668
667
|
try {
|
|
669
668
|
const { stdout } = await execFileAsync("acpx", [agentCmd, "sessions", "list"], {
|
|
670
669
|
timeout: 1e4,
|
|
671
670
|
maxBuffer: 1024 * 1024,
|
|
672
671
|
env: getExecEnv()
|
|
673
672
|
});
|
|
674
|
-
|
|
673
|
+
const hasExisting = stdout.split("\n").some(
|
|
675
674
|
(line) => !line.includes("[closed]") && line.split(" ")[1]?.trim() === sessionName
|
|
676
675
|
);
|
|
676
|
+
if (hasExisting) {
|
|
677
|
+
console.log(`[session] \u53D1\u73B0\u6B8B\u7559 session: ${sessionName}\uFF0C\u5148\u5173\u95ED`);
|
|
678
|
+
try {
|
|
679
|
+
await execFileAsync("acpx", [agentCmd, "sessions", "close", sessionName], {
|
|
680
|
+
timeout: 1e4,
|
|
681
|
+
env: getExecEnv()
|
|
682
|
+
});
|
|
683
|
+
} catch {
|
|
684
|
+
}
|
|
685
|
+
}
|
|
677
686
|
} catch {
|
|
678
687
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
await
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
);
|
|
702
|
-
} catch (err) {
|
|
703
|
-
console.error(`[session] \u89D2\u8272\u8BBE\u5B9A\u5931\u8D25:`, err.message);
|
|
704
|
-
}
|
|
705
|
-
await this.trackNewPids(pidsBefore2);
|
|
688
|
+
console.log(`[session] \u521B\u5EFA\u65B0 session: ${sessionName}`);
|
|
689
|
+
const pidsBefore = await this.getAgentPids();
|
|
690
|
+
try {
|
|
691
|
+
await execFileAsync("acpx", [agentCmd, "sessions", "new", "--name", sessionName], {
|
|
692
|
+
timeout: this.timeout,
|
|
693
|
+
maxBuffer: 1024 * 1024,
|
|
694
|
+
env: getExecEnv()
|
|
695
|
+
});
|
|
696
|
+
} catch (err) {
|
|
697
|
+
console.error(`[session] \u521B\u5EFA session \u5931\u8D25:`, err.message);
|
|
698
|
+
throw new Error(`\u521B\u5EFA\u4F1A\u8BDD\u5931\u8D25: ${err.message}`);
|
|
699
|
+
}
|
|
700
|
+
await this.trackNewPids(pidsBefore);
|
|
701
|
+
const pidsBefore2 = await this.getAgentPids();
|
|
702
|
+
try {
|
|
703
|
+
await execFileAsync(
|
|
704
|
+
"acpx",
|
|
705
|
+
["--approve-all", agentCmd, "-s", sessionName, SESSION_SKILL],
|
|
706
|
+
{ timeout: this.timeout, maxBuffer: 1024 * 1024, env: getExecEnv() }
|
|
707
|
+
);
|
|
708
|
+
} catch (err) {
|
|
709
|
+
console.error(`[session] \u89D2\u8272\u8BBE\u5B9A\u5931\u8D25:`, err.message);
|
|
706
710
|
}
|
|
711
|
+
await this.trackNewPids(pidsBefore2);
|
|
707
712
|
this.activeSessions.set(userId, {
|
|
708
713
|
name: sessionName,
|
|
709
714
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|