Download packages/app/src/utils/session-title.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 536 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/utils/session-title.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/app/src/utils/session-title.ts
-
curl -L -o session-title.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/app/src/utils/session-title.ts
536 Bytes
| const pattern = /^(New session|Child session) - \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/ | |
| interface Info { | |
| readonly title?: string | |
| readonly parentID?: string | |
| readonly time: { | |
| readonly created: number | |
| } | |
| } | |
| export function withTimestampedFallback(info: Info) { | |
| return info.title ?? `${info.parentID ? "Child" : "New"} session - ${new Date(info.time.created).toISOString()}` | |
| } | |
| export function sessionTitle(title?: string) { | |
| if (!title) return title | |
| const match = title.match(pattern) | |
| return match?.[1] ?? title | |
| } | |