Documentation
¶
Overview ¶
Package native is the native host's durable state: the SQLite database that holds settings, credentials, model catalogs, sessions and Bridge documents, its one-time import from Pi-compatible files, and the per-conversation owner locks that keep one Orb process writing each conversation (DECISIONS.md "Native SQLite storage").
Index ¶
- Variables
- func DetachedProcAttr() *syscall.SysProcAttr
- func Exec(path string, argv, environment []string) error
- func Migrated(ctx context.Context, agentDir string) (bool, error)
- func Path(agentDir string) (string, error)
- func RequireOfflineMigration(ctx context.Context, agentDir string) error
- func StopLegacyWriters(ctx context.Context, agentDir string, ...) error
- type RunningError
- type State
- func (state *State) Accounts(agentDir string, base auth.CredentialStore) *accounts.Store
- func (state *State) Auth(agentDir string) (*config.AuthStorage, error)
- func (state *State) BindSession(manager *session.SessionManager) error
- func (state *State) BridgeStore(path string, quota int) (*nativebridge.Store, error)
- func (state *State) ChatNamespace(path string) string
- func (state *State) ChildSession(cwd string) (*session.SessionManager, error)
- func (state *State) ClaimSession(manager *session.SessionManager) (func(), error)
- func (state *State) Close() error
- func (state *State) Conversation() *State
- func (state *State) DeleteSession(id string) error
- func (state *State) Document(path string) host.Document
- func (state *State) Memory() memory.Store
- func (state *State) Models(agentDir string, credentials auth.CredentialStore, offline bool) (*config.ModelRegistry, error)
- func (state *State) OwnerLock(id string) (*flock.Flock, error)
- func (state *State) PruneEmpty(ctx context.Context)
- func (state *State) Read(ctx context.Context, path string) ([]byte, error)
- func (state *State) Release()
- func (state *State) Sessions() *sqlite.Sessions
- func (state *State) Settings(cwd, agentDir string, options ...config.Option) (*config.SettingsManager, error)
- func (state *State) Trust(agentDir string) (*config.ProjectTrustStore, error)
- func (state *State) Write(ctx context.Context, path string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
var ErrLegacyMigration = errors.New("legacy Orb data needs migration; close other Orb processes, then run orb storage migrate")
Functions ¶
func DetachedProcAttr ¶
func DetachedProcAttr() *syscall.SysProcAttr
DetachedProcAttr starts a daemon outside this process's session.
func Path ¶
Path is the database file for agentDir: ORB_STATE_HOME, else beside an explicit agent dir or Bridge home, else ~/.orb/state.
func RequireOfflineMigration ¶
RequireOfflineMigration refuses while another Orb process of this user selects the same agent directory, as a RunningError.
func StopLegacyWriters ¶
func StopLegacyWriters(ctx context.Context, agentDir string, confirm func(pid int, command string) bool) error
StopLegacyWriters clears the way for the one-time migration. An Orb still running the previous version would keep writing files this one no longer reads, so confirm, given its pid and command line, decides whether to stop each; a nil confirm refuses.
Types ¶
type RunningError ¶
type RunningError struct{ PID int }
RunningError names another Orb still writing the data a migration moves.
func (RunningError) Error ¶
func (e RunningError) Error() string
type State ¶
type State struct {
DB *sqlite.DB
AgentDir string
// Files keeps settings.json and models.json in the agent dir
// authoritative, as a deployed agent's mounted configuration is.
Files bool
// contains filtered or unexported fields
}
State is the open native database for one agent directory. A nil State is the file-backed fallback: every constructor then reads the Pi-compatible files under the agent directory.
func Open ¶
func Open(ctx context.Context, agentDir string, migrate bool, credentials host.Document, sessionDirs ...string) (_ *State, err error)
Open opens agentDir's database, importing the legacy files and sessionDirs once when migrate is set; without it, pending legacy data is ErrLegacyMigration. credentials, when set, replaces auth.json.
func (*State) BindSession ¶
func (state *State) BindSession(manager *session.SessionManager) error
BindSession claims manager's conversation and keeps the claim.
func (*State) BridgeStore ¶
func (*State) ChatNamespace ¶
ChatNamespace is the namespace of a chat gateway's data directory.
func (*State) ChildSession ¶
func (state *State) ChildSession(cwd string) (*session.SessionManager, error)
ChildSession is a new session for an extension's child agent.
func (*State) ClaimSession ¶
func (state *State) ClaimSession(manager *session.SessionManager) (func(), error)
ClaimSession takes manager's conversation for this state, refusing one another Orb process holds; the returned func releases the previous claim.
func (*State) Conversation ¶
Conversation shares this state's store with a claim of its own, for a process that keeps several conversations open at once (ACP).
func (*State) DeleteSession ¶
DeleteSession deletes a stored conversation no Orb holds open.
func (*State) Document ¶
Document implements host.Store: kernel paths under the agent dir and the Bridge homes map to their namespaces, anything else is keyed by its path.
func (*State) Models ¶
func (state *State) Models(agentDir string, credentials auth.CredentialStore, offline bool) (*config.ModelRegistry, error)
func (*State) OwnerLock ¶
OwnerLock is the lock an Orb process holds while it writes conversation id.
func (*State) PruneEmpty ¶
PruneEmpty drops the empty conversations earlier runs left behind. A minute of grace covers one that another Orb created but has not claimed yet.
func (*State) Read ¶
Read and Write fall back to private files without a database; an absent document reads as os.ErrNotExist, and writing nil deletes it.
func (*State) Release ¶
func (state *State) Release()
Release drops the conversation claim, discarding a conversation left empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package accounts backs the named-credential store with a private JSON file.
|
Package accounts backs the named-credential store with a private JSON file. |
|
Package bridge supplies explicit filesystem and IPC adapters for Orb Bridge.
|
Package bridge supplies explicit filesystem and IPC adapters for Orb Bridge. |
|
daemon
Package daemon is the native Bridge service: the process `orb bridge run` serves, reached over private IPC sockets in the profile directory, its peers over Tailcat and WebSocket, the machine-level calls it answers peers (host.*), and its installation as a systemd user service or on a server over SSH.
|
Package daemon is the native Bridge service: the process `orb bridge run` serves, reached over private IPC sockets in the profile directory, its peers over Tailcat and WebSocket, the machine-level calls it answers peers (host.*), and its installation as a systemd user service or on a server over SSH. |
|
Package sandbox limits filesystem effects of child commands.
|
Package sandbox limits filesystem effects of child commands. |
|
Package selfupdate replaces the running orb with a signed release: it fetches the same archive and checksums.txt that scripts/install.sh does, verifies the signature and sha256, and swaps the binary by atomic rename.
|
Package selfupdate replaces the running orb with a signed release: it fetches the same archive and checksums.txt that scripts/install.sh does, verifies the signature and sha256, and swaps the binary by atomic rename. |
|
Package sqlite supplies explicitly opened native persistence.
|
Package sqlite supplies explicitly opened native persistence. |
|
Package tailcat supplies stream transport only.
|
Package tailcat supplies stream transport only. |
|
Package teamenv is the receiving side of a team agent's entrypoint contract (platforms/agent/harness): credentials on ORB_SECRETS_FD and ORB_AUTH_FD, never in the environment or files the agent's tools could open, and a process its same-user tools cannot inspect.
|
Package teamenv is the receiving side of a team agent's entrypoint contract (platforms/agent/harness): credentials on ORB_SECRETS_FD and ORB_AUTH_FD, never in the environment or files the agent's tools could open, and a process its same-user tools cannot inspect. |