|
|
@@ -10,7 +10,7 @@ import { proxy } from "hono/proxy"
|
|
|
import { Session } from "../session"
|
|
|
import z from "zod"
|
|
|
import { Provider } from "../provider/provider"
|
|
|
-import { mapValues } from "remeda"
|
|
|
+import { filter, mapValues, sortBy, pipe } from "remeda"
|
|
|
import { NamedError } from "@opencode-ai/util/error"
|
|
|
import { ModelsDev } from "../provider/models"
|
|
|
import { Ripgrep } from "../file/ripgrep"
|
|
|
@@ -483,6 +483,7 @@ export namespace Server {
|
|
|
schema: resolver(
|
|
|
z
|
|
|
.object({
|
|
|
+ home: z.string(),
|
|
|
state: z.string(),
|
|
|
config: z.string(),
|
|
|
worktree: z.string(),
|
|
|
@@ -499,6 +500,7 @@ export namespace Server {
|
|
|
}),
|
|
|
async (c) => {
|
|
|
return c.json({
|
|
|
+ home: Global.Path.home,
|
|
|
state: Global.Path.state,
|
|
|
config: Global.Path.config,
|
|
|
worktree: Instance.worktree,
|
|
|
@@ -549,7 +551,11 @@ export namespace Server {
|
|
|
}),
|
|
|
async (c) => {
|
|
|
const sessions = await Array.fromAsync(Session.list())
|
|
|
- sessions.sort((a, b) => b.time.updated - a.time.updated)
|
|
|
+ pipe(
|
|
|
+ await Array.fromAsync(Session.list()),
|
|
|
+ filter((s) => !s.time.archived),
|
|
|
+ sortBy((s) => s.time.updated),
|
|
|
+ )
|
|
|
return c.json(sessions)
|
|
|
},
|
|
|
)
|
|
|
@@ -755,6 +761,9 @@ export namespace Server {
|
|
|
"json",
|
|
|
z.object({
|
|
|
title: z.string().optional(),
|
|
|
+ time: z.object({
|
|
|
+ archived: z.number().optional(),
|
|
|
+ }),
|
|
|
}),
|
|
|
),
|
|
|
async (c) => {
|
|
|
@@ -765,6 +774,7 @@ export namespace Server {
|
|
|
if (updates.title !== undefined) {
|
|
|
session.title = updates.title
|
|
|
}
|
|
|
+ if (updates.time?.archived !== undefined) session.time.archived = updates.time.archived
|
|
|
})
|
|
|
|
|
|
return c.json(updatedSession)
|