@yeaft/webchat-agent 1.0.337 → 1.0.339

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/index.js CHANGED
@@ -14,7 +14,12 @@ import { getDefaultAgentName, getDefaultYeaftDir, resolveRuntimeIdentity, getCon
14
14
  import { loadNodePty } from './terminal.js';
15
15
  import { connect } from './connection.js';
16
16
  import { loadMcpServers } from './mcp.js';
17
- import { ensureManagedCliTools, summarizeManagedCliResults } from './yeaft/managed-cli.js';
17
+ import {
18
+ ensureManagedCliTools,
19
+ prepareManagedCliToolEnvironment,
20
+ runAfterManagedCliRuntimeCleanup,
21
+ summarizeManagedCliResults,
22
+ } from './yeaft/managed-cli.js';
18
23
 
19
24
  const execAsync = promisify(exec);
20
25
 
@@ -310,30 +315,32 @@ async function ensureYeaftSkills() {
310
315
  }
311
316
 
312
317
  // 优雅退出
313
- async function cleanup() {
314
- // 清理所有终端
315
- for (const [, term] of ctx.terminals) {
316
- if (term.pty) {
317
- try { term.pty.kill(); } catch {}
318
+ function cleanup() {
319
+ return runAfterManagedCliRuntimeCleanup(async () => {
320
+ // 清理所有终端
321
+ for (const [, term] of ctx.terminals) {
322
+ if (term.pty) {
323
+ try { term.pty.kill(); } catch {}
324
+ }
325
+ if (term.timer) clearTimeout(term.timer);
318
326
  }
319
- if (term.timer) clearTimeout(term.timer);
320
- }
321
- ctx.terminals.clear();
327
+ ctx.terminals.clear();
322
328
 
323
- for (const [, state] of ctx.conversations) {
324
- if (state.abortController) {
325
- state.abortController.abort();
326
- }
327
- if (state.inputStream) {
328
- state.inputStream.done();
329
+ for (const [, state] of ctx.conversations) {
330
+ if (state.abortController) {
331
+ state.abortController.abort();
332
+ }
333
+ if (state.inputStream) {
334
+ state.inputStream.done();
335
+ }
329
336
  }
330
- }
331
- ctx.conversations.clear();
332
- try {
333
- const { shutdownWorkCenter } = await import('./yeaft/work-center/bridge.js');
334
- await shutdownWorkCenter();
335
- } catch {}
336
- if (ctx.ws) ctx.ws.close();
337
+ ctx.conversations.clear();
338
+ try {
339
+ const { shutdownWorkCenter } = await import('./yeaft/work-center/bridge.js');
340
+ await shutdownWorkCenter();
341
+ } catch {}
342
+ if (ctx.ws) ctx.ws.close();
343
+ });
337
344
  }
338
345
 
339
346
  process.on('SIGINT', async () => {
@@ -362,6 +369,16 @@ process.on('SIGTERM', async () => {
362
369
  });
363
370
  }
364
371
  ctx.managedCliReady = managedCliReady;
372
+ try {
373
+ const rgEnvironment = await prepareManagedCliToolEnvironment(managedCliReady, 'rg', {
374
+ yeaftDir: YEAFT_DIR,
375
+ });
376
+ if (rgEnvironment.activated) {
377
+ console.log(`[Startup] managed rg available to child processes: ${rgEnvironment.command}`);
378
+ }
379
+ } catch (error) {
380
+ console.warn(`[Startup] managed rg environment setup failed; using built-in fallback: ${error?.message || error}`);
381
+ }
365
382
  ctx.agentCapabilities = await detectCapabilities();
366
383
  // Prime the models.dev community catalog so the Yeaft engine's *synchronous*
367
384
  // hot path (engine.js / config.js / cli.js all read context-window inline)
@@ -1 +1 @@
1
- {"version":"1.0.337"}
1
+ {"version":"1.0.339"}
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
6
6
  <title>Yeaft</title>
7
7
  <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><rect width='32' height='32' rx='8' fill='%232c2c2c'/><path d='M16 22V13M16 13L10 8M16 13L22 8' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' fill='none'/><circle cx='10' cy='8' r='2.4' fill='white'/><circle cx='22' cy='8' r='2.4' fill='white'/><circle cx='16' cy='22' r='2.4' fill='white'/></svg>">
8
- <link rel="stylesheet" href="style.bundle.css?v=35225e31">
8
+ <link rel="stylesheet" href="style.bundle.css?v=fc30fb1a">
9
9
  <script src="vendor.bundle.js?v=103fd8e7"></script>
10
10
  <script defer src="jszip.min.js"></script>
11
11
  <script defer src="docx-preview.min.js"></script>