-
Notifications
You must be signed in to change notification settings - Fork 53
Eldritch v2 #1289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eldritch v2 #1289
Conversation
|
Please test with windows service |
- Added `install` feature to `implants/imixv2/Cargo.toml`. - Created `implants/imixv2/src/install.rs` with `install` function to execute embedded `main.eldritch` scripts. - Updated `implants/imixv2/src/main.rs` to parse arguments and trigger installation when the feature is enabled. - Added tests for the install command. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]>
Renamed the `fetch_tasks` helper method in `ImixAgent` to `claim_tasks` to better reflect the underlying `ClaimTasks` API call it wraps. Updated the call site in the main run loop. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]>
) This change fixes a concurrency issue where imix tasks using the agent's transport would hang indefinitely upon completion. - Implemented `Drop` for `eldritch_core::Interpreter` to explicitly clear the environment values and parent reference. This breaks the reference cycles (e.g., Environment -> Value -> Function -> Environment) that prevented the underlying transport resources from being cleaned up. - Introduced `is_scope_owner` flag to `Interpreter` to distinguish between the root interpreter (which should cleanup the environment) and temporary interpreters used for `eval()` (which share the environment and should not clear it). - Updated `imixv2` tests to align with recent API changes in `claim_tasks`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]>
Refactored `get_callback_interval_u64` in `ImixAgent` to return a `Result` instead of silently failing and returning a default value. Updated call sites to handle the error properly, preventing tight loops on failure by introducing a fallback sleep. Added unit tests to verify behavior. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]>
This commit addresses issue #1293 where `list.remove(NaN)` and `list.index(NaN)` would fail because `NaN != NaN`. It introduces a `values_equal` helper in `eldritch-core` that treats `NaN` as equal to `NaN` specifically for container search operations (remove, index, contains), aligning behavior with expectations for element removal and containment checks. Regression tests have been added to `tests/collections.rs`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]>
Removed the `agent.sleep` method from the Eldritch Agent library. This method is no longer needed and its removal simplifies the agent interface. * Removed `sleep` from `AgentLibrary` trait in `implants/lib/eldritchv2/stdlib/eldritch-libagent/src/lib.rs` * Removed `sleep` implementation from `StdAgentLibrary` in `implants/lib/eldritchv2/stdlib/eldritch-libagent/src/std.rs` * Removed `sleep` implementation from `AgentLibraryFake` in `implants/lib/eldritchv2/stdlib/eldritch-libagent/src/fake.rs` Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
hulto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs reviewed
hulto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it through run.rs
docs/_docs/user-guide/eldritchv2.md
Outdated
|
|
||
| * **`bytes(source)`: Creates a bytes object.`** | ||
|
|
||
| If source is an integer, the array will have that size and will be initialized with null bytes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More specific on that size i32?
Is float allowed?
implants/lib/eldritchv2/eldritch-core/src/interpreter/builtins/eprint.rs
Show resolved
Hide resolved
|
Finished going through thev1 docs and making sure everything works as expected current blockers:
Follow-ups: |
The `agent_callback_uri` tome was calling `agent.set_active_callback_uri`, which is not a valid method on the `AgentLibrary`. This caused the `tests::test_all_tomes` test to fail. This commit updates the tome to use the correct method name `set_callback_uri`, and also corrects the user documentation which referenced the incorrect name. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]>
…#1366) Moved all `*_impl.rs` files and `std.rs` into a new `src/std/` directory to organize the standard library implementations better. `std.rs` was renamed to `std/mod.rs` and now exposes the submodules. `lib.rs` was updated to export the `std` module. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]>
In progress Fixed ✅
Done ✅ Deleted new docs, added new methods to existing docs ✅ Only remaining discrepancies are dict methods, in progress could not reproduce, I think this was fixed a while ago ✅ |
Implemented `clear`, `pop`, and `setdefault` for `dict` type in `eldritch-core`. Updated `get_native_methods` to include these new methods. Verified with tests. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]>
|
Jules identified another crash case: a = []
b = []
a.append(b)
b.append(a)
print("Comparing...")
x = (a == b)
print(x)Fix available, but seeing if we can get no_std support: #1367 |
* Fix recursion crash in PartialEq/Ord for Eldritch V2 Added thread-local cycle detection to `Value::PartialEq` and `Value::Ord` implementations in `eldritch-core`. This prevents stack overflow (and resulting process crashes/hangs) when comparing recursive data structures, such as lists or dictionaries that contain themselves. The fix uses a thread-local `BTreeSet` to track visited pointer pairs during comparison. If a pair is revisited, we assume equality (for `PartialEq`) or `Ordering::Equal` (for `Ord`) to break the recursion cycle. This logic is gated behind the `std` feature flag, as `thread_local!` requires std. This addresses the issue where the Imixv2 REPL would hang/crash when executing code that created recursive structures (e.g., `a.append(a)` loop). Testing: - Added temporary reproduction test `repro_recursion.rs` which confirmed stack overflow on recursive comparison. - Verified fix prevents stack overflow in the same test case. - Ran existing `eldritch-core` test suite to ensure no regressions. * Fix recursion crash in PartialEq/Ord for Eldritch V2 Added thread-local cycle detection to `Value::PartialEq` and `Value::Ord` implementations in `eldritch-core`. This prevents stack overflow (and resulting process crashes/hangs) when comparing recursive data structures, such as lists or dictionaries that contain themselves. The fix uses a thread-local `BTreeSet` to track visited pointer pairs during comparison. If a pair is revisited, we assume equality (for `PartialEq`) or `Ordering::Equal` (for `Ord`) to break the recursion cycle. This logic is gated behind the `std` feature flag, as `thread_local!` requires std. This addresses the issue where the Imixv2 REPL would hang/crash when executing code that created recursive structures (e.g., `a.append(a)` loop). Testing: - Added temporary reproduction test `repro_recursion.rs` which confirmed stack overflow on recursive comparison. - Verified fix prevents stack overflow in the same test case. - Ran existing `eldritch-core` test suite to ensure no regressions. * Refactor recursion fix to support no_std Updated `Value::PartialEq` and `Value::Ord` implementations to use recursive helper methods (`eq_helper`, `cmp_helper`) that manually pass the `visited` set down the recursion stack. This removes the dependency on `thread_local!`, making the fix compatible with `no_std` environments where thread-local storage is not available. The solution now explicitly implements container traversal (List, Dictionary, Set, Tuple) in the helpers to ensure the `visited` context is preserved during deep comparisons. This maintains the cycle detection logic while adhering to `no_std` constraints. Verified with existing tests and `regression_recursion.rs`. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit adds a new migration test script `v1_compat.eld` to `implants/lib/eldritchv2/stdlib/migration/tests/scripts/`. The script verifies compatibility between Eldritch V1 and V2 for built-in types and their methods, including strings, lists, dictionaries, etc. It currently highlights missing `clear()` methods on list and dict in V2. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
Added migration test to ensure all fixes applied for #1337 |
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
HTTP fixes merged |
hulto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Corrected the expected byte arrays in `test_write_reg_int` to match the actual behavior of `write_reg_int` and `winreg`. - `REG_NONE` and other 32-bit types now expect `u32` byte arrays (4 bytes). - `REG_QWORD` now expects a `u64` byte array (8 bytes). This resolves test failures where 4-byte registry values were being compared against 8-byte expectations and vice-versa. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
…enabling stdlib feature (#1377) Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
* shhh * fixing dependency issues * remove biased terminology * Explicitly set musl target (#1292) * Improve Eldritch error messages (#1301) * Fix infinite recursion when printing self-referential structures in Eldritch V2 (#1298) * Remove unused `lazy_static` dependency (#1302) * Remove unused `EldritchFunction` trait and `impl_eldritch_fn!` macro (#1304) * Dynamic error location formatting in eldritch-core (#1303) * Implement install command for imixv2 (#1309) - Added `install` feature to `implants/imixv2/Cargo.toml`. - Created `implants/imixv2/src/install.rs` with `install` function to execute embedded `main.eldritch` scripts. - Updated `implants/imixv2/src/main.rs` to parse arguments and trigger installation when the feature is enabled. - Added tests for the install command. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * Rename `fetch_tasks` to `claim_tasks` in imixv2 agent (#1308) Renamed the `fetch_tasks` helper method in `ImixAgent` to `claim_tasks` to better reflect the underlying `ClaimTasks` API call it wraps. Updated the call site in the main run loop. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * build reflective loader on libsys build * fix warnings * Fix imix task execution hang by implementing Drop for Interpreter (#1310) This change fixes a concurrency issue where imix tasks using the agent's transport would hang indefinitely upon completion. - Implemented `Drop` for `eldritch_core::Interpreter` to explicitly clear the environment values and parent reference. This breaks the reference cycles (e.g., Environment -> Value -> Function -> Environment) that prevented the underlying transport resources from being cleaned up. - Introduced `is_scope_owner` flag to `Interpreter` to distinguish between the root interpreter (which should cleanup the environment) and temporary interpreters used for `eval()` (which share the environment and should not clear it). - Updated `imixv2` tests to align with recent API changes in `claim_tasks`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * Refactor get_callback_interval to return Result (#1307) Refactored `get_callback_interval_u64` in `ImixAgent` to return a `Result` instead of silently failing and returning a default value. Updated call sites to handle the error properly, preventing tight loops on failure by introducing a fallback sleep. Added unit tests to verify behavior. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * Fix: Handle NaN in list.remove/index and 'in' operator (#1300) This commit addresses issue #1293 where `list.remove(NaN)` and `list.index(NaN)` would fail because `NaN != NaN`. It introduces a `values_equal` helper in `eldritch-core` that treats `NaN` as equal to `NaN` specifically for container search operations (remove, index, contains), aligning behavior with expectations for element removal and containment checks. Regression tests have been added to `tests/collections.rs`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * fix libassets dep for tests * Remove agent.sleep method (#1311) Removed the `agent.sleep` method from the Eldritch Agent library. This method is no longer needed and its removal simplifies the agent interface. * Removed `sleep` from `AgentLibrary` trait in `implants/lib/eldritchv2/stdlib/eldritch-libagent/src/lib.rs` * Removed `sleep` implementation from `StdAgentLibrary` in `implants/lib/eldritchv2/stdlib/eldritch-libagent/src/std.rs` * Removed `sleep` implementation from `AgentLibraryFake` in `implants/lib/eldritchv2/stdlib/eldritch-libagent/src/fake.rs` Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * cargo fmt * begin refactor * Refactor Agent trait into dedicated eldritch-agent crate (#1327) - Created `eldritch-agent` crate to house the `Agent` trait, decoupling it from `eldritch-libagent`. - Updated `eldritch-libagent` to re-export `Agent` from `eldritch-agent`. - Updated `eldritch-libpivot`, `eldritch-libreport`, `eldritch-libassets`, and `imixv2` to depend on `eldritch-agent` directly. - Removed dependency on `eldritch-libagent` from `eldritch-libassets`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Update eldritch-macros to enforce argument validation for library functions. (#1335) * feat(eldritch-libfile): update file.list modified time format (#1336) * exec input param to sys.exec (#1333) * exec input param to sys.exec * Add docs and cargo fmt * Cargo fmt another file --------- Co-authored-by: KCarretto <[email protected]> * feat: add string subscripting and ensure builtin string methods (#1338) Updated eldritch-core to allow strings to be subscriptable (e.g. s[0], s[1:]). Verified that all requested builtin string methods are implemented and visible via dir(""). Updated tests to reflect these changes. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Addressed comments, fix tests * cargo fmt * Update string.split() to handle whitespace when no args are passed (#1341) Updated the implementation of the `split` method for String values in `eldritch-core`. When `split()` is called without arguments, it now utilizes `split_whitespace()` to split by any whitespace characters (spaces, tabs, newlines) and treat consecutive whitespace as a single separator. This aligns the behavior with Python's `str.split()` and addresses the user request. Behavior when a specific delimiter is provided remains unchanged. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Fix TestNewShellHandler to use raw byte streams (#1346) Updated the websocket test to expect raw byte messages instead of JSON envelopes with base64 encoded data, aligning the test with the current implementation of the websocket handler. This resolves test failures where the test expected `{"type":"data",...}` but received raw text. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Fix mismatched type error in eldritch-libfile without unwrap (#1347) Replaced unsafe `.unwrap()` conversion with a direct cast to `nix::libc::suseconds_t` to resolve type mismatch errors in `TimeVal::new` call. This ensures compatibility across platforms where `suseconds_t` definitions vary. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Add support for raw strings in eldritch-core (#1345) This commit enables raw string literals (prefixed with `r` or `R`) in Eldritch, aligning with Python's behavior. In raw strings, backslashes are treated as literal characters, except when they escape the quote character. Details: - Updated `lexer.rs` to recognize `r` and `R` prefixes. - Updated `Lexer::string` method to handle `is_raw` flag. - Implemented logic to preserve backslashes in raw strings while still allowing quotes to be escaped (and keeping the escaping backslash). - Added `tests/lexer_raw_strings.rs` to verify behavior. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Implement chr and ord builtins in eldritch-core (#1344) - Added `chr(i)` to convert integer code points to characters. - Added `ord(c)` to convert characters or single-byte bytes to integer code points. - Registered new builtins in `interpreter/builtins/mod.rs`. - Added comprehensive unit tests in `tests/builtins_chr_ord.rs`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * Refactor call_bound_method to use dispatch pattern (#1343) Refactored the monolithic `call_bound_method` in `eldritch-core` to use a dispatch pattern with specific handlers for each type (`handle_list_methods`, `handle_dict_methods`, etc.). Introduced an `ArgCheck` trait to standardize and DRY up argument validation. Standardized error messages to match Python-style exceptions (TypeError, ValueError, etc.) and updated relevant tests. Preserved deadlock safety logic for List `extend`. Improved maintainability and readability of the method dispatch logic. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * cargo fmt * Fix mismatch in expected error message for list.append() test (#1348) The `test_list_extended_methods` test was failing because it expected the error message "append() takes exactly one argument", but the actual error message produced by the runtime is "append() takes exactly 1 argument". This commit updates the test assertion in `implants/lib/eldritchv2/eldritch-core/tests/collections_extended.rs` to match the actual runtime behavior, resolving the test failure. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * fix tests * Refactor eldritch-core methods.rs into a module folder (#1349) Refactors `methods.rs` into `methods/` directory with `str.rs`, `dict.rs`, `list.rs`, `set.rs`, and `mod.rs`. Updates `tests/collections_extended.rs` and `tests/coverage_boost.rs` to match the actual error message format ("1" instead of "one", "exactly" inclusion). Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * cargo fmt * Refactor operations.rs into a module folder (#1351) Refactors `eldritch-core/src/interpreter/operations.rs` into a directory module `eldritch-core/src/interpreter/operations/` with submodules: - `arithmetic.rs`: Arithmetic operations - `bitwise.rs`: Bitwise operations - `comparison.rs`: Comparison logic - `comprehension.rs`: Comprehension evaluation helper - `slicing.rs`: Slicing index adjustment This improves code organization and maintainability. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * cargo fmt * Fix 'Stdio' undeclared type error on Windows in eldritch-libsys (#1353) * Update strip methods to accept optional arguments (#1350) * Refactor eval.rs into modular eval/ directory structure (#1352) * Refactor builtins: Move map, filter, reduce, sorted, eval to builtins/ (#1354) * Format code in implants directory (#1355) * Fix eldritchv2 Windows build errors (#1356) * Fix eldritchv2 Windows build errors in libsys - Add `uuid` to `eldritch-libsys` dev-dependencies to fix unresolved import in tests. - Fix `test_exec_input` in `exec_impl.rs` to correctly define `input` variable for Windows target and use `args` properly. * Fix eldritchv2 Windows build errors in libsys - Add `uuid` to `eldritch-libsys` dev-dependencies to fix unresolved import in tests. - Fix `test_exec_input` in `exec_impl.rs` to correctly define `input` variable for Windows target and use `args` properly. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * fix windows test * Fix line ending test failure on Windows (#1358) * misc fixes * fix default feats * Cleanup auto gen and some formatting. (#1359) * Fix test failure on Windows in eldritch-libprocess (#1360) Replaced `timeout` with `ping` in `test_std_process_kill` to avoid input redirection errors on Windows. `timeout` exits immediately if stdin is redirected, which caused the test to fail. `ping` is a reliable alternative for a sleep-like command on Windows. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Fix Windows dll_inject test path resolution (#1361) Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Remove documentation generation from build scripts (#1362) Removed the documentation generation logic from `build.rs` in `eldritch-core` and `eldritchv2` as requested. The build scripts now only contain minimal `rerun-if-changed` directives. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * cargo fmt * Rename `set_active_callback_uri` to `set_callback_uri` (#1363) Renamed `set_active_callback_uri` to `set_callback_uri` in `eldritch-libagent` and related components to improve consistency and clarity. - Updated `AgentLibrary` trait in `eldritch-libagent/src/lib.rs`. - Updated implementation in `eldritch-libagent/src/std.rs`. - Updated mocks in `eldritch-libagent`, `imixv2`, `eldritch-libpivot`, `eldritch-libassets`. - Updated `imixv2` agent implementation to consolidate `set_callback_uri` and `set_active_callback_uri`. - Updated `eldritchv2` bindings test expectations. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * fixed error reporting bug, lint warnings, and added some logging * Fix agent_callback_uri tome and docs to use set_callback_uri (#1365) The `agent_callback_uri` tome was calling `agent.set_active_callback_uri`, which is not a valid method on the `AgentLibrary`. This caused the `tests::test_all_tomes` test to fail. This commit updates the tome to use the correct method name `set_callback_uri`, and also corrects the user documentation which referenced the incorrect name. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * Refactor eldritch-libpivot to move std implementations to std/ folder (#1366) Moved all `*_impl.rs` files and `std.rs` into a new `src/std/` directory to organize the standard library implementations better. `std.rs` was renamed to `std/mod.rs` and now exposes the submodules. `lib.rs` was updated to export the `std` module. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * delete v2 docs * update docs with an example for list_tasks() * feat(eldritch-core): Implement missing dict methods (#1368) Implemented `clear`, `pop`, and `setdefault` for `dict` type in `eldritch-core`. Updated `get_native_methods` to include these new methods. Verified with tests. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <[email protected]> * Fix recursion crash in PartialEq/Ord for Eldritch V2 (#1367) * Fix recursion crash in PartialEq/Ord for Eldritch V2 Added thread-local cycle detection to `Value::PartialEq` and `Value::Ord` implementations in `eldritch-core`. This prevents stack overflow (and resulting process crashes/hangs) when comparing recursive data structures, such as lists or dictionaries that contain themselves. The fix uses a thread-local `BTreeSet` to track visited pointer pairs during comparison. If a pair is revisited, we assume equality (for `PartialEq`) or `Ordering::Equal` (for `Ord`) to break the recursion cycle. This logic is gated behind the `std` feature flag, as `thread_local!` requires std. This addresses the issue where the Imixv2 REPL would hang/crash when executing code that created recursive structures (e.g., `a.append(a)` loop). Testing: - Added temporary reproduction test `repro_recursion.rs` which confirmed stack overflow on recursive comparison. - Verified fix prevents stack overflow in the same test case. - Ran existing `eldritch-core` test suite to ensure no regressions. * Fix recursion crash in PartialEq/Ord for Eldritch V2 Added thread-local cycle detection to `Value::PartialEq` and `Value::Ord` implementations in `eldritch-core`. This prevents stack overflow (and resulting process crashes/hangs) when comparing recursive data structures, such as lists or dictionaries that contain themselves. The fix uses a thread-local `BTreeSet` to track visited pointer pairs during comparison. If a pair is revisited, we assume equality (for `PartialEq`) or `Ordering::Equal` (for `Ord`) to break the recursion cycle. This logic is gated behind the `std` feature flag, as `thread_local!` requires std. This addresses the issue where the Imixv2 REPL would hang/crash when executing code that created recursive structures (e.g., `a.append(a)` loop). Testing: - Added temporary reproduction test `repro_recursion.rs` which confirmed stack overflow on recursive comparison. - Verified fix prevents stack overflow in the same test case. - Ran existing `eldritch-core` test suite to ensure no regressions. * Refactor recursion fix to support no_std Updated `Value::PartialEq` and `Value::Ord` implementations to use recursive helper methods (`eq_helper`, `cmp_helper`) that manually pass the `visited` set down the recursion stack. This removes the dependency on `thread_local!`, making the fix compatible with `no_std` environments where thread-local storage is not available. The solution now explicitly implements container traversal (List, Dictionary, Set, Tuple) in the helpers to ensure the `visited` context is preserved during deep comparisons. This maintains the cycle detection logic while adhering to `no_std` constraints. Verified with existing tests and `regression_recursion.rs`. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Add migration test script for eldritchv2 (#1369) This commit adds a new migration test script `v1_compat.eld` to `implants/lib/eldritchv2/stdlib/migration/tests/scripts/`. The script verifies compatibility between Eldritch V1 and V2 for built-in types and their methods, including strings, lists, dictionaries, etc. It currently highlights missing `clear()` methods on list and dict in V2. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Add unit tests for missing eldritch-core methods (#1370) * Update eldritch-libhttp to match v1 signatures (#1371) Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * cargo fmt * Fix failing Windows test_exec_input by replacing findstr with sort (#1374) * Fix incorrect byte length assertion in `test_write_reg_int` on Windows (#1375) * Fix write_reg_int test assertions (#1376) Corrected the expected byte arrays in `test_write_reg_int` to match the actual behavior of `write_reg_int` and `winreg`. - `REG_NONE` and other 32-bit types now expect `u32` byte arrays (4 bytes). - `REG_QWORD` now expects a `u64` byte array (8 bytes). This resolves test failures where 4-byte registry values were being compared against 8-byte expectations and vice-versa. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> * Fix eldritch-stdlib-tests on Windows by normalizing line endings and enabling stdlib feature (#1377) Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --------- Co-authored-by: Hulto <[email protected]> Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Micah <[email protected]>


Okay, so this PR does a lot. Here's a quick breakdown of all that's included:
implants/lib/eldritchv2contains the implementation of the eldritch language, REPL, and stdlib implementationsimplants/lib/eldritchv2/eldritch-coreis the primary language crate, responsible for lexing, parsing, and evaluating eldritch. It also provides features such as auto completions and error reporting.implants/lib/eldritchv2/eldritch-macrosis a helper crate, enabling library creation through the use of#[eldritch_library]and#[eldritch_method]macrosimplants/lib/eldritchv2/eldritch-replis our core REPL logic, which produces a WASM interpreter, runnable binary, and is used by our reverse shell REPLimplants/lib/eldritchv2/stdlibis where we've migrated all of eldritch's standard library methods totestsruns all thetavern/tomesin a mock environment, ensuring no syntax errorsmigrationruns sample eldritch scripts with both the v1 and v2 versions of the language, ensuring the outputs matchimplants/lib/eldritchv2/eldritchv2is the primary facade crate which ties everything together in an easy to use API, re-exporting types needed from other crates