mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 17:54:23 +01:00
sync
This commit is contained in:
@@ -8,6 +8,10 @@ import { resolver, validator as zValidator } from "hono-openapi/zod";
|
||||
import { z } from "zod";
|
||||
import "zod-openapi/extend";
|
||||
|
||||
const SessionInfo = Session.Info.openapi({
|
||||
ref: "Session.Info",
|
||||
});
|
||||
|
||||
export namespace Server {
|
||||
const log = Log.create({ service: "server" });
|
||||
const PORT = 16713;
|
||||
@@ -59,11 +63,7 @@ export namespace Server {
|
||||
description: "Successfully created session",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: resolver(
|
||||
Session.Info.openapi({
|
||||
ref: "Session.Info",
|
||||
}),
|
||||
),
|
||||
schema: resolver(SessionInfo),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -74,6 +74,34 @@ export namespace Server {
|
||||
return c.json(session);
|
||||
},
|
||||
)
|
||||
.post(
|
||||
"/session_share",
|
||||
describeRoute({
|
||||
description: "Share the session",
|
||||
responses: {
|
||||
200: {
|
||||
description: "Successfully shared session",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: resolver(SessionInfo),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
zValidator(
|
||||
"json",
|
||||
z.object({
|
||||
sessionID: z.string(),
|
||||
}),
|
||||
),
|
||||
async (c) => {
|
||||
const body = c.req.valid("json");
|
||||
await Session.share(body.sessionID);
|
||||
const session = await Session.get(body.sessionID);
|
||||
return c.json(session);
|
||||
},
|
||||
)
|
||||
.post(
|
||||
"/session_messages",
|
||||
describeRoute({
|
||||
|
||||
Reference in New Issue
Block a user