Add build_mingw target using x86_64-w64-mingw32-gcc cross-compiler with
dedicated MinGW flags and publish step. Introduce Dockerfile with Ubuntu
base image installing all required build dependencies (gcc, make, readline,
ncurses, curl, openssl, json-c, sqlite3, python3-dev). Add compose.yml for
convenient Docker-based development shell with mounted working directory.
Extend Makefile with docker, docker_make, docker_run, run_mingw targets and
suppress error output on publish commands for build and build_free targets.
Introduce conditional compilation via OLLAMA preprocessor flag to switch between OpenAI and Ollama API endpoints, model names, and URLs. Add `build_free` and `run_free` Makefile targets for the Ollama variant. Enhance REPL with `!models` command to list available models, improve error handling in `openai_process_chat_message`, and fix history line addition logic.
The change inserts a `printf("%s", output)` call inside the `tool_function_linux_terminal` function, immediately after reallocating the output buffer and before appending new data. This enables real-time display of captured process output to the console as chunks are received, rather than only returning the final aggregated string. The modification affects the core execution loop in `tools.h` where command output is accumulated from the process stream.
Add explicit system("clear") call and newline in handle_sigint to visually reset the terminal display before showing the double-Ctrl+C exit message, ensuring clean output regardless of prior screen state.
Add file path completion support alongside existing command completion in the readline-based input system. Include <glob.h> header and implement line_file_generator function that uses glob pattern matching to suggest file paths based on partial input. Modify line_command_completion to detect file path context (non-command input after start position) and delegate to the new file generator, enabling tab-completion of filenames and directories in the shell-like interface.
- Add SIGINT handler that exits on two Ctrl+C presses within 1 second
- Introduce --free flag to switch auth type to AUTH_TYPE_FREE via auth_free()
- Implement "model" REPL command to print current prompt model name
- Register index_source_directory tool description and function in tools.h
Add a new `message_add_object` function in messages.h that appends a json_object to the global message list. Modify openai_chat in openai.h to call this function after processing a chat completion, ensuring the assistant's response object is stored. Also comment out the previous `message_add_tool_call` call to avoid duplicate message storage when tool calls are present, and add a missing `continue` in main.c's repl loop after the dump command to prevent fallthrough.
- Added rpylib_prompt and rpylib_system functions to rpylib.c for user and system role OpenAI chat
- Removed build_free target from Makefile and added publish step for rpylib.so build
Implement auth_init() in auth.h to detect API keys from environment variables (R_KEY or OPENAI_API_KEY) and set auth_type accordingly. In main.c, call auth_init() during init() and replace the conditional commercial/free version startup messages with a simple carriage return clear.
Add AUTH_TYPE enum and global auth_type variable to auth.h, replacing the FREE_VERSION preprocessor conditional in chat.h with a dynamic get_prompt_model() function that returns "gpt-3.5-turbo" for free users and "gpt-4o-mini" for API key holders. Update all references to prompt_model to use the new function, enabling runtime model switching without recompilation.
The tool_function_directory_glob function previously returned NULL when the glob
pattern failed to match, causing a null pointer dereference in the user profile
avatar loader when it attempted to process the result. Changed the return value
to an empty string to ensure callers always receive a valid pointer.
The diff removes a diagnostic fprintf to stderr that warned about a missing
environment variable, and replaces the null return path with a hardcoded
fallback API key string in auth.h's resolve_api_key function.
The error return paths in tool_function_bash were returning string literals instead of heap-allocated copies via strdup, causing potential null pointer dereference when callers attempt to free the returned pointer. This fix ensures both "Popen failed!" and "Failed to allocate memory!" error messages are properly duplicated on the heap before being returned.
Implement a new `tool_function_bash` that executes shell commands via `popen` and captures their output into a dynamically allocated buffer. Register the corresponding `tool_description_bash` JSON schema and include it in the `tools_descriptions` array alongside the existing HTTP GET tool. Also change the history file path from `~/.calpaca_history` to `.r_history` and remove the redundant `read_history` call before adding new history entries.
Implement tool calling infrastructure including tools.h with http_fetch function description and execution, message_add_tool_call and message_add_tool_result helpers in messages.h, tool descriptions injection into user messages and chat_json, http header parsing utilities in http.h, curl_get function in http_curl.h, and tool call execution loop in openai_chat that recursively processes tool results.