p9: add writable s/{id}/env file for session-scoped env injection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-18 19:19:59 +02:00
parent 734d5b4d45
commit 9b747e011b
1 changed files with 10 additions and 0 deletions

View File

@ -33,6 +33,7 @@ var sessionFileList = []struct {
{"mcp", 0444},
{"systemprompt", 0444},
{"params", 0666},
{"env", 0200},
}
// SessionFileStore implements ReadWriteStore for the files within a single
@ -152,6 +153,15 @@ func (s *SessionFileStore) Put(name string, data []byte) error {
}
return s.sess.core.SetGenerationParams(params)
case "env":
for _, line := range strings.Split(string(data), "\n") {
k, v, ok := strings.Cut(strings.TrimSpace(line), "=")
if !ok || k == "" {
continue
}
s.sess.core.SetEnv(k, v)
}
}
return nil
}