reAppendSessionMetadata method
Re-append cached session metadata to the end of the transcript.
Implementation
void reAppendSessionMetadata({bool skipTitleRefresh = false}) {
if (_sessionFile == null) return;
if (currentSessionLastPrompt != null) {
_appendEntryToFileSync(_sessionFile!, {
'type': 'last-prompt',
'lastPrompt': currentSessionLastPrompt,
'sessionId': _sessionId,
});
}
if (currentSessionTitle != null) {
_appendEntryToFileSync(_sessionFile!, {
'type': 'custom-title',
'customTitle': currentSessionTitle,
'sessionId': _sessionId,
});
}
if (currentSessionTag != null) {
_appendEntryToFileSync(_sessionFile!, {
'type': 'tag',
'tag': currentSessionTag,
'sessionId': _sessionId,
});
}
if (currentSessionAgentName != null) {
_appendEntryToFileSync(_sessionFile!, {
'type': 'agent-name',
'agentName': currentSessionAgentName,
'sessionId': _sessionId,
});
}
if (currentSessionAgentColor != null) {
_appendEntryToFileSync(_sessionFile!, {
'type': 'agent-color',
'agentColor': currentSessionAgentColor,
'sessionId': _sessionId,
});
}
if (currentSessionMode != null) {
_appendEntryToFileSync(_sessionFile!, {
'type': 'mode',
'mode': currentSessionMode,
'sessionId': _sessionId,
});
}
if (currentSessionPrLink != null) {
_appendEntryToFileSync(_sessionFile!, {
'type': 'pr-link',
'sessionId': _sessionId,
'prNumber': currentSessionPrLink!.prNumber,
'prUrl': currentSessionPrLink!.prUrl,
'prRepository': currentSessionPrLink!.prRepository,
'timestamp': DateTime.now().toUtc().toIso8601String(),
});
}
}