utils/session/session_utils_full
library
Functions
-
clearCwdEnvFiles(String sessionId)
→ Future<void>
-
Clear CWD-related env files.
-
computeStandaloneAgentContext(String? agentName, String? agentColor)
→ Map<String, dynamic>?
-
Compute standalone agent context for session resume.
-
detectSessionFileType(String filePath)
→ String?
-
Detect session file type from a path.
-
detectSessionPatternType(String pattern)
→ String?
-
Detect session pattern type from a glob pattern.
-
exitRestoredWorktree({Map<String, dynamic>? getCurrentWorktreeSession()?, void restoreWorktreeSession(Map<String, dynamic>?)?, void setCwd(String)?, void setOriginalCwd(String)?, void clearCaches()?})
→ void
-
Undo restoreWorktreeForResume before a mid-session /resume switches to
another session.
-
Flatten a message array into a single text string for Haiku title input.
-
Scan transcript for the last TodoWrite tool_use block and return its todos.
-
generateSessionTitle(String description)
→ Future<String?>
-
Generate a sentence-case session title from a description or first message.
Returns
null on error or if Haiku returns unparseable output.
-
getFilePathFromInput(String toolName, Map<String, dynamic>? toolInput)
→ String?
-
Get the file path from a tool input.
-
getHookEnvFilePath(String sessionId, String hookEvent, int hookIndex)
→ Future<String>
-
Get hook env file path.
-
getSessionEnvDirPath(String sessionId)
→ Future<String>
-
Get the session env directory path.
-
getSessionEnvironmentScript(String sessionId)
→ Future<String?>
-
Get the session environment script (sourced before shell commands).
-
getSessionFileTypeFromInput(String toolName, Map<String, dynamic>? toolInput)
→ String?
-
Get session file type from tool input.
-
Build auth headers for the current session token.
-
getSessionIngressAuthToken()
→ String?
-
Get session ingress authentication token.
Priority: env var > file descriptor > well-known file.
-
getSessionState()
→ SessionState
-
Get the current session state.
-
invalidateSessionEnvCache()
→ void
-
Invalidate the session environment cache.
-
isAutoMemFile(String filePath)
→ bool
-
Check if a file path is an auto memory file.
-
isMemoryFileAccess(String toolName, Map<String, dynamic>? toolInput)
→ bool
-
Check if a tool use constitutes a memory file access.
-
isSessionActivityTrackingActive()
→ bool
-
Check if session activity tracking is active.
-
notifyPermissionModeChanged(String mode)
→ void
-
Fired by onChangeAppState when toolPermissionContext.mode changes.
-
notifySessionMetadataChanged(SessionExternalMetadata metadata)
→ void
-
Notify listeners that session metadata changed.
-
notifySessionStateChanged(SessionState state, {RequiresActionDetails? details})
→ void
-
Notify listeners that session state changed.
-
processSessionStartHooks(String source, {SessionStartHooksOptions? options})
→ Future<List<HookResultMessage>>
-
Process session start hooks.
-
processSetupHooks(String trigger, {bool? forceSyncExecution})
→ Future<List<HookResultMessage>>
-
Process setup hooks.
-
registerSessionActivityCallback(void cb())
→ void
-
Register the keep-alive sender.
-
registerSessionFileAccessHooks({required RegisterHookCallbacksFn registerHookCallbacks, void logEvent(String event, Map<String, dynamic>? props)?})
→ void
-
Register session file access tracking hooks.
-
restoreSessionStateFromLog(ResumeLoadResult result, void setAppState(void (Map<String, dynamic>)))
→ void
-
Restore session state (file history, attribution, todos) from log.
-
restoreWorktreeForResume(Map<String, dynamic>? worktreeSession, {void setCwd(String)?, void setOriginalCwd(String)?, void saveWorktreeState(Map<String, dynamic>?)?, Map<String, dynamic>? getCurrentWorktreeSession()?, void restoreWorktreeSession(Map<String, dynamic>?)?, void clearCaches()?})
→ void
-
Restore worktree working directory on resume.
-
sendSessionActivitySignal()
→ void
-
Send a single keep-alive signal.
-
setExecuteSessionStartHooks(ExecuteSessionStartHooksFn fn)
→ void
-
Set the session-start hooks executor.
-
setExecuteSetupHooks(ExecuteSetupHooksFn fn)
→ void
-
Set the setup hooks executor.
-
setIsBareMode(IsBareModeFn fn)
→ void
-
Set the bare mode checker.
-
setLoadPluginHooks(LoadPluginHooksFn fn)
→ void
-
Set the plugin hooks loader.
-
setPermissionModeChangedListener(PermissionModeChangedListener? cb)
→ void
-
Register the permission-mode-change listener.
-
setQueryHaiku(QueryHaikuFn fn)
→ void
-
Set the Haiku query callback.
-
setSessionMetadataChangedListener(SessionMetadataChangedListener? cb)
→ void
-
Register the session-metadata-change listener.
-
setSessionStateChangedListener(SessionStateChangedListener? cb)
→ void
-
Register the session-state-change listener.
-
startSessionActivity(SessionActivityReason reason)
→ void
-
Increment the activity refcount. When transitioning 0->1, start heartbeat.
-
stopSessionActivity(SessionActivityReason reason)
→ void
-
Decrement the activity refcount. When reaching 0, stop heartbeat and
start idle timer.
-
takeInitialUserMessage()
→ String?
-
Take the pending initial user message (consumed once).
-
unregisterSessionActivityCallback()
→ void
-
Unregister the keep-alive sender.
-
updateSessionIngressAuthToken(String token)
→ void
-
Update the session ingress auth token in-process.