session: split FileList into SessionFileList + AgentFileList
Prepare for agent/{aid} sublevel:
- SessionFileList: plan, env (session-level)
- AgentFileList: 21 agent-level files (prompt, state, cfg, etc.)
- NewAgentTree builder for agent file tree
- FileList kept as combined for backward compat
No routing changes yet — existing flat layout still works.
This commit is contained in:
parent
3833ba2860
commit
44a6dda695
|
|
@ -15,14 +15,22 @@ import (
|
||||||
"olliesrv/fs"
|
"olliesrv/fs"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FileList defines the fixed set of files in a session directory.
|
// SessionFileList defines session-level files (shared across agents).
|
||||||
// Permissions come from fs.Perms[fs.PathSessionFile].Files.
|
var SessionFileList = []struct {
|
||||||
var FileList = []struct {
|
|
||||||
Name string
|
Name string
|
||||||
OneShot bool
|
OneShot bool
|
||||||
Async bool
|
Async bool
|
||||||
}{
|
}{
|
||||||
{"plan", false, false},
|
{"plan", false, false},
|
||||||
|
{"env", false, false},
|
||||||
|
}
|
||||||
|
|
||||||
|
// AgentFileList defines agent-level files.
|
||||||
|
var AgentFileList = []struct {
|
||||||
|
Name string
|
||||||
|
OneShot bool
|
||||||
|
Async bool
|
||||||
|
}{
|
||||||
{"ctl", false, true},
|
{"ctl", false, true},
|
||||||
{"prompt", false, true},
|
{"prompt", false, true},
|
||||||
{"fifo.in", false, true},
|
{"fifo.in", false, true},
|
||||||
|
|
@ -37,7 +45,6 @@ var FileList = []struct {
|
||||||
{"ctxsz", false, false},
|
{"ctxsz", false, false},
|
||||||
{"models", false, false},
|
{"models", false, false},
|
||||||
{"systemprompt", false, false},
|
{"systemprompt", false, false},
|
||||||
{"env", false, false},
|
|
||||||
{"tail", false, false},
|
{"tail", false, false},
|
||||||
{"prompt.prev", false, false},
|
{"prompt.prev", false, false},
|
||||||
{"context", false, false},
|
{"context", false, false},
|
||||||
|
|
@ -48,6 +55,9 @@ var FileList = []struct {
|
||||||
{"tools", false, false},
|
{"tools", false, false},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FileList is the combined list (for backward compat in tests).
|
||||||
|
var FileList = append(SessionFileList, AgentFileList...)
|
||||||
|
|
||||||
// sessionFilePerms returns the permission registry for per-session files.
|
// sessionFilePerms returns the permission registry for per-session files.
|
||||||
func sessionFilePerms() map[string]os.FileMode {
|
func sessionFilePerms() map[string]os.FileMode {
|
||||||
return fs.Perms[fs.PathSessionFile].Files
|
return fs.Perms[fs.PathSessionFile].Files
|
||||||
|
|
@ -65,6 +75,19 @@ func NewSessionTree(sess *Session, log *olog.Logger, kill func(), rename func(ne
|
||||||
return fs.NewSynth(specs)
|
return fs.NewSynth(specs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewAgentTree builds the file tree for a single agent within a session.
|
||||||
|
func NewAgentTree(sess *Session, log *olog.Logger, saveTranscript func([]byte) error, invalidateModels func(), resetElevation func(), toolRegistry *tools.Registry) *fs.Tree {
|
||||||
|
h := &sessionHelper{sess: sess, log: log, saveTranscript: saveTranscript, invalidateModels: invalidateModels, resetElevation: resetElevation, toolRegistry: toolRegistry}
|
||||||
|
perms := sessionFilePerms()
|
||||||
|
specs := make([]fs.FileSpec, len(AgentFileList))
|
||||||
|
for i, f := range AgentFileList {
|
||||||
|
specs[i] = h.fileSpec(f.Name, perms[f.Name])
|
||||||
|
specs[i].OneShot = f.OneShot
|
||||||
|
specs[i].Async = f.Async
|
||||||
|
}
|
||||||
|
return fs.NewSynth(specs)
|
||||||
|
}
|
||||||
|
|
||||||
// sessionHelper holds the dependencies needed to build session FileSpecs.
|
// sessionHelper holds the dependencies needed to build session FileSpecs.
|
||||||
type sessionHelper struct {
|
type sessionHelper struct {
|
||||||
sess *Session
|
sess *Session
|
||||||
|
|
|
||||||
Reference in New Issue