Documentation
¶
Index ¶
- func AttachServer(ctx context.Context, addr, sessionID string) (*mcp.Server, error)
- func CreateToolHandler(t *team.Team, agentName string, safety session.SafetyPolicy, workingDir string) ...
- func LiveAttachSessions(ctx context.Context, addr string) ([]string, error)
- func ResolveAttachSession(ctx context.Context, addr, recorded string, explicit bool) (string, error)
- func StartAttachStdio(ctx context.Context, addr, sessionID string) error
- func StartHTTPServer(ctx context.Context, agentFilename, agentName string, ...) error
- func StartMCPServer(ctx context.Context, agentFilename, agentName string, ...) error
- type HTTPOptions
- type SendInput
- type SendOutput
- type ToolInput
- type ToolOutput
- type TranscriptInput
- type TranscriptM
- type TranscriptOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttachServer ¶ added in v1.58.0
AttachServer wires an MCP server to a running docker-agent run accessible via its HTTP control plane. It exposes a small toolset (send, transcript) that other agents can use to drive the live session.
func CreateToolHandler ¶
func CreateToolHandler(t *team.Team, agentName string, safety session.SafetyPolicy, workingDir string) func(context.Context, *mcp.CallToolRequest, ToolInput) (*mcp.CallToolResult, ToolOutput, error)
func LiveAttachSessions ¶ added in v1.168.0
LiveAttachSessions returns the IDs of the sessions currently attached to the run serving at addr (GET /api/sessions?active=true). Unlike the run's discovery record, which keeps naming the session the run started with, this is the live view: under --listen every open TUI tab is listed, including tabs spawned after startup, so a caller can select one explicitly.
func ResolveAttachSession ¶ added in v1.168.0
func ResolveAttachSession(ctx context.Context, addr, recorded string, explicit bool) (string, error)
ResolveAttachSession returns the session ID an attach client should drive for the run at addr. recorded is the session ID stored in the run's discovery record; explicit reports whether the caller named that session explicitly (rather than discovering the run by pid, address, or "latest").
A run's discovery record keeps naming the session it started with, but under --listen that initial tab can be closed while the run (and other tabs) stay alive. Attaching to the closed ID would make every send fail with "session not found or not running", so:
- when the recorded session is still attached, it is used;
- an explicitly named session that is no longer attached fails with a clear error listing the live sessions instead of being silently redirected to another one;
- a fresh run-level discovery resolves the live session when there is exactly one, and otherwise fails clearly listing the candidates.
func StartAttachStdio ¶ added in v1.58.0
StartAttachStdio runs the attach MCP server over stdio.
func StartHTTPServer ¶
func StartHTTPServer(ctx context.Context, agentFilename, agentName string, runConfig *config.RuntimeConfig, ln net.Listener, options HTTPOptions) error
StartHTTPServer starts a streaming HTTP MCP server on the given listener
func StartMCPServer ¶
Types ¶
type HTTPOptions ¶ added in v1.126.0
type HTTPOptions struct {
CLISafety session.SafetyPolicy
AuthToken string
Out io.Writer
OnSafetyPolicy func(servesafety.Resolved)
}
type SendOutput ¶ added in v1.58.0
type SendOutput struct {
Status string `json:"status"`
}
type ToolInput ¶
type ToolInput struct {
Message string `json:"message" jsonschema:"the message to send to the agent"`
}
type ToolOutput ¶
type ToolOutput struct {
Response string `json:"response" jsonschema:"the response from the agent"`
}
type TranscriptInput ¶ added in v1.58.0
type TranscriptInput struct {
Limit int `json:"limit,omitempty" jsonschema:"max number of recent messages to return (0 = all)"`
}
type TranscriptM ¶ added in v1.58.0
type TranscriptOutput ¶ added in v1.58.0
type TranscriptOutput struct {
Title string `json:"title"`
Messages []TranscriptM `json:"messages"`
}