chore: bump version to 0.1394

This commit is contained in:
arkon
2026-01-27 02:38:37 +01:00
parent 2a89f2aa51
commit 2d8597a66f
15 changed files with 169 additions and 38 deletions
+18 -6
View File
@@ -1202,18 +1202,24 @@ export class Session extends EventEmitter {
* the response.
*
* @param prompt - The prompt text to send to Claude
* @param options - Optional configuration
* @param options.model - Model to use ('opus', 'sonnet', or full model name). Defaults to default model.
* @param options.onProgress - Callback for progress updates (token count, status)
* @returns Promise resolving to the result text and total cost in USD
* @throws {Error} If a process is already running in this session
*
* @example
* ```typescript
* const session = new Session({ workingDir: '/project' });
* const { result, cost } = await session.runPrompt('Explain this code');
* const { result, cost } = await session.runPrompt('Explain this code', { model: 'opus' });
* console.log(`Response: ${result}`);
* console.log(`Cost: $${cost.toFixed(4)}`);
* ```
*/
async runPrompt(prompt: string): Promise<{ result: string; cost: number }> {
async runPrompt(
prompt: string,
options?: { model?: string; onProgress?: (info: { tokens?: number; status?: string }) => void }
): Promise<{ result: string; cost: number }> {
return new Promise((resolve, reject) => {
if (this.ptyProcess) {
reject(new Error('Session already has a running process'));
@@ -1235,14 +1241,20 @@ export class Session extends EventEmitter {
try {
// Spawn claude in a real PTY
console.log('[Session] Spawning PTY for claude with prompt:', prompt.substring(0, 50));
const model = options?.model;
console.log('[Session] Spawning PTY for claude with prompt:', prompt.substring(0, 50), model ? `(model: ${model})` : '');
this.ptyProcess = pty.spawn('claude', [
const args = [
'-p',
'--dangerously-skip-permissions',
'--output-format', 'stream-json',
prompt
], {
];
if (model) {
args.push('--model', model);
}
args.push(prompt);
this.ptyProcess = pty.spawn('claude', args, {
name: 'xterm-256color',
cols: 120,
rows: 40,