mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix(sessions): scope the session picker to the OpenCode project across worktrees
This commit is contained in:
1 parent
04cb3f8291
commit
e40eca2838
7 files changed
+288
-59
No files matched your search
@@ -31,6 +31,8 @@ export type ShellInfo = Awaited<ReturnType<OpenCodeApi['shell']['list']>>['data'
|
||||
|
||||
export type ShellOutputChunk = Awaited<ReturnType<OpenCodeApi['shell']['output']>>['data']
|
||||
|
||||
export type OpenCodeLocationInfo = Awaited<ReturnType<OpenCodeApi['location']['get']>>
|
||||
|
||||
export interface SessionPage {
|
||||
items: SessionInfo[]
|
||||
nextCursor?: string
|
||||
@@ -38,6 +40,8 @@ export interface SessionPage {
|
||||
|
||||
export interface SessionPageInput {
|
||||
directory?: string
|
||||
project?: string
|
||||
subpath?: string
|
||||
limit?: number
|
||||
order?: 'asc' | 'desc'
|
||||
search?: string
|
||||
@@ -94,6 +98,8 @@ export async function listSessionPage(input: SessionPageInput): Promise<SessionP
|
||||
const { data, cursor } = await callOpenCode((api) =>
|
||||
api.session.list({
|
||||
...(input.directory === undefined ? {} : { directory: input.directory }),
|
||||
...(input.project === undefined ? {} : { project: input.project }),
|
||||
...(input.subpath === undefined ? {} : { subpath: input.subpath }),
|
||||
parentID: 'null',
|
||||
limit: input.limit,
|
||||
order: input.order,
|
||||
@@ -104,6 +110,10 @@ export async function listSessionPage(input: SessionPageInput): Promise<SessionP
|
||||
return { items: data, nextCursor: cursor.next ?? undefined }
|
||||
}
|
||||
|
||||
export async function getOpenCodeLocation(directory: string): Promise<OpenCodeLocationInfo> {
|
||||
return callOpenCode((api) => api.location.get(openCodeLocation(directory)))
|
||||
}
|
||||
|
||||
export async function getSession(sessionID: string): Promise<SessionInfo> {
|
||||
return callOpenCode((api) => api.session.get({ sessionID }))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user