claude-ws 0.4.1 → 0.4.3
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": "claude-ws",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "AI-powered workspace for solo CEOs and indie builders — manage your entire business with AI agents, not just code. Kanban board, code editor, Git integration, claw agent hub, local-first SQLite.",
|
|
6
6
|
"keywords": [
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { EventEmitter } from 'events';
|
|
8
8
|
import { existsSync, readFileSync, mkdirSync } from 'fs';
|
|
9
|
-
import { join } from 'path';
|
|
9
|
+
import { join, dirname } from 'path';
|
|
10
10
|
import { homedir } from 'os';
|
|
11
11
|
import { query, type Query } from '@anthropic-ai/claude-agent-sdk';
|
|
12
12
|
import { adaptSDKMessage, isValidSDKMessage } from './claude-sdk-message-to-output-adapter';
|
|
@@ -166,6 +166,13 @@ export class AgentProvider extends EventEmitter {
|
|
|
166
166
|
const defaultModel = this.config.anthropicModel || 'opus';
|
|
167
167
|
const effectiveModel = model ? this.resolveModel(model) : defaultModel;
|
|
168
168
|
|
|
169
|
+
// Ensure the current node binary's directory is in PATH — when running under PM2/systemd
|
|
170
|
+
// with nvm, the SDK's `spawn("node", ...)` can fail with ENOENT if PATH doesn't include it
|
|
171
|
+
const nodeBinDir = dirname(process.execPath);
|
|
172
|
+
if (process.env.PATH && !process.env.PATH.split(':').includes(nodeBinDir)) {
|
|
173
|
+
process.env.PATH = `${nodeBinDir}:${process.env.PATH}`;
|
|
174
|
+
}
|
|
175
|
+
|
|
169
176
|
// Set env vars on process.env so the SDK subprocess inherits them
|
|
170
177
|
if (this.config.anthropicBaseUrl) process.env.ANTHROPIC_BASE_URL = this.config.anthropicBaseUrl;
|
|
171
178
|
if (this.config.anthropicAuthToken) {
|
|
@@ -175,7 +182,12 @@ export class AgentProvider extends EventEmitter {
|
|
|
175
182
|
delete process.env.CLAUDECODE;
|
|
176
183
|
delete process.env.CLAUDE_CODE_ENTRYPOINT;
|
|
177
184
|
|
|
185
|
+
// Use full path to node binary — spawn("node", ...) fails under PM2/systemd with nvm
|
|
186
|
+
// because PATH may not include the nvm bin directory. process.execPath is always absolute.
|
|
187
|
+
const nodeExecutable = process.execPath as 'node';
|
|
188
|
+
|
|
178
189
|
const queryOptions = {
|
|
190
|
+
executable: nodeExecutable,
|
|
179
191
|
cwd: projectPath,
|
|
180
192
|
model: effectiveModel,
|
|
181
193
|
permissionMode: 'bypassPermissions' as const,
|
|
@@ -209,7 +221,10 @@ export class AgentProvider extends EventEmitter {
|
|
|
209
221
|
},
|
|
210
222
|
};
|
|
211
223
|
|
|
212
|
-
log.info({
|
|
224
|
+
log.info({
|
|
225
|
+
model: effectiveModel, cwd: projectPath, resume: sessionOptions?.resume,
|
|
226
|
+
nodeExec: nodeExecutable, pathExists: existsSync(projectPath),
|
|
227
|
+
}, 'SDK query starting');
|
|
213
228
|
|
|
214
229
|
const response = query({
|
|
215
230
|
prompt,
|