Documentation
¶
Overview ¶
Package plan provides a toolset that lets two or more agents collaborate on plans stored in a global shared folder under the docker-agent data directory. Plans are addressed by name, so any agent that loads this toolset can write, read, list, and delete the same shared plans, and they persist across sessions.
Concurrency: all agents in a single process share one ToolSet instance (see CreateToolSet), so their reads and writes are serialized by a single mutex. On-disk writes are atomic (write-to-temp + rename), so a reader — including a separate docker-agent process — never observes a partially written plan. Two distinct processes writing the *same* plan at the very same instant can still race on the read-modify-write revision bump (last writer wins); this is acceptable for the intended in-process multi-agent collaboration.
Index ¶
Constants ¶
const ( ToolNameWritePlan = "write_plan" ToolNameReadPlan = "read_plan" ToolNameListPlans = "list_plans" ToolNameDeletePlan = "delete_plan" )
Variables ¶
This section is empty.
Functions ¶
func CreateToolSet ¶
CreateToolSet is used by the tools registry. It returns a process-wide singleton so that all agents collaborating in the same process share one lock over the global plans folder.
func DefaultDir ¶
func DefaultDir() string
DefaultDir is the global shared folder where plans are stored, under the docker-agent data directory.
Types ¶
type DeletePlanArgs ¶
type DeletePlanArgs struct {
Name string `json:"name" jsonschema:"The name of the plan to delete."`
}
type ListResult ¶
type ListResult struct {
Plans []Summary `json:"plans"`
Warnings []string `json:"warnings,omitempty"`
}
ListResult is the output of list_plans. Warnings lists plan files that could not be read or decoded, so a caller can tell "no plans exist" apart from "some plans failed to load" — important because an agent that mistakes a temporarily unreadable plan for a missing one could recreate and clobber it.
type Plan ¶
type Plan struct {
Name string `json:"name"`
Title string `json:"title,omitempty"`
Content string `json:"content"`
// Author is a free-form label identifying who last wrote the plan
// (typically the agent name). It helps collaborators see who made the
// most recent change.
Author string `json:"author,omitempty"`
Revision int `json:"revision"`
UpdatedAt string `json:"updatedAt"`
}
Plan is a shared document collaborated on by the agents.
type ReadPlanArgs ¶
type ReadPlanArgs struct {
Name string `json:"name" jsonschema:"The name of the plan to read."`
}
type Summary ¶
type Summary struct {
Name string `json:"name"`
Title string `json:"title,omitempty"`
Author string `json:"author,omitempty"`
Revision int `json:"revision"`
UpdatedAt string `json:"updatedAt"`
}
Summary is a lightweight view of a plan returned by list_plans.
type ToolSet ¶
type ToolSet struct {
// contains filtered or unexported fields
}
func (*ToolSet) Instructions ¶
type WritePlanArgs ¶
type WritePlanArgs struct {
Name string `json:"name" jsonschema:"The plan name. Lowercase letters, digits, '-' and '_' only (e.g. 'release', 'db-migration')."`
Content string `json:"content" jsonschema:"The full plan content (markdown). Replaces the existing plan."`
Title string `json:"title,omitempty" jsonschema:"Optional human-readable title. Preserved from the previous revision when omitted."`
Author string `` /* 166-byte string literal not displayed */
}