(
input: CreateSessionInput,
messages: readonly StoredMessage[],
)
| 401 | } |
| 402 | |
| 403 | async createImportedSession( |
| 404 | input: CreateSessionInput, |
| 405 | messages: readonly StoredMessage[], |
| 406 | ): Promise<SessionHeader> { |
| 407 | await this.ensureReady(); |
| 408 | assertNoConversationCopyMetadata(input); |
| 409 | if (input.subagentSpawn) { |
| 410 | throw new Error('Subagent spawn metadata requires createSubagent()'); |
| 411 | } |
| 412 | const canonicalMessages = messages.map((message) => |
| 413 | decodeStoredMessage(JSON.parse(JSON.stringify(message)) as unknown), |
| 414 | ); |
| 415 | const header: SessionHeader = { |
| 416 | ...buildSessionHeader(this.workspaceRoot, input), |
| 417 | transcriptLedgerVersion: 0, |
| 418 | }; |
| 419 | const outcome = await this.metadata.importSession( |
| 420 | header, |
| 421 | canonicalMessages, |
| 422 | projectSessionCatalogMessages(canonicalMessages), |
| 423 | ); |
| 424 | if (outcome !== 'imported') { |
| 425 | throw new Error(`Generated Session id already exists: ${header.id}`); |
| 426 | } |
| 427 | return (await this.metadata.read(header.id)).header; |
| 428 | } |
| 429 | |
| 430 | async probeStableSessionCreate( |
| 431 | sessionId: string, |
nothing calls this directly
no test coverage detected