mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 12:41:42 +00:00
Agent: unify bootstrap truncation warning handling (#32769)
Merged via squash.
Prepared head SHA: 5d6d4ddfa6
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
committed by
GitHub
parent
3ad3a90db3
commit
e4b4486a96
@@ -84,6 +84,7 @@ export function stripThoughtSignatures<T>(
|
||||
|
||||
export const DEFAULT_BOOTSTRAP_MAX_CHARS = 20_000;
|
||||
export const DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS = 150_000;
|
||||
export const DEFAULT_BOOTSTRAP_PROMPT_TRUNCATION_WARNING_MODE = "once";
|
||||
const MIN_BOOTSTRAP_FILE_BUDGET_CHARS = 64;
|
||||
const BOOTSTRAP_HEAD_RATIO = 0.7;
|
||||
const BOOTSTRAP_TAIL_RATIO = 0.2;
|
||||
@@ -111,6 +112,16 @@ export function resolveBootstrapTotalMaxChars(cfg?: OpenClawConfig): number {
|
||||
return DEFAULT_BOOTSTRAP_TOTAL_MAX_CHARS;
|
||||
}
|
||||
|
||||
export function resolveBootstrapPromptTruncationWarningMode(
|
||||
cfg?: OpenClawConfig,
|
||||
): "off" | "once" | "always" {
|
||||
const raw = cfg?.agents?.defaults?.bootstrapPromptTruncationWarning;
|
||||
if (raw === "off" || raw === "once" || raw === "always") {
|
||||
return raw;
|
||||
}
|
||||
return DEFAULT_BOOTSTRAP_PROMPT_TRUNCATION_WARNING_MODE;
|
||||
}
|
||||
|
||||
function trimBootstrapContent(
|
||||
content: string,
|
||||
fileName: string,
|
||||
|
||||
Reference in New Issue
Block a user