{"version":3,"file":"startup-progress.d.ts","sourceRoot":"","sources":["../../src/core/startup-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,eAAe,GACxB;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC3G;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3E,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AAE3B,cAAM,oBAAoB;IAGzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAuB;IAEjD,+CAA+C;IAC/C,GAAG,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAGhC;IAED,oFAAoF;IACpF,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAExB;IAED,6FAA2F;IAC3F,KAAK,IAAI,IAAI,CAIZ;IAED,IAAI,IAAI,SAAS,eAAe,EAAE,CAEjC;IAED,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAKxC;IAED,OAAO,CAAC,IAAI;CAGZ;AAED,mDAAmD;AACnD,eAAO,MAAM,eAAe,sBAA6B,CAAC","sourcesContent":["/**\n * Process-wide store for transient progress bars in the footer: first-run\n * downloads of the external tool binaries (fd, rg, the semantic-index engine),\n * the semantic index build, and `/learn` reading session transcripts.\n *\n * Modeled on `taskStore` — a singleton the footer reads directly and re-renders\n * on change — but deliberately separate from it: this is short-lived status,\n * not agent work, so it must never render as a task-panel plan row. Entries are\n * keyed so several concurrent jobs each own a stable footer line; a caller\n * removes its key when the work settles and the line disappears.\n *\n * Most entries are startup work, and `clear()` drops them when the first user\n * turn begins. A caller running later (a slash command, say) owns its key for\n * the length of its own await and must remove it in a `finally`, so a failure\n * cannot strand a bar in the footer.\n */\n\nexport type StartupProgress =\n\t| { readonly key: string; kind: \"download\"; label: string; receivedBytes: number; totalBytes: number | null }\n\t| { readonly key: string; kind: \"work\"; label: string; done: number; total: number; unit: string }\n\t| { readonly key: string; kind: \"error\"; label: string; message: string };\n\ntype Listener = () => void;\n\nclass StartupProgressStore {\n\t// Map preserves insertion order, so lines stay in the order work started\n\t// (fd, rg, then the index) instead of jumping as byte counts update.\n\tprivate readonly entries = new Map<string, StartupProgress>();\n\tprivate readonly listeners = new Set<Listener>();\n\n\t/** Insert or replace the entry for its key. */\n\tset(entry: StartupProgress): void {\n\t\tthis.entries.set(entry.key, entry);\n\t\tthis.emit();\n\t}\n\n\t/** Drop a key's line once its work settled (download done, index ready/skipped). */\n\tremove(key: string): void {\n\t\tif (this.entries.delete(key)) this.emit();\n\t}\n\n\t/** Wipe everything — called when the first user turn starts (transient startup status). */\n\tclear(): void {\n\t\tif (this.entries.size === 0) return;\n\t\tthis.entries.clear();\n\t\tthis.emit();\n\t}\n\n\tlist(): readonly StartupProgress[] {\n\t\treturn [...this.entries.values()];\n\t}\n\n\tsubscribe(listener: Listener): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => {\n\t\t\tthis.listeners.delete(listener);\n\t\t};\n\t}\n\n\tprivate emit(): void {\n\t\tfor (const listener of this.listeners) listener();\n\t}\n}\n\n/** Shared, process-wide startup-progress store. */\nexport const startupProgress = new StartupProgressStore();\n"]}