MCPcopy Create free account
hub / github.com/cortexkit/magic-context / showRecompDialog

Function showRecompDialog

packages/plugin/src/tui/index.tsx:386–422  ·  view source on GitHub ↗
(api: TuiPluginApi, targetSessionId = getSessionId(api))

Source from the content-addressed store, hash-verified

384}
385
386async function showRecompDialog(api: TuiPluginApi, targetSessionId = getSessionId(api)): Promise<boolean> {
387 const sessionId = targetSessionId
388 if (!sessionId) {
389 showToast(api, { message: "No active session", variant: "warning" })
390 return false
391 }
392
393 const count = await getCompartmentCount(sessionId)
394 // Ack only after the dialog is actually shown for the same active session;
395 // route switches while the RPC detail load is in flight must leave it pending.
396 if (getSessionId(api) !== sessionId) return false
397
398 api.ui.dialog.replace(() => (
399 <api.ui.DialogConfirm
400 title="⚠️ Recomp Confirmation"
401 message={[
402 count === 0
403 ? "This session has no compartments yet — recomp will build them from raw history."
404 : `You have ${count} compartments.`,
405 "",
406 "Recomp will regenerate all compartments and facts from raw history.",
407 "This may take a long time and consume significant tokens.",
408 "",
409 "Proceed?",
410 ].join("\n")}
411 onConfirm={() => {
412 void requestRecomp(sessionId)
413 kickRecompProgressRefresh()
414 showToast(api, { message: "Recomp requested — historian will start shortly", variant: "info" })
415 }}
416 onCancel={() => {
417 showToast(api, { message: "Recomp cancelled", variant: "info", durationOverrideMs: 3000 })
418 }}
419 />
420 ))
421 return true
422}
423
424function showUpgradeDialog(
425 api: TuiPluginApi,

Callers 3

runFunction · 0.85
onSelectFunction · 0.85
handleNotificationFunction · 0.85

Calls 5

getCompartmentCountFunction · 0.90
requestRecompFunction · 0.90
getSessionIdFunction · 0.85
showToastFunction · 0.70

Tested by

no test coverage detected