(options: CreateSessionOptions)
| 90 | } |
| 91 | |
| 92 | async createSession(options: CreateSessionOptions): Promise<Session> { |
| 93 | const { planMode, kaos, persistenceKaos, sessionStartedProperties, ...coreOptions } = options; |
| 94 | const summary = |
| 95 | kaos === undefined && persistenceKaos === undefined |
| 96 | ? await this.rpc.createSession(coreOptions) |
| 97 | : await this.rpc.createSessionWithKaos(coreOptions, kaos ?? persistenceKaos as Kaos, persistenceKaos); |
| 98 | const session = new Session({ |
| 99 | id: summary.id, |
| 100 | workDir: summary.workDir, |
| 101 | summary, |
| 102 | rpc: this.rpc, |
| 103 | onClose: () => { |
| 104 | this.activeSessions.delete(summary.id); |
| 105 | }, |
| 106 | }); |
| 107 | this.activeSessions.set(session.id, session); |
| 108 | if (planMode === true) { |
| 109 | await session.setPlanMode(true); |
| 110 | } |
| 111 | this.trackSessionStarted(summary.id, false, sessionStartedProperties); |
| 112 | this.trackSessionEvent(session.id, 'session_new'); |
| 113 | return session; |
| 114 | } |
| 115 | |
| 116 | async resumeSession(input: ResumeSessionInput): Promise<Session> { |
| 117 | const id = normalizeSessionId(input.id); |
nothing calls this directly
no test coverage detected