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

Function viewForRow

web/src/server/free-session/public-api.ts:291–314  ·  view source on GitHub ↗
(
  userId: string,
  deps: SessionDeps,
  row: InternalSessionRow,
)

Source from the content-addressed store, hash-verified

289}
290
291async function viewForRow(
292 userId: string,
293 deps: SessionDeps,
294 row: InternalSessionRow,
295): Promise<SessionStateResponse | null> {
296 const [position, depthsByModel] =
297 row.status === 'queued'
298 ? await Promise.all([
299 deps.queuePositionFor({
300 userId,
301 model: row.model,
302 queuedAt: row.queued_at,
303 }),
304 deps.queueDepthsByModel(),
305 ])
306 : [0, {}]
307 return toSessionStateResponse({
308 row,
309 position,
310 queueDepthByModel: depthsByModel,
311 graceMs: deps.graceMs,
312 now: nowOf(deps),
313 })
314}
315
316export type RequestSessionResult =
317 | SessionStateResponse

Callers 2

requestSessionFunction · 0.85
getSessionStateFunction · 0.85

Calls 2

toSessionStateResponseFunction · 0.90
nowOfFunction · 0.85

Tested by

no test coverage detected