libero3 0.3.0 → 0.3.2

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/data/db.js CHANGED
@@ -47,6 +47,10 @@ function runMigrations(db) {
47
47
  }
48
48
  }
49
49
  export function initDb(dbPath) {
50
+ // 2026-09-09:Host spawn 无 shell 不展开 ~,配置里 ~/... 会落到字面 ~ 目录(Windows 验证实测)。
51
+ dbPath = dbPath.startsWith("~/") || dbPath.startsWith("~\\")
52
+ ? join(homedir(), dbPath.slice(2))
53
+ : dbPath;
50
54
  if (instance) {
51
55
  instance.close();
52
56
  instance = null;
@@ -19,6 +19,17 @@ import { timerMinMinutes } from "./src/ap/rewards.js";
19
19
  import { FsYamlKnowledgeRepo } from "../knowledge/src/repo/fs-yaml.js";
20
20
  import { nowLocal, formatTime, parseTime } from "./src/clock/index.js";
21
21
  import { buildServerInstructions } from "./cold-start.js";
22
+ import { createRequire } from "node:module";
23
+ // serverInfo 自读 package.json:dev(tsx 下 mcp/ → ../) 与 dist(dist/mcp/ → ../../) 深度不同,两者择一
24
+ const pkgJson = (() => {
25
+ const req = createRequire(import.meta.url);
26
+ try {
27
+ return req("../../package.json");
28
+ }
29
+ catch {
30
+ return req("../package.json");
31
+ }
32
+ })();
22
33
  import { resolveUserId } from "./src/identity/resolve.js";
23
34
  import { profileIdForWrite } from "./src/identity/equivalent-ids.js";
24
35
  import { resolveDefaultUserId, logResolvedDefaultUserId, } from "./src/user-id-resolver.js";
@@ -1326,7 +1337,8 @@ export function createToolRuntime(db) {
1326
1337
  export function buildServer(db) {
1327
1338
  const { registry } = createToolRuntime(db);
1328
1339
  // instructions 必须放在第 2 参 ServerOptions(不是 serverInfo)—— SDK 只从 options 读
1329
- const server = new McpServer({ name: "libero-mcp", version: "0.2.3" }, { instructions: buildServerInstructions() });
1340
+ // serverInfo package.json 自读(2026-09-09 Windows 验证发现:写死 0.2.3 害人靠数工具判版本)
1341
+ const server = new McpServer({ name: pkgJson.name, version: pkgJson.version }, { instructions: buildServerInstructions() });
1330
1342
  for (const tool of registry) {
1331
1343
  server.registerTool(tool.name, { description: tool.description, inputSchema: tool.inputSchema }, tool.handler);
1332
1344
  }
@@ -27,17 +27,18 @@ function rowToProfile(row) {
27
27
  updated_at: row.updated_at,
28
28
  };
29
29
  }
30
- /** Platform default display_name: e.g. wecom:woqoa1b2xyz → wecom_2xyz */
30
+ /** Platform default display_name: e.g. wecom:woqoa1b2xyz → wecom_2xyz
31
+ * 2026-09-09 修复:短 id(≤8 字符,如 "libero")原样返回——取尾 4 位会截成 "bero"(WorkBuddy 实测)。 */
31
32
  export function platformDefaultDisplayName(platformUserId) {
33
+ const tail = (s) => (s.length > 8 ? s.slice(-4) : s);
32
34
  const colon = platformUserId.indexOf(":");
33
35
  if (colon > 0) {
34
36
  const platform = platformUserId.slice(0, colon);
35
37
  const rest = platformUserId.slice(colon + 1);
36
- const suffix = rest.slice(-4) || rest || "user";
38
+ const suffix = tail(rest) || "user";
37
39
  return `${platform}_${suffix}`;
38
40
  }
39
- const suffix = platformUserId.slice(-4) || platformUserId || "user";
40
- return suffix;
41
+ return tail(platformUserId) || "user";
41
42
  }
42
43
  /**
43
44
  * Exact match on display_name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libero3",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "AI 时间管理教练 MCP 工具集——时间块记录、统计、矩阵诊断、计时、分类、profile",
5
5
  "license": "MIT",
6
6
  "author": "amosyuan",