@deepseek-ai/dsh-client-ui-chat 0.2.0-rc.2 → 0.2.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -1780,6 +1780,634 @@ window.__ModuleLoader__.load({
1780
1780
  });
1781
1781
  //#endregion
1782
1782
  //#region ../../util/values/lib/index.js
1783
+ /**
1784
+ * Lazily scanned view of one JSON object's top-level fields, built from text
1785
+ * that may still be streaming or from an already parsed object. Nothing is
1786
+ * scanned until a reader asks; the view remembers every question it answered
1787
+ * and reports changed answers when the owner refreshes for publication.
1788
+ * Used for model tool-call arguments: a row reads the fields it
1789
+ * cares about at whatever granularity it displays, at every stage of the call.
1790
+ * @module @deepseek-ai/dsh-util-values/src/partial-json
1791
+ */
1792
+ const SIMPLE_ESCAPES = {
1793
+ "\"": "\"",
1794
+ "\\": "\\",
1795
+ "/": "/",
1796
+ b: "\b",
1797
+ f: "\f",
1798
+ n: "\n",
1799
+ r: "\r",
1800
+ t: " "
1801
+ };
1802
+ const CONTENT_ESCAPE = /[\\\u0000-\u001f]/u;
1803
+ function isWhitespace(c) {
1804
+ return c === " " || c === "\n" || c === "\r" || c === " ";
1805
+ }
1806
+ function isHex(c) {
1807
+ return c >= "0" && c <= "9" || c >= "a" && c <= "f" || c >= "A" && c <= "F";
1808
+ }
1809
+ /**
1810
+ * The view. A streaming instance grows through {@link PartialArguments.append};
1811
+ * {@link PartialArguments.fromText} and {@link PartialArguments.fromObject} build
1812
+ * sealed instances over a finished call. Every reader is total: an absent or
1813
+ * differently typed field answers `undefined` (or `false`), never throws.
1814
+ */
1815
+ var PartialArguments = class PartialArguments {
1816
+ /** The view of a call with no arguments available. */
1817
+ static EMPTY = PartialArguments.fromObject({});
1818
+ /**
1819
+ * View finished argument text without scanning it until a reader asks.
1820
+ * @param text - the complete argument JSON text.
1821
+ * @returns a sealed view.
1822
+ */
1823
+ static fromText(text) {
1824
+ const view = new PartialArguments();
1825
+ view.append(text);
1826
+ view.sealed = true;
1827
+ return view;
1828
+ }
1829
+ /**
1830
+ * View an already parsed argument payload, such as a PTC dispatch object.
1831
+ * @param value - the parsed argument value.
1832
+ * @returns a sealed view; a non-object payload has no fields.
1833
+ */
1834
+ static fromObject(value) {
1835
+ const view = new PartialArguments();
1836
+ view.object = typeof value === "object" && value !== null && !Array.isArray(value) ? value : {};
1837
+ view.sealed = true;
1838
+ return view;
1839
+ }
1840
+ /**
1841
+ * The source: text so far or a parsed object, plus whether it can still grow.
1842
+ * These are the only enumerable fields, so two views over the same source
1843
+ * compare equal structurally however far each has been read.
1844
+ */
1845
+ chunks = [];
1846
+ object;
1847
+ sealed = false;
1848
+ #ends = [];
1849
+ #size = 0;
1850
+ #consumed = 0;
1851
+ #mode = "root";
1852
+ #escape = false;
1853
+ #keyStart = 0;
1854
+ #keyEscaped = false;
1855
+ #key = "";
1856
+ #current = null;
1857
+ #nestedEnds = [];
1858
+ #nestedInString = false;
1859
+ #invalidAt;
1860
+ #invalidValue = false;
1861
+ #entries = /* @__PURE__ */ new Map();
1862
+ #order = [];
1863
+ #reads = /* @__PURE__ */ new Map();
1864
+ /** Whether this view rejects further appends; does not scan text or register reads. */
1865
+ get isSealed() {
1866
+ return this.sealed;
1867
+ }
1868
+ /** Whether indexing or a content read found invalid JSON; unread value contents are not validated. */
1869
+ get invalid() {
1870
+ this.scan();
1871
+ return this.#mode === "invalid" || this.#invalidValue;
1872
+ }
1873
+ /**
1874
+ * Retain streamed argument text without scanning or comparing observed answers.
1875
+ * @param fragment - the text following every fragment appended before.
1876
+ */
1877
+ append(fragment) {
1878
+ if (this.sealed) throw new Error("PartialArguments: cannot append to a sealed view");
1879
+ if (fragment.length === 0) return;
1880
+ this.chunks.push(fragment);
1881
+ this.#size += fragment.length;
1882
+ this.#ends.push(this.#size);
1883
+ }
1884
+ /**
1885
+ * Reconcile a streamed prefix with authoritative complete text without joining the fragments.
1886
+ * @param text - the final argument text, which replaces missing or conflicting deltas.
1887
+ * @returns this view sealed with its caches retained when every character matches; otherwise a new sealed view.
1888
+ */
1889
+ settle(text) {
1890
+ if (this.object !== void 0 || text.length !== this.#size) return PartialArguments.fromText(text);
1891
+ let offset = 0;
1892
+ for (const chunk of this.chunks) {
1893
+ if (!text.startsWith(chunk, offset)) return PartialArguments.fromText(text);
1894
+ offset += chunk.length;
1895
+ }
1896
+ this.chunks = text.length === 0 ? [] : [text];
1897
+ this.#ends = text.length === 0 ? [] : [text.length];
1898
+ this.sealed = true;
1899
+ return this;
1900
+ }
1901
+ /**
1902
+ * Compare observed answers and advance their publication baseline. Unread views remain unscanned.
1903
+ * @returns whether any observed answer changed since its first read or the preceding refresh.
1904
+ */
1905
+ refresh() {
1906
+ if (this.#reads.size === 0) return false;
1907
+ this.scan();
1908
+ let changed = false;
1909
+ let completions = false;
1910
+ for (const read of this.#reads.values()) {
1911
+ if (read.completion) {
1912
+ completions = true;
1913
+ continue;
1914
+ }
1915
+ changed = this.refreshRead(read) || changed;
1916
+ }
1917
+ if (completions) {
1918
+ for (const read of this.#reads.values()) if (read.completion) changed = this.refreshRead(read) || changed;
1919
+ }
1920
+ if (this.sealed) this.#reads.clear();
1921
+ return changed;
1922
+ }
1923
+ refreshRead(read) {
1924
+ const now = read.answer();
1925
+ if (Object.is(now, read.last)) return false;
1926
+ read.last = now;
1927
+ return true;
1928
+ }
1929
+ /**
1930
+ * Check whether no further fields can arrive.
1931
+ * @returns whether the outer object closed, indexing failed, or the view is sealed; unread values are not validated.
1932
+ */
1933
+ closed() {
1934
+ return this.remember("closed", "", () => this.closedNow());
1935
+ }
1936
+ /**
1937
+ * List discovered fields in first-appearance order.
1938
+ * @returns top-level keys seen so far, in first-appearance order.
1939
+ */
1940
+ keys() {
1941
+ return this.remember("keys", "", () => this.keysNow(), (keys) => keys.length);
1942
+ }
1943
+ /**
1944
+ * Check whether a top-level field has appeared.
1945
+ * @param key - argument name.
1946
+ * @returns whether the field has appeared (a string opened or another value began).
1947
+ */
1948
+ has(key) {
1949
+ return this.remember("has", key, () => this.hasNow(key));
1950
+ }
1951
+ /**
1952
+ * Check whether a field's closing delimiter has arrived, without validating its contents.
1953
+ * @param key - argument name.
1954
+ * @returns whether its delimiter arrived and no content reader has reported an error for this value.
1955
+ */
1956
+ complete(key) {
1957
+ return this.remember("complete", key, () => this.completeNow(key));
1958
+ }
1959
+ /**
1960
+ * Read string length without materializing its text.
1961
+ * @param key - argument name.
1962
+ * @param options - change granularity for a streaming string.
1963
+ * @returns decoded UTF-16 length of the string field so far; undefined when absent or not a string.
1964
+ */
1965
+ stringLength(key, options) {
1966
+ const step = Math.max(1, Math.floor(options?.step ?? 1));
1967
+ const offset = options?.offset ?? 0;
1968
+ return this.remember(`length:${step}:${offset}`, key, () => this.lengthNow(key), (length) => length === void 0 ? void 0 : Math.ceil((length + offset) / step));
1969
+ }
1970
+ /**
1971
+ * Check a string against a decoded UTF-16 length limit without materializing it.
1972
+ * @param key - argument name.
1973
+ * @param maxLength - decoded UTF-16 limit, floored to at least zero.
1974
+ * @returns whether the string is longer than the limit; false when absent or not a string.
1975
+ */
1976
+ stringExceeds(key, maxLength) {
1977
+ const limit = Math.max(0, Math.floor(maxLength));
1978
+ return this.remember(`exceeds:${limit}`, key, () => (this.lengthNow(key, limit + 1) ?? 0) > limit);
1979
+ }
1980
+ /**
1981
+ * Read a decoded string, including a streaming prefix.
1982
+ * @param key - argument name.
1983
+ * @returns the string field's decoded text so far; undefined when absent or not a string.
1984
+ */
1985
+ text(key) {
1986
+ return this.remember("text", key, () => this.textNow(key));
1987
+ }
1988
+ /**
1989
+ * Read at most the first decoded UTF-16 units of a string.
1990
+ * @param key - argument name.
1991
+ * @param maxLength - maximum decoded UTF-16 length, floored to at least one.
1992
+ * @returns the bounded string prefix; undefined when absent or not a string.
1993
+ */
1994
+ textPrefix(key, maxLength) {
1995
+ const limit = Math.max(1, Math.floor(maxLength));
1996
+ return this.remember(`prefix:${limit}`, key, () => this.textPrefixNow(key, limit));
1997
+ }
1998
+ /**
1999
+ * Read a completed non-string argument.
2000
+ * @param key - argument name.
2001
+ * @returns the parsed non-string value once it closed; undefined while open, absent, or a string.
2002
+ */
2003
+ value(key) {
2004
+ return this.remember("value", key, () => this.valueNow(key));
2005
+ }
2006
+ /** Answer a question and, on a streaming view, remember it for change detection. */
2007
+ remember(kind, key, read, comparison) {
2008
+ this.scan();
2009
+ const result = read();
2010
+ if (!this.sealed) {
2011
+ const id = `${kind}/${key}`;
2012
+ if (!this.#reads.has(id)) this.#reads.set(id, {
2013
+ completion: kind === "complete",
2014
+ answer: comparison === void 0 ? read : () => comparison(read()),
2015
+ last: comparison === void 0 ? result : comparison(result)
2016
+ });
2017
+ }
2018
+ return result;
2019
+ }
2020
+ closedNow() {
2021
+ return this.sealed || this.#mode === "closed" || this.#mode === "invalid";
2022
+ }
2023
+ keysNow() {
2024
+ return this.object === void 0 ? this.#order : Object.keys(this.object);
2025
+ }
2026
+ hasNow(key) {
2027
+ return this.object === void 0 ? this.#entries.has(key) : Object.hasOwn(this.object, key);
2028
+ }
2029
+ completeNow(key) {
2030
+ if (this.object !== void 0) return Object.hasOwn(this.object, key);
2031
+ const entry = this.#entries.get(key);
2032
+ return entry !== void 0 && entry.end >= 0 && (entry.kind === "string" ? entry.invalidAt === void 0 : !entry.invalid);
2033
+ }
2034
+ lengthNow(key, limit = Number.POSITIVE_INFINITY) {
2035
+ if (this.object !== void 0) {
2036
+ const field = Object.hasOwn(this.object, key) ? this.object[key] : void 0;
2037
+ return typeof field === "string" ? field.length : void 0;
2038
+ }
2039
+ const entry = this.#entries.get(key);
2040
+ if (entry?.kind !== "string") return void 0;
2041
+ if (entry.text !== void 0 && entry.text.at === entry.end) return entry.text.length;
2042
+ const read = entry.length ??= {
2043
+ at: entry.start,
2044
+ length: 0,
2045
+ text: ""
2046
+ };
2047
+ this.readString(entry, read, limit, false);
2048
+ return read.length;
2049
+ }
2050
+ textNow(key) {
2051
+ if (this.object !== void 0) {
2052
+ const field = Object.hasOwn(this.object, key) ? this.object[key] : void 0;
2053
+ return typeof field === "string" ? field : void 0;
2054
+ }
2055
+ const entry = this.#entries.get(key);
2056
+ if (entry?.kind !== "string") return void 0;
2057
+ if (entry.text === void 0 && entry.end >= 0 && entry.needsDecoding && entry.invalidAt === void 0) {
2058
+ let text;
2059
+ try {
2060
+ text = JSON.parse(`"${this.slice(entry.start, entry.end)}"`);
2061
+ } catch (_error) {}
2062
+ if (text !== void 0) entry.text = {
2063
+ at: entry.end,
2064
+ length: text.length,
2065
+ text
2066
+ };
2067
+ }
2068
+ const read = entry.text ??= {
2069
+ at: entry.start,
2070
+ length: 0,
2071
+ text: ""
2072
+ };
2073
+ this.readString(entry, read, Number.POSITIVE_INFINITY, true);
2074
+ return read.text;
2075
+ }
2076
+ textPrefixNow(key, maxLength) {
2077
+ if (this.object !== void 0) {
2078
+ const field = Object.hasOwn(this.object, key) ? this.object[key] : void 0;
2079
+ return typeof field === "string" ? field.slice(0, maxLength) : void 0;
2080
+ }
2081
+ const entry = this.#entries.get(key);
2082
+ if (entry?.kind !== "string") return void 0;
2083
+ const prefixes = entry.prefixes ??= /* @__PURE__ */ new Map();
2084
+ let read = prefixes.get(maxLength);
2085
+ if (read === void 0) {
2086
+ read = {
2087
+ at: entry.start,
2088
+ length: 0,
2089
+ text: ""
2090
+ };
2091
+ prefixes.set(maxLength, read);
2092
+ }
2093
+ this.readString(entry, read, maxLength, true);
2094
+ return read.text;
2095
+ }
2096
+ valueNow(key) {
2097
+ if (this.object !== void 0) {
2098
+ if (!Object.hasOwn(this.object, key)) return void 0;
2099
+ const field = this.object[key];
2100
+ return typeof field === "string" ? void 0 : field;
2101
+ }
2102
+ const entry = this.#entries.get(key);
2103
+ if (entry?.kind !== "value" || entry.end < 0 || entry.invalid) return void 0;
2104
+ if (entry.parsed === void 0) try {
2105
+ entry.parsed = JSON.parse(this.slice(entry.start, entry.end));
2106
+ } catch (_error) {
2107
+ entry.invalid = true;
2108
+ this.#invalidValue = true;
2109
+ }
2110
+ return entry.parsed;
2111
+ }
2112
+ chunkAt(at) {
2113
+ let low = 0;
2114
+ let high = this.#ends.length;
2115
+ while (low < high) {
2116
+ const mid = low + high >>> 1;
2117
+ if (this.#ends[mid] <= at) low = mid + 1;
2118
+ else high = mid;
2119
+ }
2120
+ return low;
2121
+ }
2122
+ /** Materialize only a requested range, never the cumulative source. */
2123
+ slice(start, end) {
2124
+ if (start >= end) return "";
2125
+ const first = this.chunkAt(start);
2126
+ const last = this.chunkAt(end - 1);
2127
+ const base = first === 0 ? 0 : this.#ends[first - 1];
2128
+ if (first === last) return this.chunks[first].slice(start - base, end - base);
2129
+ const parts = [this.chunks[first].slice(start - base)];
2130
+ for (let i = first + 1; i < last; i++) parts.push(this.chunks[i]);
2131
+ parts.push(this.chunks[last].slice(0, end - this.#ends[last - 1]));
2132
+ return parts.join("");
2133
+ }
2134
+ readString(entry, read, limit, materialize) {
2135
+ const end = Math.min(entry.end < 0 ? this.#consumed : entry.end, entry.invalidAt ?? Number.POSITIVE_INFINITY, this.#invalidAt ?? Number.POSITIVE_INFINITY);
2136
+ if (!entry.needsDecoding) {
2137
+ const length = Math.min(end - read.at, limit - read.length);
2138
+ if (length <= 0) return;
2139
+ if (materialize) read.text += this.slice(read.at, read.at + length);
2140
+ read.at += length;
2141
+ read.length += length;
2142
+ return;
2143
+ }
2144
+ let chunkIndex = this.chunkAt(read.at);
2145
+ while (read.at < end && read.length < limit) {
2146
+ const base = chunkIndex === 0 ? 0 : this.#ends[chunkIndex - 1];
2147
+ const chunk = this.chunks[chunkIndex];
2148
+ const remaining = chunk.slice(read.at - base, Math.min(chunk.length, end - base));
2149
+ const boundary = remaining.search(CONTENT_ESCAPE);
2150
+ const length = Math.min(boundary < 0 ? remaining.length : boundary, limit - read.length);
2151
+ if (length > 0) {
2152
+ if (materialize) read.text += remaining.slice(0, length);
2153
+ read.at += length;
2154
+ read.length += length;
2155
+ if (read.at === base + chunk.length) chunkIndex++;
2156
+ continue;
2157
+ }
2158
+ const type = remaining.length > 1 ? remaining[1] : read.at + 1 < end ? this.chunks[chunkIndex + 1][0] : void 0;
2159
+ let decoded;
2160
+ let width = 2;
2161
+ if (remaining[0] === "\\" && type === void 0 && entry.end < 0) return;
2162
+ if (remaining[0] === "\\" && type === "u") {
2163
+ const hex = this.slice(read.at + 2, Math.min(end, read.at + 6));
2164
+ let valid = true;
2165
+ for (let i = 0; i < hex.length; i++) if (!isHex(hex[i])) valid = false;
2166
+ if (valid) {
2167
+ if (hex.length < 4 && entry.end < 0) return;
2168
+ if (hex.length === 4) decoded = String.fromCharCode(Number.parseInt(hex, 16));
2169
+ }
2170
+ width = 6;
2171
+ } else if (remaining[0] === "\\" && type !== void 0) decoded = SIMPLE_ESCAPES[type];
2172
+ if (decoded === void 0) {
2173
+ entry.invalidAt = read.at;
2174
+ this.#invalidValue = true;
2175
+ return;
2176
+ }
2177
+ if (materialize) read.text += decoded;
2178
+ read.length++;
2179
+ read.at += width;
2180
+ while (chunkIndex < this.chunks.length && read.at >= this.#ends[chunkIndex]) chunkIndex++;
2181
+ }
2182
+ }
2183
+ /** Locate new field ranges without decoding or parsing their contents. */
2184
+ scan() {
2185
+ if (this.object !== void 0 || this.#consumed === this.#size) return;
2186
+ for (let i = this.chunkAt(this.#consumed); i < this.chunks.length && this.#invalidAt === void 0; i++) {
2187
+ const pending = this.chunks[i];
2188
+ const base = i === 0 ? 0 : this.#ends[i - 1];
2189
+ for (let index = this.#consumed - base; index < pending.length && this.#mode !== "invalid"; index++) {
2190
+ if (this.#mode === "string" || this.#mode === "nested" && this.#nestedInString) {
2191
+ const end = this.stringBoundary(pending, index);
2192
+ this.#consumed += end - index;
2193
+ index = end;
2194
+ if (index === pending.length) break;
2195
+ }
2196
+ this.step(pending[index], this.#consumed);
2197
+ this.#consumed++;
2198
+ }
2199
+ }
2200
+ }
2201
+ /** Only raw quotes and their preceding backslash runs can terminate a string. */
2202
+ stringBoundary(fragment, start) {
2203
+ let at = start;
2204
+ while (true) {
2205
+ const quote = fragment.indexOf("\"", at);
2206
+ const end = quote < 0 ? fragment.length : quote;
2207
+ if (this.#mode === "string") {
2208
+ const entry = this.#current;
2209
+ if (!entry.needsDecoding && CONTENT_ESCAPE.test(fragment.slice(at, end))) entry.needsDecoding = true;
2210
+ }
2211
+ let slashStart = end;
2212
+ while (slashStart > at && fragment[slashStart - 1] === "\\") slashStart--;
2213
+ const escaped = (end - slashStart) % 2 === 1 !== (slashStart === at && this.#escape);
2214
+ this.#escape = quote < 0 && escaped;
2215
+ if (quote < 0 || !escaped) return end;
2216
+ at = quote + 1;
2217
+ }
2218
+ }
2219
+ step(c, at) {
2220
+ switch (this.#mode) {
2221
+ case "root":
2222
+ if (isWhitespace(c)) return;
2223
+ if (c === "{") {
2224
+ this.#mode = "key-or-end";
2225
+ return;
2226
+ }
2227
+ this.fail();
2228
+ return;
2229
+ case "key-or-end":
2230
+ if (isWhitespace(c)) return;
2231
+ if (c === "}") {
2232
+ this.#mode = "closed";
2233
+ return;
2234
+ }
2235
+ if (c === "\"") {
2236
+ this.beginKey(at);
2237
+ return;
2238
+ }
2239
+ this.fail();
2240
+ return;
2241
+ case "key-only":
2242
+ if (isWhitespace(c)) return;
2243
+ if (c === "\"") {
2244
+ this.beginKey(at);
2245
+ return;
2246
+ }
2247
+ this.fail();
2248
+ return;
2249
+ case "key":
2250
+ this.stepKey(c, at);
2251
+ return;
2252
+ case "colon":
2253
+ if (isWhitespace(c)) return;
2254
+ if (c === ":") {
2255
+ this.#mode = "value";
2256
+ return;
2257
+ }
2258
+ this.fail();
2259
+ return;
2260
+ case "value":
2261
+ this.beginValue(c, at);
2262
+ return;
2263
+ case "string": {
2264
+ const entry = this.#current;
2265
+ entry.end = at;
2266
+ this.#current = null;
2267
+ this.#mode = "comma-or-end";
2268
+ return;
2269
+ }
2270
+ case "scalar":
2271
+ this.stepScalar(c, at);
2272
+ return;
2273
+ case "nested":
2274
+ this.stepNested(c, at);
2275
+ return;
2276
+ case "comma-or-end":
2277
+ if (isWhitespace(c)) return;
2278
+ if (c === ",") {
2279
+ this.#mode = "key-only";
2280
+ return;
2281
+ }
2282
+ if (c === "}") {
2283
+ this.#mode = "closed";
2284
+ return;
2285
+ }
2286
+ this.fail();
2287
+ return;
2288
+ case "closed":
2289
+ if (isWhitespace(c)) return;
2290
+ this.fail();
2291
+ return;
2292
+ /* v8 ignore next 2 -- scan() stops stepping once the view is invalid. */
2293
+ case "invalid": return;
2294
+ /* v8 ignore next 2 -- Every scanner mode has a handler above. */
2295
+ default: assertNever(this.#mode);
2296
+ }
2297
+ }
2298
+ fail() {
2299
+ this.#invalidAt = this.#consumed;
2300
+ this.#mode = "invalid";
2301
+ this.#current = null;
2302
+ }
2303
+ beginKey(at) {
2304
+ this.#mode = "key";
2305
+ this.#keyStart = at + 1;
2306
+ this.#keyEscaped = false;
2307
+ this.#escape = false;
2308
+ }
2309
+ stepKey(c, at) {
2310
+ if (c < " ") {
2311
+ this.fail();
2312
+ return;
2313
+ }
2314
+ if (this.#escape) {
2315
+ this.#escape = false;
2316
+ return;
2317
+ }
2318
+ if (c === "\\") {
2319
+ this.#escape = true;
2320
+ this.#keyEscaped = true;
2321
+ return;
2322
+ }
2323
+ if (c !== "\"") return;
2324
+ const raw = this.slice(this.#keyStart, at);
2325
+ if (this.#keyEscaped) try {
2326
+ this.#key = JSON.parse(`"${raw}"`);
2327
+ } catch (_error) {
2328
+ this.fail();
2329
+ return;
2330
+ }
2331
+ else this.#key = raw;
2332
+ this.#mode = "colon";
2333
+ }
2334
+ open(entry) {
2335
+ if (!this.#entries.has(this.#key)) this.#order.push(this.#key);
2336
+ this.#entries.set(this.#key, entry);
2337
+ this.#current = entry;
2338
+ }
2339
+ beginValue(c, at) {
2340
+ if (isWhitespace(c)) return;
2341
+ if (c === "\"") {
2342
+ this.open({
2343
+ kind: "string",
2344
+ start: at + 1,
2345
+ end: -1,
2346
+ needsDecoding: false,
2347
+ invalidAt: void 0,
2348
+ length: void 0,
2349
+ text: void 0,
2350
+ prefixes: void 0
2351
+ });
2352
+ this.#escape = false;
2353
+ this.#mode = "string";
2354
+ return;
2355
+ }
2356
+ if (c === "}" || c === "," || c === ":" || c === "]") {
2357
+ this.fail();
2358
+ return;
2359
+ }
2360
+ this.open({
2361
+ kind: "value",
2362
+ start: at,
2363
+ end: -1,
2364
+ parsed: void 0,
2365
+ invalid: false
2366
+ });
2367
+ if (c === "{" || c === "[") {
2368
+ this.#mode = "nested";
2369
+ this.#nestedEnds = [c === "{" ? "}" : "]"];
2370
+ this.#nestedInString = false;
2371
+ this.#escape = false;
2372
+ return;
2373
+ }
2374
+ this.#mode = "scalar";
2375
+ }
2376
+ stepScalar(c, at) {
2377
+ if (c !== "," && c !== "}" && !isWhitespace(c)) return;
2378
+ this.closeValue(at);
2379
+ this.#mode = c === "," ? "key-only" : c === "}" ? "closed" : "comma-or-end";
2380
+ }
2381
+ stepNested(c, at) {
2382
+ if (this.#nestedInString) {
2383
+ this.#nestedInString = false;
2384
+ return;
2385
+ }
2386
+ if (c === "\"") {
2387
+ this.#nestedInString = true;
2388
+ return;
2389
+ }
2390
+ if (c === "{" || c === "[") {
2391
+ this.#nestedEnds.push(c === "{" ? "}" : "]");
2392
+ return;
2393
+ }
2394
+ if (c === "}" || c === "]") {
2395
+ if (this.#nestedEnds.pop() !== c) {
2396
+ this.fail();
2397
+ return;
2398
+ }
2399
+ if (this.#nestedEnds.length === 0) {
2400
+ this.closeValue(at + 1);
2401
+ this.#mode = "comma-or-end";
2402
+ }
2403
+ }
2404
+ }
2405
+ closeValue(end) {
2406
+ const entry = this.#current;
2407
+ entry.end = end;
2408
+ this.#current = null;
2409
+ }
2410
+ };
1783
2411
  /** Duplicate-install-safe JSON and immutable-value helpers. @module @deepseek-ai/dsh-util-values */
1784
2412
  /**
1785
2413
  * Mark an unreachable closed-union branch.
@@ -6360,14 +6988,10 @@ window.__ModuleLoader__.load({
6360
6988
  };
6361
6989
  /**
6362
6990
  * One trigger-anchored dialog seat: open state, viewport-clamped placement, outside-close.
6363
- * @param controlled - external open state; when given the seat reads and writes
6364
- * it instead of owning its own, letting sibling dialogs share one exclusive slot.
6365
6991
  * @returns the seat; spread `pos ?? MEASURE_STYLE` onto the portaled panel.
6366
6992
  */
6367
- function useStatDialog(controlled) {
6368
- const [ownOpen, setOwnOpen] = (0, react.useState)(false);
6369
- const open = controlled?.open ?? ownOpen;
6370
- const setOpen = controlled?.setOpen ?? setOwnOpen;
6993
+ function useStatDialog() {
6994
+ const [open, setOpen] = (0, react.useState)(false);
6371
6995
  const rootRef = (0, react.useRef)(null);
6372
6996
  const panelRef = (0, react.useRef)(null);
6373
6997
  const pos = (0, _deepseek_ai_dsh_client_ui_primitives.useAnchoredPosition)({
@@ -6384,9 +7008,14 @@ window.__ModuleLoader__.load({
6384
7008
  const onKeyDown = (e) => {
6385
7009
  if (e.key === "Escape") setOpen(false);
6386
7010
  };
7011
+ const onClick = (e) => {
7012
+ if (e.target instanceof Node && rootRef.current?.contains(e.target) !== true && panelRef.current?.contains(e.target) !== true) setOpen(false);
7013
+ };
6387
7014
  document.addEventListener("keydown", onKeyDown);
7015
+ document.addEventListener("click", onClick, true);
6388
7016
  return () => {
6389
7017
  document.removeEventListener("keydown", onKeyDown);
7018
+ document.removeEventListener("click", onClick, true);
6390
7019
  };
6391
7020
  }, [open, setOpen]);
6392
7021
  return {
@@ -6890,7 +7519,7 @@ window.__ModuleLoader__.load({
6890
7519
  }
6891
7520
  //#endregion
6892
7521
  //#region \0dsh-css:/home/runner/work/deepseek-harness/deepseek-harness/packages/client/ui-chat/src/client/chat/StatsPills.module.css.mjs
6893
- const css$1 = ".bOPqQW_root{box-sizing:border-box;min-width:0;max-width:100%;font-size:calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));justify-content:center;gap:12px;display:flex}.bOPqQW_anchor{min-width:0;display:inline-flex}.bOPqQW_pill{box-sizing:border-box;corner-shape:round;max-width:100%;color:var(--dsw-alias-label-tertiary);font:inherit;font-variant-numeric:tabular-nums;line-height:inherit;white-space:nowrap;background:0 0;border:none;border-radius:999px;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.bOPqQW_pill svg{flex:none;width:14px;height:14px}button.bOPqQW_pill{cursor:pointer}button.bOPqQW_pill:hover,button.bOPqQW_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.bOPqQW_label{text-overflow:ellipsis;min-width:0;overflow:hidden}.bOPqQW_sep{color:var(--dsw-alias-separator-primary);margin:0 6px}";
7522
+ const css$1 = ".bOPqQW_anchor{min-width:0;font-size:calc(var(--dsh-content-font-size-secondary,13px) - 1px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));display:inline-flex}.bOPqQW_pill{box-sizing:border-box;corner-shape:round;max-width:100%;color:var(--dsw-alias-label-tertiary);font:inherit;font-variant-numeric:tabular-nums;line-height:inherit;white-space:nowrap;background:0 0;border:none;border-radius:999px;align-items:center;gap:6px;padding:1px 8px;display:inline-flex}.bOPqQW_pill svg{flex:none;width:14px;height:14px}button.bOPqQW_pill{cursor:pointer}button.bOPqQW_pill:hover,button.bOPqQW_pill[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.bOPqQW_label{text-overflow:ellipsis;min-width:0;overflow:hidden}.bOPqQW_sep{color:var(--dsw-alias-separator-primary);margin:0 6px}";
6894
7523
  const tagId$1 = "@deepseek-ai/dsh-client-ui-chat/StatsPills.module.css";
6895
7524
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId$1) + "]") === null) {
6896
7525
  const tag = document.createElement("style");
@@ -6903,7 +7532,6 @@ window.__ModuleLoader__.load({
6903
7532
  "anchor": "bOPqQW_anchor",
6904
7533
  "label": "bOPqQW_label",
6905
7534
  "pill": "bOPqQW_pill",
6906
- "root": "bOPqQW_root",
6907
7535
  "sep": "bOPqQW_sep"
6908
7536
  };
6909
7537
  //#endregion
@@ -6995,185 +7623,167 @@ window.__ModuleLoader__.load({
6995
7623
  function exactCount(value, t) {
6996
7624
  return t("message.turnUsage.count", { count: formatExactTokens(value, t) });
6997
7625
  }
6998
- function TimePill({ stats, t, dialog }) {
6999
- const { open, setOpen, rootRef, panelRef, pos } = useStatDialog(dialog);
7000
- const counts = t("stats.counts", {
7001
- turns: stats.turns,
7002
- steps: stats.steps
7003
- });
7004
- const tps = stats.decodeMs > 0 ? t("message.tokensPerSecond", { tps: formatTokensPerSecond(stats.decodeTokens / (stats.decodeMs / 1e3)) }) : null;
7005
- const label = (0, react_jsx_runtime.jsxs)("span", {
7006
- className: StatsPills_module_css_default.label,
7007
- children: [counts, tps !== null && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
7626
+ function joined$1(first, second) {
7627
+ if (second === null) return first;
7628
+ return (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
7629
+ first,
7630
+ (0, react_jsx_runtime.jsx)("span", {
7008
7631
  className: StatsPills_module_css_default.sep,
7009
7632
  "aria-hidden": true,
7010
7633
  children: "·"
7011
- }), tps] })]
7012
- });
7013
- if (stats.llmMs <= 0 && stats.toolMs <= 0 && stats.ttftSteps <= 0 && stats.decodeMs <= 0) return (0, react_jsx_runtime.jsx)("span", {
7634
+ }),
7635
+ second
7636
+ ] });
7637
+ }
7638
+ function useSessionStats(useChat, useProjection) {
7639
+ const settledNodes = useChat((s) => s.legacy.nodes);
7640
+ const projected = useProjection("sessionStats");
7641
+ return (0, react.useMemo)(() => projected ?? deriveStats(settledNodes), [projected, settledNodes]);
7642
+ }
7643
+ function decodeSpeed(stats, t) {
7644
+ return t("message.tokensPerSecond", { tps: formatTokensPerSecond(stats.decodeTokens / (stats.decodeMs / 1e3)) });
7645
+ }
7646
+ /** A static reading: used when the pill has no dialog rows or the mode is Compact. */
7647
+ function PlainPill({ stat, icon, label }) {
7648
+ return (0, react_jsx_runtime.jsx)("span", {
7014
7649
  className: StatsPills_module_css_default.anchor,
7650
+ "data-composer-stat": stat,
7015
7651
  children: (0, react_jsx_runtime.jsxs)("span", {
7016
7652
  className: StatsPills_module_css_default.pill,
7017
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGaugeOutlineRegular, {}), label]
7653
+ children: [icon, (0, react_jsx_runtime.jsx)("span", {
7654
+ className: StatsPills_module_css_default.label,
7655
+ children: label
7656
+ })]
7018
7657
  })
7019
7658
  });
7020
- return (0, react_jsx_runtime.jsxs)("span", {
7021
- ref: rootRef,
7022
- className: StatsPills_module_css_default.anchor,
7023
- children: [(0, react_jsx_runtime.jsxs)("button", {
7024
- type: "button",
7025
- className: StatsPills_module_css_default.pill,
7026
- "aria-haspopup": "dialog",
7027
- "aria-expanded": open,
7028
- "aria-label": tps === null ? counts : `${counts} · ${tps}`,
7029
- onClick: () => {
7030
- setOpen(!open);
7031
- },
7032
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGaugeOutlineRegular, {}), label]
7033
- }), open && (0, react_dom.createPortal)((0, react_jsx_runtime.jsxs)("div", {
7034
- ref: panelRef,
7035
- className: stat_dialog_module_css_default.panel,
7036
- role: "dialog",
7037
- "aria-label": t("stats.dialog.title"),
7038
- style: pos ?? MEASURE_STYLE,
7039
- children: [
7040
- (0, react_jsx_runtime.jsx)("div", {
7041
- className: stat_dialog_module_css_default.title,
7042
- children: (0, react_jsx_runtime.jsxs)("span", {
7043
- className: stat_dialog_module_css_default.titleLabel,
7044
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGaugeOutlineRegular, {}), t("stats.dialog.title")]
7045
- })
7046
- }),
7047
- (0, react_jsx_runtime.jsx)("div", {
7048
- className: stat_dialog_module_css_default.titleRule,
7049
- "aria-hidden": true
7050
- }),
7051
- (0, react_jsx_runtime.jsxs)("dl", {
7052
- className: stat_dialog_module_css_default.details,
7053
- "data-session-stats-details": true,
7054
- children: [
7055
- stats.llmMs > 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("stats.dialog.llmTime") }), (0, react_jsx_runtime.jsx)("dd", { children: formatDuration(stats.llmMs, t) })] }),
7056
- stats.toolMs > 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("stats.dialog.toolTime") }), (0, react_jsx_runtime.jsx)("dd", { children: formatDuration(stats.toolMs, t) })] }),
7057
- stats.ttftSteps > 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("stats.dialog.ttft") }), (0, react_jsx_runtime.jsx)("dd", { children: formatDuration(stats.ttftMs / stats.ttftSteps, t) })] }),
7058
- stats.decodeMs > 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("stats.dialog.speed") }), (0, react_jsx_runtime.jsx)("dd", { children: t("message.tokensPerSecond", { tps: formatTokensPerSecond(stats.decodeTokens / (stats.decodeMs / 1e3)) }) })] })
7059
- ]
7060
- })
7061
- ]
7062
- }), document.body)]
7063
- });
7064
7659
  }
