feat(agents): allow custom command args and env vars per agent#975
Open
naaa760 wants to merge 2 commits intogeneralaction:mainfrom
Open
feat(agents): allow custom command args and env vars per agent#975naaa760 wants to merge 2 commits intogeneralaction:mainfrom
naaa760 wants to merge 2 commits intogeneralaction:mainfrom
Conversation
|
@naaa760 is attempting to deploy a commit to the General Action Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR implements per-agent custom command arguments and environment variables, allowing users to configure additional CLI flags (like Implementation:
Security posture:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| src/main/services/ptyManager.ts | Adds extraArgs and env to provider config resolution and CLI arg building. Environment variable keys are validated with regex /^[A-Za-z_][A-Za-z0-9_]*$/ at multiple points to prevent injection attacks. Shell arguments from extraArgs are properly parsed using parseShellArgs. |
| src/main/services/ptyIpc.ts | Updated buildRemoteProviderInvocation to include extraArgs in remote shell commands. Environment variables from custom config are merged into remote PTY sessions with proper validation. All shell arguments are quoted using quoteShellArg for injection safety. |
| src/main/settings.ts | Extended ProviderCustomConfig interface with extraArgs and env fields. Settings normalization validates environment variable names using the same regex pattern to ensure only valid POSIX variable names are persisted. |
| src/renderer/components/CustomCommandModal.tsx | Added UI for additional parameters (extraArgs) and environment variables with add/remove functionality. Form state includes validation and filtering of empty environment variable keys before submission. Environment variables are converted to/from key-value pairs for editing. |
| src/renderer/types/electron-api.d.ts | Added extraArgs and env type definitions to ProviderCustomConfig to support custom command arguments and environment variables per agent. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User configures agent in Settings UI] --> B[CustomCommandModal.tsx]
B --> C[Save extraArgs + env to settings]
C --> D[settings.ts validates env keys]
D --> E[Stored in ProviderCustomConfig]
F[Agent spawn requested] --> G[resolveProviderCommandConfig]
G --> H{Config type?}
H -->|extraArgs| I[parseShellArgs extraArgs]
H -->|env| J[Validate env keys with regex]
I --> K[buildProviderCliArgs]
J --> L[Merge into useEnv]
K --> M{Spawn type?}
L --> M
M -->|Direct PTY| N[startDirectPty]
M -->|Shell fallback| O[startPty]
M -->|Remote SSH| P[startSshPty]
N --> Q[Spawn with merged env + args]
O --> Q
P --> R[Quote with quoteShellArg]
R --> S[SSH to remote + export env]
Last reviewed commit: 6826c54
Contributor
|
Hey @naaa760, thanks for the PR! Please run pnpm run format so that ci is happy |
Contributor
Author
|
@arnestrickmann |
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.
fix: #910
allow custom command and env vars per agent
-- Configure in Settings → Agents via the gear icon next to each agent. Stored per agent; applied for direct spawn, shell fallback, and remote PTYs. No new dependencies.