mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-15 19:21:08 +00:00
fix(agents): split preemptive compaction route types
This commit is contained in:
@@ -2,18 +2,14 @@ import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||
import { estimateTokens } from "@mariozechner/pi-coding-agent";
|
||||
import { SAFETY_MARGIN, estimateMessagesTokens } from "../../compaction.js";
|
||||
import { estimateToolResultReductionPotential } from "../tool-result-truncation.js";
|
||||
import type { PreemptiveCompactionRoute } from "./preemptive-compaction.types.js";
|
||||
|
||||
export const PREEMPTIVE_OVERFLOW_ERROR_TEXT =
|
||||
"Context overflow: prompt too large for the model (precheck).";
|
||||
|
||||
const ESTIMATED_CHARS_PER_TOKEN = 4;
|
||||
const TRUNCATION_ROUTE_BUFFER_TOKENS = 512;
|
||||
|
||||
export type PreemptiveCompactionRoute =
|
||||
| "fits"
|
||||
| "compact_only"
|
||||
| "truncate_tool_results_only"
|
||||
| "compact_then_truncate";
|
||||
export type { PreemptiveCompactionRoute } from "./preemptive-compaction.types.js";
|
||||
|
||||
export function estimatePrePromptTokens(params: {
|
||||
messages: AgentMessage[];
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
export type PreemptiveCompactionRoute =
|
||||
| "fits"
|
||||
| "compact_only"
|
||||
| "truncate_tool_results_only"
|
||||
| "compact_then_truncate";
|
||||
@@ -11,7 +11,7 @@ import type { NormalizedUsage } from "../../usage.js";
|
||||
import type { EmbeddedRunReplayMetadata, EmbeddedRunReplayState } from "../replay-state.js";
|
||||
import type { EmbeddedRunLivenessState } from "../types.js";
|
||||
import type { RunEmbeddedPiAgentParams } from "./params.js";
|
||||
import type { PreemptiveCompactionRoute } from "./preemptive-compaction.js";
|
||||
import type { PreemptiveCompactionRoute } from "./preemptive-compaction.types.js";
|
||||
|
||||
type EmbeddedRunAttemptBase = Omit<
|
||||
RunEmbeddedPiAgentParams,
|
||||
|
||||
Reference in New Issue
Block a user