Documentation
¶
Overview ¶
Package agent implements the per-aspect runtime. Long-running process that connects to its upstream (Nexus directly OR a local Outpost) via a persistent WebSocket. Handles register/turn frames over that WS, writes session entries to a local tree, invokes the configured provider for each turn.
v1 scope: register + deregister + turn dispatch over WS. Hand dispatch, knowledge frames, session projection land in subsequent parts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is the running runtime instance.
func (*Agent) Start ¶
Start brings the agent up: drives the wsclient Run loop (which dials upstream and reconnects on drop), registers on each new connection. Blocks until ctx is cancelled or FailFirstConnect trips. Deregisters on clean shutdown (while the connection is still live — we watch ctx separately so deregister lands before Run tears the socket down).
type Config ¶
type Config struct {
// Home is the absolute path to the aspect home folder.
Home string
// Aspect is the parsed aspect.json.
Aspect schemas.AspectConfig
// Provider is the chat provider adapter (e.g. claude-api).
Provider providers.Provider
// UpstreamURL is the WS URL to dial. For aspects running on a
// direct-to-Nexus host this is the Nexus's /connect endpoint;
// on hosts with a local Outpost, it's the Outpost's listener.
// Resolution rule: NEXUS_OUTPOST overrides NEXUS_UPSTREAM per
// transport spec §3.1. The caller (main.go) resolves it and
// passes the resulting URL here.
UpstreamURL string
// UpstreamIsExplicitOutpost is true when the URL was resolved
// from NEXUS_OUTPOST (not NEXUS_UPSTREAM). Triggers fail-loudly
// on initial connect failure per transport spec §3.5.
UpstreamIsExplicitOutpost bool
// AuthToken is the bearer token sent on the WS upgrade.
AuthToken string
// Logger is optional; nil falls back to slog.Default().
Logger *slog.Logger
}
Config bundles the runtime dependencies. All fields except Logger are required.