7065
- function UsagePill({ usage, t, dialog }) {
7066
- const { open, setOpen, rootRef, panelRef, pos } = useStatDialog(dialog);
7067
- const total = billedInputTokens(usage) + usage.outputTokens;
7068
- const totalText = t("message.turnUsage.count", { count: formatTokens(total, t) });
7069
- const cacheHit = cacheHitPercent(usage);
7070
- const cacheHitText = cacheHit !== null ? t("stats.cacheHit", { percent: cacheHit }) : null;
7660
+ /**
7661
+ * A pill button opening its own portaled dialog. Each pill owns its open
7662
+ * state; useStatDialog closes it on Escape or an outside pointerdown or click,
7663
+ * so at most one dialog is open across the dock.
7664
+ */
7665
+ function DialogPill({ stat, icon, label, ariaLabel, title, titleValue, children }) {
7666
+ const { open, setOpen, rootRef, panelRef, pos } = useStatDialog();
7071
7667
  return (0, react_jsx_runtime.jsxs)("span", {
7072
7668
  ref: rootRef,
7073
7669
  className: StatsPills_module_css_default.anchor,
7670
+ "data-composer-stat": stat,
7074
7671
  children: [(0, react_jsx_runtime.jsxs)("button", {
7075
7672
  type: "button",
7076
7673
  className: StatsPills_module_css_default.pill,
7077
7674
  "aria-haspopup": "dialog",
7078
7675
  "aria-expanded": open,
7079
- "aria-label": cacheHitText === null ? totalText : `${totalText} · ${cacheHitText}`,
7676
+ "aria-label": ariaLabel,
7080
7677
  onClick: () => {
7081
7678
  setOpen(!open);
7082
7679
  },
7083
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDatabaseOutlineRegular, {}), (0, react_jsx_runtime.jsxs)("span", {
7680
+ children: [icon, (0, react_jsx_runtime.jsx)("span", {
7084
7681
  className: StatsPills_module_css_default.label,
7085
- children: [totalText, cacheHitText !== null && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
7086
- className: StatsPills_module_css_default.sep,
7087
- "aria-hidden": true,
7088
- children: "·"
7089
- }), cacheHitText] })]
7682
+ children: label
7090
7683
  })]
7091
7684
  }), open && (0, react_dom.createPortal)((0, react_jsx_runtime.jsxs)("div", {
7092
7685
  ref: panelRef,
7093
7686
  className: stat_dialog_module_css_default.panel,
7094
7687
  role: "dialog",
7095
- "aria-label": t("stats.dialog.usageTitle"),
7688
+ "aria-label": title,
7096
7689
  style: pos ?? MEASURE_STYLE,
7097
7690
  children: [
7098
7691
  (0, react_jsx_runtime.jsxs)("div", {
7099
7692
  className: stat_dialog_module_css_default.title,
7100
7693
  children: [(0, react_jsx_runtime.jsxs)("span", {
7101
7694
  className: stat_dialog_module_css_default.titleLabel,
7102
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDatabaseOutlineRegular, {}), t("stats.dialog.usageTitle")]
7103
- }), (0, react_jsx_runtime.jsx)("span", {
7695
+ children: [icon, title]
7696
+ }), titleValue !== void 0 && (0, react_jsx_runtime.jsx)("span", {
7104
7697
  className: stat_dialog_module_css_default.titleValue,
7105
- children: exactCount(total, t)
7698
+ children: titleValue
7106
7699
  })]
7107
7700
  }),
7108
7701
  (0, react_jsx_runtime.jsx)("div", {
7109
7702
  className: stat_dialog_module_css_default.titleRule,
7110
7703
  "aria-hidden": true
7111
7704
  }),
7112
- (0, react_jsx_runtime.jsxs)("dl", {
7113
- className: stat_dialog_module_css_default.details,
7114
- "data-session-stats-usage": true,
7115
- children: [
7116
- cacheHit !== null && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.cacheHit") }), (0, react_jsx_runtime.jsx)("dd", { children: `${cacheHit}%` })] }),
7117
- (0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.input") }),
7118
- (0, react_jsx_runtime.jsx)("dd", { children: exactCount(usage.uncachedInputTokens, t) }),
7119
- (0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.cacheRead") }),
7120
- (0, react_jsx_runtime.jsx)("dd", { children: exactCount(usage.cacheReadTokens, t) }),
7121
- usage.cacheWriteTokens !== 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.cacheWrite") }), (0, react_jsx_runtime.jsx)("dd", { children: exactCount(usage.cacheWriteTokens, t) })] }),
7122
- (0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.output") }),
7123
- (0, react_jsx_runtime.jsx)("dd", { children: exactCount(usage.outputTokens, t) })
7124
- ]
7125
- })
7705
+ children
7126
7706
  ]
7127
7707
  }), document.body)]
7128
7708
  });
