[ark] Clone system functions into Ark spike with real-filesystem pidgin#8139
Merged
[ark] Clone system functions into Ark spike with real-filesystem pidgin#8139
Conversation
## What Clones the `opal-backend` system function group into the Ark spike, backed by the real filesystem and a protocol-based pidgin translator. Adds a `function_groups` factory parameter to `run_skilled_agent` so callers can provide their own toolset. ## Why The Ark bash agent needs file operations on the real filesystem (not AgentFileSystem) and its own pidgin resolution for `<file>` tags. The `function_groups` factory separates environment assembly from loop execution, giving the Ark spike full control over its toolset while still sharing the `LoopController` for termination. ## Changes ### `opal-backend` - **`skilled_agent.py`**: Added `function_groups` factory parameter. When provided, skips built-in environment assembly (AgentFileSystem, TaskTreeManager, built-in groups) and calls the factory with the `LoopController`. `extra_groups` kept for backward compatibility. Fixed `pre_loaded_prefixes` scoping bug. ### `spikes/ark` — new files - **`ark_pidgin.py`**: `FileReader` protocol + `TextFileReader` + `from_pidgin_string`. Protocol-based so multimodal can be swapped in later without changing the resolver. - **`system.py`**: All 7 system function handlers backed by real filesystem. Pidgin wired into `system_write_file` and `system_objective_fulfilled`. Task tree writes to `task_tree.json`. - **`declarations/system.*`**: Copied from `opal-backend`, then forked: `/mnt/` → `$HOME/` in instruction and function descriptions. - **`tests/test_ark_pidgin.py`**: 11 tests including a mock multimodal reader proving protocol agnosticism. - **`tests/test_system.py`**: 12 tests covering all handlers, path traversal, and intermediate file collection. ### `spikes/ark` — modified - **`main.py`**: Uses `function_groups` factory to wire Ark system group + sandbox group. ## Testing ```bash cd spikes/ark/backend python -m pytest tests/ -v # 43 passed ```
📊 Coverage Report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Clones the
opal-backendsystem function group into the Ark spike, backed by the real filesystem and a protocol-based pidgin translator. Adds afunction_groupsfactory parameter torun_skilled_agentso callers can provide their own toolset.Why
The Ark bash agent needs file operations on the real filesystem (not AgentFileSystem) and its own pidgin resolution for
<file>tags. Thefunction_groupsfactory separates environment assembly from loop execution, giving the Ark spike full control over its toolset while still sharing theLoopControllerfor termination.Changes
opal-backendskilled_agent.py: Addedfunction_groupsfactory parameter. When provided, skips built-in environment assembly (AgentFileSystem, TaskTreeManager, built-in groups) and calls the factory with theLoopController.extra_groupskept for backward compatibility. Fixedpre_loaded_prefixesscoping bug.spikes/ark— new filesark_pidgin.py:FileReaderprotocol +TextFileReader+from_pidgin_string. Protocol-based so multimodal can be swapped in later without changing the resolver.system.py: All 7 system function handlers backed by real filesystem. Pidgin wired intosystem_write_fileandsystem_objective_fulfilled. Task tree writes totask_tree.json.declarations/system.*: Copied fromopal-backend, then forked:/mnt/→$HOME/in instruction and function descriptions.tests/test_ark_pidgin.py: 11 tests including a mock multimodal reader proving protocol agnosticism.tests/test_system.py: 12 tests covering all handlers, path traversal, and intermediate file collection.spikes/ark— modifiedmain.py: Usesfunction_groupsfactory to wire Ark system group + sandbox group.Testing