fs: wire up compact/clear ctl commands through HandleCommand
prompts: remove session operational model (9P/DBus prompt blocks) compact and clear were dead-code comments in writeAgentCtl. Wire them through agent.HandleCommand so they actually execute. Fix context: use ctx.Session.Ctx() instead of context.Background() for proper lifecycle cancellation. Delete session_9p.md and session_dbus.md — no longer referenced.
This commit is contained in:
parent
f265fd3a9f
commit
5a946a6729
|
|
@ -636,9 +636,9 @@ func writeAgentCtl(ctx HandlerCtx, data []byte) error {
|
|||
case "stop":
|
||||
ctx.Agent.Interrupt(agent.ErrInterrupted)
|
||||
case "compact":
|
||||
// Compact is handled via agent command mechanism
|
||||
ctx.Agent.HandleCommand(ctx.Session.Ctx(), "/compact")
|
||||
case "clear":
|
||||
// Clear is handled via agent command mechanism
|
||||
ctx.Agent.HandleCommand(ctx.Session.Ctx(), "/clear")
|
||||
case "backend":
|
||||
// Backend selection via cfg
|
||||
case "model":
|
||||
|
|
|
|||
|
|
@ -12,12 +12,6 @@ import (
|
|||
//go:embed system_prompt.md
|
||||
var DefaultSystemPrompt string
|
||||
|
||||
//go:embed session_9p.md
|
||||
var Session9P string
|
||||
|
||||
//go:embed session_dbus.md
|
||||
var SessionDBus string
|
||||
|
||||
|
||||
|
||||
// Environment renders the environment context block with live values.
|
||||
|
|
@ -41,22 +35,10 @@ Tools run in a sandbox with restricted filesystem access. Unexpected permission
|
|||
|
||||
// OperationalModel returns the appropriate operational model text based on flags.
|
||||
func OperationalModel(enable9P, enableDBus bool, envVars map[string]string) string {
|
||||
expand := func(s string) string {
|
||||
return os.Expand(s, func(key string) string {
|
||||
if v, ok := envVars[key]; ok {
|
||||
return v
|
||||
}
|
||||
return os.Getenv(key)
|
||||
})
|
||||
}
|
||||
var parts []string
|
||||
if enable9P {
|
||||
parts = append(parts, expand(Session9P))
|
||||
}
|
||||
if enableDBus {
|
||||
parts = append(parts, expand(SessionDBus))
|
||||
}
|
||||
return strings.Join(parts, "\n")
|
||||
_ = enable9P
|
||||
_ = enableDBus
|
||||
_ = envVars
|
||||
return ""
|
||||
}
|
||||
|
||||
// ResolveSystemPrompt expands env vars in overridePath, then tries to read the
|
||||
|
|
|
|||
Loading…
Reference in New Issue