mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 02:39:13 +00:00
Desktop cohorts mode talks to the new cohort-json format through two typed bridge channels (facets + report) with argv validation for models, repeatable project patterns, and categories. The section keeps the classic mode side by side; the cohorts view shows the population before any metric (included observations, distinct sessions, excluded mixed- model turns with their combined cost, unknown-cost count), an Inspect samples list of the declared population through a minimal navigation adapter (sampleNavigation.ts), cost median/P90/mean with a compact histogram whose top bucket is open-ended, one-shot/retry rates over the declared population, and token volume with input + cache-read labeled as a context proxy. The volume band recomputes renderer-side over the report's own observation list (cohortStats.ts mirrors the core convention, pinned to the same test vector), excludes and counts observations without a token measure, and never reads missing data as small. CODEBURN_USER_DATA_DIR opts into an isolated Electron profile so parallel dev runs get their own userData/serve.pid.
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
/**
|
|
* Minimal sample-navigation adapter (Goal 4, Inspect samples).
|
|
*
|
|
* CONTRACT (for the shared navigation integration): the cohort sample list
|
|
* calls `openSample(ref)` when the user activates a sample row. Whoever owns
|
|
* the common drill-through navigation registers itself once via
|
|
* `registerSampleOpener`. `openSample` returns false when no navigation is
|
|
* registered, and the Compare section keeps its self-contained inline sample
|
|
* rendering — the feature works standalone today and gains the shared
|
|
* navigation without code changes here.
|
|
*
|
|
* `SampleRef` carries the canonical identity pieces only (project + session id
|
|
* + timestamp). A bare sessionId is not globally unique, so consumers must
|
|
* pair it with the project label exactly as reports print it.
|
|
*/
|
|
export type SampleRef = {
|
|
sessionId: string
|
|
project: string
|
|
timestamp: string
|
|
}
|
|
|
|
export type SampleOpener = (ref: SampleRef) => void
|
|
|
|
let opener: SampleOpener | null = null
|
|
|
|
/** Install (or remove with null) the shared navigation's sample opener. */
|
|
export function registerSampleOpener(next: SampleOpener | null): void {
|
|
opener = next
|
|
}
|
|
|
|
/** Hand a sample to the registered navigation; false when none is registered. */
|
|
export function openSample(ref: SampleRef): boolean {
|
|
if (!opener) return false
|
|
opener(ref)
|
|
return true
|
|
}
|