clay-server 2.32.0-beta.6 → 2.32.0-beta.7
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/lib/yoke/adapters/claude.js +13 -0
- package/package.json +1 -1
|
@@ -895,9 +895,18 @@ function createWorkerQueryHandle(worker, canUseTool, onElicitation) {
|
|
|
895
895
|
|
|
896
896
|
// --- Adapter factory ---
|
|
897
897
|
|
|
898
|
+
function resolveClaudeBinaryPath() {
|
|
899
|
+
try {
|
|
900
|
+
var result = require("child_process").execSync("which claude", { encoding: "utf8", timeout: 5000 }).trim();
|
|
901
|
+
if (result && fs.existsSync(result)) return result;
|
|
902
|
+
} catch (e) {}
|
|
903
|
+
return null;
|
|
904
|
+
}
|
|
905
|
+
|
|
898
906
|
function createClaudeAdapter(opts) {
|
|
899
907
|
var _cwd = (opts && opts.cwd) || process.cwd();
|
|
900
908
|
var _cachedModels = [];
|
|
909
|
+
var _claudeBinaryPath = resolveClaudeBinaryPath();
|
|
901
910
|
|
|
902
911
|
// Path to the worker script (for OS-level user isolation)
|
|
903
912
|
var workerScriptPath = path.join(__dirname, "claude-worker.js");
|
|
@@ -935,6 +944,7 @@ function createClaudeAdapter(opts) {
|
|
|
935
944
|
settingSources: ["user", "project", "local"],
|
|
936
945
|
abortController: ac,
|
|
937
946
|
};
|
|
947
|
+
if (_claudeBinaryPath) warmupOptions.pathToClaudeCodeExecutable = _claudeBinaryPath;
|
|
938
948
|
|
|
939
949
|
if (initOpts && initOpts.dangerouslySkipPermissions) {
|
|
940
950
|
warmupOptions.permissionMode = "bypassPermissions";
|
|
@@ -1069,6 +1079,7 @@ function createClaudeAdapter(opts) {
|
|
|
1069
1079
|
cwd: queryOpts.cwd || _cwd,
|
|
1070
1080
|
abortController: ac,
|
|
1071
1081
|
};
|
|
1082
|
+
if (_claudeBinaryPath) sdkOptions.pathToClaudeCodeExecutable = _claudeBinaryPath;
|
|
1072
1083
|
|
|
1073
1084
|
// YOKE standard options -> SDK options
|
|
1074
1085
|
if (queryOpts.systemPrompt) sdkOptions.systemPrompt = queryOpts.systemPrompt;
|
|
@@ -1346,6 +1357,7 @@ function createClaudeAdapter(opts) {
|
|
|
1346
1357
|
settingSources: ["user", "project", "local"],
|
|
1347
1358
|
abortController: ac,
|
|
1348
1359
|
};
|
|
1360
|
+
if (_claudeBinaryPath) warmupOptions.pathToClaudeCodeExecutable = _claudeBinaryPath;
|
|
1349
1361
|
|
|
1350
1362
|
if (initOpts && initOpts.dangerouslySkipPermissions) {
|
|
1351
1363
|
warmupOptions.permissionMode = "bypassPermissions";
|
|
@@ -1419,6 +1431,7 @@ function createClaudeAdapter(opts) {
|
|
|
1419
1431
|
}
|
|
1420
1432
|
|
|
1421
1433
|
var warmupOptions = { cwd: workerCwd, settingSources: ["user", "project", "local"] };
|
|
1434
|
+
if (_claudeBinaryPath) warmupOptions.pathToClaudeCodeExecutable = _claudeBinaryPath;
|
|
1422
1435
|
if (initOpts && initOpts.dangerouslySkipPermissions) {
|
|
1423
1436
|
warmupOptions.permissionMode = "bypassPermissions";
|
|
1424
1437
|
warmupOptions.allowDangerouslySkipPermissions = true;
|