fix(core): support unlimited shell timeouts
This commit is contained in:
parent
7668eb728d
commit
59790380de
11 changed files with 213 additions and 47 deletions
|
|
@ -1,10 +1,15 @@
|
|||
import { Shell } from "@opencode-ai/schema/shell"
|
||||
import { Location } from "@opencode-ai/schema/location"
|
||||
import { NonNegativeInt } from "@opencode-ai/schema/schema"
|
||||
import { Schema } from "effect"
|
||||
import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/unstable/httpapi"
|
||||
import { ShellNotFoundError } from "../errors.js"
|
||||
import { LocationQuery, locationQueryOpenApi } from "./location.js"
|
||||
|
||||
const TimeoutInput = Schema.Struct({
|
||||
timeout: NonNegativeInt,
|
||||
})
|
||||
|
||||
export const ShellGroup = HttpApiGroup.make("server.shell")
|
||||
.add(
|
||||
HttpApiEndpoint.get("shell.list", "/api/shell", {
|
||||
|
|
@ -52,6 +57,23 @@ export const ShellGroup = HttpApiGroup.make("server.shell")
|
|||
}),
|
||||
),
|
||||
)
|
||||
.add(
|
||||
HttpApiEndpoint.patch("shell.timeout", "/api/shell/:id/timeout", {
|
||||
params: { id: Shell.ID },
|
||||
query: LocationQuery,
|
||||
payload: TimeoutInput,
|
||||
success: Location.response(Shell.Info),
|
||||
error: ShellNotFoundError,
|
||||
})
|
||||
.annotateMerge(locationQueryOpenApi)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
identifier: "v2.shell.timeout",
|
||||
summary: "Update shell timeout",
|
||||
description: "Replace a running shell command's timeout from now, or clear it with zero.",
|
||||
}),
|
||||
),
|
||||
)
|
||||
.add(
|
||||
HttpApiEndpoint.get("shell.output", "/api/shell/:id/output", {
|
||||
params: { id: Shell.ID },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue