cyrus-claude-runner 0.0.1
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/LICENSE +21 -0
- package/dist/ClaudeRunner.d.ts +59 -0
- package/dist/ClaudeRunner.d.ts.map +1 -0
- package/dist/ClaudeRunner.js +381 -0
- package/dist/ClaudeRunner.js.map +1 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +54 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +30 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ceedar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import type { ClaudeRunnerConfig, ClaudeRunnerEvents, ClaudeProcessInfo } from './types.js';
|
|
3
|
+
export declare interface ClaudeRunner {
|
|
4
|
+
on<K extends keyof ClaudeRunnerEvents>(event: K, listener: ClaudeRunnerEvents[K]): this;
|
|
5
|
+
emit<K extends keyof ClaudeRunnerEvents>(event: K, ...args: Parameters<ClaudeRunnerEvents[K]>): boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Manages spawning and communication with Claude CLI processes
|
|
9
|
+
*/
|
|
10
|
+
export declare class ClaudeRunner extends EventEmitter {
|
|
11
|
+
private config;
|
|
12
|
+
private process;
|
|
13
|
+
private parser;
|
|
14
|
+
private startedAt;
|
|
15
|
+
private logStream;
|
|
16
|
+
private sessionId;
|
|
17
|
+
constructor(config: ClaudeRunnerConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Spawn a new Claude process
|
|
20
|
+
*/
|
|
21
|
+
spawn(): ClaudeProcessInfo;
|
|
22
|
+
/**
|
|
23
|
+
* Send input to Claude
|
|
24
|
+
*/
|
|
25
|
+
sendInput(input: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Send initial prompt and close stdin
|
|
28
|
+
*/
|
|
29
|
+
sendInitialPrompt(prompt: string): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* Kill the Claude process
|
|
32
|
+
*/
|
|
33
|
+
kill(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Check if process is running
|
|
36
|
+
*/
|
|
37
|
+
isRunning(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Build command line arguments
|
|
40
|
+
*/
|
|
41
|
+
private buildArgs;
|
|
42
|
+
/**
|
|
43
|
+
* Set up parser event handlers
|
|
44
|
+
*/
|
|
45
|
+
private setupParserEvents;
|
|
46
|
+
/**
|
|
47
|
+
* Set up process event handlers
|
|
48
|
+
*/
|
|
49
|
+
private setupProcessEvents;
|
|
50
|
+
/**
|
|
51
|
+
* Set up logging to .cyrus directory
|
|
52
|
+
*/
|
|
53
|
+
private setupLogging;
|
|
54
|
+
/**
|
|
55
|
+
* Update log file path when session ID is captured
|
|
56
|
+
*/
|
|
57
|
+
private updateLogFilePath;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=ClaudeRunner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClaudeRunner.d.ts","sourceRoot":"","sources":["../src/ClaudeRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAMrC,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE3F,MAAM,CAAC,OAAO,WAAW,YAAY;IACnC,EAAE,CAAC,CAAC,SAAS,MAAM,kBAAkB,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAA;IACvF,IAAI,CAAC,CAAC,SAAS,MAAM,kBAAkB,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAA;CACxG;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,SAAS,CAAsB;gBAE3B,MAAM,EAAE,kBAAkB;IAUtC;;OAEG;IACH,KAAK,IAAI,iBAAiB;IAmF1B;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA+B7C;;OAEG;IACG,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAatD;;OAEG;IACH,IAAI,IAAI,IAAI;IAQZ;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,OAAO,CAAC,SAAS;IA4BjB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAyDzB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAwE1B;;OAEG;IACH,OAAO,CAAC,YAAY;IAsCpB;;OAEG;IACH,OAAO,CAAC,iBAAiB;CAqC1B"}
|
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
import { mkdirSync, createWriteStream } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { homedir } from 'os';
|
|
6
|
+
import { StdoutParser } from 'cyrus-claude-parser';
|
|
7
|
+
/**
|
|
8
|
+
* Manages spawning and communication with Claude CLI processes
|
|
9
|
+
*/
|
|
10
|
+
export class ClaudeRunner extends EventEmitter {
|
|
11
|
+
config;
|
|
12
|
+
process = null;
|
|
13
|
+
parser = null;
|
|
14
|
+
startedAt = null;
|
|
15
|
+
logStream = null;
|
|
16
|
+
sessionId = null;
|
|
17
|
+
constructor(config) {
|
|
18
|
+
super();
|
|
19
|
+
this.config = config;
|
|
20
|
+
// Forward config callbacks to events
|
|
21
|
+
if (config.onEvent)
|
|
22
|
+
this.on('message', config.onEvent);
|
|
23
|
+
if (config.onError)
|
|
24
|
+
this.on('error', config.onError);
|
|
25
|
+
if (config.onExit)
|
|
26
|
+
this.on('exit', config.onExit);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Spawn a new Claude process
|
|
30
|
+
*/
|
|
31
|
+
spawn() {
|
|
32
|
+
if (this.process) {
|
|
33
|
+
throw new Error('Claude process already running');
|
|
34
|
+
}
|
|
35
|
+
// Build command arguments
|
|
36
|
+
const args = this.buildArgs();
|
|
37
|
+
const command = `${this.config.claudePath} ${args.join(' ')} | jq -c .`;
|
|
38
|
+
// Debug logging
|
|
39
|
+
console.error('[ClaudeRunner] Spawning command:', command);
|
|
40
|
+
console.error('[ClaudeRunner] Working directory:', this.config.workingDirectory);
|
|
41
|
+
console.error('[ClaudeRunner] Claude path:', this.config.claudePath);
|
|
42
|
+
// Ensure working directory exists
|
|
43
|
+
if (this.config.workingDirectory) {
|
|
44
|
+
try {
|
|
45
|
+
mkdirSync(this.config.workingDirectory, { recursive: true });
|
|
46
|
+
console.error('[ClaudeRunner] Created working directory');
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
console.error('[ClaudeRunner] Failed to create working directory:', err);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Spawn the process
|
|
53
|
+
console.log('[ClaudeRunner] Spawning Claude process...');
|
|
54
|
+
this.process = spawn('sh', ['-c', command], {
|
|
55
|
+
cwd: this.config.workingDirectory,
|
|
56
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
57
|
+
shell: false // We're already using sh -c
|
|
58
|
+
});
|
|
59
|
+
this.startedAt = new Date();
|
|
60
|
+
console.log(`[ClaudeRunner] Process spawned with PID: ${this.process.pid}`);
|
|
61
|
+
// Set up stdout parser
|
|
62
|
+
this.parser = new StdoutParser();
|
|
63
|
+
this.setupParserEvents();
|
|
64
|
+
// Handle process events
|
|
65
|
+
this.setupProcessEvents();
|
|
66
|
+
// Set up logging
|
|
67
|
+
this.setupLogging();
|
|
68
|
+
// Pipe stdout through parser
|
|
69
|
+
if (this.process.stdout) {
|
|
70
|
+
console.log('[ClaudeRunner] Setting up stdout data handler');
|
|
71
|
+
this.process.stdout.on('data', (chunk) => {
|
|
72
|
+
const chunkStr = chunk.toString();
|
|
73
|
+
console.log(`[ClaudeRunner] Received stdout data, length: ${chunk.length} bytes`);
|
|
74
|
+
console.log(`[ClaudeRunner] First 200 chars of stdout: ${chunkStr.substring(0, 200)}`);
|
|
75
|
+
// Log raw stdout to file for debugging
|
|
76
|
+
if (this.logStream) {
|
|
77
|
+
const stdoutEvent = {
|
|
78
|
+
type: 'stdout-raw',
|
|
79
|
+
data: chunkStr,
|
|
80
|
+
timestamp: new Date().toISOString()
|
|
81
|
+
};
|
|
82
|
+
this.logStream.write(JSON.stringify(stdoutEvent) + '\n');
|
|
83
|
+
}
|
|
84
|
+
this.parser?.processData(chunk);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
console.error('[ClaudeRunner] Warning: process.stdout is null');
|
|
89
|
+
}
|
|
90
|
+
// Check stdin availability
|
|
91
|
+
if (this.process.stdin) {
|
|
92
|
+
console.log('[ClaudeRunner] stdin is available');
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
console.error('[ClaudeRunner] Warning: process.stdin is null');
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
process: this.process,
|
|
99
|
+
pid: this.process.pid,
|
|
100
|
+
startedAt: this.startedAt
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Send input to Claude
|
|
105
|
+
*/
|
|
106
|
+
async sendInput(input) {
|
|
107
|
+
console.log(`[ClaudeRunner] sendInput called with input length: ${input.length} characters`);
|
|
108
|
+
if (!this.process || !this.process.stdin) {
|
|
109
|
+
console.error('[ClaudeRunner] No active Claude process or stdin');
|
|
110
|
+
throw new Error('No active Claude process');
|
|
111
|
+
}
|
|
112
|
+
return new Promise((resolve, reject) => {
|
|
113
|
+
// Just send the input directly, no heredoc needed
|
|
114
|
+
const inputWithNewline = input.endsWith('\n') ? input : input + '\n';
|
|
115
|
+
console.log(`[ClaudeRunner] Writing to stdin, input: "${inputWithNewline.trim()}"`);
|
|
116
|
+
this.process.stdin.write(inputWithNewline, (err) => {
|
|
117
|
+
if (err) {
|
|
118
|
+
console.error('[ClaudeRunner] Error writing to stdin:', err);
|
|
119
|
+
reject(err);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
console.log('[ClaudeRunner] Successfully wrote to stdin');
|
|
123
|
+
// Close stdin after writing for --continue mode
|
|
124
|
+
if (this.config.continueSession) {
|
|
125
|
+
this.process.stdin.end();
|
|
126
|
+
console.log('[ClaudeRunner] Closed stdin for continue mode');
|
|
127
|
+
}
|
|
128
|
+
resolve();
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Send initial prompt and close stdin
|
|
135
|
+
*/
|
|
136
|
+
async sendInitialPrompt(prompt) {
|
|
137
|
+
console.log(`[ClaudeRunner] sendInitialPrompt called with prompt length: ${prompt.length} characters`);
|
|
138
|
+
try {
|
|
139
|
+
await this.sendInput(prompt);
|
|
140
|
+
console.log('[ClaudeRunner] sendInput completed, closing stdin');
|
|
141
|
+
this.process?.stdin?.end();
|
|
142
|
+
console.log('[ClaudeRunner] stdin closed successfully');
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
console.error('[ClaudeRunner] Error in sendInitialPrompt:', error);
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Kill the Claude process
|
|
151
|
+
*/
|
|
152
|
+
kill() {
|
|
153
|
+
if (this.process) {
|
|
154
|
+
this.process.kill('SIGTERM');
|
|
155
|
+
this.process = null;
|
|
156
|
+
this.parser = null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Check if process is running
|
|
161
|
+
*/
|
|
162
|
+
isRunning() {
|
|
163
|
+
return this.process !== null && !this.process.killed;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Build command line arguments
|
|
167
|
+
*/
|
|
168
|
+
buildArgs() {
|
|
169
|
+
const args = [
|
|
170
|
+
'--print',
|
|
171
|
+
'--verbose',
|
|
172
|
+
'--output-format',
|
|
173
|
+
'stream-json'
|
|
174
|
+
];
|
|
175
|
+
// Add continue flag if specified
|
|
176
|
+
if (this.config.continueSession) {
|
|
177
|
+
args.push('--continue');
|
|
178
|
+
}
|
|
179
|
+
// Add allowed tools
|
|
180
|
+
if (this.config.allowedTools && this.config.allowedTools.length > 0) {
|
|
181
|
+
args.push('--allowedTools');
|
|
182
|
+
args.push(...this.config.allowedTools);
|
|
183
|
+
}
|
|
184
|
+
// Add allowed directories
|
|
185
|
+
if (this.config.allowedDirectories && this.config.allowedDirectories.length > 0) {
|
|
186
|
+
args.push('--add-dir');
|
|
187
|
+
args.push(...this.config.allowedDirectories);
|
|
188
|
+
}
|
|
189
|
+
return args;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Set up parser event handlers
|
|
193
|
+
*/
|
|
194
|
+
setupParserEvents() {
|
|
195
|
+
if (!this.parser)
|
|
196
|
+
return;
|
|
197
|
+
// Forward all events
|
|
198
|
+
this.parser.on('message', (event) => {
|
|
199
|
+
// Capture session ID from the first event if available
|
|
200
|
+
if (!this.sessionId && 'sessionId' in event && event.sessionId) {
|
|
201
|
+
this.sessionId = event.sessionId;
|
|
202
|
+
console.log(`[ClaudeRunner] Captured session ID: ${this.sessionId}`);
|
|
203
|
+
this.updateLogFilePath();
|
|
204
|
+
}
|
|
205
|
+
// Log the event
|
|
206
|
+
if (this.logStream) {
|
|
207
|
+
this.logStream.write(JSON.stringify(event) + '\n');
|
|
208
|
+
}
|
|
209
|
+
this.emit('message', event);
|
|
210
|
+
});
|
|
211
|
+
this.parser.on('assistant', (event) => {
|
|
212
|
+
this.emit('assistant', event);
|
|
213
|
+
});
|
|
214
|
+
this.parser.on('tool-use', (toolName, input) => {
|
|
215
|
+
this.emit('tool-use', toolName, input);
|
|
216
|
+
});
|
|
217
|
+
this.parser.on('text', (text) => {
|
|
218
|
+
this.emit('text', text);
|
|
219
|
+
});
|
|
220
|
+
this.parser.on('end-turn', (lastText) => {
|
|
221
|
+
this.emit('end-turn', lastText);
|
|
222
|
+
});
|
|
223
|
+
this.parser.on('result', (event) => {
|
|
224
|
+
this.emit('result', event);
|
|
225
|
+
});
|
|
226
|
+
this.parser.on('error', (error) => {
|
|
227
|
+
if (error instanceof Error) {
|
|
228
|
+
this.emit('error', error);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
// Convert ErrorEvent/ToolErrorEvent to Error
|
|
232
|
+
const message = 'message' in error ? error.message :
|
|
233
|
+
'error' in error ? error.error :
|
|
234
|
+
'Unknown error';
|
|
235
|
+
this.emit('error', new Error(message));
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
this.parser.on('token-limit', () => {
|
|
239
|
+
this.emit('token-limit');
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Set up process event handlers
|
|
244
|
+
*/
|
|
245
|
+
setupProcessEvents() {
|
|
246
|
+
if (!this.process)
|
|
247
|
+
return;
|
|
248
|
+
this.process.on('error', (error) => {
|
|
249
|
+
this.emit('error', new Error(`Claude process error: ${error.message}`));
|
|
250
|
+
});
|
|
251
|
+
this.process.on('exit', (code, signal) => {
|
|
252
|
+
console.log(`[ClaudeRunner] Process exited with code: ${code}, signal: ${signal}`);
|
|
253
|
+
// Log exit to file
|
|
254
|
+
if (this.logStream) {
|
|
255
|
+
const exitEvent = {
|
|
256
|
+
type: 'process-exit',
|
|
257
|
+
code,
|
|
258
|
+
signal,
|
|
259
|
+
timestamp: new Date().toISOString()
|
|
260
|
+
};
|
|
261
|
+
this.logStream.write(JSON.stringify(exitEvent) + '\n');
|
|
262
|
+
}
|
|
263
|
+
// Process any remaining data
|
|
264
|
+
if (this.parser) {
|
|
265
|
+
console.log('[ClaudeRunner] Processing any remaining parser data');
|
|
266
|
+
this.parser.processEnd();
|
|
267
|
+
}
|
|
268
|
+
this.emit('exit', code);
|
|
269
|
+
this.process = null;
|
|
270
|
+
this.parser = null;
|
|
271
|
+
// Close log stream
|
|
272
|
+
if (this.logStream) {
|
|
273
|
+
this.logStream.end();
|
|
274
|
+
this.logStream = null;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
// Capture stderr
|
|
278
|
+
if (this.process.stderr) {
|
|
279
|
+
console.log('[ClaudeRunner] Setting up stderr handler');
|
|
280
|
+
let stderrBuffer = '';
|
|
281
|
+
this.process.stderr.on('data', (chunk) => {
|
|
282
|
+
const chunkStr = chunk.toString();
|
|
283
|
+
console.log(`[ClaudeRunner] Received stderr data: ${chunkStr}`);
|
|
284
|
+
stderrBuffer += chunkStr;
|
|
285
|
+
// Log to file for debugging
|
|
286
|
+
if (this.logStream) {
|
|
287
|
+
const errorEvent = {
|
|
288
|
+
type: 'stderr',
|
|
289
|
+
data: chunkStr,
|
|
290
|
+
timestamp: new Date().toISOString()
|
|
291
|
+
};
|
|
292
|
+
this.logStream.write(JSON.stringify(errorEvent) + '\n');
|
|
293
|
+
}
|
|
294
|
+
// Emit complete lines
|
|
295
|
+
const lines = stderrBuffer.split('\n');
|
|
296
|
+
stderrBuffer = lines.pop() || '';
|
|
297
|
+
for (const line of lines) {
|
|
298
|
+
if (line.trim()) {
|
|
299
|
+
console.error(`[ClaudeRunner] stderr line: ${line}`);
|
|
300
|
+
this.emit('error', new Error(`Claude stderr: ${line}`));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
console.error('[ClaudeRunner] Warning: process.stderr is null');
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Set up logging to .cyrus directory
|
|
311
|
+
*/
|
|
312
|
+
setupLogging() {
|
|
313
|
+
try {
|
|
314
|
+
// Create logs directory structure: ~/.cyrus/logs/<workspace-name>/
|
|
315
|
+
const cyrusDir = join(homedir(), '.cyrus');
|
|
316
|
+
const logsDir = join(cyrusDir, 'logs');
|
|
317
|
+
// Get workspace name from config or extract from working directory
|
|
318
|
+
const workspaceName = this.config.workspaceName ||
|
|
319
|
+
(this.config.workingDirectory ? this.config.workingDirectory.split('/').pop() : 'default') ||
|
|
320
|
+
'default';
|
|
321
|
+
const workspaceLogsDir = join(logsDir, workspaceName);
|
|
322
|
+
// Create directories
|
|
323
|
+
mkdirSync(workspaceLogsDir, { recursive: true });
|
|
324
|
+
// Create initial log file with timestamp
|
|
325
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
326
|
+
const logFileName = `session-${timestamp}.jsonl`;
|
|
327
|
+
const logFilePath = join(workspaceLogsDir, logFileName);
|
|
328
|
+
console.log(`[ClaudeRunner] Creating log file at: ${logFilePath}`);
|
|
329
|
+
this.logStream = createWriteStream(logFilePath, { flags: 'a' });
|
|
330
|
+
// Write initial metadata
|
|
331
|
+
const metadata = {
|
|
332
|
+
type: 'session-metadata',
|
|
333
|
+
startedAt: this.startedAt?.toISOString(),
|
|
334
|
+
workingDirectory: this.config.workingDirectory,
|
|
335
|
+
workspaceName: workspaceName,
|
|
336
|
+
timestamp: new Date().toISOString()
|
|
337
|
+
};
|
|
338
|
+
this.logStream.write(JSON.stringify(metadata) + '\n');
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
console.error('[ClaudeRunner] Failed to set up logging:', error);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Update log file path when session ID is captured
|
|
346
|
+
*/
|
|
347
|
+
updateLogFilePath() {
|
|
348
|
+
if (!this.sessionId || !this.logStream)
|
|
349
|
+
return;
|
|
350
|
+
try {
|
|
351
|
+
// Close current stream
|
|
352
|
+
this.logStream.end();
|
|
353
|
+
// Create new file with session ID
|
|
354
|
+
const cyrusDir = join(homedir(), '.cyrus');
|
|
355
|
+
const logsDir = join(cyrusDir, 'logs');
|
|
356
|
+
const workspaceName = this.config.workspaceName ||
|
|
357
|
+
(this.config.workingDirectory ? this.config.workingDirectory.split('/').pop() : 'default') ||
|
|
358
|
+
'default';
|
|
359
|
+
const workspaceLogsDir = join(logsDir, workspaceName);
|
|
360
|
+
const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
361
|
+
const logFileName = `session-${this.sessionId}-${timestamp}.jsonl`;
|
|
362
|
+
const logFilePath = join(workspaceLogsDir, logFileName);
|
|
363
|
+
console.log(`[ClaudeRunner] Updating log file to: ${logFilePath}`);
|
|
364
|
+
this.logStream = createWriteStream(logFilePath, { flags: 'a' });
|
|
365
|
+
// Write session metadata
|
|
366
|
+
const metadata = {
|
|
367
|
+
type: 'session-metadata',
|
|
368
|
+
sessionId: this.sessionId,
|
|
369
|
+
startedAt: this.startedAt?.toISOString(),
|
|
370
|
+
workingDirectory: this.config.workingDirectory,
|
|
371
|
+
workspaceName: workspaceName,
|
|
372
|
+
timestamp: new Date().toISOString()
|
|
373
|
+
};
|
|
374
|
+
this.logStream.write(JSON.stringify(metadata) + '\n');
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
console.error('[ClaudeRunner] Failed to update log file path:', error);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
//# sourceMappingURL=ClaudeRunner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClaudeRunner.js","sourceRoot":"","sources":["../src/ClaudeRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAoB,MAAM,IAAI,CAAA;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,YAAY,EAA0D,MAAM,qBAAqB,CA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,CAAA;YAChE,MAAM,WAAW,GAAG,WAAW,IAAI,CAAC,SAAS,IAAI,SAAS,QAAQ,CAAA;YAClE,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,EAAE,WAAW,CAAC,CAAA;YAEvD,OAAO,CAAC,GAAG,CAAC,wCAAwC,WAAW,EAAE,CAAC,CAAA;YAClE,IAAI,CAAC,SAAS,GAAG,iBAAiB,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;YAE/D,yBAAyB;YACzB,MAAM,QAAQ,GAAG;gBACf,IAAI,EAAE,kBAAkB;gBACxB,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE;gBACxC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB;gBAC9C,aAAa,EAAE,aAAa;gBAC5B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACpC,CAAA;YACD,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAA;QAEvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gDAAgD,EAAE,KAAK,CAAC,CAAA;QACxE,CAAC;IACH,CAAC;CACF"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude CLI configuration helpers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* List of all available tools in Claude Code
|
|
6
|
+
*/
|
|
7
|
+
export declare const availableTools: readonly ["Read", "Write", "Edit", "MultiEdit", "Glob", "Grep", "LS", "Bash", "Task", "WebFetch", "TodoRead", "TodoWrite", "NotebookRead", "NotebookEdit", "Batch"];
|
|
8
|
+
export type ToolName = typeof availableTools[number];
|
|
9
|
+
/**
|
|
10
|
+
* Default read-only tools that are safe to enable
|
|
11
|
+
*/
|
|
12
|
+
export declare const readOnlyTools: ToolName[];
|
|
13
|
+
/**
|
|
14
|
+
* Tools that can modify the file system
|
|
15
|
+
*/
|
|
16
|
+
export declare const writeTools: ToolName[];
|
|
17
|
+
/**
|
|
18
|
+
* Get a safe set of tools for read-only operations
|
|
19
|
+
*/
|
|
20
|
+
export declare function getReadOnlyTools(): string[];
|
|
21
|
+
/**
|
|
22
|
+
* Get all available tools
|
|
23
|
+
*/
|
|
24
|
+
export declare function getAllTools(): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Get all tools except Bash (safer default for repository configuration)
|
|
27
|
+
*/
|
|
28
|
+
export declare function getSafeTools(): string[];
|
|
29
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,qKAmBjB,CAAA;AAEV,MAAM,MAAM,QAAQ,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAA;AAEpD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,EAGnC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,QAAQ,EAGhC,CAAA;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,EAAE,CAEtC;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAEvC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude CLI configuration helpers
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* List of all available tools in Claude Code
|
|
6
|
+
*/
|
|
7
|
+
export const availableTools = [
|
|
8
|
+
// File system tools
|
|
9
|
+
'Read', 'Write', 'Edit', 'MultiEdit',
|
|
10
|
+
'Glob', 'Grep', 'LS',
|
|
11
|
+
// Execution tools
|
|
12
|
+
'Bash', 'Task',
|
|
13
|
+
// Web tools
|
|
14
|
+
'WebFetch',
|
|
15
|
+
// Task management
|
|
16
|
+
'TodoRead', 'TodoWrite',
|
|
17
|
+
// Notebook tools
|
|
18
|
+
'NotebookRead', 'NotebookEdit',
|
|
19
|
+
// Utility tools
|
|
20
|
+
'Batch'
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Default read-only tools that are safe to enable
|
|
24
|
+
*/
|
|
25
|
+
export const readOnlyTools = [
|
|
26
|
+
'Read', 'Glob', 'Grep', 'LS', 'WebFetch',
|
|
27
|
+
'TodoRead', 'NotebookRead', 'Task', 'Batch'
|
|
28
|
+
];
|
|
29
|
+
/**
|
|
30
|
+
* Tools that can modify the file system
|
|
31
|
+
*/
|
|
32
|
+
export const writeTools = [
|
|
33
|
+
'Write', 'Edit', 'MultiEdit', 'Bash',
|
|
34
|
+
'TodoWrite', 'NotebookEdit'
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* Get a safe set of tools for read-only operations
|
|
38
|
+
*/
|
|
39
|
+
export function getReadOnlyTools() {
|
|
40
|
+
return [...readOnlyTools];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get all available tools
|
|
44
|
+
*/
|
|
45
|
+
export function getAllTools() {
|
|
46
|
+
return [...availableTools];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get all tools except Bash (safer default for repository configuration)
|
|
50
|
+
*/
|
|
51
|
+
export function getSafeTools() {
|
|
52
|
+
return availableTools.filter(tool => tool !== 'Bash');
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,oBAAoB;IACpB,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW;IACpC,MAAM,EAAE,MAAM,EAAE,IAAI;IAEpB,kBAAkB;IAClB,MAAM,EAAE,MAAM;IAEd,YAAY;IACZ,UAAU;IAEV,kBAAkB;IAClB,UAAU,EAAE,WAAW;IAEvB,iBAAiB;IACjB,cAAc,EAAE,cAAc;IAE9B,gBAAgB;IAChB,OAAO;CACC,CAAA;AAIV;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAe;IACvC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU;IACxC,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO;CAC5C,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAe;IACpC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IACpC,WAAW,EAAE,cAAc;CAC5B,CAAA;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,CAAC,GAAG,aAAa,CAAC,CAAA;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,CAAC,GAAG,cAAc,CAAC,CAAA;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,MAAM,CAAC,CAAA;AACvD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ClaudeRunner } from './ClaudeRunner.js';
|
|
2
|
+
export { availableTools, readOnlyTools, writeTools, getReadOnlyTools, getAllTools, getSafeTools, type ToolName } from './config.js';
|
|
3
|
+
export type { ClaudeRunnerConfig, ClaudeProcessInfo, ClaudeRunnerEvents } from './types.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,KAAK,QAAQ,EACd,MAAM,aAAa,CAAA;AACpB,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,YAAY,EAEb,MAAM,aAAa,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ChildProcess } from 'child_process';
|
|
2
|
+
import type { ClaudeEvent } from 'cyrus-claude-parser';
|
|
3
|
+
export interface ClaudeRunnerConfig {
|
|
4
|
+
claudePath: string;
|
|
5
|
+
workingDirectory?: string;
|
|
6
|
+
allowedTools?: string[];
|
|
7
|
+
allowedDirectories?: string[];
|
|
8
|
+
continueSession?: boolean;
|
|
9
|
+
workspaceName?: string;
|
|
10
|
+
onEvent?: (event: ClaudeEvent) => void;
|
|
11
|
+
onError?: (error: Error) => void;
|
|
12
|
+
onExit?: (code: number | null) => void;
|
|
13
|
+
}
|
|
14
|
+
export interface ClaudeProcessInfo {
|
|
15
|
+
process: ChildProcess;
|
|
16
|
+
pid: number | undefined;
|
|
17
|
+
startedAt: Date;
|
|
18
|
+
}
|
|
19
|
+
export interface ClaudeRunnerEvents {
|
|
20
|
+
'message': (event: ClaudeEvent) => void;
|
|
21
|
+
'assistant': (event: ClaudeEvent) => void;
|
|
22
|
+
'tool-use': (toolName: string, input: any) => void;
|
|
23
|
+
'text': (text: string) => void;
|
|
24
|
+
'end-turn': (lastText: string) => void;
|
|
25
|
+
'result': (event: ClaudeEvent) => void;
|
|
26
|
+
'error': (error: Error) => void;
|
|
27
|
+
'token-limit': () => void;
|
|
28
|
+
'exit': (code: number | null) => void;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAEtD,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACtC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,YAAY,CAAA;IACrB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACvC,WAAW,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACzC,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IAClD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAA;IACtC,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAC/B,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CACtC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cyrus-claude-runner",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Claude process spawning and management for Cyrus",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"cyrus-claude-parser": "0.0.1"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/node": "^20.0.0",
|
|
16
|
+
"typescript": "^5.3.3",
|
|
17
|
+
"vitest": "^1.1.0"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"dev": "tsc --watch",
|
|
25
|
+
"test": "vitest",
|
|
26
|
+
"test:run": "vitest run",
|
|
27
|
+
"typecheck": "tsc --noEmit"
|
|
28
|
+
}
|
|
29
|
+
}
|