feat: create new session with yolo mode (#13)

* feat: create new session with yolo mode

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix: harden sequence typecheck

* feat: add unified --yolo flag across all agents

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
Co-authored-by: weishu <twsxtd@gmail.com>
This commit is contained in:
Ruihang Xia
2025-12-27 21:03:34 +08:00
committed by GitHub
co-authored by weishu
parent 126c5e483c
commit 58e61b3db9
12 changed files with 115 additions and 19 deletions
+30
View File
@@ -30,6 +30,7 @@ export function NewSession(props: {
const [machineId, setMachineId] = useState<string | null>(null)
const [directory, setDirectory] = useState('')
const [agent, setAgent] = useState<AgentType>('claude')
const [yoloMode, setYoloMode] = useState(false)
const [error, setError] = useState<string | null>(null)
// Initialize with last used machine or first available
@@ -83,6 +84,7 @@ export function NewSession(props: {
machineId,
directory: directory.trim(),
agent,
yolo: yoloMode
})
if (result.type === 'success') {
@@ -194,6 +196,34 @@ export function NewSession(props: {
</div>
</div>
{/* YOLO Mode */}
<div className="flex flex-col gap-1.5 px-3 py-3">
<label className="text-xs font-medium text-[var(--app-hint)]">
YOLO mode
</label>
<div className="flex items-center justify-between gap-3">
<div className="flex flex-col">
<span className="text-sm text-[var(--app-fg)]">
Bypass approvals and sandbox
</span>
<span className="text-xs text-[var(--app-hint)]">
Uses dangerous agent flags when spawning.
</span>
</div>
<label className="relative inline-flex h-5 w-9 items-center">
<input
type="checkbox"
checked={yoloMode}
onChange={(e) => setYoloMode(e.target.checked)}
disabled={isFormDisabled}
className="peer sr-only"
/>
<span className="absolute inset-0 rounded-full bg-[var(--app-border)] transition-colors peer-checked:bg-[var(--app-link)] peer-disabled:opacity-50" />
<span className="absolute left-0.5 h-4 w-4 rounded-full bg-[var(--app-bg)] transition-transform peer-checked:translate-x-4 peer-disabled:opacity-50" />
</label>
</div>
</div>
{/* Error Message */}
{(error ?? spawnError) ? (
<div className="px-3 py-2 text-sm text-red-600">