Skip to main content

Module setting_key

Module setting_key 

Source
Expand description

A key a setting names as vault:<entry id> instead of holding it: srv’s own reader of a service key (voice input’s Groq key, and the other settings keys the same way when they move). The value is read inside srv at the moment of the call, goes into one outgoing request, and is never written to settings.json, a log or the renderer. The spelling is the one endpoint_key resolves for an agent’s launch environment.

The grant lives on the entry, not in the settings file. settings.json only names an entry; what lets a setting read it is a grant kept in the Vault (setting:<key> in db_vault_grants, bound to the entry it was given to), made by the Settings picker (the person’s choice) or by AgentMux’s own move of a plain key. So a file edit that points a setting at another entry reads nothing: the entry has no grant for it. The person sees it under the entry in the Vault and can take it back there. One entry per setting: allowing an entry takes the setting’s grant off every other entry, each removal recorded, so the file alone can never point the setting back at an entry chosen before. A read records the use, once every few minutes per entry, not once per call.

Constants§

AGENTMUX
Who is named in the Activity for what AgentMux does on its own, as opposed to the person.
ALLOWED
The activity line for the grant.
GRANT_PREFIX
What a grant on an entry starts with when it lets a setting read the entry: setting:<settings key>.
NOT_AVAILABLE
The one answer for a missing entry, an entry of another kind, an entry the setting was not allowed to read and a Vault that could not be opened, so a setting’s error never says which entries exist; the reason is in srv’s log.
PREFIX
What a setting’s value starts with when it names a Vault entry.
SETTINGS
The settings that may name a Vault entry. A grant for any other name is refused.
USED
The activity line for a use, listed with the other uses of a value.
WITHDRAWN
The activity line for a grant taken off an entry because another entry was allowed for the setting.

Functions§

allow
Lets setting read entry id, recorded under who: the person’s choice in Settings, or AgentMux’s own move of a key that sat in the file. Only an api-key entry, and only for a setting that is on the list. One entry per setting: the setting’s grant comes off every other entry, each removal recorded under who.
entry_of
The entry id a setting value names, when it is a vault:<id> reference.
grant_for
The grant that lets setting read an entry.
keep
Keeps value as a new api-key entry labelled label in the Personal Vault and returns its id.
move_setting
Moves a key that sits in settings.json as plain text into the Vault: keeps it as an api-key entry labelled label, then has write replace the setting with its vault:<id> reference and set <setting>Moved (so Settings can say so once). current is the setting’s value as the file has it. Returns the new entry’s id, or None when there was nothing to move (unset, blank, or already a reference). Whether it already ran is read from the value alone, never from a marker. When write fails the new entry is deleted again and the plain key stays where it was, so a later start tries again and nothing is kept twice.
present
Whether the Vault has an api-key entry with this id that setting may read. Opens nothing.
read
The entry’s value for setting, recorded as a use by who for what ("voice input"). Only an entry that setting was allowed to read: the setting file’s word alone is not enough.
reference
The setting value that names entry id.
setting_of_grant
The setting a grant on an entry is for, when it is one.