Merge branch 'dev' into feature/session-handoff

pull/12755/head
Dax Raad 2026-02-09 10:53:24 -05:00
commit 173c16581d
62 changed files with 901 additions and 1173 deletions

View File

@ -1,27 +1,32 @@
import { lstat, mkdir, readdir, rm, symlink } from "fs/promises"
import { join, relative } from "path"
type SemverLike = {
valid: (value: string) => string | null
rcompare: (left: string, right: string) => number
}
type Entry = {
dir: string
version: string
label: string
}
async function isDirectory(path: string) {
try {
const info = await lstat(path)
return info.isDirectory()
} catch {
return false
}
}
const isValidSemver = (v: string) => Bun.semver.satisfies(v, "x.x.x")
const root = process.cwd()
const bunRoot = join(root, "node_modules/.bun")
const linkRoot = join(bunRoot, "node_modules")
const directories = (await readdir(bunRoot)).sort()
const versions = new Map<string, Entry[]>()
for (const entry of directories) {
const full = join(bunRoot, entry)
const info = await lstat(full)
if (!info.isDirectory()) {
if (!(await isDirectory(full))) {
continue
}
const parsed = parseEntry(entry)
@ -29,37 +34,23 @@ for (const entry of directories) {
continue
}
const list = versions.get(parsed.name) ?? []
list.push({ dir: full, version: parsed.version, label: entry })
list.push({ dir: full, version: parsed.version })
versions.set(parsed.name, list)
}
const semverModule = (await import(join(bunRoot, "node_modules/semver"))) as
| SemverLike
| {
default: SemverLike
}
const semver = "default" in semverModule ? semverModule.default : semverModule
const selections = new Map<string, Entry>()
for (const [slug, list] of versions) {
list.sort((a, b) => {
const left = semver.valid(a.version)
const right = semver.valid(b.version)
if (left && right) {
const delta = semver.rcompare(left, right)
if (delta !== 0) {
return delta
}
}
if (left && !right) {
return -1
}
if (!left && right) {
return 1
}
const aValid = isValidSemver(a.version)
const bValid = isValidSemver(b.version)
if (aValid && bValid) return -Bun.semver.order(a.version, b.version)
if (aValid) return -1
if (bValid) return 1
return b.version.localeCompare(a.version)
})
selections.set(slug, list[0])
const first = list[0]
if (first) selections.set(slug, first)
}
await rm(linkRoot, { recursive: true, force: true })
@ -77,10 +68,7 @@ for (const [slug, entry] of Array.from(selections.entries()).sort((a, b) => a[0]
await mkdir(parent, { recursive: true })
const linkPath = join(parent, leaf)
const desired = join(entry.dir, "node_modules", slug)
const exists = await lstat(desired)
.then((info) => info.isDirectory())
.catch(() => false)
if (!exists) {
if (!(await isDirectory(desired))) {
continue
}
const relativeTarget = relative(parent, desired)

View File

@ -8,7 +8,7 @@ type PackageManifest = {
const root = process.cwd()
const bunRoot = join(root, "node_modules/.bun")
const bunEntries = (await safeReadDir(bunRoot)).sort()
const bunEntries = (await readdir(bunRoot)).sort()
let rewritten = 0
for (const entry of bunEntries) {
@ -45,11 +45,11 @@ for (const entry of bunEntries) {
}
}
console.log(`[normalize-bun-binaries] rewrote ${rewritten} links`)
console.log(`[normalize-bun-binaries] rebuilt ${rewritten} links`)
async function collectPackages(modulesRoot: string) {
const found: string[] = []
const topLevel = (await safeReadDir(modulesRoot)).sort()
const topLevel = (await readdir(modulesRoot)).sort()
for (const name of topLevel) {
if (name === ".bin" || name === ".bun") {
continue
@ -59,7 +59,7 @@ async function collectPackages(modulesRoot: string) {
continue
}
if (name.startsWith("@")) {
const scoped = (await safeReadDir(full)).sort()
const scoped = (await readdir(full)).sort()
for (const child of scoped) {
const scopedDir = join(full, child)
if (await isDirectory(scopedDir)) {
@ -121,14 +121,6 @@ async function isDirectory(path: string) {
}
}
async function safeReadDir(path: string) {
try {
return await readdir(path)
} catch {
return []
}
}
function normalizeBinName(name: string) {
const slash = name.lastIndexOf("/")
if (slash >= 0) {

View File

@ -84,7 +84,7 @@ function ServerKey(props: ParentProps) {
)
}
export function AppInterface(props: { defaultUrl?: string; children?: JSX.Element }) {
export function AppInterface(props: { defaultUrl?: string; children?: JSX.Element; isSidecar?: boolean }) {
const platform = usePlatform()
const stored = (() => {
@ -106,7 +106,7 @@ export function AppInterface(props: { defaultUrl?: string; children?: JSX.Elemen
}
return (
<ServerProvider defaultUrl={defaultServerUrl()}>
<ServerProvider defaultUrl={defaultServerUrl()} isSidecar={props.isSidecar}>
<ServerKey>
<GlobalSDKProvider>
<GlobalSyncProvider>

View File

@ -31,7 +31,7 @@ export function createPromptAttachments(input: PromptAttachmentsInput) {
const dataUrl = reader.result as string
const attachment: ImageAttachmentPart = {
type: "image",
id: crypto.randomUUID(),
id: crypto.randomUUID?.() ?? Math.random().toString(16).slice(2),
filename: file.name,
mime: file.type,
dataUrl,

View File

@ -283,7 +283,7 @@ export function SessionHeader() {
<Portal mount={mount()}>
<button
type="button"
class="hidden md:flex w-[320px] max-w-full min-w-0 p-1 pl-1.5 items-center gap-2 justify-between rounded-md border border-border-weak-base bg-surface-raised-base transition-colors cursor-default hover:bg-surface-raised-base-hover focus-visible:bg-surface-raised-base-hover active:bg-surface-raised-base-active"
class="hidden md:flex w-[320px] max-w-full min-w-0 h-[24px] px-2 pl-1.5 items-center gap-2 justify-between rounded-md border border-border-base bg-surface-panel transition-colors cursor-default hover:bg-surface-raised-base-hover focus-visible:bg-surface-raised-base-hover active:bg-surface-raised-base-active"
onClick={() => command.trigger("file.open")}
aria-label={language.t("session.header.searchFiles")}
>
@ -294,7 +294,11 @@ export function SessionHeader() {
</span>
</div>
<Show when={hotkey()}>{(keybind) => <Keybind class="shrink-0">{keybind()}</Keybind>}</Show>
<Show when={hotkey()}>
{(keybind) => (
<Keybind class="shrink-0 !border-0 !bg-transparent !shadow-none px-0">{keybind()}</Keybind>
)}
</Show>
</button>
</Portal>
)}
@ -303,6 +307,7 @@ export function SessionHeader() {
{(mount) => (
<Portal mount={mount()}>
<div class="flex items-center gap-3">
<StatusPopover />
<Show when={projectDirectory()}>
<div class="hidden xl:flex items-center">
<Show
@ -322,62 +327,62 @@ export function SessionHeader() {
}
>
<div class="flex items-center">
<Button
variant="ghost"
class="rounded-sm h-[24px] py-1.5 pr-3 pl-2 gap-2 border-none shadow-none rounded-r-none"
onClick={() => openDir(current().id)}
aria-label={language.t("session.header.open.ariaLabel", { app: current().label })}
>
<AppIcon id={current().icon} class="size-5" />
<span class="text-12-regular text-text-strong">
{language.t("session.header.open.action", { app: current().label })}
</span>
</Button>
<DropdownMenu>
<DropdownMenu.Trigger
as={IconButton}
icon="chevron-down"
<div class="flex h-[24px] box-border items-center rounded-md border border-border-base bg-surface-panel overflow-hidden">
<Button
variant="ghost"
class="rounded-sm h-[24px] w-auto px-1.5 border-none shadow-none rounded-l-none data-[expanded]:bg-surface-raised-base-active"
aria-label={language.t("session.header.open.menu")}
/>
<DropdownMenu.Portal>
<DropdownMenu.Content placement="bottom-end" gutter={6}>
<DropdownMenu.Group>
<DropdownMenu.GroupLabel>{language.t("session.header.openIn")}</DropdownMenu.GroupLabel>
<DropdownMenu.RadioGroup
value={prefs.app}
onChange={(value) => {
if (!OPEN_APPS.includes(value as OpenApp)) return
setPrefs("app", value as OpenApp)
}}
>
{options().map((o) => (
<DropdownMenu.RadioItem value={o.id} onSelect={() => openDir(o.id)}>
<AppIcon id={o.icon} class="size-5" />
<DropdownMenu.ItemLabel>{o.label}</DropdownMenu.ItemLabel>
<DropdownMenu.ItemIndicator>
<Icon name="check-small" size="small" class="text-icon-weak" />
</DropdownMenu.ItemIndicator>
</DropdownMenu.RadioItem>
))}
</DropdownMenu.RadioGroup>
</DropdownMenu.Group>
<DropdownMenu.Separator />
<DropdownMenu.Item onSelect={copyPath}>
<Icon name="copy" size="small" class="text-icon-weak" />
<DropdownMenu.ItemLabel>
{language.t("session.header.open.copyPath")}
</DropdownMenu.ItemLabel>
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Portal>
</DropdownMenu>
class="rounded-none h-full py-0 pr-3 pl-2 gap-1.5 border-none shadow-none"
onClick={() => openDir(current().id)}
aria-label={language.t("session.header.open.ariaLabel", { app: current().label })}
>
<AppIcon id={current().icon} class="size-4" />
<span class="text-12-regular text-text-strong">Open</span>
</Button>
<div class="self-stretch w-px bg-border-base/70" />
<DropdownMenu>
<DropdownMenu.Trigger
as={IconButton}
icon="chevron-down"
variant="ghost"
class="rounded-none h-full w-[24px] p-0 border-none shadow-none data-[expanded]:bg-surface-raised-base-active"
aria-label={language.t("session.header.open.menu")}
/>
<DropdownMenu.Portal>
<DropdownMenu.Content placement="bottom-end" gutter={6}>
<DropdownMenu.Group>
<DropdownMenu.GroupLabel>{language.t("session.header.openIn")}</DropdownMenu.GroupLabel>
<DropdownMenu.RadioGroup
value={prefs.app}
onChange={(value) => {
if (!OPEN_APPS.includes(value as OpenApp)) return
setPrefs("app", value as OpenApp)
}}
>
{options().map((o) => (
<DropdownMenu.RadioItem value={o.id} onSelect={() => openDir(o.id)}>
<AppIcon id={o.icon} class="size-5" />
<DropdownMenu.ItemLabel>{o.label}</DropdownMenu.ItemLabel>
<DropdownMenu.ItemIndicator>
<Icon name="check-small" size="small" class="text-icon-weak" />
</DropdownMenu.ItemIndicator>
</DropdownMenu.RadioItem>
))}
</DropdownMenu.RadioGroup>
</DropdownMenu.Group>
<DropdownMenu.Separator />
<DropdownMenu.Item onSelect={copyPath}>
<Icon name="copy" size="small" class="text-icon-weak" />
<DropdownMenu.ItemLabel>
{language.t("session.header.open.copyPath")}
</DropdownMenu.ItemLabel>
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Portal>
</DropdownMenu>
</div>
</div>
</Show>
</div>
</Show>
<StatusPopover />
<Show when={showShare()}>
<div class="flex items-center">
<Popover
@ -393,8 +398,9 @@ export function SessionHeader() {
class="rounded-xl [&_[data-slot=popover-close-button]]:hidden"
triggerAs={Button}
triggerProps={{
variant: "secondary",
class: "rounded-sm h-[24px] px-3",
variant: "ghost",
class:
"rounded-md h-[24px] px-3 border border-border-base bg-surface-panel shadow-none data-[expanded]:bg-surface-raised-base-active",
classList: { "rounded-r-none": shareUrl() !== undefined },
style: { scale: 1 },
}}
@ -466,8 +472,8 @@ export function SessionHeader() {
>
<IconButton
icon={state.copied ? "check" : "link"}
variant="secondary"
class="rounded-l-none"
variant="ghost"
class="rounded-l-none h-[24px] border border-border-base bg-surface-panel shadow-none"
onClick={copyLink}
disabled={state.unshare}
aria-label={

View File

@ -1,8 +1,10 @@
import { Component, createMemo, type JSX } from "solid-js"
import { Component, Show, createEffect, createMemo, createResource, 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"
import { Select } from "@opencode-ai/ui/select"
import { Switch } from "@opencode-ai/ui/switch"
import { Tooltip } from "@opencode-ai/ui/tooltip"
import { useTheme, type ColorScheme } from "@opencode-ai/ui/theme"
import { showToast } from "@opencode-ai/ui/toast"
import { useLanguage } from "@/context/language"
@ -40,6 +42,8 @@ export const SettingsGeneral: Component = () => {
checking: false,
})
const linux = createMemo(() => platform.platform === "desktop" && platform.os === "linux")
const check = () => {
if (!platform.checkUpdate) return
setStore("checking", true)
@ -410,13 +414,49 @@ export const SettingsGeneral: Component = () => {
</SettingsRow>
</div>
</div>
<Show when={linux()}>
{(_) => {
const [valueResource, actions] = createResource(() => platform.getDisplayBackend?.())
const value = () => (valueResource.state === "pending" ? undefined : valueResource.latest)
const onChange = (checked: boolean) =>
platform.setDisplayBackend?.(checked ? "wayland" : "auto").finally(() => actions.refetch())
return (
<div class="flex flex-col gap-1">
<h3 class="text-14-medium text-text-strong pb-2">{language.t("settings.general.section.display")}</h3>
<div class="bg-surface-raised-base px-4 rounded-lg">
<SettingsRow
title={
<div class="flex items-center gap-2">
<span>{language.t("settings.general.row.wayland.title")}</span>
<Tooltip value={language.t("settings.general.row.wayland.tooltip")} placement="top">
<span class="text-text-weak">
<Icon name="help" size="small" />
</span>
</Tooltip>
</div>
}
description={language.t("settings.general.row.wayland.description")}
>
<div data-action="settings-wayland">
<Switch checked={value() === "wayland"} onChange={onChange} />
</div>
</SettingsRow>
</div>
</div>
)
}}
</Show>
</div>
</div>
)
}
interface SettingsRowProps {
title: string
title: string | JSX.Element
description: string | JSX.Element
children: JSX.Element
}

View File

@ -141,7 +141,7 @@ export function StatusPopover() {
triggerProps={{
variant: "ghost",
class:
"rounded-sm w-[75px] h-[24px] py-1.5 pr-3 pl-2 gap-2 border-none shadow-none data-[expanded]:bg-surface-raised-base-active",
"rounded-md h-[24px] px-3 gap-2 border border-border-base bg-surface-panel shadow-none data-[expanded]:bg-surface-raised-base-active",
style: { scale: 1 },
}}
trigger={

View File

@ -53,7 +53,7 @@ function createCommentSessionState(store: Store<CommentStore>, setStore: SetStor
const add = (input: Omit<LineComment, "id" | "time">) => {
const next: LineComment = {
id: crypto.randomUUID(),
id: crypto.randomUUID?.() ?? Math.random().toString(16).slice(2),
time: Date.now(),
...input,
}

View File

@ -7,6 +7,7 @@ import { getFilename } from "@opencode-ai/util/path"
import { useSDK } from "./sdk"
import { useSync } from "./sync"
import { useLanguage } from "@/context/language"
import { useLayout } from "@/context/layout"
import { createPathHelpers } from "./file/path"
import {
approxBytes,
@ -50,9 +51,11 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
useSync()
const params = useParams()
const language = useLanguage()
const layout = useLayout()
const scope = createMemo(() => sdk.directory)
const path = createPathHelpers(scope)
const tabs = layout.tabs(() => `${params.dir}${params.id ? "/" + params.id : ""}`)
const inflight = new Map<string, Promise<void>>()
const [store, setStore] = createStore<{
@ -183,6 +186,7 @@ export const { use: useFile, provider: FileProvider } = createSimpleContext({
invalidateFromWatcher(e.details, {
normalize: path.normalize,
hasFile: (file) => Boolean(store.file[file]),
isOpen: (file) => tabs.all().some((tab) => path.pathFromTab(tab) === file),
loadFile: (file) => {
void load(file, { force: true })
},

View File

@ -27,6 +27,37 @@ describe("file watcher invalidation", () => {
expect(refresh).toEqual(["src"])
})
test("reloads files that are open in tabs", () => {
const loads: string[] = []
invalidateFromWatcher(
{
type: "file.watcher.updated",
properties: {
file: "src/open.ts",
event: "change",
},
},
{
normalize: (input) => input,
hasFile: () => false,
isOpen: (path) => path === "src/open.ts",
loadFile: (path) => loads.push(path),
node: () => ({
path: "src/open.ts",
type: "file",
name: "open.ts",
absolute: "/repo/src/open.ts",
ignored: false,
}),
isDirLoaded: () => false,
refreshDir: () => {},
},
)
expect(loads).toEqual(["src/open.ts"])
})
test("refreshes only changed loaded directory nodes", () => {
const refresh: string[] = []

View File

@ -8,6 +8,7 @@ type WatcherEvent = {
type WatcherOps = {
normalize: (input: string) => string
hasFile: (path: string) => boolean
isOpen?: (path: string) => boolean
loadFile: (path: string) => void
node: (path: string) => FileNode | undefined
isDirLoaded: (path: string) => boolean
@ -27,7 +28,7 @@ export function invalidateFromWatcher(event: WatcherEvent, ops: WatcherOps) {
if (!path) return
if (path.startsWith(".git/")) return
if (ops.hasFile(path)) {
if (ops.hasFile(path) || ops.isOpen?.(path)) {
ops.loadFile(path)
}

View File

@ -57,6 +57,12 @@ export type Platform = {
/** Set the default server URL to use on app startup (platform-specific) */
setDefaultServerUrl?(url: string | null): Promise<void> | void
/** Get the preferred display backend (desktop only) */
getDisplayBackend?(): Promise<DisplayBackend | null> | DisplayBackend | null
/** Set the preferred display backend (desktop only) */
setDisplayBackend?(backend: DisplayBackend): Promise<void>
/** Parse markdown to HTML using native parser (desktop only, returns unprocessed code blocks) */
parseMarkdown?(markdown: string): Promise<string>
@ -70,6 +76,8 @@ export type Platform = {
readClipboardImage?(): Promise<File | null>
}
export type DisplayBackend = "auto" | "wayland"
export const { use: usePlatform, provider: PlatformProvider } = createSimpleContext({
name: "Platform",
init: (props: { value: Platform }) => {

View File

@ -28,13 +28,14 @@ function projectsKey(url: string) {
export const { use: useServer, provider: ServerProvider } = createSimpleContext({
name: "Server",
init: (props: { defaultUrl: string }) => {
init: (props: { defaultUrl: string; isSidecar?: boolean }) => {
const platform = usePlatform()
const [store, setStore, _, ready] = persisted(
Persist.global("server", ["server.v3"]),
createStore({
list: [] as string[],
currentSidecarUrl: "",
projects: {} as Record<string, StoredProject[]>,
lastProject: {} as Record<string, string>,
}),
@ -59,7 +60,13 @@ export const { use: useServer, provider: ServerProvider } = createSimpleContext(
const fallback = normalizeServerUrl(props.defaultUrl)
if (fallback && url === fallback) {
setState("active", url)
batch(() => {
if (!store.list.includes(url)) {
// Add the fallback url to the list if it's not already in the list
setStore("list", store.list.length, url)
}
setState("active", url)
})
return
}
@ -89,7 +96,20 @@ export const { use: useServer, provider: ServerProvider } = createSimpleContext(
if (state.active) return
const url = normalizeServerUrl(props.defaultUrl)
if (!url) return
setState("active", url)
batch(() => {
// Remove the previous startup sidecar url
if (store.currentSidecarUrl) {
remove(store.currentSidecarUrl)
}
// Add the new sidecar url
if (props.isSidecar && props.defaultUrl) {
add(props.defaultUrl)
setStore("currentSidecarUrl", props.defaultUrl)
}
setState("active", url)
})
})
const isReady = createMemo(() => ready() && !!state.active)

View File

@ -44,6 +44,7 @@ export const dict = {
"command.session.new": "جلسة جديدة",
"command.file.open": "فتح ملف",
"command.tab.close": "إغلاق علامة التبويب",
"command.context.addSelection": "إضافة التحديد إلى السياق",
"command.context.addSelection.description": "إضافة الأسطر المحددة من الملف الحالي",
"command.input.focus": "التركيز على حقل الإدخال",

View File

@ -44,6 +44,7 @@ export const dict = {
"command.session.new": "Nova sessão",
"command.file.open": "Abrir arquivo",
"command.tab.close": "Fechar aba",
"command.context.addSelection": "Adicionar seleção ao contexto",
"command.context.addSelection.description": "Adicionar as linhas selecionadas do arquivo atual",
"command.input.focus": "Focar entrada",

View File

@ -44,6 +44,7 @@ export const dict = {
"command.session.new": "Ny session",
"command.file.open": "Åbn fil",
"command.tab.close": "Luk fane",
"command.context.addSelection": "Tilføj markering til kontekst",
"command.context.addSelection.description": "Tilføj markerede linjer fra den aktuelle fil",
"command.input.focus": "Fokuser inputfelt",

View File

@ -48,6 +48,7 @@ export const dict = {
"command.session.new": "Neue Sitzung",
"command.file.open": "Datei öffnen",
"command.tab.close": "Tab schließen",
"command.context.addSelection": "Auswahl zum Kontext hinzufügen",
"command.context.addSelection.description": "Ausgewählte Zeilen aus der aktuellen Datei hinzufügen",
"command.input.focus": "Eingabefeld fokussieren",

View File

@ -588,6 +588,7 @@ export const dict = {
"settings.general.section.notifications": "System notifications",
"settings.general.section.updates": "Updates",
"settings.general.section.sounds": "Sound effects",
"settings.general.section.display": "Display",
"settings.general.row.language.title": "Language",
"settings.general.row.language.description": "Change the display language for OpenCode",
@ -598,6 +599,11 @@ export const dict = {
"settings.general.row.font.title": "Font",
"settings.general.row.font.description": "Customise the mono font used in code blocks",
"settings.general.row.wayland.title": "Use native Wayland",
"settings.general.row.wayland.description": "Disable X11 fallback on Wayland. Requires restart.",
"settings.general.row.wayland.tooltip":
"On Linux with mixed refresh-rate monitors, native Wayland can be more stable.",
"settings.general.row.releaseNotes.title": "Release notes",
"settings.general.row.releaseNotes.description": "Show What's New popups after updates",

View File

@ -44,6 +44,7 @@ export const dict = {
"command.session.new": "Nueva sesión",
"command.file.open": "Abrir archivo",
"command.tab.close": "Cerrar pestaña",
"command.context.addSelection": "Añadir selección al contexto",
"command.context.addSelection.description": "Añadir las líneas seleccionadas del archivo actual",
"command.input.focus": "Enfocar entrada",

View File

@ -44,6 +44,7 @@ export const dict = {
"command.session.new": "Nouvelle session",
"command.file.open": "Ouvrir un fichier",
"command.tab.close": "Fermer l'onglet",
"command.context.addSelection": "Ajouter la sélection au contexte",
"command.context.addSelection.description": "Ajouter les lignes sélectionnées du fichier actuel",
"command.input.focus": "Focus input",

View File

@ -44,6 +44,7 @@ export const dict = {
"command.session.new": "新しいセッション",
"command.file.open": "ファイルを開く",
"command.tab.close": "タブを閉じる",
"command.context.addSelection": "選択範囲をコンテキストに追加",
"command.context.addSelection.description": "現在のファイルから選択した行を追加",
"command.input.focus": "入力欄にフォーカス",

View File

@ -48,6 +48,7 @@ export const dict = {
"command.session.new": "새 세션",
"command.file.open": "파일 열기",
"command.tab.close": "탭 닫기",
"command.context.addSelection": "선택 영역을 컨텍스트에 추가",
"command.context.addSelection.description": "현재 파일에서 선택한 줄을 추가",
"command.input.focus": "입력창 포커스",

View File

@ -47,6 +47,7 @@ export const dict = {
"command.session.new": "Ny sesjon",
"command.file.open": "Åpne fil",
"command.tab.close": "Lukk fane",
"command.context.addSelection": "Legg til markering i kontekst",
"command.context.addSelection.description": "Legg til valgte linjer fra gjeldende fil",
"command.input.focus": "Fokuser inndata",

View File

@ -44,6 +44,7 @@ export const dict = {
"command.session.new": "Nowa sesja",
"command.file.open": "Otwórz plik",
"command.tab.close": "Zamknij kartę",
"command.context.addSelection": "Dodaj zaznaczenie do kontekstu",
"command.context.addSelection.description": "Dodaj zaznaczone linie z bieżącego pliku",
"command.input.focus": "Fokus na pole wejściowe",

View File

@ -44,6 +44,7 @@ export const dict = {
"command.session.new": "Новая сессия",
"command.file.open": "Открыть файл",
"command.tab.close": "Закрыть вкладку",
"command.context.addSelection": "Добавить выделение в контекст",
"command.context.addSelection.description": "Добавить выбранные строки из текущего файла",
"command.input.focus": "Фокус на поле ввода",

View File

@ -44,6 +44,7 @@ export const dict = {
"command.session.new": "เซสชันใหม่",
"command.file.open": "เปิดไฟล์",
"command.tab.close": "ปิดแท็บ",
"command.context.addSelection": "เพิ่มส่วนที่เลือกไปยังบริบท",
"command.context.addSelection.description": "เพิ่มบรรทัดที่เลือกจากไฟล์ปัจจุบัน",
"command.input.focus": "โฟกัสช่องป้อนข้อมูล",

View File

@ -48,6 +48,7 @@ export const dict = {
"command.session.new": "新建会话",
"command.file.open": "打开文件",
"command.tab.close": "关闭标签页",
"command.context.addSelection": "将所选内容添加到上下文",
"command.context.addSelection.description": "添加当前文件中选中的行",
"command.input.focus": "聚焦输入框",

View File

@ -48,6 +48,7 @@ export const dict = {
"command.session.new": "新增工作階段",
"command.file.open": "開啟檔案",
"command.tab.close": "關閉分頁",
"command.context.addSelection": "將選取內容加入上下文",
"command.context.addSelection.description": "加入目前檔案中選取的行",
"command.input.focus": "聚焦輸入框",

View File

@ -1,3 +1,3 @@
export { PlatformProvider, type Platform } from "./context/platform"
export { PlatformProvider, type Platform, type DisplayBackend } from "./context/platform"
export { AppBaseProviders, AppInterface } from "./app"
export { useCommand } from "./context/command"

View File

@ -21,8 +21,11 @@ const OPENCODE_PROJECT_ID = "4b0ea68d7af9a6031a7ffda7ad66e0cb83315750"
export const ProjectIcon = (props: { project: LocalProject; class?: string; notify?: boolean }): JSX.Element => {
const notification = useNotification()
const unseenCount = createMemo(() => notification.project.unseenCount(props.project.worktree))
const hasError = createMemo(() => notification.project.unseenHasError(props.project.worktree))
const dirs = createMemo(() => [props.project.worktree, ...(props.project.sandboxes ?? [])])
const unseenCount = createMemo(() =>
dirs().reduce((total, directory) => total + notification.project.unseenCount(directory), 0),
)
const hasError = createMemo(() => dirs().some((directory) => notification.project.unseenHasError(directory)))
const name = createMemo(() => props.project.name || getFilename(props.project.worktree))
return (
<div class={`relative size-8 shrink-0 rounded ${props.class ?? ""}`}>

View File

@ -2,6 +2,7 @@ import { useNavigate, useParams } from "@solidjs/router"
import { createEffect, createMemo, For, Show, type Accessor, type JSX } from "solid-js"
import { createStore } from "solid-js/store"
import { createSortable } from "@thisbeyond/solid-dnd"
import { createMediaQuery } from "@solid-primitives/media"
import { base64Encode } from "@opencode-ai/util/encode"
import { getFilename } from "@opencode-ai/util/path"
import { Button } from "@opencode-ai/ui/button"
@ -114,7 +115,8 @@ export const SortableWorkspace = (props: {
const busy = createMemo(() => props.ctx.isBusy(props.directory))
const wasBusy = createMemo((prev) => prev || busy(), false)
const loading = createMemo(() => open() && !booted() && sessions().length === 0 && !wasBusy())
const showNew = createMemo(() => !loading() && (sessions().length === 0 || (active() && !params.id)))
const touch = createMediaQuery("(hover: none)")
const showNew = createMemo(() => !loading() && (touch() || sessions().length === 0 || (active() && !params.id)))
const loadMore = async () => {
setWorkspaceStore("limit", (limit) => limit + 5)
await globalSync.project.loadSessions(props.directory)
@ -270,23 +272,25 @@ export const SortableWorkspace = (props: {
</DropdownMenu.Content>
</DropdownMenu.Portal>
</DropdownMenu>
<Tooltip value={language.t("command.session.new")} placement="top">
<IconButton
icon="plus-small"
variant="ghost"
class="size-6 rounded-md opacity-0 pointer-events-none group-hover/workspace:opacity-100 group-hover/workspace:pointer-events-auto group-focus-within/workspace:opacity-100 group-focus-within/workspace:pointer-events-auto"
data-action="workspace-new-session"
data-workspace={base64Encode(props.directory)}
aria-label={language.t("command.session.new")}
onClick={(event) => {
event.preventDefault()
event.stopPropagation()
props.ctx.setHoverSession(undefined)
props.ctx.clearHoverProjectSoon()
navigate(`/${slug()}/session`)
}}
/>
</Tooltip>
<Show when={!touch()}>
<Tooltip value={language.t("command.session.new")} placement="top">
<IconButton
icon="plus-small"
variant="ghost"
class="size-6 rounded-md opacity-0 pointer-events-none group-hover/workspace:opacity-100 group-hover/workspace:pointer-events-auto group-focus-within/workspace:opacity-100 group-focus-within/workspace:pointer-events-auto"
data-action="workspace-new-session"
data-workspace={base64Encode(props.directory)}
aria-label={language.t("command.session.new")}
onClick={(event) => {
event.preventDefault()
event.stopPropagation()
props.ctx.setHoverSession(undefined)
props.ctx.clearHoverProjectSoon()
navigate(`/${slug()}/session`)
}}
/>
</Tooltip>
</Show>
</div>
</div>
</div>

View File

@ -18,7 +18,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
tauri-build = { version = "2", features = [] }
[dependencies]
tauri = { version = "2.9.5", features = ["macos-private-api", "devtools"] }
tauri = { version = "2.9.5", features = ["macos-private-api"] }
tauri-plugin-opener = "2"
tauri-plugin-deep-link = "2.4.6"
tauri-plugin-shell = "2"
@ -56,6 +56,7 @@ webkit2gtk = "=2.0.2"
objc2 = "0.6"
objc2-web-kit = "0.3"
[target.'cfg(windows)'.dependencies]
windows = { version = "0.61", features = [
"Win32_Foundation",

View File

@ -2,6 +2,8 @@ mod cli;
mod constants;
#[cfg(windows)]
mod job_object;
#[cfg(target_os = "linux")]
mod linux_display;
mod markdown;
mod server;
mod window_customizer;
@ -194,6 +196,43 @@ fn check_macos_app(app_name: &str) -> bool {
.unwrap_or(false)
}
#[derive(serde::Serialize, serde::Deserialize, specta::Type)]
#[serde(rename_all = "camelCase")]
pub enum LinuxDisplayBackend {
Wayland,
Auto,
}
#[tauri::command]
#[specta::specta]
fn get_display_backend() -> Option<LinuxDisplayBackend> {
#[cfg(target_os = "linux")]
{
let prefer = linux_display::read_wayland().unwrap_or(false);
return Some(if prefer {
LinuxDisplayBackend::Wayland
} else {
LinuxDisplayBackend::Auto
});
}
#[cfg(not(target_os = "linux"))]
None
}
#[tauri::command]
#[specta::specta]
fn set_display_backend(_app: AppHandle, _backend: LinuxDisplayBackend) -> Result<(), String> {
#[cfg(target_os = "linux")]
{
let prefer = matches!(_backend, LinuxDisplayBackend::Wayland);
return linux_display::write_wayland(&_app, prefer);
}
#[cfg(not(target_os = "linux"))]
Ok(())
}
#[cfg(target_os = "linux")]
fn check_linux_app(app_name: &str) -> bool {
return true;
@ -209,6 +248,8 @@ pub fn run() {
await_initialization,
server::get_default_server_url,
server::set_default_server_url,
get_display_backend,
set_display_backend,
markdown::parse_markdown_command,
check_app_exists
])

View File

@ -0,0 +1,47 @@
use serde::{Deserialize, Serialize};
use serde_json::json;
use std::path::PathBuf;
use tauri::AppHandle;
use tauri_plugin_store::StoreExt;
use crate::constants::SETTINGS_STORE;
pub const LINUX_DISPLAY_CONFIG_KEY: &str = "linuxDisplayConfig";
#[derive(Default, Serialize, Deserialize)]
struct DisplayConfig {
wayland: Option<bool>,
}
fn dir() -> Option<PathBuf> {
Some(dirs::data_dir()?.join("ai.opencode.desktop"))
}
fn path() -> Option<PathBuf> {
dir().map(|dir| dir.join(SETTINGS_STORE))
}
pub fn read_wayland() -> Option<bool> {
let path = path()?;
let raw = std::fs::read_to_string(path).ok()?;
let config = serde_json::from_str::<DisplayConfig>(&raw).ok()?;
config.wayland
}
pub fn write_wayland(app: &AppHandle, value: bool) -> Result<(), String> {
let store = app
.store(SETTINGS_STORE)
.map_err(|e| format!("Failed to open settings store: {}", e))?;
store.set(
LINUX_DISPLAY_CONFIG_KEY,
json!(DisplayConfig {
wayland: Some(value),
}),
);
store
.save()
.map_err(|e| format!("Failed to save settings store: {}", e))?;
Ok(())
}

View File

@ -2,6 +2,9 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
// borrowed from https://github.com/skyline69/balatro-mod-manager
#[cfg(target_os = "linux")]
mod display;
#[cfg(target_os = "linux")]
fn configure_display_backend() -> Option<String> {
use std::env;
@ -23,12 +26,16 @@ fn configure_display_backend() -> Option<String> {
return None;
}
// Allow users to explicitly keep Wayland if they know their setup is stable.
let allow_wayland = matches!(
env::var("OC_ALLOW_WAYLAND"),
Ok(v) if matches!(v.to_ascii_lowercase().as_str(), "1" | "true" | "yes")
);
let prefer_wayland = display::read_wayland().unwrap_or(false);
let allow_wayland = prefer_wayland
|| matches!(
env::var("OC_ALLOW_WAYLAND"),
Ok(v) if matches!(v.to_ascii_lowercase().as_str(), "1" | "true" | "yes")
);
if allow_wayland {
if prefer_wayland {
return Some("Wayland session detected; using native Wayland from settings".into());
}
return Some("Wayland session detected; respecting OC_ALLOW_WAYLAND=1".into());
}

View File

@ -10,6 +10,8 @@ export const commands = {
awaitInitialization: (events: Channel) => __TAURI_INVOKE<ServerReadyData>("await_initialization", { events }),
getDefaultServerUrl: () => __TAURI_INVOKE<string | null>("get_default_server_url"),
setDefaultServerUrl: (url: string | null) => __TAURI_INVOKE<null>("set_default_server_url", { url }),
getDisplayBackend: () => __TAURI_INVOKE<"wayland" | "auto" | null>("get_display_backend"),
setDisplayBackend: (backend: LinuxDisplayBackend) => __TAURI_INVOKE<null>("set_display_backend", { backend }),
parseMarkdownCommand: (markdown: string) => __TAURI_INVOKE<string>("parse_markdown_command", { markdown }),
checkAppExists: (appName: string) => __TAURI_INVOKE<boolean>("check_app_exists", { appName }),
};
@ -22,6 +24,8 @@ export const events = {
/* Types */
export type InitStep = { phase: "server_waiting" } | { phase: "sqlite_waiting" } | { phase: "done" };
export type LinuxDisplayBackend = "wayland" | "auto";
export type LoadingWindowComplete = null;
export type ServerReadyData = {

View File

@ -1,7 +1,14 @@
// @refresh reload
import { webviewZoom } from "./webview-zoom"
import { render } from "solid-js/web"
import { AppBaseProviders, AppInterface, PlatformProvider, Platform, useCommand } from "@opencode-ai/app"
import {
AppBaseProviders,
AppInterface,
PlatformProvider,
Platform,
DisplayBackend,
useCommand,
} from "@opencode-ai/app"
import { open, save } from "@tauri-apps/plugin-dialog"
import { getCurrent, onOpenUrl } from "@tauri-apps/plugin-deep-link"
import { openPath as openerOpenPath } from "@tauri-apps/plugin-opener"
@ -9,6 +16,7 @@ import { open as shellOpen } from "@tauri-apps/plugin-shell"
import { type as ostype } from "@tauri-apps/plugin-os"
import { check, Update } from "@tauri-apps/plugin-updater"
import { getCurrentWindow } from "@tauri-apps/api/window"
import { invoke } from "@tauri-apps/api/core"
import { isPermissionGranted, requestPermission } from "@tauri-apps/plugin-notification"
import { relaunch } from "@tauri-apps/plugin-process"
import { AsyncStorage } from "@solid-primitives/storage"
@ -338,6 +346,15 @@ const createPlatform = (password: Accessor<string | null>): Platform => ({
await commands.setDefaultServerUrl(url)
},
getDisplayBackend: async () => {
const result = await invoke<DisplayBackend | null>("get_display_backend").catch(() => null)
return result
},
setDisplayBackend: async (backend) => {
await invoke("set_display_backend", { backend }).catch(() => undefined)
},
parseMarkdown: (markdown: string) => commands.parseMarkdownCommand(markdown),
webviewZoom,
@ -413,7 +430,7 @@ render(() => {
}
return (
<AppInterface defaultUrl={data().url}>
<AppInterface defaultUrl={data().url} isSidecar>
<Inner />
</AppInterface>
)

View File

@ -0,0 +1,191 @@
import { APICallError } from "ai"
import { STATUS_CODES } from "http"
import { iife } from "@/util/iife"
export namespace ProviderError {
// Adapted from overflow detection patterns in:
// https://github.com/badlogic/pi-mono/blob/main/packages/ai/src/utils/overflow.ts
const OVERFLOW_PATTERNS = [
/prompt is too long/i, // Anthropic
/input is too long for requested model/i, // Amazon Bedrock
/exceeds the context window/i, // OpenAI (Completions + Responses API message text)
/input token count.*exceeds the maximum/i, // Google (Gemini)
/maximum prompt length is \d+/i, // xAI (Grok)
/reduce the length of the messages/i, // Groq
/maximum context length is \d+ tokens/i, // OpenRouter
/exceeds the limit of \d+/i, // GitHub Copilot
/exceeds the available context size/i, // llama.cpp server
/greater than the context length/i, // LM Studio
/context window exceeds limit/i, // MiniMax
/exceeded model token limit/i, // Kimi For Coding
/context[_ ]length[_ ]exceeded/i, // Generic fallback
/too many tokens/i, // Generic fallback
/token limit exceeded/i, // Generic fallback
]
function isOpenAiErrorRetryable(e: APICallError) {
const status = e.statusCode
if (!status) return e.isRetryable
// openai sometimes returns 404 for models that are actually available
return status === 404 || e.isRetryable
}
// Providers not reliably handled in this function:
// - z.ai: can accept overflow silently (needs token-count/context-window checks)
function isOverflow(message: string) {
if (OVERFLOW_PATTERNS.some((p) => p.test(message))) return true
// Providers/status patterns handled outside of regex list:
// - Cerebras: often returns "400 (no body)" / "413 (no body)"
// - Mistral: often returns "400 (no body)" / "413 (no body)"
return /^4(00|13)\s*(status code)?\s*\(no body\)/i.test(message)
}
function error(providerID: string, error: APICallError) {
if (providerID.includes("github-copilot") && error.statusCode === 403) {
return "Please reauthenticate with the copilot provider to ensure your credentials work properly with OpenCode."
}
return error.message
}
function message(providerID: string, e: APICallError) {
return iife(() => {
const msg = e.message
if (msg === "") {
if (e.responseBody) return e.responseBody
if (e.statusCode) {
const err = STATUS_CODES[e.statusCode]
if (err) return err
}
return "Unknown error"
}
const transformed = error(providerID, e)
if (transformed !== msg) {
return transformed
}
if (!e.responseBody || (e.statusCode && msg !== STATUS_CODES[e.statusCode])) {
return msg
}
try {
const body = JSON.parse(e.responseBody)
// try to extract common error message fields
const errMsg = body.message || body.error || body.error?.message
if (errMsg && typeof errMsg === "string") {
return `${msg}: ${errMsg}`
}
} catch {}
return `${msg}: ${e.responseBody}`
}).trim()
}
function json(input: unknown) {
if (typeof input === "string") {
try {
const result = JSON.parse(input)
if (result && typeof result === "object") return result
return undefined
} catch {
return undefined
}
}
if (typeof input === "object" && input !== null) {
return input
}
return undefined
}
export type ParsedStreamError =
| {
type: "context_overflow"
message: string
responseBody: string
}
| {
type: "api_error"
message: string
isRetryable: false
responseBody: string
}
export function parseStreamError(input: unknown): ParsedStreamError | undefined {
const body = json(input)
if (!body) return
const responseBody = JSON.stringify(body)
if (body.type !== "error") return
switch (body?.error?.code) {
case "context_length_exceeded":
return {
type: "context_overflow",
message: "Input exceeds context window of this model",
responseBody,
}
case "insufficient_quota":
return {
type: "api_error",
message: "Quota exceeded. Check your plan and billing details.",
isRetryable: false,
responseBody,
}
case "usage_not_included":
return {
type: "api_error",
message: "To use Codex with your ChatGPT plan, upgrade to Plus: https://chatgpt.com/explore/plus.",
isRetryable: false,
responseBody,
}
case "invalid_prompt":
return {
type: "api_error",
message: typeof body?.error?.message === "string" ? body?.error?.message : "Invalid prompt.",
isRetryable: false,
responseBody,
}
}
}
export type ParsedAPICallError =
| {
type: "context_overflow"
message: string
responseBody?: string
}
| {
type: "api_error"
message: string
statusCode?: number
isRetryable: boolean
responseHeaders?: Record<string, string>
responseBody?: string
metadata?: Record<string, string>
}
export function parseAPICallError(input: { providerID: string; error: APICallError }): ParsedAPICallError {
const m = message(input.providerID, input.error)
if (isOverflow(m)) {
return {
type: "context_overflow",
message: m,
responseBody: input.error.responseBody,
}
}
const metadata = input.error.url ? { url: input.error.url } : undefined
return {
type: "api_error",
message: m,
statusCode: input.error.statusCode,
isRetryable: input.providerID.startsWith("openai")
? isOpenAiErrorRetryable(input.error)
: input.error.isRetryable,
responseHeaders: input.error.responseHeaders,
responseBody: input.error.responseBody,
metadata,
}
}
}

View File

@ -1,4 +1,4 @@
import type { APICallError, ModelMessage } from "ai"
import type { ModelMessage } from "ai"
import { mergeDeep, unique } from "remeda"
import type { JSONSchema7 } from "@ai-sdk/provider"
import type { JSONSchema } from "zod/v4/core"
@ -643,6 +643,20 @@ export namespace ProviderTransform {
}
}
// Enable thinking for reasoning models on alibaba-cn (DashScope).
// DashScope's OpenAI-compatible API requires `enable_thinking: true` in the request body
// to return reasoning_content. Without it, models like kimi-k2.5, qwen-plus, qwen3, qwq,
// deepseek-r1, etc. never output thinking/reasoning tokens.
// Note: kimi-k2-thinking is excluded as it returns reasoning_content by default.
if (
input.model.providerID === "alibaba-cn" &&
input.model.capabilities.reasoning &&
input.model.api.npm === "@ai-sdk/openai-compatible" &&
!modelId.includes("kimi-k2-thinking")
) {
result["enable_thinking"] = true
}
if (input.model.api.id.includes("gpt-5") && !input.model.api.id.includes("gpt-5-chat")) {
if (!input.model.api.id.includes("gpt-5-pro")) {
result["reasoningEffort"] = "medium"
@ -810,19 +824,4 @@ export namespace ProviderTransform {
return schema as JSONSchema7
}
export function error(providerID: string, error: APICallError) {
let message = error.message
if (providerID.includes("github-copilot") && error.statusCode === 403) {
return "Please reauthenticate with the copilot provider to ensure your credentials work properly with OpenCode."
}
if (providerID.includes("github-copilot") && message.includes("The requested model is not supported")) {
return (
message +
"\n\nMake sure the model is enabled in your copilot settings: https://github.com/settings/copilot/features"
)
}
return message
}
}

View File

@ -7,8 +7,7 @@ import { LSP } from "../lsp"
import { Snapshot } from "@/snapshot"
import { fn } from "@/util/fn"
import { Storage } from "@/storage/storage"
import { ProviderTransform } from "@/provider/transform"
import { STATUS_CODES } from "http"
import { ProviderError } from "@/provider/error"
import { iife } from "@/util/iife"
import { type SystemError } from "bun"
import type { Provider } from "@/provider/provider"
@ -35,6 +34,10 @@ export namespace MessageV2 {
}),
)
export type APIError = z.infer<typeof APIError.Schema>
export const ContextOverflowError = NamedError.create(
"ContextOverflowError",
z.object({ message: z.string(), responseBody: z.string().optional() }),
)
const PartBase = z.object({
id: z.string(),
@ -361,6 +364,7 @@ export namespace MessageV2 {
NamedError.Unknown.Schema,
OutputLengthError.Schema,
AbortedError.Schema,
ContextOverflowError.Schema,
APIError.Schema,
])
.optional(),
@ -711,13 +715,6 @@ export namespace MessageV2 {
return result
}
const isOpenAiErrorRetryable = (e: APICallError) => {
const status = e.statusCode
if (!status) return e.isRetryable
// openai sometimes returns 404 for models that are actually available
return status === 404 || e.isRetryable
}
export function fromError(e: unknown, ctx: { providerID: string }) {
switch (true) {
case e instanceof DOMException && e.name === "AbortError":
@ -751,52 +748,59 @@ export namespace MessageV2 {
{ cause: e },
).toObject()
case APICallError.isInstance(e):
const message = iife(() => {
let msg = e.message
if (msg === "") {
if (e.responseBody) return e.responseBody
if (e.statusCode) {
const err = STATUS_CODES[e.statusCode]
if (err) return err
}
return "Unknown error"
}
const transformed = ProviderTransform.error(ctx.providerID, e)
if (transformed !== msg) {
return transformed
}
if (!e.responseBody || (e.statusCode && msg !== STATUS_CODES[e.statusCode])) {
return msg
}
const parsed = ProviderError.parseAPICallError({
providerID: ctx.providerID,
error: e,
})
if (parsed.type === "context_overflow") {
return new MessageV2.ContextOverflowError(
{
message: parsed.message,
responseBody: parsed.responseBody,
},
{ cause: e },
).toObject()
}
try {
const body = JSON.parse(e.responseBody)
// try to extract common error message fields
const errMsg = body.message || body.error || body.error?.message
if (errMsg && typeof errMsg === "string") {
return `${msg}: ${errMsg}`
}
} catch {}
return `${msg}: ${e.responseBody}`
}).trim()
const metadata = e.url ? { url: e.url } : undefined
return new MessageV2.APIError(
{
message,
statusCode: e.statusCode,
isRetryable: ctx.providerID.startsWith("openai") ? isOpenAiErrorRetryable(e) : e.isRetryable,
responseHeaders: e.responseHeaders,
responseBody: e.responseBody,
metadata,
message: parsed.message,
statusCode: parsed.statusCode,
isRetryable: parsed.isRetryable,
responseHeaders: parsed.responseHeaders,
responseBody: parsed.responseBody,
metadata: parsed.metadata,
},
{ cause: e },
).toObject()
case e instanceof Error:
return new NamedError.Unknown({ message: e.toString() }, { cause: e }).toObject()
default:
return new NamedError.Unknown({ message: JSON.stringify(e) }, { cause: e })
try {
const parsed = ProviderError.parseStreamError(e)
if (parsed) {
if (parsed.type === "context_overflow") {
return new MessageV2.ContextOverflowError(
{
message: parsed.message,
responseBody: parsed.responseBody,
},
{ cause: e },
).toObject()
}
return new MessageV2.APIError(
{
message: parsed.message,
isRetryable: parsed.isRetryable,
responseBody: parsed.responseBody,
},
{
cause: e,
},
).toObject()
}
} catch {}
return new NamedError.Unknown({ message: JSON.stringify(e) }, { cause: e }).toObject()
}
}
}

View File

@ -59,6 +59,9 @@ export namespace SessionRetry {
}
export function retryable(error: ReturnType<NamedError["toObject"]>) {
// DO NOT retry context overflow errors
if (MessageV2.ContextOverflowError.isInstance(error)) return undefined
if (MessageV2.APIError.isInstance(error)) {
if (!error.data.isRetryable) return undefined
return error.data.message.includes("Overloaded") ? "Provider is overloaded" : error.data.message

View File

@ -1,4 +1,5 @@
import { describe, expect, test } from "bun:test"
import { APICallError } from "ai"
import { MessageV2 } from "../../src/session/message-v2"
import type { Provider } from "../../src/provider/provider"
@ -784,3 +785,140 @@ describe("session.message-v2.toModelMessage", () => {
])
})
})
describe("session.message-v2.fromError", () => {
test("serializes context_length_exceeded as ContextOverflowError", () => {
const input = {
type: "error",
error: {
code: "context_length_exceeded",
},
}
const result = MessageV2.fromError(input, { providerID: "test" })
expect(result).toStrictEqual({
name: "ContextOverflowError",
data: {
message: "Input exceeds context window of this model",
responseBody: JSON.stringify(input),
},
})
})
test("serializes response error codes", () => {
const cases = [
{
code: "insufficient_quota",
message: "Quota exceeded. Check your plan and billing details.",
},
{
code: "usage_not_included",
message: "To use Codex with your ChatGPT plan, upgrade to Plus: https://chatgpt.com/explore/plus.",
},
{
code: "invalid_prompt",
message: "Invalid prompt from test",
},
]
cases.forEach((item) => {
const input = {
type: "error",
error: {
code: item.code,
message: item.code === "invalid_prompt" ? item.message : undefined,
},
}
const result = MessageV2.fromError(input, { providerID: "test" })
expect(result).toStrictEqual({
name: "APIError",
data: {
message: item.message,
isRetryable: false,
responseBody: JSON.stringify(input),
},
})
})
})
test("maps github-copilot 403 to reauth guidance", () => {
const error = new APICallError({
message: "forbidden",
url: "https://api.githubcopilot.com/v1/chat/completions",
requestBodyValues: {},
statusCode: 403,
responseHeaders: { "content-type": "application/json" },
responseBody: '{"error":"forbidden"}',
isRetryable: false,
})
const result = MessageV2.fromError(error, { providerID: "github-copilot" })
expect(result).toStrictEqual({
name: "APIError",
data: {
message:
"Please reauthenticate with the copilot provider to ensure your credentials work properly with OpenCode.",
statusCode: 403,
isRetryable: false,
responseHeaders: { "content-type": "application/json" },
responseBody: '{"error":"forbidden"}',
metadata: {
url: "https://api.githubcopilot.com/v1/chat/completions",
},
},
})
})
test("detects context overflow from APICallError provider messages", () => {
const cases = [
"prompt is too long: 213462 tokens > 200000 maximum",
"Your input exceeds the context window of this model",
"The input token count (1196265) exceeds the maximum number of tokens allowed (1048575)",
"Please reduce the length of the messages or completion",
"400 status code (no body)",
"413 status code (no body)",
]
cases.forEach((message) => {
const error = new APICallError({
message,
url: "https://example.com",
requestBodyValues: {},
statusCode: 400,
responseHeaders: { "content-type": "application/json" },
isRetryable: false,
})
const result = MessageV2.fromError(error, { providerID: "test" })
expect(MessageV2.ContextOverflowError.isInstance(result)).toBe(true)
})
})
test("does not classify 429 no body as context overflow", () => {
const result = MessageV2.fromError(
new APICallError({
message: "429 status code (no body)",
url: "https://example.com",
requestBodyValues: {},
statusCode: 429,
responseHeaders: { "content-type": "application/json" },
isRetryable: false,
}),
{ providerID: "test" },
)
expect(MessageV2.ContextOverflowError.isInstance(result)).toBe(false)
expect(MessageV2.APIError.isInstance(result)).toBe(true)
})
test("serializes unknown inputs", () => {
const result = MessageV2.fromError(123, { providerID: "test" })
expect(result).toStrictEqual({
name: "UnknownError",
data: {
message: "123",
},
})
})
})

View File

@ -152,6 +152,14 @@ export type MessageAbortedError = {
}
}
export type ContextOverflowError = {
name: "ContextOverflowError"
data: {
message: string
responseBody?: string
}
}
export type ApiError = {
name: "APIError"
data: {
@ -176,7 +184,13 @@ export type AssistantMessage = {
created: number
completed?: number
}
error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError
error?:
| ProviderAuthError
| UnknownError
| MessageOutputLengthError
| MessageAbortedError
| ContextOverflowError
| ApiError
parentID: string
modelID: string
providerID: string
@ -820,7 +834,13 @@ export type EventSessionError = {
type: "session.error"
properties: {
sessionID?: string
error?: ProviderAuthError | UnknownError | MessageOutputLengthError | MessageAbortedError | ApiError
error?:
| ProviderAuthError
| UnknownError
| MessageOutputLengthError
| MessageAbortedError
| ContextOverflowError
| ApiError
}
}

View File

@ -6344,6 +6344,28 @@
},
"required": ["name", "data"]
},
"ContextOverflowError": {
"type": "object",
"properties": {
"name": {
"type": "string",
"const": "ContextOverflowError"
},
"data": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"responseBody": {
"type": "string"
}
},
"required": ["message"]
}
},
"required": ["name", "data"]
},
"APIError": {
"type": "object",
"properties": {
@ -6429,6 +6451,9 @@
{
"$ref": "#/components/schemas/MessageAbortedError"
},
{
"$ref": "#/components/schemas/ContextOverflowError"
},
{
"$ref": "#/components/schemas/APIError"
}
@ -8196,6 +8221,9 @@
{
"$ref": "#/components/schemas/MessageAbortedError"
},
{
"$ref": "#/components/schemas/ContextOverflowError"
},
{
"$ref": "#/components/schemas/APIError"
}

View File

@ -1 +1 @@
<?xml version="1.0" encoding="UTF-8"?><svg id="cursor_light__Ebene_1" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 466.73 532.09"><!--Generator: Adobe Illustrator 29.6.1, SVG Export Plug-In . SVG Version: 2.1.1 Build 9)--><defs><style>.cursor_light__st0{fill:#26251e}</style></defs><path class="cursor_light__st0" d="M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z"/></svg>
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><g clip-path="url(#prefix__clip0_5_17)"><rect width="512" height="512" rx="122" fill="#000"/><g clip-path="url(#prefix__clip1_5_17)"><mask id="prefix__a" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="85" y="89" width="343" height="334"><path d="M85 89h343v334H85V89z" fill="#fff"/></mask><g mask="url(#prefix__a)"><path d="M255.428 423l148.991-83.5L255.428 256l-148.99 83.5 148.99 83.5z" fill="url(#prefix__paint0_linear_5_17)"/><path d="M404.419 339.5v-167L255.428 89v167l148.991 83.5z" fill="url(#prefix__paint1_linear_5_17)"/><path d="M255.428 89l-148.99 83.5v167l148.99-83.5V89z" fill="url(#prefix__paint2_linear_5_17)"/><path d="M404.419 172.5L255.428 423V256l148.991-83.5z" fill="#E4E4E4"/><path d="M404.419 172.5L255.428 256l-148.99-83.5h297.981z" fill="#fff"/></g></g></g><defs><linearGradient id="prefix__paint0_linear_5_17" x1="255.428" y1="256" x2="255.428" y2="423" gradientUnits="userSpaceOnUse"><stop offset=".16" stop-color="#fff" stop-opacity=".39"/><stop offset=".658" stop-color="#fff" stop-opacity=".8"/></linearGradient><linearGradient id="prefix__paint1_linear_5_17" x1="404.419" y1="173.015" x2="257.482" y2="261.497" gradientUnits="userSpaceOnUse"><stop offset=".182" stop-color="#fff" stop-opacity=".31"/><stop offset=".715" stop-color="#fff" stop-opacity="0"/></linearGradient><linearGradient id="prefix__paint2_linear_5_17" x1="255.428" y1="89" x2="112.292" y2="342.802" gradientUnits="userSpaceOnUse"><stop stop-color="#fff" stop-opacity=".6"/><stop offset=".667" stop-color="#fff" stop-opacity=".22"/></linearGradient><clipPath id="prefix__clip0_5_17"><path fill="#fff" d="M0 0h512v512H0z"/></clipPath><clipPath id="prefix__clip1_5_17"><path fill="#fff" transform="translate(85 89)" d="M0 0h343v334H0z"/></clipPath></defs></svg>

Before

Width:  |  Height:  |  Size: 782 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 513 KiB

After

Width:  |  Height:  |  Size: 273 KiB

View File

@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" fill="none" viewBox="0 0 96 96">
<g clip-path="url(#zed_logo-dark-a)">
<path
fill="#fff"
fill-rule="evenodd"
d="M9 6a3 3 0 0 0-3 3v66H0V9a9 9 0 0 1 9-9h80.379c4.009 0 6.016 4.847 3.182 7.682L43.055 57.187H57V51h6v7.688a4.5 4.5 0 0 1-4.5 4.5H37.055L26.743 73.5H73.5V36h6v37.5a6 6 0 0 1-6 6H20.743L10.243 90H87a3 3 0 0 0 3-3V21h6v66a9 9 0 0 1-9 9H6.621c-4.009 0-6.016-4.847-3.182-7.682L52.757 39H39v6h-6v-7.5a4.5 4.5 0 0 1 4.5-4.5h21.257l10.5-10.5H22.5V60h-6V22.5a6 6 0 0 1 6-6h52.757L85.757 6H9Z"
clip-rule="evenodd"
/>
</g>
<defs>
<clipPath id="zed_logo-dark-a">
<path fill="#fff" d="M0 0h96v96H0z" />
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 746 B

View File

@ -1 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" fill="none" viewBox="0 0 96 96"><g clip-path="url(#zed_light__a)"><path fill="currentColor" fill-rule="evenodd" d="M9 6a3 3 0 0 0-3 3v66H0V9a9 9 0 0 1 9-9h80.379c4.009 0 6.016 4.847 3.182 7.682L43.055 57.187H57V51h6v7.688a4.5 4.5 0 0 1-4.5 4.5H37.055L26.743 73.5H73.5V36h6v37.5a6 6 0 0 1-6 6H20.743L10.243 90H87a3 3 0 0 0 3-3V21h6v66a9 9 0 0 1-9 9H6.621c-4.009 0-6.016-4.847-3.182-7.682L52.757 39H39v6h-6v-7.5a4.5 4.5 0 0 1 4.5-4.5h21.257l10.5-10.5H22.5V60h-6V22.5a6 6 0 0 1 6-6h52.757L85.757 6H9Z" clip-rule="evenodd"/></g><defs><clipPath id="zed_light__a"><path fill="#fff" d="M0 0h96v96H0z"/></clipPath></defs></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" fill="none" viewBox="0 0 96 96">
<g clip-path="url(#zed_logo-a)">
<path
fill="#000"
fill-rule="evenodd"
d="M9 6a3 3 0 0 0-3 3v66H0V9a9 9 0 0 1 9-9h80.379c4.009 0 6.016 4.847 3.182 7.682L43.055 57.187H57V51h6v7.688a4.5 4.5 0 0 1-4.5 4.5H37.055L26.743 73.5H73.5V36h6v37.5a6 6 0 0 1-6 6H20.743L10.243 90H87a3 3 0 0 0 3-3V21h6v66a9 9 0 0 1-9 9H6.621c-4.009 0-6.016-4.847-3.182-7.682L52.757 39H39v6h-6v-7.5a4.5 4.5 0 0 1 4.5-4.5h21.257l10.5-10.5H22.5V60h-6V22.5a6 6 0 0 1 6-6h52.757L85.757 6H9Z"
clip-rule="evenodd"
/>
</g>
<defs>
<clipPath id="zed_logo-a">
<path fill="#fff" d="M0 0h96v96H0z" />
</clipPath>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 682 B

After

Width:  |  Height:  |  Size: 736 B

View File

@ -1,9 +1,5 @@
img[data-component="app-icon"] {
display: block;
box-sizing: border-box;
padding: 2px;
border-radius: 0.125rem;
background: var(--smoke-light-2);
border: 1px solid var(--smoke-light-alpha-4);
object-fit: contain;
}

View File

@ -1,5 +1,5 @@
import type { Component, ComponentProps } from "solid-js"
import { splitProps } from "solid-js"
import { createSignal, onCleanup, onMount, splitProps } from "solid-js"
import type { IconName } from "./app-icons/types"
import androidStudio from "../assets/icons/app/android-studio.svg"
@ -15,6 +15,7 @@ import textmate from "../assets/icons/app/textmate.png"
import vscode from "../assets/icons/app/vscode.svg"
import xcode from "../assets/icons/app/xcode.png"
import zed from "../assets/icons/app/zed.svg"
import zedDark from "../assets/icons/app/zed-dark.svg"
import sublimetext from "../assets/icons/app/sublimetext.svg"
const icons = {
@ -34,17 +35,43 @@ const icons = {
"sublime-text": sublimetext,
} satisfies Record<IconName, string>
const themed: Partial<Record<IconName, { light: string; dark: string }>> = {
zed: {
light: zed,
dark: zedDark,
},
}
const scheme = () => {
if (typeof document !== "object") return "light" as const
if (document.documentElement.dataset.colorScheme === "dark") return "dark" as const
return "light" as const
}
export type AppIconProps = Omit<ComponentProps<"img">, "src"> & {
id: IconName
}
export const AppIcon: Component<AppIconProps> = (props) => {
const [local, rest] = splitProps(props, ["id", "class", "classList", "alt", "draggable"])
const [mode, setMode] = createSignal(scheme())
onMount(() => {
const sync = () => setMode(scheme())
const observer = new MutationObserver(sync)
observer.observe(document.documentElement, {
attributes: true,
attributeFilter: ["data-color-scheme"],
})
sync()
onCleanup(() => observer.disconnect())
})
return (
<img
data-component="app-icon"
{...rest}
src={icons[local.id]}
src={themed[local.id]?.[mode()] ?? icons[local.id]}
alt={local.alt ?? ""}
draggable={local.draggable ?? false}
classList={{

View File

@ -79,9 +79,9 @@
background-color: var(--surface-hover);
}
&:focus-within:not([data-readonly]) [data-slot="checkbox-checkbox-control"] {
&:not([data-readonly]) [data-slot="checkbox-checkbox-input"]:focus-visible + [data-slot="checkbox-checkbox-control"] {
border-color: var(--border-focus);
box-shadow: 0 0 0 2px var(--surface-focus);
box-shadow: var(--shadow-xs-border-focus);
}
&[data-checked] [data-slot="checkbox-checkbox-control"],

View File

@ -32,6 +32,7 @@
/* } */
&:focus-visible {
outline: none;
background-color: var(--surface-raised-base-hover);
}
&[data-disabled] {
cursor: not-allowed;
@ -70,6 +71,7 @@
/* } */
&:focus-visible {
outline: none;
background-color: var(--surface-raised-base-hover);
}
&[data-disabled] {
cursor: not-allowed;

View File

@ -538,11 +538,7 @@ const toOpenVariant = (icon: IconName): IconName => {
return icon
}
const basenameOf = (p: string) =>
p
.replace(/[/\\]+$/, "")
.split(/[\\/]/)
.pop() ?? ""
const basenameOf = (p: string) => p.split("\\").join("/").split("/").filter(Boolean).pop() ?? ""
const folderNameVariants = (name: string) => {
const n = name.toLowerCase()

View File

@ -82,7 +82,7 @@
box-shadow: var(--shadow-xs-border-base);
}
&:not([data-expanded]):focus {
&:not([data-expanded]):not(:focus-visible):focus {
background-color: transparent;
box-shadow: none;
}

View File

@ -86,9 +86,9 @@
background-color: var(--surface-hover);
}
&:focus-within:not([data-readonly]) [data-slot="switch-control"] {
&:not([data-readonly]) [data-slot="switch-input"]:focus-visible ~ [data-slot="switch-control"] {
border-color: var(--border-focus);
box-shadow: 0 0 0 2px var(--surface-focus);
box-shadow: var(--shadow-xs-border-focus);
}
&[data-checked] [data-slot="switch-control"] {

View File

@ -429,6 +429,11 @@
background-color: var(--surface-raised-base-hover);
}
&:has([data-slot="tabs-trigger"]:focus-visible) {
background-color: var(--surface-raised-base-hover);
box-shadow: var(--shadow-xs-border-focus);
}
&:has([data-selected]) {
background-color: var(--surface-raised-base-active);
color: var(--text-strong);

View File

@ -1,5 +1,5 @@
import { Tooltip as KobalteTooltip } from "@kobalte/core/tooltip"
import { children, createSignal, Match, onMount, splitProps, Switch, type JSX } from "solid-js"
import { createSignal, Match, splitProps, Switch, type JSX } from "solid-js"
import type { ComponentProps } from "solid-js"
export interface TooltipProps extends ComponentProps<typeof KobalteTooltip> {
@ -40,32 +40,16 @@ export function Tooltip(props: TooltipProps) {
"contentStyle",
"inactive",
"forceOpen",
"value",
])
const c = children(() => local.children)
onMount(() => {
const childElements = c()
if (childElements instanceof HTMLElement) {
childElements.addEventListener("focusin", () => setOpen(true))
childElements.addEventListener("focusout", () => setOpen(false))
} else if (Array.isArray(childElements)) {
for (const child of childElements) {
if (child instanceof HTMLElement) {
child.addEventListener("focusin", () => setOpen(true))
child.addEventListener("focusout", () => setOpen(false))
}
}
}
})
return (
<Switch>
<Match when={local.inactive}>{local.children}</Match>
<Match when={true}>
<KobalteTooltip gutter={4} {...others} open={local.forceOpen || open()} onOpenChange={setOpen}>
<KobalteTooltip.Trigger as={"div"} data-component="tooltip-trigger" class={local.class}>
{c()}
{local.children}
</KobalteTooltip.Trigger>
<KobalteTooltip.Portal>
<KobalteTooltip.Content
@ -75,7 +59,7 @@ export function Tooltip(props: TooltipProps) {
class={local.contentClass}
style={local.contentStyle}
>
{others.value}
{local.value}
{/* <KobalteTooltip.Arrow data-slot="tooltip-arrow" /> */}
</KobalteTooltip.Content>
</KobalteTooltip.Portal>

View File

@ -1,231 +0,0 @@
{
"$schema": "https://opencode.ai/theme.json",
"defs": {
"darkWorldBg": "#0B0B3B",
"darkWorldDeep": "#050520",
"darkWorldPanel": "#151555",
"krisBlue": "#6A7BC4",
"krisCyan": "#75FBED",
"krisIce": "#C7E3F2",
"susiePurple": "#5B209D",
"susieMagenta": "#A017D0",
"susiePink": "#F983D8",
"ralseiGreen": "#33A56C",
"ralseiTeal": "#40E4D4",
"noelleRose": "#DC8998",
"noelleRed": "#DC1510",
"noelleMint": "#ECFFBB",
"noelleCyan": "#77E0FF",
"noelleAqua": "#BBFFFC",
"gold": "#FBCE3C",
"orange": "#F4A731",
"hotPink": "#EB0095",
"queenPink": "#F983D8",
"cyberGreen": "#00FF00",
"white": "#FFFFFF",
"black": "#000000",
"textMuted": "#8888AA"
},
"theme": {
"primary": {
"dark": "hotPink",
"light": "susieMagenta"
},
"secondary": {
"dark": "krisCyan",
"light": "krisBlue"
},
"accent": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"error": {
"dark": "noelleRed",
"light": "noelleRed"
},
"warning": {
"dark": "gold",
"light": "orange"
},
"success": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"info": {
"dark": "noelleCyan",
"light": "krisBlue"
},
"text": {
"dark": "white",
"light": "black"
},
"textMuted": {
"dark": "textMuted",
"light": "#555577"
},
"background": {
"dark": "darkWorldBg",
"light": "white"
},
"backgroundPanel": {
"dark": "darkWorldDeep",
"light": "#F0F0F8"
},
"backgroundElement": {
"dark": "darkWorldPanel",
"light": "#E5E5F0"
},
"border": {
"dark": "krisBlue",
"light": "susiePurple"
},
"borderActive": {
"dark": "hotPink",
"light": "susieMagenta"
},
"borderSubtle": {
"dark": "#3A3A6A",
"light": "#AAAACC"
},
"diffAdded": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"diffRemoved": {
"dark": "hotPink",
"light": "noelleRed"
},
"diffContext": {
"dark": "textMuted",
"light": "#666688"
},
"diffHunkHeader": {
"dark": "krisBlue",
"light": "susiePurple"
},
"diffHighlightAdded": {
"dark": "ralseiGreen",
"light": "ralseiTeal"
},
"diffHighlightRemoved": {
"dark": "noelleRed",
"light": "hotPink"
},
"diffAddedBg": {
"dark": "#0A2A2A",
"light": "#D4FFEE"
},
"diffRemovedBg": {
"dark": "#2A0A2A",
"light": "#FFD4E8"
},
"diffContextBg": {
"dark": "darkWorldDeep",
"light": "#F5F5FA"
},
"diffLineNumber": {
"dark": "textMuted",
"light": "#666688"
},
"diffAddedLineNumberBg": {
"dark": "#082020",
"light": "#E0FFF0"
},
"diffRemovedLineNumberBg": {
"dark": "#200820",
"light": "#FFE0F0"
},
"markdownText": {
"dark": "white",
"light": "black"
},
"markdownHeading": {
"dark": "gold",
"light": "orange"
},
"markdownLink": {
"dark": "krisCyan",
"light": "krisBlue"
},
"markdownLinkText": {
"dark": "noelleCyan",
"light": "susiePurple"
},
"markdownCode": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"markdownBlockQuote": {
"dark": "textMuted",
"light": "#666688"
},
"markdownEmph": {
"dark": "susiePink",
"light": "susieMagenta"
},
"markdownStrong": {
"dark": "hotPink",
"light": "susiePurple"
},
"markdownHorizontalRule": {
"dark": "krisBlue",
"light": "susiePurple"
},
"markdownListItem": {
"dark": "gold",
"light": "orange"
},
"markdownListEnumeration": {
"dark": "krisCyan",
"light": "krisBlue"
},
"markdownImage": {
"dark": "susieMagenta",
"light": "susiePurple"
},
"markdownImageText": {
"dark": "susiePink",
"light": "susieMagenta"
},
"markdownCodeBlock": {
"dark": "white",
"light": "black"
},
"syntaxComment": {
"dark": "textMuted",
"light": "#666688"
},
"syntaxKeyword": {
"dark": "hotPink",
"light": "susieMagenta"
},
"syntaxFunction": {
"dark": "krisCyan",
"light": "krisBlue"
},
"syntaxVariable": {
"dark": "gold",
"light": "orange"
},
"syntaxString": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"syntaxNumber": {
"dark": "noelleRose",
"light": "noelleRed"
},
"syntaxType": {
"dark": "noelleCyan",
"light": "krisBlue"
},
"syntaxOperator": {
"dark": "white",
"light": "black"
},
"syntaxPunctuation": {
"dark": "krisBlue",
"light": "#555577"
}
}
}

View File

@ -1,232 +0,0 @@
{
"$schema": "https://opencode.ai/theme.json",
"defs": {
"black": "#000000",
"white": "#FFFFFF",
"soulRed": "#FF0000",
"soulOrange": "#FF6600",
"soulYellow": "#FFFF00",
"soulGreen": "#00FF00",
"soulAqua": "#00FFFF",
"soulBlue": "#0000FF",
"soulPurple": "#FF00FF",
"ruinsPurple": "#A349A4",
"ruinsDark": "#380A43",
"snowdinBlue": "#6BA3E5",
"hotlandOrange": "#FF7F27",
"coreGray": "#3A3949",
"battleBg": "#0D0D1A",
"battlePanel": "#1A1A2E",
"uiYellow": "#FFC90E",
"textGray": "#909090",
"damageRed": "#FF3333",
"healGreen": "#00FF00",
"saveYellow": "#FFFF00",
"determinationRed": "#FF0000",
"mttPink": "#FF6EB4",
"waterfall": "#283197",
"waterfallGlow": "#00BFFF"
},
"theme": {
"primary": {
"dark": "soulRed",
"light": "determinationRed"
},
"secondary": {
"dark": "uiYellow",
"light": "uiYellow"
},
"accent": {
"dark": "soulAqua",
"light": "soulBlue"
},
"error": {
"dark": "damageRed",
"light": "soulRed"
},
"warning": {
"dark": "uiYellow",
"light": "hotlandOrange"
},
"success": {
"dark": "healGreen",
"light": "soulGreen"
},
"info": {
"dark": "soulAqua",
"light": "waterfallGlow"
},
"text": {
"dark": "white",
"light": "black"
},
"textMuted": {
"dark": "textGray",
"light": "coreGray"
},
"background": {
"dark": "black",
"light": "white"
},
"backgroundPanel": {
"dark": "battleBg",
"light": "#F0F0F0"
},
"backgroundElement": {
"dark": "battlePanel",
"light": "#E5E5E5"
},
"border": {
"dark": "white",
"light": "black"
},
"borderActive": {
"dark": "soulRed",
"light": "determinationRed"
},
"borderSubtle": {
"dark": "#555555",
"light": "#AAAAAA"
},
"diffAdded": {
"dark": "healGreen",
"light": "soulGreen"
},
"diffRemoved": {
"dark": "damageRed",
"light": "soulRed"
},
"diffContext": {
"dark": "textGray",
"light": "coreGray"
},
"diffHunkHeader": {
"dark": "soulAqua",
"light": "soulBlue"
},
"diffHighlightAdded": {
"dark": "soulGreen",
"light": "healGreen"
},
"diffHighlightRemoved": {
"dark": "soulRed",
"light": "determinationRed"
},
"diffAddedBg": {
"dark": "#002200",
"light": "#CCFFCC"
},
"diffRemovedBg": {
"dark": "#220000",
"light": "#FFCCCC"
},
"diffContextBg": {
"dark": "battleBg",
"light": "#F5F5F5"
},
"diffLineNumber": {
"dark": "textGray",
"light": "coreGray"
},
"diffAddedLineNumberBg": {
"dark": "#001A00",
"light": "#E0FFE0"
},
"diffRemovedLineNumberBg": {
"dark": "#1A0000",
"light": "#FFE0E0"
},
"markdownText": {
"dark": "white",
"light": "black"
},
"markdownHeading": {
"dark": "uiYellow",
"light": "hotlandOrange"
},
"markdownLink": {
"dark": "soulAqua",
"light": "soulBlue"
},
"markdownLinkText": {
"dark": "waterfallGlow",
"light": "waterfall"
},
"markdownCode": {
"dark": "healGreen",
"light": "soulGreen"
},
"markdownBlockQuote": {
"dark": "textGray",
"light": "coreGray"
},
"markdownEmph": {
"dark": "mttPink",
"light": "soulPurple"
},
"markdownStrong": {
"dark": "soulRed",
"light": "determinationRed"
},
"markdownHorizontalRule": {
"dark": "white",
"light": "black"
},
"markdownListItem": {
"dark": "uiYellow",
"light": "uiYellow"
},
"markdownListEnumeration": {
"dark": "uiYellow",
"light": "uiYellow"
},
"markdownImage": {
"dark": "ruinsPurple",
"light": "soulPurple"
},
"markdownImageText": {
"dark": "mttPink",
"light": "ruinsPurple"
},
"markdownCodeBlock": {
"dark": "white",
"light": "black"
},
"syntaxComment": {
"dark": "textGray",
"light": "coreGray"
},
"syntaxKeyword": {
"dark": "soulRed",
"light": "determinationRed"
},
"syntaxFunction": {
"dark": "soulAqua",
"light": "soulBlue"
},
"syntaxVariable": {
"dark": "uiYellow",
"light": "hotlandOrange"
},
"syntaxString": {
"dark": "healGreen",
"light": "soulGreen"
},
"syntaxNumber": {
"dark": "mttPink",
"light": "soulPurple"
},
"syntaxType": {
"dark": "waterfallGlow",
"light": "waterfall"
},
"syntaxOperator": {
"dark": "white",
"light": "black"
},
"syntaxPunctuation": {
"dark": "textGray",
"light": "coreGray"
}
}
}

View File

@ -791,8 +791,6 @@ To use your GitHub Copilot subscription with opencode:
:::note
Some models might need a [Pro+
subscription](https://github.com/features/copilot/plans) to use.
Some models need to be manually enabled in your [GitHub Copilot settings](https://docs.github.com/en/copilot/how-tos/use-ai-models/configure-access-to-ai-models#setup-for-individual-use).
:::
1. Run the `/connect` command and search for GitHub Copilot.

View File

@ -1,231 +0,0 @@
{
"$schema": "https://opencode.ai/theme.json",
"defs": {
"darkWorldBg": "#0B0B3B",
"darkWorldDeep": "#050520",
"darkWorldPanel": "#151555",
"krisBlue": "#6A7BC4",
"krisCyan": "#75FBED",
"krisIce": "#C7E3F2",
"susiePurple": "#5B209D",
"susieMagenta": "#A017D0",
"susiePink": "#F983D8",
"ralseiGreen": "#33A56C",
"ralseiTeal": "#40E4D4",
"noelleRose": "#DC8998",
"noelleRed": "#DC1510",
"noelleMint": "#ECFFBB",
"noelleCyan": "#77E0FF",
"noelleAqua": "#BBFFFC",
"gold": "#FBCE3C",
"orange": "#F4A731",
"hotPink": "#EB0095",
"queenPink": "#F983D8",
"cyberGreen": "#00FF00",
"white": "#FFFFFF",
"black": "#000000",
"textMuted": "#8888AA"
},
"theme": {
"primary": {
"dark": "hotPink",
"light": "susieMagenta"
},
"secondary": {
"dark": "krisCyan",
"light": "krisBlue"
},
"accent": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"error": {
"dark": "noelleRed",
"light": "noelleRed"
},
"warning": {
"dark": "gold",
"light": "orange"
},
"success": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"info": {
"dark": "noelleCyan",
"light": "krisBlue"
},
"text": {
"dark": "white",
"light": "black"
},
"textMuted": {
"dark": "textMuted",
"light": "#555577"
},
"background": {
"dark": "darkWorldBg",
"light": "white"
},
"backgroundPanel": {
"dark": "darkWorldDeep",
"light": "#F0F0F8"
},
"backgroundElement": {
"dark": "darkWorldPanel",
"light": "#E5E5F0"
},
"border": {
"dark": "krisBlue",
"light": "susiePurple"
},
"borderActive": {
"dark": "hotPink",
"light": "susieMagenta"
},
"borderSubtle": {
"dark": "#3A3A6A",
"light": "#AAAACC"
},
"diffAdded": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"diffRemoved": {
"dark": "hotPink",
"light": "noelleRed"
},
"diffContext": {
"dark": "textMuted",
"light": "#666688"
},
"diffHunkHeader": {
"dark": "krisBlue",
"light": "susiePurple"
},
"diffHighlightAdded": {
"dark": "ralseiGreen",
"light": "ralseiTeal"
},
"diffHighlightRemoved": {
"dark": "noelleRed",
"light": "hotPink"
},
"diffAddedBg": {
"dark": "#0A2A2A",
"light": "#D4FFEE"
},
"diffRemovedBg": {
"dark": "#2A0A2A",
"light": "#FFD4E8"
},
"diffContextBg": {
"dark": "darkWorldDeep",
"light": "#F5F5FA"
},
"diffLineNumber": {
"dark": "textMuted",
"light": "#666688"
},
"diffAddedLineNumberBg": {
"dark": "#082020",
"light": "#E0FFF0"
},
"diffRemovedLineNumberBg": {
"dark": "#200820",
"light": "#FFE0F0"
},
"markdownText": {
"dark": "white",
"light": "black"
},
"markdownHeading": {
"dark": "gold",
"light": "orange"
},
"markdownLink": {
"dark": "krisCyan",
"light": "krisBlue"
},
"markdownLinkText": {
"dark": "noelleCyan",
"light": "susiePurple"
},
"markdownCode": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"markdownBlockQuote": {
"dark": "textMuted",
"light": "#666688"
},
"markdownEmph": {
"dark": "susiePink",
"light": "susieMagenta"
},
"markdownStrong": {
"dark": "hotPink",
"light": "susiePurple"
},
"markdownHorizontalRule": {
"dark": "krisBlue",
"light": "susiePurple"
},
"markdownListItem": {
"dark": "gold",
"light": "orange"
},
"markdownListEnumeration": {
"dark": "krisCyan",
"light": "krisBlue"
},
"markdownImage": {
"dark": "susieMagenta",
"light": "susiePurple"
},
"markdownImageText": {
"dark": "susiePink",
"light": "susieMagenta"
},
"markdownCodeBlock": {
"dark": "white",
"light": "black"
},
"syntaxComment": {
"dark": "textMuted",
"light": "#666688"
},
"syntaxKeyword": {
"dark": "hotPink",
"light": "susieMagenta"
},
"syntaxFunction": {
"dark": "krisCyan",
"light": "krisBlue"
},
"syntaxVariable": {
"dark": "gold",
"light": "orange"
},
"syntaxString": {
"dark": "ralseiTeal",
"light": "ralseiGreen"
},
"syntaxNumber": {
"dark": "noelleRose",
"light": "noelleRed"
},
"syntaxType": {
"dark": "noelleCyan",
"light": "krisBlue"
},
"syntaxOperator": {
"dark": "white",
"light": "black"
},
"syntaxPunctuation": {
"dark": "krisBlue",
"light": "#555577"
}
}
}

View File

@ -1,232 +0,0 @@
{
"$schema": "https://opencode.ai/theme.json",
"defs": {
"black": "#000000",
"white": "#FFFFFF",
"soulRed": "#FF0000",
"soulOrange": "#FF6600",
"soulYellow": "#FFFF00",
"soulGreen": "#00FF00",
"soulAqua": "#00FFFF",
"soulBlue": "#0000FF",
"soulPurple": "#FF00FF",
"ruinsPurple": "#A349A4",
"ruinsDark": "#380A43",
"snowdinBlue": "#6BA3E5",
"hotlandOrange": "#FF7F27",
"coreGray": "#3A3949",
"battleBg": "#0D0D1A",
"battlePanel": "#1A1A2E",
"uiYellow": "#FFC90E",
"textGray": "#909090",
"damageRed": "#FF3333",
"healGreen": "#00FF00",
"saveYellow": "#FFFF00",
"determinationRed": "#FF0000",
"mttPink": "#FF6EB4",
"waterfall": "#283197",
"waterfallGlow": "#00BFFF"
},
"theme": {
"primary": {
"dark": "soulRed",
"light": "determinationRed"
},
"secondary": {
"dark": "uiYellow",
"light": "uiYellow"
},
"accent": {
"dark": "soulAqua",
"light": "soulBlue"
},
"error": {
"dark": "damageRed",
"light": "soulRed"
},
"warning": {
"dark": "uiYellow",
"light": "hotlandOrange"
},
"success": {
"dark": "healGreen",
"light": "soulGreen"
},
"info": {
"dark": "soulAqua",
"light": "waterfallGlow"
},
"text": {
"dark": "white",
"light": "black"
},
"textMuted": {
"dark": "textGray",
"light": "coreGray"
},
"background": {
"dark": "black",
"light": "white"
},
"backgroundPanel": {
"dark": "battleBg",
"light": "#F0F0F0"
},
"backgroundElement": {
"dark": "battlePanel",
"light": "#E5E5E5"
},
"border": {
"dark": "white",
"light": "black"
},
"borderActive": {
"dark": "soulRed",
"light": "determinationRed"
},
"borderSubtle": {
"dark": "#555555",
"light": "#AAAAAA"
},
"diffAdded": {
"dark": "healGreen",
"light": "soulGreen"
},
"diffRemoved": {
"dark": "damageRed",
"light": "soulRed"
},
"diffContext": {
"dark": "textGray",
"light": "coreGray"
},
"diffHunkHeader": {
"dark": "soulAqua",
"light": "soulBlue"
},
"diffHighlightAdded": {
"dark": "soulGreen",
"light": "healGreen"
},
"diffHighlightRemoved": {
"dark": "soulRed",
"light": "determinationRed"
},
"diffAddedBg": {
"dark": "#002200",
"light": "#CCFFCC"
},
"diffRemovedBg": {
"dark": "#220000",
"light": "#FFCCCC"
},
"diffContextBg": {
"dark": "battleBg",
"light": "#F5F5F5"
},
"diffLineNumber": {
"dark": "textGray",
"light": "coreGray"
},
"diffAddedLineNumberBg": {
"dark": "#001A00",
"light": "#E0FFE0"
},
"diffRemovedLineNumberBg": {
"dark": "#1A0000",
"light": "#FFE0E0"
},
"markdownText": {
"dark": "white",
"light": "black"
},
"markdownHeading": {
"dark": "uiYellow",
"light": "hotlandOrange"
},
"markdownLink": {
"dark": "soulAqua",
"light": "soulBlue"
},
"markdownLinkText": {
"dark": "waterfallGlow",
"light": "waterfall"
},
"markdownCode": {
"dark": "healGreen",
"light": "soulGreen"
},
"markdownBlockQuote": {
"dark": "textGray",
"light": "coreGray"
},
"markdownEmph": {
"dark": "mttPink",
"light": "soulPurple"
},
"markdownStrong": {
"dark": "soulRed",
"light": "determinationRed"
},
"markdownHorizontalRule": {
"dark": "white",
"light": "black"
},
"markdownListItem": {
"dark": "uiYellow",
"light": "uiYellow"
},
"markdownListEnumeration": {
"dark": "uiYellow",
"light": "uiYellow"
},
"markdownImage": {
"dark": "ruinsPurple",
"light": "soulPurple"
},
"markdownImageText": {
"dark": "mttPink",
"light": "ruinsPurple"
},
"markdownCodeBlock": {
"dark": "white",
"light": "black"
},
"syntaxComment": {
"dark": "textGray",
"light": "coreGray"
},
"syntaxKeyword": {
"dark": "soulRed",
"light": "determinationRed"
},
"syntaxFunction": {
"dark": "soulAqua",
"light": "soulBlue"
},
"syntaxVariable": {
"dark": "uiYellow",
"light": "hotlandOrange"
},
"syntaxString": {
"dark": "healGreen",
"light": "soulGreen"
},
"syntaxNumber": {
"dark": "mttPink",
"light": "soulPurple"
},
"syntaxType": {
"dark": "waterfallGlow",
"light": "waterfall"
},
"syntaxOperator": {
"dark": "white",
"light": "black"
},
"syntaxPunctuation": {
"dark": "textGray",
"light": "coreGray"
}
}
}