mirror of
https://github.com/bendtherules/opencode-plugin-compaction-prompt.git
synced 2026-08-18 13:42:55 +00:00
feat: always report compaction status
This commit is contained in:
+4
-16
@@ -31,11 +31,7 @@ function buildInstructions(
|
||||
prompt: string,
|
||||
completionMarker: string,
|
||||
memory: string,
|
||||
): string | undefined {
|
||||
if (!prompt && !memory) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
): string {
|
||||
const sections = [
|
||||
"## User Compaction Instructions",
|
||||
`These instructions take precedence over previous instructions if there is conflict. At the very end of the summary, echo exactly: **${completionMarker}**`,
|
||||
@@ -115,17 +111,9 @@ export const CompactionPromptPlugin: Plugin = async (
|
||||
output,
|
||||
): Promise<void> => {
|
||||
const memory = await readMemory(memoryPath, logError);
|
||||
const instructions = buildInstructions(prompt, completionMarker, memory);
|
||||
|
||||
if (!instructions) {
|
||||
if (mode === "replace") {
|
||||
output.prompt = skippedCompactionMarker;
|
||||
} else {
|
||||
output.context.push(skippedCompactionMarker);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
const marker =
|
||||
prompt || memory ? completionMarker : skippedCompactionMarker;
|
||||
const instructions = buildInstructions(prompt, marker, memory);
|
||||
|
||||
if (mode === "replace") {
|
||||
output.prompt = instructions;
|
||||
|
||||
Reference in New Issue
Block a user