orchestrix-yuri 4.5.8 → 4.5.9
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/gateway/engine/claude-sdk.js +16 -39
- package/package.json +1 -1
|
@@ -194,14 +194,23 @@ const CHANNEL_MODE_INSTRUCTIONS = [
|
|
|
194
194
|
function buildSystemPrompt() {
|
|
195
195
|
const parts = [];
|
|
196
196
|
|
|
197
|
-
// Layer 1: Yuri
|
|
197
|
+
// Layer 1: Yuri persona (extracted essentials from SKILL.md)
|
|
198
|
+
// The full SKILL.md is ~11KB — too large for system prompt.
|
|
199
|
+
// We extract only: persona, principles, commands, greeting templates.
|
|
200
|
+
// Implementation details (tmux rules, memory layout, completion detection)
|
|
201
|
+
// are in task files and loaded by Claude on demand.
|
|
198
202
|
if (fs.existsSync(SKILL_PATH)) {
|
|
199
203
|
let skill = fs.readFileSync(SKILL_PATH, 'utf8');
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
skill = skill.replace(/^---[\s\S]*?---\s*\n/, ''); // strip frontmatter
|
|
205
|
+
|
|
206
|
+
// Extract sections up to "## Phase Execution" (everything after is implementation detail)
|
|
207
|
+
const cutoff = skill.indexOf('## Phase Execution');
|
|
208
|
+
if (cutoff > 0) {
|
|
209
|
+
skill = skill.slice(0, cutoff).trim();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
parts.push(skill);
|
|
203
213
|
} else {
|
|
204
|
-
// Fallback if skill not installed
|
|
205
214
|
parts.push(
|
|
206
215
|
'# Yuri — Meta-Orchestrator\n\n' +
|
|
207
216
|
'You are **Yuri**, a Meta-Orchestrator and Technical Chief of Staff.\n' +
|
|
@@ -274,40 +283,9 @@ function runClaude(args, cwd, timeout) {
|
|
|
274
283
|
return new Promise((resolve) => {
|
|
275
284
|
const binary = getClaudeBinary();
|
|
276
285
|
|
|
277
|
-
|
|
278
|
-
// command-line argument length limits. Claude CLI's --system-prompt
|
|
279
|
-
// with the full SKILL.md (~11KB) exceeds shell/OS arg limits.
|
|
280
|
-
const tmpFiles = [];
|
|
281
|
-
const finalArgs = [];
|
|
282
|
-
for (let i = 0; i < args.length; i++) {
|
|
283
|
-
if (args[i] === '--system-prompt' && args[i + 1] && args[i + 1].length > 1000) {
|
|
284
|
-
const tmpFile = path.join(os.tmpdir(), `yuri-sp-${Date.now()}.txt`);
|
|
285
|
-
fs.writeFileSync(tmpFile, args[i + 1]);
|
|
286
|
-
tmpFiles.push(tmpFile);
|
|
287
|
-
finalArgs.push('--system-prompt-file', tmpFile);
|
|
288
|
-
i++; // skip the value
|
|
289
|
-
} else if (i === args.length - 1 && args[i].length > 1000 && !args[i].startsWith('-')) {
|
|
290
|
-
// Last arg = user prompt, write to temp file for stdin piping
|
|
291
|
-
const tmpFile = path.join(os.tmpdir(), `yuri-prompt-${Date.now()}.txt`);
|
|
292
|
-
fs.writeFileSync(tmpFile, args[i]);
|
|
293
|
-
tmpFiles.push(tmpFile);
|
|
294
|
-
finalArgs.push('-p', '-'); // read prompt from stdin
|
|
295
|
-
// We'll pipe this file via stdin below
|
|
296
|
-
finalArgs._stdinFile = tmpFile;
|
|
297
|
-
} else {
|
|
298
|
-
finalArgs.push(args[i]);
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
log.engine(`Calling: claude ${finalArgs.slice(0, 4).join(' ')}... (cwd: ${cwd})`);
|
|
303
|
-
|
|
304
|
-
const cleanupTmp = () => {
|
|
305
|
-
for (const f of tmpFiles) {
|
|
306
|
-
try { fs.unlinkSync(f); } catch { /* ok */ }
|
|
307
|
-
}
|
|
308
|
-
};
|
|
286
|
+
log.engine(`Calling: claude ${args.slice(0, 4).join(' ')}... (cwd: ${cwd})`);
|
|
309
287
|
|
|
310
|
-
const proc = execFile(binary,
|
|
288
|
+
const proc = execFile(binary, args, {
|
|
311
289
|
cwd,
|
|
312
290
|
timeout: timeout || 300000,
|
|
313
291
|
maxBuffer: 10 * 1024 * 1024, // 10MB
|
|
@@ -317,7 +295,6 @@ function runClaude(args, cwd, timeout) {
|
|
|
317
295
|
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE: '80',
|
|
318
296
|
},
|
|
319
297
|
}, (err, stdout, stderr) => {
|
|
320
|
-
cleanupTmp();
|
|
321
298
|
if (err && err.killed) {
|
|
322
299
|
log.warn('Claude CLI timed out');
|
|
323
300
|
return resolve({ reply: '⏱ Response timed out.', raw: '' });
|