Expand description
Registry of attached databases for cross-database queries.
The primary workspace opened by crate::engine::Engine is always
addressable under the reserved alias "local". Callers can attach
additional .hyper files under user-chosen aliases via
AttachRegistry::attach; the registry tracks every live attachment
so it can be replayed after an crate::error::ErrorCode::ConnectionLost
auto-reconnect rebuilds the underlying Hyper connection.
§Future kinds
AttachSource is a tagged enum so future remote kinds (TCP to a
standard hyperd, gRPC to a Data 360 Hyper) plug in without breaking
the registry API or the MCP tool schemas. Only AttachSource::LocalFile
is implemented today; the MCP tool layer rejects other kind values
with a clear “not yet supported” message.
§Safety model
- Path policy.
LocalFilepaths must be absolute and canonicalized (..components rejected) so the LLM cannot traverse outside the filesystem root via relative tricks. - Alias policy. Aliases are validated as strict SQL identifiers
(
[A-Za-z_][A-Za-z0-9_]{0,62}) and cannot collide with"local". - Read-only posture. Attachments default to read-only. Writable
mode is opt-in and is still subject to the server-level
--read-onlyguard —--read-onlyalways wins.
Structs§
- Attach
Registry - Live set of attachments keyed by alias. Thread-safe via an internal
Mutex; all operations are serial, which matches the rest of the engine’s single-connection model. - Attach
Request - Request shape for
AttachRegistry::attach. Pre-validated by the MCP tool layer; the registry re-validates defensively because it is also the entry point for replay. - Attached
Db - One live attachment. Constructed by
AttachRegistry::attachand returned unchanged until the alias is detached.
Enums§
- Attach
Source - Where an attached database lives. Kind-tagged so future remote variants (TCP, gRPC) can slot in without breaking the registry API or MCP tool schemas.
- OnMissing
- Policy for what
AttachRegistry::attachshould do when the requestedLocalFilepath does not exist. Applies only to thelocal_filekind today; remote kinds (tcp,grpc) will ignore it.
Constants§
- LOCAL_
ALIAS - Alias reserved for the server’s primary workspace. Users cannot
attach under this name;
copy_querytreatstarget_database: "local"the same as the unqualified default.
Functions§
- validate_
alias - Validate a user-supplied alias. Must match
[A-Za-z_][A-Za-z0-9_]{0,62}and must not equalLOCAL_ALIAS. The 63-char cap matches thePostgreSQLidentifier limit Hyper inherits. - validate_
input_ path - Validate a user-supplied file path that must already exist.
- validate_
local_ path - Validate a
LocalFilepath. Must be absolute, must exist, must canonicalize cleanly with no..components in the result. Returns the canonical path on success. - validate_
local_ path_ for_ create - Validate a
LocalFilepath for the create-if-missing code path. - validate_
output_ path - Validate a user-supplied output path that may not yet exist.