@openagents-org/agent-launcher 0.2.61 → 0.2.63
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 +13 -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
|
] : [
|
|
@@ -343,12 +349,15 @@ class ClaudeAdapter extends BaseAdapter {
|
|
|
343
349
|
// visible console windows and Unicode path issues
|
|
344
350
|
if (IS_WINDOWS && cmd[0].toLowerCase().endsWith('.cmd')) {
|
|
345
351
|
// Resolve .cmd shim → actual JS entry point
|
|
352
|
+
// npm shims use %dp0% (directory of the .cmd file) as a relative base
|
|
353
|
+
const cmdDir = path.dirname(path.resolve(cmd[0]));
|
|
346
354
|
const cmdContent = fs.readFileSync(cmd[0], 'utf-8');
|
|
347
|
-
const jsMatch = cmdContent.match(/"([^"]+\.js)"
|
|
355
|
+
const jsMatch = cmdContent.match(/"?%dp0%\\([^"*?]+\.js)"?/i);
|
|
348
356
|
if (jsMatch) {
|
|
357
|
+
const jsPath = path.resolve(cmdDir, jsMatch[1]);
|
|
349
358
|
const nodeExe = path.join(os.homedir(), '.openagents', 'nodejs', 'node.exe');
|
|
350
359
|
const nodeBin = fs.existsSync(nodeExe) ? nodeExe : 'node';
|
|
351
|
-
cmd = [nodeBin,
|
|
360
|
+
cmd = [nodeBin, jsPath, ...cmd.slice(1)];
|
|
352
361
|
} else {
|
|
353
362
|
cmd = ['cmd.exe', '/c', ...cmd];
|
|
354
363
|
}
|