ventureos 1.0.7 → 1.0.8
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/install.js +27 -12
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -15,7 +15,7 @@ import { stdin as input, stdout as output } from 'process';
|
|
|
15
15
|
import fs from 'fs';
|
|
16
16
|
import path from 'path';
|
|
17
17
|
import { fileURLToPath } from 'url';
|
|
18
|
-
import { spawnSync } from 'child_process';
|
|
18
|
+
import { spawnSync, spawn } from 'child_process';
|
|
19
19
|
|
|
20
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
21
21
|
const PACKAGE_ROOT = path.dirname(__filename);
|
|
@@ -488,7 +488,9 @@ async function callLLM(provider, apiKey, model, system, messages) {
|
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
async function callViaCLI(cliCmd, system, messages) {
|
|
491
|
-
// Build full context: system + conversation history + latest user message
|
|
491
|
+
// Build full context: system + conversation history + latest user message.
|
|
492
|
+
// Sent via stdin to avoid ARG_MAX limits and CLI option-parsing issues
|
|
493
|
+
// (e.g. prompts that start with "---" being misread as flags).
|
|
492
494
|
let prompt = system + '\n\n';
|
|
493
495
|
|
|
494
496
|
for (const msg of messages.slice(0, -1)) {
|
|
@@ -499,17 +501,30 @@ async function callViaCLI(cliCmd, system, messages) {
|
|
|
499
501
|
const lastMsg = messages[messages.length - 1];
|
|
500
502
|
prompt += `Human: ${lastMsg.content}`;
|
|
501
503
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
});
|
|
504
|
+
return new Promise((resolve, reject) => {
|
|
505
|
+
const proc = spawn(cliCmd, ['--print', '--dangerously-skip-permissions'], {
|
|
506
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
507
|
+
});
|
|
507
508
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
509
|
+
let stdout = '';
|
|
510
|
+
let stderr = '';
|
|
511
|
+
|
|
512
|
+
proc.stdout.on('data', chunk => { stdout += chunk; });
|
|
513
|
+
proc.stderr.on('data', chunk => { stderr += chunk; });
|
|
514
|
+
|
|
515
|
+
proc.on('close', code => {
|
|
516
|
+
if (code !== 0) {
|
|
517
|
+
reject(new Error(stderr.trim() || `${cliCmd} CLI exited with code ${code}`));
|
|
518
|
+
} else {
|
|
519
|
+
resolve(stdout.trim());
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
proc.on('error', reject);
|
|
524
|
+
|
|
525
|
+
proc.stdin.write(prompt, 'utf8');
|
|
526
|
+
proc.stdin.end();
|
|
527
|
+
});
|
|
513
528
|
}
|
|
514
529
|
|
|
515
530
|
async function callAnthropic(apiKey, model, system, messages) {
|