Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bolt terminal): added dedicated bolt terminal, and attached to workbench #228

Merged
merged 4 commits into from
Nov 12, 2024

Conversation

thecodacus
Copy link
Collaborator

Add Dedicated Terminal for AI Operations

Overview

This PR introduces a dedicated terminal ("Bolt Terminal") for AI operations, replacing the previous approach of using throwaway shell processes. This architectural change improves reliability, provides better process management, and enhances the user experience when executing AI-driven commands.

Key Changes

1. Terminal Architecture

  • Added a new BoltShell class to manage a persistent terminal session
  • Implemented command execution queue management
  • Added proper terminal initialization and cleanup
  • Introduced command execution state tracking
  • Added support for command interruption and process management

2. Action System Updates

  • Added new start action type for application startup operations
  • Modified ActionRunner to use the dedicated Bolt terminal
  • Updated action parsing to support the new action type
  • Improved error handling and logging for shell operations

3. UI Enhancements

  • Added dedicated "Bolt Terminal" tab in the terminal panel
  • Updated terminal UI to distinguish between AI and user terminals
  • Modified terminal icons and status indicators
  • Added proper terminal initialization states

4. Process Management

  • Implemented proper command execution lifecycle
  • Added support for command interruption
  • Improved error handling for failed commands
  • Added command execution state tracking

Technical Details

BoltShell Class

The new BoltShell class provides:

  • Persistent terminal session management
  • Command execution queuing
  • Process lifecycle management
  • OSC code handling for terminal states
  • Improved error handling

Action System Changes

  • New start action type specifically for development server operations
  • Modified action runner to use BoltShell for command execution
  • Updated action parser to support the new action types
  • Improved error handling and status reporting

Testing

  • Tested terminal initialization
  • Verified command execution and interruption
  • Tested multiple command scenarios
  • Verified proper cleanup and state management
  • Tested error scenarios and recovery

Migration Impact

  • No breaking changes for existing functionality
  • AI operations now use the dedicated terminal automatically
  • Existing terminal operations remain unchanged
  • No changes required for existing action implementations

Future Improvements

  • Add support for multiple AI terminals if needed
  • Add more sophisticated command queuing
  • detect terminal error and feedback to AI for auto correction

Preview

Screen.Recording.2024.11.09.at.12.56.43.PM.mp4

@thecodacus thecodacus marked this pull request as draft November 9, 2024 08:15
@thecodacus thecodacus marked this pull request as ready for review November 9, 2024 08:15
@chrismahoney chrismahoney added the enhancement New feature or request label Nov 9, 2024
@chrismahoney chrismahoney self-requested a review November 9, 2024 15:32
@coleam00
Copy link
Collaborator

coleam00 commented Nov 9, 2024

This is incredible, thank you so much @thecodacus! We are looking into merging this this weekend!

@wonderwhy-er
Copy link
Collaborator

Ouh, that was on my list of things, great addition!

@thecodacus
Copy link
Collaborator Author

thanks @wonderwhy-er , i can see there are lots of things that we have in bolt.new website is missing on the repo.
These are very needed things in terms of experience.
@coleam00 I have also raised another pr for code streaming please check that out as well

@chrismahoney chrismahoney self-assigned this Nov 10, 2024
@chrismahoney
Copy link
Collaborator

Taking this on to review & merge between tonight and tomorrow; already seen some vast improvements locally, and simplicity of not having to use dev tools for the console output.

I’ll reach out if there are edge cases or non-local scenarios I’d like to confirm are working. Thanks so much for giving this the time it deserves 🙌

@chrismahoney
Copy link
Collaborator

@thecodacus The repo name for this PR changed to dash-ai, could you update the PR? I'm reviewing based off of this same branch there for now.

@thecodacus
Copy link
Collaborator Author

@chrismahoney, I have set the name dash-ai from start when I forked it. I don't know if it will cause any issue in here. Shall rename it?

@chrismahoney
Copy link
Collaborator

I do see this occasionally, but I believe it's a function of the general prompt not playing well with my local qwen2.5-coder model. Despite the visual it performs the codegen/artifact steps. More an FYI so I can add an issue for this and the Bolt modifications syntax later.

image

@thecodacus
Copy link
Collaborator Author

thats weird, maybe addition of one extra command sometimes confusing the llm

@chrismahoney
Copy link
Collaborator

Oh okay, probably disregard for now. I'll review and if there are merge issues that may just be local for me vs. upstream.

