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

Function getSessionEnvDirPath

src/utils/sessionEnvironment.ts:16–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14let sessionEnvUnavailableLogged = false
15
16export async function getSessionEnvDirPath(): Promise<string | null> {
17 const sessionEnvDir = join(
18 getClaudeConfigHomeDir(),
19 'session-env',
20 getSessionId(),
21 )
22 try {
23 await mkdir(sessionEnvDir, { recursive: true })
24 return sessionEnvDir
25 } catch (e: unknown) {
26 const code = getErrnoCode(e)
27 if (
28 (code === 'EACCES' || code === 'EPERM' || code === 'EROFS') &&
29 !sessionEnvUnavailableLogged
30 ) {
31 sessionEnvUnavailableLogged = true
32 logForDebugging(
33 `Session environment disabled: cannot create ${sessionEnvDir} (${errorMessage(e)})`,
34 )
35 }
36 if (code === 'EACCES' || code === 'EPERM' || code === 'EROFS') {
37 return null
38 }
39 throw e
40 }
41}
42
43export async function getHookEnvFilePath(
44 hookEvent: 'Setup' | 'SessionStart' | 'CwdChanged' | 'FileChanged',

Callers 3

getHookEnvFilePathFunction · 0.85
clearCwdEnvFilesFunction · 0.85

Calls 5

getSessionIdFunction · 0.85
mkdirFunction · 0.85
getErrnoCodeFunction · 0.85
logForDebuggingFunction · 0.70
errorMessageFunction · 0.70

Tested by

no test coverage detected