mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
14 lines
482 B
TypeScript
14 lines
482 B
TypeScript
import type { SessionInfo } from "@opencode/client/promise"
|
|
import { displayLabel } from "@opencode/util/session-title-fallback"
|
|
|
|
const pattern = /^(New session|Child session) - \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/
|
|
|
|
export function sessionLabel(session: Pick<SessionInfo, "title" | "parentID">) {
|
|
return displayLabel(session)
|
|
}
|
|
|
|
export function sessionTitle(title?: string) {
|
|
if (!title) return title
|
|
const match = title.match(pattern)
|
|
return match?.[1] ?? title
|
|
}
|