Documentation
¶
Overview ¶
Package ops tracks long-running MCP tool invocations so a local portal can list and cancel them. It is intentionally process-local: each LabLinkServer process keeps its own registry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle is returned by Begin and used by the caller to mark completion.
type Operation ¶
type Operation struct {
ID string `json:"id"`
Tool string `json:"tool"`
Node string `json:"node,omitempty"`
Summary string `json:"summary,omitempty"`
Args map[string]string `json:"args,omitempty"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Status Status `json:"status"`
Error string `json:"error,omitempty"`
// contains filtered or unexported fields
}
Operation is a single in-flight or recently-completed tool invocation.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks operations and fans out change events to subscribers.
func NewRegistry ¶
NewRegistry constructs a Registry. maxHistory is the number of completed operations retained for display; 0 means unlimited.
func (*Registry) Begin ¶
func (r *Registry) Begin(parent context.Context, tool, node, summary string, args map[string]string) (context.Context, *Handle)
Begin records a new operation and returns a wrapped context whose cancellation can be triggered either by the caller or by the portal (Cancel by ID). Done must be called on the returned Handle when the work completes.
func (*Registry) Cancel ¶
Cancel marks the operation as cancelled-by-portal and triggers its context cancel. Returns false if the id is unknown or already finished.