MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / AuthedSurface

Function AuthedSurface

cli/src/app.tsx:347–436  ·  view source on GitHub ↗
({
  chatKey,
  headerContent,
  initialPrompt,
  agentId,
  fileTree,
  inputRef,
  setIsAuthenticated,
  setUser,
  logoutMutation,
  continueChat,
  continueChatId,
  authStatus,
  initialMode,
  gitRoot,
  onSwitchToGitRoot,
  showChatHistory,
  onSelectChat,
  onCancelChatHistory,
  onNewChat,
}: AuthedSurfaceProps)

Source from the content-addressed store, hash-verified

345 * we have a token).
346 */
347const AuthedSurface = ({
348 chatKey,
349 headerContent,
350 initialPrompt,
351 agentId,
352 fileTree,
353 inputRef,
354 setIsAuthenticated,
355 setUser,
356 logoutMutation,
357 continueChat,
358 continueChatId,
359 authStatus,
360 initialMode,
361 gitRoot,
362 onSwitchToGitRoot,
363 showChatHistory,
364 onSelectChat,
365 onCancelChatHistory,
366 onNewChat,
367}: AuthedSurfaceProps) => {
368 const { session, error: sessionError } = useFreebuffSession()
369
370 // Terminal state: a 409 from the gate means another CLI rotated our
371 // instance id. Show a dedicated screen and stop polling — don't fall back
372 // into the waiting room, which would look like normal queued progress.
373 if (IS_FREEBUFF && session?.status === 'superseded') {
374 return <FreebuffSupersededScreen />
375 }
376
377 // Route every non-admitted state through the pre-chat screen:
378 // null → initial GET in flight (brief)
379 // 'none' → no seat yet; show model-picker landing
380 // 'queued' → waiting our turn
381 // 'country_blocked' → terminal region-gate message
382 // 'banned' → terminal account-banned message
383 // 'rate_limited' → hit per-model session quota; terminal for this run
384 // 'takeover_prompt' → another local CLI already holds this account
385 //
386 // 'ended' deliberately falls through to <Chat>: the agent may still be
387 // finishing work under the server-side grace period, and the chat surface
388 // itself swaps the input box for the session-ended banner.
389 if (
390 IS_FREEBUFF &&
391 (session === null ||
392 session.status === 'queued' ||
393 session.status === 'none' ||
394 session.status === 'country_blocked' ||
395 session.status === 'banned' ||
396 session.status === 'rate_limited' ||
397 session.status === 'takeover_prompt')
398 ) {
399 return <WaitingRoomScreen session={session} error={sessionError} />
400 }
401
402 // Chat history renders inside AuthedSurface so the freebuff session stays
403 // mounted while the user browses history. Unmounting this surface would
404 // DELETE the session row and drop the user back into the waiting room on

Callers

nothing calls this directly

Calls 1

useFreebuffSessionFunction · 0.90

Tested by

no test coverage detected