@baize-ai/core 0.3.3 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to baize-core will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.5] - 2026-08-26
9
+
10
+ ### Fixed
11
+ - web-console 重启 agent 会话按当前 runtime 定位 tmux 会话(codex-main/claude-main)——保存 Codex API key 后自动重启生效,不再因会话名不匹配报"无 tmux session"
12
+
13
+ ## [0.3.4] - 2026-08-26
14
+
15
+ ### Fixed
16
+ - web-console 视图切换:定时任务页不再与其他页重叠(model/channels/a2a/chat 分支补 schedulerView.hidden)
17
+
8
18
  ## [0.3.3] - 2026-08-26
9
19
 
10
20
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baize-ai/core",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "description": "Baize (\u767d\u6cfd) \u2014 autonomous AI agent infrastructure",
6
6
  "main": "cli/baize.js",
@@ -401,19 +401,33 @@ ensure_build_toolchain() {
401
401
  }
402
402
 
403
403
  # Rebuild native deps in installed skill dirs when their prebuilt binaries are
404
- # wrong-platform (common with better-sqlite3 on Linux via mirrors).
404
+ # wrong-platform (common with better-sqlite3 on Linux via mirrors). Forces
405
+ # source compilation (npm 11 ignores the old --build-from-source flag; the
406
+ # npm_config_build_from_source env / .npmrc entry is the supported form) and
407
+ # points node-gyp headers at npmmirror so the build works fully in mainland.
405
408
  rebuild_native_modules() {
406
409
  ensure_build_toolchain
407
410
  local REGISTRY
408
411
  REGISTRY="$(detect_registry)"
412
+ # Persist source-compile + mirror disturl so EVERY later npm install in this
413
+ # user (init, components, upgrades) compiles native modules locally instead
414
+ # of pulling broken platform prebuilds.
415
+ local npmrc="$HOME/.npmrc"
416
+ touch "$npmrc"
417
+ if ! grep -q '^build-from-source=' "$npmrc" 2>/dev/null; then
418
+ printf 'build-from-source=true\n' >> "$npmrc"
419
+ fi
420
+ if ! grep -q '^disturl=' "$npmrc" 2>/dev/null; then
421
+ printf 'disturl=%s\n' "https://registry.npmmirror.com/-/binary/node/" >> "$npmrc"
422
+ fi
409
423
  for skill in comm-bridge scheduler web-console baize-memory; do
410
424
  local dir="$HOME/baize/.claude/skills/$skill"
411
425
  if [ -d "$dir/node_modules/better-sqlite3" ]; then
412
- info "Rebuilding native deps in ${skill} (wrong-platform prebuild fix)..."
413
- if (cd "$dir" && npm rebuild better-sqlite3 --registry "$REGISTRY" >/dev/null 2>&1); then
414
- ok "${skill}: better-sqlite3 rebuilt"
426
+ info "Rebuilding native deps in ${skill} (source compile, wrong-platform prebuild fix)..."
427
+ if (cd "$dir" && rm -rf node_modules/better-sqlite3/build && npm rebuild better-sqlite3 --registry "$REGISTRY" 2>&1 | tail -3); then
428
+ ok "${skill}: better-sqlite3 rebuilt from source"
415
429
  else
416
- warn "${skill}: native rebuild failed — install a compiler toolchain manually"
430
+ warn "${skill}: native rebuild failed — see output above (install a compiler toolchain manually)"
417
431
  fi
418
432
  fi
419
433
  done
@@ -2321,6 +2321,7 @@ function showAppView(basePath, view) {
2321
2321
  chatView.hidden = true;
2322
2322
  channelsView.hidden = true;
2323
2323
  a2aView.hidden = true;
2324
+ schedulerView.hidden = true;
2324
2325
  modelView.hidden = false;
2325
2326
  setNav(navModel, [navChat, navChannels, navA2a, navScheduler]);
2326
2327
  renderModelSettings(basePath);
@@ -2328,6 +2329,7 @@ function showAppView(basePath, view) {
2328
2329
  chatView.hidden = true;
2329
2330
  modelView.hidden = true;
2330
2331
  a2aView.hidden = true;
2332
+ schedulerView.hidden = true;
2331
2333
  channelsView.hidden = false;
2332
2334
  setNav(navChannels, [navChat, navModel, navA2a, navScheduler]);
2333
2335
  renderChannels(basePath);
@@ -2335,6 +2337,7 @@ function showAppView(basePath, view) {
2335
2337
  chatView.hidden = true;
2336
2338
  modelView.hidden = true;
2337
2339
  channelsView.hidden = true;
2340
+ schedulerView.hidden = true;
2338
2341
  a2aView.hidden = false;
2339
2342
  setNav(navA2a, [navChat, navModel, navChannels, navScheduler]);
2340
2343
  renderA2a(basePath);
@@ -2350,6 +2353,7 @@ function showAppView(basePath, view) {
2350
2353
  modelView.hidden = true;
2351
2354
  channelsView.hidden = true;
2352
2355
  a2aView.hidden = true;
2356
+ schedulerView.hidden = true;
2353
2357
  chatView.hidden = false;
2354
2358
  setNav(navChat, [navModel, navChannels, navA2a, navScheduler]);
2355
2359
  ensureChatEmptyState(basePath);
@@ -37,7 +37,20 @@ export function envFile() { return path.join(baizeDir(), '.env'); }
37
37
  function configFile() { return path.join(baizeDir(), '.baize', 'config.json'); }
38
38
  function claudeSettings() { return path.join(homeDir(), '.claude', 'settings.json'); }
39
39
  function codexAuth() { return path.join(homeDir(), '.codex', 'auth.json'); }
40
- const CLAUDE_SESSION = process.env.CLAUDE_SESSION || 'claude-main';
40
+ // Session name follows the active runtime: codex runs in 'codex-main',
41
+ // claude in 'claude-main'. Hard-coding 'claude-main' made the web-console
42
+ // restart button report "no tmux session" while the codex session was alive
43
+ // (stuck on login) — a dead end for browser-only recovery.
44
+ function agentSessionName() {
45
+ if (process.env.CLAUDE_SESSION) return process.env.CLAUDE_SESSION;
46
+ let runtime = 'claude';
47
+ try {
48
+ const cfg = JSON.parse(require('node:fs').readFileSync(
49
+ require('node:path').join(homeDir(), 'baize', '.baize', 'config.json'), 'utf8'));
50
+ if (cfg && cfg.runtime) runtime = cfg.runtime;
51
+ } catch { /* default claude */ }
52
+ return runtime === 'codex' ? 'codex-main' : 'claude-main';
53
+ }
41
54
  const CLI = process.env.BAIZE_CLI || 'baize';
42
55
 
43
56
  // ── Low-level helpers ────────────────────────────────────────────────────────
@@ -352,14 +365,15 @@ export async function switchRuntime(name) {
352
365
  * @returns {Promise<{success: boolean, restarted: boolean, reason?: string}>}
353
366
  */
354
367
  export async function restartAgentSession() {
368
+ const session = agentSessionName();
355
369
  try {
356
- await execFileAsync('tmux', ['has-session', '-t', CLAUDE_SESSION], { timeout: 5000 });
370
+ await execFileAsync('tmux', ['has-session', '-t', session], { timeout: 5000 });
357
371
  } catch {
358
372
  return { success: true, restarted: false, reason: 'no_session' };
359
373
  }
360
374
  try {
361
- await execFileAsync('tmux', ['send-keys', '-t', CLAUDE_SESSION, '/exit', 'Enter'], { timeout: 5000 });
362
- return { success: true, restarted: true };
375
+ await execFileAsync('tmux', ['send-keys', '-t', session, '/exit', 'Enter'], { timeout: 5000 });
376
+ return { success: true, restarted: true, session };
363
377
  } catch (err) {
364
378
  return { success: false, restarted: false, reason: err.message };
365
379
  }