handler

package
v0.0.0-...-2228978 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: Apache-2.0 Imports: 72 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

See 'adding methods' in the camber-helper/README.md.

Documentation

Index

Constants

View Source
const DefaultServePort = 17874

Variables

View Source
var ErrInvalidParams = errors.New("invalid request params")

Functions

func InitDaemonProfile

func InitDaemonProfile(path string) error

InitDaemonProfile initializes a profile without replacing an operator's configuration.

func Serve

func Serve(parent context.Context, opts ServeOptions) error

Serve initializes the dedicated helper and exposes its owned conversations.

Types

type CamberHandler

type CamberHandler struct {
	protocol.Handler
	// contains filtered or unexported fields
}

CamberHandler embeds the regular protocol.Handler but overrides the Handle method to allow us to pass our own custom messages

N.B. please put new sets of handlers in their own packages, e.g. a new handler/$foo package (see git and acpnav for implementation). Via embedding you can avoid needing to write wrapper methods.

func New

func New() *CamberHandler

func NewWithOptions

func NewWithOptions(options *ServeOptions) *CamberHandler

NewWithOptions constructs the handler without starting a standalone listener. Passing nil selects ordinary desktop remote-access setup.

func (*CamberHandler) ACPNavListAgentServers

func (*CamberHandler) ACPNavRemoveWorktree

func (h *CamberHandler) ACPNavRemoveWorktree(ctx context.Context, req *methods.ACPNavRemoveWorktreeParams, gCtx *glsp.Context) (methods.ACPNavState, error)

func (*CamberHandler) Abort

Abort acknowledges the compatibility RPC. In-flight RPCs use $/cancelRequest.

func (*CamberHandler) CheckACPNavAgentRuntimes

CheckACPNavAgentRuntimes reports whether the runtimes registry agent distributions launch through resolve on the environment agent subprocesses spawn with, so the marketplace can warn about a missing runtime before an install instead of failing on first launch.

func (*CamberHandler) DeleteMCPSecrets

func (*CamberHandler) GetUserConfig

GetUserConfig retrieves the current user configuration

func (*CamberHandler) GetWorkspaceFolders

func (h *CamberHandler) GetWorkspaceFolders() []protocol.WorkspaceFolder

func (*CamberHandler) Handle

func (h *CamberHandler) Handle(req *glsp.Context) (r any, validMethod bool, validParams bool, err error)

all method calls go via Handle (primary stdio/TCP client) or HandleRemote (authenticated remote access clients).

func (*CamberHandler) HandleRemote

func (h *CamberHandler) HandleRemote(originID string, req *glsp.Context) (any, bool, bool, error)

HandleRemote dispatches a request from an authenticated remote client. The remoteaccess server enforces its method allowlist before calling this; originID keeps fan-out from echoing traffic back to the originator.

func (*CamberHandler) InitiateMCPOAuth

func (*CamberHandler) IsConcurrentMethod

func (h *CamberHandler) IsConcurrentMethod(method string) bool

Checks if the method should be run concurrently

func (*CamberHandler) MCPOAuthCallback

