{"version":3,"file":"context-mode.d.ts","sourceRoot":"","sources":["../../../../src/runs/shared/context-mode.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAC3C,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,OAAO,CAAC;AAEnD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,GAAG,SAAS,CAAC,GAAG,cAAc,GAAG,SAAS,CAKvG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS,GAAG,MAAM,CAKvF;AAED,wBAAgB,gBAAgB,CAC/B,KAAK,EAAE;IAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACjD,IAAI,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS,GAC5C,MAAM,CAKR;AAED,wBAAgB,iBAAiB,CAChC,KAAK,EAAE;IAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,EACjD,IAAI,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS,GAC5C,MAAM,CAKR","sourcesContent":["export type ContextMode = \"fresh\" | \"fork\";\nexport type ContextSummary = ContextMode | \"mixed\";\n\nexport function isContextMode(value: unknown): value is ContextMode {\n\treturn value === \"fresh\" || value === \"fork\";\n}\n\nexport function isContextSummary(value: unknown): value is ContextSummary {\n\treturn isContextMode(value) || value === \"mixed\";\n}\n\nexport function summarizeContextModes(modes: Array<ContextMode | undefined>): ContextSummary | undefined {\n\tconst resolved = modes.filter(isContextMode);\n\tif (resolved.length === 0) return undefined;\n\tconst first = resolved[0]!;\n\treturn resolved.every((mode) => mode === first) ? first : \"mixed\";\n}\n\nexport function contextModeLabel(mode: ContextMode | ContextSummary | undefined): string {\n\tif (mode === \"fork\") return \"[fork]\";\n\tif (mode === \"fresh\") return \"[fresh]\";\n\tif (mode === \"mixed\") return \"[mixed]\";\n\treturn \"\";\n}\n\nexport function contextModeBadge(\n\ttheme: { fg(name: string, text: string): string },\n\tmode: ContextMode | ContextSummary | undefined,\n): string {\n\tconst label = contextModeLabel(mode);\n\tif (!label) return \"\";\n\tif (mode === \"fork\") return theme.fg(\"warning\", ` ${label}`);\n\treturn theme.fg(\"dim\", ` ${label}`);\n}\n\nexport function contextModePrefix(\n\ttheme: { fg(name: string, text: string): string },\n\tmode: ContextMode | ContextSummary | undefined,\n): string {\n\tconst label = contextModeLabel(mode);\n\tif (!label) return \"\";\n\tif (mode === \"fork\") return `${theme.fg(\"warning\", label)} `;\n\treturn `${theme.fg(\"dim\", label)} `;\n}\n"]}