@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 21 lines 715 Bytes
Raw
1 import { ASSISTANT_CITATION_MAX_COMMENT_LENGTH } from "@t3tools/contracts";
2
3 type AssistantCitationCommentDismissal =
4 | { kind: "commit"; comment: string }
5 | { kind: "close" }
6 | { kind: "keep-open" };
7
8 export function resolveAssistantCitationCommentDismissal({
9 reason,
10 draft,
11 savedComment,
12 }: {
13 reason: string;
14 draft: string | null;
15 savedComment: string | undefined;
16 }): AssistantCitationCommentDismissal {
17 if (reason === "escape-key" || draft === null) return { kind: "close" };
18 if (draft.trim() === (savedComment ?? "").trim()) return { kind: "close" };
19 if (draft.length > ASSISTANT_CITATION_MAX_COMMENT_LENGTH) return { kind: "keep-open" };
20 return { kind: "commit", comment: draft };
21 }