mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-04 07:49:51 +00:00
chore: generate
This commit is contained in:
parent
ad78ef5a4c
commit
ae4be983cb
3 changed files with 23 additions and 18 deletions
|
|
@ -181,7 +181,8 @@ async function mockServers(page: Page, permissionRequests: string[], permissionR
|
|||
return json(route, true)
|
||||
}
|
||||
if (requestDirectory && requestDirectory !== directory) return json(route, { name: "InvalidDirectory" }, 500)
|
||||
if (url.pathname === "/global/event" || url.pathname === "/event" || url.pathname === "/api/event") return sse(route)
|
||||
if (url.pathname === "/global/event" || url.pathname === "/event" || url.pathname === "/api/event")
|
||||
return sse(route)
|
||||
if (url.pathname === "/global/health") return json(route, { healthy: true })
|
||||
if (url.pathname === "/api/provider" || url.pathname === "/api/model" || url.pathname === "/api/agent")
|
||||
return json(route, { data: [] })
|
||||
|
|
|
|||
|
|
@ -242,8 +242,8 @@ export const Terminal = (props: TerminalProps) => {
|
|||
|
||||
const pushSize = async (cols: number, rows: number) => {
|
||||
if ((await sdk().protocol) === "v1") {
|
||||
return sdk().client.pty
|
||||
.update({
|
||||
return sdk()
|
||||
.client.pty.update({
|
||||
ptyID: id,
|
||||
size: { cols, rows },
|
||||
})
|
||||
|
|
@ -251,8 +251,8 @@ export const Terminal = (props: TerminalProps) => {
|
|||
debugTerminal("failed to sync terminal size", err)
|
||||
})
|
||||
}
|
||||
return sdk().api.pty
|
||||
.update({
|
||||
return sdk()
|
||||
.api.pty.update({
|
||||
ptyID: id,
|
||||
location: { directory },
|
||||
size: { cols, rows },
|
||||
|
|
@ -534,16 +534,16 @@ export const Terminal = (props: TerminalProps) => {
|
|||
|
||||
const gone = async () => {
|
||||
if ((await sdk().protocol) === "v1") {
|
||||
return sdk().client.pty
|
||||
.get({ ptyID: id }, { throwOnError: false })
|
||||
return sdk()
|
||||
.client.pty.get({ ptyID: id }, { throwOnError: false })
|
||||
.then((result) => result.response.status === 404)
|
||||
.catch((err) => {
|
||||
debugTerminal("failed to inspect terminal session", err)
|
||||
return false
|
||||
})
|
||||
}
|
||||
return sdk().api.pty
|
||||
.get({ ptyID: id, location: { directory } })
|
||||
return sdk()
|
||||
.api.pty.get({ ptyID: id, location: { directory } })
|
||||
.then((result) => result.data.status === "exited")
|
||||
.catch((err) => {
|
||||
if (err && typeof err === "object" && "_tag" in err && err._tag === "PtyNotFoundError") return true
|
||||
|
|
@ -554,8 +554,8 @@ export const Terminal = (props: TerminalProps) => {
|
|||
|
||||
const connectToken = async () => {
|
||||
if ((await sdk().protocol) === "v1") {
|
||||
const result = await sdk().client.pty
|
||||
.connectToken(
|
||||
const result = await sdk()
|
||||
.client.pty.connectToken(
|
||||
{ ptyID: id, directory },
|
||||
{
|
||||
throwOnError: false,
|
||||
|
|
@ -573,8 +573,8 @@ export const Terminal = (props: TerminalProps) => {
|
|||
throw new Error("PTY connect ticket rejected by origin or CSRF checks. Check the server CORS config.")
|
||||
throw new Error(`PTY connect ticket failed with ${result.response.status}`)
|
||||
}
|
||||
return sdk().api.pty
|
||||
.connectToken({
|
||||
return sdk()
|
||||
.api.pty.connectToken({
|
||||
ptyID: id,
|
||||
location: { directory },
|
||||
"x-opencode-ticket": "1",
|
||||
|
|
|
|||
|
|
@ -280,10 +280,12 @@ function createWorkspaceTerminalSession(
|
|||
if ((await sdk.protocol) === "v1") {
|
||||
return (await sdk.client.pty.create({ title: pty.title })).data
|
||||
}
|
||||
return (await sdk.api.pty.create({
|
||||
location,
|
||||
title: pty.title,
|
||||
})).data
|
||||
return (
|
||||
await sdk.api.pty.create({
|
||||
location,
|
||||
title: pty.title,
|
||||
})
|
||||
).data
|
||||
})().catch((error: unknown) => {
|
||||
console.error("Failed to clone terminal", error)
|
||||
return undefined
|
||||
|
|
@ -432,7 +434,9 @@ function createWorkspaceTerminalSession(
|
|||
}
|
||||
|
||||
const removePromise =
|
||||
(await sdk.protocol) === "v1" ? sdk.client.pty.remove({ ptyID: id }) : sdk.api.pty.remove({ ptyID: id, location })
|
||||
(await sdk.protocol) === "v1"
|
||||
? sdk.client.pty.remove({ ptyID: id })
|
||||
: sdk.api.pty.remove({ ptyID: id, location })
|
||||
await removePromise.catch((error: unknown) => {
|
||||
console.error("Failed to close terminal", error)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue