@yeaft/webchat-agent 1.0.300 → 1.0.301

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/context.js CHANGED
@@ -18,6 +18,7 @@ export default {
18
18
  pendingUserQuestions: new Map(),
19
19
  nodePty: null,
20
20
  CONFIG: null,
21
+ managedCliReady: Promise.resolve([]),
21
22
  agentCapabilities: [],
22
23
  // Agent 级别的 slash commands 缓存(所有 conversation 共用)
23
24
  slashCommands: [],
package/index.js CHANGED
@@ -14,6 +14,7 @@ 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
18
 
18
19
  const execAsync = promisify(exec);
19
20
 
@@ -349,10 +350,18 @@ process.on('SIGTERM', async () => {
349
350
 
350
351
  // 启动 - 先确保依赖,再检测能力,预热 models.dev 缓存,再连接
351
352
  (async () => {
353
+ let managedCliReady = Promise.resolve([]);
352
354
  if (process.env.YEAFT_SKIP_STARTUP_INSTALLS !== 'true') {
353
355
  await ensureDependencies();
354
356
  await ensureYeaftSkills();
357
+ managedCliReady = ensureManagedCliTools({ yeaftDir: YEAFT_DIR });
358
+ managedCliReady.then(results => {
359
+ console.log(`[Startup] managed CLI tools: ${summarizeManagedCliResults(results)}`);
360
+ }).catch(error => {
361
+ console.warn(`[Startup] managed CLI setup failed; using built-in fallbacks: ${error?.message || error}`);
362
+ });
355
363
  }
364
+ ctx.managedCliReady = managedCliReady;
356
365
  ctx.agentCapabilities = await detectCapabilities();
357
366
  // Prime the models.dev community catalog so the Yeaft engine's *synchronous*
358
367
  // hot path (engine.js / config.js / cli.js all read context-window inline)
@@ -1 +1 @@
1
- {"version":"1.0.300"}
1
+ {"version":"1.0.301"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.300",
3
+ "version": "1.0.301",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -23,7 +23,7 @@ function buildVpPersona(vpId, loaded) {
23
23
  };
24
24
  }
25
25
 
26
- function createEngine(loaded, sessionId, vpId) {
26
+ export function createCliVpEngine(loaded, sessionId, vpId) {
27
27
  const effectiveConfig = resolveSessionConfig(
28
28
  loaded.config,
29
29
  loadSessionConfig(loaded.yeaftDir, sessionId),
@@ -41,6 +41,7 @@ function createEngine(loaded, sessionId, vpId) {
41
41
  yeaftDir: loaded.yeaftDir,
42
42
  toolStats: loaded.toolStats || null,
43
43
  taskManager: loaded.taskManager || null,
44
+ managedCliReady: loaded.managedCliReady || null,
44
45
  sessionId,
45
46
  vpId,
46
47
  });
@@ -58,7 +59,7 @@ export function createCliSessionRunner({
58
59
  loaded,
59
60
  sessionId,
60
61
  workDir = process.cwd(),
61
- engineFactory = createEngine,
62
+ engineFactory = createCliVpEngine,
62
63
  personaFactory = buildVpPersona,
63
64
  } = {}) {
64
65
  if (!loaded || !sessionId) return null;
package/yeaft/cli.js CHANGED
@@ -40,6 +40,7 @@ import { loadSessionConfig, resolveSessionConfig } from './sessions/session-conf
40
40
  import { validateSessionId } from './sessions/ids.js';
41
41
  import { createJsonlWriter, JsonlInput, runStreamTurn, runStreamSessionTurn } from './stdio-protocol.js';
42
42
  import { createCliSessionRunner } from './cli-session-runner.js';
43
+ import { ensureManagedCliTools, summarizeManagedCliResults } from './managed-cli.js';
43
44
 
44
45
  // ─── Argument parsing ──────────────────────────────────────────
45
46
 
@@ -65,6 +66,7 @@ export function parseArgs(argv) {
65
66
  outputFormat: 'text',
66
67
  print: false,
67
68
  prompt: null,
69
+ managedCliReady: Promise.resolve([]),
68
70
  };
69
71
 
70
72
  const rest = argv.slice(2);
@@ -346,6 +348,7 @@ async function runREPL(config, args) {
346
348
  skipMCP: args.skipMCP,
347
349
  skipSkills: args.skipSkills,
348
350
  configOverrides: effectiveConfig,
351
+ managedCliReady: args.managedCliReady,
349
352
  });
350
353
 
351
354
  const { engine, conversationStore, trace, skillManager, mcpManager, toolRegistry } = session;
@@ -797,6 +800,7 @@ async function runStreamJson(config, args) {
797
800
  ...effectiveConfig,
798
801
  ...(effectiveConfig.modelEffort ? { modelEffort: effectiveConfig.modelEffort } : {}),
799
802
  },
803
+ managedCliReady: args.managedCliReady,
800
804
  });
801
805
  const { engine, conversationStore, skillManager, toolRegistry } = loaded;
802
806
  const sessionRunner = createCliSessionRunner({ loaded, sessionId, workDir });
@@ -885,6 +889,7 @@ async function runOnce(config, args) {
885
889
  skipMCP: args.skipMCP,
886
890
  skipSkills: args.skipSkills,
887
891
  configOverrides: effectiveConfig,
892
+ managedCliReady: args.managedCliReady,
888
893
  });
889
894
 
890
895
  const { engine, conversationStore } = session;
@@ -993,7 +998,6 @@ async function main() {
993
998
  language: args.language,
994
999
  debug: args.debug || undefined,
995
1000
  });
996
-
997
1001
  // Handle --trace queries (no LLM needed, no session needed)
998
1002
  if (args.trace) {
999
1003
  await handleTraceQuery(args, config);
@@ -1010,8 +1014,20 @@ async function main() {
1010
1014
  return;
1011
1015
  }
1012
1016
 
1017
+ const prepareManagedCli = () => {
1018
+ args.managedCliReady = ensureManagedCliTools({ yeaftDir: config.dir });
1019
+ args.managedCliReady.then(results => {
1020
+ if (results.some(result => result.status === 'installed')) {
1021
+ console.error(`[Yeaft] managed CLI tools: ${summarizeManagedCliResults(results)}`);
1022
+ }
1023
+ }).catch(error => {
1024
+ console.error(`[Yeaft] managed CLI setup failed; using built-in fallbacks: ${error?.message || error}`);
1025
+ });
1026
+ };
1027
+
1013
1028
  // Handle interactive mode
1014
1029
  if (args.interactive) {
1030
+ prepareManagedCli();
1015
1031
  await runREPL(config, args);
1016
1032
  return;
1017
1033
  }
@@ -1023,6 +1039,7 @@ async function main() {
1023
1039
  if (!args.prompt && args.inputFormat !== 'stream-json' && process.stdin.isTTY) {
1024
1040
  throw new Error('stream-json output requires a prompt, piped stdin, or --input-format stream-json');
1025
1041
  }
1042
+ prepareManagedCli();
1026
1043
  await runStreamJson(config, args);
1027
1044
  return;
1028
1045
  }
@@ -1032,6 +1049,7 @@ async function main() {
1032
1049
 
1033
1050
  // Handle prompt (from args or stdin)
1034
1051
  if (args.prompt) {
1052
+ prepareManagedCli();
1035
1053
  await runOnce(config, args);
1036
1054
  return;
1037
1055
  }
@@ -1044,6 +1062,7 @@ async function main() {
1044
1062
  }
1045
1063
  args.prompt = input.trim();
1046
1064
  if (args.prompt) {
1065
+ prepareManagedCli();
1047
1066
  await runOnce(config, args);
1048
1067
  return;
1049
1068
  }
package/yeaft/engine.js CHANGED
@@ -524,6 +524,9 @@ export class Engine {
524
524
 
525
525
  /** @type {string|null} */
526
526
  #yeaftDir;
527
+
528
+ /** @type {Promise<Array>|null} */
529
+ #managedCliReady;
527
530
  /** @type {string|null} — set when this engine is bound to a specific group (per-VP fan-out path). */
528
531
  #sessionId = null;
529
532
  /** @type {string|null} — set when this engine is bound to a specific VP (per-VP fan-out path). */
@@ -716,9 +719,10 @@ export class Engine {
716
719
  * mcpManager?: import('./mcp.js').MCPManager,
717
720
  * yeaftDir?: string,
718
721
  * toolStats?: import('./stats/tool-usage.js').ToolUsageStats,
722
+ * managedCliReady?: Promise<Array>,
719
723
  * }} params
720
724
  */
721
- constructor({ adapter, trace, config, conversationStore, memoryIndex, amsRegistry, toolRegistry, skillManager, mcpManager, yeaftDir, toolStats = null, taskManager = null, sessionId = null, vpId = null, chatId = null }) {
725
+ constructor({ adapter, trace, config, conversationStore, memoryIndex, amsRegistry, toolRegistry, skillManager, mcpManager, yeaftDir, toolStats = null, taskManager = null, sessionId = null, vpId = null, chatId = null, managedCliReady = null }) {
722
726
  this.#adapter = adapter;
723
727
  this.#trace = trace;
724
728
  this.#config = config;
@@ -732,6 +736,7 @@ export class Engine {
732
736
  this.#skillManager = skillManager || null;
733
737
  this.#mcpManager = mcpManager || null;
734
738
  this.#yeaftDir = yeaftDir || null;
739
+ this.#managedCliReady = managedCliReady || null;
735
740
  this.#toolStats = toolStats || null;
736
741
  // Per-VP fan-out (2026-06-01): engine instances in the group path are
737
742
  // keyed by ${sessionId}::${vpId}::${threadId}, so binding the engine to
@@ -1260,6 +1265,7 @@ export class Engine {
1260
1265
  return {
1261
1266
  signal,
1262
1267
  yeaftDir: this.#yeaftDir,
1268
+ managedCliReady: this.#managedCliReady,
1263
1269
  runtimePlatform: getRuntimePlatformInfo(),
1264
1270
  // Group-scoped working directory. Threaded from #runQuery({ workDir })
1265
1271
  // → set by web-bridge runVpTurn from sessionMeta.workDir. Tools read
@@ -1341,6 +1347,7 @@ export class Engine {
1341
1347
  skillManager: this.#skillManager,
1342
1348
  mcpManager: this.#mcpManager,
1343
1349
  yeaftDir: this.#yeaftDir,
1350
+ managedCliReady: this.#managedCliReady,
1344
1351
  parentName: vpCtx?.senderVpId || 'parent',
1345
1352
  parentVpId: vpCtx?.senderVpId || null,
1346
1353
  parentVpPersona: vpCtx?.vpPersona || null,