fix: 修复类型问题(#267) (#271)

* fix: 修复 Bun 的 polyfill 问题

* fix: 类型修复完成

* feat: 统一所有包的类型文件

* fix: 修复构建问题
This commit is contained in:
claude-code-best
2026-04-15 10:54:00 +08:00
committed by GitHub
parent 2273a0bcfe
commit 1a4e9702c2
39 changed files with 187 additions and 131 deletions

View File

@@ -8,7 +8,7 @@ import { storeIsSessionOwner } from "../../store";
const app = new Hono();
function checkOwnership(c: { get: (key: string) => string | undefined }, sessionId: string) {
const uuid = c.get("uuid");
const uuid = c.get("uuid")!;
if (!storeIsSessionOwner(sessionId, uuid)) {
return { error: true, session: null };
}

View File

@@ -11,7 +11,7 @@ const app = new Hono();
/** POST /web/sessions — Create a session from web UI */
app.post("/sessions", uuidAuth, async (c) => {
const uuid = c.get("uuid");
const uuid = c.get("uuid")!;
const body = await c.req.json();
const session = createSession({
environment_id: body.environment_id || null,
@@ -37,21 +37,21 @@ app.post("/sessions", uuidAuth, async (c) => {
/** GET /web/sessions — List sessions owned by the requesting UUID */
app.get("/sessions", uuidAuth, async (c) => {
const uuid = c.get("uuid");
const uuid = c.get("uuid")!;
const sessions = storeListSessionsByOwnerUuid(uuid);
return c.json(sessions, 200);
});
/** GET /web/sessions/all — List sessions owned by the requesting UUID (unowned sessions excluded) */
app.get("/sessions/all", uuidAuth, async (c) => {
const uuid = c.get("uuid");
const uuid = c.get("uuid")!;
const sessions = listSessionSummariesByOwnerUuid(uuid);
return c.json(sessions, 200);
});
/** GET /web/sessions/:id — Session detail */
app.get("/sessions/:id", uuidAuth, async (c) => {
const uuid = c.get("uuid");
const uuid = c.get("uuid")!;
const sessionId = c.req.param("id")!;
if (!storeIsSessionOwner(sessionId, uuid)) {
return c.json({ error: { type: "forbidden", message: "Not your session" } }, 403);
@@ -65,7 +65,7 @@ app.get("/sessions/:id", uuidAuth, async (c) => {
/** GET /web/sessions/:id/history — Historical events for session */
app.get("/sessions/:id/history", uuidAuth, async (c) => {
const uuid = c.get("uuid");
const uuid = c.get("uuid")!;
const sessionId = c.req.param("id")!;
if (!storeIsSessionOwner(sessionId, uuid)) {
return c.json({ error: { type: "forbidden", message: "Not your session" } }, 403);
@@ -82,7 +82,7 @@ app.get("/sessions/:id/history", uuidAuth, async (c) => {
/** SSE /web/sessions/:id/events — Real-time event stream */
app.get("/sessions/:id/events", uuidAuth, async (c) => {
const uuid = c.get("uuid");
const uuid = c.get("uuid")!;
const sessionId = c.req.param("id")!;
if (!storeIsSessionOwner(sessionId, uuid)) {
return c.json({ error: { type: "forbidden", message: "Not your session" } }, 403);