MCPcopy Create free account
hub / github.com/Noumena-Network/code / materializeSessionFile

Method materializeSessionFile

src/utils/sessionStorage.ts:1058–1073  ·  view source on GitHub ↗

* Create the session file, write cached startup metadata, and flush * buffered entries. Called on the first user/assistant message.

()

Source from the content-addressed store, hash-verified

1056 * buffered entries. Called on the first user/assistant message.
1057 */
1058 private async materializeSessionFile(): Promise<void> {
1059 // Guard here too — reAppendSessionMetadata writes via appendEntryToFile
1060 // (not appendEntry) so it would bypass the per-entry persistence check
1061 // and create a metadata-only file despite --no-session-persistence.
1062 if (this.shouldSkipPersistence()) return
1063 this.ensureCurrentSessionFile()
1064 // mode/agentSetting are cache-only pre-materialization; write them now.
1065 this.reAppendSessionMetadata()
1066 if (this.pendingEntries.length > 0) {
1067 const buffered = this.pendingEntries
1068 this.pendingEntries = []
1069 for (const entry of buffered) {
1070 await this.appendEntry(entry)
1071 }
1072 }
1073 }
1074
1075 async insertMessageChain(
1076 messages: Transcript,

Callers 1

insertMessageChainMethod · 0.95

Calls 4

shouldSkipPersistenceMethod · 0.95
appendEntryMethod · 0.95

Tested by

no test coverage detected