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

Function startNewSession

extensions/cli/src/session.ts:557–582  ·  view source on GitHub ↗
(history: ChatHistoryItem[] = [])

Source from the content-addressed store, hash-verified

555 * Start a new session with a new sessionId
556 */
557export function startNewSession(history: ChatHistoryItem[] = []): Session {
558 const manager = SessionManager.getInstance();
559
560 // Clear the current session from memory (don't delete the file)
561 manager.clear();
562
563 // Create a new session with a new sessionId
564 const newSession: Session = {
565 sessionId: uuidv4(),
566 title: DEFAULT_SESSION_TITLE,
567 workspaceDirectory: process.cwd(),
568 history,
569 usage: {
570 totalCost: 0,
571 promptTokens: 0,
572 completionTokens: 0,
573 promptTokensDetails: {
574 cachedTokens: 0,
575 cacheWriteTokens: 0,
576 },
577 },
578 };
579
580 manager.setSession(newSession);
581 return newSession;
582}
583
584/**
585 * Track cost for the current session

Callers 4

session.test.tsFile · 0.85
initializeChatHistoryFunction · 0.85
useChatFunction · 0.85

Calls 3

setSessionMethod · 0.80
getInstanceMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected