fix(app): terminal improvements - focus, rename, error state, CSP (#9700)

This commit is contained in:
Halil Tezcan KARABULUT
2026-01-21 15:49:46 +03:00
committed by GitHub
parent 259b2a3c2d
commit 87d91c29e2
6 changed files with 348 additions and 62 deletions

View File

@@ -102,7 +102,12 @@ export namespace Pty {
}
const cwd = input.cwd || Instance.directory
const env = { ...process.env, ...input.env, TERM: "xterm-256color" } as Record<string, string>
const env = {
...process.env,
...input.env,
TERM: "xterm-256color",
OPENCODE_TERMINAL: "1",
} as Record<string, string>
log.info("creating session", { id, cmd: command, args, cwd })
const spawn = await pty()
@@ -146,6 +151,10 @@ export namespace Pty {
ptyProcess.onExit(({ exitCode }) => {
log.info("session exited", { id, exitCode })
session.info.status = "exited"
for (const ws of session.subscribers) {
ws.close()
}
session.subscribers.clear()
Bus.publish(Event.Exited, { id, exitCode })
for (const ws of session.subscribers) {
ws.close()

View File

@@ -499,6 +499,7 @@ export namespace Server {
)
.all("/*", async (c) => {
const path = c.req.path
const response = await proxy(`https://app.opencode.ai${path}`, {
...c.req,
headers: {
@@ -508,7 +509,7 @@ export namespace Server {
})
response.headers.set(
"Content-Security-Policy",
"default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self'",
"default-src 'self'; script-src 'self' 'wasm-unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' data:",
)
return response
}) as unknown as Hono,