You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(js): expose in-process Terminal in the NAPI package - #2523
@everruns/bashkit (Node, Bun, Deno) exports Terminal, matching the Rust and Python terminal: send, runUntilIdle, screenText, historyText, takeTranscript, activity, file access, plus agent-style call(input, waitMs) with Vim key notation and toolDefinition() / systemPrompt() from TerminalTool. runUntilIdle and call are async and yield between short slices, so sync methods (send, screenText, …) work while a command runs.
Why
Follow-up to #2517, #2518 and #2521: completes the terminal across Rust, Python and JS.
Local: full JS suite 591 passed (includes new terminal.spec.ts), tsc + prettier clean, clippy clean, capability parity check passes.
Note: Ctrl-C while a command is running (e.g. sleep) stops the line at the next command boundary, not mid-command; same as the Rust terminal. Tests assert it.
Risk
Low. Additive; enables the terminal feature in the JS crate only.
Checklist
Tests added or updated (__test__/terminal.spec.ts)
Backward compatibility considered: additive; docs, knowledge and capability parity updated
CodeQL rust/access-invalid-pointer (alert #49) is a false positive in code generated by #[napi], not in this PR's code. I ran CodeQL 2.27.1 locally on crates/bashkit-js with the same query. The flow is wrapped_val = ptr::null_mut() → napi_unwrap(env, val, &mut wrapped_val) → &*wrapped_val, which is napi-derive-backend 6.1.5 codegen/struct.rs:173-202 expanded at the struct ident. The identical flow is reported on main for every #[napi] class: Bash (lib.rs:1776), BashTool (lib.rs:2541) and ScriptedTool (lib.rs:3352). It only shows as "new" here because Terminal is a new class. No code change on our side can clear it. It needs a dismissal as "false positive" in code scanning (I lack permission: 403).
The earlier pushes (cloning the Arc before locking, and spawning async work via Env::spawn_future on a cloned Arc instead of async fn(&self)) stay as robustness fixes; all other 34 checks are green.
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
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.
What changed
@everruns/bashkit(Node, Bun, Deno) exportsTerminal, matching the Rust and Python terminal:send,runUntilIdle,screenText,historyText,takeTranscript,activity, file access, plus agent-stylecall(input, waitMs)with Vim key notation andtoolDefinition()/systemPrompt()fromTerminalTool.runUntilIdleandcallare async and yield between short slices, so sync methods (send,screenText, …) work while a command runs.Why
Follow-up to #2517, #2518 and #2521: completes the terminal across Rust, Python and JS.
Before / After
Before: no terminal in JS.
After:
Local: full JS suite 591 passed (includes new
terminal.spec.ts), tsc + prettier clean, clippy clean, capability parity check passes.Note: Ctrl-C while a command is running (e.g.
sleep) stops the line at the next command boundary, not mid-command; same as the Rust terminal. Tests assert it.Risk
terminalfeature in the JS crate only.Checklist
__test__/terminal.spec.ts)