2026-10-05 22:51:08 +03:00
|
|
|
"use client";
|
2026-10-25 17:18:44 +03:00
|
|
|
import { useI18n } from "@/components/i18n";
|
|
|
|
|
|
2026-10-05 22:51:08 +03:00
|
|
|
|
|
|
|
|
import type { CompactionDetails } from "@/src/core";
|
|
|
|
|
|
|
|
|
|
/** What one divider carries: the marker's full model-facing content (the
|
2026-10-06 14:18:05 +03:00
|
|
|
* [SESSION HISTORY COMPACTED] header + the summary) and its details.
|
|
|
|
|
* The content is deliberately UNRENDERED (owner, release polish
|
|
|
|
|
* 2026-10-06): the compaction summary is model-facing plumbing — anyone
|
|
|
|
|
* who wants to inspect it reads their provider logs. The dividers mark
|
|
|
|
|
* WHERE the cut landed and how big it was; nothing opens. */
|
2026-10-05 22:51:08 +03:00
|
|
|
export interface CompactionDividerData {
|
|
|
|
|
content: string;
|
|
|
|
|
details: CompactionDetails;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** The moment divider (owner round 14): minimal centered small text where
|
|
|
|
|
* the user currently is — the retrying-message register (SystemLine's
|
|
|
|
|
* exact classes), NO horizontal rule. The transcript's quiet note that
|
2026-10-06 14:18:05 +03:00
|
|
|
* history was just summarized; the cut divider below carries the seam.
|
|
|
|
|
* Inert since release polish 2026-10-06 — plain text, no affordance. */
|
|
|
|
|
export function CompactionMomentDivider({ data: _data }: { data: CompactionDividerData }) {
|
2026-10-25 17:18:44 +03:00
|
|
|
const { t } = useI18n();
|
2026-10-05 22:51:08 +03:00
|
|
|
return (
|
|
|
|
|
<div className="flex w-full items-center justify-center py-1">
|
2026-10-06 14:18:05 +03:00
|
|
|
<span data-testid="compaction-divider" className="px-1.5 text-xs text-muted-foreground/70">
|
2026-10-25 17:18:44 +03:00
|
|
|
{t("Context compacted")}</span>
|
2026-10-05 22:51:08 +03:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** The cut divider (owner round 14): the LONGER divider at the actual
|
|
|
|
|
* compaction cut — the seam where verbatim history ends and the kept
|
|
|
|
|
* recent tail begins. Phase-divider's geometry (dotted rules + centered
|
2026-10-06 14:18:05 +03:00
|
|
|
* chip) so it reads as a transcript boundary, not a message. Inert
|
|
|
|
|
* since release polish 2026-10-06 — the token count stays, the summary
|
|
|
|
|
* is inspectable only in provider logs. */
|
|
|
|
|
export function CompactionCutDivider({ data }: { data: CompactionDividerData }) {
|
2026-10-25 17:18:44 +03:00
|
|
|
const { t } = useI18n();
|
|
|
|
|
const kTok = data.details.tokensBefore > 0 ? t(" · {v0}k tok", { v0: Math.round(data.details.tokensBefore / 1000) }) : "";
|
2026-10-05 22:51:08 +03:00
|
|
|
return (
|
2026-10-06 14:18:05 +03:00
|
|
|
<div data-testid="compaction-cut-divider" className="my-4 flex w-full items-center gap-3">
|
2026-10-05 22:51:08 +03:00
|
|
|
<span className="h-0 flex-1 border-t-2 border-dotted border-border/50" aria-hidden />
|
|
|
|
|
<span className="rounded-full border border-border/80 px-2.5 py-0.5 text-xs font-medium uppercase tracking-wide text-muted-foreground">
|
2026-10-25 17:18:44 +03:00
|
|
|
{t("History compacted")}{kTok}
|
2026-10-05 22:51:08 +03:00
|
|
|
</span>
|
|
|
|
|
<span className="h-0 flex-1 border-t-2 border-dotted border-border/50" aria-hidden />
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|