feat: add server link sharing

This commit is contained in:
Dax Raad 2026-07-08 18:41:08 -04:00
commit 7698a5e6ac
25 changed files with 1586 additions and 1194 deletions

View file

@ -16,6 +16,7 @@ import type { Definition } from "@opencode-ai/schema/event"
import { AgentGroup } from "./groups/agent.js"
import { PluginGroup } from "./groups/plugin.js"
import { HealthGroup } from "./groups/health.js"
import { ServerGroup } from "./groups/server.js"
import { DebugGroup } from "./groups/debug.js"
import { PtyGroup } from "./groups/pty.js"
import { ShellGroup } from "./groups/shell.js"
@ -82,6 +83,7 @@ type ApiGroups<
Event extends HttpApiGroup.Any,
> =
| typeof HealthGroup
| typeof ServerGroup
| typeof DebugGroup
| LocationGroups<LocationId>
| FormGroups<LocationId, LocationService, FormLocationId, FormLocationService>
@ -143,6 +145,7 @@ const makeApiFromGroup = <
> =>
HttpApi.make("server")
.add(HealthGroup)
.add(ServerGroup)
.add(LocationGroup.middleware(locationMiddleware))
.add(AgentGroup.middleware(locationMiddleware))
.add(PluginGroup.middleware(locationMiddleware))

View file

@ -34,6 +34,7 @@ export const ClientApi: ClientApiShape = makeDefaultApi({
export const groupNames = {
"server.health": "health",
"server.server": "server",
"server.debug": "debug",
"server.location": "location",
"server.agent": "agent",

View file

@ -0,0 +1,16 @@
import { Schema } from "effect"
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
export const ServerGroup = HttpApiGroup.make("server.server")
.add(
HttpApiEndpoint.get("server.get", "/api/server", {
success: Schema.Struct({ urls: Schema.Array(Schema.String) }),
}).annotateMerge(
OpenApi.annotations({
identifier: "v2.server.get",
summary: "Get server information",
description: "Return the URLs that can be used to connect to this server.",
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "server" }))