@chrismahoney chrismahoney merged commit 0203cf9 into stackblitz-labs:main Nov 12, 2024
1 check passed
@veerababumanyam
Copy link

can someone please suggest me on preview. I tried all possible ways mentioned but not able to get preview. Windows, docker, multiple LLMs like OpenAI, Anthropic, Ollama with wen, phi, deepseek, llama. Did max tokens setting as well but not able to get preview. tried reinstalling but no help. It would be great if someone suggest how to get a preview. Thanks in advance

@chrismahoney
Copy link
Collaborator

If you’re running a small model, try to verify that preview is intact by running a prompt such as ‘Create a basic Hello World page using HTML5’. I know it’s simple, but if you’re having issues related to the context length of your model, that prompt fits within the context window and should result in a functional preview.

arsenikstiger pushed a commit to arsenikstiger/bolt.new-any-llm that referenced this pull request Nov 12, 2024
commit a081f8b
Merge: f1c5fbf 8c6e420
Author: Chris Mahoney <[email protected]>
Date:   Tue Nov 12 12:41:58 2024 -0600

    Merge pull request stackblitz-labs#213 from thecodacus/code-streaming

    feat(code-streaming): added code streaming to editor while AI is writing files

commit 8c6e420
Author: Anirban Kar <[email protected]>
Date:   Wed Nov 13 00:04:41 2024 +0530

    type fix

commit 32699fd
Author: Anirban Kar <[email protected]>
Date:   Wed Nov 13 00:03:33 2024 +0530

    made types optional and, workbench get repo fix

commit 5f46a18
Author: Anirban Kar <[email protected]>
Date:   Tue Nov 12 23:49:34 2024 +0530

    recreated the lock file

commit 6b37859
Author: Anirban Kar <[email protected]>
Date:   Tue Nov 12 23:47:27 2024 +0530

    temporary removed lock file

commit 58d95bd
Author: Anirban Kar <[email protected]>
Date:   Tue Nov 12 23:44:40 2024 +0530

    chore: recreated the lock file

commit a50945e
Author: Anirban Kar <[email protected]>
Date:   Tue Nov 12 23:39:44 2024 +0530

    chore: reverted pnpm lock

commit cc43f06
Author: Anirban Kar <[email protected]>
Date:   Tue Nov 12 23:36:18 2024 +0530

    chore: reverted pnpm package version to match ghaction

commit 2d270e7
Merge: 54351cd f1c5fbf
Author: Anirban Kar <[email protected]>
Date:   Tue Nov 12 23:20:30 2024 +0530

    Merge branch 'main' into code-streaming

commit f1c5fbf
Merge: 0203cf9 d7b1edc
Author: Chris Mahoney <[email protected]>
Date:   Tue Nov 12 10:46:30 2024 -0600

    Merge pull request stackblitz-labs#261 from chrismahoney/fix/remove-ghaction-titlecheck

    Temporarily removing semantic-pr.yaml

commit d7b1edc
Author: Chris Mahoney <[email protected]>
Date:   Tue Nov 12 10:34:51 2024 -0600

    Temporarily removing semantic-pr.yaml in order to verify otherwise ready for review PRs.

commit 0203cf9
Merge: 1630d80 f28f7f0
Author: Chris Mahoney <[email protected]>
Date:   Tue Nov 12 09:30:21 2024 -0600

    Merge pull request stackblitz-labs#228 from thecodacus/feature--bolt-shell

    feat(bolt terminal): added dedicated bolt terminal, and attached to workbench

commit 1630d80
Merge: 0b75051 b240344
Author: Cole Medin <[email protected]>
Date:   Mon Nov 11 18:40:30 2024 -0600

    Merge pull request stackblitz-labs#247 from JNN5/main

    fix: adds missing -t for dockerbuild:prod command in package.json

commit 0b75051
Merge: 4b492b9 9c84880
Author: Cole Medin <[email protected]>
Date:   Mon Nov 11 18:39:48 2024 -0600

    Merge pull request stackblitz-labs#254 from ali00209/new_bolt5

    fix: bug  stackblitz-labs#245

commit 9c84880
Author: ali00209 <[email protected]>
Date:   Tue Nov 12 05:10:54 2024 +0500

    fix: bug  stackblitz-labs#245

commit b240344
Author: Jonas Neumann <[email protected]>
Date:   Mon Nov 11 17:41:15 2024 +0800

    fix: adds missing -t for dockerbuild:prod command in package.json

