@cortexkit/opencode-magic-context 0.49.84 → 0.49.86

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.
Files changed (107) hide show
  1. package/dist/{announcement-p41dde4h.js → announcement-fnyxaahs.js} +3 -1
  2. package/dist/auto-search-worker.js +3 -3
  3. package/dist/chunk-embedding-write-worker.js +5 -4
  4. package/dist/{context-3sajdysh.js → context-xesm7rj3.js} +27 -26
  5. package/dist/{derive-budgets-0kcek5ex.js → derive-budgets-90869322.js} +3 -1
  6. package/dist/{embedding-backfill-k994xdas.js → embedding-backfill-v6sw58m8.js} +7 -5
  7. package/dist/embedding-worker.js +15 -27
  8. package/dist/features/magic-context/memory/embedding-worker-boundary.test-support.d.ts +24 -0
  9. package/dist/features/magic-context/memory/embedding-worker-boundary.test-support.d.ts.map +1 -0
  10. package/dist/features/magic-context/memory/embedding-worker-client.d.ts +35 -1
  11. package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
  12. package/dist/features/magic-context/memory/embedding-worker-loop.d.ts +57 -0
  13. package/dist/features/magic-context/memory/embedding-worker-loop.d.ts.map +1 -0
  14. package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -1
  15. package/dist/features/magic-context/project-embedding-registry.d.ts +6 -1
  16. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  17. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  18. package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
  19. package/dist/{index-xjfan0za.js → index-022w6314.js} +37 -37
  20. package/dist/{index-tvbkemec.js → index-08jfpny9.js} +1 -1
  21. package/dist/{index-fgy6hnr3.js → index-1bqkqde0.js} +5 -4
  22. package/dist/{index-0wehkw71.js → index-1pf5qrx4.js} +4 -4
  23. package/dist/{index-tqnvn9pa.js → index-25nktq8n.js} +3 -3
  24. package/dist/{index-98qy103c.js → index-2kf73btc.js} +1 -1
  25. package/dist/{index-vpw46557.js → index-3dtzyred.js} +1 -1
  26. package/dist/{index-bd34njzg.js → index-4ntnt8ee.js} +1 -1
  27. package/dist/{index-w2wpx7t5.js → index-4w5rx7de.js} +1 -1
  28. package/dist/{index-xd0ww0ns.js → index-798s7c8s.js} +1 -1
  29. package/dist/{index-fpqdbb67.js → index-7svecf3m.js} +3 -3
  30. package/dist/{v2/server-fvnzcnww.js → index-c5tmzym6.js} +192 -11
  31. package/dist/{index-k0jnsjcp.js → index-d0rtbv0f.js} +6 -6
  32. package/dist/{index-qybp04ff.js → index-e32b3x4n.js} +3 -3
  33. package/dist/{index-cfy5k1pa.js → index-gxdc95cp.js} +5 -5
  34. package/dist/{index-w8dcjt7f.js → index-k0tb2z28.js} +1 -1
  35. package/dist/{index-zb4h9nrk.js → index-k50xhjw1.js} +202 -14
  36. package/dist/{index-szwrpyac.js → index-nny4gm06.js} +1 -1
  37. package/dist/{index-shpyv8gq.js → index-s8ks5nz4.js} +16 -9
  38. package/dist/{index-d028gmgp.js → index-ttk3trse.js} +14 -14
  39. package/dist/{index-skwwbcnv.js → index-w6v4dw5f.js} +24 -24
  40. package/dist/{index-5wjv4c41.js → index-xccywqdj.js} +15 -15
  41. package/dist/{index-kthfyf45.js → index-zmqx48vt.js} +3 -3
  42. package/dist/index.js +33 -33
  43. package/dist/migration-worker.js +4 -3
  44. package/dist/{project-embedding-registry-y3z36mjy.js → project-embedding-registry-q80scexh.js} +6 -4
  45. package/dist/raw-ordinal-warmup-worker.js +2 -2
  46. package/dist/{recomp-orchestrator-m2s3jpvj.js → recomp-orchestrator-7ecg8ryx.js} +16 -15
  47. package/dist/{render-p2j7rn9a.js → render-yqp7q79f.js} +8 -7
  48. package/dist/{search-archive-hz9xh7nh.js → search-archive-r4h96j2z.js} +2 -2
  49. package/dist/{search-ksx0f1qd.js → search-bw22d7zc.js} +12 -10
  50. package/dist/shared/storage-file-mutex.d.ts.map +1 -1
  51. package/dist/shared/storage-permissions.d.ts +5 -3
  52. package/dist/shared/storage-permissions.d.ts.map +1 -1
  53. package/dist/{store-x0swqb5c.js → store-n4yz3n66.js} +2 -2
  54. package/dist/{store-reader-tsv1w4vt.js → store-reader-nf8z86n9.js} +1 -1
  55. package/dist/{transform-postprocess-phase-1wb2rrr1.js → transform-postprocess-phase-t99yj9vt.js} +17 -16
  56. package/dist/v2/auto-search-worker.js +3 -3
  57. package/dist/v2/chunk-embedding-write-worker.js +5 -4
  58. package/dist/v2/{context-at9nje0j.js → context-k8sx1nyy.js} +39 -39
  59. package/dist/v2/{derive-budgets-xbwcap8k.js → derive-budgets-ecjy1aqh.js} +4 -2
  60. package/dist/v2/{embedding-backfill-hjvjxp7d.js → embedding-backfill-k8kqnwfq.js} +7 -5
  61. package/dist/v2/embedding-worker.js +15 -27
  62. package/dist/v2/migration-worker.js +4 -3
  63. package/dist/v2/{project-embedding-registry-mzsvyads.js → project-embedding-registry-2jp1antr.js} +6 -4
  64. package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
  65. package/dist/v2/{recomp-orchestrator-nhef90gc.js → recomp-orchestrator-ssde9ft1.js} +17 -16
  66. package/dist/v2/{render-c9r2g2jv.js → render-fezgh7pa.js} +8 -7
  67. package/dist/v2/{search-archive-80ckv9kq.js → search-archive-zz1kza50.js} +2 -2
  68. package/dist/v2/{search-t06js5dc.js → search-m251amra.js} +11 -9
  69. package/dist/v2/{server-4z964n1c.js → server-3p6b0qya.js} +1 -1
  70. package/dist/v2/{server-3cndh146.js → server-4wwwm2ya.js} +24 -24
  71. package/dist/v2/{server-mr9rqn0y.js → server-97w51d8n.js} +4 -4
  72. package/dist/v2/{server-d706s5xn.js → server-b93f0bqh.js} +205 -17
  73. package/dist/v2/{server-dfesqfv1.js → server-brgandk4.js} +1 -1
  74. package/dist/v2/{server-w1jfaxas.js → server-cwtehwbb.js} +1 -1
  75. package/dist/v2/{server-y4favn4d.js → server-e2k9mt86.js} +1 -1
  76. package/dist/v2/{server-3hhakg5a.js → server-fsw8kbng.js} +13 -13
  77. package/dist/v2/{server-68q80y27.js → server-hn8b7sfe.js} +16 -9
  78. package/dist/v2/{server-pejjj0nv.js → server-mbkwcwgw.js} +1 -1
  79. package/dist/v2/{server-ry6rpspz.js → server-n5zr7190.js} +15 -15
  80. package/dist/v2/{server-210rc0z9.js → server-ps6rz88g.js} +1 -1
  81. package/dist/{index-fvnzcnww.js → v2/server-r2es6zt7.js} +192 -11
  82. package/dist/v2/{server-bt546axy.js → server-rz4snd3x.js} +3 -3
  83. package/dist/v2/{server-863bwkga.js → server-ssg29wjg.js} +6 -6
  84. package/dist/v2/{server-hhw6rzsn.js → server-w7mpvkpj.js} +1 -1
  85. package/dist/v2/{server-sy98vksf.js → server-xa8fefhw.js} +3 -3
  86. package/dist/v2/{server-gx1s06dx.js → server-y31y6gws.js} +5 -4
  87. package/dist/v2/{server-cce6m31c.js → server-ytqps2xa.js} +1 -1
  88. package/dist/v2/server.js +6 -4
  89. package/dist/v2/{store-reader-paamf0ac.js → store-reader-2vhx33n6.js} +1 -1
  90. package/dist/v2/{store-h3s95ywe.js → store-y56y034s.js} +2 -2
  91. package/dist/v2/{v2-archive-reader-1zzteaa5.js → v2-archive-reader-e2w39c3p.js} +1 -1
  92. package/dist/v2/{wrapup-orchestrator-9y98qcqz.js → wrapup-orchestrator-eg5b1p89.js} +16 -15
  93. package/dist/{v2-archive-reader-3yjxaj5z.js → v2-archive-reader-8dsngf2j.js} +1 -1
  94. package/dist/{wrapup-orchestrator-sa3a075a.js → wrapup-orchestrator-nmk6yf7f.js} +17 -16
  95. package/package.json +1 -1
  96. package/src/shared/storage-file-mutex-review.test.ts +125 -2
  97. package/src/shared/storage-file-mutex.ts +17 -8
  98. package/src/shared/storage-permissions-creators.test.ts +194 -0
  99. package/src/shared/storage-permissions-startup.test.ts +476 -0
  100. package/src/shared/storage-permissions.ts +227 -12
  101. package/src/tui/compaction-off.ts +2 -2
  102. package/src/tui/slots/sidebar-content-render.test.ts +309 -0
  103. package/src/tui/slots/sidebar-content.tsx +134 -99
  104. package/src/tui-compiled/compaction-off.ts +2 -2
  105. package/src/tui-compiled/slots/sidebar-content.tsx +321 -247
  106. /package/dist/{index-rdh63md0.js → index-1y4y98r1.js} +0 -0
  107. /package/dist/v2/{server-9nk5h6w6.js → server-qyazxy92.js} +0 -0
