-
+
{language.t("session.header.search.placeholder", {
project: name(),
diff --git a/packages/app/src/components/status-popover.tsx b/packages/app/src/components/status-popover.tsx
index 61facb84eb..063205f0c3 100644
--- a/packages/app/src/components/status-popover.tsx
+++ b/packages/app/src/components/status-popover.tsx
@@ -277,8 +277,8 @@ export function StatusPopover() {
aria-disabled={isBlocked()}
onClick={() => {
if (isBlocked()) return
- server.setActive(key)
navigate("/")
+ queueMicrotask(() => server.setActive(key))
}}
>
diff --git a/packages/app/src/components/terminal.tsx b/packages/app/src/components/terminal.tsx
index d4eccbc828..aed46f1262 100644
--- a/packages/app/src/components/terminal.tsx
+++ b/packages/app/src/components/terminal.tsx
@@ -65,14 +65,11 @@ const debugTerminal = (...values: unknown[]) => {
console.debug("[terminal]", ...values)
}
-const errorStatus = (err: unknown) => {
+const errorName = (err: unknown) => {
if (!err || typeof err !== "object") return
- if (!("data" in err)) return
- const data = err.data
- if (!data || typeof data !== "object") return
- if (!("statusCode" in data)) return
- const status = data.statusCode
- return typeof status === "number" ? status : undefined
+ if (!("name" in err)) return
+ const errorName = err.name
+ return typeof errorName === "string" ? errorName : undefined
}
const useTerminalUiBindings = (input: {
@@ -168,6 +165,12 @@ export const Terminal = (props: TerminalProps) => {
const theme = useTheme()
const language = useLanguage()
const server = useServer()
+ const directory = sdk.directory
+ const client = sdk.client
+ const url = sdk.url
+ const auth = server.current?.http
+ const username = auth?.username ?? "opencode"
+ const password = auth?.password ?? ""
let container!: HTMLDivElement
const [local, others] = splitProps(props, ["pty", "class", "classList", "autoFocus", "onConnect", "onConnectError"])
const id = local.pty.id
@@ -218,7 +221,7 @@ export const Terminal = (props: TerminalProps) => {
}
const pushSize = (cols: number, rows: number) => {
- return sdk.client.pty
+ return client.pty
.update({
ptyID: id,
size: { cols, rows },
@@ -477,11 +480,11 @@ export const Terminal = (props: TerminalProps) => {
}
const gone = () =>
- sdk.client.pty
+ client.pty
.get({ ptyID: id })
.then(() => false)
.catch((err) => {
- if (errorStatus(err) === 404) return true
+ if (errorName(err) === "NotFoundError") return true
debugTerminal("failed to inspect terminal session", err)
return false
})
@@ -509,14 +512,14 @@ export const Terminal = (props: TerminalProps) => {
if (disposed) return
drop?.()
- const url = new URL(sdk.url + `/pty/${id}/connect`)
- url.searchParams.set("directory", sdk.directory)
- url.searchParams.set("cursor", String(seek))
- url.protocol = url.protocol === "https:" ? "wss:" : "ws:"
- url.username = server.current?.http.username ?? "opencode"
- url.password = server.current?.http.password ?? ""
+ const next = new URL(url + `/pty/${id}/connect`)
+ next.searchParams.set("directory", directory)
+ next.searchParams.set("cursor", String(seek))
+ next.protocol = next.protocol === "https:" ? "wss:" : "ws:"
+ next.username = username
+ next.password = password
- const socket = new WebSocket(url)
+ const socket = new WebSocket(next)
socket.binaryType = "arraybuffer"
ws = socket
diff --git a/packages/app/src/components/titlebar.tsx b/packages/app/src/components/titlebar.tsx
index 345903420c..77de1a73ce 100644
--- a/packages/app/src/components/titlebar.tsx
+++ b/packages/app/src/components/titlebar.tsx
@@ -77,6 +77,7 @@ export function Titlebar() {
const canBack = createMemo(() => history.index > 0)
const canForward = createMemo(() => history.index < history.stack.length - 1)
+ const hasProjects = createMemo(() => layout.projects.list().length > 0)
const back = () => {
const next = backPath(history)
@@ -251,36 +252,38 @@ export function Titlebar() {
-