Skip to main content

Module paths

Module paths 

Source
Expand description

§paths

Path utilities for gglib data directories and user-configurable locations.

This module provides the canonical path resolution for all gglib components:

  • Database location
  • Models directory
  • Llama.cpp binaries
  • Application data and resource roots

§Design

  • Returns PathBuf and PathError for clear error handling
  • No interactive/terminal I/O - adapters handle user prompts separately
  • OS-specific logic is kept private in platform

Modules

Modules§

config 🔒
Configuration file utilities.
database 🔒
Database path resolution.
ensure 🔒
Directory creation and verification utilities.
error 🔒
Path-related error types.
llama 🔒
Llama.cpp binary path resolution.
models 🔒
Models directory resolution, and the canonical form of a model file path.
pids 🔒
PID file directory path resolution.
platform 🔒
Platform-specific path detection and resolution.
private 🔒
Directories and files that nobody else on this machine can read.
remote 🔒
Where the remote tunnel’s stored endpoint key lives.
resolver 🔒
Pure path resolver for testing and CLI introspection.
slots 🔒
Slot cache path helpers.

Structs§

ModelsDirResolution
Resolution result for the models directory.
ResolvedPaths
All resolved paths captured in a single struct.

Enums§

DirectoryCreationStrategy
Strategy for how to handle missing directories when ensuring they exist.
ModelsDirSource
How the models directory was derived.
PathError
Errors that can occur during path resolution and directory operations.

Constants§

DEFAULT_MODELS_DIR_RELATIVE
Default relative location for downloaded models on non-Windows platforms.

Functions§

canonical_model_path
Resolve path to the one form the library identifies a model file by.
canonical_model_path_string
The canonical path as the string the file_path column stores.
create_private_dir
Create dir and any parents it lacks 0700, and take group and other’s access away from a dir that was already there.
create_private_file
Create file empty and 0600, or take group and other’s access away from one that is already there.
data_root
Get the root directory for application data (database, config).
database_path
Get the path to the gglib database file.
default_models_dir
Return the platform-specific default models directory.
ensure_directory
Ensure the provided directory exists and is writable according to the chosen strategy.
gglib_data_dir
Get the gglib data directory containing llama binaries.
is_prebuilt_binary
Check if we are running from a pre-built binary (not from the source repo).
llama_bench_path
Get the path to the managed llama-bench binary.
llama_config_path
Get the path to the llama build configuration file.
llama_cpp_dir
Get the path to the llama.cpp repository directory.
llama_server_path
Get the path to the managed llama-server binary.
make_private
Take group and other’s access away from whatever is at path; the owner keeps what it had.
persist_models_dir
Persist the selected models directory into .env.
pids_dir
Returns the directory where PID files are stored.
remote_identity_path
Path to the stored iroh endpoint key for the remote tunnel.
resolve_models_dir
Resolve the models directory from an explicit override, env var, or default.
resource_root
Get the root directory for application resources (binaries, static assets).
slot_bin_path
Full on-disk path for a model+session slot cache file (flat under slot_dir).
slot_file_name
Filename for a model+session slot cache file: {model_id}__{session_id}.bin.
slot_model_prefix
Filename prefix identifying all of one model’s slot files: {model_id}__.
slot_session_from_stem
Recover the session id from a slot file stem ({model_id}__{session}).
slot_tmp_file_name
Filename for an in-flight save: {model_id}__{session_id}.{nonce}.tmp.