@saltpub/xiaojiu-agent-bridge 0.1.7 → 0.1.8

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/launcher.js CHANGED
@@ -22,6 +22,11 @@ var logFile = join(updateDir, "launcher.log");
22
22
  var MAX_BOOT_ATTEMPTS = 2;
23
23
  var CRASH_BACKOFF_MS = 5e3;
24
24
  var BOOT_FAIL_MAX_BACKOFF_MS = 6e4;
25
+ var BOOT_READY_TIMEOUT_MS = 9e4;
26
+ function readBootReadyTimeoutMs(env = process.env) {
27
+ const raw = Number(env.XIAOJIU_BRIDGE_BOOT_TIMEOUT_MS);
28
+ return Number.isSafeInteger(raw) && raw > 0 ? raw : BOOT_READY_TIMEOUT_MS;
29
+ }
25
30
  function logline(message) {
26
31
  try {
27
32
  mkdirSync(updateDir, { recursive: true });
@@ -123,11 +128,29 @@ async function main() {
123
128
  [ENV_BOOT_FILE]: bootFile
124
129
  }
125
130
  });
131
+ const bootReadyTimeoutMs = readBootReadyTimeoutMs();
132
+ const deadline = setTimeout(() => {
133
+ const after2 = readJson(bootFile);
134
+ if (after2?.version === current.version && after2.ready === true) return;
135
+ logline(`child not ready after ${bootReadyTimeoutMs}ms; killing the wedged boot`);
136
+ try {
137
+ child?.kill("SIGTERM");
138
+ } catch {
139
+ }
140
+ setTimeout(() => {
141
+ try {
142
+ child?.kill("SIGKILL");
143
+ } catch {
144
+ }
145
+ }, 5e3).unref();
146
+ }, bootReadyTimeoutMs);
147
+ deadline.unref?.();
126
148
  const code = await new Promise((resolve) => {
127
149
  child?.on("exit", (exitCode, signal) => {
128
150
  resolve(exitCode ?? (signal ? 1 : 0));
129
151
  });
130
152
  });
153
+ clearTimeout(deadline);
131
154
  child = void 0;
132
155
  if (quitting) process.exit(0);
133
156
  if (code === SWITCH_EXIT_CODE) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltpub/xiaojiu-agent-bridge",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Bridge Xiaojiu IM with local CLI coding agents",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.33.0",
@@ -112,7 +112,8 @@
112
112
  "schemaVersion": 1,
113
113
  "channel": "stable",
114
114
  "highlights": [
115
- "后台自动更新:daemon 托管安装改为稳定 launcher + 旁路版本目录(versions/<x.y.z>),每 6h 检查 npm、空闲窗口切换、健康检查失败自动回滚;旧 daemon 首次启动自动迁移;`update` 命令在 launcher 模式下走同一 stage 路径。`update.autoUpdate: false` 或 `XIAOJIU_BRIDGE_NO_UPDATE_CHECK=1` 可关闭。"
115
+ "launcher 新增启动超时:child 启动 90 秒后仍未写 `boot.json` 的 ready 标记(hang 住不退出的坏启动)会被杀掉并按一次未 ready 失败计入 attempts,连续两次后照常回退 previous 并标记 bad——此前这种 wedged 启动会让监督循环永久卡住。`XIAOJIU_BRIDGE_BOOT_TIMEOUT_MS` 可覆盖该时长(主要供测试)。",
116
+ "`update` 不再要求手动停止空闲的 daemon:无会话运行时自动停止后台服务 → 安装新版本 → 重新拉起(npm 失败自动回滚服务);有会话运行时两条路径都拒绝并不动任何文件(listen sidecar 新增 `activeRuns` 跨进程计数)。前台 `run`/控制台进程仍需手动停止。"
116
117
  ],
117
118
  "breakingChanges": [],
118
119
  "securityFix": false,