Commit Graph
100 Commits
Author SHA1 Message Date
retoor 34cacf55d2 feat: replace strcpy/strcat with memcpy and add null-termination across multiple source files
Replace unsafe string concatenation patterns using strcpy/strcat with explicit memcpy calls and proper null-termination in bash_repair.c, context_manager.c, context_summarizer.c, and db.c. Add missing null-pointer checks for strdup results in bash_executor.c. Introduce atomic_int for spinner_running flag in http_client.c. Add consecutive_tool_error_iterations field to agent struct and refactor agent heartbeat/token tracking to use messages_get_db instead of db_open. Remove r_config_get_max_tokens declaration from r_config.h. Add json_repair.c to Makefile build sources and include db.h in messages.h with new messages_get_db function declaration.
2026-04-03 08:42:43 +00:00
retoor 9bd9595145 feat: add spawn_tracker header with depth/total limits and validation interface 2026-02-15 18:15:15 +00:00
retoor 83b3eec68b feat: add snapshot database tables, live snapshot recording, and vi/emacs editing mode toggles 2026-02-14 07:07:05 +00:00
retoor 37e7aa4833 feat: add refusal detection and soldier persona to agent system prompt 2026-02-14 04:32:20 +00:00
retoor 28b8f44147 feat: add spawn tracker and deepsearch tool with configurable depth limits
Implement spawn_tracker module to enforce recursive agent spawning limits via R_MAX_SPAWN_DEPTH and R_MAX_TOTAL_SPAWNS environment variables, replacing the previous max_subagents parameter in tool_agent.c. Add tool_deepsearch.c implementing an iterative multi-query research algorithm with configurable system message, and register the new source files in Makefile build targets.
2026-02-10 20:20:19 +00:00
retoor 866647d5ac feat: append content=true parameter to web search API URL in do_web_search function 2026-02-10 03:34:07 +00:00
retoor 6574db64e1 fix: add null check for avatar pointer before dereference in user profile loader 2026-02-10 03:29:48 +00:00
retoor 6b64e96abe chore: update documentation, benchmark tests, and database migration with author birth years and book published years 2026-01-29 07:06:31 +00:00
retoor 5a2a16f0ff feat: add auto_backgrounded field to python and terminal tool responses and final output prefix for completed processes 2026-01-29 06:52:58 +00:00
retoor d0a17cd3c9 feat: replace logging with custom log_all function and truncate benchmark log on start 2026-01-29 06:42:06 +00:00
retoor 608b69e547 feat: replace quicksort with simplified recursive version and fix partition logic 2026-01-29 05:57:52 +00:00
retoor dccd79c05a feat: add markdown module header and async bash execution result structs
Introduce `include/markdown.h` with retoor copyright header and add `r_process_result_t` struct plus `r_bash_execute_ext` / `r_process_result_free` declarations to `include/bash_executor.h` for advanced async process handling.
2026-01-29 05:54:10 +00:00
retoor 8215d7012d feat: add agent subagent support, bash timeout, context manager improvements, and benchmark script
- Add agent_set_is_subagent and agent_set_tool_registry to agent API for subagent support
- Add timeout_seconds parameter to r_bash_execute to prevent hanging processes
- Refactor context_manager truncation logic with dynamic ratio-based truncation and total size calculation
- Add messages_to_json_string helper and r_config_get_max_tokens accessor
- Introduce tool_registry_get_specialized for type-filtered tool registries
- Add completion_phrases and passive_phrases detection to agent completion logic
- Suppress spinner in http_client when stderr is not a TTY
- Add comprehensive agent_benchmark.py with TestCase framework and logging
2026-01-29 05:01:05 +00:00
retoor a72e4116b1 chore: add build directory to gitignore and trim trailing whitespace from bin entry 2026-01-29 01:29:50 +00:00
retoor a985c56650 chore: fix relative include path for r_error.h in string.h header 2026-01-29 01:29:33 +00:00
retoor f8fbafa19a chore: remove trailing whitespace from README.md line 42 2026-01-29 01:27:20 +00:00
retoor dc150f2ea2 chore: remove entire agent, auth, browse, chat, db_utils, and http_curl source trees
This commit deletes the complete implementation of the agent loop, authentication module, web browsing utilities, chat prompt builder, database helper, and HTTP client. All corresponding header files and test harnesses are also removed. The diff shows the deletion of 6 source files and 6 header files totaling over 1000 lines of code, including the agent state machine, API key resolution logic, curl-based HTTP functions, SQLite database initialization and CRUD operations, and the JSON chat prompt construction.
2026-01-29 01:21:11 +00:00
retoor 65630263c1 feat: add parallel thread execution for tool calls and port scanning with configurable concurrency
Implement pthread-based parallel execution in tool_registry_execute to run tool calls concurrently, replacing the previous sequential loop. Add tool_thread_args_t struct and tool_thread_func wrapper for thread-safe execution. Introduce MAX_PARALLEL_PROBES constant and probe_t struct in network_port_scan_execute to enable concurrent socket probing with non-blocking connect patterns, replacing the single-threaded sequential port scan loop.
2026-01-28 23:51:24 +00:00
retoor 20d92682b2 feat: add bash_repair, context_manager, json_repair, python_repair, and r_diff modules with Makefile integration 2026-01-28 23:38:21 +00:00
retoor 216627e777 feat: add context overflow detection and automatic history shrinking in agent loop
Implement context manager integration that detects API errors indicating context length exceeded, then automatically shrinks message history and retries the request. Add new messages API functions (remove_range, get_object, replace_at) and a new R_ERROR_CONTEXT_TOO_LONG error code to support this functionality.
2026-01-28 19:15:02 +00:00
retoor 09e3f62a34 feat: stream agent response incrementally and remove duplicate rendering in main loop 2026-01-28 19:06:18 +00:00
retoor c9a29efc5d chore: update system prompt instructions for tool calls and communication rules 2026-01-28 18:55:47 +00:00
retoor c096e43c96 chore: add ANSI dim/bold escape codes to stderr output in bash executor and tool registry 2026-01-28 18:50:07 +00:00
retoor 88458a81c9 chore: reformat indentation from 4-space to 2-space style in src/main.c 2026-01-28 18:47:14 +00:00
retoor 7f799e8fa5 chore: remove AppRun, compose.yml, collect_so_files.sh and database.db; add include headers and refactor Makefile with src directory structure 2026-01-28 18:34:39 +00:00
retoor 00b4c2a479 chore: add spinner animation and working directory to agent init payload 2025-12-26 09:16:59 +00:00
retoor 9fe393c9e8 chore: remove unused json-c includes and web_search_news function from browse.h 2025-12-26 06:24:13 +00:00
retoor 15e6b86290 feat: replace direct openai_chat calls with agent_chat and add autonomous agent pipeline with iteration control 2025-12-18 00:08:38 +00:00
retoor 09d8a1de30 chore: normalize code style and remove trailing whitespace across multiple source files 2025-09-27 19:20:18 +00:00
retoor aed84c8f00 fix: replace unsafe sprintf with snprintf and fix memory leak in curl_get/curl_post 2025-05-29 18:59:25 +00:00
retoor 9c7e5e7259 feat: make tools parameter optional via R_USE_TOOLS env var check
Add use_tools() helper that reads R_USE_TOOLS environment variable to
conditionally include tools descriptions in chat JSON output, defaulting
to true when unset or unrecognized.
2025-05-29 00:40:09 +00:00
retoor ae8377b0a4 feat: add get_env_string helper and R_SYSTEM_MESSAGE env support, update init prompt with key-stemming instruction 2025-05-24 13:21:13 +00:00
retoor 956d1af1ec feat: add Python code execution tool and RAG side project with Makefile targets 2025-05-14 03:23:36 +00:00
retoor a35080015a fix: replace raw env pointer with strdup to avoid dangling reference in get_prompt_model 2025-05-14 00:43:33 +00:00
retoor a19800f7ae chore: normalize indentation to 2 spaces and reorder includes in browse.h, db_utils.c, main.c, and messages.h 2025-05-05 12:33:08 +00:00
retoor 0ecaab39c2 feat: conditionally add strict parameter to all tool descriptions via get_use_strict() guard 2025-05-05 12:31:35 +00:00
retoor 580e352295 chore: add recursive mkdir and parent dir creation for write_file in tools.h 2025-05-05 12:09:21 +00:00
retoor 2b66f755b7 fix: remove duplicate -lnettle from CFLAGS and add mkdir -p bin before build target 2025-04-12 22:32:34 +00:00
retoor b3921685c3 chore: add publish step after build to copy binary to release directory 2025-04-12 22:29:43 +00:00
retoor 1cbb3afd48 chore: add publish target dependency to build and replace publish script with curl download 2025-04-12 22:21:00 +00:00
retoor 844a5875fb chore: add libtinfo-dev and libgnutls-dev to Dockerfile apt dependencies 2025-04-12 22:16:03 +00:00
retoor 606bc27834 feat: add AppImage build pipeline with desktop integration and dependency bundling
Implement full AppImage packaging support including AppRun entry point, .desktop launcher, icon asset, and recursive shared library collection via collect_so_files.sh. The Makefile build target now generates a portable Linux executable by assembling the directory structure, copying the binary to AppImage/usr/bin/r, running the dependency collector, and invoking appimagetool to produce a self-contained AppImage binary. Also update .gitignore to exclude the AppImage build directory and add shell scripts to the ignore list.
2025-04-08 22:00:21 +00:00
retoor 0f43cd435c docs: add Grok AI model support and run command example to readme 2025-04-08 08:26:32 +00:00
retoor f786943906 docs: add environment setup tips and OpenAI/Grok config examples to README
The diff adds a tip about creating bash files for environment variables and symlinking them for easy access, along with new configuration sections for OpenAI (using gpt-4o-mini) and Grok (using grok-2 with strict mode disabled) API setups in the README documentation.
2025-04-08 08:22:47 +00:00
retoor 7046b3e551 feat: enforce strict mode via R_USE_STRICT env var and truncate oversized tool results and content 2025-04-08 08:17:27 +00:00
retoor e6784bc68c fix: correct glob pattern to match nested directories in build script
The fix changes the glob pattern from a literal dot to a wildcard asterisk when the target directory is ".", enabling recursive matching of files in subdirectories during the build process.
2025-04-07 08:24:38 +00:00
retoor 682b050ed4 fix: replace dot-only target_dir with wildcard for nested directory matching in rglob
The change adds a conditional check in `tool_function_directory_rglob` that converts a target_dir of "." to "*", enabling the recursive glob to match files in nested subdirectories rather than only the current directory's immediate contents.
2025-04-07 08:24:11 +00:00
retoor 3974d391b2 chore: strip trailing whitespace and placeholder license section from README.md 2025-04-03 11:24:37 +00:00
retoor 997fce03b2 docs: add comprehensive project overview, features, prerequisites, and configuration examples to readme 2025-04-03 11:22:50 +00:00
retoor bfb1e2b901 chore: remove trailing whitespace from README.md line 42 and add debug logging for curl requests and JSON parsing failures 2025-04-03 11:18:56 +00:00
retoor ec1e14d947 chore: append 2>&1 redirect to shell commands lacking stderr handling in tools.h 2025-04-03 03:38:30 +00:00
retoor 0e8fdda063 fix: add error handling for memory allocation, database, and OpenAI failures across multiple C modules 2025-04-03 03:26:11 +00:00
retoor a71258a566 feat: add R_BASE_URL env var support with joinpath helper for dynamic API URL construction
Replace hardcoded global API URL variables with getter functions that check the R_BASE_URL environment variable, falling back to the static defaults. Introduce a joinpath utility in utils.h to safely concatenate a base URL with a path segment, handling trailing slashes and leading path slashes. Remove conditional compilation blocks for RD and OLLAMA backends, consolidating all API URL logic into the new get_completions_api_url and get_models_api_url functions. Update all call sites in openai.h to use the new getter functions instead of direct global variable access.
2025-04-03 00:18:41 +00:00
retoor f73f9b3c50 chore: remove placeholder progress message and add tools command with claude backend
- Remove the initial commit placeholder progress message from Makefile
- Add `!tools` command to REPL that prints available tools descriptions
- Include tools.h header and integrate tools_descriptions() function
- Switch default RD backend from DeepInfra/Llama to Anthropic/Claude models
- Update advanced_model and fast_model to claude-3-5-haiku-20241022
- Change completions_api_url to Anthropic API endpoint
- Enable verbose mode by default (is_verbose = true)
- Update README to reflect new Claude/Ollama focus and remove old download links
2025-04-02 13:37:59 +00:00
retoor 5e34d03629 feat: add file version history tracking with db_store_file_version on write
Introduce a new `file_version_history` table to the SQLite schema and implement the `db_store_file_version` function that reads a file's current content and inserts a version record before overwriting it. The `tool_function_write_file` now calls this backup function prior to opening the file for writing, ensuring every write operation creates a recoverable snapshot.
2025-03-30 12:34:25 +00:00
retoor 62142a4946 chore: delete unused script.sh shell file from repository root 2025-03-30 00:48:51 +00:00
retoor 35f2f150b5 chore: remove empty placeholder commit and delete unused inplace_url.h header 2025-03-30 00:48:35 +00:00
retoor 120fe71ecd chore: remove cgi-bin gpt scripts, malloc wrappers, and dead repl help/debug commands 2025-03-30 00:47:00 +00:00
retoor d3bfa84254 feat: add MinGW cross-compilation target and Docker support for build environment
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.
2025-03-30 00:09:06 +00:00
retoor f7561f291d feat: extend supported file extensions list and add cross-platform path handling in utils 2025-03-29 23:13:42 +00:00
retoor 605f396464 fix: correct typo in indexer.h header guard macro name and remove unused prompt_max_tokens 2025-03-28 22:22:57 +00:00
retoor bcdd0cbb86 feat: add mkdir directory creation function to vibe tool with tool description registration 2025-03-28 22:11:55 +00:00
retoor addf84662a feat: uncomment additionalProperties false in three tool description functions for strict schema validation 2025-03-28 22:03:34 +00:00
retoor c740d9ce54 chore: switch default build target to run_free and update model configs 2025-03-28 22:00:17 +00:00
retoor 47aa1693ea chore: add rd build target and deepinfra api config with custom malloc tracking 2025-03-28 20:38:50 +00:00
retoor 7befee245d feat: add Ollama support with conditional compilation and new build 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.
2025-03-28 19:50:10 +00:00
retoor fec259097a chore: normalize indentation to 2 spaces and reorder includes in auth.h, browse.c, chat.h, db_utils.c, db_utils.h, http_curl.h 2025-03-28 05:56:36 +00:00
retoor 599a268e65 refactor: replace hardcoded prompt_temperature and db_file with PROMPT_TEMPERATURE and DB_FILE macros defined in r.h 2025-03-28 05:55:22 +00:00
retoor 7dfd1c0b44 fix: prevent infinite recursion in web_search and add upsert logic to db_set with new db_execute function 2025-03-28 04:37:22 +00:00
retoor 0b54f87e3a docs: add multi-language keyword support and expand code buffer in markdown parser 2025-03-28 02:10:54 +00:00
retoor e903226953 fix: handle triple backtick code blocks in markdown-to-ansi parser and add rpylib.so to gitignore 2025-03-28 02:02:24 +00:00
retoor 3d4b57d8ae fix: comment out max_tokens field and add missing includes across multiple headers 2025-03-28 01:41:15 +00:00
retoor 8dc66bbfaa feat: add web_search function and dynamic model switching with !dump/!model/!debug commands 2025-03-28 00:55:04 +00:00
retoor 9348e4ebea chore: add sqlite3 link, increase prompt tokens, expand history path, and refine tool descriptions 2025-03-27 22:08:00 +00:00
retoor 7cd02d81f5 fix: guard against null avatar URL in user profile loader before dereference 2025-03-22 02:16:14 +00:00
retoor eccb17d766 chore: add sqlite3 link flag, verbose mode, and new browse/db_utils modules to build system 2025-03-22 02:15:49 +00:00
retoor 0689101e72 feat: add real-time stdout printing during terminal command execution in tools.h
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.
2025-03-21 08:19:41 +00:00
retoor aa0467475d chore: clear terminal on first SIGINT before printing exit prompt in main.c
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.
2025-03-21 02:27:11 +00:00
retoor 4e05fe540d feat: add glob-based file path autocompletion to readline input handler
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.
2025-03-21 02:22:19 +00:00
retoor 50419881dd feat: add double-sigint exit, --free flag, model command, and index_source_directory tool
- 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
2025-03-21 00:15:40 +00:00
retoor 075e4efc4f fix: replace message_add_tool_call with message_add_object in openai_chat function 2025-03-20 16:00:13 +00:00
retoor eb99686ce9 feat: add message_add_object helper and integrate into openai_chat flow
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.
2025-03-20 15:38:10 +00:00
retoor 1bc92e5834 feat: add prompt and system methods to rpylib.c and remove free build from Makefile
- 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
2025-03-20 03:13:26 +00:00
retoor 4fed366425 chore: refactor Makefile with CC/CFLAGS variables and reorder build targets 2025-03-20 01:57:47 +00:00
retoor 1a77a5b692 fix: add dump command to repl and remove deprecated hello function from rpylib 2025-03-20 01:36:56 +00:00
retoor 0a18669f40 feat: add auth_init function and remove version-specific startup messages
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.
2025-03-19 21:02:39 +00:00
retoor 91553e1979 feat: replace compile-time free tier flag with runtime auth_type enum for model selection
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.
2025-03-19 20:45:07 +00:00
retoor 6b08d3334c fix: return empty string instead of null on glob failure in directory glob
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.
2025-03-19 20:25:34 +00:00
retoor 6d84cbef32 fix: correct integer overflow in rpylib.c buffer size calculation for large inputs 2025-03-19 17:05:42 +00:00
retoor af7969a183 feat: add messages_remove function to delete all chat messages by repeatedly removing last entry 2025-03-19 17:04:32 +00:00
retoor a0feb4b985 fix: remove stderr warning and hardcode fallback api key in resolve_api_key
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.
2025-03-16 22:35:35 +00:00
retoor 6e3e899832 chore: remove FREE_VERSION conditional and add --py flag for python file inclusion 2025-03-16 21:46:09 +00:00
retoor 8b25cb93d4 chore: add static qualifiers to global variables and const-correctness to tool result parameters 2025-03-16 06:36:13 +00:00
retoor 3aa4f0d02e chore: remove trailing whitespace from line.h and delete unused http.h module 2025-03-05 23:10:15 +00:00
retoor 8d1968ce97 fix: add null checks for openai responses and implement interactive terminal tool with home directory expansion 2025-03-05 22:53:35 +00:00
retoor 8a13f1a59c chore: replace placeholder branding with final logo and color scheme 2025-03-03 16:06:05 +00:00
retoor d819021fdb chore: add directory_rglob tool declaration and registration to tools.h 2025-03-03 13:51:13 +00:00
retoor be5e2e4c05 fix: clarify directory_glob tool description to specify glob format output 2025-03-03 13:09:28 +00:00
retoor c247e3b1bb fix: remove debug print statements from chat_json and tools_descriptions functions 2025-03-03 12:57:16 +00:00
retoor d626f1e8e5 chore: strip license boilerplate and commented dead code from openai.h header 2025-03-03 12:53:24 +00:00