Dominic Elm commited on
Commit
e8447db
·
unverified ·
1 Parent(s): 6c39477

fix: adjust system prompt (#32)

Browse files
packages/bolt/app/components/editor/codemirror/languages.ts CHANGED
@@ -78,6 +78,20 @@ export const supportedLanguages = [
78
  return import('@codemirror/lang-wast').then((module) => module.wast());
79
  },
80
  }),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  ];
82
 
83
  export async function getLanguage(fileName: string) {
 
78
  return import('@codemirror/lang-wast').then((module) => module.wast());
79
  },
80
  }),
81
+ LanguageDescription.of({
82
+ name: 'Python',
83
+ extensions: ['py'],
84
+ async load() {
85
+ return import('@codemirror/lang-python').then((module) => module.python());
86
+ },
87
+ }),
88
+ LanguageDescription.of({
89
+ name: 'C++',
90
+ extensions: ['cpp'],
91
+ async load() {
92
+ return import('@codemirror/lang-cpp').then((module) => module.cpp());
93
+ },
94
+ }),
95
  ];
96
 
97
  export async function getLanguage(fileName: string) {
packages/bolt/app/lib/.server/llm/prompts.ts CHANGED
@@ -5,7 +5,18 @@ export const getSystemPrompt = (cwd: string = WORK_DIR) => `
5
  You are Bolt, an expert AI assistant and exceptional senior software developer with vast knowledge across multiple programming languages, frameworks, and best practices.
6
 
7
  <system_constraints>
8
- You are operating in an environment called WebContainer, an in-browser Node.js runtime that emulates a Linux system to some degree. However, it runs in the browser and doesn't run a full-fledged Linux system and doesn't rely on a cloud VM to execute code. All code is executed in the browser. It does come with a shell that emulates zsh. The container cannot run native binaries since those cannot be executed in the browser. That means it can only execute code that is native to a browser including JS, WebAssembly, etc. The shell comes with a \`python\` binary but it CANNOT rely on 3rd party dependencies and doesn't have \`pip\` support nor networking support. It's LIMITED TO VANILLA Python. The assistant should keep that in mind.
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  WebContainer has the ability to run a web server but requires to use an npm package (e.g., Vite, servor, serve, http-server) or use the Node.js APIs to implement a web server.
11
 
@@ -116,7 +127,7 @@ You are Bolt, an expert AI assistant and exceptional senior software developer w
116
  11. CRITICAL: Always provide the FULL, updated content of the artifact. This means:
117
 
118
  - Include ALL code, even if parts are unchanged
119
- - NEVER use placeholders like "// rest of the code remains the same..." or "<- leave original code here ->"
120
  - ALWAYS show the complete, up-to-date file contents when updating files
121
  - Avoid any form of truncation or summarization
122
 
 
5
  You are Bolt, an expert AI assistant and exceptional senior software developer with vast knowledge across multiple programming languages, frameworks, and best practices.
6
 
7
  <system_constraints>
8
+ You are operating in an environment called WebContainer, an in-browser Node.js runtime that emulates a Linux system to some degree. However, it runs in the browser and doesn't run a full-fledged Linux system and doesn't rely on a cloud VM to execute code. All code is executed in the browser. It does come with a shell that emulates zsh. The container cannot run native binaries since those cannot be executed in the browser. That means it can only execute code that is native to a browser including JS, WebAssembly, etc.
9
+
10
+ The shell comes with \`python\` and \`python3\` binaries, but they are LIMITED TO THE PYTHON STANDARD LIBRARY ONLY This means:
11
+
12
+ - There is NO \`pip\` support! If you attempt to use \`pip\`, you should explicitly state that it's not available.
13
+ - CRITICAL: Third-party libraries cannot be installed or imported.
14
+ - Even some standard library modules that require additional system dependencies (like \`curses\`) are not available.
15
+ - Only modules from the core Python standard library can be used.
16
+
17
+ Additionally, there is no \`g++\` or any C/C++ compiler available. WebContainer CANNOT run native binaries or compile C/C++ code!
18
+
19
+ Keep these limitations in mind when suggesting Python or C++ solutions and explicitly mention these constraints if relevant to the task at hand.
20
 
21
  WebContainer has the ability to run a web server but requires to use an npm package (e.g., Vite, servor, serve, http-server) or use the Node.js APIs to implement a web server.
22
 
 
127
  11. CRITICAL: Always provide the FULL, updated content of the artifact. This means:
128
 
129
  - Include ALL code, even if parts are unchanged
130
+ - NEVER use placeholders like "// rest of the code remains the same..." or "<- leave original code here ->"
131
  - ALWAYS show the complete, up-to-date file contents when updating files
132
  - Avoid any form of truncation or summarization
133
 
packages/bolt/package.json CHANGED
@@ -19,11 +19,13 @@
19
  "@ai-sdk/anthropic": "^0.0.30",
20
  "@codemirror/autocomplete": "^6.17.0",
21
  "@codemirror/commands": "^6.6.0",
 
22
  "@codemirror/lang-css": "^6.2.1",
23
  "@codemirror/lang-html": "^6.4.9",
24
  "@codemirror/lang-javascript": "^6.2.2",
25
  "@codemirror/lang-json": "^6.0.1",
26
  "@codemirror/lang-markdown": "^6.2.5",
 
27
  "@codemirror/lang-sass": "^6.0.2",
28
  "@codemirror/lang-wast": "^6.0.2",
29
  "@codemirror/language": "^6.10.2",
 
19
  "@ai-sdk/anthropic": "^0.0.30",
20
  "@codemirror/autocomplete": "^6.17.0",
21
  "@codemirror/commands": "^6.6.0",
22
+ "@codemirror/lang-cpp": "^6.0.2",
23
  "@codemirror/lang-css": "^6.2.1",
24
  "@codemirror/lang-html": "^6.4.9",
25
  "@codemirror/lang-javascript": "^6.2.2",
26
  "@codemirror/lang-json": "^6.0.1",
27
  "@codemirror/lang-markdown": "^6.2.5",
28
+ "@codemirror/lang-python": "^6.1.6",
29
  "@codemirror/lang-sass": "^6.0.2",
30
  "@codemirror/lang-wast": "^6.0.2",
31
  "@codemirror/language": "^6.10.2",
pnpm-lock.yaml CHANGED
@@ -44,6 +44,9 @@ importers:
44
  '@codemirror/commands':
45
  specifier: ^6.6.0
46
  version: 6.6.0
 
 
 
47
  '@codemirror/lang-css':
48
  specifier: ^6.2.1
49
  version: 6.2.1(@codemirror/[email protected])
@@ -59,6 +62,9 @@ importers:
59
  '@codemirror/lang-markdown':
60
  specifier: ^6.2.5
61
  version: 6.2.5
 
 
 
62
  '@codemirror/lang-sass':
63
  specifier: ^6.0.2
64
  version: 6.0.2(@codemirror/[email protected])
@@ -526,6 +532,9 @@ packages:
526
  '@codemirror/[email protected]':
527
  resolution: {integrity: sha512-qnY+b7j1UNcTS31Eenuc/5YJB6gQOzkUoNmJQc0rznwqSRpeaWWpjkWy2C/MPTcePpsKJEM26hXrOXl1+nceXg==}
528
 
 
 
 
529
  '@codemirror/[email protected]':
530
  resolution: {integrity: sha512-/UNWDNV5Viwi/1lpr/dIXJNWiwDxpw13I4pTUAsNxZdg6E0mI2kTQb0P2iHczg1Tu+H4EBgJR+hYhKiHKko7qg==}
531
 
@@ -541,6 +550,9 @@ packages:
541
  '@codemirror/[email protected]':
542
  resolution: {integrity: sha512-Hgke565YcO4fd9pe2uLYxnMufHO5rQwRr+AAhFq8ABuhkrjyX8R5p5s+hZUTdV60O0dMRjxKhBLxz8pu/MkUVA==}
543
 
 
 
 
544
  '@codemirror/[email protected]':
545
  resolution: {integrity: sha512-l/bdzIABvnTo1nzdY6U+kPAC51czYQcOErfzQ9zSm9D8GmNPD0WTW8st/CJwBTPLO8jlrbyvlSEcN20dc4iL0Q==}
546
 
@@ -1135,6 +1147,9 @@ packages:
1135
  '@lezer/[email protected]':
1136
  resolution: {integrity: sha512-yemX0ZD2xS/73llMZIK6KplkjIjf2EvAHcinDi/TfJ9hS25G0388+ClHt6/3but0oOxinTcQHJLDXh6w1crzFQ==}
1137
 
 
 
 
1138
  '@lezer/[email protected]':
1139
  resolution: {integrity: sha512-7JhxupKuMBaWQKjQoLtzhGj83DdnZY9MckEOG5+/iLKNK2ZJqKc6hf6uc0HjwCX7Qlok44jBNqZhHKDhEhZYLA==}
1140
 
@@ -1156,6 +1171,9 @@ packages:
1156
  '@lezer/[email protected]':
1157
  resolution: {integrity: sha512-ErbEQ15eowmJUyT095e9NJc3BI9yZ894fjSDtHftD0InkfUBGgnKSU6dvan9jqsZuNHg2+ag/1oyDRxNsENupQ==}
1158
 
 
 
 
1159
  '@lezer/[email protected]':
1160
  resolution: {integrity: sha512-w/RCO2dIzZH1To8p+xjs8cE+yfgGus8NZ/dXeWl/QzHyr+TeBs71qiE70KPImEwvTsmEjoWh0A5SxMzKd5BWBQ==}
1161
 
@@ -5469,6 +5487,11 @@ snapshots:
5469
  '@codemirror/view': 6.28.4
5470
  '@lezer/common': 1.2.1
5471
 
 
 
 
 
 
5472
  '@codemirror/[email protected](@codemirror/[email protected])':
5473
  dependencies:
5474
  '@codemirror/autocomplete': 6.17.0(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@lezer/[email protected])
@@ -5516,6 +5539,16 @@ snapshots:
5516
  '@lezer/common': 1.2.1
5517
  '@lezer/markdown': 1.3.0
5518
 
 
 
 
 
 
 
 
 
 
 
5519
  '@codemirror/[email protected](@codemirror/[email protected])':
5520
  dependencies:
5521
  '@codemirror/lang-css': 6.2.1(@codemirror/[email protected])
@@ -5990,6 +6023,12 @@ snapshots:
5990
 
5991
  '@lezer/[email protected]': {}
5992
 
 
 
 
 
 
 
5993
  '@lezer/[email protected]':
5994
  dependencies:
5995
  '@lezer/common': 1.2.1
@@ -6027,6 +6066,12 @@ snapshots:
6027
  '@lezer/common': 1.2.1
6028
  '@lezer/highlight': 1.2.0
6029
 
 
 
 
 
 
 
6030
  '@lezer/[email protected]':
6031
  dependencies:
6032
  '@lezer/common': 1.2.1
 
44
  '@codemirror/commands':
45
  specifier: ^6.6.0
46
  version: 6.6.0
47
+ '@codemirror/lang-cpp':
48
+ specifier: ^6.0.2
49
+ version: 6.0.2
50
  '@codemirror/lang-css':
51
  specifier: ^6.2.1
52
  version: 6.2.1(@codemirror/[email protected])
 
62
  '@codemirror/lang-markdown':
63
  specifier: ^6.2.5
64
  version: 6.2.5
65
+ '@codemirror/lang-python':
66
+ specifier: ^6.1.6
67
+ version: 6.1.6(@codemirror/[email protected])
68
  '@codemirror/lang-sass':
69
  specifier: ^6.0.2
70
  version: 6.0.2(@codemirror/[email protected])
 
532
  '@codemirror/[email protected]':
533
  resolution: {integrity: sha512-qnY+b7j1UNcTS31Eenuc/5YJB6gQOzkUoNmJQc0rznwqSRpeaWWpjkWy2C/MPTcePpsKJEM26hXrOXl1+nceXg==}
534
 
535
+ '@codemirror/[email protected]':
536
+ resolution: {integrity: sha512-6oYEYUKHvrnacXxWxYa6t4puTlbN3dgV662BDfSH8+MfjQjVmP697/KYTDOqpxgerkvoNm7q5wlFMBeX8ZMocg==}
537
+
538
  '@codemirror/[email protected]':
539
  resolution: {integrity: sha512-/UNWDNV5Viwi/1lpr/dIXJNWiwDxpw13I4pTUAsNxZdg6E0mI2kTQb0P2iHczg1Tu+H4EBgJR+hYhKiHKko7qg==}
540
 
 
550
  '@codemirror/[email protected]':
551
  resolution: {integrity: sha512-Hgke565YcO4fd9pe2uLYxnMufHO5rQwRr+AAhFq8ABuhkrjyX8R5p5s+hZUTdV60O0dMRjxKhBLxz8pu/MkUVA==}
552
 
553
+ '@codemirror/[email protected]':
554
+ resolution: {integrity: sha512-ai+01WfZhWqM92UqjnvorkxosZ2aq2u28kHvr+N3gu012XqY2CThD67JPMHnGceRfXPDBmn1HnyqowdpF57bNg==}
555
+
556
  '@codemirror/[email protected]':
557
  resolution: {integrity: sha512-l/bdzIABvnTo1nzdY6U+kPAC51czYQcOErfzQ9zSm9D8GmNPD0WTW8st/CJwBTPLO8jlrbyvlSEcN20dc4iL0Q==}
558
 
 
1147
  '@lezer/[email protected]':
1148
  resolution: {integrity: sha512-yemX0ZD2xS/73llMZIK6KplkjIjf2EvAHcinDi/TfJ9hS25G0388+ClHt6/3but0oOxinTcQHJLDXh6w1crzFQ==}
1149
 
1150
+ '@lezer/[email protected]':
1151
+ resolution: {integrity: sha512-macwKtyeUO0EW86r3xWQCzOV9/CF8imJLpJlPv3sDY57cPGeUZ8gXWOWNlJr52TVByMV3PayFQCA5SHEERDmVQ==}
1152
+
1153
  '@lezer/[email protected]':
1154
  resolution: {integrity: sha512-7JhxupKuMBaWQKjQoLtzhGj83DdnZY9MckEOG5+/iLKNK2ZJqKc6hf6uc0HjwCX7Qlok44jBNqZhHKDhEhZYLA==}
1155
 
 
1171
  '@lezer/[email protected]':
1172
  resolution: {integrity: sha512-ErbEQ15eowmJUyT095e9NJc3BI9yZ894fjSDtHftD0InkfUBGgnKSU6dvan9jqsZuNHg2+ag/1oyDRxNsENupQ==}
1173
 
1174
+ '@lezer/[email protected]':
1175
+ resolution: {integrity: sha512-ykDOb2Ti24n76PJsSa4ZoDF0zH12BSw1LGfQXCYJhJyOGiFTfGaX0Du66Ze72R+u/P35U+O6I9m8TFXov1JzsA==}
1176
+
1177
  '@lezer/[email protected]':
1178
  resolution: {integrity: sha512-w/RCO2dIzZH1To8p+xjs8cE+yfgGus8NZ/dXeWl/QzHyr+TeBs71qiE70KPImEwvTsmEjoWh0A5SxMzKd5BWBQ==}
1179
 
 
5487
  '@codemirror/view': 6.28.4
5488
  '@lezer/common': 1.2.1
5489
 
5490
+ '@codemirror/[email protected]':
5491
+ dependencies:
5492
+ '@codemirror/language': 6.10.2
5493
+ '@lezer/cpp': 1.1.2
5494
+
5495
  '@codemirror/[email protected](@codemirror/[email protected])':
5496
  dependencies:
5497
  '@codemirror/autocomplete': 6.17.0(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@lezer/[email protected])
 
5539
  '@lezer/common': 1.2.1
5540
  '@lezer/markdown': 1.3.0
5541
 
5542
+ '@codemirror/[email protected](@codemirror/[email protected])':
5543
+ dependencies:
5544
+ '@codemirror/autocomplete': 6.17.0(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])(@lezer/[email protected])
5545
+ '@codemirror/language': 6.10.2
5546
+ '@codemirror/state': 6.4.1
5547
+ '@lezer/common': 1.2.1
5548
+ '@lezer/python': 1.1.14
5549
+ transitivePeerDependencies:
5550
+ - '@codemirror/view'
5551
+
5552
  '@codemirror/[email protected](@codemirror/[email protected])':
5553
  dependencies:
5554
  '@codemirror/lang-css': 6.2.1(@codemirror/[email protected])
 
6023
 
6024
  '@lezer/[email protected]': {}
6025
 
6026
+ '@lezer/[email protected]':
6027
+ dependencies:
6028
+ '@lezer/common': 1.2.1
6029
+ '@lezer/highlight': 1.2.0
6030
+ '@lezer/lr': 1.4.1
6031
+
6032
  '@lezer/[email protected]':
6033
  dependencies:
6034
  '@lezer/common': 1.2.1
 
6066
  '@lezer/common': 1.2.1
6067
  '@lezer/highlight': 1.2.0
6068
 
6069
+ '@lezer/[email protected]':
6070
+ dependencies:
6071
+ '@lezer/common': 1.2.1
6072
+ '@lezer/highlight': 1.2.0
6073
+ '@lezer/lr': 1.4.1
6074
+
6075
  '@lezer/[email protected]':
6076
  dependencies:
6077
  '@lezer/common': 1.2.1