@ian2018cs/agenthub 0.2.8 → 0.2.10
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ian2018cs/agenthub",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "A web-based UI for AI Agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "server/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@anthropic-ai/claude-agent-sdk": "^0.2.
|
|
54
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.89",
|
|
55
55
|
"@codemirror/lang-css": "^6.3.1",
|
|
56
56
|
"@codemirror/lang-html": "^6.4.9",
|
|
57
57
|
"@codemirror/lang-javascript": "^6.2.4",
|
package/server/claude-sdk.js
CHANGED
|
@@ -250,6 +250,11 @@ function mapCliOptionsToSDK(options = {}) {
|
|
|
250
250
|
sdkOptions.resume = sessionId;
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
+
// Map per-request environment variables (e.g. CLAUDE_CONFIG_DIR for user isolation)
|
|
254
|
+
if (options.env) {
|
|
255
|
+
sdkOptions.env = options.env;
|
|
256
|
+
}
|
|
257
|
+
|
|
253
258
|
return sdkOptions;
|
|
254
259
|
}
|
|
255
260
|
|
|
@@ -511,8 +516,8 @@ async function loadMcpConfig(cwd, userUuid) {
|
|
|
511
516
|
}
|
|
512
517
|
|
|
513
518
|
// Add/override with project-specific MCP servers
|
|
514
|
-
if (claudeConfig.
|
|
515
|
-
const projectConfig = claudeConfig.
|
|
519
|
+
if (claudeConfig.projects && cwd) {
|
|
520
|
+
const projectConfig = claudeConfig.projects[cwd];
|
|
516
521
|
if (projectConfig && projectConfig.mcpServers && typeof projectConfig.mcpServers === 'object') {
|
|
517
522
|
mcpServers = { ...mcpServers, ...projectConfig.mcpServers };
|
|
518
523
|
console.log(`Loaded ${Object.keys(projectConfig.mcpServers).length} project-specific MCP servers`);
|
|
@@ -552,11 +557,18 @@ async function queryClaudeSDK(command, options = {}, ws) {
|
|
|
552
557
|
let tempDir = null;
|
|
553
558
|
let abortController = null;
|
|
554
559
|
|
|
555
|
-
// Set CLAUDE_CONFIG_DIR for user isolation
|
|
560
|
+
// Set CLAUDE_CONFIG_DIR for user isolation via per-request env (avoids global process.env race condition).
|
|
561
|
+
// The SDK passes this env object to the Claude CLI subprocess, so each concurrent
|
|
562
|
+
// request gets its own isolated config directory without overwriting the global env.
|
|
556
563
|
if (userUuid) {
|
|
557
564
|
const userPaths = getUserPaths(userUuid);
|
|
558
|
-
|
|
559
|
-
|
|
565
|
+
options = {
|
|
566
|
+
...options,
|
|
567
|
+
env: {
|
|
568
|
+
...process.env,
|
|
569
|
+
CLAUDE_CONFIG_DIR: userPaths.claudeDir,
|
|
570
|
+
},
|
|
571
|
+
};
|
|
560
572
|
}
|
|
561
573
|
|
|
562
574
|
try {
|
|
@@ -287,7 +287,10 @@ export async function initUserDirectories(userUuid) {
|
|
|
287
287
|
const settingsConfig = {
|
|
288
288
|
env: {
|
|
289
289
|
ANTHROPIC_AUTH_TOKEN: process.env.ANTHROPIC_AUTH_TOKEN || '',
|
|
290
|
-
ANTHROPIC_BASE_URL: process.env.ANTHROPIC_BASE_URL || ''
|
|
290
|
+
ANTHROPIC_BASE_URL: process.env.ANTHROPIC_BASE_URL || '',
|
|
291
|
+
CLAUDE_CODE_ATTRIBUTION_HEADER: '0',
|
|
292
|
+
CLAUDE_CODE_DISABLE_1M_CONTEXT: '1',
|
|
293
|
+
DISABLE_PROMPT_CACHING: '1'
|
|
291
294
|
}
|
|
292
295
|
};
|
|
293
296
|
await fs.writeFile(destSettings, JSON.stringify(settingsConfig, null, 2));
|