@baize-ai/core 0.3.7 → 0.3.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/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ 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.8] - 2026-08-26
9
+
10
+ ### Fixed
11
+ - web-console 重启 agent 会话按钮:无运行中会话时不再误报「没有运行中的 agent 会话」——改为触发 activity-monitor 重启(Guardian 立即拉起 agent),提示「正在拉起 agent 进程…」;PM2 不可用时由 Guardian 周期探测兜底
12
+
8
13
  ## [0.3.7] - 2026-08-26
9
14
 
10
15
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baize-ai/core",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "type": "module",
5
5
  "description": "Baize (\u767d\u6cfd) \u2014 autonomous AI agent infrastructure",
6
6
  "main": "cli/baize.js",
@@ -986,8 +986,10 @@ async function restartSessionFromAdmin(basePath) {
986
986
  const { body } = await adminFetch(basePath, '/api/admin/restart', { method: 'POST' });
987
987
  if (body.restarted) {
988
988
  setAdminMsg('已发送重启指令(activity-monitor 将自动拉起新会话)');
989
+ } else if (body.pending) {
990
+ setAdminMsg('正在拉起 agent 进程…(已触发 activity-monitor,稍后刷新查看)');
989
991
  } else if (body.reason === 'no_session') {
990
- setAdminMsg('没有运行中的 agent 会话(无 tmux session)', true);
992
+ setAdminMsg('当前无运行中会话,请稍后刷新查看');
991
993
  } else {
992
994
  setAdminMsg(`重启失败:${body.reason || '未知错误'}`, true);
993
995
  }
@@ -362,14 +362,20 @@ export async function switchRuntime(name) {
362
362
  * Restart the agent session by sending /exit to the tmux session; the activity
363
363
  * monitor relaunches it with fresh env (which merges ~/baize/.env). No-op with
364
364
  * a clear reason when no session is running.
365
- * @returns {Promise<{success: boolean, restarted: boolean, reason?: string}>}
365
+ * @returns {Promise<{success: boolean, restarted: boolean, pending?: boolean, reason?: string}>}
366
366
  */
367
367
  export async function restartAgentSession() {
368
368
  const session = agentSessionName();
369
369
  try {
370
370
  await execFileAsync('tmux', ['has-session', '-t', session], { timeout: 5000 });
371
371
  } catch {
372
- return { success: true, restarted: false, reason: 'no_session' };
372
+ // No session trigger activity-monitor to relaunch the agent promptly
373
+ // instead of waiting out the Guardian's backoff. PM2 unavailable → the
374
+ // Guardian's periodic probe will pick it up; still report as pending.
375
+ try {
376
+ await execFileAsync('pm2', ['restart', 'activity-monitor'], { timeout: 15000 });
377
+ } catch { /* non-fatal — Guardian probes on its own schedule */ }
378
+ return { success: true, restarted: false, pending: true, reason: 'no_session' };
373
379
  }
374
380
  try {
375
381
  await execFileAsync('tmux', ['send-keys', '-t', session, '/exit', 'Enter'], { timeout: 5000 });