Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/app/dist-mirror/assets/ghostty-web-BG18ggZB.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/app/dist-mirror/assets/home-BXC2hA1W.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,160 changes: 2,160 additions & 0 deletions packages/app/dist-mirror/assets/mirror-CG5OfKsh.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/app/dist-mirror/assets/mirror-Vrhk6YUM.css

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions packages/app/dist-mirror/assets/session-Bk7UX8F7.js

Large diffs are not rendered by default.

177 changes: 176 additions & 1 deletion packages/app/src/components/settings-general.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Show, createMemo, createResource, type JSX } from "solid-js"
import { Component, Show, createEffect, createMemo, createResource, createSignal, type JSX } from "solid-js"
import { createStore } from "solid-js/store"
import { Button } from "@opencode-ai/ui/button"
import { Icon } from "@opencode-ai/ui/icon"
Expand All @@ -10,6 +10,8 @@ import { showToast } from "@opencode-ai/ui/toast"
import { useLanguage } from "@/context/language"
import { usePlatform } from "@/context/platform"
import { useSettings, monoFontFamily } from "@/context/settings"
import { useGlobalSDK } from "@/context/global-sdk"
import { useServer } from "@/context/server"
import { playSound, SOUND_OPTIONS } from "@/utils/sound"
import { Link } from "./link"

