klaude-code 2.10.2__py3-none-any.whl → 2.10.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- klaude_code/auth/AGENTS.md +4 -24
- klaude_code/auth/__init__.py +1 -17
- klaude_code/cli/auth_cmd.py +3 -53
- klaude_code/cli/list_model.py +0 -50
- klaude_code/config/assets/builtin_config.yaml +7 -35
- klaude_code/config/config.py +5 -42
- klaude_code/const.py +5 -2
- klaude_code/core/agent_profile.py +2 -10
- klaude_code/core/backtrack/__init__.py +3 -0
- klaude_code/core/backtrack/manager.py +48 -0
- klaude_code/core/memory.py +25 -9
- klaude_code/core/task.py +53 -7
- klaude_code/core/tool/__init__.py +2 -0
- klaude_code/core/tool/backtrack/__init__.py +3 -0
- klaude_code/core/tool/backtrack/backtrack_tool.md +17 -0
- klaude_code/core/tool/backtrack/backtrack_tool.py +65 -0
- klaude_code/core/tool/context.py +5 -0
- klaude_code/core/turn.py +3 -0
- klaude_code/llm/anthropic/input.py +28 -4
- klaude_code/llm/input_common.py +70 -1
- klaude_code/llm/openai_compatible/input.py +5 -2
- klaude_code/llm/openrouter/input.py +5 -2
- klaude_code/llm/registry.py +0 -1
- klaude_code/protocol/events.py +10 -0
- klaude_code/protocol/llm_param.py +0 -1
- klaude_code/protocol/message.py +10 -1
- klaude_code/protocol/tools.py +1 -0
- klaude_code/session/session.py +111 -2
- klaude_code/session/store.py +2 -0
- klaude_code/skill/assets/executing-plans/SKILL.md +84 -0
- klaude_code/skill/assets/writing-plans/SKILL.md +116 -0
- klaude_code/tui/commands.py +15 -0
- klaude_code/tui/components/developer.py +1 -1
- klaude_code/tui/components/errors.py +2 -4
- klaude_code/tui/components/metadata.py +5 -10
- klaude_code/tui/components/rich/markdown.py +5 -1
- klaude_code/tui/components/rich/status.py +7 -76
- klaude_code/tui/components/rich/theme.py +12 -2
- klaude_code/tui/components/tools.py +31 -18
- klaude_code/tui/components/user_input.py +1 -1
- klaude_code/tui/display.py +4 -0
- klaude_code/tui/input/completers.py +51 -17
- klaude_code/tui/input/images.py +127 -0
- klaude_code/tui/input/prompt_toolkit.py +16 -2
- klaude_code/tui/machine.py +26 -8
- klaude_code/tui/renderer.py +97 -0
- klaude_code/tui/runner.py +7 -2
- klaude_code/tui/terminal/image.py +28 -12
- klaude_code/ui/terminal/title.py +8 -3
- {klaude_code-2.10.2.dist-info → klaude_code-2.10.4.dist-info}/METADATA +1 -1
- {klaude_code-2.10.2.dist-info → klaude_code-2.10.4.dist-info}/RECORD +53 -56
- klaude_code/auth/antigravity/__init__.py +0 -20
- klaude_code/auth/antigravity/exceptions.py +0 -17
- klaude_code/auth/antigravity/oauth.py +0 -315
- klaude_code/auth/antigravity/pkce.py +0 -25
- klaude_code/auth/antigravity/token_manager.py +0 -27
- klaude_code/core/prompts/prompt-antigravity.md +0 -80
- klaude_code/llm/antigravity/__init__.py +0 -3
- klaude_code/llm/antigravity/client.py +0 -558
- klaude_code/llm/antigravity/input.py +0 -268
- klaude_code/skill/assets/create-plan/SKILL.md +0 -74
- {klaude_code-2.10.2.dist-info → klaude_code-2.10.4.dist-info}/WHEEL +0 -0
- {klaude_code-2.10.2.dist-info → klaude_code-2.10.4.dist-info}/entry_points.txt +0 -0
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
"""OAuth PKCE flow for Antigravity authentication."""
|
|
2
|
-
|
|
3
|
-
import base64
|
|
4
|
-
import json
|
|
5
|
-
import secrets
|
|
6
|
-
import time
|
|
7
|
-
import webbrowser
|
|
8
|
-
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
9
|
-
from threading import Thread
|
|
10
|
-
from typing import Any, cast
|
|
11
|
-
from urllib.parse import parse_qs, urlencode, urlparse
|
|
12
|
-
|
|
13
|
-
import httpx
|
|
14
|
-
|
|
15
|
-
from klaude_code.auth.antigravity.exceptions import (
|
|
16
|
-
AntigravityNotLoggedInError,
|
|
17
|
-
AntigravityOAuthError,
|
|
18
|
-
AntigravityTokenExpiredError,
|
|
19
|
-
)
|
|
20
|
-
from klaude_code.auth.antigravity.pkce import generate_pkce
|
|
21
|
-
from klaude_code.auth.antigravity.token_manager import AntigravityAuthState, AntigravityTokenManager
|
|
22
|
-
|
|
23
|
-
# OAuth configuration (decoded from base64 for compatibility with pi implementation)
|
|
24
|
-
CLIENT_ID = base64.b64decode(
|
|
25
|
-
"MTA3MTAwNjA2MDU5MS10bWhzc2luMmgyMWxjcmUyMzV2dG9sb2poNGc0MDNlcC5hcHBzLmdvb2dsZXVzZXJjb250ZW50LmNvbQ=="
|
|
26
|
-
).decode()
|
|
27
|
-
CLIENT_SECRET = base64.b64decode("R09DU1BYLUs1OEZXUjQ4NkxkTEoxbUxCOHNYQzR6NnFEQWY=").decode()
|
|
28
|
-
REDIRECT_URI = "http://localhost:51121/oauth-callback"
|
|
29
|
-
REDIRECT_PORT = 51121
|
|
30
|
-
|
|
31
|
-
# Google OAuth endpoints
|
|
32
|
-
AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth"
|
|
33
|
-
TOKEN_URL = "https://oauth2.googleapis.com/token"
|
|
34
|
-
|
|
35
|
-
# Antigravity requires additional scopes
|
|
36
|
-
SCOPES = [
|
|
37
|
-
"https://www.googleapis.com/auth/cloud-platform",
|
|
38
|
-
"https://www.googleapis.com/auth/userinfo.email",
|
|
39
|
-
"https://www.googleapis.com/auth/userinfo.profile",
|
|
40
|
-
"https://www.googleapis.com/auth/cclog",
|
|
41
|
-
"https://www.googleapis.com/auth/experimentsandconfigs",
|
|
42
|
-
]
|
|
43
|
-
|
|
44
|
-
# Fallback project ID when discovery fails
|
|
45
|
-
DEFAULT_PROJECT_ID = "rising-fact-p41fc"
|
|
46
|
-
|
|
47
|
-
# Cloud Code Assist endpoint
|
|
48
|
-
CLOUDCODE_ENDPOINT = "https://cloudcode-pa.googleapis.com"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
class OAuthCallbackHandler(BaseHTTPRequestHandler):
|
|
52
|
-
"""HTTP request handler for OAuth callback."""
|
|
53
|
-
|
|
54
|
-
code: str | None = None
|
|
55
|
-
state: str | None = None
|
|
56
|
-
error: str | None = None
|
|
57
|
-
|
|
58
|
-
def log_message(self, format: str, *args: Any) -> None:
|
|
59
|
-
"""Suppress HTTP server logs."""
|
|
60
|
-
pass
|
|
61
|
-
|
|
62
|
-
def do_GET(self) -> None:
|
|
63
|
-
"""Handle GET request from OAuth callback."""
|
|
64
|
-
parsed = urlparse(self.path)
|
|
65
|
-
params = parse_qs(parsed.query)
|
|
66
|
-
|
|
67
|
-
OAuthCallbackHandler.code = params.get("code", [None])[0]
|
|
68
|
-
OAuthCallbackHandler.state = params.get("state", [None])[0]
|
|
69
|
-
OAuthCallbackHandler.error = params.get("error", [None])[0]
|
|
70
|
-
|
|
71
|
-
self.send_response(200)
|
|
72
|
-
self.send_header("Content-Type", "text/html")
|
|
73
|
-
self.end_headers()
|
|
74
|
-
|
|
75
|
-
if OAuthCallbackHandler.error:
|
|
76
|
-
html = f"""
|
|
77
|
-
<html><body style="font-family: sans-serif; text-align: center; padding: 50px;">
|
|
78
|
-
<h1>Authentication Failed</h1>
|
|
79
|
-
<p>Error: {OAuthCallbackHandler.error}</p>
|
|
80
|
-
<p>Please close this window and try again.</p>
|
|
81
|
-
</body></html>
|
|
82
|
-
"""
|
|
83
|
-
else:
|
|
84
|
-
html = """
|
|
85
|
-
<html><body style="font-family: sans-serif; text-align: center; padding: 50px;">
|
|
86
|
-
<h1>Authentication Successful!</h1>
|
|
87
|
-
<p>You can close this window now.</p>
|
|
88
|
-
<script>setTimeout(function() { window.close(); }, 2000);</script>
|
|
89
|
-
</body></html>
|
|
90
|
-
"""
|
|
91
|
-
self.wfile.write(html.encode())
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def _discover_project(access_token: str) -> str:
|
|
95
|
-
"""Discover or provision a project for the user."""
|
|
96
|
-
headers = {
|
|
97
|
-
"Authorization": f"Bearer {access_token}",
|
|
98
|
-
"Content-Type": "application/json",
|
|
99
|
-
"User-Agent": "google-api-nodejs-client/9.15.1",
|
|
100
|
-
"X-Goog-Api-Client": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
|
101
|
-
"Client-Metadata": json.dumps(
|
|
102
|
-
{
|
|
103
|
-
"ideType": "IDE_UNSPECIFIED",
|
|
104
|
-
"platform": "PLATFORM_UNSPECIFIED",
|
|
105
|
-
"pluginType": "GEMINI",
|
|
106
|
-
}
|
|
107
|
-
),
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
try:
|
|
111
|
-
with httpx.Client() as client:
|
|
112
|
-
response = client.post(
|
|
113
|
-
f"{CLOUDCODE_ENDPOINT}/v1internal:loadCodeAssist",
|
|
114
|
-
headers=headers,
|
|
115
|
-
json={
|
|
116
|
-
"metadata": {
|
|
117
|
-
"ideType": "IDE_UNSPECIFIED",
|
|
118
|
-
"platform": "PLATFORM_UNSPECIFIED",
|
|
119
|
-
"pluginType": "GEMINI",
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
timeout=30,
|
|
123
|
-
)
|
|
124
|
-
|
|
125
|
-
if response.status_code == 200:
|
|
126
|
-
data: dict[str, Any] = response.json()
|
|
127
|
-
project = data.get("cloudaicompanionProject")
|
|
128
|
-
if isinstance(project, str) and project:
|
|
129
|
-
return project
|
|
130
|
-
if isinstance(project, dict):
|
|
131
|
-
project_dict = cast(dict[str, Any], project)
|
|
132
|
-
project_id = project_dict.get("id")
|
|
133
|
-
if isinstance(project_id, str) and project_id:
|
|
134
|
-
return project_id
|
|
135
|
-
except Exception:
|
|
136
|
-
pass
|
|
137
|
-
|
|
138
|
-
return DEFAULT_PROJECT_ID
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def _get_user_email(access_token: str) -> str | None:
|
|
142
|
-
"""Get user email from the access token."""
|
|
143
|
-
try:
|
|
144
|
-
with httpx.Client() as client:
|
|
145
|
-
response = client.get(
|
|
146
|
-
"https://www.googleapis.com/oauth2/v1/userinfo?alt=json",
|
|
147
|
-
headers={"Authorization": f"Bearer {access_token}"},
|
|
148
|
-
timeout=10,
|
|
149
|
-
)
|
|
150
|
-
if response.status_code == 200:
|
|
151
|
-
data = response.json()
|
|
152
|
-
return data.get("email")
|
|
153
|
-
except Exception:
|
|
154
|
-
pass
|
|
155
|
-
return None
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
class AntigravityOAuth:
|
|
159
|
-
"""Handle OAuth PKCE flow for Antigravity authentication."""
|
|
160
|
-
|
|
161
|
-
def __init__(self, token_manager: AntigravityTokenManager | None = None):
|
|
162
|
-
self.token_manager = token_manager or AntigravityTokenManager()
|
|
163
|
-
|
|
164
|
-
def login(self) -> AntigravityAuthState:
|
|
165
|
-
"""Run the complete OAuth login flow."""
|
|
166
|
-
verifier, challenge = generate_pkce()
|
|
167
|
-
state = secrets.token_urlsafe(32)
|
|
168
|
-
|
|
169
|
-
# Build authorization URL
|
|
170
|
-
auth_params = {
|
|
171
|
-
"client_id": CLIENT_ID,
|
|
172
|
-
"response_type": "code",
|
|
173
|
-
"redirect_uri": REDIRECT_URI,
|
|
174
|
-
"scope": " ".join(SCOPES),
|
|
175
|
-
"code_challenge": challenge,
|
|
176
|
-
"code_challenge_method": "S256",
|
|
177
|
-
"state": state,
|
|
178
|
-
"access_type": "offline",
|
|
179
|
-
"prompt": "consent",
|
|
180
|
-
}
|
|
181
|
-
auth_url = f"{AUTH_URL}?{urlencode(auth_params)}"
|
|
182
|
-
|
|
183
|
-
# Reset callback handler state
|
|
184
|
-
OAuthCallbackHandler.code = None
|
|
185
|
-
OAuthCallbackHandler.state = None
|
|
186
|
-
OAuthCallbackHandler.error = None
|
|
187
|
-
|
|
188
|
-
# Start callback server
|
|
189
|
-
server = HTTPServer(("localhost", REDIRECT_PORT), OAuthCallbackHandler)
|
|
190
|
-
server_thread = Thread(target=server.handle_request)
|
|
191
|
-
server_thread.start()
|
|
192
|
-
|
|
193
|
-
# Open browser for user to authenticate
|
|
194
|
-
webbrowser.open(auth_url)
|
|
195
|
-
|
|
196
|
-
# Wait for callback
|
|
197
|
-
server_thread.join(timeout=300) # 5 minute timeout
|
|
198
|
-
server.server_close()
|
|
199
|
-
|
|
200
|
-
# Check for errors
|
|
201
|
-
if OAuthCallbackHandler.error:
|
|
202
|
-
raise AntigravityOAuthError(f"OAuth error: {OAuthCallbackHandler.error}")
|
|
203
|
-
|
|
204
|
-
if not OAuthCallbackHandler.code:
|
|
205
|
-
raise AntigravityOAuthError("No authorization code received")
|
|
206
|
-
|
|
207
|
-
if OAuthCallbackHandler.state is None or OAuthCallbackHandler.state != state:
|
|
208
|
-
raise AntigravityOAuthError("OAuth state mismatch")
|
|
209
|
-
|
|
210
|
-
# Exchange code for tokens
|
|
211
|
-
auth_state = self._exchange_code(OAuthCallbackHandler.code, verifier)
|
|
212
|
-
|
|
213
|
-
# Save tokens
|
|
214
|
-
self.token_manager.save(auth_state)
|
|
215
|
-
|
|
216
|
-
return auth_state
|
|
217
|
-
|
|
218
|
-
def _exchange_code(self, code: str, verifier: str) -> AntigravityAuthState:
|
|
219
|
-
"""Exchange authorization code for tokens."""
|
|
220
|
-
data = {
|
|
221
|
-
"client_id": CLIENT_ID,
|
|
222
|
-
"client_secret": CLIENT_SECRET,
|
|
223
|
-
"code": code,
|
|
224
|
-
"grant_type": "authorization_code",
|
|
225
|
-
"redirect_uri": REDIRECT_URI,
|
|
226
|
-
"code_verifier": verifier,
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
with httpx.Client() as client:
|
|
230
|
-
response = client.post(TOKEN_URL, data=data, timeout=30)
|
|
231
|
-
|
|
232
|
-
if response.status_code != 200:
|
|
233
|
-
raise AntigravityOAuthError(f"Token exchange failed: {response.text}")
|
|
234
|
-
|
|
235
|
-
tokens = response.json()
|
|
236
|
-
access_token = tokens["access_token"]
|
|
237
|
-
refresh_token = tokens.get("refresh_token")
|
|
238
|
-
expires_in = tokens.get("expires_in", 3600)
|
|
239
|
-
|
|
240
|
-
if not refresh_token:
|
|
241
|
-
raise AntigravityOAuthError("No refresh token received. Please try again.")
|
|
242
|
-
|
|
243
|
-
# Get user email
|
|
244
|
-
email = _get_user_email(access_token)
|
|
245
|
-
|
|
246
|
-
# Discover project
|
|
247
|
-
project_id = _discover_project(access_token)
|
|
248
|
-
|
|
249
|
-
# Calculate expiry time with 5 minute buffer
|
|
250
|
-
expires_at = int(time.time()) + expires_in - 300
|
|
251
|
-
|
|
252
|
-
return AntigravityAuthState(
|
|
253
|
-
access_token=access_token,
|
|
254
|
-
refresh_token=refresh_token,
|
|
255
|
-
expires_at=expires_at,
|
|
256
|
-
project_id=project_id,
|
|
257
|
-
email=email,
|
|
258
|
-
)
|
|
259
|
-
|
|
260
|
-
def refresh(self) -> AntigravityAuthState:
|
|
261
|
-
"""Refresh the access token using refresh token with file locking.
|
|
262
|
-
|
|
263
|
-
Uses file locking to prevent multiple instances from refreshing simultaneously.
|
|
264
|
-
If another instance has already refreshed, returns the updated state.
|
|
265
|
-
"""
|
|
266
|
-
|
|
267
|
-
def do_refresh(current_state: AntigravityAuthState) -> AntigravityAuthState:
|
|
268
|
-
data = {
|
|
269
|
-
"client_id": CLIENT_ID,
|
|
270
|
-
"client_secret": CLIENT_SECRET,
|
|
271
|
-
"refresh_token": current_state.refresh_token,
|
|
272
|
-
"grant_type": "refresh_token",
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
with httpx.Client() as client:
|
|
276
|
-
response = client.post(TOKEN_URL, data=data, timeout=30)
|
|
277
|
-
|
|
278
|
-
if response.status_code != 200:
|
|
279
|
-
raise AntigravityTokenExpiredError(f"Token refresh failed: {response.text}")
|
|
280
|
-
|
|
281
|
-
tokens = response.json()
|
|
282
|
-
access_token = tokens["access_token"]
|
|
283
|
-
refresh_token = tokens.get("refresh_token", current_state.refresh_token)
|
|
284
|
-
expires_in = tokens.get("expires_in", 3600)
|
|
285
|
-
|
|
286
|
-
# Calculate expiry time with 5 minute buffer
|
|
287
|
-
expires_at = int(time.time()) + expires_in - 300
|
|
288
|
-
|
|
289
|
-
return AntigravityAuthState(
|
|
290
|
-
access_token=access_token,
|
|
291
|
-
refresh_token=refresh_token,
|
|
292
|
-
expires_at=expires_at,
|
|
293
|
-
project_id=current_state.project_id,
|
|
294
|
-
email=current_state.email,
|
|
295
|
-
)
|
|
296
|
-
|
|
297
|
-
try:
|
|
298
|
-
return self.token_manager.refresh_with_lock(do_refresh)
|
|
299
|
-
except ValueError as e:
|
|
300
|
-
raise AntigravityNotLoggedInError(str(e)) from e
|
|
301
|
-
|
|
302
|
-
def ensure_valid_token(self) -> tuple[str, str]:
|
|
303
|
-
"""Ensure we have a valid access token, refreshing if needed.
|
|
304
|
-
|
|
305
|
-
Returns:
|
|
306
|
-
Tuple of (access_token, project_id).
|
|
307
|
-
"""
|
|
308
|
-
state = self.token_manager.get_state()
|
|
309
|
-
if state is None:
|
|
310
|
-
raise AntigravityNotLoggedInError("Not logged in to Antigravity. Run 'klaude login antigravity' first.")
|
|
311
|
-
|
|
312
|
-
if state.is_expired():
|
|
313
|
-
state = self.refresh()
|
|
314
|
-
|
|
315
|
-
return state.access_token, state.project_id
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"""PKCE utilities for Antigravity OAuth."""
|
|
2
|
-
|
|
3
|
-
import base64
|
|
4
|
-
import hashlib
|
|
5
|
-
import secrets
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def base64url_encode(data: bytes) -> str:
|
|
9
|
-
"""Encode bytes as base64url string without padding."""
|
|
10
|
-
return base64.urlsafe_b64encode(data).rstrip(b"=").decode("ascii")
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def generate_pkce() -> tuple[str, str]:
|
|
14
|
-
"""Generate PKCE code verifier and challenge.
|
|
15
|
-
|
|
16
|
-
Returns:
|
|
17
|
-
Tuple of (verifier, challenge).
|
|
18
|
-
"""
|
|
19
|
-
verifier_bytes = secrets.token_bytes(32)
|
|
20
|
-
verifier = base64url_encode(verifier_bytes)
|
|
21
|
-
|
|
22
|
-
challenge_hash = hashlib.sha256(verifier.encode("ascii")).digest()
|
|
23
|
-
challenge = base64url_encode(challenge_hash)
|
|
24
|
-
|
|
25
|
-
return verifier, challenge
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"""Token storage and management for Antigravity authentication."""
|
|
2
|
-
|
|
3
|
-
from pathlib import Path
|
|
4
|
-
from typing import Any
|
|
5
|
-
|
|
6
|
-
from klaude_code.auth.base import BaseAuthState, BaseTokenManager
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class AntigravityAuthState(BaseAuthState):
|
|
10
|
-
"""Stored authentication state for Antigravity."""
|
|
11
|
-
|
|
12
|
-
project_id: str
|
|
13
|
-
email: str | None = None
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class AntigravityTokenManager(BaseTokenManager[AntigravityAuthState]):
|
|
17
|
-
"""Manage Antigravity OAuth tokens."""
|
|
18
|
-
|
|
19
|
-
def __init__(self, auth_file: Path | None = None):
|
|
20
|
-
super().__init__(auth_file)
|
|
21
|
-
|
|
22
|
-
@property
|
|
23
|
-
def storage_key(self) -> str:
|
|
24
|
-
return "antigravity"
|
|
25
|
-
|
|
26
|
-
def _create_state(self, data: dict[str, Any]) -> AntigravityAuthState:
|
|
27
|
-
return AntigravityAuthState.model_validate(data)
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
<identity>
|
|
2
|
-
You are Antigravity, a powerful agentic AI coding assistant designed by the Google DeepMind team working on Advanced Agentic Coding.
|
|
3
|
-
You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.
|
|
4
|
-
The USER will send you requests, which you must always prioritize addressing. Along with each USER request, we will attach additional metadata about their current state, such as what files they have open and where their cursor is.
|
|
5
|
-
This information may or may not be relevant to the coding task, it is up for you to decide.
|
|
6
|
-
</identity>
|
|
7
|
-
|
|
8
|
-
<tool_calling>
|
|
9
|
-
Call tools as you normally would. The following list provides additional guidance to help you avoid errors:
|
|
10
|
-
- **Absolute paths only**. When using tools that accept file path arguments, ALWAYS use the absolute file path.
|
|
11
|
-
</tool_calling>
|
|
12
|
-
|
|
13
|
-
<web_application_development>
|
|
14
|
-
## Technology Stack
|
|
15
|
-
Your web applications should be built using the following technologies:
|
|
16
|
-
1. **Core**: Use HTML for structure and JavaScript for logic.
|
|
17
|
-
2. **Styling (CSS)**: Use Vanilla CSS for maximum flexibility and control. Avoid using TailwindCSS unless the USER explicitly requests it; in this case, first confirm which TailwindCSS version to use.
|
|
18
|
-
3. **Web App**: If the USER specifies that they want a more complex web app, use a framework like Next.js or Vite. Only do this if the USER explicitly requests a web app.
|
|
19
|
-
4. **New Project Creation**: If you need to use a framework for a new app, use `npx` with the appropriate script, but there are some rules to follow:
|
|
20
|
-
- Use `npx -y` to automatically install the script and its dependencies
|
|
21
|
-
- You MUST run the command with `--help` flag to see all available options first
|
|
22
|
-
- Initialize the app in the current directory with `./` (example: `npx -y create-vite-app@latest ./`)
|
|
23
|
-
- You should run in non-interactive mode so that the user doesn't need to input anything
|
|
24
|
-
5. **Running Locally**: When running locally, use `npm run dev` or equivalent dev server. Only build the production bundle if the USER explicitly requests it or you are validating the code for correctness.
|
|
25
|
-
|
|
26
|
-
# Design Aesthetics
|
|
27
|
-
1. **Use Rich Aesthetics**: The USER should be wowed at first glance by the design. Use best practices in modern web design (e.g. vibrant colors, dark modes, glassmorphism, and dynamic animations) to create a stunning first impression. Failure to do this is UNACCEPTABLE.
|
|
28
|
-
2. **Prioritize Visual Excellence**: Implement designs that will WOW the user and feel extremely premium:
|
|
29
|
-
- Avoid generic colors (plain red, blue, green). Use curated, harmonious color palettes (e.g., HSL tailored colors, sleek dark modes).
|
|
30
|
-
- Using modern typography (e.g., from Google Fonts like Inter, Roboto, or Outfit) instead of browser defaults.
|
|
31
|
-
- Use smooth gradients
|
|
32
|
-
- Add subtle micro-animations for enhanced user experience
|
|
33
|
-
3. **Use a Dynamic Design**: An interface that feels responsive and alive encourages interaction. Achieve this with hover effects and interactive elements. Micro-animations, in particular, are highly effective for improving user engagement.
|
|
34
|
-
4. **Premium Designs**: Make a design that feels premium and state of the art. Avoid creating simple minimum viable products.
|
|
35
|
-
5. **Don't use placeholders**: If you need an image, use your generate_image tool to create a working demonstration.
|
|
36
|
-
|
|
37
|
-
## Implementation Workflow
|
|
38
|
-
Follow this systematic approach when building web applications:
|
|
39
|
-
1. **Plan and Understand**:
|
|
40
|
-
- Fully understand the user's requirements
|
|
41
|
-
- Draw inspiration from modern, beautiful, and dynamic web designs
|
|
42
|
-
- Outline the features needed for the initial version
|
|
43
|
-
2. **Build the Foundation**:
|
|
44
|
-
- Start by creating/modifying `index.css`
|
|
45
|
-
- Implement the core design system with all tokens and utilities
|
|
46
|
-
3. **Create Components**:
|
|
47
|
-
- Build necessary components using your design system
|
|
48
|
-
- Ensure all components use predefined styles, not ad-hoc utilities
|
|
49
|
-
- Keep components focused and reusable
|
|
50
|
-
4. **Assemble Pages**:
|
|
51
|
-
- Update the main application to incorporate your design and components
|
|
52
|
-
- Ensure proper routing and navigation
|
|
53
|
-
- Implement responsive layouts
|
|
54
|
-
5. **Polish and Optimize**:
|
|
55
|
-
- Review the overall user experience
|
|
56
|
-
- Ensure smooth interactions and transitions
|
|
57
|
-
- Optimize performance where needed
|
|
58
|
-
|
|
59
|
-
## SEO Best Practices
|
|
60
|
-
Automatically implement SEO best practices on every page:
|
|
61
|
-
- **Title Tags**: Include proper, descriptive title tags for each page
|
|
62
|
-
- **Meta Descriptions**: Add compelling meta descriptions that accurately summarize page content
|
|
63
|
-
- **Heading Structure**: Use a single `<h1>` per page with proper heading hierarchy
|
|
64
|
-
- **Semantic HTML**: Use appropriate HTML5 semantic elements
|
|
65
|
-
- **Unique IDs**: Ensure all interactive elements have unique, descriptive IDs for browser testing
|
|
66
|
-
- **Performance**: Ensure fast page load times through optimization
|
|
67
|
-
CRITICAL REMINDER: AESTHETICS ARE VERY IMPORTANT. If your web app looks simple and basic then you have FAILED!
|
|
68
|
-
</web_application_development>
|
|
69
|
-
<ephemeral_message>
|
|
70
|
-
There will be an <EPHEMERAL_MESSAGE> appearing in the conversation at times. This is not coming from the user, but instead injected by the system as important information to pay attention to.
|
|
71
|
-
Do not respond to nor acknowledge those messages, but do follow them strictly.
|
|
72
|
-
</ephemeral_message>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<communication_style>
|
|
76
|
-
- **Formatting**. Format your responses in github-style markdown to make your responses easier for the USER to parse. For example, use headers to organize your responses and bolded or italicized text to highlight important keywords. Use backticks to format file, directory, function, and class names. If providing a URL to the user, format this in markdown as well, for example `[label](example.com)`.
|
|
77
|
-
- **Proactiveness**. As an agent, you are allowed to be proactive, but only in the course of completing the user's task. For example, if the user asks you to add a new component, you can edit the code, verify build and test statuses, and take any other obvious follow-up actions, such as performing additional research. However, avoid surprising the user. For example, if the user asks HOW to approach something, you should answer their question and instead of jumping into editing a file.
|
|
78
|
-
- **Helpfulness**. Respond like a helpful software engineer who is explaining your work to a friendly collaborator on the project. Acknowledge mistakes or any backtracking you do as a result of new information.
|
|
79
|
-
- **Ask for clarification**. If you are unsure about the USER's intent, always ask for clarification rather than making assumptions.
|
|
80
|
-
</communication_style>
|