@yeaft/webchat-agent 0.1.574 → 0.1.576
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/index.js +18 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -57,10 +57,28 @@ function saveConfig(config) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
const fileConfig = loadConfig();
|
|
60
|
+
|
|
61
|
+
// task-fix (5-bugs): the Unify web-bridge reads `ctx.CONFIG.yeaftDir`
|
|
62
|
+
// for every group / VP / memory operation. If unset, `path.join(undefined, …)`
|
|
63
|
+
// throws `The "path" argument must be of type string. Received undefined`
|
|
64
|
+
// and the UI surfaces "群组操作失败: …" with a raw node error. Resolve the
|
|
65
|
+
// default (`~/.yeaft`) here and make sure the directory exists before the
|
|
66
|
+
// WebSocket connection goes live, so downstream code can assume a real path.
|
|
67
|
+
const YEAFT_DIR = process.env.YEAFT_DIR || fileConfig.yeaftDir || join(homedir(), '.yeaft');
|
|
68
|
+
try {
|
|
69
|
+
if (!existsSync(YEAFT_DIR)) {
|
|
70
|
+
mkdirSync(YEAFT_DIR, { recursive: true });
|
|
71
|
+
console.log(`[Agent] Created yeaft dir: ${YEAFT_DIR}`);
|
|
72
|
+
}
|
|
73
|
+
} catch (err) {
|
|
74
|
+
console.warn(`[Agent] Could not ensure yeaft dir ${YEAFT_DIR}: ${err?.message || err}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
60
77
|
const CONFIG = {
|
|
61
78
|
serverUrl: process.env.SERVER_URL || fileConfig.serverUrl,
|
|
62
79
|
agentName: process.env.AGENT_NAME || fileConfig.agentName,
|
|
63
80
|
workDir: process.env.WORK_DIR || fileConfig.workDir || process.cwd(),
|
|
81
|
+
yeaftDir: YEAFT_DIR,
|
|
64
82
|
reconnectInterval: fileConfig.reconnectInterval,
|
|
65
83
|
agentSecret: process.env.AGENT_SECRET || fileConfig.agentSecret,
|
|
66
84
|
// 显式禁用的工具(非 MCP 相关)
|