import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; import readline from "node:readline"; import {
isSilentReplyPrefixText,
isSilentReplyText,
SILENT_REPLY_TOKEN,
startsWithSilentToken,
stripLeadingSilentToken,
} from "../../auto-reply/tokens.js";
/** Maximum number of JSONL records to inspect before giving up. */ const SESSION_FILE_MAX_RECORDS = 500; const CLAUDE_PROJECTS_RELATIVE_DIR = path.join(".claude", "projects");
export function resolveFallbackRetryPrompt(params: {
body: string;
isFallbackRetry: boolean;
sessionHasHistory?: boolean;
}): string { if (!params.isFallbackRetry) { return params.body;
} if (!params.sessionHasHistory) { return params.body;
} // Even with persisted session history, fully replacing the body with a // generic "continue where you left off" message strips the original task // from the fallback model's view. Agents then have to reconstruct the // instruction from history alone, which is fragile and sometimes // impossible. Prepend the retry context to the original body instead so // the fallback model has both the recovery signal AND the task. (#65760) return `[Retry after the previous model attempt failed or timed out]\n\n${params.body}`;
}
export function createAcpVisibleTextAccumulator() {
let pendingSilentPrefix = "";
let visibleText = "";
let rawVisibleText = ""; const startsWithWordChar = (chunk: string): boolean => /^[\p{L}\p{N}]/u.test(chunk);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.