refactor(core): canonicalize pty service (#32182)

This commit is contained in:
Shoubhit Dash
2026-06-14 16:16:39 +05:30
committed by GitHub
parent 7efade2d53
commit f2cf607376
30 changed files with 1134 additions and 506 deletions
@@ -757,6 +757,44 @@ const scenarios: Scenario[] = [
.seeded((ctx) => ctx.file("hello.txt", "hello\n"))
.at((ctx) => ({ path: "/api/fs/find?query=hello&type=file", headers: ctx.headers() }))
.json(200, locationData(array)),
http.protected.get("/api/pty", "v2.pty.list").json(200, locationData(array)),
http.protected
.post("/api/pty", "v2.pty.create")
.mutating()
.at((ctx) => ({ path: "/api/pty", headers: ctx.headers(), body: controlledPtyInput("HTTP API V2 PTY") }))
.json(200, locationData(object)),
http.protected
.get("/api/pty/{ptyID}", "v2.pty.get")
.at((ctx) => ({ path: route("/api/pty/{ptyID}", { ptyID: "pty_httpapi_missing" }), headers: ctx.headers() }))
.json(404, object, "status"),
http.protected
.put("/api/pty/{ptyID}", "v2.pty.update")
.mutating()
.at((ctx) => ({
path: route("/api/pty/{ptyID}", { ptyID: "pty_httpapi_missing" }),
headers: ctx.headers(),
body: { title: "missing" },
}))
.json(404, object, "status"),
http.protected
.delete("/api/pty/{ptyID}", "v2.pty.remove")
.mutating()
.at((ctx) => ({ path: route("/api/pty/{ptyID}", { ptyID: "pty_httpapi_missing" }), headers: ctx.headers() }))
.json(404, object, "status"),
http.protected
.post("/api/pty/{ptyID}/connect-token", "v2.pty.connectToken")
.at((ctx) => ({
path: route("/api/pty/{ptyID}/connect-token", { ptyID: "pty_httpapi_missing" }),
headers: { ...ctx.headers(), "x-opencode-ticket": "1" },
}))
.json(404, object, "status"),
http.protected
.get("/api/pty/{ptyID}/connect", "v2.pty.connect")
.at((ctx) => ({
path: route("/api/pty/{ptyID}/connect", { ptyID: "pty_httpapi_missing" }),
headers: ctx.headers(),
}))
.status(404, undefined, "none"),
http.protected.get("/api/reference", "v2.reference.list").json(200, object),
http.protected
.get("/api/provider/{providerID}", "v2.provider.get")