Expand Down Expand Up @@ -42,6 +44,57 @@ export const SettingsGeneral: Component = () => {
const language = useLanguage()
const platform = usePlatform()
const settings = useSettings()
const globalSDK = useGlobalSDK()
const server = useServer()

// Build auth headers from server connection credentials
const authHeaders = (): Record<string, string> => {
const http = server.current?.http
if (!http?.password) return {}
return { Authorization: `Basic ${btoa(`${http.username ?? "opencode"}:${http.password}`)}` }
}

// YOLO state
const [yoloEnabled, setYoloEnabled] = createSignal(false)
const [yoloPersisted, setYoloPersisted] = createSignal(false)

const loadYoloStatus = () => {
const doFetch = platform.fetch ?? fetch
doFetch(`${globalSDK.url}/config/yolo`, { headers: authHeaders() })
.then((response) => {
if (response.ok) return response.json()
return null
})
.then((data) => {
if (data) {
setYoloEnabled(data.enabled === true)
setYoloPersisted(data.persisted === true)
}
})
.catch(() => {})
}

setTimeout(loadYoloStatus, 100)

const setYolo = (enabled: boolean, persist: boolean) => {
const doFetch = platform.fetch ?? fetch
doFetch(`${globalSDK.url}/config/yolo`, {
method: "POST",
headers: { "Content-Type": "application/json", ...authHeaders() },
body: JSON.stringify({ enabled, persist }),
})
.then((response) => {
if (response.ok) return response.json()
return null
})
.then((data) => {
if (data) {
setYoloEnabled(data.enabled === true)
setYoloPersisted(data.persisted === true)
}
})
.catch((e) => console.error("Failed to set YOLO:", e))
}

const [store, setStore] = createStore({
checking: false,
Expand Down Expand Up @@ -538,6 +591,128 @@ export const SettingsGeneral: Component = () => {
)
}}
</Show>

{/* YOLO Mode Section */}
<div class="flex flex-col gap-1">
<div class="flex items-center gap-2 pb-2">
<h3 class="text-14-medium text-text-strong">YOLO Mode</h3>
<Show when={yoloEnabled()}>
<span class="text-10-medium text-fill-danger-base bg-fill-danger-ghost px-1.5 py-0.5 rounded">
ACTIVE
</span>
</Show>
</div>

<p class="text-12-regular text-text-muted pb-2">
Skip ALL permission prompts. OpenCode will execute without asking for confirmation.
</p>

{/* Warning */}
<div class="p-3 rounded-lg border border-fill-warning-base bg-fill-warning-ghost mb-3">
<p class="text-12-regular text-text-base">
<span class="text-12-medium">Warning:</span> This is dangerous. Only enable if you fully trust OpenCode's
actions. Explicit deny rules in your config will still be respected.
</p>
</div>

{/* This Session Only Card */}
<div
class="p-3 rounded-lg border-2 transition-all mb-2"
classList={{
"border-fill-danger-base bg-fill-danger-ghost": yoloEnabled() && !yoloPersisted(),
"border-border-weak-base bg-fill-ghost-base": !(yoloEnabled() && !yoloPersisted()),
}}
>
<div class="flex items-center justify-between">
<div class="flex flex-col gap-0.5">
<div class="flex items-center gap-2">
<span class="text-13-medium text-text-base">This Session Only</span>
<Show when={yoloEnabled() && !yoloPersisted()}>
<span class="text-10-medium text-fill-danger-base">ACTIVE</span>
</Show>
</div>
<span class="text-11-regular text-text-muted">Resets when you restart OpenCode</span>
</div>
<Show
when={yoloEnabled() && !yoloPersisted()}
fallback={
<button
type="button"
onClick={() => setYolo(true, false)}
class="px-3 py-1.5 rounded text-12-medium bg-fill-danger-base text-white hover:bg-fill-danger-strong transition-colors"
>
Enable
</button>
}
>
<button
type="button"
onClick={() => setYolo(false, false)}
class="px-3 py-1.5 rounded border border-border-base text-12-medium text-text-base hover:bg-fill-ghost-base transition-colors"
>
Disable
</button>
</Show>
</div>
</div>

{/* Always Enabled Card */}
<div
class="p-3 rounded-lg border-2 transition-all mb-3"
classList={{
"border-fill-danger-base bg-fill-danger-ghost": yoloPersisted(),
"border-border-weak-base bg-fill-ghost-base": !yoloPersisted(),
}}
>
<div class="flex items-center justify-between">
<div class="flex flex-col gap-0.5">
<div class="flex items-center gap-2">
<span class="text-13-medium text-text-base">Always Enabled</span>
<Show when={yoloPersisted()}>
<span class="text-10-medium text-fill-danger-base">ACTIVE</span>
<span class="text-10-medium text-fill-success-base">Saved</span>
</Show>
</div>
<span class="text-11-regular text-text-muted">Persists across restarts (saved in config.json)</span>
</div>
<Show
when={yoloPersisted()}
fallback={
<button
type="button"
onClick={() => setYolo(true, true)}
class="px-3 py-1.5 rounded text-12-medium bg-fill-danger-base text-white hover:bg-fill-danger-strong transition-colors"
>
Save to Config
</button>
}
>
<button
type="button"
onClick={() => setYolo(false, true)}
class="px-3 py-1.5 rounded border border-border-base text-12-medium text-text-base hover:bg-fill-ghost-base transition-colors"
>
Remove from Config
</button>
</Show>
</div>
</div>

{/* CLI Usage */}
<div class="p-3 rounded-lg border border-border-weak-base bg-fill-ghost-base">
<span class="text-12-medium text-text-base">CLI Usage</span>
<div class="mt-2 flex flex-col gap-1">
<div class="flex items-center gap-3">
<code class="text-11-regular font-mono text-text-muted">opencode --yolo</code>
<span class="text-11-regular text-text-weak">one session</span>
</div>
<div class="flex items-center gap-3">
<code class="text-11-regular font-mono text-text-muted">OPENCODE_YOLO=true</code>
<span class="text-11-regular text-text-weak">env var</span>
</div>
</div>
</div>
</div>
</div>
</div>
)
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,160 changes: 2,160 additions & 0 deletions packages/desktop/src-tauri/web-ui/assets/mirror-CG5OfKsh.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2,158 changes: 2,158 additions & 0 deletions packages/desktop/src-tauri/web-ui/assets/mirror-zS2aUGv8.js

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions packages/desktop/src-tauri/web-ui/assets/session-Bk7UX8F7.js

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions packages/desktop/src-tauri/web-ui/assets/session-JI5Qslgu.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,10 @@ export namespace Config {
.describe("Token buffer for compaction. Leaves enough window to avoid overflow during compaction."),
})
.optional(),
yolo: z
.boolean()
.optional()
.describe("Enable YOLO mode - auto-approve all permission prompts (except explicit deny rules)"),
experimental: z
.object({
disable_paste_summary: z.boolean().optional(),
Expand Down
1 change: 1 addition & 0 deletions packages/opencode/src/flag/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ function truthy(key: string) {
}

export namespace Flag {
export const OPENCODE_YOLO = truthy("OPENCODE_YOLO")
export const OPENCODE_AUTO_SHARE = truthy("OPENCODE_AUTO_SHARE")
export const OPENCODE_GIT_BASH_PATH = process.env["OPENCODE_GIT_BASH_PATH"]
export const OPENCODE_CONFIG = process.env["OPENCODE_CONFIG"]
Expand Down
6 changes: 6 additions & 0 deletions packages/opencode/src/permission/next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { PermissionTable } from "@/session/session.sql"
import { fn } from "@/util/fn"
import { Log } from "@/util/log"
import { Wildcard } from "@/util/wildcard"
import { Yolo } from "@/yolo"
import os from "os"
import z from "zod"

Expand Down Expand Up @@ -141,6 +142,11 @@ export namespace PermissionNext {
if (rule.action === "deny")
throw new DeniedError(ruleset.filter((r) => Wildcard.match(request.permission, r.permission)))
if (rule.action === "ask") {
// YOLO mode auto-approves all "ask" permissions (but respects explicit "deny")
if (Yolo.isEnabled()) {
log.warn("YOLO mode auto-approved", { permission: request.permission, pattern })
continue
}
const id = input.id ?? Identifier.ascending("permission")
return new Promise<void>((resolve, reject) => {
const info: Request = {
Expand Down
2 changes: 2 additions & 0 deletions packages/opencode/src/project/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import { Log } from "@/util/log"
import { ShareNext } from "@/share/share-next"
import { Snapshot } from "../snapshot"
import { Truncate } from "../tool/truncation"
import { Yolo } from "../yolo"

export async function InstanceBootstrap() {
Log.Default.info("bootstrapping", { directory: Instance.directory })
await Yolo.init()
await Plugin.init()
ShareNext.init()
Format.init()
Expand Down
Loading
Loading