u1s1-cli 0.19.4 → 0.19.5

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.
@@ -1,5 +1,6 @@
1
1
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
- import { join } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { dirname, join } from "node:path";
3
4
  import { agentDir, CUSTOM_ENDPOINTS, ENDPOINT_ID_RE, endpointKeyEnvName, MODELS, PROVIDER_ID, VERSION, } from "./config.js";
4
5
  const BRAND_APPEND = `## u1s1
5
6
 
@@ -50,6 +51,21 @@ export function ensureBrandPrompt(shell) {
50
51
  writeFileSync(p, content);
51
52
  }
52
53
  }
54
+ /**
55
+ * 当前捆绑的 pi 引擎版本号。pi 的包 exports 只有 "import" 条目,
56
+ * require.resolve 会报 ERR_PACKAGE_PATH_NOT_EXPORTED,必须走
57
+ * import.meta.resolve;拿到入口文件(dist/index.js)后向上一级找包根。
58
+ */
59
+ function bundledPiVersion() {
60
+ try {
61
+ const entry = fileURLToPath(import.meta.resolve("@earendil-works/pi-coding-agent"));
62
+ const pkg = JSON.parse(readFileSync(join(dirname(entry), "..", "package.json"), "utf8"));
63
+ return typeof pkg.version === "string" ? pkg.version : undefined;
64
+ }
65
+ catch {
66
+ return undefined;
67
+ }
68
+ }
53
69
  /** Defaults that don't overwrite values the user already set. */
54
70
  export function ensureDefaultSettings() {
55
71
  mkdirSync(agentDir, { recursive: true });
@@ -105,6 +121,16 @@ export function ensureDefaultSettings() {
105
121
  delete settings.theme;
106
122
  changed = true;
107
123
  }
124
+ // 屏蔽 pi 引擎的启动更新日志(What's New):那是上游英文 changelog,且 pi 的
125
+ // 版本号体系(0.84.x)和 u1s1(0.19.x)完全对不上——settings 里「上次看到的
126
+ // 版本」一旦缺失或偏旧,升级后启动会一次性灌出几十条英文更新说明。
127
+ // u1s1 的版本动态走公告横幅和 u1s1 update,这里每次启动都把该记录钉死在
128
+ // 当前捆绑的引擎版本上,保证启动时永不弹 changelog。
129
+ const piVersion = bundledPiVersion();
130
+ if (piVersion && settings["lastChangelogVersion"] !== piVersion) {
131
+ settings["lastChangelogVersion"] = piVersion;
132
+ changed = true;
133
+ }
108
134
  if (changed)
109
135
  writeFileSync(p, JSON.stringify(settings, null, 2) + "\n");
110
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u1s1-cli",
3
- "version": "0.19.4",
3
+ "version": "0.19.5",
4
4
  "description": "u1s1 — 有一说一,最省心的 AI 编程搭子。终端里用中文说需求,AI 帮你读文件、改代码、跑命令。",
5
5
  "type": "module",
6
6
  "bin": {