feat: replaced manual debug request path with automated llm dump

- Replaced the `/debug dump-next-request` command with an updated `/dump` command that exports LLM request context to JSON sidecar files.
- Removed persistent debug path state and manual path configuration in favor of automated generation.
- Updated session logic to handle serializing LLM request context to temporary directories.
- Refactored testing suites to remove path-based debug tests and verify dynamic request file generation.
This commit is contained in:
can1357
2026-06-21 03:18:20 +02:00
parent 72b2885b5f
commit 4d96bcf6b6
11 changed files with 153 additions and 167 deletions
@@ -85,15 +85,30 @@ export class CommandController {
}
}
handleDumpCommand() {
async handleDumpCommand(): Promise<void> {
try {
const formatted = this.ctx.session.formatSessionAsText();
if (!formatted) {
this.ctx.showError("No messages to dump yet.");
return;
}
copyToClipboard(formatted);
this.ctx.showStatus("Session copied to clipboard");
// Build the LLM request JSON sidecar first so its path (and a
// raw-context warning) can be appended to the copied transcript.
let sidecarPath: string | undefined;
let sidecarError: string | undefined;
try {
sidecarPath = await this.ctx.session.dumpLlmRequestToTmpDir();
} catch (error: unknown) {
sidecarError = error instanceof Error ? error.message : "Unknown error";
}
const doc = sidecarPath
? `${formatted}\n\n---\nLLM request JSON: ${sidecarPath}\nThis file persists on disk and may contain raw context/secrets — treat accordingly.`
: formatted;
await copyToClipboard(doc);
const statusParts = ["Session copied to clipboard"];
if (sidecarPath) statusParts.push(`LLM request JSON: ${sidecarPath}`);
if (sidecarError) statusParts.push(`LLM request JSON unavailable: ${sidecarError}`);
this.ctx.showStatus(statusParts.join("\n"));
} catch (error: unknown) {
this.ctx.showError(`Failed to copy session: ${error instanceof Error ? error.message : "Unknown error"}`);
}