MCPcopy
hub / github.com/codeaashu/claude-code / CollapseStatus

Function CollapseStatus

src/components/ContextVisualization.tsx:21–71  ·  view source on GitHub ↗

* One-liner for the legend header showing what context-collapse has done. * Returns null when nothing's summarized/staged so we don't add visual * noise in the common case. This is the one place a user can see that * their context was rewritten — the placeholders are isMeta * and don

()

Source from the content-addressed store, hash-verified

19 * and don't appear in the conversation view.
20 */
21function CollapseStatus() {
22 const $ = _c(2);
23 if (feature("CONTEXT_COLLAPSE")) {
24 let t0;
25 let t1;
26 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
27 t1 = Symbol.for("react.early_return_sentinel");
28 bb0: {
29 const {
30 getStats,
31 isContextCollapseEnabled
32 } = require("../services/contextCollapse/index.js") as typeof import('../services/contextCollapse/index.js');
33 if (!isContextCollapseEnabled()) {
34 t1 = null;
35 break bb0;
36 }
37 const s = getStats();
38 const {
39 health: h
40 } = s;
41 const parts = [];
42 if (s.collapsedSpans > 0) {
43 parts.push(`${s.collapsedSpans} ${plural(s.collapsedSpans, "span")} summarized (${s.collapsedMessages} msgs)`);
44 }
45 if (s.stagedSpans > 0) {
46 parts.push(`${s.stagedSpans} staged`);
47 }
48 const summary = parts.length > 0 ? parts.join(", ") : h.totalSpawns > 0 ? `${h.totalSpawns} ${plural(h.totalSpawns, "spawn")}, nothing staged yet` : "waiting for first trigger";
49 let line2 = null;
50 if (h.totalErrors > 0) {
51 line2 = <Text color="warning">Collapse errors: {h.totalErrors}/{h.totalSpawns} spawns failed{h.lastError ? ` (last: ${h.lastError.slice(0, 60)})` : ""}</Text>;
52 } else {
53 if (h.emptySpawnWarningEmitted) {
54 line2 = <Text color="warning">Collapse idle: {h.totalEmptySpawns} consecutive empty runs</Text>;
55 }
56 }
57 t0 = <><Text dimColor={true}>Context strategy: collapse ({summary})</Text>{line2}</>;
58 }
59 $[0] = t0;
60 $[1] = t1;
61 } else {
62 t0 = $[0];
63 t1 = $[1];
64 }
65 if (t1 !== Symbol.for("react.early_return_sentinel")) {
66 return t1;
67 }
68 return t0;
69 }
70 return null;
71}
72
73// Order for displaying source groups: Project > User > Managed > Plugin > Built-in
74const SOURCE_DISPLAY_ORDER = ['Project', 'User', 'Managed', 'Plugin', 'Built-in'];

Callers

nothing calls this directly

Calls 3

featureFunction · 0.85
pluralFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected