Documentation
¶
Index ¶
- type BackgroundTask
- type Session
- func (s *Session) AddTask(task *BackgroundTask) error
- func (s *Session) Close()
- func (s *Session) Cwd() string
- func (s *Session) GetTask(id string) (*BackgroundTask, bool)
- func (s *Session) HasViewed(path string) bool
- func (s *Session) MarkViewed(path string)
- func (s *Session) Nonce() string
- func (s *Session) RemoveTask(id string)
- func (s *Session) Sentinel() string
- func (s *Session) SetCwd(cwd string)
- func (s *Session) TaskCount() int
- type SessionCleanupStore
- func (s *SessionCleanupStore) After(_ context.Context, _, _ string, _ int) iter.Seq2[[]byte, error]
- func (s *SessionCleanupStore) Append(_ context.Context, _, _ string, _ []byte) error
- func (s *SessionCleanupStore) Open(_ context.Context, _, _ string) error
- func (s *SessionCleanupStore) SessionClosed(_ context.Context, sessionID string) error
- type SessionRegistry
- type SyncBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackgroundTask ¶
type BackgroundTask struct {
ID string
Cmd *exec.Cmd
Stdout *SyncBuffer
Stderr *SyncBuffer
Done chan struct{}
ExitCode int
// contains filtered or unexported fields
}
BackgroundTask represents a command running in the background.
func (*BackgroundTask) SetTimedOut ¶
func (t *BackgroundTask) SetTimedOut()
SetTimedOut marks the task as killed by the safety-net timeout.
func (*BackgroundTask) TimedOut ¶
func (t *BackgroundTask) TimedOut() bool
TimedOut reports whether the task was killed by the safety-net timeout.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session holds per-session state including the tracked working directory, a random nonce for sentinel generation, background task tracking, and viewed-file tracking for view-before-edit enforcement.
func (*Session) AddTask ¶
func (s *Session) AddTask(task *BackgroundTask) error
AddTask stores a background task. Returns an error if the session is closed or the limit is reached.
func (*Session) Close ¶
func (s *Session) Close()
Close terminates all running background tasks and marks the session as closed. For each running task, it sends SIGTERM to the process group, waits up to 5 seconds, then sends SIGKILL if the process is still alive. Close is idempotent — subsequent calls have no effect.
func (*Session) GetTask ¶
func (s *Session) GetTask(id string) (*BackgroundTask, bool)
GetTask retrieves a background task by ID.
func (*Session) HasViewed ¶
HasViewed reports whether the given resolved file path has been viewed in this session.
func (*Session) MarkViewed ¶
MarkViewed records a resolved file path as having been viewed in this session.
func (*Session) RemoveTask ¶
RemoveTask removes a background task by ID.
type SessionCleanupStore ¶
type SessionCleanupStore struct {
Registry *SessionRegistry
}
SessionCleanupStore is a minimal mcp.EventStore implementation whose sole purpose is to receive SessionClosed notifications from the go-sdk and trigger Boris session cleanup via the SessionRegistry.
Open, Append, and After are no-ops — stream resumption is not supported.
func (*SessionCleanupStore) After ¶
After returns an empty iterator; stream resumption is not supported.
func (*SessionCleanupStore) Open ¶
func (s *SessionCleanupStore) Open(_ context.Context, _, _ string) error
Open is a no-op; stream resumption is not supported.
func (*SessionCleanupStore) SessionClosed ¶
func (s *SessionCleanupStore) SessionClosed(_ context.Context, sessionID string) error
SessionClosed is called by the go-sdk when an HTTP session terminates (idle timeout, client DELETE, or connection drop). It closes the corresponding Boris session and removes it from the registry.
type SessionRegistry ¶
type SessionRegistry struct {
// contains filtered or unexported fields
}
SessionRegistry maps go-sdk session IDs to Boris sessions, enabling cleanup when the SDK signals session end (via EventStore.SessionClosed).
func NewRegistry ¶
func NewRegistry() *SessionRegistry
NewRegistry creates an empty SessionRegistry.
func (*SessionRegistry) CloseAll ¶
func (r *SessionRegistry) CloseAll()
CloseAll closes every session in the registry and clears the map. It is safe to call concurrently with CloseAndRemove and is idempotent.
func (*SessionRegistry) CloseAndRemove ¶
func (r *SessionRegistry) CloseAndRemove(id string)
CloseAndRemove closes the Boris session for the given ID and removes it from the registry. If the ID is not found, this is a no-op.
func (*SessionRegistry) Register ¶
func (r *SessionRegistry) Register(id string, sess *Session)
Register associates a go-sdk session ID with a Boris session. If the ID is already registered, the existing entry is overwritten.
type SyncBuffer ¶
type SyncBuffer struct {
// contains filtered or unexported fields
}
SyncBuffer is a concurrency-safe buffer that implements io.Writer. It is safe for concurrent use, e.g. as cmd.Stdout while reading accumulated output from another goroutine.
func (*SyncBuffer) String ¶
func (sb *SyncBuffer) String() string