cctally 1.43.0 → 1.43.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/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.43.1] - 2026-06-13
9
+
10
+ ### Fixed
11
+ - Conversation viewer: harness-injected user-role lines — compaction summaries, background task/Bash completion notifications, remote-control "Message sent at …" stamps, and `!`-mode bash echoes — are no longer rendered as your own messages; they now show as labeled system/notification pills (compaction expandable), and a remote-control reply shows just your text. Already-recorded history is corrected at read time with no migration. (#191)
12
+
8
13
  ## [1.43.0] - 2026-06-13
9
14
 
10
15
  ### Fixed
@@ -112,6 +112,64 @@ def _strip_ansi(text):
112
112
  return _ANSI_RE.sub("", text) if text else text
113
113
 
114
114
 
115
+ # ---- #191: harness-injected user-line discriminators (shared with the query
116
+ # kernel via re-export). All key on a SELF-IDENTIFYING body shape so the
117
+ # read-time recovery half can rescue already-ingested `human` rows. ----
118
+
119
+ # Compaction summary preamble. The ingest authority is the `isCompactSummary`
120
+ # JSONL flag (see _normalize); this body match is the read-time meta_kind label
121
+ # authority (and rescues the rare legacy sentinel-without-flag row).
122
+ _COMPACT_SENTINEL = "This session is being continued from a previous conversation"
123
+
124
+
125
+ def _is_compaction_body(text) -> bool:
126
+ """True iff `text` is a compaction-summary body."""
127
+ return bool(text) and text.lstrip().startswith(_COMPACT_SENTINEL)
128
+
129
+
130
+ # Full open+close-tag wrapper (NOT a bare startswith — Codex P1a): a real prompt
131
+ # that merely begins with the literal tag but isn't a well-formed closed block
132
+ # stays human. Unrolled-lazy body = linear time; \1 backref forces the close tag
133
+ # to match the open. A trailing harness line after the close tag is allowed.
134
+ _NOTIFICATION_RE = re.compile(
135
+ r"\s*<(task|bash)-notification>(?:(?!</\1-notification>)[\s\S])*</\1-notification>")
136
+
137
+
138
+ def _is_notification_body(text) -> bool:
139
+ """True iff `text` opens with a complete <task-notification>…</task-notification>
140
+ or <bash-notification>…</bash-notification> background-completion wrapper."""
141
+ return bool(text) and _NOTIFICATION_RE.match(text) is not None
142
+
143
+
144
+ # `!`-mode local shell echoes. A DEDICATED detector, NOT a `_MARKER_TAGS` entry
145
+ # (Codex P1b) — so a bash echo containing a literal <command-args> can never
146
+ # reach the #188 `_extract_command_invocation` promotion path.
147
+ _BASH_ECHO_RE = re.compile(
148
+ r"\s*<(bash-input|bash-stdout|bash-stderr)>(?:(?!</\1>)[\s\S])*</\1>")
149
+
150
+
151
+ def _is_bash_echo_body(text) -> bool:
152
+ """True iff `text` opens with a complete <bash-input>/<bash-stdout>/
153
+ <bash-stderr> echo wrapper."""
154
+ return bool(text) and _BASH_ECHO_RE.match(text) is not None
155
+
156
+
157
+ # Remote-control replies (sent from the Claude mobile/remote app) arrive as a
158
+ # real user turn prefixed with a `Message sent at <ts> UTC.` system-reminder
159
+ # stamp. NARROW (Codex / approved decision): only this exact leading shape is
160
+ # stripped; no other <system-reminder> is touched.
161
+ _REMOTE_CONTROL_RE = re.compile(
162
+ r"\A\s*<system-reminder>Message sent at [^<]*UTC\.</system-reminder>\s*")
163
+
164
+
165
+ def _strip_remote_control_prefix(text):
166
+ """Remove a leading remote-control `Message sent at … UTC.` system-reminder
167
+ block, returning the real user reply. No-op when absent; None/'' pass through."""
168
+ if not text:
169
+ return text
170
+ return _REMOTE_CONTROL_RE.sub("", text, count=1)
171
+
172
+
115
173
  _TOOL_RESULT_CAP = 16000 # was 4000; full text always re-derivable from JSONL
116
174
  _INPUT_LEAF_CAP = 8000 # max chars per string leaf in a bounded tool input
117
175
  _INPUT_TOTAL_CAP = 32000 # honesty backstop on the serialized bounded input
@@ -239,6 +297,19 @@ def _normalize(obj, t, offset):
239
297
  # tool_result block still folds as a result.
240
298
  entry_type = META
241
299
  text = ""
300
+ elif obj.get("isCompactSummary"):
301
+ # #191: compaction summary injected as a user line — authoritative flag.
302
+ entry_type = META
303
+ text = ""
304
+ elif _is_notification_body(text):
305
+ # #191: <task-notification>/<bash-notification> background completion.
306
+ entry_type = META
307
+ text = ""
308
+ elif _is_bash_echo_body(text):
309
+ # #191: <bash-input>/<bash-stdout>/<bash-stderr> `!`-mode echo. Dedicated
310
+ # branch (NOT _MARKER_TAGS) so it can't reach the #188 promotion path.
311
+ entry_type = META
312
+ text = ""
242
313
  elif (blocks and all(b["kind"] == "text" for b in blocks)
243
314
  and (_inv := _extract_command_invocation(blocks, text)) is not None):
244
315
  # #188: a slash-command invocation carrying a real user prompt in
@@ -267,7 +338,10 @@ def _normalize(obj, t, offset):
267
338
  entry_type = META
268
339
  text = ""
269
340
  else:
341
+ # #191: a leading remote-control `Message sent at … UTC.` system-reminder
342
+ # stamp is stripped from the real user reply (narrow). No-op when absent.
270
343
  entry_type = HUMAN
344
+ text = _strip_remote_control_prefix(text)
271
345
  is_asst = t == "assistant"
272
346
  # #177 S6: derive the split search columns on the FINAL post-augment blocks
273
347
  # (every _attach_* pass above has already merged bash_stderr / answers /
@@ -43,6 +43,12 @@ from _lib_conversation import _extract_command_invocation
43
43
  # re-ingest). Scoped to prose/thinking/title/label — NEVER tool_result (Bash
44
44
  # AnsiText boundary). Shares the parser's regex so ingest and read-time agree.
45
45
  from _lib_conversation import _strip_ansi
46
+ # #191: harness-injected user-line discriminators — defined in the parser,
47
+ # re-exported here so ingest and read-time recovery share one classification.
48
+ from _lib_conversation import (
49
+ _is_compaction_body, _is_notification_body, _is_bash_echo_body,
50
+ _strip_remote_control_prefix,
51
+ )
46
52
 
47
53
 
48
54
  _TITLE_MAX = 120
@@ -144,6 +150,12 @@ def _meta_classify(item, allow_human_fallback):
144
150
  all_text = all(b.get("kind") == "text" for b in (item.get("blocks") or []))
145
151
  if _is_system_marker(body) and (is_meta or all_text):
146
152
  return ("command", None, body)
153
+ if all_text and _is_compaction_body(body):
154
+ return ("compaction", None, body) # #191
155
+ if all_text and _is_notification_body(body):
156
+ return ("notification", None, body) # #191
157
+ if all_text and _is_bash_echo_body(body):
158
+ return ("command", None, body) # #191 (#5 -> System-marker pill)
147
159
  if not is_meta:
148
160
  return None
149
161
  return ("context", None, body)
@@ -209,9 +221,12 @@ def _session_titles_map(conn, session_ids):
209
221
  continue # already resolved to the first non-marker
210
222
  if _is_system_marker(text) or _looks_like_command_plumbing(text):
211
223
  continue
224
+ if (_is_compaction_body(text) or _is_notification_body(text)
225
+ or _is_bash_echo_body(text)): # #191: never a title
226
+ continue
212
227
  if skip_skill_titles and _first_nonblank_line(text).startswith(_SKILL_PREAMBLE):
213
228
  continue
214
- t = _title_from_text(text)
229
+ t = _title_from_text(_strip_remote_control_prefix(text)) # #191: strip the stamp
215
230
  if t:
216
231
  titles[sid] = t
217
232
  return titles
@@ -676,6 +691,13 @@ def _assemble_session(conn, session_id):
676
691
  it["skill_name"] = skill_name
677
692
  it["text"] = body
678
693
 
694
+ # #191: strip a leading remote-control `Message sent at … UTC.` stamp from any
695
+ # turn that remains a genuine human reply. Shared assembly -> covers BOTH the
696
+ # reader and the outline. No-op on #188-promoted command turns (no stamp).
697
+ for it in items:
698
+ if it["kind"] == "human" and it.get("text"):
699
+ it["text"] = _strip_remote_control_prefix(it["text"])
700
+
679
701
  # ---- Phase 4b: fold a Skill-invoked skill body into its Skill tool chip ----
680
702
  # A Skill invocation's injected body (now meta_kind='skill') links to its
681
703
  # Skill tool_use via source_tool_use_id (threaded as the internal
@@ -62,7 +62,7 @@ Error generating stack: `+e.message+`
62
62
 
63
63
  `)},`t${r.length}`)),a=[])};for(;i<e.length;){let s=e[i];if(s.kind===`text`){a.push(s.text),i++;continue}if(o(),s.kind===`tool_call`){let t=[];for(;i<e.length&&e[i].kind===`tool_call`;)t.push(e[i]),i++;n||r.push((0,U.jsx)(yC,{calls:t},`r${r.length}`));continue}if(n&&(s.kind===`tool_use`||s.kind===`tool_result`)){i++;continue}r.push((0,U.jsx)(CC,{block:s,anchorUuid:t},`c${r.length}`)),i++}return o(),r.length===0?null:(0,U.jsx)(`div`,{className:`conv-blocks`,children:r})}function yC({calls:e}){return _C(e)?(0,U.jsx)(`div`,{className:`conv-toolrun`,children:(0,U.jsx)(mC,{call:e[0]})}):(0,U.jsxs)(`div`,{className:`conv-toolrun`,children:[e.length>=2&&(0,U.jsxs)(`div`,{className:`conv-toolrun-head`,children:[`tool run · `,e.length,` actions`]}),e.map((e,t)=>(0,U.jsx)(xC,{call:e},t))]})}function bC({result:e,name:t,preview:n}){let r=t===`Read`&&!e.is_error?Px(`Read`,n):``;return r?(0,U.jsx)(jx,{code:e.text,lang:r}):(0,U.jsx)(`pre`,{className:`conv-code conv-code--result`,children:e.text})}function xC({call:e}){if(e.skill_body!=null)return(0,U.jsxs)(`details`,{className:`conv-chip conv-chip--tool conv-chip--skill`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),vx(e.name),` `,(0,U.jsx)(hC,{name:e.name}),(0,U.jsx)(`span`,{className:`conv-chip-preview`,children:e.preview})]}),(0,U.jsxs)(`div`,{className:`conv-chip-body`,children:[(0,U.jsx)(yx,{text:e.skill_body}),(0,U.jsx)(kx,{children:e.skill_body})]})]});let t=pC(e);if(t)return t;let n=e.result?.is_error?` · error`:e.result?.truncated?` · truncated`:``;return(0,U.jsxs)(`details`,{className:`conv-chip conv-chip--tool`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),vx(e.name),` `,(0,U.jsx)(hC,{name:e.name}),(0,U.jsx)(`span`,{className:`conv-chip-preview`,children:e.preview}),n&&(0,U.jsx)(`span`,{className:`conv-chip-status`,children:n})]}),(0,U.jsxs)(`div`,{className:`conv-chip-body conv-chip-body--io`,children:[(0,U.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,U.jsx)(`div`,{className:`conv-tool-io-label`,children:`request`}),(0,U.jsx)(yx,{text:e.input_summary}),(0,U.jsx)(`pre`,{className:`conv-code conv-code--hl`,children:Sx(e.input_summary,`json`)})]}),e.result?(0,U.jsxs)(`div`,{className:`conv-tool-io`,children:[(0,U.jsxs)(`div`,{className:`conv-tool-io-label`,children:[`result`,e.result.is_error?` · error`:` · ok`,e.result.truncated?` · truncated`:``]}),(0,U.jsx)(yx,{text:e.result.text}),(0,U.jsx)(bC,{result:e.result,name:e.name,preview:e.preview}),e.result.media?.map(t=>(0,U.jsx)(XS,{media:t,toolUseId:e.tool_use_id,context:e.name??`tool`},t.index))]}):(0,U.jsx)(`div`,{className:`conv-tool-io`,children:(0,U.jsx)(`div`,{className:`conv-tool-io-label conv-tool-io-label--none`,children:`no result`})})]})]})}function SC(e){let t=e.split(`
64
64
  `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>80?`${t.slice(0,80).trimEnd()}…`:t}function CC({block:e,anchorUuid:t}){switch(e.kind){case`thinking`:return(0,U.jsxs)(`details`,{className:`conv-chip conv-chip--thinking`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,U.jsx)(Ub,{}),` `,(0,U.jsx)(`span`,{className:`conv-chip-name`,children:`Thinking`}),(0,U.jsx)(`span`,{className:`conv-chip-preview`,children:SC(e.text)})]}),(0,U.jsx)(`div`,{className:`conv-chip-body`,children:(0,U.jsx)(kx,{children:e.text})})]});case`tool_use`:return(0,U.jsxs)(`details`,{className:`conv-chip conv-chip--tool`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),vx(e.name),` `,(0,U.jsx)(hC,{name:e.name})]}),(0,U.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,U.jsx)(yx,{text:e.input_summary}),(0,U.jsx)(`pre`,{className:`conv-code`,children:e.input_summary})]})]});case`tool_result`:return(0,U.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,U.jsx)($b,{}),` `,(0,U.jsx)(`span`,{className:`conv-chip-name`,children:`Result`}),(0,U.jsx)(`span`,{className:`conv-chip-preview`,children:SC(e.text)}),e.is_error&&(0,U.jsx)(`span`,{className:`conv-chip-status`,children:` · error`}),e.truncated&&(0,U.jsx)(`span`,{className:`conv-chip-status`,children:` · truncated`})]}),(0,U.jsxs)(`div`,{className:`conv-chip-body conv-tool-io`,children:[(0,U.jsx)(yx,{text:e.text}),(0,U.jsx)(`pre`,{className:`conv-code`,children:e.text}),e.media?.map(t=>(0,U.jsx)(XS,{media:t,toolUseId:e.tool_use_id,context:`tool result`},t.index))]})]});case`image`:case`document`:return(0,U.jsx)(XS,{media:{kind:e.kind,media_type:e.media_type,bytes:e.bytes,index:e.index??-1},uuid:t,context:`attached`});case`tool_reference`:return(0,U.jsxs)(`span`,{className:`conv-chip conv-chip--ref`,children:[(0,U.jsx)(ex,{}),` `,e.name??`tool`]});default:return null}}var wC=`#/conversations`;function TC(e){let t=e.startsWith(`#`)?e.slice(1):e;if(t===``||t===`/`)return null;if(t===`/conversations`||t===`/conversations/`)return{sessionId:null,turnUuid:null};if(!t.startsWith(`/conversations/`))return null;let n=t.slice(15).split(`/`).filter(e=>e.length>0);return n.length===1?{sessionId:decodeURIComponent(n[0]),turnUuid:null}:n.length===2?{sessionId:decodeURIComponent(n[0]),turnUuid:decodeURIComponent(n[1])}:null}function EC(e,t){if(e===null)return wC;let n=encodeURIComponent(e);return t?`${wC}/${n}/${encodeURIComponent(t)}`:`${wC}/${n}`}function DC(e,t,n,r){return`${e}${t}${EC(n,r)}`}function OC(e,t){return e===`dashboard`?``:EC(t)}function kC(e,t){if(e===window.location.hash)return;let n=e===``?window.location.pathname+window.location.search:e;t===`push`?window.history.pushState(null,``,n):window.history.replaceState(null,``,n)}function AC(e,t){kC(EC(e,t),`replace`)}function jC(e){let t=TC(window.location.hash);if(t===null){e.dispatch({type:`SET_VIEW`,view:`dashboard`});return}if(t.sessionId===null){e.dispatch({type:`SET_VIEW`,view:`conversations`}),e.dispatch({type:`SELECT_CONVERSATION`,sessionId:null});return}let n=t.turnUuid?{session_id:t.sessionId,uuid:t.turnUuid}:void 0;e.dispatch({type:`OPEN_CONVERSATION`,sessionId:t.sessionId,jump:n})}function MC(e={getState:B,subscribeStore:V,dispatch:H}){jC(e);let t=()=>{let t=e.getState();return{view:t.view,sid:t.selectedConversationId,jumpUuid:t.conversationJump?.uuid??null}},n=t(),r=()=>jC(e);window.addEventListener(`hashchange`,r);let i=e.subscribeStore(()=>{let r=e.getState(),i=t(),a=r.conversationJump?.session_id===i.sid;if(i.view!==n.view||i.sid!==n.sid){let e=OC(i.view,i.sid);i.view===`conversations`&&i.sid&&i.jumpUuid&&a&&(e=EC(i.sid,i.jumpUuid)),kC(e,`push`)}else i.sid&&i.sid===n.sid&&i.jumpUuid&&i.jumpUuid!==n.jumpUuid&&a&&kC(EC(i.sid,i.jumpUuid),`replace`);n=i});return()=>{window.removeEventListener(`hashchange`,r),i()}}function NC({sessionId:e,uuid:t,className:n}){let{copied:r,copy:i}=Rb();return(0,U.jsx)(`button`,{type:`button`,className:`conv-copy-btn ${n??``}`.trim(),"aria-label":r?`Link copied`:`Copy link to this turn`,onClick:n=>{n.stopPropagation(),i(DC(window.location.origin,window.location.pathname,e,t)),AC(e,t)},children:r?(0,U.jsx)(ix,{}):(0,U.jsx)(ax,{})})}function PC(e){let t=e.split(`
65
- `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>80?`${t.slice(0,80).trimEnd()}…`:t}function FC({item:e,className:t=``,style:n},r){let i=e=>`conv-item ${e}${t?` ${t}`:``}`,a=tS(),o=e.ts?A.timeHHmm(e.ts,a,{noSuffix:!0}):null,s=o&&o!==`—`?o:null,c=s?(0,U.jsxs)(`span`,{className:`conv-item-time`,title:e.ts??void 0,children:[`· `,s]}):null;if(e.kind===`tool_result`)return(0,U.jsx)(`div`,{ref:r,className:i(`conv-item--tool_result`),style:n,"data-uuid":e.anchor.uuid,children:(0,U.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,U.jsx)($b,{}),` Tool result`,(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid,className:`conv-chip-permalink`}),c]}),(0,U.jsx)(`div`,{className:`conv-chip-body`,children:(0,U.jsx)(vC,{blocks:e.blocks,anchorUuid:e.anchor.uuid})})]})});if(e.kind===`assistant`){let t=typeof e.cost_usd==`number`&&e.cost_usd>0,a=`tokens`in e?e.tokens:void 0;return(0,U.jsxs)(`div`,{ref:r,className:i(`conv-item--assistant`),style:n,"data-uuid":e.anchor.uuid,children:[(0,U.jsxs)(`div`,{className:`conv-item-head`,children:[(0,U.jsx)(`span`,{className:`conv-item-label`,children:`Assistant`}),e.model&&(0,U.jsx)(`span`,{className:`chip ${dn(e.model)}`,children:e.model}),c]}),(0,U.jsx)(vC,{blocks:e.blocks,anchorUuid:e.anchor.uuid}),e.text&&(0,U.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,U.jsx)(yx,{text:e.text})]}),(t||a)&&(0,U.jsxs)(`div`,{className:`conv-item-cost`,title:a?`input ${a.input} · output ${a.output} · cache create ${a.cache_creation} · cache read ${a.cache_read}`:void 0,children:[t&&`$${e.cost_usd.toFixed(4)}`,a&&(0,U.jsxs)(U.Fragment,{children:[t?` · `:``,`in `,A.tokens(a.input),` · out `,A.tokens(a.output),` · cache `,A.tokens(a.cache_creation+a.cache_read)]})]})]})}if(e.kind===`meta`){let t=e.meta_kind,a=t===`skill`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(qb,{}),` `,(0,U.jsx)(`span`,{className:`conv-meta-label`,children:`Skill content`}),e.skill_name&&(0,U.jsxs)(`span`,{className:`conv-meta-name`,children:[`· `,e.skill_name]})]}):t===`command`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kb,{}),` `,(0,U.jsx)(`span`,{className:`conv-meta-label`,children:`System marker`})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kb,{}),` `,(0,U.jsx)(`span`,{className:`conv-meta-label`,children:`Injected context`}),(0,U.jsx)(`span`,{className:`conv-meta-preview`,children:PC(e.text)})]});return(0,U.jsx)(`div`,{ref:r,className:i(`conv-item--meta`),style:n,"data-uuid":e.anchor.uuid,children:(0,U.jsxs)(`details`,{className:`conv-meta conv-meta--${t}`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),a,c]}),t===`command`?(0,U.jsx)(`pre`,{className:`conv-meta-body conv-meta-body--pre`,children:e.text}):(0,U.jsxs)(`div`,{className:`conv-meta-body`,children:[(0,U.jsx)(vC,{blocks:e.blocks,anchorUuid:e.anchor.uuid}),t===`skill`&&e.text&&(0,U.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,U.jsx)(yx,{text:e.text})]})]})]})})}if(Kl(e.text)&&e.blocks.every(e=>e.kind===`text`))return(0,U.jsx)(`div`,{ref:r,className:i(`conv-item--system`),style:n,"data-uuid":e.anchor.uuid,children:(0,U.jsxs)(`details`,{className:`conv-system-marker`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,U.jsx)(Kb,{}),` System marker`,(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid,className:`conv-chip-permalink`})]}),(0,U.jsx)(`pre`,{className:`conv-system-marker-body`,children:e.text})]})});let l=`command_name`in e?e.command_name:null;return(0,U.jsxs)(`div`,{ref:r,className:i(`conv-item--human`),style:n,"data-uuid":e.anchor.uuid,children:[(0,U.jsxs)(`div`,{className:`conv-item-head`,children:[(0,U.jsx)(`span`,{className:`conv-item-label`,children:`You`}),l&&(0,U.jsx)(`span`,{className:`conv-cmd-badge`,children:l}),c]}),e.text&&(0,U.jsx)(kx,{children:e.text}),(0,U.jsx)(vC,{blocks:e.blocks.filter(e=>e.kind!==`text`),anchorUuid:e.anchor.uuid}),e.text&&(0,U.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,U.jsx)(yx,{text:e.text})]})]})}var IC=(0,_.memo)((0,_.forwardRef)(FC)),LC=60;function RC(e){return e==null?null:e===`completed`?(0,U.jsx)(`span`,{className:`conv-subagent-ok`,"aria-label":`completed`,title:`completed`,children:`✓`}):e===`error`?(0,U.jsxs)(`span`,{className:`conv-subagent-err`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`✕`}),` error`]}):(0,U.jsxs)(`span`,{className:`conv-subagent-warn`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`⚠`}),` `,e]})}function zC(e,t){let n=((e.find(e=>e.kind!==`meta`)??e[0])?.text??``).split(`
66
- `).map(e=>e.trim()).find(e=>e.length>0)??``;return n?n.length>LC?`${n.slice(0,LC).trimEnd()}…`:n:`Subagent ${t}`}function BC({subagentKey:e,items:t,nested:n,meta:r,getItemRef:i,rootUuid:a,getCardRef:o,onOpenChange:s,forceOpen:c=!1,riseClassName:l=``,riseStyle:u}){let[d,f]=(0,_.useState)(!1),p=d||c;(0,_.useEffect)(()=>{c&&(f(!0),s?.(e,!0))},[c]);let m=zC(t,e),h=t.reduce((e,t)=>e+(`cost_usd`in t?t.cost_usd??0:0),0),g=[...new Set(t.map(e=>`model`in e?e.model:null).filter(Boolean))];return(0,U.jsxs)(`details`,{"data-uuid":a,ref:a!=null&&o?o(a):void 0,className:[n?`conv-sidechain conv-sidechain--nested`:`conv-sidechain`,c?`conv-sidechain--force`:``,l].filter(Boolean).join(` `),style:u,open:p,onToggle:t=>{let n=t.currentTarget.open;f(n),s?.(e,n)},children:[(0,U.jsxs)(`summary`,{className:`conv-sidechain-head`,children:[(0,U.jsx)(`span`,{className:`conv-sidechain-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(Gb,{})}),(0,U.jsxs)(`span`,{className:`conv-sidechain-headtext`,children:[(0,U.jsxs)(`span`,{className:`conv-sidechain-kind`,children:[`Subagent`,r?.kind?(0,U.jsxs)(`span`,{className:`conv-sidechain-kindname`,children:[` · `,r.kind]}):null]}),(0,U.jsx)(`span`,{className:`conv-sidechain-title`,children:m}),r&&(r.total_tokens!=null||r.total_duration_ms!=null||r.total_tool_use_count!=null||r.status!=null)&&(0,U.jsxs)(`span`,{className:`conv-sidechain-submeta`,children:[r.total_tokens!=null&&(0,U.jsxs)(`span`,{children:[A.compact(r.total_tokens),` tok`]}),r.total_duration_ms!=null&&(0,U.jsx)(`span`,{children:A.durationMs(r.total_duration_ms)}),r.total_tool_use_count!=null&&(0,U.jsxs)(`span`,{children:[r.total_tool_use_count,` `,r.total_tool_use_count===1?`tool`:`tools`]}),RC(r.status)]})]}),(0,U.jsxs)(`span`,{className:`conv-sidechain-meta`,children:[g.length>0&&(0,U.jsx)(`span`,{className:`conv-sidechain-model`,children:g.join(`, `)}),(0,U.jsxs)(`span`,{children:[t.length,` msgs`]}),(0,U.jsx)(`span`,{className:`conv-sidechain-cost`,children:A.usd2(h)}),(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`})]})]}),(0,U.jsx)(`div`,{className:`conv-sidechain-body`,children:t.map(e=>(0,U.jsx)(IC,{item:e,ref:p&&i?i(e):void 0},e.anchor.uuid))})]})}function VC(e){return e.blocks.some(e=>e.kind===`tool_call`&&!!e.result?.is_error||e.kind===`tool_result`&&e.is_error)}function HC(e){return e.text.trim()!==``||e.blocks.some(e=>e.kind===`thinking`)}function UC(e,t){if(t===`all`)return!0;if(e.kind===`subagent`||e.kind===`tool_result_run`)return t===`errors`&&e.items.some(VC);let n=e.item;return t===`prompts`?n.kind===`human`:t===`errors`?VC(n):n.kind===`human`?!0:n.kind===`assistant`?HC(n):!1}function WC(e){return e.kind===`hidden_run`?e.firstUuid:e.kind===`item`?e.item.anchor.uuid:e.items[0].anchor.uuid}function GC(e,t){if(t===`all`)return e;let n=[],r=[],i=()=>{r.length&&n.push({kind:`hidden_run`,count:r.length,firstUuid:WC(r[0])}),r=[]};for(let a of e)UC(a,t)?(i(),n.push(a)):r.push(a);return i(),n}var KC=600;function qC(e){return e.kind===`hidden_run`?null:e.kind===`item`?e.item.ts??null:e.items[0]?.ts??null}function JC(e,t){let n=[],r=null,i=new Intl.DateTimeFormat(`en-US`,{timeZone:t.tz,month:`short`,day:`2-digit`}),a=e=>i.format(e);for(let t of e){let e=qC(t),i=e?new Date(e):null,o=i!=null&&!isNaN(i.getTime());if(o&&r){let t=(i.getTime()-r.getTime())/1e3,o=a(i)!==a(r);t>=0&&(t>=KC||o)&&n.push({kind:`time_marker`,gapSeconds:t>=KC?t:null,dayLabel:o?a(i):null,key:`tm-${n.length}-${e}`})}o&&(r=i),n.push(t)}return n}function YC(e,t){if(t===`all`)return!0;let n=(e.tools??[]).some(e=>e.is_error);return e.is_sidechain?t===`errors`&&n:t===`prompts`?e.kind===`human`:t===`errors`?n:e.kind===`human`?!0:e.kind===`assistant`?e.label.trim()!==``||(e.thinking?.length??0)>0:!1}var XC=new Set([`ExitPlanMode`,`AskUserQuestion`]);function ZC(e){let t=[],n=[],r=[],i=[],a=new Map,o=new Set;return e.forEach((e,s)=>{a.set(e.uuid,s),e.tools?.some(e=>e.is_error)&&t.push(s),e.kind===`human`&&n.push(s),e.subagent_key!=null&&!o.has(e.subagent_key)&&(o.add(e.subagent_key),r.push(s)),e.tools?.some(e=>e.name!=null&&XC.has(e.name))&&i.push(s)}),{error:t,prompt:n,subagent:r,plan:i,indexByUuid:a}}function QC(e,t,n){if(n===1){for(let n of e)if(n>t)return n;return null}for(let n=e.length-1;n>=0;n--)if(e[n]<t)return e[n];return null}var $C=/^\s*(?:<((?:local-)?command-[a-z-]+)>(?:(?!<\/\1>)[\s\S])*<\/\1>\s*)+$/,ew=e=>$C.test(e);function tw(e){for(let t of e.items)if(t.kind===`human`&&!t.is_sidechain&&t.text.trim()&&!Kl(t.text)&&!ew(t.text)){let e=t.text.split(`
67
- `).map(e=>e.trim()).find(Boolean);if(e)return e.length>120?e.slice(0,120).trimEnd()+`…`:e}return e.project_label||e.session_id}function nw({sessionId:e,mobileBack:t,outline:n}){let{detail:r,loading:i,error:a,hasMore:o,loadMore:s,loadUntil:c}=Hl(e),l=(0,_.useSyncExternalStore)(V,()=>B().conversationJump),u=(0,_.useSyncExternalStore)(V,()=>B().convOutlineOpen),d=(0,_.useSyncExternalStore)(V,()=>B().convFocusMode),f=(0,_.useSyncExternalStore)(V,()=>B().convCurrentTurnUuid),p=(0,_.useSyncExternalStore)(V,()=>B().convPinnedUuid),m=(0,_.useSyncExternalStore)(V,()=>B().convFindOpen),[h,g]=(0,_.useState)(null),v=(0,_.useRef)(null),y=jo(),b=(0,_.useRef)(null),x=(0,_.useRef)(new Map),S=(0,_.useRef)(new Map),C=(0,_.useRef)(new Map),w=(0,_.useRef)(new Map),T=(0,_.useRef)(null),[E,D]=(0,_.useState)(null),O=(0,_.useRef)(new Set),[k,j]=(0,_.useState)(0),M=(0,_.useRef)(0);M.current=k;let N=(0,_.useRef)([]),P=(0,_.useRef)(null),F=(0,_.useRef)(null),ee=(0,_.useRef)(o);ee.current=o;let te=(0,_.useRef)(s);te.current=s;let ne=(0,_.useRef)(y);ne.current=y;let I=(0,_.useRef)(n);I.current=n;let re=(0,_.useRef)(f);re.current=f;let ie=(0,_.useRef)(p);ie.current=p;let ae=(0,_.useRef)(d);ae.current=d;let oe=(0,_.useRef)(e);oe.current=e;let se=(0,_.useRef)(m);se.current=m;let L=(0,_.useRef)(!0),ce=(0,_.useRef)(0),le=(0,_.useRef)(!1),[ue,de]=(0,_.useState)(0),R=(0,_.useRef)(new Set),fe=(0,_.useRef)(new Set),pe=(0,_.useCallback)((e,t)=>{t?R.current.add(e):R.current.delete(e)},[]),[me,he]=(0,_.useState)(!1),ge=(0,_.useRef)(null),_e=(0,_.useCallback)(()=>{let e=F.current;if(!e)return;let t=e.scrollTop+e.clientHeight>=e.scrollHeight-80;L.current=t,t&&de(e=>e&&0);let n=P.current,r=F.current;if(n&&r){let e=r.getBoundingClientRect().top,t=null;for(let r of Array.from(n.children)){let n=r.getBoundingClientRect();if(n.top<=e+1&&n.bottom>e+1){t=r;break}}t&&e-t.getBoundingClientRect().top>160?(ge.current=t,he(!0)):(ge.current=null,he(!1))}},[]),ve=(0,_.useCallback)(()=>{ge.current?.scrollIntoView({block:`start`,behavior:ne.current?`auto`:`smooth`}),he(!1),H({type:`CLEAR_CONV_PIN`})},[]);(0,_.useLayoutEffect)(()=>{let e=F.current,t=r?.items??[],n=t.length,i=ce.current,a=n-i,s=a>0&&le.current===!1&&i>0,c=a>0?t.slice(i):[],l=0;if(s){let e=new Set;for(let t of c){let n=t.subagent_key;n==null?l++:fe.current.has(n)?R.current.has(n)&&l++:e.has(n)||(l++,e.add(n))}}for(let e of c)e.subagent_key!=null&&fe.current.add(e.subagent_key);e&&s&&(L.current&&l>0?e.scrollTo({top:e.scrollHeight}):l>0&&de(e=>e+l)),ce.current=n,le.current=o},[r?.items.length,o]);let ye=(0,_.useCallback)(()=>{let e=F.current;e&&(e.scrollTo({top:e.scrollHeight,behavior:ne.current?`auto`:`smooth`}),de(0),H({type:`CLEAR_CONV_PIN`}))},[]),be=(0,_.useMemo)(()=>Wl(r?.items??[]),[r?.items]),xe=(0,_.useMemo)(()=>GC(be,d),[be,d]),Se=Wt(),Ce=(0,_.useMemo)(()=>({tz:Se.resolvedTz,offsetLabel:Se.offsetLabel}),[Se.resolvedTz,Se.offsetLabel]),we=(0,_.useMemo)(()=>JC(xe,Ce),[xe,Ce]),Te=(0,_.useRef)(be);Te.current=be;let Ee=(0,_.useMemo)(()=>r?tw(r):``,[r]),De=(0,_.useMemo)(()=>({sessionId:e,focusMode:d,fmtCtx:Ce}),[e,d,Ce]);(0,_.useEffect)(()=>{if(!b.current||!o)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&s()});return e.observe(b.current),()=>e.disconnect()},[o,s]),(0,_.useEffect)(()=>{let e=F.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new Set,n=new IntersectionObserver(e=>{for(let n of e)n.isIntersecting?t.add(n.target):t.delete(n.target);let n=null,r=1/0;for(let e of t){let t=e.getBoundingClientRect().top;t<r&&(r=t,n=e)}let i=n?.getAttribute(`data-uuid`);i&&H({type:`SET_CONV_CURRENT_TURN`,uuid:i})},{root:e,threshold:0}),r=new Set;for(let e of x.current.values())r.has(e)||(r.add(e),n.observe(e));for(let e of S.current.values())r.has(e)||(r.add(e),n.observe(e));return()=>n.disconnect()},[xe]),(0,_.useEffect)(()=>{if(!l||l.session_id!==e){E!==null&&D(null);return}if(!r||r.session_id!==e)return;let t=!1;return(async()=>{if(await c(l.uuid),t)return;let e=x.current.get(l.uuid)??S.current.get(l.uuid);if(e){l.expand_details&&e.querySelectorAll(`details:not([open])`).forEach(e=>{e.open=!0}),e.scrollIntoView({behavior:y?`auto`:`smooth`,block:`center`}),e.classList.add(`conv-item--jumped`),H({type:`SET_CONV_PINNED_TURN`,uuid:l.uuid});let t=P.current;if(t){let n=Array.prototype.indexOf.call(t.children,e);n>=0&&j(n)}T.current!=null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{e.classList.remove(`conv-item--jumped`),T.current=null},2e3),H({type:`CLEAR_CONVERSATION_JUMP`}),D(null);return}let n=ae.current;if(n!==`all`){let e=Te.current.find(e=>WC(e)===l.uuid||e.kind===`item`&&e.item.member_uuids.includes(l.uuid));if(e!=null&&!UC(e,n)){H({type:`SET_CONV_FOCUS_MODE`,mode:`all`});return}}let i=r.items.find(e=>e.member_uuids.includes(l.uuid));if(i&&i.subagent_key!=null&&E!==i.subagent_key){D(i.subagent_key);return}o||H({type:`CLEAR_CONVERSATION_JUMP`})})(),()=>{t=!0}},[l,e,r?.items.length,o,E,d]),(0,_.useEffect)(()=>()=>{T.current!=null&&window.clearTimeout(T.current)},[]),(0,_.useEffect)(()=>{let e=F.current;if(!e)return;let t=()=>H({type:`CLEAR_CONV_PIN`}),n=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]),r=e=>{n.has(e.key)&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`touchmove`,t,{passive:!0}),e.addEventListener(`keydown`,r),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`touchmove`,t),e.removeEventListener(`keydown`,r)}},[r!=null]),(0,_.useEffect)(()=>()=>{C.current.clear(),w.current.clear(),S.current.clear()},[e]),(0,_.useEffect)(()=>{D(null)},[e]),(0,_.useEffect)(()=>{de(0),L.current=!0,he(!1),ge.current=null,R.current.clear(),fe.current.clear()},[e]),(0,_.useEffect)(()=>{O.current.clear()},[e]),(0,_.useEffect)(()=>{for(let e of be){let t=e.kind===`subagent`||e.kind===`tool_result_run`?e.items[0]?.anchor.uuid:e.item.anchor.uuid;t&&O.current.add(t)}},[be]);let Oe=(0,_.useCallback)((t,n,r)=>y||O.current.has(t)||l!=null&&l.session_id===e&&n.includes(l.uuid)?[``,void 0]:[`conv-rise`,{animationDelay:O.current.size===0?`${r*40}ms`:`0ms`}],[y,l,e]),ke=(0,_.useCallback)(e=>{let t=C.current,n=e.anchor.uuid,r=t.get(n);return r||(r=t=>{for(let n of e.member_uuids)t?x.current.set(n,t):x.current.delete(n)},t.set(n,r)),r},[]),Ae=(0,_.useCallback)(e=>{let t=w.current,n=t.get(e);return n||(n=t=>{t?S.current.set(e,t):S.current.delete(e)},t.set(e,n)),n},[]);(0,_.useEffect)(()=>{j(0)},[e]),(0,_.useEffect)(()=>{let e=P.current;if(!e)return;let t=e.children;for(let e=0;e<t.length;e++){let n=t[e].dataset.convMarker!=null;t[e].classList.toggle(`conv-item--focused`,e===k&&!n)}},[k,xe]),(0,_.useEffect)(()=>{let e=N.current,t=M.current,n=e[t];if(!n)return;let r=e=>e.kind===`time_marker`?null:WC(e),i=r(n),a=i==null?-1:we.findIndex(e=>r(e)===i);if(a<0)for(let n=t+1;n<e.length;n++){let t=r(e[n]);if(t==null)continue;let i=we.findIndex(e=>r(e)===t);if(i>=0){a=i;break}}a<0&&(a=we.length-1);let o=e=>{let t=we[e];return t!=null&&(t.kind===`time_marker`||t.kind===`hidden_run`)};if(a>=0&&o(a)){let e=a;for(;e<we.length&&o(e);)e++;if(e>=we.length)for(e=a;e>=0&&o(e);)e--;a=e}a<0&&(a=0),j(a)},[d]),(0,_.useEffect)(()=>{N.current=we},[we]);let z=(0,_.useCallback)(e=>{let t=P.current;if(!t)return;let n=t.children.length-1;if(n<0)return;let r=M.current,i=e>=0?1:-1,a=r+e;for(;a>=0&&a<=n&&t.children[a].dataset.convMarker!=null;)a+=i;if(a=Math.max(0,Math.min(n,a)),t.children[a]?.dataset.convMarker==null){if(e>0&&r===n&&ee.current){te.current();return}a!==r&&(H({type:`CLEAR_CONV_PIN`}),j(a),t.children[a]?.scrollIntoView({block:`nearest`,behavior:ne.current?`auto`:`smooth`}))}},[]),je=(0,_.useCallback)(e=>{let t=P.current;if(!t)return;t.classList.add(`conv-reader-thread--bulk`),t.querySelectorAll(`details`).forEach(t=>{t.open=e});let n=()=>t.classList.remove(`conv-reader-thread--bulk`);typeof requestAnimationFrame==`function`?requestAnimationFrame(n):n()},[]),Me=(0,_.useCallback)(()=>{F.current?.scrollTo({top:0,behavior:ne.current?`auto`:`smooth`}),j(0),H({type:`CLEAR_CONV_PIN`})},[]),{indexByUuid:Ne,...Pe}=(0,_.useMemo)(()=>ZC(n?.turns??[]),[n]),Fe=(0,_.useRef)(Pe);Fe.current=Pe;let Ie=(0,_.useRef)(Ne);Ie.current=Ne;let Le=(0,_.useCallback)(e=>{if(ne.current)return;let t=document.querySelector(`[data-jump-kind="${e}"]`);t&&(t.classList.add(`conv-pulse-disabled`),window.setTimeout(()=>t.classList.remove(`conv-pulse-disabled`),300))},[]),Re=(0,_.useCallback)((e,t)=>{let n=I.current?.turns??[];if(n.length===0)return;let r=Fe.current[e],i=Ie.current,a=-1,o=ie.current??re.current;if(o!=null&&i.has(o))a=i.get(o);else{let e=(P.current?.children[M.current])?.getAttribute(`data-uuid`);e!=null&&i.has(e)&&(a=i.get(e))}let s=QC(r,a,t);if(s==null){Le(e);return}let c=n[s],l=ae.current;if(l!==`all`){let e=Te.current.find(e=>WC(e)===c.uuid||e.kind===`item`&&e.item.member_uuids.includes(c.uuid));(e==null||!UC(e,l))&&H({type:`SET_CONV_FOCUS_MODE`,mode:`all`})}H({type:`OPEN_CONVERSATION`,sessionId:oe.current,jump:{session_id:oe.current,uuid:c.uuid}})},[Le]),ze=(0,_.useRef)(Re);ze.current=Re;let Be=(0,_.useCallback)(e=>{let t=e.split(/\s+/).filter(Boolean);g(t.length?t:null)},[]),Ve=(0,_.useCallback)(()=>{g(null),P.current?.focus?.()},[]);(0,_.useEffect)(()=>{m||g(null)},[m]);let He=(0,_.useCallback)(()=>{let e=[`all`,`chat`,`prompts`,`errors`],t=ae.current,n=e[(e.indexOf(t)+1)%e.length];H({type:`SET_CONV_FOCUS_MODE`,mode:n})},[]);return Ht((0,_.useMemo)(()=>{let e=()=>!B().openModal&&B().inputMode===null,t=(t,n)=>({key:t,scope:`global`,view:`conversations`,when:e,action:n});return[t(`j`,()=>z(1)),t(`k`,()=>z(-1)),t(`[`,()=>je(!1)),t(`]`,()=>je(!0)),t(`g`,()=>Me()),t(`o`,()=>H({type:`TOGGLE_CONV_OUTLINE`})),t(`e`,()=>ze.current(`error`,1)),t(`E`,()=>ze.current(`error`,-1)),t(`u`,()=>ze.current(`prompt`,1)),t(`U`,()=>ze.current(`prompt`,-1)),t(`b`,()=>ze.current(`subagent`,1)),t(`B`,()=>ze.current(`subagent`,-1)),t(`p`,()=>ze.current(`plan`,1)),t(`P`,()=>ze.current(`plan`,-1)),t(`v`,()=>He()),{key:`n`,scope:`global`,view:`conversations`,when:()=>e()&&se.current,action:()=>v.current?.(1)},{key:`N`,scope:`global`,view:`conversations`,when:()=>e()&&se.current,action:()=>v.current?.(-1)}]},[])),i&&!r?(0,U.jsx)(`div`,{className:`conv-reader conv-reader--loading`,children:(0,U.jsxs)(`div`,{className:`conv-state`,children:[(0,U.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(ox,{})}),(0,U.jsx)(`div`,{className:`conv-state-title`,children:`Loading conversation…`})]})}):a?(0,U.jsx)(`div`,{className:`conv-reader conv-reader--error`,children:(0,U.jsxs)(`div`,{className:`conv-state`,children:[(0,U.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(sx,{})}),(0,U.jsx)(`div`,{className:`conv-state-title`,children:a})]})}):r?(0,U.jsxs)(`div`,{className:`conv-reader`,children:[(0,U.jsxs)(`div`,{className:`conv-reader-head`,children:[t&&(0,U.jsx)(`button`,{type:`button`,className:`conv-back`,onClick:()=>H({type:`SELECT_CONVERSATION`,sessionId:null}),children:`← Back`}),(0,U.jsxs)(`div`,{className:`conv-reader-headmain`,children:[(0,U.jsx)(`div`,{className:`conv-reader-title`,children:Ee||r.session_id}),(0,U.jsxs)(`div`,{className:`conv-reader-meta`,children:[r.project_label||`—`,` · `,r.git_branch??`—`,` · `,A.usd2(r.cost_usd),` · `,r.models.join(`, `)]})]}),(0,U.jsxs)(`div`,{className:`conv-reader-controls`,children:[(0,U.jsx)(`div`,{className:`conv-focus-seg`,role:`radiogroup`,"aria-label":`Focus mode`,children:[`all`,`chat`,`prompts`,`errors`].map(e=>{let t={all:`All`,chat:`Chat`,prompts:`Prompts`,errors:`Errors`},r=n?.stats.error_count??0;return(0,U.jsxs)(`button`,{type:`button`,className:[`conv-focus-seg-btn`,d===e?`conv-focus-seg-btn--on`:``].filter(Boolean).join(` `),role:`radio`,"aria-checked":d===e,onClick:()=>H({type:`SET_CONV_FOCUS_MODE`,mode:e}),children:[t[e],e===`errors`&&r>0&&(0,U.jsx)(`span`,{className:`conv-focus-seg-badge`,children:r})]},e)})}),(0,U.jsx)(`button`,{type:`button`,className:`conv-outline-toggle`,"aria-pressed":u,"aria-label":`Toggle session outline`,title:`Toggle session outline (o)`,onClick:()=>H({type:`TOGGLE_CONV_OUTLINE`}),children:`☰ Outline`})]})]}),m&&(0,U.jsx)(Yl,{sessionId:e,onClose:Ve,onTermsChange:Be,stepRef:v}),(0,U.jsxs)(`div`,{className:`conv-reader-body`,ref:F,onScroll:_e,children:[(0,U.jsx)(Xl.Provider,{value:h,children:(0,U.jsx)(Qx.Provider,{value:De,children:(0,U.jsx)(`div`,{className:`conv-reader-thread`,ref:P,children:we.map((t,n)=>{if(t.kind===`time_marker`){let e=t.gapSeconds==null?null:`⏸ ${A.gapDuration(t.gapSeconds)} later`;return(0,U.jsx)(`div`,{className:`conv-time-marker`,"data-conv-marker":``,role:`separator`,children:e&&t.dayLabel?`${e} · ${t.dayLabel}`:e||`— ${t.dayLabel} —`},t.key)}if(t.kind===`hidden_run`)return(0,U.jsxs)(`button`,{type:`button`,className:`conv-hidden-run`,"data-conv-marker":``,onClick:()=>{H({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),H({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t.firstUuid}})},children:[`· `,t.count,` hidden ·`]},`hr-${t.firstUuid}`);if(t.kind===`subagent`){let i=t.items.flatMap(e=>e.member_uuids),[a,o]=Oe(t.items[0].anchor.uuid,i,n);return(0,U.jsx)(BC,{subagentKey:t.subagentKey,items:t.items,nested:t.nested,meta:r.subagent_meta?.[t.subagentKey],getItemRef:ke,rootUuid:t.items[0].anchor.uuid,getCardRef:Ae,onOpenChange:pe,forceOpen:r.session_id===e&&t.subagentKey===E,riseClassName:a,riseStyle:o},`sc-${t.subagentKey}`)}if(t.kind===`tool_result_run`){let e=t.items.flatMap(e=>e.member_uuids),[r,i]=Oe(t.items[0].anchor.uuid,e,n);return(0,U.jsxs)(`details`,{className:[`conv-toolresult-run`,r].filter(Boolean).join(` `),style:i,open:!0,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,U.jsx)($b,{}),` `,t.items.length,` tool results`]}),(0,U.jsx)(`div`,{className:`conv-toolresult-run-body`,children:t.items.map(e=>(0,U.jsx)(IC,{item:e,ref:ke(e)},e.anchor.uuid))})]},`trr-${t.items[0].anchor.uuid}`)}let[i,a]=Oe(t.item.anchor.uuid,t.item.member_uuids,n);return(0,U.jsx)(IC,{item:t.item,ref:ke(t.item),className:i,style:a},t.item.anchor.uuid)})})})}),o&&(0,U.jsx)(`div`,{ref:b,className:`conv-load-sentinel`,children:`Loading more…`})]}),ue>0&&!L.current&&(0,U.jsxs)(`button`,{type:`button`,className:`conv-new-pill`,onClick:ye,children:[`↓ `,ue,` new`]}),me&&(0,U.jsx)(`button`,{type:`button`,className:`conv-jump-top`,onClick:ve,title:`Jump to the start of this turn`,"aria-label":`Jump to the start of this turn`,children:`↑`})]}):(0,U.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:(0,U.jsxs)(`div`,{className:`conv-state`,children:[(0,U.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(cx,{})}),(0,U.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,U.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})})}var rw=new Set([`ExitPlanMode`]),iw=new Set([`AskUserQuestion`]),aw=/^#{1,6}\s+\S/;function ow(e,t){let n=new Map;for(let t of e)if(t.subagent_key!=null){let e=n.get(t.subagent_key);e?e.push(t):n.set(t.subagent_key,[t])}let r=[],i=new Map,a=new Set,o=new Map(e.map((e,t)=>[e.uuid,t])),s=null,c=null,l=()=>s==null?0:1,u=e=>{if(s!=null)for(let t of e.member_uuids)i.set(t,s)},d=e=>{let c=n.get(e),u=c.some(e=>e.tools?.some(e=>e.is_error));if(r.push({entryId:`sc:${e}`,uuid:c[0].uuid,type:`subagent`,label:`subagent · ${t?.[e]?.kind??`agent`}`,depth:l(),error:u,plan:!1,question:!1,thinkingCount:0,toolCount:c.reduce((e,t)=>e+(t.tools?.length??0),0),subagentKey:e,subagentKind:t?.[e]?.kind,turnIndex:o.get(c[0].uuid)??0}),a.add(e),s!=null)for(let e of c)for(let t of e.member_uuids)i.set(t,s)};for(let t of e){if(t.subagent_key!=null){a.has(t.subagent_key)||d(t.subagent_key);continue}let e=(t.tools??[]).some(e=>e.is_error),n=(t.tools??[]).some(e=>e.name!=null&&rw.has(e.name)),f=(t.tools??[]).some(e=>e.name!=null&&iw.has(e.name)),p=t.kind===`assistant`&&aw.test(t.label),m=t.tools?.length??0,h=t.thinking?.length??0;if(t.kind===`human`){s=t.uuid,i.set(t.uuid,t.uuid);for(let e of t.member_uuids)i.set(e,t.uuid);c={entryId:t.uuid,uuid:t.uuid,type:`human`,label:t.label,depth:0,error:!1,plan:!1,question:!1,thinkingCount:0,toolCount:m,turnIndex:o.get(t.uuid)??0},r.push(c);continue}if(t.kind===`meta`){u(t);continue}h>0&&c!=null&&(c.thinkingCount+=h),u(t);let g=null,_=``;if(e){g=`error`;let e=(t.tools??[]).find(e=>e.is_error)?.name;_=p?t.label:`tool error${e?` · ${e}`:``}`}else n?(g=`plan`,_=p?t.label:`plan`):f?(g=`question`,_=p?t.label:`question`):p&&(g=`heading`,_=t.label);g!=null&&r.push({entryId:t.uuid,uuid:t.uuid,type:g,label:_,depth:l(),error:e,plan:n,question:f,thinkingCount:0,toolCount:m,turnIndex:o.get(t.uuid)??0})}for(let e of n.keys())a.has(e)||d(e);return{entries:r,sectionByUuid:i}}function sw({sessionId:e,turns:t,lists:n,currentUuid:r,pinned:i,reduced:a,focusMode:o}){let{indexByUuid:s,...c}=n,l=(n,l,u)=>{let d=i??r,f=d!=null&&s.has(d)?s.get(d):-1,p=QC(c[n],f,l);if(p==null){a||(u.classList.add(`conv-pulse-disabled`),window.setTimeout(()=>u.classList.remove(`conv-pulse-disabled`),300));return}let m=t[p];o!==`all`&&!YC(m,o)&&H({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),H({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:m.uuid}})},u=[{kind:`error`,glyph:`✕`,label:`error turns`,aria:`error turn`,key:`e`},{kind:`prompt`,glyph:`⊕`,label:`prompts`,aria:`prompt`,key:`u`},{kind:`subagent`,glyph:`▸`,label:`subagents`,aria:`subagent`,key:`b`},{kind:`plan`,glyph:`⊞`,label:`plans`,aria:`plan / question`,key:`p`}].filter(e=>c[e.kind].length>0);return u.length===0?null:(0,U.jsxs)(`div`,{className:`conv-outline-jump`,children:[(0,U.jsx)(`div`,{className:`conv-outline-jump-label`,children:`Jump to`}),(0,U.jsx)(`div`,{className:`conv-jump-cluster`,role:`group`,"aria-label":`Jump to next landmark`,children:u.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`conv-jump-cluster-btn`,"data-jump-kind":e.kind,title:`Next ${e.aria} (${e.key}) · shift-click for previous`,"aria-label":`Next ${e.aria}, ${c[e.kind].length} total`,onClick:t=>l(e.kind,t.shiftKey?-1:1,t.currentTarget),children:[(0,U.jsx)(`span`,{className:`conv-jump-cluster-glyph`,"aria-hidden":`true`,children:e.glyph}),(0,U.jsx)(`span`,{className:`conv-jump-cluster-text`,children:e.label}),(0,U.jsx)(`span`,{className:`conv-jump-cluster-count`,children:c[e.kind].length})]},e.kind))})]})}function cw(e){if(e.error)return(0,U.jsx)(sx,{});if(e.plan)return(0,U.jsx)(ux,{});if(e.question)return(0,U.jsx)(lx,{});switch(e.type){case`human`:return(0,U.jsx)(cx,{});case`subagent`:return(0,U.jsx)(Gb,{});case`error`:return(0,U.jsx)(sx,{});case`plan`:return(0,U.jsx)(ux,{});case`question`:return(0,U.jsx)(lx,{});case`heading`:return(0,U.jsx)(Wb,{});default:return(0,U.jsx)(Wb,{})}}function lw({stats:e,errorTurns:t}){let n=e.turns.human,r=e.tokens.input+e.tokens.output+e.tokens.cache_creation+e.tokens.cache_read,i=(0,_.useMemo)(()=>Object.entries(e.tool_counts).sort((e,t)=>t[1]-e[1]),[e.tool_counts]),a=i.slice(0,3),o=i.length-a.length,s=i.map(([e,t])=>`${e} ×${t}`).join(`
68
- `),c=(0,_.useMemo)(()=>Object.entries(e.models).sort((e,t)=>t[1]-e[1]),[e.models]),l=(()=>{let n=e.error_count,r=`${n} ${n===1?`error`:`errors`}`;return t===n?r:`${r} in ${t} turns`})();return(0,U.jsxs)(`div`,{className:`conv-outline-stats-body`,children:[(0,U.jsxs)(`div`,{className:`conv-outline-stats-headline`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stats-strong`,children:e.turns.total}),` turns`,` · `,(0,U.jsx)(`span`,{className:`conv-outline-stats-strong`,children:n}),` yours`]}),(0,U.jsxs)(`div`,{className:`conv-outline-stat-tiles`,children:[(0,U.jsxs)(`div`,{className:`conv-outline-stat-tile`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:A.hhmm(e.duration_seconds)}),(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Time`})]}),(0,U.jsxs)(`div`,{className:`conv-outline-stat-tile conv-outline-stat-tile--tokens`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:A.tokens(r)}),(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Tokens`})]}),(0,U.jsxs)(`div`,{className:`conv-outline-stat-tile conv-outline-stat-tile--cost`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:A.usd2(e.cost_usd)}),(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Cost`})]})]}),c.length>0&&(0,U.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--models`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⬡`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Models`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-value`,children:c.map(([e,t])=>`${e} ×${t}`).join(`, `)})]}),a.length>0&&(0,U.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--tools`,title:s,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚙`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Tools`}),(0,U.jsxs)(`span`,{className:`conv-outline-stat-kv-value`,children:[a.map(([e,t])=>`${e} ×${t}`).join(` `),o>0?` +${o} more`:``]})]}),e.error_count>0&&(0,U.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--errors`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚠`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Errors`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-value`,children:l})]})]})}function uw({sessionId:e,outline:t}){let n=(0,_.useSyncExternalStore)(V,()=>B().convCurrentTurnUuid),r=(0,_.useSyncExternalStore)(V,()=>B().convPinnedUuid),i=(0,_.useSyncExternalStore)(V,()=>B().convFocusMode),a=jo(),{entries:o,sectionByUuid:s}=(0,_.useMemo)(()=>t?ow(t.turns,t.subagent_meta):{entries:[],sectionByUuid:new Map},[t]),c=(0,_.useMemo)(()=>ZC(t?.turns??[]),[t]),l=(0,_.useMemo)(()=>{let e=new Map;return(t?.turns??[]).forEach(t=>e.set(t.uuid,t)),e},[t]),u=t=>{let n=l.get(t);n&&i!==`all`&&!YC(n,i)&&H({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),H({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t}})},d=n==null?null:s.get(n)??null,f=(0,_.useRef)(null),p=r??n;return(0,_.useEffect)(()=>{p!=null&&(f.current?.querySelector(`[aria-current="true"]`))?.scrollIntoView({block:`nearest`,behavior:a?`auto`:`smooth`})},[p,a]),(0,U.jsx)(`nav`,{className:`conv-outline`,"aria-label":`Session outline`,children:t==null?(0,U.jsx)(`div`,{className:`conv-outline-placeholder`,children:`Loading outline…`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`conv-outline-stats`,children:[(0,U.jsx)(lw,{stats:t.stats,errorTurns:c.error.length}),(0,U.jsx)(sw,{sessionId:e,turns:t.turns,lists:c,currentUuid:n,pinned:r,reduced:a,focusMode:i})]}),(0,U.jsx)(`ol`,{className:`conv-outline-list`,ref:f,children:o.map(e=>{let t=r==null?n!=null&&(e.uuid===n||e.type===`human`&&e.uuid===d):e.uuid===r;return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,className:[`conv-outline-entry`,`conv-outline-entry--${e.type}`,e.depth?`conv-outline-entry--nested`:``,e.error?`conv-outline-entry--error`:``].filter(Boolean).join(` `),"aria-current":t?`true`:void 0,onClick:()=>u(e.uuid),title:e.label,children:[(0,U.jsx)(`span`,{className:`conv-outline-entry-glyph`,"aria-hidden":`true`,children:cw(e)}),(0,U.jsx)(`span`,{className:`conv-outline-entry-label`,children:e.label}),e.thinkingCount>0&&(0,U.jsxs)(`span`,{className:`conv-outline-entry-thinking`,title:`${e.thinkingCount} thinking ${e.thinkingCount===1?`block`:`blocks`}`,children:[`🧠 ×`,e.thinkingCount]})]})},e.entryId)})})]})})}function dw(){let e=(0,_.useSyncExternalStore)(V,()=>B().selectedConversationId),t=(0,_.useSyncExternalStore)(V,()=>B().convOutlineOpen),n=W(),r=cn(),{outline:i}=wl(e);return Ht(fw),bt(n)?r?(0,U.jsx)(`div`,{className:`conv-view conv-view--mobile`,children:e==null?(0,U.jsx)(Fl,{}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(nw,{sessionId:e,outline:i,mobileBack:!0}),t&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{type:`button`,className:`conv-outline-backdrop`,"aria-label":`Close outline`,onClick:()=>H({type:`TOGGLE_CONV_OUTLINE`})}),(0,U.jsx)(`div`,{className:`conv-outline-sheet`,children:(0,U.jsx)(uw,{sessionId:e,outline:i})})]})]})}):(0,U.jsxs)(`div`,{className:[`conv-view`,t&&e!=null?`conv-view--outline`:``].filter(Boolean).join(` `),children:[(0,U.jsx)(Fl,{}),e==null?(0,U.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:(0,U.jsxs)(`div`,{className:`conv-state`,children:[(0,U.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(cx,{})}),(0,U.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,U.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})}):(0,U.jsx)(nw,{sessionId:e,outline:i}),t&&e!=null&&(0,U.jsx)(uw,{sessionId:e,outline:i})]}):(0,U.jsxs)(`div`,{className:`conv-disabled`,children:[`Transcript viewing is disabled. Enable it with`,` `,(0,U.jsx)(`code`,{children:`cctally config set dashboard.expose_transcripts true`}),` `,`(loopback is always allowed; restart the dashboard to apply).`]})}var fw=[{key:`/`,scope:`global`,view:`conversations`,when:()=>!B().openModal&&B().inputMode===null,action:()=>{if(B().selectedConversationId){H({type:`OPEN_CONV_FIND`});return}let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}},{key:`Escape`,scope:`global`,view:`conversations`,when:()=>!B().openModal,action:()=>{if(B().conversationSearch){H({type:`SET_CONVERSATION_SEARCH`,text:``});return}H({type:`SET_VIEW`,view:`dashboard`})}}];function pw(){let e=(0,_.useSyncExternalStore)(V,()=>B().prefs.panelOrder),t=(0,_.useSyncExternalStore)(V,()=>B().view);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(kt,{}),t===`conversations`?(0,U.jsx)(dw,{}):(0,U.jsx)(Ro,{items:e,children:(0,U.jsx)(`div`,{className:`grid`,children:e.map((e,t)=>(0,U.jsx)(Mo,{id:e,index:t},e))})}),(0,U.jsx)(Ft,{}),(0,U.jsx)(Yn,{}),(0,U.jsx)(er,{}),(0,U.jsx)(Cc,{}),(0,U.jsx)(bl,{}),(0,U.jsx)(os,{}),(0,U.jsx)(Vo,{}),(0,U.jsx)(sr,{})]})}function mw(e){let t=B().prefs.panelOrder,n=e-1;if(n<0||n>=t.length)return;let r=Gn[t[n]];r&&r.openAction()}var hw=`Click a panel first, then press S to share it.`;function gw(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(sn).matches}function _w(){if(typeof document>`u`)return null;let e=document.activeElement;if(!e||!(e instanceof Element))return null;let t=e.closest(`[data-panel-kind]`);return t?t.getAttribute(`data-panel-kind`):null}function vw(){return{key:`S`,scope:`global`,when:()=>{let e=B();return!(gw()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>{let e=_w();if(e===null){H({type:`SHOW_STATUS_TOAST`,text:hw});return}if(!re.has(e))return;let t=e;H(R(t,`${t}-panel`))}}}function yw(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(sn).matches}function bw(){return{key:`B`,scope:`global`,when:()=>{let e=B();return!(yw()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>H(pe())}}function xw(){return[bw()]}ft(),et(),Vt(),MC();var Sw=()=>{let e=B();return!e.update.modalOpen&&!e.doctorModalOpen};Bt([{key:`1`,scope:`global`,when:Sw,action:()=>mw(1)},{key:`2`,scope:`global`,when:Sw,action:()=>mw(2)},{key:`3`,scope:`global`,when:Sw,action:()=>mw(3)},{key:`4`,scope:`global`,when:Sw,action:()=>mw(4)},{key:`5`,scope:`global`,when:Sw,action:()=>mw(5)},{key:`6`,scope:`global`,when:Sw,action:()=>mw(6)},{key:`7`,scope:`global`,when:Sw,action:()=>mw(7)},{key:`8`,scope:`global`,when:Sw,action:()=>mw(8)},{key:`9`,scope:`global`,when:Sw,action:()=>mw(9)},{key:`0`,scope:`global`,when:Sw,action:()=>mw(10)},{key:`r`,scope:`global`,when:Sw,action:()=>Dt()},{key:`q`,scope:`global`,when:Sw,action:Pt},{key:`n`,scope:`global`,when:Sw,action:()=>Mt(1)},{key:`N`,scope:`global`,when:Sw,action:()=>Mt(-1)},{key:`d`,scope:`global`,view:`any`,when:()=>{let e=B();return!(e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>H({type:`OPEN_DOCTOR_MODAL`})},vw(),...xw(),{key:`c`,scope:`sessions`,when:()=>!B().openModal,action:()=>{let e=B().prefs.sessionsCollapsed;H({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!e}})}}]);var Cw=document.getElementById(`root`);if(!Cw)throw Error(`missing #root`);(0,v.createRoot)(Cw).render((0,U.jsx)(_.StrictMode,{children:(0,U.jsx)(pw,{})}));
65
+ `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>80?`${t.slice(0,80).trimEnd()}…`:t}function FC(e){let t=e.match(/<summary>([\s\S]*?)<\/summary>/);return PC(t?t[1]:e)}function IC({item:e,className:t=``,style:n},r){let i=e=>`conv-item ${e}${t?` ${t}`:``}`,a=tS(),o=e.ts?A.timeHHmm(e.ts,a,{noSuffix:!0}):null,s=o&&o!==`—`?o:null,c=s?(0,U.jsxs)(`span`,{className:`conv-item-time`,title:e.ts??void 0,children:[`· `,s]}):null;if(e.kind===`tool_result`)return(0,U.jsx)(`div`,{ref:r,className:i(`conv-item--tool_result`),style:n,"data-uuid":e.anchor.uuid,children:(0,U.jsxs)(`details`,{className:`conv-chip conv-chip--result`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,U.jsx)($b,{}),` Tool result`,(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid,className:`conv-chip-permalink`}),c]}),(0,U.jsx)(`div`,{className:`conv-chip-body`,children:(0,U.jsx)(vC,{blocks:e.blocks,anchorUuid:e.anchor.uuid})})]})});if(e.kind===`assistant`){let t=typeof e.cost_usd==`number`&&e.cost_usd>0,a=`tokens`in e?e.tokens:void 0;return(0,U.jsxs)(`div`,{ref:r,className:i(`conv-item--assistant`),style:n,"data-uuid":e.anchor.uuid,children:[(0,U.jsxs)(`div`,{className:`conv-item-head`,children:[(0,U.jsx)(`span`,{className:`conv-item-label`,children:`Assistant`}),e.model&&(0,U.jsx)(`span`,{className:`chip ${dn(e.model)}`,children:e.model}),c]}),(0,U.jsx)(vC,{blocks:e.blocks,anchorUuid:e.anchor.uuid}),e.text&&(0,U.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,U.jsx)(yx,{text:e.text})]}),(t||a)&&(0,U.jsxs)(`div`,{className:`conv-item-cost`,title:a?`input ${a.input} · output ${a.output} · cache create ${a.cache_creation} · cache read ${a.cache_read}`:void 0,children:[t&&`$${e.cost_usd.toFixed(4)}`,a&&(0,U.jsxs)(U.Fragment,{children:[t?` · `:``,`in `,A.tokens(a.input),` · out `,A.tokens(a.output),` · cache `,A.tokens(a.cache_creation+a.cache_read)]})]})]})}if(e.kind===`meta`){let t=e.meta_kind,a=t===`skill`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(qb,{}),` `,(0,U.jsx)(`span`,{className:`conv-meta-label`,children:`Skill content`}),e.skill_name&&(0,U.jsxs)(`span`,{className:`conv-meta-name`,children:[`· `,e.skill_name]})]}):t===`command`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kb,{}),` `,(0,U.jsx)(`span`,{className:`conv-meta-label`,children:`System marker`})]}):t===`compaction`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kb,{}),` `,(0,U.jsx)(`span`,{className:`conv-meta-label`,children:`Compacted earlier conversation`})]}):t===`notification`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kb,{}),` `,(0,U.jsx)(`span`,{className:`conv-meta-label`,children:`Background task`}),(0,U.jsx)(`span`,{className:`conv-meta-preview`,children:FC(e.text)})]}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Kb,{}),` `,(0,U.jsx)(`span`,{className:`conv-meta-label`,children:`Injected context`}),(0,U.jsx)(`span`,{className:`conv-meta-preview`,children:PC(e.text)})]});return(0,U.jsx)(`div`,{ref:r,className:i(`conv-item--meta`),style:n,"data-uuid":e.anchor.uuid,children:(0,U.jsxs)(`details`,{className:`conv-meta conv-meta--${t}`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),a,c]}),t===`command`?(0,U.jsx)(`pre`,{className:`conv-meta-body conv-meta-body--pre`,children:e.text}):(0,U.jsxs)(`div`,{className:`conv-meta-body`,children:[(0,U.jsx)(vC,{blocks:e.blocks,anchorUuid:e.anchor.uuid}),t===`skill`&&e.text&&(0,U.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,U.jsx)(yx,{text:e.text})]})]})]})})}if(Kl(e.text)&&e.blocks.every(e=>e.kind===`text`))return(0,U.jsx)(`div`,{ref:r,className:i(`conv-item--system`),style:n,"data-uuid":e.anchor.uuid,children:(0,U.jsxs)(`details`,{className:`conv-system-marker`,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,U.jsx)(Kb,{}),` System marker`,(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid,className:`conv-chip-permalink`})]}),(0,U.jsx)(`pre`,{className:`conv-system-marker-body`,children:e.text})]})});let l=`command_name`in e?e.command_name:null;return(0,U.jsxs)(`div`,{ref:r,className:i(`conv-item--human`),style:n,"data-uuid":e.anchor.uuid,children:[(0,U.jsxs)(`div`,{className:`conv-item-head`,children:[(0,U.jsx)(`span`,{className:`conv-item-label`,children:`You`}),l&&(0,U.jsx)(`span`,{className:`conv-cmd-badge`,children:l}),c]}),e.text&&(0,U.jsx)(kx,{children:e.text}),(0,U.jsx)(vC,{blocks:e.blocks.filter(e=>e.kind!==`text`),anchorUuid:e.anchor.uuid}),e.text&&(0,U.jsxs)(`div`,{className:`conv-item-actions`,children:[(0,U.jsx)(NC,{sessionId:e.anchor.session_id,uuid:e.anchor.uuid}),(0,U.jsx)(yx,{text:e.text})]})]})}var LC=(0,_.memo)((0,_.forwardRef)(IC)),RC=60;function zC(e){return e==null?null:e===`completed`?(0,U.jsx)(`span`,{className:`conv-subagent-ok`,"aria-label":`completed`,title:`completed`,children:`✓`}):e===`error`?(0,U.jsxs)(`span`,{className:`conv-subagent-err`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`✕`}),` error`]}):(0,U.jsxs)(`span`,{className:`conv-subagent-warn`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`⚠`}),` `,e]})}function BC(e,t){let n=((e.find(e=>e.kind!==`meta`)??e[0])?.text??``).split(`
66
+ `).map(e=>e.trim()).find(e=>e.length>0)??``;return n?n.length>RC?`${n.slice(0,RC).trimEnd()}…`:n:`Subagent ${t}`}function VC({subagentKey:e,items:t,nested:n,meta:r,getItemRef:i,rootUuid:a,getCardRef:o,onOpenChange:s,forceOpen:c=!1,riseClassName:l=``,riseStyle:u}){let[d,f]=(0,_.useState)(!1),p=d||c;(0,_.useEffect)(()=>{c&&(f(!0),s?.(e,!0))},[c]);let m=BC(t,e),h=t.reduce((e,t)=>e+(`cost_usd`in t?t.cost_usd??0:0),0),g=[...new Set(t.map(e=>`model`in e?e.model:null).filter(Boolean))];return(0,U.jsxs)(`details`,{"data-uuid":a,ref:a!=null&&o?o(a):void 0,className:[n?`conv-sidechain conv-sidechain--nested`:`conv-sidechain`,c?`conv-sidechain--force`:``,l].filter(Boolean).join(` `),style:u,open:p,onToggle:t=>{let n=t.currentTarget.open;f(n),s?.(e,n)},children:[(0,U.jsxs)(`summary`,{className:`conv-sidechain-head`,children:[(0,U.jsx)(`span`,{className:`conv-sidechain-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(Gb,{})}),(0,U.jsxs)(`span`,{className:`conv-sidechain-headtext`,children:[(0,U.jsxs)(`span`,{className:`conv-sidechain-kind`,children:[`Subagent`,r?.kind?(0,U.jsxs)(`span`,{className:`conv-sidechain-kindname`,children:[` · `,r.kind]}):null]}),(0,U.jsx)(`span`,{className:`conv-sidechain-title`,children:m}),r&&(r.total_tokens!=null||r.total_duration_ms!=null||r.total_tool_use_count!=null||r.status!=null)&&(0,U.jsxs)(`span`,{className:`conv-sidechain-submeta`,children:[r.total_tokens!=null&&(0,U.jsxs)(`span`,{children:[A.compact(r.total_tokens),` tok`]}),r.total_duration_ms!=null&&(0,U.jsx)(`span`,{children:A.durationMs(r.total_duration_ms)}),r.total_tool_use_count!=null&&(0,U.jsxs)(`span`,{children:[r.total_tool_use_count,` `,r.total_tool_use_count===1?`tool`:`tools`]}),zC(r.status)]})]}),(0,U.jsxs)(`span`,{className:`conv-sidechain-meta`,children:[g.length>0&&(0,U.jsx)(`span`,{className:`conv-sidechain-model`,children:g.join(`, `)}),(0,U.jsxs)(`span`,{children:[t.length,` msgs`]}),(0,U.jsx)(`span`,{className:`conv-sidechain-cost`,children:A.usd2(h)}),(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`})]})]}),(0,U.jsx)(`div`,{className:`conv-sidechain-body`,children:t.map(e=>(0,U.jsx)(LC,{item:e,ref:p&&i?i(e):void 0},e.anchor.uuid))})]})}function HC(e){return e.blocks.some(e=>e.kind===`tool_call`&&!!e.result?.is_error||e.kind===`tool_result`&&e.is_error)}function UC(e){return e.text.trim()!==``||e.blocks.some(e=>e.kind===`thinking`)}function WC(e,t){if(t===`all`)return!0;if(e.kind===`subagent`||e.kind===`tool_result_run`)return t===`errors`&&e.items.some(HC);let n=e.item;return t===`prompts`?n.kind===`human`:t===`errors`?HC(n):n.kind===`human`?!0:n.kind===`assistant`?UC(n):!1}function GC(e){return e.kind===`hidden_run`?e.firstUuid:e.kind===`item`?e.item.anchor.uuid:e.items[0].anchor.uuid}function KC(e,t){if(t===`all`)return e;let n=[],r=[],i=()=>{r.length&&n.push({kind:`hidden_run`,count:r.length,firstUuid:GC(r[0])}),r=[]};for(let a of e)WC(a,t)?(i(),n.push(a)):r.push(a);return i(),n}var qC=600;function JC(e){return e.kind===`hidden_run`?null:e.kind===`item`?e.item.ts??null:e.items[0]?.ts??null}function YC(e,t){let n=[],r=null,i=new Intl.DateTimeFormat(`en-US`,{timeZone:t.tz,month:`short`,day:`2-digit`}),a=e=>i.format(e);for(let t of e){let e=JC(t),i=e?new Date(e):null,o=i!=null&&!isNaN(i.getTime());if(o&&r){let t=(i.getTime()-r.getTime())/1e3,o=a(i)!==a(r);t>=0&&(t>=qC||o)&&n.push({kind:`time_marker`,gapSeconds:t>=qC?t:null,dayLabel:o?a(i):null,key:`tm-${n.length}-${e}`})}o&&(r=i),n.push(t)}return n}function XC(e,t){if(t===`all`)return!0;let n=(e.tools??[]).some(e=>e.is_error);return e.is_sidechain?t===`errors`&&n:t===`prompts`?e.kind===`human`:t===`errors`?n:e.kind===`human`?!0:e.kind===`assistant`?e.label.trim()!==``||(e.thinking?.length??0)>0:!1}var ZC=new Set([`ExitPlanMode`,`AskUserQuestion`]);function QC(e){let t=[],n=[],r=[],i=[],a=new Map,o=new Set;return e.forEach((e,s)=>{a.set(e.uuid,s),e.tools?.some(e=>e.is_error)&&t.push(s),e.kind===`human`&&n.push(s),e.subagent_key!=null&&!o.has(e.subagent_key)&&(o.add(e.subagent_key),r.push(s)),e.tools?.some(e=>e.name!=null&&ZC.has(e.name))&&i.push(s)}),{error:t,prompt:n,subagent:r,plan:i,indexByUuid:a}}function $C(e,t,n){if(n===1){for(let n of e)if(n>t)return n;return null}for(let n=e.length-1;n>=0;n--)if(e[n]<t)return e[n];return null}var ew=/^\s*(?:<((?:local-)?command-[a-z-]+)>(?:(?!<\/\1>)[\s\S])*<\/\1>\s*)+$/,tw=e=>ew.test(e);function nw(e){for(let t of e.items)if(t.kind===`human`&&!t.is_sidechain&&t.text.trim()&&!Kl(t.text)&&!tw(t.text)){let e=t.text.split(`
67
+ `).map(e=>e.trim()).find(Boolean);if(e)return e.length>120?e.slice(0,120).trimEnd()+`…`:e}return e.project_label||e.session_id}function rw({sessionId:e,mobileBack:t,outline:n}){let{detail:r,loading:i,error:a,hasMore:o,loadMore:s,loadUntil:c}=Hl(e),l=(0,_.useSyncExternalStore)(V,()=>B().conversationJump),u=(0,_.useSyncExternalStore)(V,()=>B().convOutlineOpen),d=(0,_.useSyncExternalStore)(V,()=>B().convFocusMode),f=(0,_.useSyncExternalStore)(V,()=>B().convCurrentTurnUuid),p=(0,_.useSyncExternalStore)(V,()=>B().convPinnedUuid),m=(0,_.useSyncExternalStore)(V,()=>B().convFindOpen),[h,g]=(0,_.useState)(null),v=(0,_.useRef)(null),y=jo(),b=(0,_.useRef)(null),x=(0,_.useRef)(new Map),S=(0,_.useRef)(new Map),C=(0,_.useRef)(new Map),w=(0,_.useRef)(new Map),T=(0,_.useRef)(null),[E,D]=(0,_.useState)(null),O=(0,_.useRef)(new Set),[k,j]=(0,_.useState)(0),M=(0,_.useRef)(0);M.current=k;let N=(0,_.useRef)([]),P=(0,_.useRef)(null),F=(0,_.useRef)(null),ee=(0,_.useRef)(o);ee.current=o;let te=(0,_.useRef)(s);te.current=s;let ne=(0,_.useRef)(y);ne.current=y;let I=(0,_.useRef)(n);I.current=n;let re=(0,_.useRef)(f);re.current=f;let ie=(0,_.useRef)(p);ie.current=p;let ae=(0,_.useRef)(d);ae.current=d;let oe=(0,_.useRef)(e);oe.current=e;let se=(0,_.useRef)(m);se.current=m;let L=(0,_.useRef)(!0),ce=(0,_.useRef)(0),le=(0,_.useRef)(!1),[ue,de]=(0,_.useState)(0),R=(0,_.useRef)(new Set),fe=(0,_.useRef)(new Set),pe=(0,_.useCallback)((e,t)=>{t?R.current.add(e):R.current.delete(e)},[]),[me,he]=(0,_.useState)(!1),ge=(0,_.useRef)(null),_e=(0,_.useCallback)(()=>{let e=F.current;if(!e)return;let t=e.scrollTop+e.clientHeight>=e.scrollHeight-80;L.current=t,t&&de(e=>e&&0);let n=P.current,r=F.current;if(n&&r){let e=r.getBoundingClientRect().top,t=null;for(let r of Array.from(n.children)){let n=r.getBoundingClientRect();if(n.top<=e+1&&n.bottom>e+1){t=r;break}}t&&e-t.getBoundingClientRect().top>160?(ge.current=t,he(!0)):(ge.current=null,he(!1))}},[]),ve=(0,_.useCallback)(()=>{ge.current?.scrollIntoView({block:`start`,behavior:ne.current?`auto`:`smooth`}),he(!1),H({type:`CLEAR_CONV_PIN`})},[]);(0,_.useLayoutEffect)(()=>{let e=F.current,t=r?.items??[],n=t.length,i=ce.current,a=n-i,s=a>0&&le.current===!1&&i>0,c=a>0?t.slice(i):[],l=0;if(s){let e=new Set;for(let t of c){let n=t.subagent_key;n==null?l++:fe.current.has(n)?R.current.has(n)&&l++:e.has(n)||(l++,e.add(n))}}for(let e of c)e.subagent_key!=null&&fe.current.add(e.subagent_key);e&&s&&(L.current&&l>0?e.scrollTo({top:e.scrollHeight}):l>0&&de(e=>e+l)),ce.current=n,le.current=o},[r?.items.length,o]);let ye=(0,_.useCallback)(()=>{let e=F.current;e&&(e.scrollTo({top:e.scrollHeight,behavior:ne.current?`auto`:`smooth`}),de(0),H({type:`CLEAR_CONV_PIN`}))},[]),be=(0,_.useMemo)(()=>Wl(r?.items??[]),[r?.items]),xe=(0,_.useMemo)(()=>KC(be,d),[be,d]),Se=Wt(),Ce=(0,_.useMemo)(()=>({tz:Se.resolvedTz,offsetLabel:Se.offsetLabel}),[Se.resolvedTz,Se.offsetLabel]),we=(0,_.useMemo)(()=>YC(xe,Ce),[xe,Ce]),Te=(0,_.useRef)(be);Te.current=be;let Ee=(0,_.useMemo)(()=>r?nw(r):``,[r]),De=(0,_.useMemo)(()=>({sessionId:e,focusMode:d,fmtCtx:Ce}),[e,d,Ce]);(0,_.useEffect)(()=>{if(!b.current||!o)return;let e=new IntersectionObserver(e=>{e[0].isIntersecting&&s()});return e.observe(b.current),()=>e.disconnect()},[o,s]),(0,_.useEffect)(()=>{let e=F.current;if(!e||typeof IntersectionObserver>`u`)return;let t=new Set,n=new IntersectionObserver(e=>{for(let n of e)n.isIntersecting?t.add(n.target):t.delete(n.target);let n=null,r=1/0;for(let e of t){let t=e.getBoundingClientRect().top;t<r&&(r=t,n=e)}let i=n?.getAttribute(`data-uuid`);i&&H({type:`SET_CONV_CURRENT_TURN`,uuid:i})},{root:e,threshold:0}),r=new Set;for(let e of x.current.values())r.has(e)||(r.add(e),n.observe(e));for(let e of S.current.values())r.has(e)||(r.add(e),n.observe(e));return()=>n.disconnect()},[xe]),(0,_.useEffect)(()=>{if(!l||l.session_id!==e){E!==null&&D(null);return}if(!r||r.session_id!==e)return;let t=!1;return(async()=>{if(await c(l.uuid),t)return;let e=x.current.get(l.uuid)??S.current.get(l.uuid);if(e){l.expand_details&&e.querySelectorAll(`details:not([open])`).forEach(e=>{e.open=!0}),e.scrollIntoView({behavior:y?`auto`:`smooth`,block:`center`}),e.classList.add(`conv-item--jumped`),H({type:`SET_CONV_PINNED_TURN`,uuid:l.uuid});let t=P.current;if(t){let n=Array.prototype.indexOf.call(t.children,e);n>=0&&j(n)}T.current!=null&&window.clearTimeout(T.current),T.current=window.setTimeout(()=>{e.classList.remove(`conv-item--jumped`),T.current=null},2e3),H({type:`CLEAR_CONVERSATION_JUMP`}),D(null);return}let n=ae.current;if(n!==`all`){let e=Te.current.find(e=>GC(e)===l.uuid||e.kind===`item`&&e.item.member_uuids.includes(l.uuid));if(e!=null&&!WC(e,n)){H({type:`SET_CONV_FOCUS_MODE`,mode:`all`});return}}let i=r.items.find(e=>e.member_uuids.includes(l.uuid));if(i&&i.subagent_key!=null&&E!==i.subagent_key){D(i.subagent_key);return}o||H({type:`CLEAR_CONVERSATION_JUMP`})})(),()=>{t=!0}},[l,e,r?.items.length,o,E,d]),(0,_.useEffect)(()=>()=>{T.current!=null&&window.clearTimeout(T.current)},[]),(0,_.useEffect)(()=>{let e=F.current;if(!e)return;let t=()=>H({type:`CLEAR_CONV_PIN`}),n=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]),r=e=>{n.has(e.key)&&t()};return e.addEventListener(`wheel`,t,{passive:!0}),e.addEventListener(`touchmove`,t,{passive:!0}),e.addEventListener(`keydown`,r),()=>{e.removeEventListener(`wheel`,t),e.removeEventListener(`touchmove`,t),e.removeEventListener(`keydown`,r)}},[r!=null]),(0,_.useEffect)(()=>()=>{C.current.clear(),w.current.clear(),S.current.clear()},[e]),(0,_.useEffect)(()=>{D(null)},[e]),(0,_.useEffect)(()=>{de(0),L.current=!0,he(!1),ge.current=null,R.current.clear(),fe.current.clear()},[e]),(0,_.useEffect)(()=>{O.current.clear()},[e]),(0,_.useEffect)(()=>{for(let e of be){let t=e.kind===`subagent`||e.kind===`tool_result_run`?e.items[0]?.anchor.uuid:e.item.anchor.uuid;t&&O.current.add(t)}},[be]);let Oe=(0,_.useCallback)((t,n,r)=>y||O.current.has(t)||l!=null&&l.session_id===e&&n.includes(l.uuid)?[``,void 0]:[`conv-rise`,{animationDelay:O.current.size===0?`${r*40}ms`:`0ms`}],[y,l,e]),ke=(0,_.useCallback)(e=>{let t=C.current,n=e.anchor.uuid,r=t.get(n);return r||(r=t=>{for(let n of e.member_uuids)t?x.current.set(n,t):x.current.delete(n)},t.set(n,r)),r},[]),Ae=(0,_.useCallback)(e=>{let t=w.current,n=t.get(e);return n||(n=t=>{t?S.current.set(e,t):S.current.delete(e)},t.set(e,n)),n},[]);(0,_.useEffect)(()=>{j(0)},[e]),(0,_.useEffect)(()=>{let e=P.current;if(!e)return;let t=e.children;for(let e=0;e<t.length;e++){let n=t[e].dataset.convMarker!=null;t[e].classList.toggle(`conv-item--focused`,e===k&&!n)}},[k,xe]),(0,_.useEffect)(()=>{let e=N.current,t=M.current,n=e[t];if(!n)return;let r=e=>e.kind===`time_marker`?null:GC(e),i=r(n),a=i==null?-1:we.findIndex(e=>r(e)===i);if(a<0)for(let n=t+1;n<e.length;n++){let t=r(e[n]);if(t==null)continue;let i=we.findIndex(e=>r(e)===t);if(i>=0){a=i;break}}a<0&&(a=we.length-1);let o=e=>{let t=we[e];return t!=null&&(t.kind===`time_marker`||t.kind===`hidden_run`)};if(a>=0&&o(a)){let e=a;for(;e<we.length&&o(e);)e++;if(e>=we.length)for(e=a;e>=0&&o(e);)e--;a=e}a<0&&(a=0),j(a)},[d]),(0,_.useEffect)(()=>{N.current=we},[we]);let z=(0,_.useCallback)(e=>{let t=P.current;if(!t)return;let n=t.children.length-1;if(n<0)return;let r=M.current,i=e>=0?1:-1,a=r+e;for(;a>=0&&a<=n&&t.children[a].dataset.convMarker!=null;)a+=i;if(a=Math.max(0,Math.min(n,a)),t.children[a]?.dataset.convMarker==null){if(e>0&&r===n&&ee.current){te.current();return}a!==r&&(H({type:`CLEAR_CONV_PIN`}),j(a),t.children[a]?.scrollIntoView({block:`nearest`,behavior:ne.current?`auto`:`smooth`}))}},[]),je=(0,_.useCallback)(e=>{let t=P.current;if(!t)return;t.classList.add(`conv-reader-thread--bulk`),t.querySelectorAll(`details`).forEach(t=>{t.open=e});let n=()=>t.classList.remove(`conv-reader-thread--bulk`);typeof requestAnimationFrame==`function`?requestAnimationFrame(n):n()},[]),Me=(0,_.useCallback)(()=>{F.current?.scrollTo({top:0,behavior:ne.current?`auto`:`smooth`}),j(0),H({type:`CLEAR_CONV_PIN`})},[]),{indexByUuid:Ne,...Pe}=(0,_.useMemo)(()=>QC(n?.turns??[]),[n]),Fe=(0,_.useRef)(Pe);Fe.current=Pe;let Ie=(0,_.useRef)(Ne);Ie.current=Ne;let Le=(0,_.useCallback)(e=>{if(ne.current)return;let t=document.querySelector(`[data-jump-kind="${e}"]`);t&&(t.classList.add(`conv-pulse-disabled`),window.setTimeout(()=>t.classList.remove(`conv-pulse-disabled`),300))},[]),Re=(0,_.useCallback)((e,t)=>{let n=I.current?.turns??[];if(n.length===0)return;let r=Fe.current[e],i=Ie.current,a=-1,o=ie.current??re.current;if(o!=null&&i.has(o))a=i.get(o);else{let e=(P.current?.children[M.current])?.getAttribute(`data-uuid`);e!=null&&i.has(e)&&(a=i.get(e))}let s=$C(r,a,t);if(s==null){Le(e);return}let c=n[s],l=ae.current;if(l!==`all`){let e=Te.current.find(e=>GC(e)===c.uuid||e.kind===`item`&&e.item.member_uuids.includes(c.uuid));(e==null||!WC(e,l))&&H({type:`SET_CONV_FOCUS_MODE`,mode:`all`})}H({type:`OPEN_CONVERSATION`,sessionId:oe.current,jump:{session_id:oe.current,uuid:c.uuid}})},[Le]),ze=(0,_.useRef)(Re);ze.current=Re;let Be=(0,_.useCallback)(e=>{let t=e.split(/\s+/).filter(Boolean);g(t.length?t:null)},[]),Ve=(0,_.useCallback)(()=>{g(null),P.current?.focus?.()},[]);(0,_.useEffect)(()=>{m||g(null)},[m]);let He=(0,_.useCallback)(()=>{let e=[`all`,`chat`,`prompts`,`errors`],t=ae.current,n=e[(e.indexOf(t)+1)%e.length];H({type:`SET_CONV_FOCUS_MODE`,mode:n})},[]);return Ht((0,_.useMemo)(()=>{let e=()=>!B().openModal&&B().inputMode===null,t=(t,n)=>({key:t,scope:`global`,view:`conversations`,when:e,action:n});return[t(`j`,()=>z(1)),t(`k`,()=>z(-1)),t(`[`,()=>je(!1)),t(`]`,()=>je(!0)),t(`g`,()=>Me()),t(`o`,()=>H({type:`TOGGLE_CONV_OUTLINE`})),t(`e`,()=>ze.current(`error`,1)),t(`E`,()=>ze.current(`error`,-1)),t(`u`,()=>ze.current(`prompt`,1)),t(`U`,()=>ze.current(`prompt`,-1)),t(`b`,()=>ze.current(`subagent`,1)),t(`B`,()=>ze.current(`subagent`,-1)),t(`p`,()=>ze.current(`plan`,1)),t(`P`,()=>ze.current(`plan`,-1)),t(`v`,()=>He()),{key:`n`,scope:`global`,view:`conversations`,when:()=>e()&&se.current,action:()=>v.current?.(1)},{key:`N`,scope:`global`,view:`conversations`,when:()=>e()&&se.current,action:()=>v.current?.(-1)}]},[])),i&&!r?(0,U.jsx)(`div`,{className:`conv-reader conv-reader--loading`,children:(0,U.jsxs)(`div`,{className:`conv-state`,children:[(0,U.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(ox,{})}),(0,U.jsx)(`div`,{className:`conv-state-title`,children:`Loading conversation…`})]})}):a?(0,U.jsx)(`div`,{className:`conv-reader conv-reader--error`,children:(0,U.jsxs)(`div`,{className:`conv-state`,children:[(0,U.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(sx,{})}),(0,U.jsx)(`div`,{className:`conv-state-title`,children:a})]})}):r?(0,U.jsxs)(`div`,{className:`conv-reader`,children:[(0,U.jsxs)(`div`,{className:`conv-reader-head`,children:[t&&(0,U.jsx)(`button`,{type:`button`,className:`conv-back`,onClick:()=>H({type:`SELECT_CONVERSATION`,sessionId:null}),children:`← Back`}),(0,U.jsxs)(`div`,{className:`conv-reader-headmain`,children:[(0,U.jsx)(`div`,{className:`conv-reader-title`,children:Ee||r.session_id}),(0,U.jsxs)(`div`,{className:`conv-reader-meta`,children:[r.project_label||`—`,` · `,r.git_branch??`—`,` · `,A.usd2(r.cost_usd),` · `,r.models.join(`, `)]})]}),(0,U.jsxs)(`div`,{className:`conv-reader-controls`,children:[(0,U.jsx)(`div`,{className:`conv-focus-seg`,role:`radiogroup`,"aria-label":`Focus mode`,children:[`all`,`chat`,`prompts`,`errors`].map(e=>{let t={all:`All`,chat:`Chat`,prompts:`Prompts`,errors:`Errors`},r=n?.stats.error_count??0;return(0,U.jsxs)(`button`,{type:`button`,className:[`conv-focus-seg-btn`,d===e?`conv-focus-seg-btn--on`:``].filter(Boolean).join(` `),role:`radio`,"aria-checked":d===e,onClick:()=>H({type:`SET_CONV_FOCUS_MODE`,mode:e}),children:[t[e],e===`errors`&&r>0&&(0,U.jsx)(`span`,{className:`conv-focus-seg-badge`,children:r})]},e)})}),(0,U.jsx)(`button`,{type:`button`,className:`conv-outline-toggle`,"aria-pressed":u,"aria-label":`Toggle session outline`,title:`Toggle session outline (o)`,onClick:()=>H({type:`TOGGLE_CONV_OUTLINE`}),children:`☰ Outline`})]})]}),m&&(0,U.jsx)(Yl,{sessionId:e,onClose:Ve,onTermsChange:Be,stepRef:v}),(0,U.jsxs)(`div`,{className:`conv-reader-body`,ref:F,onScroll:_e,children:[(0,U.jsx)(Xl.Provider,{value:h,children:(0,U.jsx)(Qx.Provider,{value:De,children:(0,U.jsx)(`div`,{className:`conv-reader-thread`,ref:P,children:we.map((t,n)=>{if(t.kind===`time_marker`){let e=t.gapSeconds==null?null:`⏸ ${A.gapDuration(t.gapSeconds)} later`;return(0,U.jsx)(`div`,{className:`conv-time-marker`,"data-conv-marker":``,role:`separator`,children:e&&t.dayLabel?`${e} · ${t.dayLabel}`:e||`— ${t.dayLabel} —`},t.key)}if(t.kind===`hidden_run`)return(0,U.jsxs)(`button`,{type:`button`,className:`conv-hidden-run`,"data-conv-marker":``,onClick:()=>{H({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),H({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t.firstUuid}})},children:[`· `,t.count,` hidden ·`]},`hr-${t.firstUuid}`);if(t.kind===`subagent`){let i=t.items.flatMap(e=>e.member_uuids),[a,o]=Oe(t.items[0].anchor.uuid,i,n);return(0,U.jsx)(VC,{subagentKey:t.subagentKey,items:t.items,nested:t.nested,meta:r.subagent_meta?.[t.subagentKey],getItemRef:ke,rootUuid:t.items[0].anchor.uuid,getCardRef:Ae,onOpenChange:pe,forceOpen:r.session_id===e&&t.subagentKey===E,riseClassName:a,riseStyle:o},`sc-${t.subagentKey}`)}if(t.kind===`tool_result_run`){let e=t.items.flatMap(e=>e.member_uuids),[r,i]=Oe(t.items[0].anchor.uuid,e,n);return(0,U.jsxs)(`details`,{className:[`conv-toolresult-run`,r].filter(Boolean).join(` `),style:i,open:!0,children:[(0,U.jsxs)(`summary`,{children:[(0,U.jsx)(`span`,{className:`conv-chev`,"aria-hidden":`true`}),(0,U.jsx)($b,{}),` `,t.items.length,` tool results`]}),(0,U.jsx)(`div`,{className:`conv-toolresult-run-body`,children:t.items.map(e=>(0,U.jsx)(LC,{item:e,ref:ke(e)},e.anchor.uuid))})]},`trr-${t.items[0].anchor.uuid}`)}let[i,a]=Oe(t.item.anchor.uuid,t.item.member_uuids,n);return(0,U.jsx)(LC,{item:t.item,ref:ke(t.item),className:i,style:a},t.item.anchor.uuid)})})})}),o&&(0,U.jsx)(`div`,{ref:b,className:`conv-load-sentinel`,children:`Loading more…`})]}),ue>0&&!L.current&&(0,U.jsxs)(`button`,{type:`button`,className:`conv-new-pill`,onClick:ye,children:[`↓ `,ue,` new`]}),me&&(0,U.jsx)(`button`,{type:`button`,className:`conv-jump-top`,onClick:ve,title:`Jump to the start of this turn`,"aria-label":`Jump to the start of this turn`,children:`↑`})]}):(0,U.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:(0,U.jsxs)(`div`,{className:`conv-state`,children:[(0,U.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(cx,{})}),(0,U.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,U.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})})}var iw=new Set([`ExitPlanMode`]),aw=new Set([`AskUserQuestion`]),ow=/^#{1,6}\s+\S/;function sw(e,t){let n=new Map;for(let t of e)if(t.subagent_key!=null){let e=n.get(t.subagent_key);e?e.push(t):n.set(t.subagent_key,[t])}let r=[],i=new Map,a=new Set,o=new Map(e.map((e,t)=>[e.uuid,t])),s=null,c=null,l=()=>s==null?0:1,u=e=>{if(s!=null)for(let t of e.member_uuids)i.set(t,s)},d=e=>{let c=n.get(e),u=c.some(e=>e.tools?.some(e=>e.is_error));if(r.push({entryId:`sc:${e}`,uuid:c[0].uuid,type:`subagent`,label:`subagent · ${t?.[e]?.kind??`agent`}`,depth:l(),error:u,plan:!1,question:!1,thinkingCount:0,toolCount:c.reduce((e,t)=>e+(t.tools?.length??0),0),subagentKey:e,subagentKind:t?.[e]?.kind,turnIndex:o.get(c[0].uuid)??0}),a.add(e),s!=null)for(let e of c)for(let t of e.member_uuids)i.set(t,s)};for(let t of e){if(t.subagent_key!=null){a.has(t.subagent_key)||d(t.subagent_key);continue}let e=(t.tools??[]).some(e=>e.is_error),n=(t.tools??[]).some(e=>e.name!=null&&iw.has(e.name)),f=(t.tools??[]).some(e=>e.name!=null&&aw.has(e.name)),p=t.kind===`assistant`&&ow.test(t.label),m=t.tools?.length??0,h=t.thinking?.length??0;if(t.kind===`human`){s=t.uuid,i.set(t.uuid,t.uuid);for(let e of t.member_uuids)i.set(e,t.uuid);c={entryId:t.uuid,uuid:t.uuid,type:`human`,label:t.label,depth:0,error:!1,plan:!1,question:!1,thinkingCount:0,toolCount:m,turnIndex:o.get(t.uuid)??0},r.push(c);continue}if(t.kind===`meta`){u(t);continue}h>0&&c!=null&&(c.thinkingCount+=h),u(t);let g=null,_=``;if(e){g=`error`;let e=(t.tools??[]).find(e=>e.is_error)?.name;_=p?t.label:`tool error${e?` · ${e}`:``}`}else n?(g=`plan`,_=p?t.label:`plan`):f?(g=`question`,_=p?t.label:`question`):p&&(g=`heading`,_=t.label);g!=null&&r.push({entryId:t.uuid,uuid:t.uuid,type:g,label:_,depth:l(),error:e,plan:n,question:f,thinkingCount:0,toolCount:m,turnIndex:o.get(t.uuid)??0})}for(let e of n.keys())a.has(e)||d(e);return{entries:r,sectionByUuid:i}}function cw({sessionId:e,turns:t,lists:n,currentUuid:r,pinned:i,reduced:a,focusMode:o}){let{indexByUuid:s,...c}=n,l=(n,l,u)=>{let d=i??r,f=d!=null&&s.has(d)?s.get(d):-1,p=$C(c[n],f,l);if(p==null){a||(u.classList.add(`conv-pulse-disabled`),window.setTimeout(()=>u.classList.remove(`conv-pulse-disabled`),300));return}let m=t[p];o!==`all`&&!XC(m,o)&&H({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),H({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:m.uuid}})},u=[{kind:`error`,glyph:`✕`,label:`error turns`,aria:`error turn`,key:`e`},{kind:`prompt`,glyph:`⊕`,label:`prompts`,aria:`prompt`,key:`u`},{kind:`subagent`,glyph:`▸`,label:`subagents`,aria:`subagent`,key:`b`},{kind:`plan`,glyph:`⊞`,label:`plans`,aria:`plan / question`,key:`p`}].filter(e=>c[e.kind].length>0);return u.length===0?null:(0,U.jsxs)(`div`,{className:`conv-outline-jump`,children:[(0,U.jsx)(`div`,{className:`conv-outline-jump-label`,children:`Jump to`}),(0,U.jsx)(`div`,{className:`conv-jump-cluster`,role:`group`,"aria-label":`Jump to next landmark`,children:u.map(e=>(0,U.jsxs)(`button`,{type:`button`,className:`conv-jump-cluster-btn`,"data-jump-kind":e.kind,title:`Next ${e.aria} (${e.key}) · shift-click for previous`,"aria-label":`Next ${e.aria}, ${c[e.kind].length} total`,onClick:t=>l(e.kind,t.shiftKey?-1:1,t.currentTarget),children:[(0,U.jsx)(`span`,{className:`conv-jump-cluster-glyph`,"aria-hidden":`true`,children:e.glyph}),(0,U.jsx)(`span`,{className:`conv-jump-cluster-text`,children:e.label}),(0,U.jsx)(`span`,{className:`conv-jump-cluster-count`,children:c[e.kind].length})]},e.kind))})]})}function lw(e){if(e.error)return(0,U.jsx)(sx,{});if(e.plan)return(0,U.jsx)(ux,{});if(e.question)return(0,U.jsx)(lx,{});switch(e.type){case`human`:return(0,U.jsx)(cx,{});case`subagent`:return(0,U.jsx)(Gb,{});case`error`:return(0,U.jsx)(sx,{});case`plan`:return(0,U.jsx)(ux,{});case`question`:return(0,U.jsx)(lx,{});case`heading`:return(0,U.jsx)(Wb,{});default:return(0,U.jsx)(Wb,{})}}function uw({stats:e,errorTurns:t}){let n=e.turns.human,r=e.tokens.input+e.tokens.output+e.tokens.cache_creation+e.tokens.cache_read,i=(0,_.useMemo)(()=>Object.entries(e.tool_counts).sort((e,t)=>t[1]-e[1]),[e.tool_counts]),a=i.slice(0,3),o=i.length-a.length,s=i.map(([e,t])=>`${e} ×${t}`).join(`
68
+ `),c=(0,_.useMemo)(()=>Object.entries(e.models).sort((e,t)=>t[1]-e[1]),[e.models]),l=(()=>{let n=e.error_count,r=`${n} ${n===1?`error`:`errors`}`;return t===n?r:`${r} in ${t} turns`})();return(0,U.jsxs)(`div`,{className:`conv-outline-stats-body`,children:[(0,U.jsxs)(`div`,{className:`conv-outline-stats-headline`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stats-strong`,children:e.turns.total}),` turns`,` · `,(0,U.jsx)(`span`,{className:`conv-outline-stats-strong`,children:n}),` yours`]}),(0,U.jsxs)(`div`,{className:`conv-outline-stat-tiles`,children:[(0,U.jsxs)(`div`,{className:`conv-outline-stat-tile`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:A.hhmm(e.duration_seconds)}),(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Time`})]}),(0,U.jsxs)(`div`,{className:`conv-outline-stat-tile conv-outline-stat-tile--tokens`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:A.tokens(r)}),(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Tokens`})]}),(0,U.jsxs)(`div`,{className:`conv-outline-stat-tile conv-outline-stat-tile--cost`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-value`,children:A.usd2(e.cost_usd)}),(0,U.jsx)(`span`,{className:`conv-outline-stat-tile-label`,children:`Cost`})]})]}),c.length>0&&(0,U.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--models`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⬡`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Models`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-value`,children:c.map(([e,t])=>`${e} ×${t}`).join(`, `)})]}),a.length>0&&(0,U.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--tools`,title:s,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚙`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Tools`}),(0,U.jsxs)(`span`,{className:`conv-outline-stat-kv-value`,children:[a.map(([e,t])=>`${e} ×${t}`).join(` `),o>0?` +${o} more`:``]})]}),e.error_count>0&&(0,U.jsxs)(`div`,{className:`conv-outline-stat-kv conv-outline-stat-kv--errors`,children:[(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-glyph`,"aria-hidden":`true`,children:`⚠`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-label`,children:`Errors`}),(0,U.jsx)(`span`,{className:`conv-outline-stat-kv-value`,children:l})]})]})}function dw({sessionId:e,outline:t}){let n=(0,_.useSyncExternalStore)(V,()=>B().convCurrentTurnUuid),r=(0,_.useSyncExternalStore)(V,()=>B().convPinnedUuid),i=(0,_.useSyncExternalStore)(V,()=>B().convFocusMode),a=jo(),{entries:o,sectionByUuid:s}=(0,_.useMemo)(()=>t?sw(t.turns,t.subagent_meta):{entries:[],sectionByUuid:new Map},[t]),c=(0,_.useMemo)(()=>QC(t?.turns??[]),[t]),l=(0,_.useMemo)(()=>{let e=new Map;return(t?.turns??[]).forEach(t=>e.set(t.uuid,t)),e},[t]),u=t=>{let n=l.get(t);n&&i!==`all`&&!XC(n,i)&&H({type:`SET_CONV_FOCUS_MODE`,mode:`all`}),H({type:`OPEN_CONVERSATION`,sessionId:e,jump:{session_id:e,uuid:t}})},d=n==null?null:s.get(n)??null,f=(0,_.useRef)(null),p=r??n;return(0,_.useEffect)(()=>{p!=null&&(f.current?.querySelector(`[aria-current="true"]`))?.scrollIntoView({block:`nearest`,behavior:a?`auto`:`smooth`})},[p,a]),(0,U.jsx)(`nav`,{className:`conv-outline`,"aria-label":`Session outline`,children:t==null?(0,U.jsx)(`div`,{className:`conv-outline-placeholder`,children:`Loading outline…`}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`conv-outline-stats`,children:[(0,U.jsx)(uw,{stats:t.stats,errorTurns:c.error.length}),(0,U.jsx)(cw,{sessionId:e,turns:t.turns,lists:c,currentUuid:n,pinned:r,reduced:a,focusMode:i})]}),(0,U.jsx)(`ol`,{className:`conv-outline-list`,ref:f,children:o.map(e=>{let t=r==null?n!=null&&(e.uuid===n||e.type===`human`&&e.uuid===d):e.uuid===r;return(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,className:[`conv-outline-entry`,`conv-outline-entry--${e.type}`,e.depth?`conv-outline-entry--nested`:``,e.error?`conv-outline-entry--error`:``].filter(Boolean).join(` `),"aria-current":t?`true`:void 0,onClick:()=>u(e.uuid),title:e.label,children:[(0,U.jsx)(`span`,{className:`conv-outline-entry-glyph`,"aria-hidden":`true`,children:lw(e)}),(0,U.jsx)(`span`,{className:`conv-outline-entry-label`,children:e.label}),e.thinkingCount>0&&(0,U.jsxs)(`span`,{className:`conv-outline-entry-thinking`,title:`${e.thinkingCount} thinking ${e.thinkingCount===1?`block`:`blocks`}`,children:[`🧠 ×`,e.thinkingCount]})]})},e.entryId)})})]})})}function fw(){let e=(0,_.useSyncExternalStore)(V,()=>B().selectedConversationId),t=(0,_.useSyncExternalStore)(V,()=>B().convOutlineOpen),n=W(),r=cn(),{outline:i}=wl(e);return Ht(pw),bt(n)?r?(0,U.jsx)(`div`,{className:`conv-view conv-view--mobile`,children:e==null?(0,U.jsx)(Fl,{}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(rw,{sessionId:e,outline:i,mobileBack:!0}),t&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`button`,{type:`button`,className:`conv-outline-backdrop`,"aria-label":`Close outline`,onClick:()=>H({type:`TOGGLE_CONV_OUTLINE`})}),(0,U.jsx)(`div`,{className:`conv-outline-sheet`,children:(0,U.jsx)(dw,{sessionId:e,outline:i})})]})]})}):(0,U.jsxs)(`div`,{className:[`conv-view`,t&&e!=null?`conv-view--outline`:``].filter(Boolean).join(` `),children:[(0,U.jsx)(Fl,{}),e==null?(0,U.jsx)(`div`,{className:`conv-reader conv-reader--empty`,children:(0,U.jsxs)(`div`,{className:`conv-state`,children:[(0,U.jsx)(`span`,{className:`conv-state-glyph`,"aria-hidden":`true`,children:(0,U.jsx)(cx,{})}),(0,U.jsx)(`div`,{className:`conv-state-title`,children:`Select a conversation`}),(0,U.jsx)(`div`,{className:`conv-state-hint`,children:`Choose one from the list to start reading.`})]})}):(0,U.jsx)(rw,{sessionId:e,outline:i}),t&&e!=null&&(0,U.jsx)(dw,{sessionId:e,outline:i})]}):(0,U.jsxs)(`div`,{className:`conv-disabled`,children:[`Transcript viewing is disabled. Enable it with`,` `,(0,U.jsx)(`code`,{children:`cctally config set dashboard.expose_transcripts true`}),` `,`(loopback is always allowed; restart the dashboard to apply).`]})}var pw=[{key:`/`,scope:`global`,view:`conversations`,when:()=>!B().openModal&&B().inputMode===null,action:()=>{if(B().selectedConversationId){H({type:`OPEN_CONV_FIND`});return}let e=document.querySelector(`.conv-rail-search input`);e?.focus(),e?.select()}},{key:`Escape`,scope:`global`,view:`conversations`,when:()=>!B().openModal,action:()=>{if(B().conversationSearch){H({type:`SET_CONVERSATION_SEARCH`,text:``});return}H({type:`SET_VIEW`,view:`dashboard`})}}];function mw(){let e=(0,_.useSyncExternalStore)(V,()=>B().prefs.panelOrder),t=(0,_.useSyncExternalStore)(V,()=>B().view);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(kt,{}),t===`conversations`?(0,U.jsx)(fw,{}):(0,U.jsx)(Ro,{items:e,children:(0,U.jsx)(`div`,{className:`grid`,children:e.map((e,t)=>(0,U.jsx)(Mo,{id:e,index:t},e))})}),(0,U.jsx)(Ft,{}),(0,U.jsx)(Yn,{}),(0,U.jsx)(er,{}),(0,U.jsx)(Cc,{}),(0,U.jsx)(bl,{}),(0,U.jsx)(os,{}),(0,U.jsx)(Vo,{}),(0,U.jsx)(sr,{})]})}function hw(e){let t=B().prefs.panelOrder,n=e-1;if(n<0||n>=t.length)return;let r=Gn[t[n]];r&&r.openAction()}var gw=`Click a panel first, then press S to share it.`;function _w(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(sn).matches}function vw(){if(typeof document>`u`)return null;let e=document.activeElement;if(!e||!(e instanceof Element))return null;let t=e.closest(`[data-panel-kind]`);return t?t.getAttribute(`data-panel-kind`):null}function yw(){return{key:`S`,scope:`global`,when:()=>{let e=B();return!(_w()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>{let e=vw();if(e===null){H({type:`SHOW_STATUS_TOAST`,text:gw});return}if(!re.has(e))return;let t=e;H(R(t,`${t}-panel`))}}}function bw(){return typeof window>`u`||!window.matchMedia?!1:window.matchMedia(sn).matches}function xw(){return{key:`B`,scope:`global`,when:()=>{let e=B();return!(bw()||e.shareModal!==null||e.composerModal!==null||e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>H(pe())}}function Sw(){return[xw()]}ft(),et(),Vt(),MC();var Cw=()=>{let e=B();return!e.update.modalOpen&&!e.doctorModalOpen};Bt([{key:`1`,scope:`global`,when:Cw,action:()=>hw(1)},{key:`2`,scope:`global`,when:Cw,action:()=>hw(2)},{key:`3`,scope:`global`,when:Cw,action:()=>hw(3)},{key:`4`,scope:`global`,when:Cw,action:()=>hw(4)},{key:`5`,scope:`global`,when:Cw,action:()=>hw(5)},{key:`6`,scope:`global`,when:Cw,action:()=>hw(6)},{key:`7`,scope:`global`,when:Cw,action:()=>hw(7)},{key:`8`,scope:`global`,when:Cw,action:()=>hw(8)},{key:`9`,scope:`global`,when:Cw,action:()=>hw(9)},{key:`0`,scope:`global`,when:Cw,action:()=>hw(10)},{key:`r`,scope:`global`,when:Cw,action:()=>Dt()},{key:`q`,scope:`global`,when:Cw,action:Pt},{key:`n`,scope:`global`,when:Cw,action:()=>Mt(1)},{key:`N`,scope:`global`,when:Cw,action:()=>Mt(-1)},{key:`d`,scope:`global`,view:`any`,when:()=>{let e=B();return!(e.openModal!==null||e.update.modalOpen||e.inputMode!==null)},action:()=>H({type:`OPEN_DOCTOR_MODAL`})},yw(),...Sw(),{key:`c`,scope:`sessions`,when:()=>!B().openModal,action:()=>{let e=B().prefs.sessionsCollapsed;H({type:`SAVE_PREFS`,patch:{sessionsCollapsed:!e}})}}]);var ww=document.getElementById(`root`);if(!ww)throw Error(`missing #root`);(0,v.createRoot)(ww).render((0,U.jsx)(_.StrictMode,{children:(0,U.jsx)(mw,{})}));
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
6
6
  <title>cctally dashboard</title>
7
- <script type="module" crossorigin src="/static/assets/index-BswIdhEG.js"></script>
7
+ <script type="module" crossorigin src="/static/assets/index-qxISkiGC.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/static/assets/index-mPwkGfE9.css">
9
9
  </head>
10
10
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cctally",
3
- "version": "1.43.0",
3
+ "version": "1.43.1",
4
4
  "description": "Claude Code usage tracker and local dashboard for Pro/Max subscription limits - weekly cost-per-percent trend, quota forecasts, threshold alerts. ccusage-compatible.",
5
5
  "homepage": "https://github.com/omrikais/cctally",
6
6
  "repository": {