Implement Shell V2 Endpoint and Logic#1824
Conversation
- Update `Shell` ent schema to make task optional and add `ShellTask` relation. - Create `ShellTask` ent schema with history mixin. - Update `portal.proto` to include `ShellPayload`. - Add `createShell` mutation to GraphQL schema and implement resolver. - Implement `ShellV2Handler` with WebSocket upgrade, shell verification, auth check, and pubsub integration. - Update `tavern/app.go` to register new endpoint. - Update `ShellV2` frontend to verify shell status via GraphQL and handle errors. - Fix generated resolvers to avoid panics. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
* feat(shellv2): implement new shell endpoint, task tracking, and frontend (#1824) - Update `Shell` ent schema to make task optional and add `ShellTask` relation. - Create `ShellTask` ent schema with history mixin. - Update `portal.proto` to include `ShellPayload`. - Add `createShell` mutation to GraphQL schema and implement resolver. - Implement `ShellV2Handler` with WebSocket upgrade, shell verification, auth check, and pubsub integration. - Update `tavern/app.go` to register new endpoint. - Update `ShellV2` frontend to verify shell status via GraphQL and handle errors. - Fix generated resolvers to avoid panics. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * some backend work * artisnal websockets * stubbed it out... artisnally :chefskiss: * Implement Shell V2 WebSocket backend logic (#1829) - Update `ShellPayload` in `portal.proto` to include `stream_id` for multi-user session tracking. - Implement `writeMessagesFromWebsocket` in `tavern/internal/http/shell/handler.go` to handle user input, create `ShellTask` ents, and route messages to active portals or queue them if no portal is active. - Implement `writeMessagesFromShell` to handle output from portals (interactive) or DB polling (non-interactive), with support for "Other Stream" output notifications. - Add `WebsocketMessageKindOutputFromOtherStream` and associated message struct in `websocket.go`. - Add integration tests in `tavern/internal/http/shell/integration_test.go` covering interactive, non-interactive, and multi-user scenarios. - Fix WebSocket handler to accept both `TextMessage` and `BinaryMessage` frames. - Ensure thread-safe access to `activePortal` state using `ShellSession`. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * feat: ShellV2 Typed WebSocket Protocol & Improved Rendering (#1830) * feat: update ShellV2 to use typed WebSocket protocol and improved output rendering - Created `tavern/internal/www/src/pages/shellv2/websocket.ts` to mirror backend WebSocket message types. - Updated `headless-adapter.ts` to use typed messages and correct input format. - Refactored `ShellV2` component to handle asynchronous output by clearing and redrawing the input line. - Implemented specific handling for task errors (red) and control flow messages. Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * minor changes --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com> * tried fixing but it didn't work * fixed * remove old code --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: KCarretto <16250309+KCarretto@users.noreply.github.com>
Implemented the new Shell V2 endpoint and associated logic.
Changes:
Backend:
Shellentity to maketaskoptional and addedshell_tasksedge.ShellTaskentity to log inputs with sequencing.portal.prototo supportShellPayloadmotes.createShellGraphQL mutation.ShellV2Handler(/shellv2/ws/:id) which:ShellTaskin DB.ShellPayloadmote via PubSub.ent.resolvers.goto implement field resolvers forShellTask(avoiding panics).Frontend:
ShellV2page (tavern/internal/www/src/pages/shellv2/index.tsx).GetShellto verify shell status/existence before connecting WebSocket.AlertErrorif shell is not found, closed, or connection fails.App.tsxto support/shellv2/:shellId.Verification:
go generate ./...to update all generated code.go test ./...(existing tests pass/fail as before, new code compiles).PR created automatically by Jules for task 10257790695595503837 started by @KCarretto