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 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
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 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.