Help us shape the future of Go! Take the 2026 Go Developer Survey

worker

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package worker exposes bounded explicit delegation through MCP over stdio. It reads only the request file named by the caller in the declared workspace; it never discovers files, executes commands, or edits workspace files.

Index

Constants

View Source
const (
	ToolName = "questlock_delegate"
	// MaxRequestBytes bounds both an approved request file and an MCP frame.
	MaxRequestBytes = 1 << 20
)
View Source
const ReviseToolName = "questlock_revise"
View Source
const StatusToolName = "questlock_status"

Variables

View Source
var (
	ErrConfiguration = errors.New("worker_configuration_invalid")
	ErrTransport     = errors.New("worker_transport_failed")
)

Functions

func ReadApprovedRequest added in v0.8.0

func ReadApprovedRequest(workspace, path string) ([]byte, error)

ReadApprovedRequest reuses the MCP worker's pinned, bounded, symlink-refusing file boundary for explicit opt-in local queue callers. It discovers no files.

func Serve

func Serve(ctx context.Context, input io.ReadCloser, output io.Writer, options Options) error

Serve runs the official MCP SDK on newline-delimited JSON streams. The SDK supports current server/discover and legacy initialize clients. It closes input on disconnect or cancellation; output remains owned by the caller. Errors returned here and to the client contain controlled labels only.

Types

type Options

type Options struct {
	Workspace string
	Version   string
	// ProfileID is an operator-chosen nonsecret label, never a broker URL or
	// credential. ProfileKind is custom (default) or managed.
	ProfileID   string
	ProfileKind string
	Execute     func(context.Context, delegation.Request) (delegation.Result, error)
	// Revise optionally enables checked literal edits, without model inference.
	Revise    func(context.Context, revision.Request) (revision.Result, error)
	AllowPaid bool
}

Options is process authority, not tool input. Execute must honor its context and preserve the delegation router's durable reuse and uncertainty rules. Enabling AllowPaid still requires explicit prices and positive dollar budgets in the request policy; it does not authorize arbitrary paid model calls.

type Status added in v0.13.0

type Status struct {
	Schema          int               `json:"schema"`
	RuntimeVersion  string            `json:"runtime_version"`
	RequestRoot     string            `json:"request_root"`
	Profile         StatusProfile     `json:"profile"`
	Policy          StatusPolicy      `json:"policy"`
	RequestSchemas  StatusSchemas     `json:"request_schemas"`
	Checks          StatusChecks      `json:"checks"`
	Tools           []string          `json:"tools"`
	WorkflowConfigs map[string]string `json:"workflow_configs"`
	Readiness       StatusReadiness   `json:"readiness"`
	ReadOnly        bool              `json:"read_only"`
	ModelCalls      int               `json:"model_calls"`
}

Status is the connected worker's operating contract, not a broker, provider, or native-client health check. Schema versions describe the accepted JSON: delegation currently has no schema field; revision requires schema: 1.

type StatusChecks added in v0.13.0

type StatusChecks struct {
	Schema int      `json:"schema"`
	Kinds  []string `json:"kinds"`
}

type StatusPolicy added in v0.13.0

type StatusPolicy struct {
	AllowPaid                          bool `json:"allow_paid"`
	PaidRequiresExplicitRequestBudgets bool `json:"paid_requires_explicit_request_budgets"`
}

type StatusProfile added in v0.13.0

type StatusProfile struct {
	ID   string `json:"id"`
	Kind string `json:"kind"`
}

type StatusReadiness added in v0.13.0

type StatusReadiness struct {
	Worker      string `json:"worker"`
	RequestRoot string `json:"request_root"`
	Broker      string `json:"broker"`
	Providers   string `json:"providers"`
}

type StatusSchemas added in v0.13.0

type StatusSchemas struct {
	Delegation          []string `json:"delegation"`
	Revision            []int    `json:"revision"`
	SemanticShadowModes []string `json:"semantic_shadow_modes,omitempty"`
	SemanticReuseModes  []string `json:"semantic_reuse_modes,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL