chore: generate
This commit is contained in:
@@ -181,7 +181,8 @@ async function mockServers(page: Page, permissionRequests: string[], permissionR
|
|||||||
return json(route, true)
|
return json(route, true)
|
||||||
}
|
}
|
||||||
if (requestDirectory && requestDirectory !== directory) return json(route, { name: "InvalidDirectory" }, 500)
|
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 === "/global/health") return json(route, { healthy: true })
|
||||||
if (url.pathname === "/api/provider" || url.pathname === "/api/model" || url.pathname === "/api/agent")
|
if (url.pathname === "/api/provider" || url.pathname === "/api/model" || url.pathname === "/api/agent")
|
||||||
return json(route, { data: [] })
|
return json(route, { data: [] })
|
||||||
|
|||||||
@@ -242,8 +242,8 @@ export const Terminal = (props: TerminalProps) => {
|
|||||||
|
|
||||||
const pushSize = async (cols: number, rows: number) => {
|
const pushSize = async (cols: number, rows: number) => {
|
||||||
if ((await sdk().protocol) === "v1") {
|
if ((await sdk().protocol) === "v1") {
|
||||||
return sdk().client.pty
|
return sdk()
|
||||||
.update({
|
.client.pty.update({
|
||||||
ptyID: id,
|
ptyID: id,
|
||||||
size: { cols, rows },
|
size: { cols, rows },
|
||||||
})
|
})
|
||||||
@@ -251,8 +251,8 @@ export const Terminal = (props: TerminalProps) => {
|
|||||||
debugTerminal("failed to sync terminal size", err)
|
debugTerminal("failed to sync terminal size", err)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return sdk().api.pty
|
return sdk()
|
||||||
.update({
|
.api.pty.update({
|
||||||
ptyID: id,
|
ptyID: id,
|
||||||
location: { directory },
|
location: { directory },
|
||||||
size: { cols, rows },
|
size: { cols, rows },
|
||||||
@@ -534,16 +534,16 @@ export const Terminal = (props: TerminalProps) => {
|
|||||||
|
|
||||||
const gone = async () => {
|
const gone = async () => {
|
||||||
if ((await sdk().protocol) === "v1") {
|
if ((await sdk().protocol) === "v1") {
|
||||||
return sdk().client.pty
|
return sdk()
|
||||||
.get({ ptyID: id }, { throwOnError: false })
|
.client.pty.get({ ptyID: id }, { throwOnError: false })
|
||||||
.then((result) => result.response.status === 404)
|
.then((result) => result.response.status === 404)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
debugTerminal("failed to inspect terminal session", err)
|
debugTerminal("failed to inspect terminal session", err)
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return sdk().api.pty
|
return sdk()
|
||||||
.get({ ptyID: id, location: { directory } })
|
.api.pty.get({ ptyID: id, location: { directory } })
|
||||||
.then((result) => result.data.status === "exited")
|
.then((result) => result.data.status === "exited")
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err && typeof err === "object" && "_tag" in err && err._tag === "PtyNotFoundError") return true
|
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 () => {
|
const connectToken = async () => {
|
||||||
if ((await sdk().protocol) === "v1") {
|
if ((await sdk().protocol) === "v1") {
|
||||||
const result = await sdk().client.pty
|
const result = await sdk()
|
||||||
.connectToken(
|
.client.pty.connectToken(
|
||||||
{ ptyID: id, directory },
|
{ ptyID: id, directory },
|
||||||
{
|
{
|
||||||
throwOnError: false,
|
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 rejected by origin or CSRF checks. Check the server CORS config.")
|
||||||
throw new Error(`PTY connect ticket failed with ${result.response.status}`)
|
throw new Error(`PTY connect ticket failed with ${result.response.status}`)
|
||||||
}
|
}
|
||||||
return sdk().api.pty
|
return sdk()
|
||||||
.connectToken({
|
.api.pty.connectToken({
|
||||||
ptyID: id,
|
ptyID: id,
|
||||||
location: { directory },
|
location: { directory },
|
||||||
"x-opencode-ticket": "1",
|
"x-opencode-ticket": "1",
|
||||||
|
|||||||
@@ -280,10 +280,12 @@ function createWorkspaceTerminalSession(
|
|||||||
if ((await sdk.protocol) === "v1") {
|
if ((await sdk.protocol) === "v1") {
|
||||||
return (await sdk.client.pty.create({ title: pty.title })).data
|
return (await sdk.client.pty.create({ title: pty.title })).data
|
||||||
}
|
}
|
||||||
return (await sdk.api.pty.create({
|
return (
|
||||||
location,
|
await sdk.api.pty.create({
|
||||||
title: pty.title,
|
location,
|
||||||
})).data
|
title: pty.title,
|
||||||
|
})
|
||||||
|
).data
|
||||||
})().catch((error: unknown) => {
|
})().catch((error: unknown) => {
|
||||||
console.error("Failed to clone terminal", error)
|
console.error("Failed to clone terminal", error)
|
||||||
return undefined
|
return undefined
|
||||||
@@ -432,7 +434,9 @@ function createWorkspaceTerminalSession(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const removePromise =
|
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) => {
|
await removePromise.catch((error: unknown) => {
|
||||||
console.error("Failed to close terminal", error)
|
console.error("Failed to close terminal", error)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user