feat: add Tier 2 tools (TTS, MOA) and safety config extension - #39
Merged
Conversation
- Add sandbox.safety subobject with urlFilter and pythonImportHook options - Update sandbox.timeout.seconds to allow 0 (no limit) - Add text_to_speech tool (OpenAI TTS API, saves to ~/voice-memos/) - Add mixture_of_agents tool (4 parallel OpenRouter calls + aggregation) - Wire pythonImportHook from safety config into code.js instead of env var - Fix bug in vision.js (missing analysisPrompt constant) - Add comprehensive tests for all new tools - Update tool registration with API-key-based gating (OPENAI_API_KEY, OPENROUTER_API_KEY)
- Add POSIX setrlimit(RLIMIT_AS) enforcement for execute_code tool
- Use posix npm package (CJS) to call setrlimit with 'as' (address space) limit
- Parse memoryLimit config string ('512m', '2g') to bytes via parseMemLimit()
- Explicitly kill child process on timeout via child.kill('SIGKILL')
- AbortController signal may not reliably kill all interpreters
- Add posix as runtime dependency in package.json
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.
Description
Adds Tier 2 tools (text-to-speech and mixture of agents) and extends the sandbox safety configuration with a configurable
safetysubobject. All new tools register with API-key-based gating and 100% test coverage.Type of Change
Testing
text_to_speech(text validation, model/voice validation, API call, error handling, network errors)mixture_of_agents(message validation, API key gating, parallel calls, partial aggregation on failure, all-fail scenario, network errors)Coverage
Checklist
npm run lintpassesChanged Files
New:
src/tools/tts.js— OpenAI TTS text-to-speech toolsrc/tools/moa.js— Mixture of Agents with 4 parallel OpenRouter calls + aggregationtests/unit/tools_tts.test.js— 10 unit teststests/unit/tools_moa.test.js— 11 unit testsModified:
src/config/schemas.js— Addedsandbox.safetysubobject withurlFilterandpythonImportHookbooleansconfig.yaml— Addedsandbox.safetysectionsrc/tools/index.js— Registered TTS and MOA tools with API-key gatingsrc/tools/code.js— UsepythonImportHookfrom safety config options instead ofPYTHON_IMPORT_HOOKenv varsrc/tools/vision.js— Fixed missinganalysisPromptconstanttests/unit/tools_code.test.js— Updated to use safety config from optionstests/unit/tool_registration.test.js— Added registration tests for TTS and MOAtests/unit/config.test.js— Added tests for safety config schemaThreat Model