feat(runtime): add interactive shell - #2189
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## refactor #2189 +/- ##
============================================
- Coverage 97.15% 97.08% -0.07%
============================================
Files 542 550 +8
Lines 37728 38227 +499
============================================
+ Hits 36653 37113 +460
- Misses 1075 1114 +39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Claude Security Review: no high-confidence findings. (run) |
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Nice, well-layered addition. Shell transport, terminal I/O, TUI handoff, and the handler are cleanly separated, and each layer has focused tests that mock at real boundaries (SDK openShell, InteractiveTerminalPeer) rather than at implementation details. Telemetry is picked up automatically by the router/TUI middleware (command_path and is_tui), consistent with sibling commands like invoke, so no extra instrumentation is needed here.
A few things I looked at closely and am satisfied with:
InteractiveTerminal.runrestores raw mode, pause state,SIGWINCH, and stdin listeners infinally, and covers the abort / pump-failure / detach-byte paths in tests.resolveRuntimeShellBearerTokencorrectly rejects-(stdin) because the PTY owns stdin, and strips only a single trailing newline.normalizeRuntimeShellRequestrefuses non-READYruntimes, malformed ARNs, non-CUSTOM_JWT authorizers, and enforces the token/no-token combinations for IAM vs CUSTOM_JWT.- The
RuntimeShellScreen->TuiHandoffControllerpattern correctly unmounts Ink before running the interactive shell, andrenderTuiAtinvokeshandoffs.take()afterwaitUntilExit, which the screen test asserts. - The 64 KiB - 1 chunking in
RuntimeShellSessionAdapter.sendis exercised by a boundary test that verifies bytes are preserved across the split. withTuiOnEmptyFlagsAndArgshandles the bareagentcore runtime shellcase (no flags → TUI), and the handler's--id-required branch correctly kicks in only when any flag is supplied, matching the documented UX.
Nothing blocking from me.
|
Claude Security Review: no high-confidence findings. (run) |
88b2e8a to
544c5d9
Compare
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
| await waitUntilExit(); | ||
| let nextPath: string | undefined = path; | ||
| while (nextPath !== undefined) { | ||
| const handoffs = new TuiHandoffController(); |
There was a problem hiding this comment.
Interesting mechanism here. Looks like it'll work, but we'll have to be careful. Abusing this could cause a lot of weird behavior.
AlexanderRichey
left a comment
There was a problem hiding this comment.
Looks like there are some merge conflicts.
860f0c1 to
73b1e09
Compare
|
Claude Security Review: no high-confidence findings. (run) |
|
Superseded by the upstream-native stack:
The replacement branches now live directly in |
Summary
Adds
agentcore runtime shell, a native interactive PTY session for AgentCoreRuntimes.
runtime shellopens Runtime and endpoint pickers.--idskips the Runtime picker.--idwith--qualifierconnects directly.--session-idwith--shell-idreattaches to an existing shell.Ctrl+C, terminal resize, ANSI/full-screen applications, detach, reconnect,and remote exit status are preserved.
endpoint picker, or Runtime details screen when the native terminal ends.
The ownership boundaries are intentional:
The TUI uses a post-render handoff so Ink fully restores the terminal before IO
enters raw mode. This keeps the picker experience in the existing TUI while the
actual shell remains a native terminal session. When that handoff completes,
Ink remounts the route that launched it.
Command
Additional behavior:
--bearer-tokenaccepts inline orfile://CUSTOM_JWT tokens.--jsonand--endpoint-urlare rejected.Ctrl+]detaches and prints the exact reattach command.Validation
bun test src: 2,886 passed, 0 failed.bun run format:checkbun run secrets:checkbun run buildbun run compile:linux-x64bun install --frozen-lockfilebun auditThe current
refactorbase has a duplicateresolveProjectResourceskey insrc/handlers/project/buildDeploy.screen.test.tsx, so repository-widetypecheck and lint fail on that unchanged upstream file. Targeted lint for every
file changed by this PR passes.
Live TUI Harness validation against a READY IAM Runtime in
us-west-2covered:Ctrl+Cinterrupt without disconnectingCtrl+]detachexitwith exit code 0--idshell detach returning to the endpoint pickerMerge blocker
This PR must not merge until
aws/bedrock-agentcore-sdk-typescript#249is merged and published, then
bedrock-agentcoreandbun.lockare refreshed.The current npm release (
0.4.3) exposes the required TypeScript API and keepsthis branch reproducible, but its
ShellSession.close()permanently terminatesthe remote PTY. Live detach/reattach validation used the exact PR head
3b83f6e63b87f5753ccfb05b66a99a45c7e6826f, whereclose()detaches and theupdated shell wire protocol is implemented.