struct

Arcana::AgentConfig

Inherits Struct < Value < Object

Who a project's agent is on the bus, read from the project's .ai/config.yml (the dot-ai convention, draft 0.3):

handle: arcana
description: >
  The agent for the Arcana bus itself.

The handle may be written with or without its @. Configs from before draft 0.3 kept both keys under arcana:; those are still read when the top-level keys are missing. Without a handle anywhere, the handle falls back to @ plus the project directory's name.

A session's project is the nearest directory at or above where it works that holds .ai/ (find, project_root); only where there is none is the session's own directory the project.

The owner token proves to the bus that a registration is this project's (see Directory#claim). It lives in .ai/arcana.token, kept out of git through the repository's info/exclude since it only means something to this machine's bus. A project without .ai/ keeps it under $XDG_STATE_HOME/arcana/tokens/ instead.

The project's key (see Arcana::Key) proves the same, without the bus ever holding the secret: .ai/arcana.key, kept out of git the same way, or $XDG_STATE_HOME/arcana/keys/ without .ai/. One key holds all the project's addresses.

Constants

CONFIG_FILES = {"config.yml", "config.yaml"}
KEY_FILE = "arcana.key"
TOKEN_FILE = "arcana.token"

Constructors

find(dir : String) : AgentConfig

load for the project a session in dir works in (project_root).

Source
load(project_dir : String) : AgentConfig

Raises AgentConfig::Error when the config exists but can't be read, rather than quietly falling back to the directory name.

Source
new(project_dir : String, handle : String, description : String = "")
Source

Class methods

config_path(project_dir : String) : String | Nil
Source
fallback_handle(project_dir : String) : String

@ plus the directory name, folded into a legal handle.

Source
project_root(dir : String) : String

The project a session in dir works in (dot-ai, "Projects inside projects"): the nearest directory at or above it that holds .ai/, since a directory without one belongs to the project above it. Walks the path with symbolic links resolved, as dot-ai does, so both find the same project. With no .ai/ anywhere above, dir itself, whose handle is then the fallback.

.ai may be a symbolic link to another project's .ai/: a folder grouping several repositories under one project links to the .ai/ of the repository that holds it, and a session in any of them finds that project through the link.

Source

Instance methods

ai_dir?
Source
description
Source
handle
Source
key

The project's key, or nil if none has been made yet.

Source
key!

The project's key, made on first use. Each call also checks that git ignores it, which a key made by an older hook may lack.

Source
key_path
Source
owner_token

The owner token, or nil if none has been made yet.

Source
owner_token!

The owner token, made on first use. Each call also checks that git ignores it, as key! does.

Source
project_dir
Source
token_path
Source

Nested types