@saltpub/xiaojiu-agent-bridge 0.1.7 → 0.1.9

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.9",
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
+ "新增 `/btw [问题]` 旁路提问:长任务运行中可向该会话问一句,用会话上下文回答、不执行工具、不写入会话历史,也不会让 btw 会话出现在 `/resume`;claude/codex/pi/omp/opencode 分别走 fork、RPC btw 与 `session.generate` 等价机制。",
116
+ "修复 launcher 模式下守护进程无法停止的问题:`stop`/`kill` 现在会先终止 launcher 监管进程再停止 bot 子进程,避免子进程被立即自动拉起导致停止假成功;`kill <uid>` 与 `stop --profile` 统一为同一套停止逻辑。停止时会同时清理现行 `port-*` 与旧版 profile 命名的系统服务定义。`profile remove` 在持锁进程已退出时自动清理残留锁,锁冲突错误现在带持有者 pid 与启动时间。"
116
117
  ],
117
118
  "breakingChanges": [],
118
119
  "securityFix": false,