Repository navigation
Conversation
When OpenCode discovers skills from multiple scan paths (e.g. global ~/.agents/skills/ and project-level .agents/skills/), the same physical SKILL.md file can be found multiple times. The add() function would log a warning with identical existing and duplicate paths, then overwrite the same map entry. This fix returns early when the same file path is encountered again, silencing the false-positive warning. If two different files share the same skill name, the warning is still shown as intended. Fixes #26709
Add support for interactive commands (sudo, ssh -t, ansible -K) that require password/secure input. Previously these commands would fail because the tool used ChildProcessSpawner with stdin: 'ignore'. Changes: - Add SecureInput Effect service with: - Password prompt pattern detection (sudo, SSH, GPG, ansible, etc.) - Interactive command auto-detection - PTY-based command execution via bun-pty - Event-driven password request/submit/cancel/timeout flow - Password goes directly to PTY, never stored or logged - 60s timeout, output sanitization ([password supplied]) - Add 'interactive: boolean' parameter to ShellTool parameter schema - Add PTY execution branch in ShellTool that activates on interactive flag or auto-detection - Add SecureInputID identifier prefix (sec_) - Add Hono API routes: GET /secure-input (list), POST /:id/submit, POST /:id/cancel - Register SecureInput layer in AppRuntime - Register routes in instance server - Update shell.txt prompt template with interactive usage note Output sanitization replaces detected password prompts with '[password supplied]' before returning to the LLM.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Just TWO HOUR window? Isn't this a bit overdramatic? |
|
@isavcic absolutely right |
Summary
Add PTY-based interactive command execution for commands that require password/secure input (sudo, ssh -t, ansible -K, etc.). These commands previously failed because the ShellTool used
ChildProcessSpawnerwithstdin: 'ignore'.Implementation
This PR adds a SecureInput Effect service and integrates it into the ShellTool:
New module:
packages/opencode/src/secure-input/SecureInputID— Newtype prefixed withsec_[sudo] password for user:,Password:,Enter passphrase:, etc.sudo,ssh -t,ansible -K,su,gpgsecure-input.requested,.submitted,.cancelled,.timed-outeventsModified files
packages/opencode/src/tool/shell/prompt.ts— Addedinteractive?: booleanparameter with LLM-facing descriptionpackages/opencode/src/tool/shell.ts— Added PTY execution branch activated byparams.interactiveor auto-detectionpackages/opencode/src/tool/shell/shell.txt— Added usage note about interactive commandspackages/opencode/src/id/id.ts— Addedsecureinput: "sec"prefixpackages/opencode/src/effect/app-runtime.ts— Registered SecureInput layerpackages/opencode/src/server/routes/instance/— Added/secure-inputHono routes (GET /,POST /:id/submit,POST /:id/cancel)packages/opencode/src/server/routes/instance/index.ts— Registered routesHow it works
interactive: true(auto-detected for sudo/ssh/ansible)secure-input.requestedevent[password supplied]in the returned outputPOST /:id/submit) or cancels (POST /:id/cancel)Follow-up work