MCPcopy Index your code
hub / github.com/continuedev/continue / createSession

Function createSession

extensions/cli/src/session.ts:337–358  ·  view source on GitHub ↗
(
  history: ChatHistoryItem[] = [],
  sessionId?: string,
)

Source from the content-addressed store, hash-verified

335 * Create a new session
336 */
337export function createSession(
338 history: ChatHistoryItem[] = [],
339 sessionId?: string,
340): Session {
341 const session: Session = {
342 sessionId: sessionId ?? uuidv4(),
343 title: DEFAULT_SESSION_TITLE,
344 workspaceDirectory: process.cwd(),
345 history,
346 usage: {
347 totalCost: 0,
348 promptTokens: 0,
349 completionTokens: 0,
350 promptTokensDetails: {
351 cachedTokens: 0,
352 cacheWriteTokens: 0,
353 },
354 },
355 };
356 SessionManager.getInstance().setSession(session);
357 return session;
358}
359
360/**
361 * Clear the current session

Callers 4

loadOrCreateSessionByIdFunction · 0.85
session.test.tsFile · 0.85
serveFunction · 0.85
useChatFunction · 0.85

Calls 2

setSessionMethod · 0.80
getInstanceMethod · 0.45

Tested by

no test coverage detected