MCPOAuthCallback completes a pending deep-link OAuth flow with the redirect URL the client received from the OS (camber://oauth/callback?…). Flows wait on this only when they were started with a deep-link redirect.

func (*CamberHandler) OnTextDocumentDidChange

func (h *CamberHandler) OnTextDocumentDidChange(ctx context.Context, event events.TextDocumentDidChange, call glsp.CallFunc)

func (*CamberHandler) OnWorkspaceDidCreateFiles

func (h *CamberHandler) OnWorkspaceDidCreateFiles(ctx context.Context, params lsptypes.CreateFilesParams, call glsp.CallFunc)

func (*CamberHandler) OnWorkspaceDidRenameFiles

func (h *CamberHandler) OnWorkspaceDidRenameFiles(ctx context.Context, params lsptypes.RenameFilesParams, call glsp.CallFunc)

func (*CamberHandler) OnWorkspaceWillDeleteFiles

func (h *CamberHandler) OnWorkspaceWillDeleteFiles(ctx context.Context, params lsptypes.DeleteFilesParams, call glsp.CallFunc)

func (*CamberHandler) OpenAPI

func (h *CamberHandler) OpenAPI() huma.API

func (*CamberHandler) ReadFile

func (h *CamberHandler) ReadFile(ctx context.Context, uri protocol.DocumentURI) ([]byte, error)

func (*CamberHandler) SetACPNavAgentServers

func (*CamberHandler) SetTCPTransport

func (h *CamberHandler) SetTCPTransport()

SetTCPTransport is called before listening. The private native window bridge is available only on the desktop's framed stdio connection.

func (*CamberHandler) TextDocumentDidChange

func (h *CamberHandler) TextDocumentDidChange(ctx context.Context, params *protocol.DidChangeTextDocumentParams, lspCtx *glsp.Context) (any, error)

func (*CamberHandler) TextDocumentDidClose

func (h *CamberHandler) TextDocumentDidClose(ctx context.Context, params *protocol.DidCloseTextDocumentParams, c *glsp.Context) (any, error)

func (*CamberHandler) TextDocumentDidOpen

func (h *CamberHandler) TextDocumentDidOpen(ctx context.Context, params *protocol.DidOpenTextDocumentParams, c *glsp.Context) (any, error)

func (*CamberHandler) WorkspaceDidChangeWatchedFiles

func (h *CamberHandler) WorkspaceDidChangeWatchedFiles(ctx context.Context, params *protocol3.DidChangeWatchedFilesParams, lspCtx *glsp.Context) (any, error)

func (*CamberHandler) WorkspaceDidChangeWorkspaceFolders

func (h *CamberHandler) WorkspaceDidChangeWorkspaceFolders(ctx context.Context, params *protocol3.DidChangeWorkspaceFoldersParams, lspCtx *glsp.Context) (any, error)

func (*CamberHandler) WorkspaceDidCreateFiles

func (h *CamberHandler) WorkspaceDidCreateFiles(ctx context.Context, params *lsptypes.CreateFilesParams, lspCtx *glsp.Context) (any, error)

func (*CamberHandler) WorkspaceDidDeleteFiles

func (h *CamberHandler) WorkspaceDidDeleteFiles(ctx context.Context, params *lsptypes.DeleteFilesParams, lspCtx *glsp.Context) (any, error)

func (*CamberHandler) WorkspaceDidRenameFiles

func (h *CamberHandler) WorkspaceDidRenameFiles(ctx context.Context, params *lsptypes.RenameFilesParams, lspCtx *glsp.Context) (any, error)

func (*CamberHandler) WorkspaceWillDeleteFiles

func (h *CamberHandler) WorkspaceWillDeleteFiles(ctx context.Context, params *lsptypes.DeleteFilesParams, lspCtx *glsp.Context) (any, error)

type ClientCapabilitiesConfig

type ClientCapabilitiesConfig struct {
	// MCPOAuthDeepLink reports that the client registered the camber:// URL
	// scheme with the OS and forwards camber://oauth/callback redirects to
	// the helper via camber/mcpOAuthCallback (the desktop app).
	MCPOAuthDeepLink bool `json:"mcpOAuthDeepLink"`
	// contains filtered or unexported fields
}

type Config

type Config struct {
	AssistantHost        string                                `json:"assistantHost"`
	AssistantEnvironment string                                `json:"assistantEnvironment"`
	ClientCapabilities   ClientCapabilitiesConfig              `json:"clientCapabilities,omitempty"`
	SessionID            string                                `json:"sessionId"`
	ACPAgentServers      map[string]acpproxy.AgentServerConfig `json:"agentServers,omitempty"`
}

Config is the configuration that can be specified in initialize calls.

type HelloIn

type HelloIn struct {
	// will be returned in pong
	Ping string `json:"ping" maxLength:"128"`
}

type HelloOut

type HelloOut struct {
	Pong string `json:"pong"`
}

type JSONRPCOperation

type JSONRPCOperation struct {
	// Summary is a short summary of what the operation does.
	Summary string
	// Description is a verbose explanation of the operation behavior. CommonMark
	// syntax MAY be used for rich text representation.
	Description string
	// The JSON-RPC method, e.g. "camber/foo"
	Method string
}

JSONRPCOperation captures metadata for a single JSONRPC method.

type ListSkillsOutput

type ListSkillsOutput struct {
	Skills []SkillSummary `json:"skills"`
}

type ListSkillsParams

type ListSkillsParams struct{}

type MethodHandler

type MethodHandler func(ctx context.Context, lspReq *glsp.Context) (any, error)

type OwnedStreams

type OwnedStreams interface {
	Stage(origin, requestID, subscriptionID string, worker func(context.Context, func(method string, params any) error) error) error
	Stop(origin, subscriptionID string)
}

OwnedStreams tracks subscriptions by connection origin. Stage starts its worker only after the matching subscribe reply has been written. Stop waits for that subscription's last write before returning.

type PrimaryConversationStreams

type PrimaryConversationStreams struct {
	// contains filtered or unexported fields
}

PrimaryConversationStreams belongs to one initialized stdio helper. Handle unwraps requests from the primary connection before wrapping Notify.

func NewPrimaryConversationStreams

func NewPrimaryConversationStreams(lifetime context.Context) *PrimaryConversationStreams

func (*PrimaryConversationStreams) Activate

func (r *PrimaryConversationStreams) Activate(origin, subscriptionID string) error

Activate starts at most one stream worker for the current endpoint.

func (*PrimaryConversationStreams) EndpointContext

func (r *PrimaryConversationStreams) EndpointContext(origin string) context.Context

func (*PrimaryConversationStreams) Handle

func (r *PrimaryConversationStreams) Handle(req *glsp.Context, dispatch func(*glsp.Context, string) (any, bool, bool, error)) (any, bool, bool, error)

Handle unwraps the private Rust bridge. The ordinary v2 adapter still validates the inner params and handles both stdio and socket operations.

func (*PrimaryConversationStreams) StageV2

func (r *PrimaryConversationStreams) StageV2(origin, _, subscriptionID string, worker func(context.Context, func(string, any) error) error, events ...methods.ConversationEventV2) error

StageV2 matches the paired stream registry interface. Stdio uses explicit activation by the window after the first page has been installed.

func (*PrimaryConversationStreams) Stop

func (r *PrimaryConversationStreams) Stop(origin, subscriptionID string)

Stop cancels the current generation and waits for its worker to exit.

func (*PrimaryConversationStreams) SubscriptionContext

func (r *PrimaryConversationStreams) SubscriptionContext(origin, id string) context.Context

SubscriptionContext ends when this subscription generation is removed.

type ServeOptions

type ServeOptions struct {
	TerminalShell string
	TerminalXDG   map[string]string
	Daemon        bool
	Tailscale     bool
	ListenIP      string
	AgentConfig   string
	StateDir      string
	Port          int
	WebOrigin     string
	Token         string
	SeedID        string
	Agent         string
	Workspace     string
	Streams       OwnedStreams
}

ServeOptions selects the standalone listener instead of desktop remote access. Streams belongs to this listener; each socket has a distinct origin.

type SkillSummary

type SkillSummary struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Location    string `json:"location"`
	DirPath     string `json:"dir_path"`
}

