agentgui 1.0.41 → 1.0.42
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/acp-launcher.js +64 -4
- package/package.json +1 -1
package/acp-launcher.js
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import { createClient } from 'claude-code-acp';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import os from 'os';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Load CLI configuration to ensure identical behavior
|
|
8
|
+
*/
|
|
9
|
+
function loadCLIConfig() {
|
|
10
|
+
const configPaths = [
|
|
11
|
+
path.join(os.homedir(), '.claude', 'config.json'),
|
|
12
|
+
path.join(os.homedir(), '.claude-code', 'config.json'),
|
|
13
|
+
path.join(process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config'), 'claude', 'config.json')
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
for (const configPath of configPaths) {
|
|
17
|
+
try {
|
|
18
|
+
if (fs.existsSync(configPath)) {
|
|
19
|
+
const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
20
|
+
console.log(`[ACP] Loaded CLI config from ${configPath}`);
|
|
21
|
+
return config;
|
|
22
|
+
}
|
|
23
|
+
} catch (e) {
|
|
24
|
+
// Config file doesn't exist or is invalid, continue
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
2
30
|
|
|
3
31
|
const RIPPLEUI_SYSTEM_PROMPT = `CRITICAL INSTRUCTION: You are responding in a web-based HTML interface. EVERY response must be formatted as beautiful, styled HTML using RippleUI and Tailwind CSS. This is NOT a text-based interface - users see raw HTML rendered in their browser.
|
|
4
32
|
|
|
@@ -73,18 +101,50 @@ export default class ACPConnection {
|
|
|
73
101
|
|
|
74
102
|
/**
|
|
75
103
|
* Connect to ACP bridge and create session
|
|
104
|
+
* Uses identical configuration to CLI version
|
|
76
105
|
*/
|
|
77
106
|
async connect(agentType, cwd) {
|
|
78
107
|
try {
|
|
79
108
|
console.log(`[ACP] Connecting to ${agentType}...`);
|
|
80
109
|
|
|
81
|
-
//
|
|
82
|
-
|
|
110
|
+
// Load CLI configuration for identical behavior
|
|
111
|
+
const cliConfig = loadCLIConfig();
|
|
112
|
+
|
|
113
|
+
// Create client with CLI-identical configuration
|
|
114
|
+
// Pass through all environment for OAuth and plugin support
|
|
115
|
+
const clientConfig = {
|
|
83
116
|
agent: agentType === 'opencode' ? 'opencode' : 'claude-code',
|
|
84
|
-
cwd
|
|
117
|
+
cwd,
|
|
118
|
+
// Use same environment as CLI (HOME, PATH, etc.)
|
|
119
|
+
env: process.env,
|
|
120
|
+
// Load plugins just like CLI does
|
|
121
|
+
plugins: true,
|
|
122
|
+
// Use OAuth for authentication (same as CLI)
|
|
123
|
+
oauth: true,
|
|
124
|
+
// Use model preferences from CLI config
|
|
125
|
+
modelPreferences: cliConfig.modelPreferences || undefined,
|
|
126
|
+
// Enable all capabilities that CLI enables
|
|
127
|
+
capabilities: {
|
|
128
|
+
fs: true,
|
|
129
|
+
mcp: true,
|
|
130
|
+
web: true,
|
|
131
|
+
terminal: true
|
|
132
|
+
},
|
|
133
|
+
// Pass through any other CLI settings
|
|
134
|
+
...cliConfig
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Remove potential conflicting fields
|
|
138
|
+
delete clientConfig.agent; // Re-add below
|
|
139
|
+
delete clientConfig.cwd; // Re-add below
|
|
140
|
+
|
|
141
|
+
this.client = await createClient({
|
|
142
|
+
agent: clientConfig.agent || (agentType === 'opencode' ? 'opencode' : 'claude-code'),
|
|
143
|
+
cwd,
|
|
144
|
+
...clientConfig
|
|
85
145
|
});
|
|
86
146
|
|
|
87
|
-
console.log(`[ACP] ✅ Connected to ${agentType} (
|
|
147
|
+
console.log(`[ACP] ✅ Connected to ${agentType} (CLI-identical mode)`);
|
|
88
148
|
} catch (err) {
|
|
89
149
|
console.error(`[ACP] ❌ FATAL: Connection failed: ${err.message}`);
|
|
90
150
|
throw new Error(`ACP connection failed for ${agentType}: ${err.message}`);
|