@yeaft/webchat-agent 1.0.358 → 1.0.359

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
@@ -10,7 +10,14 @@ import { exec } from 'child_process';
10
10
  import { promisify } from 'util';
11
11
  import { fileURLToPath } from 'url';
12
12
  import ctx from './context.js';
13
- import { getDefaultAgentName, getDefaultYeaftDir, resolveRuntimeIdentity, getConfigPath, loadServiceConfig } from './service.js';
13
+ import {
14
+ getDefaultAgentName,
15
+ getDefaultYeaftDir,
16
+ resolveRuntimeIdentity,
17
+ getConfigPath,
18
+ loadServiceConfig,
19
+ shouldLoadLegacyLocalConfig,
20
+ } from './service.js';
14
21
  import { loadNodePty } from './terminal.js';
15
22
  import { connect } from './connection.js';
16
23
  import { loadMcpServers } from './mcp.js';
@@ -37,7 +44,8 @@ const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf-8'));
37
44
  ctx.agentVersion = pkg.version;
38
45
  ctx.pkgName = pkg.name;
39
46
 
40
- // 配置文件路径(向后兼容:先查当前目录 .claude-agent.json
47
+ // Legacy direct launches may still read cwd/.claude-agent.json. Explicit
48
+ // service instances must stay scoped to their standard per-instance config.
41
49
  const LOCAL_CONFIG_FILE = join(process.cwd(), '.claude-agent.json');
42
50
  const IS_LOCAL_RUN = process.env.YEAFT_LOCAL_RUN === 'true';
43
51
  const DEFAULT_AGENT_NAME = getDefaultAgentName();
@@ -56,8 +64,10 @@ function loadConfig() {
56
64
  // must not inherit a remote agent's persisted configuration.
57
65
  if (IS_LOCAL_RUN) return defaults;
58
66
 
59
- // Priority 1: Local .claude-agent.json (backward compat)
60
- if (existsSync(LOCAL_CONFIG_FILE)) {
67
+ // Priority 1: Local .claude-agent.json (backward compat for unscoped launches only).
68
+ // A named service can share its cwd with an unrelated legacy launch, so the
69
+ // process-level instance identity must fence this unscoped file out.
70
+ if (shouldLoadLegacyLocalConfig(process.env) && existsSync(LOCAL_CONFIG_FILE)) {
61
71
  try {
62
72
  const saved = JSON.parse(readFileSync(LOCAL_CONFIG_FILE, 'utf-8'));
63
73
  const { agentId, ...rest } = saved;
@@ -77,7 +87,7 @@ function loadConfig() {
77
87
  }
78
88
 
79
89
  function saveConfig(config) {
80
- if (IS_LOCAL_RUN) return;
90
+ if (IS_LOCAL_RUN || !shouldLoadLegacyLocalConfig(process.env)) return;
81
91
  writeFileSync(LOCAL_CONFIG_FILE, JSON.stringify(config, null, 2));
82
92
  }
83
93
 
@@ -1 +1 @@
1
- {"version":"1.0.358"}
1
+ {"version":"1.0.359"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.358",
3
+ "version": "1.0.359",
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",
package/service/config.js CHANGED
@@ -98,6 +98,10 @@ export function resolveRuntimeIdentity(fileConfig = {}, env = process.env) {
98
98
  return { agentName, instanceId };
99
99
  }
100
100
 
101
+ export function shouldLoadLegacyLocalConfig(env = process.env) {
102
+ return !String(env.YEAFT_AGENT_INSTANCE || '').trim();
103
+ }
104
+
101
105
  export function resolveServiceInstanceId(args = [], env = process.env, options = {}) {
102
106
  const { deprecatedInstanceId, explicitName } = readIdentityArgs(args);
103
107
  if (explicitName) return explicitName;
package/service/index.js CHANGED
@@ -29,6 +29,7 @@ export {
29
29
  resolveDisplayName,
30
30
  resolveRuntimeIdentity,
31
31
  resolveServiceInstanceId,
32
+ shouldLoadLegacyLocalConfig,
32
33
  normalizeInstanceId,
33
34
  isDefaultInstance,
34
35
  validateInstanceId,
package/service.js CHANGED
@@ -22,6 +22,7 @@ export {
22
22
  resolveDisplayName,
23
23
  resolveRuntimeIdentity,
24
24
  resolveServiceInstanceId,
25
+ shouldLoadLegacyLocalConfig,
25
26
  normalizeInstanceId,
26
27
  isDefaultInstance,
27
28
  validateInstanceId,