@@ -161,7 +161,7 @@ interface TokenSegment {
161
161
  // Segmented token breakdown bar with legend
162
162
  const TokenBreakdown = (props: {
163
163
  theme: TuiThemeCurrent
164
- snapshot: SidebarSnapshot
164
+ snapshot: SidebarSnapshot | null
165
165
  // Collapsed mode renders only the proportional bar (no per-category legend
166
166
  // rows) so the sidebar shrinks to the progress bar + a few summary lines.
167
167
  collapsed?: boolean
@@ -175,8 +175,8 @@ const TokenBreakdown = (props: {
175
175
  // space on the right on wide sidebars.
176
176
  const segments = createMemo<TokenSegment[]>(() => {
177
177
  const s = props.snapshot
178
- const total = s.inputTokens || 1
179
178
  const result: TokenSegment[] = []
179
+ if (!s) return result
180
180
 
181
181
  // System Prompt (purple)
182
182
  if (s.systemPromptTokens > 0) {
@@ -250,12 +250,14 @@ const TokenBreakdown = (props: {
250
250
  // segment is also skipped in the bar at 0 width because the segment
251
251
  // builder uses `Math.max(1, ...)` only when tokens > 0 (see
252
252
  // segmentWidths), so the visual bar stays correct either way.
253
- result.push({
254
- key: "conv",
255
- tokens: s.conversationTokens,
256
- color: COLORS.conversation,
253
+ if (s.conversationTokens != null) {
254
+ result.push({
255
+ key: "conv",
256
+ tokens: s.conversationTokens,
257
+ color: COLORS.conversation,
257
258
  label: "Conversation",
258
- })
259
+ })
260
+ }
259
261
 
260
262
  // Tool Calls = tool_use/tool_result/tool/tool-invocation parts in messages
261
263
  // (actionable — users can reduce via ctx_reduce)
@@ -284,7 +286,7 @@ const TokenBreakdown = (props: {
284
286
  return result
285
287
  })
286
288
 
287
- const totalTokens = createMemo(() => props.snapshot.inputTokens || 1)
289
+ const totalTokens = createMemo(() => props.snapshot?.inputTokens || 1)
288
290
 
289
291
  // Render-time segments for the bar. Zero-token segments are filtered out
290
292
  // entirely (no flex weight, no rendered box) so they don't claim any
@@ -739,6 +741,51 @@ const SidebarContent = (props: {
739
741
 
740
742
  const s = createMemo(() => snapshot())
741
743
  const compactionOff = () => s()?.compaction_enabled === false
744
+ const nativeRows = createMemo(() => {
745
+ const current = s()
746
+ return current?.compaction_enabled === false ? compactionOffSidebarRows(current) : []
747
+ })
748
+ const dreamerLabel = createMemo(() => {
749
+ const progress = s()?.dreamerProgress
750
+ if (!progress) return
751
+ return `Dreamer ${progress.task}: ${progress.processed}/${progress.total} processed`
752
+ })
753
+ const contextSummary = createMemo(() => {
754
+ const current = s()
755
+ if (!current || !(current.inputTokens > 0 && current.contextLimit > 0)) return
756
+ const tokens = `${compactTokens(current.inputTokens)} / ${compactTokens(current.contextLimit)}`
757
+ if (current.compaction_enabled === false) {
758
+ return { tokens, native: nativeCompactionContextLabel(current) }
759
+ }
760
+ const usage = current.usagePercentage?.toFixed(1)
761
+ const threshold = current.executeThreshold == null
762
+ ? undefined
763
+ : `${formatThresholdPercent(current.executeThreshold)}%${current.executeThresholdClamped ? "*" : ""}`
764
+ return { tokens, usage, threshold }
765
+ }, undefined, {
766
+ equals: (a, b) =>
767
+ a?.tokens === b?.tokens && a?.native === b?.native &&
768
+ a?.usage === b?.usage && a?.threshold === b?.threshold,
769
+ })
770
+ const hygieneSummary = createMemo(() => {
771
+ const current = s()
772
+ if (!current || !(current.inputTokens > 0)) return
773
+ const hygiene = current.tailHygiene
774
+ if (!hygiene) return
775
+ return { value: hygieneValue(hygiene), warning: !hygiene.evaluable }
776
+ }, undefined, {
777
+ equals: (a, b) => a?.value === b?.value && a?.warning === b?.warning,
778
+ })
779
+ const totalInputTokensLabel = () => {
780
+ const tokens = s()?.totalInputTokens
781
+ return tokens == null ? undefined : compactTokens(tokens)
782
+ }
783
+ const collapsedMemoryValue = () => {
784
+ const current = s()
785
+ const count = current?.memoryCount ?? 0
786
+ const injected = current?.memoryBlockCount ?? 0
787
+ return injected > 0 ? `${injected}/${count}` : String(count)
788
+ }
742
789
  const contextSummaryColor = createMemo(() => {
743
790
  if (compactionOff()) return props.theme.accent
744
791
  const usage = s()?.usagePercentage ?? 0
@@ -778,11 +825,13 @@ const SidebarContent = (props: {
778
825
  {/* The fence probe writes the failure into the server-owned snapshot,
779
826
  so this survives sidebar refreshes and is visible independently of
780
827
  the one-shot toast. */}
781
- {s()?.lastTransformError && (
782
- <box marginTop={1} width="100%">
783
- <text fg={props.theme.error}>⚠ {s()!.lastTransformError}</text>
784
- </box>
785
- )}
828
+ <Show keyed when={s()?.lastTransformError}>
829
+ {(error) => (
830
+ <box marginTop={1} width="100%">
831
+ <text fg={props.theme.error}>⚠ {error}</text>
832
+ </box>
833
+ )}
834
+ </Show>
786
835
 
787
836
  {s()?.projectBindingWarning && (
788
837
  <box marginTop={1} width="100%">
@@ -802,47 +851,51 @@ const SidebarContent = (props: {
802
851
  )}
803
852
  </For>
804
853
 
805
- {s()?.dreamerProgress && (
806
- <box marginTop={1} width="100%">
807
- <text fg={props.theme.warning}>
808
- Dreamer {s()!.dreamerProgress!.task}: {s()!.dreamerProgress!.processed}/{s()!.dreamerProgress!.total} processed
809
- </text>
810
- </box>
811
- )}
854
+ <Show keyed when={dreamerLabel()}>
855
+ {(label) => (
856
+ <box marginTop={1} width="100%">
857
+ <text fg={props.theme.warning}>{label}</text>
858
+ </box>
859
+ )}
860
+ </Show>
812
861
 
813
862
  {/* Token breakdown bar. In collapsed mode the header, bar and the
814
863
  3 summary rows stack with no vertical padding for a compact look;
815
864
  expanded mode keeps the 1-row gap above the bar. */}
816
- {s() && s()!.inputTokens > 0 && (
865
+ {(s()?.inputTokens ?? 0) > 0 && (
817
866
  <box marginTop={collapsed() ? 0 : 1} flexDirection="column">
818
- {(s()?.contextLimit ?? 0) > 0 && (
819
- <box width="100%" flexDirection="row" justifyContent="space-between">
820
- {compactionOff() ? (
821
- <text fg={contextSummaryColor()}>
822
- <b>{nativeCompactionContextLabel(s()!)}</b>
823
- </text>
824
- ) : (
825
- <text fg={contextSummaryColor()}>
826
- <b>{s()!.usagePercentage.toFixed(1)}%</b> / {formatThresholdPercent(s()!.executeThreshold)}%{s()!.executeThresholdClamped ? "*" : ""}
827
- </text>
828
- )}
829
- {/* Right: absolute token usage against the usable
830
- scheduler window — the same denominator as the
831
- percentage and nudge/trigger scheduling. */}
832
- <text fg={contextSummaryColor()}>
833
- {compactTokens(s()!.inputTokens)} / {compactTokens(s()!.contextLimit)}
834
- </text>
835
- </box>
836
- )}
837
- <TokenBreakdown theme={props.theme} snapshot={s()!} collapsed={collapsed()} />
838
- {s()!.tailHygiene !== undefined && (
839
- <StatRow
840
- theme={props.theme}
841
- label="Hygiene"
842
- value={hygieneValue(s()!.tailHygiene!)}
843
- warning={!s()!.tailHygiene!.evaluable}
844
- />
845
- )}
867
+ <Show keyed when={contextSummary()}>
868
+ {(summary) => (
869
+ <box width="100%" flexDirection="row" justifyContent="space-between">
870
+ {summary.native != null ? (
871
+ <text fg={contextSummaryColor()}>
872
+ <b>{summary.native}</b>
873
+ </text>
874
+ ) : (
875
+ <text fg={contextSummaryColor()}>
876
+ {summary.usage != null && <b>{summary.usage}%</b>}
877
+ {summary.usage != null && summary.threshold != null ? " / " : ""}
878
+ {summary.threshold ?? ""}
879
+ </text>
880
+ )}
881
+ {/* Right: absolute token usage against the usable
882
+ scheduler window — the same denominator as the
883
+ percentage and nudge/trigger scheduling. */}
884
+ <text fg={contextSummaryColor()}>{summary.tokens}</text>
885
+ </box>
886
+ )}
887
+ </Show>
888
+ <TokenBreakdown theme={props.theme} snapshot={s()} collapsed={collapsed()} />
889
+ <Show keyed when={hygieneSummary()}>
890
+ {(hygiene) => (
891
+ <StatRow
892
+ theme={props.theme}
893
+ label="Hygiene"
894
+ value={hygiene.value}
895
+ warning={hygiene.warning}
896
+ />
897
+ )}
898
+ </Show>
846
899
  </box>
847
900
  )}
848
901
 
@@ -852,7 +905,7 @@ const SidebarContent = (props: {
852
905
  {collapsed() && (
853
906
  <box width="100%" flexDirection="column">
854
907
  {compactionOff() ? (
855
- compactionOffSidebarRows(s()!).map((row) => (
908
+ nativeRows().map((row) => (
856
909
  <StatRow
857
910
  theme={props.theme}
858
911
  label={row.label}
@@ -883,11 +936,7 @@ const SidebarContent = (props: {
883
936
  </Show>
884
937
  <box width="100%" flexDirection="row" justifyContent="space-between">
885
938
  <text fg={props.theme.textMuted}>Memories</text>
886
- <text fg={props.theme.textMuted}>
887
- {(s()?.memoryBlockCount ?? 0) > 0
888
- ? `${s()!.memoryBlockCount}/${s()?.memoryCount ?? 0}`
889
- : String(s()?.memoryCount ?? 0)}
890
- </text>
939
+ <text fg={props.theme.textMuted}>{collapsedMemoryValue()}</text>
891
940
  </box>
892
941
  <box width="100%" flexDirection="row" justifyContent="space-between">
893
942
  <text fg={props.theme.textMuted}>Status</text>
@@ -941,7 +990,7 @@ const SidebarContent = (props: {
941
990
  <>
942
991
  <SectionHeader theme={props.theme} title="Memory" />
943
992
  {compactionOff() ? (
944
- compactionOffSidebarRows(s()!)
993
+ nativeRows()
945
994
  .filter((row) => row.label === "Memories")
946
995
  .map((row) => (
947
996
  <StatRow theme={props.theme} label={row.label} value={row.value} accent />
@@ -954,14 +1003,11 @@ const SidebarContent = (props: {
954
1003
  value={String(s()?.memoryCount ?? 0)}
955
1004
  accent
956
1005
  />
957
- {(s()?.memoryBlockCount ?? 0) > 0 && (
958
- <StatRow
959
- theme={props.theme}
960
- label="Injected"
961
- value={String(s()!.memoryBlockCount)}
962
- dim
963
- />
964
- )}
1006
+ <Show keyed when={(s()?.memoryBlockCount ?? 0) > 0 && s()?.memoryBlockCount}>
1007
+ {(count) => (
1008
+ <StatRow theme={props.theme} label="Injected" value={String(count)} dim />
1009
+ )}
1010
+ </Show>
965
1011
  </>
966
1012
  )}
967
1013
  </>
@@ -976,7 +1022,7 @@ const SidebarContent = (props: {
976
1022
  <>
977
1023
  <SectionHeader theme={props.theme} title="Status" />
978
1024
  {compactionOff() ? (
979
- compactionOffSidebarRows(s()!)
1025
+ nativeRows()
980
1026
  .filter((row) => row.label !== "Memories")
981
1027
  .map((row) => (
982
1028
  <StatRow
@@ -988,29 +1034,21 @@ const SidebarContent = (props: {
988
1034
  ))
989
1035
  ) : (
990
1036
  <>
991
- {(s()?.pendingOpsCount ?? 0) > 0 && (
992
- <StatRow
993
- theme={props.theme}
994
- label="Queue"
995
- value={`${s()!.pendingOpsCount} pending`}
996
- warning
997
- />
998
- )}
999
- {(s()?.sessionNoteCount ?? 0) > 0 && (
1000
- <StatRow
1001
- theme={props.theme}
1002
- label="Notes"
1003
- value={String(s()!.sessionNoteCount)}
1004
- />
1005
- )}
1006
- {(s()?.readySmartNoteCount ?? 0) > 0 && (
1007
- <StatRow
1008
- theme={props.theme}
1009
- label="Smart Notes"
1010
- value={`${s()!.readySmartNoteCount} ready`}
1011
- accent
1012
- />
1013
- )}
1037
+ <Show keyed when={(s()?.pendingOpsCount ?? 0) > 0 && s()?.pendingOpsCount}>
1038
+ {(count) => (
1039
+ <StatRow theme={props.theme} label="Queue" value={`${count} pending`} warning />
1040
+ )}
1041
+ </Show>
1042
+ <Show keyed when={(s()?.sessionNoteCount ?? 0) > 0 && s()?.sessionNoteCount}>
1043
+ {(count) => (
1044
+ <StatRow theme={props.theme} label="Notes" value={String(count)} />
1045
+ )}
1046
+ </Show>
1047
+ <Show keyed when={(s()?.readySmartNoteCount ?? 0) > 0 && s()?.readySmartNoteCount}>
1048
+ {(count) => (
1049
+ <StatRow theme={props.theme} label="Smart Notes" value={`${count} ready`} accent />
1050
+ )}
1051
+ </Show>
1014
1052
  </>
1015
1053
  )}
1016
1054
  </>
@@ -1059,17 +1097,14 @@ const SidebarContent = (props: {
1059
1097
  snapshot fields (newWorkTokens, totalInputTokens) and the
1060
1098
  session_meta columns are still populated; only the UI is
1061
1099
  simplified for now. */}
1062
- {sections().stats && s()?.totalInputTokens != null && (
1063
- <>
1064
- <SectionHeader theme={props.theme} title="Stats" />
1065
- <StatRow
1066
- theme={props.theme}
1067
- label="Total tokens"
1068
- value={compactTokens(s()!.totalInputTokens ?? 0)}
1069
- dim
1070
- />
1071
- </>
1072
- )}
1100
+ <Show keyed when={sections().stats && totalInputTokensLabel()}>
1101
+ {(total) => (
1102
+ <>
1103
+ <SectionHeader theme={props.theme} title="Stats" />
1104
+ <StatRow theme={props.theme} label="Total tokens" value={total} dim />
1105
+ </>
1106
+ )}
1107
+ </Show>
1073
1108
  </>
1074
1109
  )}
1075
1110
  </box>
@@ -18,8 +18,8 @@ export function nativeCompactionContextLabel(snapshot: SidebarSnapshot): string
18
18
 
19
19
  export function compactionOffSidebarRows(snapshot: SidebarSnapshot): CompactionOffSidebarRow[] {
20
20
  const rows: CompactionOffSidebarRow[] = [
21
- { label: "Memories", value: String(snapshot.memoryCount) },
22
- { label: "Notes", value: String(snapshot.sessionNoteCount) },
21
+ { label: "Memories", value: String(snapshot.memoryCount ?? "") },
22
+ { label: "Notes", value: String(snapshot.sessionNoteCount ?? "") },
23
23
  ];
24
24
  const archivedCount = snapshot.archivedCompartmentCount ?? 0;
25
25
  if (archivedCount > 0) {