@inetafrica/open-claudia 2.6.6 → 2.6.7
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/core/runner.js +13 -7
- package/package.json +1 -1
package/core/runner.js
CHANGED
|
@@ -132,6 +132,7 @@ async function buildClaudeArgs(prompt, opts = {}) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
args.push("--model", settings.model || DEFAULT_CLAUDE_MODEL);
|
|
135
|
+
if (opts.maxTurns) args.push("--max-turns", String(opts.maxTurns));
|
|
135
136
|
if (settings.effort) args.push("--effort", settings.effort);
|
|
136
137
|
if (settings.budget) args.push("--max-budget-usd", String(settings.budget));
|
|
137
138
|
if (settings.permissionMode) args.push("--permission-mode", settings.permissionMode);
|
|
@@ -276,6 +277,11 @@ function compactSeedPrompt(summary, extras = {}) {
|
|
|
276
277
|
"Treat the following summary as the prior conversation context. Do not repeat it back unless asked.",
|
|
277
278
|
"Continue from this state in future turns.",
|
|
278
279
|
"",
|
|
280
|
+
// A seed turn that starts working (e.g. resuming a CI watch from the
|
|
281
|
+
// brief) can background a long-running command, and `claude -p` won't
|
|
282
|
+
// exit while a background task runs — that wedges the message queue.
|
|
283
|
+
"RIGHT NOW: reply with ONE short acknowledgement line only. Do NOT use any tools, run any commands, or start/resume any work in this turn — even if the summary, pending tasks, or recent turns suggest obvious next steps. Work resumes with the next user message.",
|
|
284
|
+
"",
|
|
279
285
|
"Before telling the user you lack context on something they reference:",
|
|
280
286
|
"1. Check the summary below.",
|
|
281
287
|
"2. Read the full archived brief on disk (path given below, when present) — it is the detailed version of this summary.",
|
|
@@ -545,10 +551,6 @@ async function compactActiveSession(cwd, opts = {}) {
|
|
|
545
551
|
if (opts.notify) await send(opts.message || "Context is getting large, compacting first so this stays fast…");
|
|
546
552
|
const summaryRun = await runClaudeCapture(compactSummaryPrompt(), cwd, { resumeSessionId: oldSessionId, skipAutoCompact: true, label: "compact-summary", timeoutMs: COMPACT_SUMMARY_TIMEOUT });
|
|
547
553
|
summary = summaryRun.text || "No prior context was returned by the summarizer.";
|
|
548
|
-
state[sessionKey] = null;
|
|
549
|
-
state.sessionUsage = { turns: 0, inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheCreationTokens: 0, costUsd: 0, lastInputTokens: 0 };
|
|
550
|
-
state.isFirstMessage = true;
|
|
551
|
-
saveState();
|
|
552
554
|
} finally {
|
|
553
555
|
state.isCompacting = false;
|
|
554
556
|
saveState();
|
|
@@ -559,9 +561,13 @@ async function compactActiveSession(cwd, opts = {}) {
|
|
|
559
561
|
// Only seed with the condensed version when the full text actually made it to disk.
|
|
560
562
|
const seedSummary = (condensed && briefPath) ? condensed : (condensed ? `${fullBrief}\n\n${condensed}` : fullBrief);
|
|
561
563
|
const repoFacts = collectRepoStateFacts(cwd);
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
564
|
+
// The old session id stays in place until the seed succeeds: if the seed
|
|
565
|
+
// dies (timeout, /stop, crash) the conversation keeps resuming the
|
|
566
|
+
// pre-compaction session instead of being orphaned. maxTurns: 1 hard-stops
|
|
567
|
+
// a seed that ignores the no-work instruction and reaches for tools.
|
|
568
|
+
const seedRun = await runClaudeCapture(compactSeedPrompt(seedSummary, { briefPath, condensed: !!(condensed && briefPath), repoFacts, recentTurns }), cwd, { fresh: true, skipAutoCompact: true, label: "compact-seed", timeoutMs: COMPACT_SUMMARY_TIMEOUT, maxTurns: 1 });
|
|
569
|
+
const newSessionId = seedRun.sessionId || null;
|
|
570
|
+
state[sessionKey] = newSessionId;
|
|
565
571
|
state.isFirstMessage = false;
|
|
566
572
|
state.lastCompactedAt = Date.now();
|
|
567
573
|
state.sessionUsage = { turns: 0, inputTokens: 0, outputTokens: 0, cacheReadTokens: 0, cacheCreationTokens: 0, costUsd: 0, lastInputTokens: 0 };
|
package/package.json
CHANGED