commit 4b492b9
Merge: c968948 32ae66a
Author: Eduard Ruzga <[email protected]>
Date:   Mon Nov 11 09:58:05 2024 +0200

    Merge pull request stackblitz-labs#104 from karrot0/main

    feat: lm studio integration

commit 32ae66a
Merge: dff340e 6f8001a
Author: Karrot0 <[email protected]>
Date:   Sun Nov 10 21:08:06 2024 -0500

    Merge branch 'main' of https://github.com/karrot0/bolt.new-any-llm

commit dff340e
Author: Karrot0 <[email protected]>
Date:   Sun Nov 10 21:08:01 2024 -0500

    @wonderwhy-er suggestion fix pr

commit 6f8001a
Merge: 9a7d28a c968948
Author: Karrot <[email protected]>
Date:   Sun Nov 10 21:04:29 2024 -0500

    Merge branch 'coleam00:main' into main

commit c968948
Merge: 848c697 93ff797
Author: Chris Mahoney <[email protected]>
Date:   Sun Nov 10 17:16:10 2024 -0600

    Merge pull request stackblitz-labs#242 from aaronbolton/main

    removing GitHub action workflow github-build-push.yml

commit 93ff797
Merge: 1b44a0b 848c697
Author: Aaron Bolton <[email protected]>
Date:   Sun Nov 10 20:24:42 2024 +0000

    Merge branch 'main' of https://github.com/aaronbolton/bolt.new-any-llm

commit 1b44a0b
Author: Aaron Bolton <[email protected]>
Date:   Sun Nov 10 20:24:32 2024 +0000

    Delete github-build-push.yml

commit 848c697
Author: Cole Medin <[email protected]>
Date:   Sun Nov 10 13:43:28 2024 -0600

    Update README.md

commit 52ae333
Merge: ce6b65e c35211f
Author: Eduard Ruzga <[email protected]>
Date:   Sun Nov 10 15:06:51 2024 +0200

    Merge pull request stackblitz-labs#205 from milutinke/claude-new-sonnet-and-haiku

    feat: added the latest Sonnet 3.5 and Haiku 3.5

commit c35211f
Merge: bb0546d ce6b65e
Author: Anon <[email protected]>
Date:   Sun Nov 10 13:58:34 2024 +0100

    Merge branch 'main' into claude-new-sonnet-and-haiku

commit 9a7d28a
Merge: f9e750d ce6b65e
Author: Eduard Ruzga <[email protected]>
Date:   Sun Nov 10 14:55:17 2024 +0200

    Merge branch 'main' into main

commit ce6b65e
Merge: 13b1321 435d6b4
Author: Chris Mahoney <[email protected]>
Date:   Sat Nov 9 20:53:00 2024 -0600

    Merge pull request stackblitz-labs#178 from albahrani/patch-1

    docs: update README.md changed .env to .env.local

commit 13b1321
Author: Cole Medin <[email protected]>
Date:   Sat Nov 9 07:59:06 2024 -0600

    Noting that API key will still work if set in .env file

commit b3fe207
Author: Cole Medin <[email protected]>
Date:   Sat Nov 9 07:56:43 2024 -0600

    Fixing merge conflicts in BaseChat.tsx

commit 936a9c0
Merge: d18517a f30612d
Author: Cole Medin <[email protected]>
Date:   Sat Nov 9 07:45:06 2024 -0600

    Merge pull request stackblitz-labs#188 from TommyHolmberg/respect-provider-choice

    fix: respect provider choice from UI

commit f30612d
Merge: 9b97837 d18517a
Author: Cole Medin <[email protected]>
Date:   Sat Nov 9 07:44:40 2024 -0600

    Merge branch 'main' into respect-provider-choice

commit f28f7f0
Author: Anirban Kar <[email protected]>
Date:   Sat Nov 9 14:23:29 2024 +0530

    chore: cleanup logging

commit d4c4fe1
Author: Anirban Kar <[email protected]>
Date:   Sat Nov 9 13:43:19 2024 +0530

    feat: hyperlinked on "Start application"  actionto switch to preview in workbench

commit 719384c
Author: Anirban Kar <[email protected]>
Date:   Sat Nov 9 12:59:42 2024 +0530

    feat(bolt-terminal) bolt terminal integrated with the system

commit d18517a
Merge: 1ba0606 52cd1ae
Author: Chris Mahoney <[email protected]>
Date:   Fri Nov 8 23:22:45 2024 -0600

    Merge pull request stackblitz-labs#101 from ali00209/new_bolt1

    feat: add ability to enter API keys in the UI

