MCPcopy
hub / github.com/superagent-ai/grok-cli / createSession

Method createSession

src/storage/sessions.ts:52–75  ·  view source on GitHub ↗
(model: string, mode: AgentMode, cwd: string)

Source from the content-addressed store, hash-verified

50 }
51
52 createSession(model: string, mode: AgentMode, cwd: string): SessionInfo {
53 const now = new Date().toISOString();
54 const id = createSessionId();
55 const db = getDatabase();
56
57 db.prepare(`
58 INSERT INTO sessions (
59 id, workspace_id, title, recap_text, recap_model, recap_updated_at, model, mode, cwd_at_start, cwd_last, status, created_at, updated_at
60 ) VALUES (
61 @id, @workspace_id, NULL, NULL, NULL, NULL, @model, @mode, @cwd_at_start, @cwd_last, 'active', @created_at, @updated_at
62 )
63 `).run({
64 id,
65 workspace_id: this.workspace.id,
66 model,
67 mode,
68 cwd_at_start: cwd,
69 cwd_last: cwd,
70 created_at: now,
71 updated_at: now,
72 });
73
74 return this.getRequiredSession(id);
75 }
76
77 getLatestSession(): SessionInfo | null {
78 const row = getDatabase()

Callers 2

openSessionMethod · 0.95
sessions.test.tsFile · 0.45

Calls 5

getRequiredSessionMethod · 0.95
getDatabaseFunction · 0.90
createSessionIdFunction · 0.85
runMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected