@openagents-org/agent-launcher 0.2.60 → 0.2.62
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 +1 -1
- package/src/adapters/claude.js +21 -4
package/package.json
CHANGED
package/src/adapters/claude.js
CHANGED
|
@@ -106,6 +106,14 @@ class ClaudeAdapter extends BaseAdapter {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
_findClaudeBinary() {
|
|
109
|
+
const home = os.homedir();
|
|
110
|
+
|
|
111
|
+
// Tier 0: Portable install at ~/.openagents/nodejs/node_modules/.bin/
|
|
112
|
+
const portableBin = path.join(home, '.openagents', 'nodejs', 'node_modules', '.bin');
|
|
113
|
+
const ext = IS_WINDOWS ? '.cmd' : '';
|
|
114
|
+
const portableCandidate = path.join(portableBin, `claude${ext}`);
|
|
115
|
+
if (fs.existsSync(portableCandidate)) return portableCandidate;
|
|
116
|
+
|
|
109
117
|
// Tier 1: PATH search
|
|
110
118
|
try {
|
|
111
119
|
if (IS_WINDOWS) {
|
|
@@ -120,12 +128,10 @@ class ClaudeAdapter extends BaseAdapter {
|
|
|
120
128
|
|
|
121
129
|
// Tier 2: Next to current Node.js interpreter (npm global)
|
|
122
130
|
const nodeBinDir = path.dirname(process.execPath);
|
|
123
|
-
const ext = IS_WINDOWS ? '.cmd' : '';
|
|
124
131
|
const nearNode = path.join(nodeBinDir, `claude${ext}`);
|
|
125
132
|
if (fs.existsSync(nearNode)) return nearNode;
|
|
126
133
|
|
|
127
134
|
// Tier 3: Common install locations
|
|
128
|
-
const home = os.homedir();
|
|
129
135
|
const candidates = IS_WINDOWS ? [
|
|
130
136
|
path.join(process.env.APPDATA || '', 'npm', 'claude.cmd'),
|
|
131
137
|
] : [
|
|
@@ -339,9 +345,19 @@ class ClaudeAdapter extends BaseAdapter {
|
|
|
339
345
|
delete cleanEnv.CLAUDE_CODE_SESSION;
|
|
340
346
|
|
|
341
347
|
try {
|
|
342
|
-
// On Windows, .cmd
|
|
348
|
+
// On Windows, spawn node.exe directly instead of .cmd shims to avoid
|
|
349
|
+
// visible console windows and Unicode path issues
|
|
343
350
|
if (IS_WINDOWS && cmd[0].toLowerCase().endsWith('.cmd')) {
|
|
344
|
-
|
|
351
|
+
// Resolve .cmd shim → actual JS entry point
|
|
352
|
+
const cmdContent = fs.readFileSync(cmd[0], 'utf-8');
|
|
353
|
+
const jsMatch = cmdContent.match(/"([^"]+\.js)"/);
|
|
354
|
+
if (jsMatch) {
|
|
355
|
+
const nodeExe = path.join(os.homedir(), '.openagents', 'nodejs', 'node.exe');
|
|
356
|
+
const nodeBin = fs.existsSync(nodeExe) ? nodeExe : 'node';
|
|
357
|
+
cmd = [nodeBin, jsMatch[1], ...cmd.slice(1)];
|
|
358
|
+
} else {
|
|
359
|
+
cmd = ['cmd.exe', '/c', ...cmd];
|
|
360
|
+
}
|
|
345
361
|
}
|
|
346
362
|
|
|
347
363
|
const proc = spawn(cmd[0], cmd.slice(1), {
|
|
@@ -349,6 +365,7 @@ class ClaudeAdapter extends BaseAdapter {
|
|
|
349
365
|
env: cleanEnv,
|
|
350
366
|
cwd: this.workingDir,
|
|
351
367
|
detached: !IS_WINDOWS,
|
|
368
|
+
windowsHide: true,
|
|
352
369
|
});
|
|
353
370
|
this._channelProcesses[msgChannel] = proc;
|
|
354
371
|
|