9p: make /p createable, fix /p dir mode to 0755, update README
- Add /p to create handler (same pattern as /t and /sk) - Use 0755 for /p directory (prompts aren't executable) - Update README: sk/ is now r/w
This commit is contained in:
parent
7b3e159ac0
commit
0586e94672
|
|
@ -24,8 +24,8 @@ ollie/
|
||||||
agent r/w: active agent name
|
agent r/w: active agent name
|
||||||
model r/w: active model name
|
model r/w: active model name
|
||||||
workdir r/w: working directory for tool execution and system prompt
|
workdir r/w: working directory for tool execution and system prompt
|
||||||
sk/ dir: skills (r/o, from OLLIE_SKILLS_PATH or ~/.config/ollie/skills/)
|
sk/ dir: skills (r/w, from OLLIE_SKILLS_PATH or ~/.config/ollie/skills/)
|
||||||
<name>.md read: skill SKILL.md content
|
<name>.md r/w: skill SKILL.md content
|
||||||
t/ dir: tool scripts (r/w, backed by ~/.config/ollie/tools/)
|
t/ dir: tool scripts (r/w, backed by ~/.config/ollie/tools/)
|
||||||
<script> r/w: tool script content
|
<script> r/w: tool script content
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ func (s *Server) create(cs *connState, fc *plan9.Fcall) *plan9.Fcall {
|
||||||
if !ok {
|
if !ok {
|
||||||
return errFcall(fc, "bad fid")
|
return errFcall(fc, "bad fid")
|
||||||
}
|
}
|
||||||
if f.path != "/sk" && f.path != "/t" {
|
if f.path != "/p" && f.path != "/sk" && f.path != "/t" {
|
||||||
return errFcall(fc, "create not supported")
|
return errFcall(fc, "create not supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -346,6 +346,11 @@ func (s *Server) create(cs *connState, fc *plan9.Fcall) *plan9.Fcall {
|
||||||
// Actually create the file on disk so that even a no-write create
|
// Actually create the file on disk so that even a no-write create
|
||||||
// (e.g. touch) produces a real file.
|
// (e.g. touch) produces a real file.
|
||||||
switch f.path {
|
switch f.path {
|
||||||
|
case "/p":
|
||||||
|
os.MkdirAll(s.promptsDir, 0755) //nolint:errcheck
|
||||||
|
if err := os.WriteFile(s.promptsDir+"/"+fc.Name, nil, 0644); err != nil {
|
||||||
|
return errFcall(fc, err.Error())
|
||||||
|
}
|
||||||
case "/t":
|
case "/t":
|
||||||
dir := execute.ToolsPath()
|
dir := execute.ToolsPath()
|
||||||
os.MkdirAll(dir, 0755) //nolint:errcheck
|
os.MkdirAll(dir, 0755) //nolint:errcheck
|
||||||
|
|
@ -943,7 +948,7 @@ func (s *Server) readDir(path string, offset uint64, count uint32) []byte {
|
||||||
|
|
||||||
if path == "/" {
|
if path == "/" {
|
||||||
dirs = append(dirs, makeDir("ctl", "/ctl", false, 0200))
|
dirs = append(dirs, makeDir("ctl", "/ctl", false, 0200))
|
||||||
dirs = append(dirs, makeDir("p", "/p", true, plan9.DMDIR|0555))
|
dirs = append(dirs, makeDir("p", "/p", true, plan9.DMDIR|0755))
|
||||||
dirs = append(dirs, makeDir("s", "/s", true, plan9.DMDIR|0555))
|
dirs = append(dirs, makeDir("s", "/s", true, plan9.DMDIR|0555))
|
||||||
dirs = append(dirs, makeDir("sk", "/sk", true, plan9.DMDIR|0555))
|
dirs = append(dirs, makeDir("sk", "/sk", true, plan9.DMDIR|0555))
|
||||||
dirs = append(dirs, makeDir("t", "/t", true, plan9.DMDIR|0777))
|
dirs = append(dirs, makeDir("t", "/t", true, plan9.DMDIR|0777))
|
||||||
|
|
@ -1049,6 +1054,8 @@ func (s *Server) makeStat(path string) plan9.Dir {
|
||||||
qid.Type = QTDir
|
qid.Type = QTDir
|
||||||
if path == "/t" {
|
if path == "/t" {
|
||||||
mode = plan9.DMDIR | 0777
|
mode = plan9.DMDIR | 0777
|
||||||
|
} else if path == "/p" {
|
||||||
|
mode = plan9.DMDIR | 0755
|
||||||
} else {
|
} else {
|
||||||
mode = plan9.DMDIR | 0555
|
mode = plan9.DMDIR | 0555
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in New Issue