@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 +15 -5
- package/local-runtime/version.json +1 -1
- package/package.json +1 -1
- package/service/config.js +4 -0
- package/service/index.js +1 -0
- package/service.js +1 -0
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 {
|
|
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
|
-
//
|
|
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
|
-
|
|
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.
|
|
1
|
+
{"version":"1.0.359"}
|
package/package.json
CHANGED
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