fix: remove session compaction card from agent configuration
No adapters currently support configuring compaction, so the info box adds complexity without utility. Will revisit at the adapter level. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,11 +1,6 @@
|
|||||||
import { useState, useEffect, useRef, useMemo, useCallback } from "react";
|
import { useState, useEffect, useRef, useMemo, useCallback } from "react";
|
||||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
import { AGENT_ADAPTER_TYPES } from "@paperclipai/shared";
|
import { AGENT_ADAPTER_TYPES } from "@paperclipai/shared";
|
||||||
import {
|
|
||||||
hasSessionCompactionThresholds,
|
|
||||||
resolveSessionCompactionPolicy,
|
|
||||||
type ResolvedSessionCompactionPolicy,
|
|
||||||
} from "@paperclipai/adapter-utils";
|
|
||||||
import type {
|
import type {
|
||||||
Agent,
|
Agent,
|
||||||
AdapterEnvironmentTestResult,
|
AdapterEnvironmentTestResult,
|
||||||
@@ -408,12 +403,6 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
|
|||||||
heartbeat: mergedHeartbeat,
|
heartbeat: mergedHeartbeat,
|
||||||
};
|
};
|
||||||
}, [isCreate, overlay.heartbeat, runtimeConfig, val]);
|
}, [isCreate, overlay.heartbeat, runtimeConfig, val]);
|
||||||
const sessionCompaction = useMemo(
|
|
||||||
() => resolveSessionCompactionPolicy(adapterType, effectiveRuntimeConfig),
|
|
||||||
[adapterType, effectiveRuntimeConfig],
|
|
||||||
);
|
|
||||||
const showSessionCompactionCard = Boolean(sessionCompaction.adapterSessionManagement);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn("relative", cards && "space-y-6")}>
|
<div className={cn("relative", cards && "space-y-6")}>
|
||||||
{/* ---- Floating Save button (edit mode, when dirty) ---- */}
|
{/* ---- Floating Save button (edit mode, when dirty) ---- */}
|
||||||
@@ -839,12 +828,6 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
|
|||||||
numberHint={help.intervalSec}
|
numberHint={help.intervalSec}
|
||||||
showNumber={val!.heartbeatEnabled}
|
showNumber={val!.heartbeatEnabled}
|
||||||
/>
|
/>
|
||||||
{showSessionCompactionCard && (
|
|
||||||
<SessionCompactionPolicyCard
|
|
||||||
adapterType={adapterType}
|
|
||||||
resolution={sessionCompaction}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
@@ -867,12 +850,6 @@ export function AgentConfigForm(props: AgentConfigFormProps) {
|
|||||||
numberHint={help.intervalSec}
|
numberHint={help.intervalSec}
|
||||||
showNumber={eff("heartbeat", "enabled", heartbeat.enabled !== false)}
|
showNumber={eff("heartbeat", "enabled", heartbeat.enabled !== false)}
|
||||||
/>
|
/>
|
||||||
{showSessionCompactionCard && (
|
|
||||||
<SessionCompactionPolicyCard
|
|
||||||
adapterType={adapterType}
|
|
||||||
resolution={sessionCompaction}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<CollapsibleSection
|
<CollapsibleSection
|
||||||
title="Advanced Run Policy"
|
title="Advanced Run Policy"
|
||||||
@@ -960,69 +937,6 @@ function AdapterEnvironmentResult({ result }: { result: AdapterEnvironmentTestRe
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatSessionThreshold(value: number, suffix: string) {
|
|
||||||
if (value <= 0) return "Off";
|
|
||||||
return `${value.toLocaleString("en-US")} ${suffix}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function SessionCompactionPolicyCard({
|
|
||||||
adapterType,
|
|
||||||
resolution,
|
|
||||||
}: {
|
|
||||||
adapterType: string;
|
|
||||||
resolution: ResolvedSessionCompactionPolicy;
|
|
||||||
}) {
|
|
||||||
const { adapterSessionManagement, policy, source } = resolution;
|
|
||||||
if (!adapterSessionManagement) return null;
|
|
||||||
|
|
||||||
const adapterLabel = adapterLabels[adapterType] ?? adapterType;
|
|
||||||
const sourceLabel = source === "agent_override" ? "Agent override" : "Adapter default";
|
|
||||||
const rotationDisabled = !policy.enabled || !hasSessionCompactionThresholds(policy);
|
|
||||||
const nativeSummary =
|
|
||||||
adapterSessionManagement.nativeContextManagement === "confirmed"
|
|
||||||
? `${adapterLabel} is treated as natively managing long context, so Paperclip fresh-session rotation defaults to off.`
|
|
||||||
: adapterSessionManagement.nativeContextManagement === "likely"
|
|
||||||
? `${adapterLabel} likely manages long context itself, but Paperclip still keeps conservative rotation defaults for now.`
|
|
||||||
: `${adapterLabel} does not have verified native compaction behavior, so Paperclip keeps conservative rotation defaults.`;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="rounded-md border border-sky-500/25 bg-sky-500/10 px-3 py-3 space-y-2">
|
|
||||||
<div className="flex items-center justify-between gap-3">
|
|
||||||
<div className="text-xs font-medium text-sky-50">Session compaction</div>
|
|
||||||
<span className="rounded-full border border-sky-400/30 px-2 py-0.5 text-[11px] text-sky-100">
|
|
||||||
{sourceLabel}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<p className="text-xs text-sky-100/90">
|
|
||||||
{nativeSummary}
|
|
||||||
</p>
|
|
||||||
<p className="text-xs text-sky-100/80">
|
|
||||||
{rotationDisabled
|
|
||||||
? "No Paperclip-managed fresh-session thresholds are active for this adapter."
|
|
||||||
: "Paperclip will start a fresh session when one of these thresholds is reached."}
|
|
||||||
</p>
|
|
||||||
<div className="grid grid-cols-3 gap-2 text-[11px] text-sky-100/85 tabular-nums">
|
|
||||||
<div>
|
|
||||||
<div className="text-sky-100/60">Runs</div>
|
|
||||||
<div>{formatSessionThreshold(policy.maxSessionRuns, "runs")}</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div className="text-sky-100/60">Raw input</div>
|
|
||||||
<div>{formatSessionThreshold(policy.maxRawInputTokens, "tokens")}</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div className="text-sky-100/60">Age</div>
|
|
||||||
<div>{formatSessionThreshold(policy.maxSessionAgeHours, "hours")}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<p className="text-[11px] text-sky-100/75">
|
|
||||||
A large cumulative raw token total does not mean the full session is resent on every heartbeat.
|
|
||||||
{source === "agent_override" && " This agent has an explicit runtimeConfig session compaction override."}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ---- Internal sub-components ---- */
|
/* ---- Internal sub-components ---- */
|
||||||
|
|
||||||
const ENABLED_ADAPTER_TYPES = new Set(["claude_local", "codex_local", "gemini_local", "opencode_local", "cursor"]);
|
const ENABLED_ADAPTER_TYPES = new Set(["claude_local", "codex_local", "gemini_local", "opencode_local", "cursor"]);
|
||||||
|
|||||||
Reference in New Issue
Block a user