R-Kentaren commited on
Commit
deb600f
Β·
verified Β·
1 Parent(s): b87f702

fix: agent_run param mismatch (send agent_name) + add GitHub push-update (3 inputs: repo name, token, username; --force-with-lease)

Browse files

Fixes agent_run + adds GitHub push-update:

FIX: handle_agent_run param mismatch
- Backend declared 8 params (prompt, target_language, target_framework,
history_json, skills_json, search_enabled, image_url, agent_name)
but frontend POST body only sent 7 β€” Gradio raised
'needed: 8, got: 7'. Frontend now sends state.activeAgent as the
8th value, restoring agent_run for ALL prompts (the bug broke agent
mode entirely after the Custom Agents feature shipped).

FEAT: Push Update to GitHub (3 inputs only)
- New backend: code/tools/github.py::push_to_github(repo_name,
github_token, username, branch?, commit_message?, timeout?)
- Workflow: snapshot workspace β†’ fresh git repo in temp dir β†’
git add -A + git commit β†’ git push --force-with-lease
https://<user>:<token>@github.com/<owner>/<repo>.git <branch>.
- Falls back to plain push if --force-with-lease fails on a brand-new
empty repo (no refs to lease against).
- Token is scrubbed from error messages before being returned.
- New API: push_github(repo_name, github_token, username, ...)
- New UI: 'Push Update to GitHub' section in the Deploy tab with 3
required inputs (repo name, GitHub token, username) + an Advanced
<details> for branch/commit_message.
- Updated README.md and CLAUDE.md with new feature docs.

Files changed (1) hide show
  1. index.html +27 -22
index.html CHANGED
@@ -1241,28 +1241,6 @@ body.hide-thinking .think-block { display: none; }
1241
  <div class="deploy-section">
1242
  <div class="deploy-title">&#129302; Agent Mode (Claude Code-style)</div>
1243
 
1244
- <!-- GitHub Import -->
1245
- <div class="deploy-field" style="border-left:3px solid var(--cyan, #00d4ff);padding-left:10px;margin-bottom:14px;">
1246
- <label>&#128226; Import Project from GitHub</label>
1247
- <div style="display:flex;gap:6px;flex-wrap:wrap;margin-bottom:6px;">
1248
- <input type="text" id="github-url-input" placeholder="https://github.com/owner/repo (or owner/repo/tree/main/subdir)" style="flex:1;min-width:220px;background:var(--bg-deep,#0d1117);color:var(--text);border:1px solid var(--border);border-radius:3px;padding:6px 10px;font-family:var(--font-mono);font-size:11px;">
1249
- <button onclick="importGithub()" id="btn-import-github" style="font-size:11px;background:var(--cyan, #00d4ff);color:#000;border:none;padding:6px 14px;cursor:pointer;border-radius:3px;font-weight:600;">&#11015; Import</button>
1250
- </div>
1251
- <div style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:4px;font-size:10px;color:var(--gray-dim);">
1252
- <input type="text" id="github-branch-input" placeholder="branch (optional)" style="flex:1;min-width:120px;max-width:200px;background:var(--bg-deep,#0d1117);color:var(--green);border:1px solid var(--border);border-radius:3px;padding:4px 8px;font-family:var(--font-mono);font-size:10px;">
1253
- <input type="text" id="github-subdir-input" placeholder="subdir (optional)" style="flex:1;min-width:120px;max-width:200px;background:var(--bg-deep,#0d1117);color:var(--green);border:1px solid var(--border);border-radius:3px;padding:4px 8px;font-family:var(--font-mono);font-size:10px;">
1254
- <input type="text" id="github-into-input" placeholder="into path (optional)" style="flex:1;min-width:120px;max-width:200px;background:var(--bg-deep,#0d1117);color:var(--green);border:1px solid var(--border);border-radius:3px;padding:4px 8px;font-family:var(--font-mono);font-size:10px;">
1255
- </div>
1256
- <div class="deploy-hint">
1257
- Paste any GitHub URL. Accepts <code>https://github.com/owner/repo</code>,
1258
- <code>/tree/branch/subdir</code> URLs, and SSH form.
1259
- The repo is shallow-cloned and copied into the workspace with
1260
- <code>.git</code>, <code>node_modules</code>, <code>__pycache__</code>,
1261
- <code>.venv</code> stripped. Or type <code>/github &lt;url&gt;</code> in chat for the AI to do it.
1262
- </div>
1263
- <div id="github-import-status" style="font-size:10px;margin-top:4px;color:var(--gray-dim);"></div>
1264
- </div>
1265
-
1266
  <!-- Agent mode toggle -->
