mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
stuff adam needs
This commit is contained in:
parent
03c6c3f4cb
commit
936a6be5d6
2 changed files with 13 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ export namespace Session {
|
|||
created: z.number(),
|
||||
updated: z.number(),
|
||||
compacting: z.number().optional(),
|
||||
archived: z.number().optional(),
|
||||
}),
|
||||
revert: z
|
||||
.object({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue