feat(runtime): add interactive shell - #2198
Conversation
|
Claude Security Review: no high-confidence findings. (run) |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## refactor #2198 +/- ##
============================================
- Coverage 97.07% 97.03% -0.05%
============================================
Files 544 551 +7
Lines 37866 38323 +457
============================================
+ Hits 36760 37186 +426
- Misses 1106 1137 +31 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Nice work — the shell command is well‑structured and the abstraction boundaries are clean:
InteractiveTerminalis decoupled from the runtime SDK viaInteractiveTerminalPeerand gets solid unit coverage using realPassThroughstreams.- The SDK adapter (
createRuntimeShellOpener) is testable viacreateClient/sleepinjection, and the retry policy on 409/424/429 upgrade failures is bounded and covered. - Auth + endpoint constraints (CUSTOM_JWT requires
--bearer-token, IAM rejects it,--endpoint-urland--jsonare rejected, TTY is required) are all enforced innormalizeRuntimeShellRequestandrunRuntimeShellwith matching tests. - The
TuiHandoffControllercleanly solves the "unmount Ink, run raw‑mode PTY, remount Ink" problem, and therenderTuiAtloop remounts the requested origin. - The bundler plugin correctly rewrites
bedrock-agentcore/runtimeto the client entry so the server‑side deps get tree‑shaken.
A couple of small things worth being aware of but not blocking:
- Pulling in
bedrock-agentcoretransitively brings the legacy@aws-sdk/protocol-http@3.374.0and@aws-sdk/signature-v4@3.374.0(2023) alongside the current@smithy/*equivalents already in the tree. Nothing to fix here — just something to watch as the SDK team consolidates. - In
InteractiveTerminal.run, if thepump()iterator rejects,pendingis not awaited before entering thefinally(control jumps pastawait pending). In practice queued sends/resizes are best‑effort and cleanup still runs, so this is fine, but if you ever surface a "no lost writes on failure" guarantee you'd want toawait pending.catch(() => {})in the finally.
1c07a15 to
c653741
Compare
|
Claude Security Review: no high-confidence findings. (run) |
c653741 to
dc2028e
Compare
|
Claude Security Review: no high-confidence findings. (run) |
Ink treats CI environments as non-interactive even when stdin and stdout are TTYs. renderTuiAt already requires a TTY, so force interactive mode to preserve live rendering and input.
dc2028e to
5c82949
Compare
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
AlexanderRichey
left a comment
There was a problem hiding this comment.
A lot going on in this PR! I presume a lot of this is a copy/paste job from the old CLI?
Summary
Adds
agentcore runtime shell, a native interactive PTY session for AgentCoreRuntimes using the currently published TypeScript SDK (
bedrock-agentcore0.4.3).runtime shellopens Runtime and endpoint pickers.--idskips the Runtime picker.--idwith--qualifierconnects directly.--session-idopens the shell in a specific Runtime session.Ctrl+C,Ctrl+D, terminal resize, ANSI/full-screenapplications, transparent reconnect, and remote exit status are preserved.
endpoint picker, or Runtime details screen when the native terminal ends.
The ownership boundaries are intentional:
The Runtime Shell screen uses Ink's
suspendTerminal()API so Ink releases rawinput and the alternate screen before IO takes terminal ownership. When the
shell ends, Ink restores the same TUI instance and the screen navigates back to
the route that launched it.
Command
Additional behavior:
--bearer-tokenaccepts inline orfile://CUSTOM_JWT tokens.--jsonand--endpoint-urlare rejected.exitor sendingCtrl+Dterminates the remote shell.Validation
CI=true bun test --coverage --coverage-reporter=lcovbun run typecheckbun run lint:checkbun run format:checkbun run secrets:checkbun run buildLive TUI Harness validation against a READY IAM Runtime in
us-west-2covered:Ctrl+Cinterrupt without disconnectingexitwith exit code 0Stack
This PR is independently mergeable and does not require a TypeScript SDK
release. Follow-up PR #2199 adds detach and reattach after the corresponding SDK
behavior is published.