16 Commits

Author SHA1 Message Date
github-actions[bot]
5d3fb1d7de chore: release version 1.0.0 2025-05-12 01:53:53 +00:00
KevIsDev
c1474d85e5 Merge branch 'main' into stable 2025-05-12 02:45:27 +01:00
KevIsDev
3779000ec5 Revert "ci: reorder steps and add env vars for Electron build #release:major"
This reverts commit 9c0e898d17.
2025-05-12 02:15:31 +01:00
KevIsDev
9c0e898d17 ci: reorder steps and add env vars for Electron build #release:major
Reordered the "Commit and Tag Release" step to ensure it runs before uploading release assets. Added environment variables `GH_TOKEN`, `GITHUB_TOKEN`, and `NODE_OPTIONS` to the Electron build, added authentication and memory allocation during the build process.
2025-05-12 02:12:32 +01:00
KevIsDev
dee7fb0545 Merge branch 'main' into stable 2025-05-12 01:56:42 +01:00
KevIsDev
0e31267078 Merge branch 'main' into stable 2025-05-12 01:31:47 +01:00
Stijnus
332edd3d98 fix: settings bugfix error building my application issue #1414 (#1436)
* Fix: error building my application #1414

* fix for vite

* Update vite.config.ts

* Update root.tsx

* fix the root.tsx and the debugtab

* lm studio fix and fix for the api key

* Update api.enhancer for prompt enhancement

* bugfixes

* Revert api.enhancer.ts back to original code

* Update api.enhancer.ts

* Update api.git-proxy.$.ts

* Update api.git-proxy.$.ts

* Update api.enhancer.ts
2025-03-11 02:19:39 +05:30
github-actions[bot]
7045646b1a chore: release version 0.0.7 2025-02-28 20:13:16 +00:00
Leex
eb4aa68581 Update docker.yaml 2025-02-24 23:27:33 +01:00
Leex
73710da501 Update docker.yaml 2025-02-23 22:52:09 +01:00
Leex
a87eae2119 Update Dockerfile (fix docker deployment) 2025-02-23 22:37:38 +01:00
github-actions[bot]
ecf3cad189 chore: release version 0.0.6 2025-01-22 20:54:03 +00:00
github-actions[bot]
be7a754a74 chore: release version 0.0.5 2024-12-31 22:28:12 +00:00
github-actions[bot]
2a585ab5ea chore: release version 0.0.4 2024-12-31 17:17:51 +00:00
github-actions[bot]
eac1933094 chore: release version 0.0.3 2024-12-17 21:00:06 +00:00
github-actions[bot]
c36ab43dcc chore: release version 0.0.2 2024-12-16 21:50:28 +00:00
8 changed files with 132 additions and 91 deletions

View File

