-
Notifications
You must be signed in to change notification settings - Fork 5
🤖 Add pluggable runtime abstraction layer #178
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
Open
ammar-agent
wants to merge
11
commits into
main
Choose a base branch
from
runtime-abstraction
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+959
−60
Conversation
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
53 tasks
Implements Phase 1 of pluggable runtime system with minimal Runtime interface that allows tools to execute in different environments (local, docker, ssh). Changes: - Add Runtime interface with 5 core methods: exec, readFile, writeFile, stat, exists - Implement LocalRuntime using Node.js APIs (spawn, fs/promises) - Refactor file tools (file_read, file_edit_*) to use runtime abstraction - Update ToolConfiguration to include runtime field - Inject LocalRuntime in aiService and ipcMain - Update tsconfig to ES2023 for Disposable type support - Update all tests to inject LocalRuntime (90 tests pass) This is a pure refactoring with zero user-facing changes. All existing functionality remains identical. Sets foundation for Docker and SSH runtimes. _Generated with `cmux`_
3a4b265 to
ef7ea1c
Compare
- Add SSHRuntime class implementing Runtime interface - Add runtime configuration types (local, ssh) - Add runtime factory to create runtime based on config - Use native ssh2 SFTP for file operations - Support SSH key and password authentication - Connection pooling and automatic reconnection
- Add runtimeConfig to WorkspaceMetadata - Update AIService to use runtime factory with workspace config - Update all tests and ipcMain to use runtime factory - Default to local runtime if no config specified
- Use async fs.readFile instead of sync readFileSync - Remove async from close() method (no await needed) - Fix any type usage in runtime factory error message
electron-builder tries to run 'rebuild' for native modules, but ssh2 doesn't have native dependencies that need rebuilding. Add a no-op script to satisfy electron-builder.
- Create src/constants/env.ts with NON_INTERACTIVE_ENV_VARS - Update LocalRuntime and bash tool to use shared constant - Eliminates duplicate environment variable definitions
f1679f6 to
e5e1499
Compare
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.
Overview
Implements Phase 1 of pluggable runtime system with minimal Runtime interface that allows tools to execute in different environments (local, docker, ssh). This is a pure refactoring with zero user-facing changes.
Changes
Runtime Abstraction
exec(),readFile(),writeFile(),stat(),exists()Tool Refactoring
file_read.tsto useruntime.readFile()andruntime.stat()file_edit_replace.tsto use runtime for all file operationsfile_edit_insert.tsto use runtime for all file operationsfileCommon.tsto work withFileStatinterface instead offs.Statsbash.tskept unchanged (complex overflow handling)Integration
ToolConfigurationto includeruntime: RuntimefieldLocalRuntimein aiService and ipcMainTesting
Architecture Benefits
Easy to test: Runtime implementations are isolated (< 250 lines each), no dependencies between runtimes.
Easy to extend: Adding DockerRuntime or SSHRuntime = implement 5-method interface. Tools automatically work with new runtimes.
Backwards compatible: LocalRuntime is default, no config changes = no behavior changes.
Next Steps
Foundation is now in place for:
runtimeConfigto WorkspaceMetadataTesting
Generated with
cmux