7129
7709
  }
7130
- const StatsPills = (0, react.memo)(function StatsPills({ useChat, useProjection, usePerformanceUsage, t }) {
7710
+ /**
7711
+ * Turn and step counts with whole-session speed, opening the time and speed
7712
+ * dialog; Compact keeps only the speed reading.
7713
+ */
7714
+ const ActivityPill = (0, react.memo)(function ActivityPill({ useChat, useProjection, usePerformanceUsage, t }) {
7715
+ const mode = usePerformanceUsage((value) => value);
7716
+ const stats = useSessionStats(useChat, useProjection);
7717
+ const speed = stats.decodeMs > 0 ? decodeSpeed(stats, t) : null;
7718
+ const icon = (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGaugeOutlineRegular, {});
7719
+ if (mode === "compact") return speed === null ? null : (0, react_jsx_runtime.jsx)(PlainPill, {
7720
+ stat: "activity",
7721
+ icon,
7722
+ label: speed
7723
+ });
7724
+ if (stats.steps === 0) return null;
7725
+ const counts = t("stats.counts", {
7726
+ turns: stats.turns,
7727
+ steps: stats.steps
7728
+ });
7729
+ const content = {
7730
+ stat: "activity",
7731
+ icon,
7732
+ label: joined$1(counts, speed)
7733
+ };
7734
+ if (stats.llmMs <= 0 && stats.toolMs <= 0 && stats.ttftSteps <= 0 && speed === null) return (0, react_jsx_runtime.jsx)(PlainPill, { ...content });
7735
+ return (0, react_jsx_runtime.jsx)(DialogPill, {
7736
+ ...content,
7737
+ ariaLabel: speed === null ? counts : `${counts} · ${speed}`,
7738
+ title: t("stats.dialog.title"),
7739
+ children: (0, react_jsx_runtime.jsxs)("dl", {
7740
+ className: stat_dialog_module_css_default.details,
7741
+ "data-session-stats-details": true,
7742
+ children: [
7743
+ stats.llmMs > 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("stats.dialog.llmTime") }), (0, react_jsx_runtime.jsx)("dd", { children: formatDuration(stats.llmMs, t) })] }),
7744
+ stats.toolMs > 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("stats.dialog.toolTime") }), (0, react_jsx_runtime.jsx)("dd", { children: formatDuration(stats.toolMs, t) })] }),
7745
+ stats.ttftSteps > 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("stats.dialog.ttft") }), (0, react_jsx_runtime.jsx)("dd", { children: formatDuration(stats.ttftMs / stats.ttftSteps, t) })] }),
7746
+ speed !== null && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("stats.dialog.speed") }), (0, react_jsx_runtime.jsx)("dd", { children: speed })] })
7747
+ ]
7748
+ })
7749
+ });
7750
+ });
7751
+ /** Whole-log token total and cache hit; Compact keeps only the cache hit. */
7752
+ const UsagePill = (0, react.memo)(function UsagePill({ useProjection, usePerformanceUsage, t }) {
7131
7753
  const mode = usePerformanceUsage((value) => value);
7132
- const settledNodes = useChat((s) => s.legacy.nodes);
7133
7754
  const usage = useProjection("tokenUsage");
7134
- const [openPill, setOpenPill] = (0, react.useState)(null);
7135
- const projected = useProjection("sessionStats");
7136
- const stats = (0, react.useMemo)(() => projected ?? deriveStats(settledNodes), [projected, settledNodes]);
7137
- const hasTokens = usage !== void 0 && (billedInputTokens(usage) > 0 || usage.outputTokens > 0);
7138
- if (mode === "compact") {
7139
- const speed = stats.decodeMs > 0 ? t("message.tokensPerSecond", { tps: formatTokensPerSecond(stats.decodeTokens / (stats.decodeMs / 1e3)) }) : null;
7140
- const cacheHit = hasTokens ? cacheHitPercent(usage) : null;
7141
- if (speed === null && cacheHit === null) return null;
7142
- return (0, react_jsx_runtime.jsxs)("div", {
7143
- className: StatsPills_module_css_default.root,
7144
- "data-composer-stats": true,
7145
- children: [speed !== null && (0, react_jsx_runtime.jsxs)("span", {
7146
- className: StatsPills_module_css_default.pill,
7147
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconGaugeOutlineRegular, {}), speed]
7148
- }), cacheHit !== null && (0, react_jsx_runtime.jsxs)("span", {
7149
- className: StatsPills_module_css_default.pill,
7150
- children: [(0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDatabaseOutlineRegular, {}), t("stats.cacheHit", { percent: cacheHit })]
7151
- })]
7152
- });
7153
- }
7154
- if (stats.steps === 0 && !hasTokens) return null;
7155
- return (0, react_jsx_runtime.jsxs)("div", {
7156
- className: StatsPills_module_css_default.root,
7157
- "data-composer-stats": true,
7158
- children: [stats.steps > 0 && (0, react_jsx_runtime.jsx)(TimePill, {
7159
- stats,
7160
- t,
7161
- dialog: {
7162
- open: openPill === "time",
7163
- setOpen: (open) => {
7164
- setOpenPill(open ? "time" : null);
7165
- }
7166
- }
7167
- }), hasTokens && (0, react_jsx_runtime.jsx)(UsagePill, {
7168
- usage,
7169
- t,
7170
- dialog: {
7171
- open: openPill === "usage",
7172
- setOpen: (open) => {
7173
- setOpenPill(open ? "usage" : null);
7174
- }
7175
- }
7176
- })]
7755
+ if (usage === void 0 || billedInputTokens(usage) === 0 && usage.outputTokens === 0) return null;
7756
+ const cacheHit = cacheHitPercent(usage);
7757
+ const cacheHitText = cacheHit !== null ? t("stats.cacheHit", { percent: cacheHit }) : null;
7758
+ const icon = (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconDatabaseOutlineRegular, {});
7759
+ if (mode === "compact") return cacheHitText === null ? null : (0, react_jsx_runtime.jsx)(PlainPill, {
7760
+ stat: "usage",
7761
+ icon,
7762
+ label: cacheHitText
7763
+ });
7764
+ const total = billedInputTokens(usage) + usage.outputTokens;
7765
+ const totalText = t("message.turnUsage.count", { count: formatTokens(total, t) });
7766
+ return (0, react_jsx_runtime.jsx)(DialogPill, {
7767
+ stat: "usage",
7768
+ icon,
7769
+ label: joined$1(totalText, cacheHitText),
7770
+ ariaLabel: cacheHitText === null ? totalText : `${totalText} · ${cacheHitText}`,
7771
+ title: t("stats.dialog.usageTitle"),
7772
+ titleValue: exactCount(total, t),
7773
+ children: (0, react_jsx_runtime.jsxs)("dl", {
7774
+ className: stat_dialog_module_css_default.details,
7775
+ "data-session-stats-usage": true,
7776
+ children: [
7777
+ cacheHit !== null && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.cacheHit") }), (0, react_jsx_runtime.jsx)("dd", { children: `${cacheHit}%` })] }),
7778
+ (0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.input") }),
7779
+ (0, react_jsx_runtime.jsx)("dd", { children: exactCount(usage.uncachedInputTokens, t) }),
7780
+ (0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.cacheRead") }),
7781
+ (0, react_jsx_runtime.jsx)("dd", { children: exactCount(usage.cacheReadTokens, t) }),
7782
+ usage.cacheWriteTokens !== 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.cacheWrite") }), (0, react_jsx_runtime.jsx)("dd", { children: exactCount(usage.cacheWriteTokens, t) })] }),
7783
+ (0, react_jsx_runtime.jsx)("dt", { children: t("message.turnUsage.output") }),
7784
+ (0, react_jsx_runtime.jsx)("dd", { children: exactCount(usage.outputTokens, t) })
7785
+ ]
7786
+ })
7177
7787
  });
7178
7788
  });
7179
7789
  //#endregion
@@ -7455,6 +8065,10 @@ window.__ModuleLoader__.load({
7455
8065
  };
7456
8066
  }
7457
8067
  function updateChunk(state, chunk, seq, time) {
8068
+ if (chunk.type === "tool-call-delta") {
8069
+ const previous = state.blocks[chunk.index];
8070
+ if (previous?.kind === "tool-call" && previous.callId !== "" && (chunk.name === void 0 || chunk.name === previous.name) && (state.firstTokenTime !== void 0 || !isTokenDelta(chunk))) return state;
8071
+ }
7458
8072
  const blocks = [...state.blocks];
7459
8073
  let changedIndex = -1;
7460
8074
  let previousVisible = false;
@@ -7488,17 +8102,11 @@ window.__ModuleLoader__.load({
7488
8102
  const previous = blocks[chunk.index];
7489
8103
  changedIndex = chunk.index;
7490
8104
  previousVisible = blockIsVisible(previous);
7491
- const base = previous?.kind === "tool-call" ? previous : {
7492
- kind: "tool-call",
7493
- callId: "",
7494
- name: "",
7495
- argsRaw: ""
7496
- };
7497
8105
  blocks[chunk.index] = {
7498
8106
  kind: "tool-call",
7499
- callId: base.callId || String(chunk.id),
7500
- name: chunk.name ?? base.name,
7501
- argsRaw: base.argsRaw + chunk.argumentsDelta
8107
+ callId: (previous?.kind === "tool-call" ? previous.callId : "") || String(chunk.id),
8108
+ name: chunk.name ?? (previous?.kind === "tool-call" ? previous.name : ""),
8109
+ argsRaw: previous?.kind === "tool-call" ? previous.argsRaw : ""
7502
8110
  };
7503
8111
  break;
7504
8112
  }
@@ -7687,7 +8295,16 @@ window.__ModuleLoader__.load({
7687
8295
  * @param ctx - owning UI Conversation context.
7688
8296
  */
7689
8297
  function registerAssistantConversationNode(ctx) {
7690
- ctx.uiConversation.events.register(assistantDefinition);
8298
+ const match = assistantDefinition.match.bind(assistantDefinition);
8299
+ ctx.uiConversation.events.register({
8300
+ ...assistantDefinition,
8301
+ match: {
8302
+ "step/start": match,
8303
+ "assistant/live-chunk": match,
8304
+ "assistant/message": match,
8305
+ "llm/retry": match
8306
+ }
8307
+ });
7691
8308
  }
7692
8309
  //#endregion
7693
8310
  //#region lib/types/client/contract/chat-nodes.js
@@ -8619,7 +9236,7 @@ window.__ModuleLoader__.load({
8619
9236
  function sameContribution(left, right) {
8620
9237
  return left !== void 0 && left.anchorSeq === right.anchorSeq && left.partial?.blocks === right.partial?.blocks && left.partial?.turn === right.partial?.turn && left.partial?.step === right.partial?.step && left.running === right.running && sameReferences$1(left.nodes, right.nodes);
8621
9238
  }
8622
- /** Incremental compatibility projection for StatsPills and legacy top-level snapshot fields. */
9239
+ /** Incremental compatibility projection for the composer stats pills and legacy top-level snapshot fields. */
8623
9240
  var LegacySliceBuilder = class {
8624
9241
  contributions = /* @__PURE__ */ new Map();
8625
9242
  finalizedContributions = /* @__PURE__ */ new Map();
@@ -9525,33 +10142,68 @@ window.__ModuleLoader__.load({
9525
10142
  function jsonArguments(value) {
9526
10143
  return JSON.stringify(value);
9527
10144
  }
9528
- function rootCall(match) {
9529
- const event = match.event;
9530
- if (event.type === "assistant/live-chunk") {
9531
- const chunk = event.data.chunk;
9532
- if (chunk.type !== "tool-call-delta" || !chunk.name) throw new Error("tool preparation requires a named call delta");
9533
- return {
9534
- phase: "preparing",
9535
- callId: String(chunk.id),
9536
- name: chunk.name,
9537
- turn: event.data.turn,
9538
- step: event.data.step,
9539
- time: event.time,
9540
- subCalls: []
9541
- };
9542
- }
10145
+ function rootCall(match, previous) {
9543
10146
  if (match.event.type !== "tool/call") throw new Error("tool-call start requires tool/call");
9544
10147
  return {
9545
10148
  phase: "start",
9546
10149
  callId: String(match.event.data.callId),
9547
10150
  name: match.event.data.name,
9548
10151
  argsRaw: match.event.data.arguments,
10152
+ args: previous === void 0 ? PartialArguments.fromText(match.event.data.arguments) : previous.args.settle(match.event.data.arguments),
9549
10153
  turn: match.event.data.turn,
9550
10154
  step: match.event.data.step,
9551
10155
  time: match.event.time,
9552
10156
  subCalls: []
9553
10157
  };
9554
10158
  }
10159
+ /**
10160
+ * Retain argument fragments in the named call's lazy view. Root replacement
10161
+ * belongs to publication, after all pending fragments can be observed together.
10162
+ */
10163
+ function applyDelta(state, match) {
10164
+ const event = match.event;
10165
+ if (event.type !== "assistant/live-chunk") return state;
10166
+ const chunk = event.data.chunk;
10167
+ const root = state.root;
10168
+ if (chunk.type === "block-end" && chunk.block.type === "tool-call") {
10169
+ if (root === void 0 || "kind" in root || root.phase !== "preparing") return state;
10170
+ return {
10171
+ ...state,
10172
+ root: {
10173
+ ...root,
10174
+ name: chunk.block.name,
10175
+ args: root.args.settle(chunk.block.arguments)
10176
+ }
10177
+ };
10178
+ }
10179
+ if (chunk.type !== "tool-call-delta") return state;
10180
+ if (root === void 0) {
10181
+ if (!chunk.name) return state;
10182
+ const args = new PartialArguments();
10183
+ args.append(chunk.argumentsDelta);
10184
+ return {
10185
+ ...state,
10186
+ root: {
10187
+ phase: "preparing",
10188
+ callId: String(chunk.id),
10189
+ name: chunk.name,
10190
+ turn: event.data.turn,
10191
+ step: event.data.step,
10192
+ time: event.time,
10193
+ subCalls: [],
10194
+ args
10195
+ }
10196
+ };
10197
+ }
10198
+ if ("kind" in root || root.phase !== "preparing" || root.args.isSealed) return state;
10199
+ root.args.append(chunk.argumentsDelta);
10200
+ return state;
10201
+ }
10202
+ function preparingBlock(root, current) {
10203
+ const changed = root.args.refresh();
10204
+ if (!changed && current !== void 0 && !("kind" in current) && current.phase === "preparing" && current.name === root.name && current.args === root.args) return current;
10205
+ return changed ? { ...root } : root;
10206
+ }
9555
10207
  function rootResult(match, previous) {
9556
10208
  if (match.event.type !== "tool/result") return void 0;
9557
10209
  const message = match.event.data.message;
@@ -9560,6 +10212,8 @@ window.__ModuleLoader__.load({
9560
10212
  seq: match.event.seq,
9561
10213
  time: match.event.time,
9562
10214
  callId: String(message.source.callId),
10215
+ name: previous?.name ?? "",
10216
+ args: previous?.args ?? PartialArguments.EMPTY,
9563
10217
  call: previous === void 0 ? null : {
9564
10218
  name: previous.name,
9565
10219
  argsRaw: previous.argsRaw
@@ -9579,6 +10233,7 @@ window.__ModuleLoader__.load({
9579
10233
  parentCallId: data.parentCallId,
9580
10234
  name: data.name,
9581
10235
  argsRaw: jsonArguments(data.arguments),
10236
+ args: PartialArguments.fromObject(data.arguments),
9582
10237
  turn: locationTurn(match),
9583
10238
  step: locationStep(match),
9584
10239
  time: match.event.time,
@@ -9592,6 +10247,8 @@ window.__ModuleLoader__.load({
9592
10247
  time: match.event.time,
9593
10248
  callId: data.subCallId,
9594
10249
  parentCallId: data.parentCallId,
10250
+ name: data.name,
10251
+ args: previous !== void 0 && !("kind" in previous) ? previous.args : PartialArguments.fromObject(data.arguments),
9595
10252
  call: {
9596
10253
  name: data.name,
9597
10254
  argsRaw: jsonArguments(data.arguments)
@@ -9691,6 +10348,8 @@ window.__ModuleLoader__.load({
9691
10348
  time: interruptedAt.time,
9692
10349
  callId: block.callId,
9693
10350
  ...block.parentCallId === void 0 ? {} : { parentCallId: block.parentCallId },
10351
+ name: block.name,
10352
+ args: block.args,
9694
10353
  call: {
9695
10354
  name: block.name,
9696
10355
  argsRaw: block.argsRaw
@@ -9739,7 +10398,11 @@ window.__ModuleLoader__.load({
9739
10398
  match: (event) => {
9740
10399
  if (event.type === "assistant/live-chunk") {
9741
10400
  const chunk = event.data.chunk;
9742
- return chunk.type === "tool-call-delta" && chunk.name ? {
10401
+ if (chunk.type === "block-end" && chunk.block.type === "tool-call") return {
10402
+ id: String(chunk.block.id),
10403
+ role: "start"
10404
+ };
10405
+ return chunk.type === "tool-call-delta" ? {
9743
10406
  id: String(chunk.id),
9744
10407
  role: "start"
9745
10408
  } : null;
@@ -9761,19 +10424,26 @@ window.__ModuleLoader__.load({
9761
10424
  }
9762
10425
  return null;
9763
10426
  },
9764
- start: (_context, match) => ({
9765
- root: rootCall(match),
9766
- children: /* @__PURE__ */ new Map(),
9767
- parents: /* @__PURE__ */ new Map()
9768
- }),
10427
+ start: (_context, match) => {
10428
+ const state = {
10429
+ root: void 0,
10430
+ children: /* @__PURE__ */ new Map(),
10431
+ parents: /* @__PURE__ */ new Map()
10432
+ };
10433
+ return match.event.type === "tool/call" ? {
10434
+ ...state,
10435
+ root: rootCall(match)
10436
+ } : applyDelta(state, match);
10437
+ },
9769
10438
  update: (context, match) => {
10439
+ if (match.event.type === "assistant/live-chunk") return applyDelta(context.state, match);
9770
10440
  if (match.event.type === "tool/call") return {
9771
10441
  ...context.state,
9772
- root: rootCall(match)
10442
+ root: rootCall(match, context.state.root)
9773
10443
  };
9774
10444
  if (match.event.type === "tool/result") {
9775
10445
  const root = context.state.root;
9776
- const result = rootResult(match, !("kind" in root) && root.phase === "start" ? root : void 0);
10446
+ const result = rootResult(match, root !== void 0 && !("kind" in root) && root.phase === "start" ? root : void 0);
9777
10447
  return result === void 0 ? context.state : {
9778
10448
  ...context.state,
9779
10449
  root: result
@@ -9785,12 +10455,12 @@ window.__ModuleLoader__.load({
9785
10455
  buildViewNode: (context) => {
9786
10456
  const current = context.current.get("chat");
9787
10457
  const state = context.state ?? fallbackState$2(context);
9788
- if (state === void 0) return current == null ? null : current.visibility === "hidden" ? current : {
10458
+ if (state?.root === void 0) return current == null ? null : current.visibility === "hidden" ? current : {
9789
10459
  ...current,
9790
10460
  visibility: "hidden"
9791
10461
  };
9792
10462
  const interruptedAt = interruption(context);
9793
- const projected = projectBlock(state.root, state, interruptedAt);
10463
+ const projected = projectBlock(!("kind" in state.root) && state.root.phase === "preparing" ? preparingBlock(state.root, current?.data.root) : state.root, state, interruptedAt);
9794
10464
  const anchor = context.start?.event.seq ?? ("kind" in state.root ? state.root.seq : context.matches[0]?.event.seq ?? 0);
9795
10465
  const visibility = !("kind" in projected) && projected.phase === "preparing" && interruptedAt !== void 0 ? "hidden" : "visible";
9796
10466
  const location = contextLocation(context);
@@ -9807,7 +10477,17 @@ window.__ModuleLoader__.load({
9807
10477
  * @param ctx - owning UI Conversation context.
9808
10478
  */
9809
10479
  function registerToolConversationNode(ctx) {
9810
- ctx.uiConversation.events.register(toolDefinition);
10480
+ const match = toolDefinition.match.bind(toolDefinition);
10481
+ ctx.uiConversation.events.register({
10482
+ ...toolDefinition,
10483
+ match: {
10484
+ "assistant/live-chunk": match,
10485
+ "tool/call": match,
10486
+ "tool/result": match,
10487
+ "tool/ptc-dispatch-start": match,
10488
+ "tool/ptc-dispatch": match
10489
+ }
10490
+ });
9811
10491
  }
9812
10492
  //#endregion
9813
10493
  //#region lib/types/client/conversation-nodes/turn-error.js
@@ -10159,7 +10839,21 @@ window.__ModuleLoader__.load({
10159
10839
  * @param ctx - owning UI Conversation context.
10160
10840
  */
10161
10841
  function registerTurnProcess(ctx) {
10162
- ctx.uiConversation.events.register(turnProcessDefinition);
10842
+ const match = turnProcessDefinition.match.bind(turnProcessDefinition);
10843
+ ctx.uiConversation.events.register({
10844
+ ...turnProcessDefinition,
10845
+ match: {
10846
+ "turn/start": match,
10847
+ "assistant/live-chunk": match,
10848
+ "assistant/message": match,
10849
+ "tool/call": match,
10850
+ "tool/result": match,
10851
+ "llm/retry": match,
10852
+ "step/start": match,
10853
+ "step/end": match,
10854
+ "turn/end": match
10855
+ }
10856
+ });
10163
10857
  }
10164
10858
  //#endregion
10165
10859
  //#region ../../llm/llm/lib/types/assistant-stream.js
@@ -10487,7 +11181,23 @@ window.__ModuleLoader__.load({
10487
11181
  * @param ctx - owning UI Conversation context.
10488
11182
  */
10489
11183
  function registerTurnTailConversationNode(ctx) {
10490
- ctx.uiConversation.events.register(turnTailDefinition);
11184
+ const match = turnTailDefinition.match.bind(turnTailDefinition);
11185
+ ctx.uiConversation.events.register({
11186
+ ...turnTailDefinition,
11187
+ match: {
11188
+ "turn/start": match,
11189
+ "turn/end": match,
11190
+ "tool/call": match,
11191
+ "tool/result": match,
11192
+ "assistant/message": match,
11193
+ "assistant/attempt": match,
11194
+ "assistant/live-chunk": match,
11195
+ "step/start": match,
11196
+ "step/end": match,
11197
+ "llm/retry": match,
11198
+ "llm/retry-started": match
11199
+ }
11200
+ });
10491
11201
  }
10492
11202
  //#endregion
10493
11203
  //#region lib/types/client/conversation-nodes/process-activity.js
@@ -10517,6 +11227,7 @@ window.__ModuleLoader__.load({
10517
11227
  return "tools";
10518
11228
  }
10519
11229
  const LIVE_TOOL_DETAIL_MAX_CHARS = 160;
11230
+ const LIVE_TOOL_DETAIL_PREFIX_CHARS = 512;
10520
11231
  const LIVE_TOOL_DETAIL_SEGMENTER = new Intl.Segmenter(void 0, { granularity: "grapheme" });
10521
11232
  const LIVE_TOOL_DETAIL_KEYS = [
10522
11233
  "title",
@@ -10542,10 +11253,46 @@ window.__ModuleLoader__.load({
10542
11253
  "action",
10543
11254
  "status"
10544
11255
  ];
11256
+ function normalizeLiveToolText(text) {
11257
+ const normalized = text.replace(/\s+/g, " ").trim();
11258
+ if (normalized.length <= LIVE_TOOL_DETAIL_MAX_CHARS) return {
11259
+ text: normalized,
11260
+ truncated: false
11261
+ };
11262
+ const chars = [];
11263
+ for (const { segment } of LIVE_TOOL_DETAIL_SEGMENTER.segment(normalized)) {
11264
+ if (chars.length === LIVE_TOOL_DETAIL_MAX_CHARS) return {
11265
+ text: `${chars.slice(0, LIVE_TOOL_DETAIL_MAX_CHARS - 1).join("").trimEnd()}…`,
11266
+ truncated: true
11267
+ };
11268
+ chars.push(segment);
11269
+ }
11270
+ return {
11271
+ text: normalized,
11272
+ truncated: false
11273
+ };
11274
+ }
10545
11275
  function normalizeLiveToolDetail(value) {
10546
- const normalized = (typeof value === "string" ? value : Array.isArray(value) && value.every((item) => typeof item === "string") ? value.join(", ") : "").replace(/\s+/g, " ").trim();
10547
- const chars = Array.from(LIVE_TOOL_DETAIL_SEGMENTER.segment(normalized), (part) => part.segment);
10548
- return chars.length <= LIVE_TOOL_DETAIL_MAX_CHARS ? normalized : `${chars.slice(0, LIVE_TOOL_DETAIL_MAX_CHARS - 1).join("").trimEnd()}…`;
11276
+ return normalizeLiveToolText(typeof value === "string" ? value : Array.isArray(value) && value.every((item) => typeof item === "string") ? value.join(", ") : "").text;
11277
+ }
11278
+ function argumentTextDetail(args, key) {
11279
+ let limit = LIVE_TOOL_DETAIL_PREFIX_CHARS;
11280
+ while (true) {
11281
+ let prefix = args.textPrefix(key, limit);
11282
+ if (prefix === void 0) return void 0;
11283
+ const last = prefix.charCodeAt(prefix.length - 1);
11284
+ if (last >= 55296 && last <= 56319) {
11285
+ const extended = args.textPrefix(key, limit + 1);
11286
+ const next = extended.charCodeAt(prefix.length);
11287
+ if (next >= 56320 && next <= 57343) {
11288
+ prefix = extended;
11289
+ limit++;
11290
+ } else if (extended.length === prefix.length && !args.isSealed && !args.complete(key)) prefix = prefix.slice(0, -1);
11291
+ }
11292
+ const detail = normalizeLiveToolText(prefix);
11293
+ if (detail.truncated || !args.stringExceeds(key, limit)) return detail.text;
11294
+ limit *= 2;
11295
+ }
10549
11296
  }
10550
11297
  function questionDetail(value) {
10551
11298
  if (!Array.isArray(value)) return "";
@@ -10572,20 +11319,19 @@ window.__ModuleLoader__.load({
10572
11319
  }
10573
11320
  return "";
10574
11321
  }
10575
- function liveToolDetail(name, argsRaw) {
10576
- let args;
10577
- try {
10578
- args = JSON.parse(argsRaw);
10579
- } catch (_error) {
10580
- return normalizeLiveToolDetail(name);
10581
- }
10582
- if (args === null || typeof args !== "object") return normalizeLiveToolDetail(name);
10583
- for (const key of LIVE_TOOL_DETAIL_KEYS) if (key in args) {
10584
- const value = Reflect.get(args, key);
10585
- const detail = key === "questions" ? questionDetail(value) : normalizeLiveToolDetail(value);
11322
+ /**
11323
+ * One-line task detail from the argument view, read the same way while the
11324
+ * arguments stream and after dispatch: the first detail key present with text
11325
+ * so far or a closed value. Without one, the tool name stands in once no further
11326
+ * field can arrive; a field still to come is not named early.
11327
+ */
11328
+ function liveToolDetail(name, args) {
11329
+ for (const key of LIVE_TOOL_DETAIL_KEYS) {
11330
+ if (!args.has(key)) continue;
11331
+ const detail = key === "questions" ? questionDetail(args.value(key)) : argumentTextDetail(args, key) ?? normalizeLiveToolDetail(args.value(key));
10586
11332
  if (detail !== "") return detail;
10587
11333
  }
10588
- return normalizeLiveToolDetail(name);
11334
+ return args.closed() ? normalizeLiveToolDetail(name) : "";
10589
11335
  }
10590
11336
  /**
10591
11337
  * Rank categories by distinct call count, breaking ties by first appearance.
@@ -10608,7 +11354,7 @@ window.__ModuleLoader__.load({
10608
11354
  if (isRunningTool(tool) && tool.time >= runningTime) {
10609
11355
  running = kind;
10610
11356
  preparing = tool.phase === "preparing";
10611
- runningDetail = tool.phase === "preparing" ? kind === "tools" ? tool.name : "" : liveToolDetail(tool.name, tool.argsRaw);
11357
+ runningDetail = liveToolDetail(tool.name, tool.args);
10612
11358
  runningTime = tool.time;
10613
11359
  }
10614
11360
  counts.set(kind, (counts.get(kind) ?? 0) + 1);
@@ -12494,13 +13240,23 @@ window.__ModuleLoader__.load({
12494
13240
  }
12495
13241
  })
12496
13242
  }, QuotaNoticeHost));
12497
- ctx.slots.inject("conversation.composer.dock", () => ctx.slots.register({
12498
- name: "conversation.composer.dock",
12499
- id: "stats",
12500
- order: 0,
12501
- locale: NS,
12502
- inject: () => ({ hooks: { performanceUsage } })
12503
- }, StatsPills));
13243
+ const statPillInject = () => ({ hooks: { performanceUsage } });
13244
+ ctx.slots.inject("conversation.composer.dock", function* () {
13245
+ yield ctx.slots.register({
13246
+ name: "conversation.composer.dock",
13247
+ id: "activity",
13248
+ order: 0,
13249
+ locale: NS,
13250
+ inject: statPillInject
13251
+ }, ActivityPill);
13252
+ yield ctx.slots.register({
13253
+ name: "conversation.composer.dock",
13254
+ id: "usage",
13255
+ order: 1,
13256
+ locale: NS,
13257
+ inject: statPillInject
13258
+ }, UsagePill);
13259
+ });
12504
13260
  ctx.slots.inject("conversation.approval.detail", () => ctx.slots.register({ name: "conversation.approval.detail" }, ApprovalCommand));
12505
13261
  }
12506
13262
  //#endregion