@@ -542,53 +542,8 @@ const FileInfo = memo(
}, },
); );
// Create and manage a single highlighter instance at the module level
let highlighterInstance: any = null;
let highlighterPromise: Promise<any> | null = null;
const getSharedHighlighter = async () => {
if (highlighterInstance) {
return highlighterInstance;
}
if (highlighterPromise) {
return highlighterPromise;
}
highlighterPromise = getHighlighter({
themes: ['github-dark', 'github-light'],
langs: [
'typescript',
'javascript',
'json',
'html',
'css',
'jsx',
'tsx',
'python',
'php',
'java',
'c',
'cpp',
'csharp',
'go',
'ruby',
'rust',
'plaintext',
],
});
highlighterInstance = await highlighterPromise;
highlighterPromise = null;
// Clear the promise once resolved
return highlighterInstance;
};
const InlineDiffComparison = memo(({ beforeCode, afterCode, filename, language }: CodeComparisonProps) => { const InlineDiffComparison = memo(({ beforeCode, afterCode, filename, language }: CodeComparisonProps) => {
const [isFullscreen, setIsFullscreen] = useState(false); const [isFullscreen, setIsFullscreen] = useState(false);
// Use state to hold the shared highlighter instance
const [highlighter, setHighlighter] = useState<any>(null); const [highlighter, setHighlighter] = useState<any>(null);
const theme = useStore(themeStore); const theme = useStore(themeStore);
@@ -599,32 +554,34 @@ const InlineDiffComparison = memo(({ beforeCode, afterCode, filename, language }
const { unifiedBlocks, hasChanges, isBinary, error } = useProcessChanges(beforeCode, afterCode); const { unifiedBlocks, hasChanges, isBinary, error } = useProcessChanges(beforeCode, afterCode);
useEffect(() => { useEffect(() => {
// Fetch the shared highlighter instance getHighlighter({
getSharedHighlighter().then(setHighlighter); themes: ['github-dark', 'github-light'],
langs: [
/* 'typescript',
* No cleanup needed here for the highlighter instance itself, 'javascript',
* as it's managed globally. Shiki instances don't typically 'json',
* need disposal unless you are dynamically loading/unloading themes/languages. 'html',
* If you were dynamically loading, you might need a more complex 'css',
* shared instance manager with reference counting or similar. 'jsx',
* For static themes/langs, a single instance is sufficient. 'tsx',
*/ 'python',
}, []); // Empty dependency array ensures this runs only once on mount 'php',
'java',
'c',
'cpp',
'csharp',
'go',
'ruby',
'rust',
'plaintext',
],
}).then(setHighlighter);
}, []);
if (isBinary || error) { if (isBinary || error) {
return renderContentWarning(isBinary ? 'binary' : 'error'); return renderContentWarning(isBinary ? 'binary' : 'error');
} }
// Render a loading state or null while highlighter is not ready
if (!highlighter) {
return (
<div className="h-full flex items-center justify-center">
<div className="text-bolt-elements-textTertiary">Loading diff...</div>
</div>
);
}
return ( return (
<FullscreenOverlay isFullscreen={isFullscreen}> <FullscreenOverlay isFullscreen={isFullscreen}>
<div className="w-full h-full flex flex-col"> <div className="w-full h-full flex flex-col">
@@ -645,7 +602,7 @@ const InlineDiffComparison = memo(({ beforeCode, afterCode, filename, language }
lineNumber={block.lineNumber} lineNumber={block.lineNumber}
content={block.content} content={block.content}
type={block.type} type={block.type}
highlighter={highlighter} // Pass the shared instance highlighter={highlighter}
language={language} language={language}
block={block} block={block}
theme={theme} theme={theme}

View File

@@ -108,9 +108,6 @@ export async function streamText(props: {
} }
const dynamicMaxTokens = modelDetails && modelDetails.maxTokenAllowed ? modelDetails.maxTokenAllowed : MAX_TOKENS; const dynamicMaxTokens = modelDetails && modelDetails.maxTokenAllowed ? modelDetails.maxTokenAllowed : MAX_TOKENS;
logger.info(
`Max tokens for model ${modelDetails.name} is ${dynamicMaxTokens} based on ${modelDetails.maxTokenAllowed} or ${MAX_TOKENS}`,
);
let systemPrompt = let systemPrompt =
PromptLibrary.getPropmtFromLibrary(promptId || 'default', { PromptLibrary.getPropmtFromLibrary(promptId || 'default', {

View File

@@ -45,6 +45,14 @@ The year is 2025.
</technology_preferences> </technology_preferences>
<running_shell_commands_info> <running_shell_commands_info>
With each user request, you are provided with information about the shell command that is currently running.
Example:
<bolt_running_commands>
npm run dev
</bolt_running_commands>
CRITICAL: CRITICAL:
- NEVER mention or reference the XML tags or structure of this process list in your responses - NEVER mention or reference the XML tags or structure of this process list in your responses
- DO NOT repeat or directly quote any part of the command information provided - DO NOT repeat or directly quote any part of the command information provided
@@ -278,7 +286,6 @@ The year is 2025.
- Follow the guidelines for shell commands. - Follow the guidelines for shell commands.
- Use the start action type over the shell type ONLY when the command is intended to start the project. - Use the start action type over the shell type ONLY when the command is intended to start the project.
- IMPORTANT: Always execute the start command after executing a shell command.
- file: For creating new files or updating existing files. Add \`filePath\` and \`contentType\` attributes: - file: For creating new files or updating existing files. Add \`filePath\` and \`contentType\` attributes:
@@ -310,7 +317,7 @@ The year is 2025.
11. Prioritize installing required dependencies by updating \`package.json\` first. 11. Prioritize installing required dependencies by updating \`package.json\` first.
- If a \`package.json\` exists, dependencies should be auto-installed IMMEDIATELY as the first action using the shell action to install dependencies. - If a \`package.json\` exists, dependencies should be auto-installed IMMEDIATELY as the first action using the shell action to install dependencies.
- If you need to update the \`package.json\` file make sure it's the FIRST action, so dependencies can install in parallel to the rest of the response being streamed this should ALWAYS be done inside the artifact. - If you need to update the \`package.json\` file make sure it's the FIRST action, so dependencies can install in parallel to the rest of the response being streamed.
- \`npm install\` will not automatically run every time \`package.json\` is updated, so you need to include a shell action to install dependencies. - \`npm install\` will not automatically run every time \`package.json\` is updated, so you need to include a shell action to install dependencies.
- Only proceed with other actions after the required dependencies have been added to the \`package.json\`. - Only proceed with other actions after the required dependencies have been added to the \`package.json\`.
@@ -318,7 +325,7 @@ The year is 2025.
12. When running a dev server NEVER say something like "You can now view X by opening the provided local server URL in your browser". The preview will be opened automatically or by the user manually! 12. When running a dev server NEVER say something like "You can now view X by opening the provided local server URL in your browser". The preview will be opened automatically or by the user manually!
13. Always include a start command in the artifact, The start command should be the LAST action in the artifact. 13. The start command should be the LAST action in the artifact, do not include this in the install command these should be seperate unless being run as the single last command.
</artifact_instructions> </artifact_instructions>
<design_instructions> <design_instructions>
@@ -640,8 +647,7 @@ function App() {
} }
export default App;</boltAction> export default App;</boltAction>
<boltAction type="file" filePath="src/App.css" contentType="content">.container {
<boltAction type="file" filePath="src/App.css" contentType="content"> {
max-width: 800px; max-width: 800px;
margin: 0 auto; margin: 0 auto;
padding: 20px; padding: 20px;
@@ -692,6 +698,25 @@ export default App;</boltAction>
npm run dev npm run dev
</boltAction> </boltAction>
</boltArtifact> </boltArtifact>
I've created a demonstration of three different ways to center a div:
1. **Using Flexbox** - This is the most recommended modern approach:
- Set the parent container to \`display: flex\`
- Use \`justify-content: center\` for horizontal centering
- Use \`align-items: center\` for vertical centering
2. **Using CSS Grid** - Even simpler than flexbox in some cases:
- Set the parent container to \`display: grid\`
- Use \`place-items: center\` to center in both directions at once
3. **Using Position Absolute** - The traditional method:
- Set the parent to \`position: relative\`
- Set the child to \`position: absolute\`
- Use \`top: 50%; left: 50%\` to position at the center
- Use \`transform: translate(-50%, -50%)\` to adjust for the element's size
The flexbox method is generally the most versatile and recommended approach for most centering needs in modern web development.</assistant_response>
</example> </example>
</examples>`; </examples>`;

View File

@@ -17,7 +17,7 @@ export default class AnthropicProvider extends BaseProvider {
name: 'claude-3-7-sonnet-20250219', name: 'claude-3-7-sonnet-20250219',
label: 'Claude 3.7 Sonnet', label: 'Claude 3.7 Sonnet',
provider: 'Anthropic', provider: 'Anthropic',
maxTokenAllowed: 128000, maxTokenAllowed: 8000,
}, },
{ {
name: 'claude-3-5-sonnet-latest', name: 'claude-3-5-sonnet-latest',
@@ -95,7 +95,6 @@ export default class AnthropicProvider extends BaseProvider {
}); });
const anthropic = createAnthropic({ const anthropic = createAnthropic({
apiKey, apiKey,
headers: { 'anthropic-beta': 'output-128k-2025-02-19' },
}); });
return anthropic(model); return anthropic(model);

View File

@@ -199,7 +199,7 @@ ${value.content}
const takeSnapshot = useCallback( const takeSnapshot = useCallback(
async (chatIdx: string, files: FileMap, _chatId?: string | undefined, chatSummary?: string) => { async (chatIdx: string, files: FileMap, _chatId?: string | undefined, chatSummary?: string) => {
const id = chatId.get(); const id = _chatId || chatId.get();
if (!id || !db) { if (!id || !db) {
return; return;

View File

@@ -692,9 +692,27 @@ export class FilesStore {
#processEventBuffer(events: Array<[events: PathWatcherEvent[]]>) { #processEventBuffer(events: Array<[events: PathWatcherEvent[]]>) {
const watchEvents = events.flat(2); const watchEvents = events.flat(2);
for (const { type, path, buffer } of watchEvents) { for (const { type, path: eventPath, buffer } of watchEvents) {
// remove any trailing slashes // remove any trailing slashes
const sanitizedPath = path.replace(/\/+$/g, ''); const sanitizedPath = eventPath.replace(/\/+$/g, '');
// Skip processing if this file/folder was explicitly deleted
if (this.#deletedPaths.has(sanitizedPath)) {
continue;
}
let isInDeletedFolder = false;
for (const deletedPath of this.#deletedPaths) {
if (sanitizedPath.startsWith(deletedPath + '/')) {
isInDeletedFolder = true;
break;
}
}
if (isInDeletedFolder) {
continue;
}
switch (type) { switch (type) {
case 'add_dir': { case 'add_dir': {
@@ -720,21 +738,38 @@ export class FilesStore {
} }
let content = ''; let content = '';
/**
* @note This check is purely for the editor. The way we detect this is not
* bullet-proof and it's a best guess so there might be false-positives.
* The reason we do this is because we don't want to display binary files
* in the editor nor allow to edit them.
*/
const isBinary = isBinaryFile(buffer); const isBinary = isBinaryFile(buffer);
if (!isBinary) { if (isBinary && buffer) {
// For binary files, we need to preserve the content as base64
content = Buffer.from(buffer).toString('base64');
} else if (!isBinary) {
content = this.#decodeFileContent(buffer); content = this.#decodeFileContent(buffer);
/*
* If the content is a single space and this is from our empty file workaround,
* convert it back to an actual empty string
*/
if (content === ' ' && type === 'add_file') {
content = '';
}
} }
this.files.setKey(sanitizedPath, { type: 'file', content, isBinary }); const existingFile = this.files.get()[sanitizedPath];
if (existingFile?.type === 'file' && existingFile.isBinary && existingFile.content && !content) {
content = existingFile.content;
}
// Preserve lock state if the file already exists
const isLocked = existingFile?.type === 'file' ? existingFile.isLocked : false;
this.files.setKey(sanitizedPath, {
type: 'file',
content,
isBinary,
isLocked,
});
break; break;
} }
case 'remove_file': { case 'remove_file': {

View File

@@ -1,5 +1,4 @@
import { type ActionFunctionArgs, json } from '@remix-run/cloudflare'; import { type ActionFunctionArgs, json } from '@remix-run/cloudflare';
import crypto from 'crypto';
import type { NetlifySiteInfo } from '~/types/netlify'; import type { NetlifySiteInfo } from '~/types/netlify';
interface DeployRequestBody { interface DeployRequestBody {
@@ -8,6 +7,15 @@ interface DeployRequestBody {
chatId: string; chatId: string;
} }
async function sha1(message: string) {
const msgBuffer = new TextEncoder().encode(message);
const hashBuffer = await crypto.subtle.digest('SHA-1', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map((b) => b.toString(16).padStart(2, '0')).join('');
return hashHex;
}
export async function action({ request }: ActionFunctionArgs) { export async function action({ request }: ActionFunctionArgs) {
try { try {
const { siteId, files, token, chatId } = (await request.json()) as DeployRequestBody & { token: string }; const { siteId, files, token, chatId } = (await request.json()) as DeployRequestBody & { token: string };
@@ -104,7 +112,7 @@ export async function action({ request }: ActionFunctionArgs) {
for (const [filePath, content] of Object.entries(files)) { for (const [filePath, content] of Object.entries(files)) {
// Ensure file path starts with a forward slash // Ensure file path starts with a forward slash
const normalizedPath = filePath.startsWith('/') ? filePath : '/' + filePath; const normalizedPath = filePath.startsWith('/') ? filePath : '/' + filePath;
const hash = crypto.createHash('sha1').update(content).digest('hex'); const hash = await sha1(content);
fileDigests[normalizedPath] = hash; fileDigests[normalizedPath] = hash;
} }

View File

@@ -93,6 +93,26 @@ export default defineConfig((config) => {
}, },
build: { build: {
target: 'esnext', target: 'esnext',
rollupOptions: {
output: {
format: 'esm',
},
},
commonjsOptions: {
transformMixedEsModules: true,
},
},
optimizeDeps: {
esbuildOptions: {
define: {
global: 'globalThis',
},
},
},
resolve: {
alias: {
buffer: 'vite-plugin-node-polyfills/polyfills/buffer',
},
}, },
plugins: [ plugins: [
nodePolyfills({ nodePolyfills({