Libraries (agent)
Human page: ../user/libraries.md.
Do not invent CMake that names or registers packages. Compile the .c++ file. The host calls add_library.
End-user scripts import each other with no host call: import helpers loads helpers + the language extension beside the importer, then ., imports.search_directories, add_search_path. Same language only. Not raw C++.
JSON (imports.*) is syntax only: keywords, module_separator, bind_as, optional search_directories, optional plugin_entry (default rescripted_register).
void add_library(std::string import_name, Library lib);
void add_library(std::string import_name, std::map<std::string, HostFn> members);
void add_library(std::string import_name, std::map<std::string, Value> members);
void add_library(std::string import_name, std::string source, std::string_view language_name);
void add_library(std::string import_name, std::string path); // script, .h/.cpp, or plugin
void add_library_file(std::string import_name, std::string script_path);
void remove_library(std::string_view import_name);
bool has_library(std::string_view import_name) const;
void set_plugin_entry(std::string name);
void load_plugin(const std::string& path);
void load_plugin(const std::string& path, std::string entry_name);
RESCRIPTED_LIBRARY(math) { lib.bind("twice", fn); } → rescripted::library::math.
Other TUs: RESCRIPTED_LIBRARY_DECLARE(math); then engine.add_library("math", rescripted::library::math);
add_library(name, path): .so/.dylib/.dll → load_plugin; .h/.cpp/… → best-effort extern "C" prototypes resolved in-process; anything else → script file.
Plugins export extern "C" void rescripted_register(Engine&) (name overridable) and usually add_library themselves.
Do not generate bind_module, add_module, or install_standard_libraries.