MCPcopy
hub / github.com/codeaashu/claude-code / useTeleportResume

Function useTeleportResume

src/hooks/useTeleportResume.tsx:15–84  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

13};
14export type TeleportSource = 'cliArg' | 'localCommand';
15export function useTeleportResume(source) {
16 const $ = _c(8);
17 const [isResuming, setIsResuming] = useState(false);
18 const [error, setError] = useState(null);
19 const [selectedSession, setSelectedSession] = useState(null);
20 let t0;
21 if ($[0] !== source) {
22 t0 = async session => {
23 setIsResuming(true);
24 setError(null);
25 setSelectedSession(session);
26 logEvent("tengu_teleport_resume_session", {
27 source: source as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
28 session_id: session.id as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS
29 });
30 ;
31 try {
32 const result = await teleportResumeCodeSession(session.id);
33 setTeleportedSessionInfo({
34 sessionId: session.id
35 });
36 setIsResuming(false);
37 return result;
38 } catch (t1) {
39 const err = t1;
40 const teleportError = {
41 message: err instanceof TeleportOperationError ? err.message : errorMessage(err),
42 formattedMessage: err instanceof TeleportOperationError ? err.formattedMessage : undefined,
43 isOperationError: err instanceof TeleportOperationError
44 };
45 setError(teleportError);
46 setIsResuming(false);
47 return null;
48 }
49 };
50 $[0] = source;
51 $[1] = t0;
52 } else {
53 t0 = $[1];
54 }
55 const resumeSession = t0;
56 let t1;
57 if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
58 t1 = () => {
59 setError(null);
60 };
61 $[2] = t1;
62 } else {
63 t1 = $[2];
64 }
65 const clearError = t1;
66 let t2;
67 if ($[3] !== error || $[4] !== isResuming || $[5] !== resumeSession || $[6] !== selectedSession) {
68 t2 = {
69 resumeSession,
70 isResuming,
71 error,
72 selectedSession,

Callers 1

TeleportResumeWrapperFunction · 0.85

Calls 4

logEventFunction · 0.85
setTeleportedSessionInfoFunction · 0.85
errorMessageFunction · 0.50

Tested by

no test coverage detected