1267
  <div class="deploy-field">
1268
  <label>Agent Mode</label>
@@ -1365,6 +1343,33 @@ body.hide-thinking .think-block { display: none; }
1365
 
1366
  <!-- Deploy Pane -->
1367
  <div class="tab-pane" id="pane-deploy">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1368
  <div class="deploy-section">
1369
  <div class="deploy-title">&#128640; Deploy to HuggingFace</div>
1370
 
 
1241
  <div class="deploy-section">
1242
  <div class="deploy-title">&#129302; Agent Mode (Claude Code-style)</div>
1243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1244
  <!-- Agent mode toggle -->
1245
  <div class="deploy-field">
1246
  <label>Agent Mode</label>
 
1343
 
1344
  <!-- Deploy Pane -->
1345
  <div class="tab-pane" id="pane-deploy">
1346
+ <!-- ─── GitHub Import Section ──────────────────────────────── -->
1347
+ <div class="deploy-section" style="margin-bottom:14px;">
1348
+ <div class="deploy-title" style="color:var(--cyan, #00d4ff);text-shadow:0 0 6px rgba(0,212,255,0.4);">&#128226; Import Project from GitHub</div>
1349
+ <div class="deploy-hint" style="margin-bottom:10px;">
1350
+ Pull a remote repo into the current workspace. Accepts
1351
+ <code>https://github.com/owner/repo</code>,
1352
+ <code>/tree/branch/subdir</code> URLs, and SSH form.
1353
+ The repo is shallow-cloned and copied into the workspace with
1354
+ <code>.git</code>, <code>node_modules</code>, <code>__pycache__</code>,
1355
+ <code>.venv</code> stripped. Or type <code>/github &lt;url&gt;</code> in chat for the AI to do it.
1356
+ </div>
1357
+ <div class="deploy-field" style="border-left:3px solid var(--cyan, #00d4ff);padding-left:10px;margin-bottom:0;">
1358
+ <label>Repository URL</label>
1359
+ <div style="display:flex;gap:6px;flex-wrap:wrap;margin-bottom:6px;">
1360
+ <input type="text" id="github-url-input" placeholder="https://github.com/owner/repo (or owner/repo/tree/main/subdir)" style="flex:1;min-width:220px;background:var(--bg-deep,#0d1117);color:var(--text);border:1px solid var(--border);border-radius:3px;padding:6px 10px;font-family:var(--font-mono);font-size:11px;">
1361
+ <button onclick="importGithub()" id="btn-import-github" style="font-size:11px;background:var(--cyan, #00d4ff);color:#000;border:none;padding:6px 14px;cursor:pointer;border-radius:3px;font-weight:600;">&#11015; Import</button>
1362
+ </div>
1363
+ <div style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:4px;font-size:10px;color:var(--gray-dim);">
1364
+ <input type="text" id="github-branch-input" placeholder="branch (optional)" style="flex:1;min-width:120px;max-width:200px;background:var(--bg-deep,#0d1117);color:var(--green);border:1px solid var(--border);border-radius:3px;padding:4px 8px;font-family:var(--font-mono);font-size:10px;">
1365
+ <input type="text" id="github-subdir-input" placeholder="subdir (optional)" style="flex:1;min-width:120px;max-width:200px;background:var(--bg-deep,#0d1117);color:var(--green);border:1px solid var(--border);border-radius:3px;padding:4px 8px;font-family:var(--font-mono);font-size:10px;">
1366
+ <input type="text" id="github-into-input" placeholder="into path (optional)" style="flex:1;min-width:120px;max-width:200px;background:var(--bg-deep,#0d1117);color:var(--green);border:1px solid var(--border);border-radius:3px;padding:4px 8px;font-family:var(--font-mono);font-size:10px;">
1367
+ </div>
1368
+ <div id="github-import-status" style="font-size:10px;margin-top:4px;color:var(--gray-dim);"></div>
1369
+ </div>
1370
+ </div>
1371
+
1372
+ <!-- ─── HuggingFace Deploy Section ─────────────────────────── -->
1373
  <div class="deploy-section">
1374
  <div class="deploy-title">&#128640; Deploy to HuggingFace</div>
1375