commit 52cd1ae
Merge: 73a07c9 1ba0606
Author: Ali <[email protected]>
Date:   Sat Nov 9 09:59:21 2024 +0500

    Merge branch 'main' into new_bolt1

commit 73a07c9
Author: ali00209 <[email protected]>
Date:   Sat Nov 9 09:55:40 2024 +0500

    fix: Resolved

commit f9e750d
Merge: 73505a3 1ba0606
Author: Karrot <[email protected]>
Date:   Fri Nov 8 17:10:40 2024 -0500

    Merge branch 'main' into main

commit d1f3e8c
Author: Anirban Kar <[email protected]>
Date:   Fri Nov 8 21:47:31 2024 +0530

    feat: added bolt dedicated shell

commit 9b97837
Author: Tommy <[email protected]>
Date:   Fri Nov 8 08:51:22 2024 +0100

    Show which model name and provider is used in user message.

commit 54351cd
Author: Anirban Kar <[email protected]>
Date:   Fri Nov 8 11:14:15 2024 +0530

    feature(code-streaming): added code streaming to editor while AI is writing code

commit 1ba0606
Merge: 775283e dec6513
Author: Cole Medin <[email protected]>
Date:   Thu Nov 7 18:12:27 2024 -0600

    Merge pull request stackblitz-labs#209 from patrykwegrzyn/main

    feat: set numCtx = 32768 for Ollama models

commit dec6513
Author: Patryk Wegrzyn <[email protected]>
Date:   Thu Nov 7 23:51:12 2024 +0000

    Set numCtx = 32768 for Ollama models

commit bb0546d
Author: Anon <[email protected]>
Date:   Thu Nov 7 14:38:22 2024 +0100

    Added the latest Sonnet 3.5 and Haiku 3.5

commit 775283e
Merge: a6d81b1 8d7f108
Author: Cole Medin <[email protected]>
Date:   Thu Nov 7 06:29:01 2024 -0600

    Merge pull request stackblitz-labs#196 from milutinke/x-ai

    feat: added support for xAI Grok Beta

commit 8d7f108
Author: Anon <[email protected]>
Date:   Thu Nov 7 01:14:27 2024 +0100

    Added the XAI_API_KEY variable to the .env.example

commit 9a2fc92
Author: Anon <[email protected]>
Date:   Thu Nov 7 01:03:37 2024 +0100

    Added support for xAI Grok Beta

commit 73505a3
Merge: 27b6684 a6d81b1
Author: Karrot <[email protected]>
Date:   Wed Nov 6 15:52:24 2024 -0500

    Merge branch 'coleam00:main' into main

commit 2a362b9
Author: Tommy <[email protected]>
Date:   Wed Nov 6 21:35:54 2024 +0100

    Added sanitization for user messages.
    Use regex defined in constants.ts instead of redefining.

commit 074e2f3
Author: Tommy <[email protected]>
Date:   Wed Nov 6 11:10:08 2024 +0100

    Moved provider and setProvider variables to the higher level component so that it can be accessed in sendMessage.
    Added provider to message queue in sendMessage.
    Changed streamText to extract both model and provider.

commit 435d6b4
Author: Alexander Al-Bahrani <[email protected]>
Date:   Tue Nov 5 12:41:58 2024 +0100

    Update README.md changed .env to .env.local

    The installation description stated to create an .env file out of the .env.example
    This leads to an error when executing docker compose up since the docker-compose.yml expects the environment file being called .env.local

commit 27b6684
Merge: 449d0a3 e7ce257
Author: Karrot <[email protected]>
Date:   Sun Nov 3 16:21:16 2024 -0500

    Merge branch 'coleam00:main' into main

commit 449d0a3
Merge: 8dfc4f7 065be0f
Author: Karrot <[email protected]>
Date:   Wed Oct 30 14:52:23 2024 -0400

    Merge branch 'coleam00:main' into main

commit 8dfc4f7
Author: Karrot <[email protected]>
Date:   Wed Oct 30 13:05:57 2024 -0400

    Changed mode.ts to add BaseURL. Thanks @alumbs

commit 748e0d6
Author: Karrot <[email protected]>
Date:   Sun Oct 27 23:26:54 2024 -0400

    Remove Package-lock.json

commit 4edcc5e
Author: Karrot0 <[email protected]>
Date:   Sun Oct 27 23:16:07 2024 -0400

    LM Studio Integration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants