Documentation
¶
Index ¶
- Constants
- Variables
- func AddUpdateWatchdogArgs(target, previous, expected string) []string
- func CheckAgentVersion(agent, version string) (tested, recognized bool)
- func ClearUpdateBlock(version string)
- func ConfigDir() (string, error)
- func ConfigPath() (string, error)
- func DefaultForbiddenArgs() []string
- func Doctor(cfg Config, cfgErr error, out io.Writer) int
- func FetchHubPublicKey(ctx context.Context, hubURL string) (string, error)
- func HideConsoleWindow()
- func InstallOwnUpdate(staged string) error
- func InstallStagedUpdate(staged string, force bool) error
- func NewIdentity() (ed25519.PublicKey, ed25519.PrivateKey, error)
- func NormalizeUpdateChannel(channel, currentVersion string) string
- func PlatformName() string
- func ReadHostname() string
- func RollbackUpdate(force bool) error
- func SaveConfig(cfg Config) error
- func SaveUpdatePrefs(prefs UpdateSettings) error
- func ServiceAction(action string) error
- func ServiceInstalled() bool
- func StageUpdate(ctx context.Context, info UpdateInfo, stagedDir string, requireSignature bool) (string, error)
- func StageUpdateNamed(ctx context.Context, info UpdateInfo, stagedDir, binaryName string, ...) (string, string, error)
- func StageUpdateWithMode(ctx context.Context, info UpdateInfo, stagedDir string, requireSignature bool) (string, string, error)
- func StartUpdateWatchdog(expected string) error
- func VerifyStagedBinary(ctx context.Context, path, expected string) error
- func VerifyStagedBinaryNamed(ctx context.Context, path, name, expected string) error
- func VerifyUpdateAndRollback(target, previous, expected string) error
- type ACPRun
- func (r *ACPRun) CompleteElicitation(_ context.Context, _ acp.CompleteElicitationNotification) error
- func (r *ACPRun) CreateElicitation(_ context.Context, _ acp.CreateElicitationRequest) (acp.CreateElicitationResponse, error)
- func (r *ACPRun) CreateTerminal(context.Context, acp.CreateTerminalRequest) (acp.CreateTerminalResponse, error)
- func (r *ACPRun) Interrupt() error
- func (r *ACPRun) KillTerminal(context.Context, acp.KillTerminalRequest) (acp.KillTerminalResponse, error)
- func (r *ACPRun) Options(context.Context) (protocol.RunOptions, error)
- func (r *ACPRun) Prompt(text string, options *protocol.PromptOptions) error
- func (r *ACPRun) ReadTextFile(context.Context, acp.ReadTextFileRequest) (acp.ReadTextFileResponse, error)
- func (r *ACPRun) ReleaseTerminal(context.Context, acp.ReleaseTerminalRequest) (acp.ReleaseTerminalResponse, error)
- func (r *ACPRun) ReplyApproval(id, decision string) error
- func (r *ACPRun) RequestPermission(ctx context.Context, params acp.RequestPermissionRequest) (acp.RequestPermissionResponse, error)
- func (r *ACPRun) SessionUpdate(_ context.Context, params acp.SessionNotification) error
- func (r *ACPRun) Stop()
- func (r *ACPRun) TerminalOutput(context.Context, acp.TerminalOutputRequest) (acp.TerminalOutputResponse, error)
- func (r *ACPRun) WaitForTerminalExit(context.Context, acp.WaitForTerminalExitRequest) (acp.WaitForTerminalExitResponse, error)
- func (r *ACPRun) WriteTextFile(context.Context, acp.WriteTextFileRequest) (acp.WriteTextFileResponse, error)
- type Action
- type Adapter
- type AgentVersionRange
- type ClaudeAdapter
- func (a *ClaudeAdapter) BuildCommand(action Action) (Command, error)
- func (a *ClaudeAdapter) Detect(context.Context) (protocol.AgentInfo, error)
- func (a *ClaudeAdapter) ListSessions(ctx context.Context) ([]protocol.Session, error)
- func (a *ClaudeAdapter) Name() string
- func (a *ClaudeAdapter) Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
- func (a *ClaudeAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
- func (a *ClaudeAdapter) WatchPaths() []string
- type CodexAdapter
- func (a *CodexAdapter) BuildCommand(action Action) (Command, error)
- func (a *CodexAdapter) Detect(context.Context) (protocol.AgentInfo, error)
- func (a *CodexAdapter) ListSessions(ctx context.Context) ([]protocol.Session, error)
- func (a *CodexAdapter) Name() string
- func (a *CodexAdapter) Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
- func (a *CodexAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
- func (a *CodexAdapter) WatchPaths() []string
- type CodexRun
- type Command
- type CommandCodeAdapter
- func (a *CommandCodeAdapter) BuildCommand(action Action) (Command, error)
- func (a *CommandCodeAdapter) Detect(context.Context) (protocol.AgentInfo, error)
- func (a *CommandCodeAdapter) ListSessions(ctx context.Context) ([]protocol.Session, error)
- func (a *CommandCodeAdapter) Name() string
- func (a *CommandCodeAdapter) Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
- func (a *CommandCodeAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
- func (a *CommandCodeAdapter) WatchPaths() []string
- type Config
- type CursorAdapter
- func (a *CursorAdapter) BuildCommand(action Action) (Command, error)
- func (a *CursorAdapter) Detect(context.Context) (protocol.AgentInfo, error)
- func (a *CursorAdapter) ListSessions(ctx context.Context) ([]protocol.Session, error)
- func (a *CursorAdapter) Name() string
- func (a *CursorAdapter) Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
- func (a *CursorAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
- func (a *CursorAdapter) WatchPaths() []string
- type Daemon
- func (d *Daemon) Adapters() []Adapter
- func (d *Daemon) CheckUpdateNow(ctx context.Context, channel string) (UpdateInfo, error)
- func (d *Daemon) InstallUpdateNow(ctx context.Context) error
- func (d *Daemon) Run(ctx context.Context) error
- func (d *Daemon) SetRemoteInstall(enabled bool) (*protocol.UpdateStatus, error)
- type DevinAdapter
- func (a *DevinAdapter) BuildCommand(action Action) (Command, error)
- func (a *DevinAdapter) Detect(context.Context) (protocol.AgentInfo, error)
- func (a *DevinAdapter) ListSessions(ctx context.Context) ([]protocol.Session, error)
- func (a *DevinAdapter) Name() string
- func (a *DevinAdapter) Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
- func (a *DevinAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
- func (a *DevinAdapter) WatchPaths() []string
- type DoctorCheck
- type DoctorReport
- type GeminiAdapter
- func (a *GeminiAdapter) BuildCommand(action Action) (Command, error)
- func (a *GeminiAdapter) Detect(context.Context) (protocol.AgentInfo, error)
- func (a *GeminiAdapter) ListSessions(ctx context.Context) ([]protocol.Session, error)
- func (a *GeminiAdapter) Name() string
- func (a *GeminiAdapter) Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
- func (a *GeminiAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
- func (a *GeminiAdapter) WatchPaths() []string
- type OpenCodeAdapter
- func (a *OpenCodeAdapter) BuildCommand(action Action) (Command, error)
- func (a *OpenCodeAdapter) Detect(context.Context) (protocol.AgentInfo, error)
- func (a *OpenCodeAdapter) ListSessions(ctx context.Context) ([]protocol.Session, error)
- func (a *OpenCodeAdapter) Name() string
- func (a *OpenCodeAdapter) Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
- func (a *OpenCodeAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
- func (a *OpenCodeAdapter) WatchPaths() []string
- type Policy
- type Run
- type RuntimeStatus
- type SearchIndex
- func (x *SearchIndex) Close() error
- func (x *SearchIndex) Count() (int, error)
- func (x *SearchIndex) MarshalStatus() string
- func (x *SearchIndex) Rebuild(ctx context.Context, adapters []Adapter, policy Policy, log *slog.Logger) error
- func (x *SearchIndex) Refresh(ctx context.Context, adapters []Adapter, policy Policy, log *slog.Logger) error
- func (x *SearchIndex) Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
- func (x *SearchIndex) SetDisabled()
- func (x *SearchIndex) Status() protocol.IndexStatus
- type StoreWatcher
- type StructuredRun
- func (r *StructuredRun) Interrupt() error
- func (r *StructuredRun) Options(ctx context.Context) (protocol.RunOptions, error)
- func (r *StructuredRun) Prompt(text string, options *protocol.PromptOptions) error
- func (r *StructuredRun) ReplyApproval(id, decision string) error
- func (r *StructuredRun) Stop()
- type UpdateInfo
- type UpdateSettings
- type UpdateState
Constants ¶
const ( UpdatePhaseIdle = "idle" UpdatePhaseChecking = "checking" UpdatePhaseDownloading = "downloading" UpdatePhaseReady = "ready" UpdatePhaseWaitingIdle = "waiting_for_idle" UpdatePhaseInstalling = "installing" UpdatePhaseVerifying = "verifying" UpdatePhaseSuccess = "success" UpdatePhaseFailed = "failed" UpdatePhaseRolledBack = "rolled_back" UpdatePhaseBlocked = "blocked" UpdatePhaseDisabled = "disabled" )
Update phases reported to the hub and persisted across restarts. The hub only displays them; it cannot advance or bypass the local updater policy.
Variables ¶
var ErrNoRelease = errors.New("no published release")
ErrNoRelease means the release feed is reachable but contains no publishable release. During alpha this is the normal state, not an update failure.
var Version = "alpha"
Functions ¶
func AddUpdateWatchdogArgs ¶
AddUpdateWatchdogArgs is used by the CLI parser tests to keep the flag names in one place.
func CheckAgentVersion ¶
CheckAgentVersion reports whether a detected version is inside any tested band. recognized is false when the matrix has no entry or the version could not be parsed.
func ClearUpdateBlock ¶
func ClearUpdateBlock(version string)
ClearUpdateBlock removes a version from the persisted display state after an operator explicitly unblocks it in the local configuration.
func ConfigPath ¶
func DefaultForbiddenArgs ¶
func DefaultForbiddenArgs() []string
func FetchHubPublicKey ¶
FetchHubPublicKey reads the hub's command-signing key. Pairing uses this to pin the key; an existing host also calls it on startup when it was paired before command signing existed (trust on first use).
func HideConsoleWindow ¶ added in v0.1.7
func HideConsoleWindow()
HideConsoleWindow is a no-op outside Windows.
func InstallOwnUpdate ¶
InstallOwnUpdate replaces the currently running executable without touching the daemon service or host identity. It is used by the standalone `nexus` client. On Windows a small detached helper waits for this process to exit before replacing the locked image.
func InstallStagedUpdate ¶
InstallStagedUpdate replaces the running daemon binary after asking the per-user service to restart. force must be set explicitly because the restart interrupts active agent runs; callers should verify that no runs are active before setting it.
func NewIdentity ¶
func NewIdentity() (ed25519.PublicKey, ed25519.PrivateKey, error)
func NormalizeUpdateChannel ¶
NormalizeUpdateChannel resolves auto and unknown channel names. Stable is always the safe default; an unknown value must never silently select prereleases.
func PlatformName ¶
func PlatformName() string
func ReadHostname ¶
func ReadHostname() string
func RollbackUpdate ¶
RollbackUpdate restores nexusd.previous through the same service restart path. The currently installed binary is kept as nexusd.failed for diagnosis.
func SaveConfig ¶
func SaveUpdatePrefs ¶
func SaveUpdatePrefs(prefs UpdateSettings) error
SaveUpdatePrefs stores normalized updater settings without touching any other field. It never changes the host identity or pairing.
func ServiceAction ¶
ServiceAction installs, uninstalls or queries the per-user background service. It intentionally never creates a root/SYSTEM service.
func ServiceInstalled ¶
func ServiceInstalled() bool
ServiceInstalled reports whether the per-user service that can restart the daemon after a binary replacement is present.
func StageUpdate ¶
func StageUpdate(ctx context.Context, info UpdateInfo, stagedDir string, requireSignature bool) (string, error)
StageUpdate downloads the archive and checksum file, verifies the SHA-256 digest (and the cosign bundle when cosign is installed or required), then extracts nexusd into the staged directory.
func StageUpdateNamed ¶
func StageUpdateNamed(ctx context.Context, info UpdateInfo, stagedDir, binaryName string, requireSignature bool) (string, string, error)
StageUpdateNamed stages one executable from a release archive. It is shared by the daemon and the terminal client so both use the same checksum, signature and extraction rules.
func StageUpdateWithMode ¶
func StageUpdateWithMode(ctx context.Context, info UpdateInfo, stagedDir string, requireSignature bool) (string, string, error)
StageUpdateWithMode also reports the trust mode that was actually used: "cosign" or "checksum-only". A failed signature is never downgraded to checksum-only.
func StartUpdateWatchdog ¶
StartUpdateWatchdog copies the current (known working) executable and starts it in a detached scope before the binary is replaced. If the new daemon does not report the expected version within the startup window, the copy restores nexusd.previous and restarts the service. Windows uses the Task Scheduler helper instead because a running image cannot be replaced in place.
func VerifyStagedBinary ¶
VerifyStagedBinary runs the downloaded daemon's version command before it can replace a working installation. A wrong or non-executable binary is rejected here, not after the service restart.
func VerifyStagedBinaryNamed ¶
VerifyStagedBinaryNamed checks the version output of a staged executable.
func VerifyUpdateAndRollback ¶
VerifyUpdateAndRollback is the detached half of StartUpdateWatchdog. It waits for the new daemon to publish its runtime status and rolls back only when the service is present but not healthy.
Types ¶
type ACPRun ¶
type ACPRun struct {
// contains filtered or unexported fields
}
ACPRun drives any Agent Client Protocol adapter over stdio. This is how agents without a native structured driver (for example Claude Code via claude-code-acp) get text streaming, tool cards and approvals.
func (*ACPRun) CompleteElicitation ¶ added in v0.1.15
func (r *ACPRun) CompleteElicitation(_ context.Context, _ acp.CompleteElicitationNotification) error
Completion notifications are harmless when elicitation is unsupported.
func (*ACPRun) CreateElicitation ¶ added in v0.1.15
func (r *ACPRun) CreateElicitation(_ context.Context, _ acp.CreateElicitationRequest) (acp.CreateElicitationResponse, error)
The client does not advertise elicitation support. Reject requests using the ACP method-not-found error, as required by the SDK.
func (*ACPRun) CreateTerminal ¶
func (r *ACPRun) CreateTerminal(context.Context, acp.CreateTerminalRequest) (acp.CreateTerminalResponse, error)
func (*ACPRun) KillTerminal ¶
func (r *ACPRun) KillTerminal(context.Context, acp.KillTerminalRequest) (acp.KillTerminalResponse, error)
func (*ACPRun) Options ¶
Options returns only what the agent actually advertised: config options categorised as model/thought level and the session's mode list.
func (*ACPRun) ReadTextFile ¶
func (r *ACPRun) ReadTextFile(context.Context, acp.ReadTextFileRequest) (acp.ReadTextFileResponse, error)
ReadTextFile is not advertised to the agent, so this is only a safety net.
func (*ACPRun) ReleaseTerminal ¶
func (r *ACPRun) ReleaseTerminal(context.Context, acp.ReleaseTerminalRequest) (acp.ReleaseTerminalResponse, error)
func (*ACPRun) ReplyApproval ¶
func (*ACPRun) RequestPermission ¶
func (r *ACPRun) RequestPermission(ctx context.Context, params acp.RequestPermissionRequest) (acp.RequestPermissionResponse, error)
func (*ACPRun) SessionUpdate ¶
func (*ACPRun) TerminalOutput ¶
func (r *ACPRun) TerminalOutput(context.Context, acp.TerminalOutputRequest) (acp.TerminalOutputResponse, error)
func (*ACPRun) WaitForTerminalExit ¶
func (r *ACPRun) WaitForTerminalExit(context.Context, acp.WaitForTerminalExitRequest) (acp.WaitForTerminalExitResponse, error)
func (*ACPRun) WriteTextFile ¶
func (r *ACPRun) WriteTextFile(context.Context, acp.WriteTextFileRequest) (acp.WriteTextFileResponse, error)
type Adapter ¶
type Adapter interface {
Name() string
Detect(context.Context) (protocol.AgentInfo, error)
ListSessions(context.Context) ([]protocol.Session, error)
Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
BuildCommand(Action) (Command, error)
}
Adapter is implemented per coding agent. Discovery must work without starting the agent; Control only produces argv and never executes anything.
func DetectAdapters ¶
DetectAdapters returns one adapter per installed agent. Unknown agents are ignored instead of failing the daemon.
type AgentVersionRange ¶
type AgentVersionRange struct {
Agent string
Min string
Max string
Structured bool
// Note explains a supported band that intentionally has no structured
// driver, for example OpenCode 1.x.
Note string
}
AgentVersionRange is the tested version band for one agent. Structured mode is disabled outside the band unless the host explicitly allows untested versions; terminal mode remains available.
func AgentMatrix ¶
func AgentMatrix() []AgentVersionRange
AgentMatrix returns a copy of the tested version matrix.
func (AgentVersionRange) TestedRange ¶
func (r AgentVersionRange) TestedRange() string
TestedRange renders the band for display and documentation.
type ClaudeAdapter ¶
type ClaudeAdapter struct {
// contains filtered or unexported fields
}
ClaudeAdapter discovers Claude Code sessions from its JSONL store and starts the native CLI for terminal runs.
func NewClaudeAdapter ¶
func NewClaudeAdapter(bin string) *ClaudeAdapter
func (*ClaudeAdapter) BuildCommand ¶
func (a *ClaudeAdapter) BuildCommand(action Action) (Command, error)
func (*ClaudeAdapter) ListSessions ¶
func (*ClaudeAdapter) Name ¶
func (a *ClaudeAdapter) Name() string
func (*ClaudeAdapter) Transcript ¶
func (a *ClaudeAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
func (*ClaudeAdapter) WatchPaths ¶
func (a *ClaudeAdapter) WatchPaths() []string
type CodexAdapter ¶
type CodexAdapter struct {
// contains filtered or unexported fields
}
CodexAdapter discovers Codex CLI rollouts and starts the native CLI.
func NewCodexAdapter ¶
func NewCodexAdapter(bin string) *CodexAdapter
func (*CodexAdapter) BuildCommand ¶
func (a *CodexAdapter) BuildCommand(action Action) (Command, error)
func (*CodexAdapter) ListSessions ¶
func (*CodexAdapter) Name ¶
func (a *CodexAdapter) Name() string
func (*CodexAdapter) Transcript ¶
func (a *CodexAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
func (*CodexAdapter) WatchPaths ¶
func (a *CodexAdapter) WatchPaths() []string
type CodexRun ¶
type CodexRun struct {
// contains filtered or unexported fields
}
CodexRun drives Codex CLI's experimental app-server over JSONL/JSON-RPC.
func (*CodexRun) Options ¶
Options returns Codex's catalog models and their advertised reasoning efforts. Models are filtered to the non-hidden catalog entries.
func (*CodexRun) Prompt ¶
func (r *CodexRun) Prompt(text string, options *protocol.PromptOptions) error
func (*CodexRun) ReplyApproval ¶
type Command ¶
Command is a resolved process launch, including a Windows shim wrapper if the agent is installed as .cmd/.bat/.ps1.
type CommandCodeAdapter ¶ added in v0.1.5
type CommandCodeAdapter struct {
// contains filtered or unexported fields
}
CommandCodeAdapter discovers Command Code sessions and starts the native CLI. Structured runs use the generic ACP driver through `command-code acp`.
func NewCommandCodeAdapter ¶ added in v0.1.5
func NewCommandCodeAdapter(bin string) *CommandCodeAdapter
func (*CommandCodeAdapter) BuildCommand ¶ added in v0.1.5
func (a *CommandCodeAdapter) BuildCommand(action Action) (Command, error)
func (*CommandCodeAdapter) ListSessions ¶ added in v0.1.5
func (*CommandCodeAdapter) Name ¶ added in v0.1.5
func (a *CommandCodeAdapter) Name() string
func (*CommandCodeAdapter) Transcript ¶ added in v0.1.5
func (a *CommandCodeAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
func (*CommandCodeAdapter) WatchPaths ¶ added in v0.1.5
func (a *CommandCodeAdapter) WatchPaths() []string
type Config ¶
type Config struct {
HubURL string `json:"hub_url"`
HostID string `json:"host_id"`
HostName string `json:"host_name"`
PrivateKey string `json:"private_key"`
HubPublicKey string `json:"hub_public_key,omitempty"`
HubSigningRequired bool `json:"hub_signing_required,omitempty"`
Policy Policy `json:"policy"`
// Updates configures the host-local auto-updater. Omitted means enabled
// with the official defaults; a hub cannot change these settings.
Updates *UpdateSettings `json:"updates,omitempty"`
// RunBufferBytes bounds the per-run terminal replay buffer. Omitted means
// 1 MiB; values below 64 KiB or above 16 MiB are clamped.
RunBufferBytes int `json:"run_buffer_bytes,omitempty"`
// ACPCommands maps an agent name to an Agent Client Protocol adapter
// command line, for example {"claude": "claude-code-acp"}. When empty the
// daemon looks for the claude-agent-acp or claude-code-acp binary on PATH.
ACPCommands map[string]string `json:"acp_commands,omitempty"`
// AllowUntestedAgentVersions keeps structured mode enabled for agents
// outside the tested version band. Every use is audited.
AllowUntestedAgentVersions bool `json:"allow_untested_agent_versions,omitempty"`
// SearchIndex enables the host-local FTS5 transcript cache. Omitted means
// enabled; set it to false to keep transcript text out of a local index.
SearchIndex *bool `json:"search_index,omitempty"`
}
Config is stored next to the host key in the per-user config directory.
func LoadConfig ¶
func Pair ¶
Pair redeems a one-time pairing code and stores the host identity. It returns the short authentication string the user must compare with the hub.
func (Config) ACPCommand ¶
ACPCommand returns the ACP adapter command configured for an agent.
func (Config) RunBufferBytesOrDefault ¶
RunBufferBytesOrDefault returns the bounded terminal replay size.
func (Config) SearchIndexEnabled ¶
SearchIndexEnabled reports whether the local search index may be built.
func (Config) SigningKey ¶
func (c Config) SigningKey() (ed25519.PrivateKey, error)
func (Config) UpdatePrefs ¶
func (c Config) UpdatePrefs() UpdateSettings
UpdatePrefs returns the host-local updater settings with defaults applied.
type CursorAdapter ¶ added in v0.1.12
type CursorAdapter struct {
// contains filtered or unexported fields
}
CursorAdapter discovers Cursor agent transcripts and starts the Cursor CLI. Structured runs use the generic ACP driver through `cursor-agent acp`.
Cursor stores desktop and background-agent transcripts under ~/.cursor/projects/<encoded-workspace>/agent-transcripts/<session>/<session>.jsonl. The folder name is a lossy encoding of the workspace path, so the working directory is read from a terminal transcript when one exists and decoded from the folder name as a last resort.
func NewCursorAdapter ¶ added in v0.1.12
func NewCursorAdapter(bin string) *CursorAdapter
func (*CursorAdapter) BuildCommand ¶ added in v0.1.12
func (a *CursorAdapter) BuildCommand(action Action) (Command, error)
func (*CursorAdapter) ListSessions ¶ added in v0.1.12
func (*CursorAdapter) Name ¶ added in v0.1.12
func (a *CursorAdapter) Name() string
func (*CursorAdapter) Transcript ¶ added in v0.1.12
func (a *CursorAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
func (*CursorAdapter) WatchPaths ¶ added in v0.1.12
func (a *CursorAdapter) WatchPaths() []string
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon owns the hub link, discovery loop and run manager.
func NewDaemonWithAdapters ¶
NewDaemonWithAdapters builds a daemon with an explicit adapter set. It is used by tests and by embedding scenarios; production uses DetectAdapters.
func (*Daemon) CheckUpdateNow ¶
CheckUpdateNow triggers a host-local check, for example from the hub's "Check for updates" button. It never installs anything.
func (*Daemon) InstallUpdateNow ¶
InstallUpdateNow honours the host-local remote-install policy. The caller may be the hub, but only the host decides whether that request is allowed.
func (*Daemon) SetRemoteInstall ¶ added in v0.1.5
func (d *Daemon) SetRemoteInstall(enabled bool) (*protocol.UpdateStatus, error)
SetRemoteInstall persists the host-local remote-install switch. It never changes the channel, signature policy or release source, which stay local.
type DevinAdapter ¶ added in v0.1.12
type DevinAdapter struct {
// contains filtered or unexported fields
}
DevinAdapter reads the Devin CLI session database read-only and starts the Devin CLI for terminal runs. Structured runs use the generic ACP driver through `devin acp`. Devin Desktop bundles the same CLI and session store.
func NewDevinAdapter ¶ added in v0.1.12
func NewDevinAdapter(bin string) *DevinAdapter
func (*DevinAdapter) BuildCommand ¶ added in v0.1.12
func (a *DevinAdapter) BuildCommand(action Action) (Command, error)
func (*DevinAdapter) ListSessions ¶ added in v0.1.12
func (*DevinAdapter) Name ¶ added in v0.1.12
func (a *DevinAdapter) Name() string
func (*DevinAdapter) Transcript ¶ added in v0.1.12
func (a *DevinAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
func (*DevinAdapter) WatchPaths ¶ added in v0.1.12
func (a *DevinAdapter) WatchPaths() []string
type DoctorCheck ¶
type DoctorCheck struct {
ID string `json:"id"`
Status string `json:"status"` // ok, warning, error
Detail string `json:"detail"`
}
DoctorCheck is a sanitized diagnostic result suitable for the hub UI. It intentionally omits host ids, paths, keys and configuration values.
type DoctorReport ¶
type DoctorReport struct {
Version string `json:"version"`
Issues int `json:"issues"`
Checks []DoctorCheck `json:"checks"`
}
DoctorReport is the safe subset of `nexusd doctor` exposed to the hub.
type GeminiAdapter ¶
type GeminiAdapter struct {
// contains filtered or unexported fields
}
GeminiAdapter is a best-effort adapter for Gemini CLI. Its on-disk chat format is less stable than the other agents, so unknown files are skipped and never break indexing.
func NewGeminiAdapter ¶
func NewGeminiAdapter(bin string) *GeminiAdapter
func (*GeminiAdapter) BuildCommand ¶
func (a *GeminiAdapter) BuildCommand(action Action) (Command, error)
func (*GeminiAdapter) ListSessions ¶
func (*GeminiAdapter) Name ¶
func (a *GeminiAdapter) Name() string
func (*GeminiAdapter) Transcript ¶
func (a *GeminiAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
func (*GeminiAdapter) WatchPaths ¶
func (a *GeminiAdapter) WatchPaths() []string
type OpenCodeAdapter ¶
type OpenCodeAdapter struct {
// contains filtered or unexported fields
}
OpenCodeAdapter reads the OpenCode SQLite store read-only and starts the native OpenCode TUI for terminal runs.
func NewOpenCodeAdapter ¶
func NewOpenCodeAdapter(bin string) *OpenCodeAdapter
func (*OpenCodeAdapter) BuildCommand ¶
func (a *OpenCodeAdapter) BuildCommand(action Action) (Command, error)
func (*OpenCodeAdapter) ListSessions ¶
func (*OpenCodeAdapter) Name ¶
func (a *OpenCodeAdapter) Name() string
func (*OpenCodeAdapter) Transcript ¶
func (a *OpenCodeAdapter) Transcript(ctx context.Context, nativeID string, offset, limit int) (protocol.Transcript, error)
func (*OpenCodeAdapter) WatchPaths ¶
func (a *OpenCodeAdapter) WatchPaths() []string
type Policy ¶
type Policy struct {
AllowedRoots []string `json:"allowed_roots"`
AllowedAgents []string `json:"allowed_agents"`
AllowNew bool `json:"allow_new_sessions"`
AllowFork bool `json:"allow_fork"`
ForbiddenArgs []string `json:"forbidden_args"`
// AllowAllRoots removes the directory filter entirely: every discovered
// session is advertised and every non-empty path may be read or started.
// A missing field is resolved on load: new and legacy home-only configs
// default to true, a config with custom roots keeps them restricted.
AllowAllRoots *bool `json:"allow_all_roots,omitempty"`
// AllowForceResume permits the hub to ask for a resume even when a
// best-effort process scan reports the native session as open elsewhere.
// Omitted means enabled for backward compatibility.
AllowForceResume *bool `json:"allow_force_resume,omitempty"`
// AllowPersistentApprovals permits the agent's own persistent permission
// option ("always"). Off by default: unlike a one-time approval, a
// persistent grant removes every future prompt for that action.
AllowPersistentApprovals bool `json:"allow_persistent_approvals,omitempty"`
// ProcessGraceSeconds is how long a stopped run may take to exit before
// its process tree is killed. Zero means the five-second default.
ProcessGraceSeconds int `json:"process_grace_seconds,omitempty"`
}
Policy is enforced on the host and cannot be overridden by the hub.
func DefaultPolicy ¶
func DefaultPolicy() Policy
func (Policy) AgentAllowed ¶
AgentAllowed checks a name against the policy; an empty list means "all detected agents".
func (Policy) AllowAllRootsEnabled ¶ added in v0.1.11
AllowAllRootsEnabled reports whether the directory filter is disabled. A nil pointer is restricted so tests and hand-built policies keep the previous fail-closed behaviour; LoadConfig resolves the default.
func (Policy) ArgsAllowed ¶
ArgsAllowed rejects permission-bypass flags even if the hub asks for them.
func (Policy) ForceResumeAllowed ¶
ForceResumeAllowed reports whether a force-resume request is acceptable. The zero value is enabled so existing configurations keep working.
func (Policy) ProcessGrace ¶
ProcessGrace returns the configured grace period, clamped to a sane range.
func (Policy) WithinRoots ¶
WithinRoots reports whether path is inside one of the allowed roots.
type Run ¶
type Run struct {
// contains filtered or unexported fields
}
Run is one live process attached to an agent session.
type RuntimeStatus ¶
type RuntimeStatus = runtimeStatus
RuntimeStatus is the last published active-run snapshot. A status older than two minutes is treated as stale by ReadRuntimeStatus.
func ReadRuntimeStatus ¶
func ReadRuntimeStatus() (RuntimeStatus, bool)
ReadRuntimeStatus exposes the running daemon's runtime snapshot to the installer and status command. It never blocks on the daemon.
type SearchIndex ¶
type SearchIndex struct {
// contains filtered or unexported fields
}
SearchIndex is a host-local SQLite FTS5 cache. It never leaves the host: the hub only receives hit metadata and an index status. The index is a second local copy of transcript text, so the file is created with 0600 permissions and can be disabled with search_index=false.
func OpenSearchIndex ¶
func OpenSearchIndex(path string) (*SearchIndex, error)
OpenSearchIndex opens or creates the index in a host-local directory.
func (*SearchIndex) Count ¶
func (x *SearchIndex) Count() (int, error)
Count returns the number of indexed sessions.
func (*SearchIndex) MarshalStatus ¶
func (x *SearchIndex) MarshalStatus() string
MarshalStatus is a small helper for the CLI.
func (*SearchIndex) Rebuild ¶
func (x *SearchIndex) Rebuild(ctx context.Context, adapters []Adapter, policy Policy, log *slog.Logger) error
Rebuild drops and rebuilds the whole index.
func (*SearchIndex) Refresh ¶
func (x *SearchIndex) Refresh(ctx context.Context, adapters []Adapter, policy Policy, log *slog.Logger) error
Refresh incrementally indexes changed sessions.
func (*SearchIndex) Search ¶
func (x *SearchIndex) Search(ctx context.Context, query string, limit int) ([]protocol.SearchHit, error)
Search runs a ranked FTS5 query. Only metadata is returned.
func (*SearchIndex) SetDisabled ¶
func (x *SearchIndex) SetDisabled()
SetDisabled reports the configured-off state without opening a database.
func (*SearchIndex) Status ¶
func (x *SearchIndex) Status() protocol.IndexStatus
Status returns the current progress.
type StoreWatcher ¶
type StoreWatcher interface {
WatchPaths() []string
}
StoreWatcher is implemented by adapters that can name the local files whose mtimes change when a session is created or extended. The daemon polls this small fingerprint instead of rescanning every session file on every tick.
type StructuredRun ¶
type StructuredRun struct {
// contains filtered or unexported fields
}
StructuredRun drives an agent through its own local server protocol. The first implementation targets OpenCode's v2 HTTP API; terminal mode remains the universal fallback for every other agent.
func (*StructuredRun) Interrupt ¶
func (r *StructuredRun) Interrupt() error
func (*StructuredRun) Options ¶
func (r *StructuredRun) Options(ctx context.Context) (protocol.RunOptions, error)
Options returns the model, reasoning-variant and agent choices that the running OpenCode server actually exposes.
func (*StructuredRun) Prompt ¶
func (r *StructuredRun) Prompt(text string, options *protocol.PromptOptions) error
func (*StructuredRun) ReplyApproval ¶
func (r *StructuredRun) ReplyApproval(id, decision string) error
func (*StructuredRun) Stop ¶
func (r *StructuredRun) Stop()
type UpdateInfo ¶
type UpdateInfo struct {
Current string `json:"current"`
Latest string `json:"latest"`
Available bool `json:"available"`
Prerelease bool `json:"prerelease"`
Channel string `json:"channel,omitempty"`
AssetName string `json:"asset_name,omitempty"`
ChecksumURL string `json:"checksum_url,omitempty"`
SignatureURL string `json:"signature_url,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
Notes string `json:"notes,omitempty"`
PublishedAt time.Time `json:"published_at,omitempty"`
}
func CheckForUpdate ¶
func CheckForUpdate(ctx context.Context, currentVersion, channel string) (UpdateInfo, error)
CheckForUpdate reads the release list directly from GitHub. The hub is never involved in choosing or serving the binary, so a compromised hub cannot substitute an executable.
func CheckForUpdateCached ¶
func CheckForUpdateCached(ctx context.Context, currentVersion, channel, etag string) (info UpdateInfo, newETag string, notModified bool, err error)
CheckForUpdateCached is CheckForUpdate with an ETag for conditional requests. notModified is true when GitHub answered 304; the caller should reuse its cached metadata.
type UpdateSettings ¶
type UpdateSettings struct {
Disabled bool `json:"disabled,omitempty"`
Channel string `json:"channel,omitempty"`
CheckIntervalMinutes int `json:"check_interval_minutes,omitempty"`
InstallWhenIdle *bool `json:"install_when_idle,omitempty"`
RequireSignature *bool `json:"require_signature,omitempty"`
AllowRemoteInstall bool `json:"allow_remote_install,omitempty"`
BlockedVersions []string `json:"blocked_versions,omitempty"`
}
UpdateSettings controls the host-local auto-updater. The settings live on the host and are never pushed by the hub. A nil Updates field in an existing config means "official defaults": enabled, stable, every six hours, install when idle, SHA-256 verification and optional cosign when installed.
func (UpdateSettings) InstallIdle ¶
func (u UpdateSettings) InstallIdle() bool
InstallIdle reports whether updates may be installed automatically.
func (UpdateSettings) Interval ¶
func (u UpdateSettings) Interval() time.Duration
Interval returns the configured check interval.
func (UpdateSettings) IsBlocked ¶
func (u UpdateSettings) IsBlocked(version string) bool
IsBlocked reports whether a version was temporarily blocked after failures.
func (UpdateSettings) Resolve ¶
func (u UpdateSettings) Resolve() UpdateSettings
Resolve returns a normalized copy of the settings with defaults applied.
func (UpdateSettings) SignatureRequired ¶
func (u UpdateSettings) SignatureRequired() bool
SignatureRequired reports whether a cosign bundle must verify successfully. The default is false: SHA-256 is always verified, and cosign is optional. Set require_signature to true on hosts that have cosign installed.
type UpdateState ¶
type UpdateState = updateState
UpdateState is the persisted updater snapshot exposed to the CLI.
func ReadUpdateState ¶
func ReadUpdateState() (UpdateState, bool)
ReadUpdateState returns the persisted updater state, if any.
Source Files
¶
- adapter.go
- agents.go
- attachments.go
- attachments_unix.go
- audit.go
- autoupdate.go
- claude.go
- cli.go
- codex.go
- commandcode.go
- config.go
- console_other.go
- cursor.go
- daemon.go
- devin.go
- doctor_safe.go
- gemini.go
- git.go
- hubsig.go
- opencode.go
- opencode_service.go
- process.go
- process_guard_unix.go
- process_other.go
- process_start_other.go
- process_tree.go
- runs.go
- searchindex.go
- service_other.go
- service_path.go
- stdio_pipes.go
- structured.go
- structured_acp.go
- structured_codex.go
- update.go
- update_apply.go
- update_apply_other.go
- update_restart_other.go
- update_watchdog.go
- update_watchdog_unix.go
- util.go
- versions.go
- watch.go