MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / persistToRemote

Method persistToRemote

src/utils/sessionStorage.ts:1339–1380  ·  view source on GitHub ↗
(sessionId: UUID, entry: TranscriptMessage)

Source from the content-addressed store, hash-verified

1337 }
1338
1339 private async persistToRemote(sessionId: UUID, entry: TranscriptMessage) {
1340 if (isShuttingDown()) {
1341 return
1342 }
1343
1344 // CCR v2 path: write as internal worker event
1345 if (this.internalEventWriter) {
1346 try {
1347 await this.internalEventWriter(
1348 'transcript',
1349 entry as unknown as Record<string, unknown>,
1350 {
1351 ...(isCompactBoundaryMessage(entry) && { isCompaction: true }),
1352 ...(entry.agentId && { agentId: entry.agentId }),
1353 },
1354 )
1355 } catch {
1356 logEvent('tengu_session_persistence_failed', {})
1357 logForDebugging('Failed to write transcript as internal event')
1358 }
1359 return
1360 }
1361
1362 // v1 Session Ingress path
1363 if (
1364 !isEnvTruthy(process.env.ENABLE_SESSION_PERSISTENCE) ||
1365 !this.remoteIngressUrl
1366 ) {
1367 return
1368 }
1369
1370 const success = await sessionIngress.appendSessionLog(
1371 sessionId,
1372 entry,
1373 this.remoteIngressUrl,
1374 )
1375
1376 if (!success) {
1377 logEvent('tengu_session_persistence_failed', {})
1378 gracefulShutdownSync(1, 'other')
1379 }
1380 }
1381
1382 setRemoteIngressUrl(url: string): void {
1383 this.remoteIngressUrl = url

Callers 1

appendEntryMethod · 0.95

Calls 6

isShuttingDownFunction · 0.85
isCompactBoundaryMessageFunction · 0.85
logEventFunction · 0.85
gracefulShutdownSyncFunction · 0.85
logForDebuggingFunction · 0.70
isEnvTruthyFunction · 0.70

Tested by

no test coverage detected