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

Function toLandingSession

cli/src/hooks/use-freebuff-session.ts:219–249  ·  view source on GitHub ↗
(
  current: FreebuffSessionResponse | null,
)

Source from the content-addressed store, hash-verified

217}
218
219function toLandingSession(
220 current: FreebuffSessionResponse | null,
221): Extract<FreebuffSessionResponse, { status: 'none' }> {
222 const accessTier =
223 current && 'accessTier' in current ? current.accessTier : undefined
224 const queueDepthByModel =
225 current && 'queueDepthByModel' in current
226 ? current.queueDepthByModel
227 : undefined
228 const rateLimitsByModel = getRateLimitsByModel(current)
229 const countryCode =
230 current && 'countryCode' in current ? current.countryCode : undefined
231 const countryBlockReason =
232 current && 'countryBlockReason' in current
233 ? current.countryBlockReason
234 : undefined
235 const ipPrivacySignals =
236 current && 'ipPrivacySignals' in current
237 ? current.ipPrivacySignals
238 : undefined
239
240 return {
241 status: 'none',
242 ...(accessTier ? { accessTier } : {}),
243 ...(queueDepthByModel ? { queueDepthByModel } : {}),
244 ...(rateLimitsByModel ? { rateLimitsByModel } : {}),
245 ...(countryCode ? { countryCode } : {}),
246 ...(countryBlockReason ? { countryBlockReason } : {}),
247 ...(ipPrivacySignals ? { ipPrivacySignals } : {}),
248 }
249}
250
251/** Best-effort DELETE of the caller's session row, gated on actually holding
252 * one. Used both by exit paths and any flow that wants the next POST to

Callers 1

useFreebuffSessionFunction · 0.85

Calls 1

getRateLimitsByModelFunction · 0.90

Tested by

no test coverage detected