Skip to content

Implement Shell V2 Endpoint and Logic#1824

Merged
KCarretto merged 1 commit intofeat/shellv2-backendfrom
feat/shellv2-impl-10257790695595503837
Feb 17, 2026
Merged

Implement Shell V2 Endpoint and Logic#1824
KCarretto merged 1 commit intofeat/shellv2-backendfrom
feat/shellv2-impl-10257790695595503837

Conversation

@KCarretto
Copy link
Copy Markdown
Collaborator

Implemented the new Shell V2 endpoint and associated logic.

Changes:

  • Backend:

    • Modified Shell entity to make task optional and added shell_tasks edge.
    • Created ShellTask entity to log inputs with sequencing.
    • Updated portal.proto to support ShellPayload motes.
    • Added createShell GraphQL mutation.
    • Implemented ShellV2Handler (/shellv2/ws/:id) which:
      • Verifies shell existence and that it is not closed.
      • Enforces Authorization: Checks that the current user is the owner of the shell (or an admin).
      • Writes input to ShellTask in DB.
      • Publishes input as ShellPayload mote via PubSub.
    • Updated ent.resolvers.go to implement field resolvers for ShellTask (avoiding panics).
  • Frontend:

    • Updated ShellV2 page (tavern/internal/www/src/pages/shellv2/index.tsx).
    • Added GraphQL query GetShell to verify shell status/existence before connecting WebSocket.
    • Displays AlertError if shell is not found, closed, or connection fails.
    • Updated routing in App.tsx to support /shellv2/:shellId.
  • Verification:

    • Ran go generate ./... to update all generated code.
    • Ran go test ./... (existing tests pass/fail as before, new code compiles).

PR created automatically by Jules for task 10257790695595503837 started by @KCarretto

- 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>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@KCarretto KCarretto marked this pull request as ready for review February 17, 2026 02:31
@KCarretto KCarretto merged commit 7eab769 into feat/shellv2-backend Feb 17, 2026
@KCarretto KCarretto deleted the feat/shellv2-impl-10257790695595503837 branch February 17, 2026 02:31
github-merge-queue bot pushed a commit that referenced this pull request Feb 18, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant