Skip to content

feat(tools): add sandboxed code-execution tool (§6.7) - #321

Open
gnanirahulnutakki wants to merge 3 commits into
devfrom
feat/code-execution-6.7-2026-07-14
Open

feat(tools): add sandboxed code-execution tool (§6.7)#321
gnanirahulnutakki wants to merge 3 commits into
devfrom
feat/code-execution-6.7-2026-07-14

Conversation

@gnanirahulnutakki

Copy link
Copy Markdown
Member

Summary

  • Adds crates/code-execution (ardur-code-execution), Phase 1 of the §6.7 code-execution blueprint: closed LanguageAdapter trait (Bash + Python), CodeExecutionCaveat cap-token-shaped attenuation (language allowlist, timeout ceiling, tool-callback allowlist that only ever narrows, forced expose_stderr override, output-size ceiling), a code.exec.{requested,completed,failed,tool_denied}.v1 receipt forest, and a CodeExecutionTool (code.exec) gated by Capability::ProcessSpawn + a custom code_execution capability that scans captured stdout through ardur-injection-defense before returning it.
  • Explicitly out of scope this PR (documented as // TODO §6.7 Phase 2 in lib.rs): tool-call RPC transport (the script cannot yet call back into the tool registry — tool_allowlist is accepted/attenuated/receipted as a stated intent only), Node/Rust adapters, and routing through the §6.3 backend matrix / §11.5 sandbox runtime — neither crate exists yet in this workspace, so every dispatch here is unsandboxed local process execution until §11.5 lands.
  • Browser automation (§6.9/§6.10) already ships as crates/browser and is not duplicated by this PR — confirmed via docs/current-status.md and the crate's existing browser.navigate/click/type/screenshot/extract tools before starting this work.
  • §6.13 computer-use (macOS Accessibility/SkyLight FFI) has no crate yet; deliberately deferred as a separate, larger OS-specific undertaking rather than attempted here.

Test plan

  • cargo build -p ardur-code-execution
  • cargo test -p ardur-code-execution (19/19 passing — full Tool::invoke round trips against real bash/python3 subprocesses, not mocks)
  • cargo fmt --check
  • cargo clippy -p ardur-code-execution --all-targets -- -D warnings
  • cargo check --workspace --all-features (no cross-crate breakage)
  • Rebased onto origin/dev and re-verified green

Adds crates/code-execution (ardur-code-execution), Phase 1 of the §6.7
code-execution blueprint: a closed LanguageAdapter trait with Bash and
Python adapters, a cap-token-shaped CodeExecutionCaveat that attenuates
every request (language allowlist, timeout ceiling, tool-callback
allowlist intersection that never widens, forced expose_stderr override,
output-size ceiling), a code.exec.{requested,completed,failed,tool_denied}.v1
receipt forest, and a CodeExecutionTool (code.exec) gated by
Capability::ProcessSpawn plus a custom code_execution capability that
scans captured stdout through ardur-injection-defense before returning it.

Tool-call RPC (a running script dispatching back into the tool registry),
Node/Rust adapters, and routing through the §6.3 backend matrix / §11.5
sandbox runtime are out of scope here — none of those crates exist yet in
this workspace. Documented as explicit Phase 2 TODOs; every dispatch in
this crate is unsandboxed local process execution until §11.5 lands.

Browser automation (§6.9/§6.10) already ships as crates/browser and is
not duplicated here.

Checkpoint: architect/sessions/2026-07-14-code-execution-6.7/journal.md
Signed-off-by: Gnani Nutakki <gnani.nutakki@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e353956-cdb7-4e38-a0ee-0fece1f538e6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/code-execution-6.7-2026-07-14

Comment @coderabbitai help to get the list of available commands.

gnanirahulnutakki added a commit that referenced this pull request Jul 17, 2026
## Summary
- Adds `crates/computer-use` (`ardur-computer-use`), Phase 1 of the
§6.13 computer-use blueprint: a closed 10-action vocabulary (`capture`,
`click`, `double_click`, `right_click`, `middle_click`, `drag`,
`scroll`, `type`, `key`, `wait`), an in-substrate `BlockedActionPolicy`
denylist (5 hard-blocked key combos + 6 dangerous-text patterns, adapted
from Hermes's `computer_use/tool.py:80-107`) enforced **regardless** of
cap-token or consent state, a cap-token-shaped `ComputerUseCaveat`
(per-action-kind permitted set), a session-scoped `ConsentBroker`
(grant/revoke/TTL), the
`computer.{session.started,consent.granted,consent.revoked,action.invoked,action.denied,screenshot.taken}.v1`
receipt family with a `DenialSource` that distinguishes
blocked-action/cap-token/consent refusals, and a `ComputerUseTool`
(`computer.use`) gated by a custom `computer_use` capability. Gate
order: denylist → caveat → consent.
- Phase 1 backend (`LocalInputDriver`) uses `enigo` (mouse/keyboard
synthesis) + `xcap` (screen capture) over **public** macOS APIs. The
blueprint's own MVP decision explicitly rejects the private SkyLight-SPI
path Hermes uses (`SLEventPostToPid`, etc.), gating it behind a separate
`computer_use_skylight_spi` cap-token caveat reserved for a future phase
— so this PR isn't under-delivering relative to the blueprint's own
stated MVP scope.
- Documented Phase 2 TODOs in `lib.rs`:
`set_value`/`list_apps`/`focus_app` (need `AXUIElement`
accessibility-tree access, which neither `enigo` nor `xcap` expose), the
`som`/`ax` capture modes,
`AXIsProcessTrustedWithOptions`/`CGPreflightScreenCaptureAccess`
OS-permission preflight, a real interactive consent dialog UI
(`ConsentBroker` ships the state machine only), and cap-token-to-caveat
projection from a verified Biscuit block.
- Companion PR to #321 (§6.7 code-execution) — together they close the
`/goal` directive's tool-surface domain (code-execution +
browser/computer-use). Browser automation (§6.9/§6.10) already ships as
`crates/browser` and is not touched here.

## Test plan
- [x] `cargo build -p ardur-computer-use`
- [x] `cargo test -p ardur-computer-use` (33/33 passing —
denylist/caveat/consent gate-order tests, action-parsing tests, and a
`wait` dispatch test; deliberately no test exercises real
click/type/screenshot execution, since that would require
Accessibility/ScreenRecording permission granted to the CI runner)
- [x] `cargo fmt --check`
- [x] `cargo clippy -p ardur-computer-use --all-targets -- -D warnings`
- [x] `cargo check --workspace --all-features` (no cross-crate breakage
from the new `enigo`/`xcap`/`image`/`hex` dependencies)

---------

Signed-off-by: Ardur <team@ardur.ai>
Co-authored-by: ArdurAI <team@ardur.ai>
ArdurAI added 2 commits July 17, 2026 17:20
Signed-off-by: ArdurAI <team@ardur.ai>
…7-2026-07-14

Signed-off-by: ArdurAI <team@ardur.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant