Documentation
¶
Overview ¶
Package sessionplan provides a per-session plan tracker for the "draft, review, execute" workflow. One markdown plan per session, stored at <data-dir>/session_plans/<session-id>.md. The toolset is a metadata stub — the runtime owns the handlers (pkg/runtime/sessionplan_handlers.go) so they can reach the live session.
Complementary to pkg/tools/builtin/plan, which models shared, named plans multiple agents collaborate on. Tool names are deliberately distinct (write_session_plan / read_session_plan vs. write_plan / read_plan) so the two toolsets can coexist on the same agent without colliding.
Index ¶
- Constants
- Variables
- func CreateToolSet() (tools.ToolSet, error)
- func DefaultDir() string
- func Path(dir, sessionID string) (string, error)
- func ReadContent(dir, sessionID string) (content, path string, err error)
- func Sweep(dir string, now time.Time, maxAge time.Duration) error
- func WriteContent(dir, sessionID, content string) (string, error)
- type ToolSet
- type WriteSessionPlanArgs
Constants ¶
const ( ToolNameWriteSessionPlan = "write_session_plan" ToolNameReadSessionPlan = "read_session_plan" ToolNameExitPlanMode = "exit_plan_mode" )
Variables ¶
var ( ErrInvalidSessionID = errors.New("invalid session ID") ErrPlanNotFound = errors.New("session plan not found") )
Functions ¶
func CreateToolSet ¶
func DefaultDir ¶
func DefaultDir() string
func ReadContent ¶
ReadContent returns ErrPlanNotFound (with the path so callers can include it in user-facing messages) on ENOENT, distinguishing "plan missing" from a real read failure such as a permission error.
func Sweep ¶
Sweep is best-effort: a permission glitch on one file should not block cleaning the rest, but the first error encountered is returned so callers can surface it.
func WriteContent ¶
WriteContent uses atomicfile.Write so a concurrent reader — in this process or another — sees either the old or the new file, never a partial one, and so an existing symlink is replaced rather than followed.
Types ¶
type ToolSet ¶
type ToolSet struct{}
func New ¶
func New() *ToolSet
New builds a toolset without running the startup sweep, for tests and embedders that want predictable filesystem behaviour.
func (*ToolSet) Instructions ¶
type WriteSessionPlanArgs ¶
type WriteSessionPlanArgs struct {
Content string `json:"content" jsonschema:"The full plan content as markdown. Replaces the existing plan for this session."`
}