mirror of
https://github.com/stablyai/orca.git
synced 2026-10-07 16:02:29 +00:00
The jcode journal reader, the Claude transcript reader and the Command Code transcript reader each carried their own copy of the same reverse chunked line scan; they now share one tested helper. jcode's managed hook script drops its hand-rolled curl for buildPosixAgentHookPostCommand, which also gains it the raw-JSON transport and the --noproxy guard the bespoke copy was missing. Co-authored-by: czzczz <chanzrz_zbf@foxmail.com>
22 lines
1.3 KiB
TypeScript
22 lines
1.3 KiB
TypeScript
// jcode paints `<emoji> jcode <session-name>[ · +N -M][ · work|last ~<dur>]` about once
|
|
// a second (crates/jcode-tui/src/tui/app/terminal_title.rs). The tail is live status,
|
|
// the emoji is picked per session and swapped mid-turn, and the head is jcode's own
|
|
// name plus the codename it generates ("Puppy", "Tigress") — a label, never a
|
|
// conversation name. Captured titles are in docs/reference/jcode-hook-events.md.
|
|
const JCODE_TITLE_STATUS_RE =
|
|
/^[\p{Extended_Pictographic}\u{FE0F}\u{200D}]+\s*|\s+·\s+(?:\+\d+\s+-\d+|(?:work|last)\s+~\S+)(?=\s+·\s+|$)/gu
|
|
|
|
/** The jcode title with its per-session emoji and live diff/duration segments removed. */
|
|
export function stripJcodeTitleStatus(title: string): string {
|
|
return title.replace(JCODE_TITLE_STATUS_RE, '').trim()
|
|
}
|
|
|
|
// `jcode`, `jcode Puppy`, and `jcode/creek Puppy` (the self-dev variant) are all
|
|
// identity; anything the user could recognise as their own work has more to it.
|
|
const JCODE_IDENTITY_TITLE_RE = /^jcode(?:\/[^\s·]+)?(?:\s+[^\s·]+)?$/iu
|
|
|
|
/** True when a jcode title says only which jcode session this is, not what it is doing. */
|
|
export function isJcodeIdentityTerminalTitle(title: string | null | undefined): boolean {
|
|
return Boolean(title) && JCODE_IDENTITY_TITLE_RE.test(stripJcodeTitleStatus(title ?? ''))
|
|
}
|