Documentation
¶
Overview ¶
Package daemon wires Smif together: the socket API, the store, the router, the scheduler, the supervisor and the runners. It is the only long-lived process (RFC 4.1).
Index ¶
- Constants
- Variables
- func IsNotFound(err error) bool
- func RemoteArgv(host, command string) []string
- func RemoteDisconnect(host string)
- func SSHCommand() string
- type Daemon
- func (d *Daemon) Cancel(id string) (string, error)
- func (d *Daemon) Config() *config.Config
- func (d *Daemon) GC() (*api.GCResult, error)
- func (d *Daemon) HumanReply(p api.HumanReplyParams) (*api.SendResult, error)
- func (d *Daemon) Ingest(c auth.Principal, kind string, raw json.RawMessage) (*api.SendResult, error)
- func (d *Daemon) Reload() error
- func (d *Daemon) Retry(id string) error
- func (d *Daemon) Start() error
- func (d *Daemon) Stop()
- func (d *Daemon) Store() *store.Store
- func (d *Daemon) Wait()
- type Options
Constants ¶
const MaxPromptRunes = 4000
MaxPromptRunes caps one prompt.
const (
// RemoteCommand runs in a non-login shell, which has no ~/.local/bin.
RemoteCommand = `PATH="$HOME/.local/bin:$PATH" smif sessions --json`
)
Other machines (ADR-0023): a remote is an ssh host that runs smif too. The daemon asks it for its session list and shows the rows here, read only.
const RemoteKey = "smif_ed25519"
RemoteKey is the daemon's own key in ~/.ssh (ADR-0024). The other machine lets it run the session list and nothing else.
const SessionAskProfile = "answer"
SessionAskProfile is the worker profile that answers session asks.
Variables ¶
var Version = "dev"
Version is set at build time.
Functions ¶
func IsNotFound ¶
IsNotFound reports whether err is a store not-found.
func RemoteArgv ¶ added in v0.2.0
RemoteArgv is the ssh call. The host passed config validation, and -- ends the options. A shared connection keeps a poll cheap.
func RemoteDisconnect ¶ added in v0.3.2
func RemoteDisconnect(host string)
RemoteDisconnect closes the daemon's shared connection to a host. sshd reads a key's line at login, so a connection that stays open keeps the old rights: after a change of the key, the next poll must log in again.
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon is the running service.
func (*Daemon) Cancel ¶
Cancel cancels a queued, waiting or running message. It returns the state the item has after the call: api.CancelRejected when the item is rejected at once, api.CancelCancelling when a running worker must stop first (the outcome then shows in thread.get).
func (*Daemon) HumanReply ¶
func (d *Daemon) HumanReply(p api.HumanReplyParams) (*api.SendResult, error)
HumanReply answers a needs_human item (RFC 5.3, 7.3 `smif reply`).
An ask the rules escalated is answered directly: the text becomes the reply to the asker. Anything else continues in the same thread: the text goes back to the agent as a reply and its worker runs again.
func (*Daemon) Ingest ¶
func (d *Daemon) Ingest(c auth.Principal, kind string, raw json.RawMessage) (*api.SendResult, error)
Ingest validates, stamps and persists a client message, then routes it. The message is committed before the ack (R-DEL-2).
func (*Daemon) Start ¶
Start reconciles state, probes claude, binds the socket and starts the dispatcher. It returns once the socket accepts connections.
type Options ¶
type Options struct {
ConfigPath string
DataDir string
Socket string
// Notifier overrides the configured notifier (tests).
Notifier notify.Notifier
// SkipProbe uses the verified capability set instead of probing claude.
SkipProbe bool
// LogWriter receives daemon logs in addition to the log file.
LogWriter io.Writer
}
Options configure a daemon.