Documentation
¶
Overview ¶
Package runtime owns the shared MCP protocol, tools and task lifetimes. Application configuration, credential stores and UI belong to host adapters.
Index ¶
- func FormatMCPError(err error) error
- type ClientIdentity
- type CreateTunnelInput
- type FSBaseOutput
- type FSCpInput
- type FSListInput
- type FSListOutput
- type FSMkdirInput
- type FSMvInput
- type FSRmInput
- type FSTouchInput
- type FileInfo
- type HTTPOptions
- type ListNodesInput
- type ListNodesOutput
- type ListTunnelsInput
- type ListTunnelsOutput
- type NodeInfo
- type Option
- type PrepareDownloadInput
- type PrepareUploadInput
- type PreparedTransferOutput
- type ReadFileInput
- type ReadFileOutput
- type RecoveryEntry
- type RecoveryOptions
- type Runtime
- type SshRunInput
- type SshRunOutput
- type TransferFileInput
- type TransferFileOutput
- type TransferTaskInput
- type TunnelInput
- type TunnelOutput
- type WriteFileInput
- type WriteFileOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatMCPError ¶
Types ¶
type ClientIdentity ¶
type ClientIdentity struct{ ClientID, TokenID string }
ClientIdentity is the verified client and credential attached to an HTTP tool invocation. IDs contain no bearer secret and survive detached SDK calls.
func ClientIdentityFromContext ¶
func ClientIdentityFromContext(ctx context.Context) (ClientIdentity, bool)
type CreateTunnelInput ¶
type CreateTunnelInput struct {
RequestID string `` /* 157-byte string literal not displayed */
NodeID string `json:"nodeID" jsonschema:"Managed SSH node ID or alias, including canonical openssh:host IDs returned by tunnel tools."`
Mode string `` /* 202-byte string literal not displayed */
ListenHost string `` /* 140-byte string literal not displayed */
ListenPort int `json:"listenPort" jsonschema:"Listening TCP port, 0 to 65535. Zero requests an automatically allocated port."`
TargetHost string `` /* 130-byte string literal not displayed */
TargetPort int `json:"targetPort" jsonschema:"Destination TCP port, 1 to 65535."`
TTLSeconds int `` /* 133-byte string literal not displayed */
}
type FSBaseOutput ¶
type FSBaseOutput struct {
Status string `json:"status" jsonschema:"Operation status"`
}
type FSListInput ¶
type FSListOutput ¶
type FSMkdirInput ¶
type FSTouchInput ¶
type FileInfo ¶
type FileInfo struct {
Name string `json:"name" jsonschema:"File name"`
Size int64 `json:"size" jsonschema:"Size in bytes"`
Mode string `json:"mode" jsonschema:"File mode/permissions"`
ModTime time.Time `json:"modTime" jsonschema:"Last modification time"`
IsDir bool `json:"isDir" jsonschema:"True if it is a directory"`
}
type HTTPOptions ¶
type HTTPOptions struct {
Listen string
PublicURL string
Token string
// TokenVerifier supplies deployment-owned authentication. It is mutually
// exclusive with Token and must return a stable, nonempty UserID. The
// optional Extra["tokenID"] identifies the credential, not the client.
TokenVerifier auth.TokenVerifier
StateDir string
AllowedHosts []string
AllowedOrigins []string
HeaderTimeout time.Duration
BodyTimeout time.Duration
StreamIdle time.Duration
ToolTimeout time.Duration
SessionTimeout time.Duration
ShutdownTimeout time.Duration
MaxSessions int
MaxRequests int // Per-lane capacity, including independent dynamic authentication.
Transfers transfer.Limits
// contains filtered or unexported fields
}
HTTPOptions configures authenticated Streamable HTTP. Token is consumed at construction; the runtime retains only its digest, never a printable token.
func DefaultHTTPOptions ¶
func DefaultHTTPOptions() HTTPOptions
func (*HTTPOptions) ValidateLimits ¶
func (o *HTTPOptions) ValidateLimits() error
ValidateLimits lets host configuration adapters validate typed limits before loading authentication material or starting a runtime.
type ListNodesInput ¶
type ListNodesInput struct {
Tag string `json:"tag,omitempty" jsonschema:"Filter nodes by tag. If empty, lists all nodes."`
}
type ListNodesOutput ¶
type ListTunnelsInput ¶
type ListTunnelsOutput ¶
type Option ¶
type Option func(*serverConfig)
func WithDependencies ¶
func WithDependencies(dependencies ports.Dependencies) Option
func WithHTTP ¶
func WithHTTP(options HTTPOptions) Option
WithHTTP switches the runtime to HTTP tools and session-based Streamable HTTP. Start it with Runtime.ServeHTTP rather than the stdio Run entry point.
func WithLogger ¶
func WithLogger(log logger.DebugLogger) Option
func WithToolTimeout ¶
WithToolTimeout sets a positive tool deadline for stdio and HTTP. It overrides HTTPOptions.ToolTimeout regardless of option order, including HTTP request and SDK middleware deadlines. Session and file-transfer limits are independent.
func WithTunnelRunner ¶
WithTunnelRunner supplies a host-owned dedicated runner for compatibility adapters. HTTP never enables tunnel tools regardless of this option.
type PrepareDownloadInput ¶
type PrepareUploadInput ¶
type PrepareUploadInput struct {
RequestID string `json:"requestID" jsonschema:"Client-generated idempotency key; keep the same key when retrying preparation"`
NodeID string `json:"nodeID" jsonschema:"Managed SSH node ID"`
RemotePath string `json:"remotePath" jsonschema:"Absolute destination file path on the SSH target"`
Size int64 `json:"size" jsonschema:"Exact client file size in bytes"`
SHA256 string `json:"sha256" jsonschema:"Lowercase SHA-256 of the client file"`
Overwrite bool `json:"overwrite,omitempty" jsonschema:"Explicitly replace an existing ordinary file atomically; new file mode is 0600"`
}
type PreparedTransferOutput ¶
type ReadFileInput ¶
type ReadFileInput struct {
NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
Path string `json:"path" jsonschema:"Absolute path to the remote file"`
Offset int64 `json:"offset,omitempty" jsonschema:"Byte offset to start reading from"`
Limit int64 `json:"limit,omitempty" jsonschema:"Max bytes to read (default 50KB, max 100KB)"`
}
type ReadFileOutput ¶
type ReadFileOutput struct {
Content string `json:"content" jsonschema:"File content represented as string"`
EOF bool `json:"eof" jsonschema:"True if end of file reached"`
Size int64 `json:"size" jsonschema:"Total size of the remote file"`
Status string `json:"status" jsonschema:"Operation status"`
}
type RecoveryEntry ¶
type RecoveryEntry struct {
Task transfer.Status `json:"task"`
TemporaryPath string `json:"temporaryPath,omitempty"`
Verified bool `json:"verified"`
DestinationExists bool `json:"destinationExists"`
ActualSize int64 `json:"actualSize,omitempty"`
ActualSHA256 string `json:"actualSHA256,omitempty"`
MatchesExpected bool `json:"matchesExpected"`
Resolution string `json:"resolution,omitempty"`
}
func RecoverTransfers ¶
func RecoverTransfers(ctx context.Context, options RecoveryOptions, opts ...Option) (_ []RecoveryEntry, retErr error)
RecoverTransfers is offline maintenance: the permanent journal lock prevents racing a running service. Listing never mutates task records or contacts SSH. Remote verification/cleanup and operator acknowledgement are explicit options.
type RecoveryOptions ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func (*Runtime) HTTPHandler ¶
HTTPHandler returns the authenticated handler owned by this runtime. Every HTTP server using it must bind its lifecycle to this runtime and call Close.
func (*Runtime) Run ¶
Run serves a transport until it ends or the runtime is closed. It does not relinquish the caller's responsibility to close the runtime.
type SshRunInput ¶
type SshRunInput struct {
NodeID string `json:"nodeID" jsonschema:"The ID of the node to execute command on"`
Command string `json:"command" jsonschema:"The shell command to execute"`
Sudo bool `json:"sudo,omitempty" jsonschema:"Whether to use sudo to execute the command"`
Execution *ssh.ExecutionConfig `` /* 240-byte string literal not displayed */
}
type SshRunOutput ¶
type SshRunOutput struct {
Output string `json:"output" jsonschema:"Command stdout/stderr"`
Status string `json:"status" jsonschema:"Operation status"`
Error string `json:"error,omitempty" jsonschema:"Error message if failed"`
Outcome string `json:"outcome,omitempty" jsonschema:"Execution outcome: not_started, completed, or unknown"`
ExitCode *uint32 `json:"exitCode,omitempty" jsonschema:"Exit status code if received"`
Signal string `json:"signal,omitempty" jsonschema:"Termination signal if terminated by signal"`
PlanDigest string `json:"planDigest,omitempty" jsonschema:"Digest of the executed command plan"`
Truncated bool `json:"truncated,omitempty" jsonschema:"Whether output exceeded limit and was truncated"`
}
type TransferFileInput ¶
type TransferFileOutput ¶
type TransferFileOutput struct {
Status string `json:"status" jsonschema:"Operation status"`
}
type TransferTaskInput ¶
type TransferTaskInput struct {
TransferID string `json:"transferID" jsonschema:"Transfer task ID returned by a prepare tool"`
}
type TunnelInput ¶
type TunnelInput struct {
TunnelID string `json:"tunnelID" jsonschema:"Tunnel ID returned by xops_tunnel_create or xops_tunnel_list."`
}
type TunnelOutput ¶
type WriteFileInput ¶
type WriteFileInput struct {
NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
Path string `json:"path" jsonschema:"Absolute path to the remote file"`
Content string `json:"content" jsonschema:"Content to write"`
Append bool `json:"append,omitempty" jsonschema:"If true, append to existing file; if false, overwrite completely"`
}