mirror of
http://10.0.2.1:3031/sauer/claude-code.git
synced 2026-06-30 11:16:58 +10:00
194 lines
19 KiB
TypeScript
194 lines
19 KiB
TypeScript
|
|
import { c as _c } from "react/compiler-runtime";
|
||
|
|
import type { UUID } from 'crypto';
|
||
|
|
import React, { useCallback } from 'react';
|
||
|
|
import { Box, Text } from '../ink.js';
|
||
|
|
import { useKeybinding } from '../keybindings/useKeybinding.js';
|
||
|
|
import { getAllBaseTools } from '../tools.js';
|
||
|
|
import type { LogOption } from '../types/logs.js';
|
||
|
|
import { formatRelativeTimeAgo } from '../utils/format.js';
|
||
|
|
import { getSessionIdFromLog, isLiteLog, loadFullLog } from '../utils/sessionStorage.js';
|
||
|
|
import { ConfigurableShortcutHint } from './ConfigurableShortcutHint.js';
|
||
|
|
import { Byline } from './design-system/Byline.js';
|
||
|
|
import { KeyboardShortcutHint } from './design-system/KeyboardShortcutHint.js';
|
||
|
|
import { LoadingState } from './design-system/LoadingState.js';
|
||
|
|
import { Messages } from './Messages.js';
|
||
|
|
type Props = {
|
||
|
|
log: LogOption;
|
||
|
|
onExit: () => void;
|
||
|
|
onSelect: (log: LogOption) => void;
|
||
|
|
};
|
||
|
|
export function SessionPreview(t0) {
|
||
|
|
const $ = _c(33);
|
||
|
|
const {
|
||
|
|
log,
|
||
|
|
onExit,
|
||
|
|
onSelect
|
||
|
|
} = t0;
|
||
|
|
const [fullLog, setFullLog] = React.useState(null);
|
||
|
|
let t1;
|
||
|
|
let t2;
|
||
|
|
if ($[0] !== log) {
|
||
|
|
t1 = () => {
|
||
|
|
setFullLog(null);
|
||
|
|
if (isLiteLog(log)) {
|
||
|
|
loadFullLog(log).then(setFullLog);
|
||
|
|
}
|
||
|
|
};
|
||
|
|
t2 = [log];
|
||
|
|
$[0] = log;
|
||
|
|
$[1] = t1;
|
||
|
|
$[2] = t2;
|
||
|
|
} else {
|
||
|
|
t1 = $[1];
|
||
|
|
t2 = $[2];
|
||
|
|
}
|
||
|
|
React.useEffect(t1, t2);
|
||
|
|
const isLoading = isLiteLog(log) && fullLog === null;
|
||
|
|
const displayLog = fullLog ?? log;
|
||
|
|
let t3;
|
||
|
|
if ($[3] !== displayLog) {
|
||
|
|
t3 = getSessionIdFromLog(displayLog) || "" as UUID;
|
||
|
|
$[3] = displayLog;
|
||
|
|
$[4] = t3;
|
||
|
|
} else {
|
||
|
|
t3 = $[4];
|
||
|
|
}
|
||
|
|
const conversationId = t3;
|
||
|
|
let t4;
|
||
|
|
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
||
|
|
t4 = getAllBaseTools();
|
||
|
|
$[5] = t4;
|
||
|
|
} else {
|
||
|
|
t4 = $[5];
|
||
|
|
}
|
||
|
|
const tools = t4;
|
||
|
|
let t5;
|
||
|
|
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
||
|
|
t5 = {
|
||
|
|
context: "Confirmation"
|
||
|
|
};
|
||
|
|
$[6] = t5;
|
||
|
|
} else {
|
||
|
|
t5 = $[6];
|
||
|
|
}
|
||
|
|
useKeybinding("confirm:no", onExit, t5);
|
||
|
|
let t6;
|
||
|
|
if ($[7] !== fullLog || $[8] !== log || $[9] !== onSelect) {
|
||
|
|
t6 = () => {
|
||
|
|
onSelect(fullLog ?? log);
|
||
|
|
};
|
||
|
|
$[7] = fullLog;
|
||
|
|
$[8] = log;
|
||
|
|
$[9] = onSelect;
|
||
|
|
$[10] = t6;
|
||
|
|
} else {
|
||
|
|
t6 = $[10];
|
||
|
|
}
|
||
|
|
const handleSelect = t6;
|
||
|
|
let t7;
|
||
|
|
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
||
|
|
t7 = {
|
||
|
|
context: "Confirmation"
|
||
|
|
};
|
||
|
|
$[11] = t7;
|
||
|
|
} else {
|
||
|
|
t7 = $[11];
|
||
|
|
}
|
||
|
|
useKeybinding("confirm:yes", handleSelect, t7);
|
||
|
|
if (isLoading) {
|
||
|
|
let t8;
|
||
|
|
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
||
|
|
t8 = <LoadingState message={"Loading session\u2026"} />;
|
||
|
|
$[12] = t8;
|
||
|
|
} else {
|
||
|
|
t8 = $[12];
|
||
|
|
}
|
||
|
|
let t9;
|
||
|
|
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
||
|
|
t9 = <Box flexDirection="column" padding={1}>{t8}<Text dimColor={true}><Byline><ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="cancel" /></Byline></Text></Box>;
|
||
|
|
$[13] = t9;
|
||
|
|
} else {
|
||
|
|
t9 = $[13];
|
||
|
|
}
|
||
|
|
return t9;
|
||
|
|
}
|
||
|
|
let t8;
|
||
|
|
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
||
|
|
t8 = [];
|
||
|
|
$[14] = t8;
|
||
|
|
} else {
|
||
|
|
t8 = $[14];
|
||
|
|
}
|
||
|
|
let t10;
|
||
|
|
let t9;
|
||
|
|
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
||
|
|
t9 = [];
|
||
|
|
t10 = new Set();
|
||
|
|
$[15] = t10;
|
||
|
|
$[16] = t9;
|
||
|
|
} else {
|
||
|
|
t10 = $[15];
|
||
|
|
t9 = $[16];
|
||
|
|
}
|
||
|
|
let t11;
|
||
|
|
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
||
|
|
t11 = [];
|
||
|
|
$[17] = t11;
|
||
|
|
} else {
|
||
|
|
t11 = $[17];
|
||
|
|
}
|
||
|
|
let t12;
|
||
|
|
if ($[18] !== conversationId || $[19] !== displayLog.messages) {
|
||
|
|
t12 = <Messages messages={displayLog.messages} tools={tools} commands={t8} verbose={true} toolJSX={null} toolUseConfirmQueue={t9} inProgressToolUseIDs={t10} isMessageSelectorVisible={false} conversationId={conversationId} screen="transcript" streamingToolUses={t11} showAllInTranscript={true} isLoading={false} />;
|
||
|
|
$[18] = conversationId;
|
||
|
|
$[19] = displayLog.messages;
|
||
|
|
$[20] = t12;
|
||
|
|
} else {
|
||
|
|
t12 = $[20];
|
||
|
|
}
|
||
|
|
let t13;
|
||
|
|
if ($[21] !== displayLog.modified) {
|
||
|
|
t13 = formatRelativeTimeAgo(displayLog.modified);
|
||
|
|
$[21] = displayLog.modified;
|
||
|
|
$[22] = t13;
|
||
|
|
} else {
|
||
|
|
t13 = $[22];
|
||
|
|
}
|
||
|
|
const t14 = displayLog.gitBranch ? ` · ${displayLog.gitBranch}` : "";
|
||
|
|
let t15;
|
||
|
|
if ($[23] !== displayLog.messageCount || $[24] !== t13 || $[25] !== t14) {
|
||
|
|
t15 = <Text>{t13} ·{" "}{displayLog.messageCount} messages{t14}</Text>;
|
||
|
|
$[23] = displayLog.messageCount;
|
||
|
|
$[24] = t13;
|
||
|
|
$[25] = t14;
|
||
|
|
$[26] = t15;
|
||
|
|
} else {
|
||
|
|
t15 = $[26];
|
||
|
|
}
|
||
|
|
let t16;
|
||
|
|
if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
|
||
|
|
t16 = <Text dimColor={true}><Byline><KeyboardShortcutHint shortcut="Enter" action="resume" /><ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="cancel" /></Byline></Text>;
|
||
|
|
$[27] = t16;
|
||
|
|
} else {
|
||
|
|
t16 = $[27];
|
||
|
|
}
|
||
|
|
let t17;
|
||
|
|
if ($[28] !== t15) {
|
||
|
|
t17 = <Box flexShrink={0} flexDirection="column" borderTopDimColor={true} borderBottom={false} borderLeft={false} borderRight={false} borderStyle="single" paddingLeft={2}>{t15}{t16}</Box>;
|
||
|
|
$[28] = t15;
|
||
|
|
$[29] = t17;
|
||
|
|
} else {
|
||
|
|
t17 = $[29];
|
||
|
|
}
|
||
|
|
let t18;
|
||
|
|
if ($[30] !== t12 || $[31] !== t17) {
|
||
|
|
t18 = <Box flexDirection="column">{t12}{t17}</Box>;
|
||
|
|
$[30] = t12;
|
||
|
|
$[31] = t17;
|
||
|
|
$[32] = t18;
|
||
|
|
} else {
|
||
|
|
t18 = $[32];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