Directories

Path Synopsis
Package appcontrol holds the desktop's conversation-management operations that do not need UI state, so the desktop UI (through camber/app/* helper methods) and the camber control CLI (through control actions) run the same code.
Package appcontrol holds the desktop's conversation-management operations that do not need UI state, so the desktop UI (through camber/app/* helper methods) and the camber control CLI (through control actions) run the same code.
Package approvals owns pending agent approvals (permission prompts and elicitations) as helper-side state.
Package approvals owns pending agent approvals (permission prompts and elicitations) as helper-side state.
Package control exposes desktop conversation orchestration to local clients.
Package control exposes desktop conversation orchestration to local clients.
Package git exposes camber/git/* JSON-RPC methods backing the desktop changes view: working-tree status, per-file diffs, staging, discarding, and committing.
Package git exposes camber/git/* JSON-RPC methods backing the desktop changes view: working-tree status, per-file diffs, staging, discarding, and committing.
Package github exposes camber/github/* JSON-RPC methods that surface pull-request status for worktrees.
Package github exposes camber/github/* JSON-RPC methods that surface pull-request status for worktrees.
Package ownedwriter elects the sidecar allowed to dispatch and recover owned commands for a physical navigation database.
Package ownedwriter elects the sidecar allowed to dispatch and recover owned commands for a physical navigation database.
Package remoteaccess serves the mobile remote-control surface: an authenticated HTTP + WebSocket endpoint that speaks the same JSON-RPC protocol as the primary stdio client, minus a small method deny list (see denylist.go).
Package remoteaccess serves the mobile remote-control surface: an authenticated HTTP + WebSocket endpoint that speaks the same JSON-RPC protocol as the primary stdio client, minus a small method deny list (see denylist.go).
webui
Package webui embeds the built mobile-remote UI bundle so camber-helper can serve it directly (a phone has no dev server to proxy through).
Package webui embeds the built mobile-remote UI bundle so camber-helper can serve it directly (a phone has no dev server to proxy through).
Package remoteterminal owns the PTYs the helper spawns on behalf of remote (mobile) clients: a plain shell (or a one-shot setup/teardown command) per worktree, with output retained for reconnect backfill.
Package remoteterminal owns the PTYs the helper spawns on behalf of remote (mobile) clients: a plain shell (or a one-shot setup/teardown command) per worktree, with output retained for reconnect backfill.
Package workspacefiles implements the workspace RPCs for one authenticated paired socket.
Package workspacefiles implements the workspace RPCs for one authenticated paired socket.

Jump to

Keyboard shortcuts

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