@dudko.dev/agent-web-react 0.0.32 → 0.0.34

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/dist/index.js CHANGED
@@ -192,6 +192,7 @@ var createInitialAgentState = () => ({
192
192
  events: [],
193
193
  seq: 0
194
194
  });
195
+ var BLOCKER_MARK = "[BLOCKER]";
195
196
  var resetRun = (state) => ({
196
197
  ...createInitialAgentState(),
197
198
  status: state.status,
@@ -695,7 +696,10 @@ var applyEvent = (state, event, ctx) => {
695
696
  ...event.model !== void 0 ? { model: event.model } : {},
696
697
  ...event.tierReason !== void 0 ? { tierReason: event.tierReason } : {}
697
698
  };
698
- return { ...state, steps: [...state.steps, view] };
699
+ const steps = state.steps.map(
700
+ (s) => s.total === event.total ? s : { ...s, total: event.total }
701
+ );
702
+ return { ...state, steps: [...steps, view] };
699
703
  }
700
704
  case "step.escalated":
701
705
  return {
@@ -733,7 +737,13 @@ var applyEvent = (state, event, ctx) => {
733
737
  case "step.text-delta":
734
738
  return {
735
739
  ...state,
736
- steps: patchStep(state.steps, event.step.id, (s) => ({ ...s, text: s.text + event.delta }))
740
+ // "[BLOCKER]" is the executor's signal to the core that a step cannot be completed (the
741
+ // core strips it from the step's summary): never a word for the user. Stripped from the
742
+ // text as it accumulates, so a marker split across two deltas goes too.
743
+ steps: patchStep(state.steps, event.step.id, (s) => ({
744
+ ...s,
745
+ text: (s.text + event.delta).split(BLOCKER_MARK).join("")
746
+ }))
737
747
  };
738
748
  case "step.tool-call": {
739
749
  const tagged = new Set(
@@ -1088,6 +1098,7 @@ var applyEvent = (state, event, ctx) => {
1088
1098
  return event.phase === "run" ? {
1089
1099
  ...withoutBusy(keepSubmitted(state)),
1090
1100
  error: event.error,
1101
+ errorCode: event.code,
1091
1102
  messages: finalizeAssistant(
1092
1103
  state.messages,
1093
1104
  state.finalText || `Error: ${event.error}`,
@@ -1169,7 +1180,8 @@ var agentStateReducer = (state, action) => {
1169
1180
  return {
1170
1181
  ...state,
1171
1182
  status: action.status,
1172
- error: action.status === "error" ? action.error : void 0
1183
+ error: action.status === "error" ? action.error : void 0,
1184
+ errorCode: void 0
1173
1185
  };
1174
1186
  case "remote": {
1175
1187
  const remote = action.remote;
@@ -2508,6 +2520,11 @@ var defaultLabels = {
2508
2520
  subagentNoTools: "no tools",
2509
2521
  approvalLeadHelper: (role) => role ? `The helper \u201C${role}\u201D wants to run` : "A helper the agent started wants to run",
2510
2522
  mediaImage: (path) => `Generated image ${path}`,
2523
+ imageOpen: (name) => `Open image ${name}`,
2524
+ imagePrevious: "Previous image",
2525
+ imageNext: "Next image",
2526
+ imageZoom: "Zoom",
2527
+ imageCount: (index, total) => `${index} of ${total}`,
2511
2528
  mediaAudio: (path) => `Generated audio ${path}`,
2512
2529
  mediaFile: (path) => `Generated file ${path}`,
2513
2530
  transcriptOf: (name) => `Transcript of ${name}`,
@@ -2797,11 +2814,128 @@ var useAgentContext = () => {
2797
2814
  var useOptionalAgentContext = () => useContext2(AgentContext);
2798
2815
 
2799
2816
  // src/components/AgentChat.tsx
2800
- import { useEffect as useEffect14, useRef as useRef9, useState as useState15 } from "react";
2801
- import { createPortal } from "react-dom";
2817
+ import { useEffect as useEffect16, useRef as useRef11, useState as useState16 } from "react";
2818
+ import { createPortal as createPortal2 } from "react-dom";
2819
+
2820
+ // src/hooks/use-follow-scroll.ts
2821
+ import { useEffect as useEffect6, useLayoutEffect, useRef as useRef5 } from "react";
2822
+
2823
+ // src/follow-scroll.ts
2824
+ var FOLLOW_REJOIN_PX = 80;
2825
+ var FOLLOW_LEAVE_PX = 2;
2826
+ var endGap = (m) => m.scrollHeight - m.scrollTop - m.clientHeight;
2827
+ var reach = (m) => Math.min(m.scrollTop, Math.max(0, m.scrollHeight - m.clientHeight));
2828
+ var followsAfterScroll = (following, before, now) => {
2829
+ if (before.scrollHeight !== now.scrollHeight || before.clientHeight !== now.clientHeight)
2830
+ return following;
2831
+ if (now.scrollTop < reach(before) - FOLLOW_LEAVE_PX) return false;
2832
+ if (now.scrollTop > before.scrollTop) return endGap(now) < FOLLOW_REJOIN_PX ? true : following;
2833
+ return following;
2834
+ };
2835
+ var followsAfterResize = (following, before, now) => following && !(now.clientHeight === before.clientHeight && now.scrollHeight >= before.scrollHeight && now.scrollTop < reach(before) - FOLLOW_LEAVE_PX);
2836
+
2837
+ // src/hooks/use-follow-scroll.ts
2838
+ var useIsoLayoutEffect = typeof window === "undefined" ? useEffect6 : useLayoutEffect;
2839
+ var measure = (el) => ({
2840
+ scrollTop: el.scrollTop,
2841
+ scrollHeight: el.scrollHeight,
2842
+ clientHeight: el.clientHeight
2843
+ });
2844
+ var anchorOf = (el) => {
2845
+ const box = el.getBoundingClientRect();
2846
+ if (box.width === 0 || box.height === 0) return void 0;
2847
+ const doc = el.ownerDocument;
2848
+ const marks = [];
2849
+ for (const dy of [8, 24, 48, 80, 120, 180]) {
2850
+ if (dy >= box.height) break;
2851
+ const node = doc.elementFromPoint(box.left + box.width / 2, box.top + dy);
2852
+ if (!node || node === el || !el.contains(node) || marks.some((m) => m.node === node)) continue;
2853
+ const r = node.getBoundingClientRect();
2854
+ marks.push({ node, offset: r.top - box.top, height: r.height });
2855
+ }
2856
+ marks.sort((a, b) => a.height - b.height);
2857
+ return marks.length ? { marks, top: el.scrollTop } : void 0;
2858
+ };
2859
+ var useFollowScroll = (ref, turn, live = true) => {
2860
+ const following = useRef5(true);
2861
+ const last = useRef5(void 0);
2862
+ const anchor = useRef5(void 0);
2863
+ const settle = useRef5(() => {
2864
+ });
2865
+ const arriving = useRef5(live);
2866
+ arriving.current = live;
2867
+ useIsoLayoutEffect(() => {
2868
+ const el = ref.current;
2869
+ if (!el) return;
2870
+ last.current = measure(el);
2871
+ const anchoring = el.style.getPropertyValue("overflow-anchor");
2872
+ el.style.setProperty("overflow-anchor", "none");
2873
+ const toEnd = () => {
2874
+ const top = el.scrollHeight - el.clientHeight;
2875
+ if (top - el.scrollTop > 0.5) el.scrollTop = top;
2876
+ };
2877
+ const keep = (render) => {
2878
+ const now = measure(el);
2879
+ const before = last.current;
2880
+ if (before) following.current = followsAfterResize(following.current, before, now);
2881
+ if (following.current) {
2882
+ if (render || arriving.current || !before || now.clientHeight !== before.clientHeight)
2883
+ toEnd();
2884
+ else if (endGap(now) > 0.5) following.current = false;
2885
+ } else if (anchor.current) {
2886
+ const seenAt = anchor.current.top;
2887
+ const mark = anchor.current.marks.find(
2888
+ (m) => m.node.isConnected && m.node.getClientRects().length > 0
2889
+ );
2890
+ if (mark) {
2891
+ const shift = mark.node.getBoundingClientRect().top - el.getBoundingClientRect().top - mark.offset + (el.scrollTop - seenAt);
2892
+ if (Math.abs(shift) > 0.5) el.scrollTop += shift;
2893
+ }
2894
+ }
2895
+ last.current = measure(el);
2896
+ if (!following.current) anchor.current = anchorOf(el);
2897
+ };
2898
+ settle.current = () => keep(true);
2899
+ const onScroll = () => {
2900
+ const now = measure(el);
2901
+ const was = following.current;
2902
+ following.current = followsAfterScroll(was, last.current ?? now, now);
2903
+ last.current = now;
2904
+ anchor.current = following.current ? void 0 : anchorOf(el);
2905
+ };
2906
+ el.addEventListener("scroll", onScroll, { passive: true });
2907
+ const restore = () => {
2908
+ el.removeEventListener("scroll", onScroll);
2909
+ if (anchoring) el.style.setProperty("overflow-anchor", anchoring);
2910
+ else el.style.removeProperty("overflow-anchor");
2911
+ };
2912
+ if (typeof ResizeObserver === "undefined") return restore;
2913
+ const sizes = new ResizeObserver(() => keep(false));
2914
+ const watch = () => {
2915
+ sizes.disconnect();
2916
+ sizes.observe(el);
2917
+ for (const child of el.children) sizes.observe(child);
2918
+ };
2919
+ watch();
2920
+ const parts = typeof MutationObserver === "undefined" ? void 0 : new MutationObserver((records) => {
2921
+ if (records.some((r) => r.type === "childList")) watch();
2922
+ });
2923
+ parts?.observe(el, { childList: true });
2924
+ return () => {
2925
+ restore();
2926
+ sizes.disconnect();
2927
+ parts?.disconnect();
2928
+ };
2929
+ }, [ref]);
2930
+ useIsoLayoutEffect(() => {
2931
+ following.current = true;
2932
+ anchor.current = void 0;
2933
+ }, [turn]);
2934
+ useIsoLayoutEffect(() => settle.current());
2935
+ };
2802
2936
 
2803
2937
  // src/hooks/use-mcp-app-host.ts
2804
- import { useCallback as useCallback7, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef5, useState as useState7 } from "react";
2938
+ import { useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef6, useState as useState7 } from "react";
2805
2939
 
2806
2940
  // src/mcp-app.ts
2807
2941
  import { mcpAppOrigin } from "@dudko.dev/agent-web";
@@ -3630,18 +3764,18 @@ var useMcpAppHost = ({
3630
3764
  }) => {
3631
3765
  const [requests, setRequests] = useState7([]);
3632
3766
  const [draft, setDraft] = useState7();
3633
- const waiting = useRef5(
3767
+ const waiting = useRef6(
3634
3768
  /* @__PURE__ */ new Map()
3635
3769
  );
3636
- const samplingAllowed = useRef5(/* @__PURE__ */ new Set());
3637
- const sampleRef = useRef5(sampleFn);
3770
+ const samplingAllowed = useRef6(/* @__PURE__ */ new Set());
3771
+ const sampleRef = useRef6(sampleFn);
3638
3772
  sampleRef.current = sampleFn;
3639
3773
  const [gated, setGated] = useState7({});
3640
- const connectionRef = useRef5(connection);
3774
+ const connectionRef = useRef6(connection);
3641
3775
  connectionRef.current = connection;
3642
- const approveRef = useRef5(approve);
3776
+ const approveRef = useRef6(approve);
3643
3777
  approveRef.current = approve;
3644
- useEffect6(
3778
+ useEffect7(
3645
3779
  () => () => {
3646
3780
  for (const { resolve } of waiting.current.values()) resolve(false);
3647
3781
  waiting.current.clear();
@@ -3972,11 +4106,11 @@ var AppRequestPrompt = ({
3972
4106
  };
3973
4107
 
3974
4108
  // src/components/McpAppFrame.tsx
3975
- import { useEffect as useEffect7, useLayoutEffect, useMemo as useMemo5, useRef as useRef6, useState as useState8 } from "react";
4109
+ import { useEffect as useEffect8, useLayoutEffect as useLayoutEffect2, useMemo as useMemo5, useRef as useRef7, useState as useState8 } from "react";
3976
4110
  import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
3977
4111
  var HOST_INFO = { name: "@dudko.dev/agent-web-react", version: "1" };
3978
4112
  var MAX_LISTED_CALLS = 12;
3979
- var useIsoLayoutEffect = typeof window === "undefined" ? useEffect7 : useLayoutEffect;
4113
+ var useIsoLayoutEffect2 = typeof window === "undefined" ? useEffect8 : useLayoutEffect2;
3980
4114
  var userActivation = () => typeof navigator === "undefined" ? void 0 : navigator.userActivation?.isActive;
3981
4115
  var silentSandboxes = /* @__PURE__ */ new Set();
3982
4116
  var warned = /* @__PURE__ */ new Set();
@@ -4018,27 +4152,27 @@ var McpAppFrame = ({
4018
4152
  const [fallback, setFallback] = useState8();
4019
4153
  const [broken, setBroken] = useState8(false);
4020
4154
  const [onOrigin, setOnOrigin] = useState8(false);
4021
- const shellLoaded = useRef6(void 0);
4155
+ const shellLoaded = useRef7(void 0);
4022
4156
  const [mode, setMode] = useState8("inline");
4023
- const modeRef = useRef6("inline");
4157
+ const modeRef = useRef7("inline");
4024
4158
  const [holder, setHolder] = useState8(0);
4025
4159
  const [fullRect, setFullRect] = useState8();
4026
- const leaveRef = useRef6(void 0);
4027
- const rootRef = useRef6(null);
4028
- const exitRef = useRef6(null);
4029
- const allowFullscreenRef = useRef6(allowFullscreen);
4160
+ const leaveRef = useRef7(void 0);
4161
+ const rootRef = useRef7(null);
4162
+ const exitRef = useRef7(null);
4163
+ const allowFullscreenRef = useRef7(allowFullscreen);
4030
4164
  allowFullscreenRef.current = allowFullscreen;
4031
- const iframeRef = useRef6(null);
4032
- const bridgeRef = useRef6(void 0);
4033
- const menuRef = useRef6(null);
4034
- const themeRef = useRef6(theme);
4165
+ const iframeRef = useRef7(null);
4166
+ const bridgeRef = useRef7(void 0);
4167
+ const menuRef = useRef7(null);
4168
+ const themeRef = useRef7(theme);
4035
4169
  themeRef.current = theme;
4036
- const hostRef = useRef6(host);
4170
+ const hostRef = useRef7(host);
4037
4171
  hostRef.current = host;
4038
- const appRef = useRef6(app);
4172
+ const appRef = useRef7(app);
4039
4173
  appRef.current = app;
4040
4174
  const live = !collapsed;
4041
- useEffect7(() => {
4175
+ useEffect8(() => {
4042
4176
  if (!live) return;
4043
4177
  if (!hostRef.current.connected) {
4044
4178
  setLoaded({ unavailable: true });
@@ -4076,7 +4210,7 @@ var McpAppFrame = ({
4076
4210
  () => !resource || !placement ? void 0 : placement.mode === "origin" ? buildMcpAppSandboxShell(placement.url) : buildMcpAppDocument(resource.html, resource.csp),
4077
4211
  [resource, placement]
4078
4212
  );
4079
- useEffect7(() => {
4213
+ useEffect8(() => {
4080
4214
  const reason = placement?.mode === "opaque" ? placement.reason : void 0;
4081
4215
  if (reason && reason !== "no-answer" && sandboxUrl !== void 0) {
4082
4216
  warnOnce(
@@ -4085,7 +4219,7 @@ var McpAppFrame = ({
4085
4219
  );
4086
4220
  }
4087
4221
  }, [placement, sandboxUrl]);
4088
- useEffect7(() => {
4222
+ useEffect8(() => {
4089
4223
  const frame = iframeRef.current;
4090
4224
  if (!live || !resource || !frame || !placement || broken) return;
4091
4225
  const abort = new AbortController();
@@ -4230,10 +4364,10 @@ var McpAppFrame = ({
4230
4364
  }, [live, resource, reload, variant, app.id, placement, broken, timeoutMs]);
4231
4365
  const fullscreen = mode === "fullscreen" && live && !broken;
4232
4366
  const waitingNow = host.isWaiting(app);
4233
- useEffect7(() => {
4367
+ useEffect8(() => {
4234
4368
  if (fullscreen && waitingNow) leaveRef.current?.();
4235
4369
  }, [fullscreen, waitingNow]);
4236
- useIsoLayoutEffect(() => {
4370
+ useIsoLayoutEffect2(() => {
4237
4371
  if (!fullscreen) return;
4238
4372
  const place = () => {
4239
4373
  const chat2 = rootRef.current?.closest(".awr-chat");
@@ -4265,7 +4399,7 @@ var McpAppFrame = ({
4265
4399
  ro?.disconnect();
4266
4400
  };
4267
4401
  }, [fullscreen]);
4268
- useEffect7(() => {
4402
+ useEffect8(() => {
4269
4403
  if (!fullscreen) return;
4270
4404
  const before = document.activeElement;
4271
4405
  exitRef.current?.focus();
@@ -4282,10 +4416,10 @@ var McpAppFrame = ({
4282
4416
  if (frame && (before === frame || document.activeElement === document.body)) frame.focus();
4283
4417
  };
4284
4418
  }, [fullscreen]);
4285
- useEffect7(() => {
4419
+ useEffect8(() => {
4286
4420
  if (theme) bridgeRef.current?.updateContext({ theme });
4287
4421
  }, [theme]);
4288
- useEffect7(() => {
4422
+ useEffect8(() => {
4289
4423
  if (!menu) return;
4290
4424
  const close = (e) => {
4291
4425
  if (e instanceof KeyboardEvent ? e.key === "Escape" : !menuRef.current?.contains(e.target)) {
@@ -4590,7 +4724,7 @@ var McpAppLine = ({ app, note, action, onAction, labels, className }) => {
4590
4724
  };
4591
4725
 
4592
4726
  // src/components/AgentComposer.tsx
4593
- import { useEffect as useEffect8, useLayoutEffect as useLayoutEffect2, useMemo as useMemo6, useRef as useRef7, useState as useState9 } from "react";
4727
+ import { useEffect as useEffect9, useLayoutEffect as useLayoutEffect3, useMemo as useMemo6, useRef as useRef8, useState as useState9 } from "react";
4594
4728
  import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
4595
4729
  var thinkingDefaults = (l) => [
4596
4730
  { id: "off", label: l.thinkingLevels.off },
@@ -4602,10 +4736,10 @@ var thinkingDefaults = (l) => [
4602
4736
  var MODES = ["autopilot", "ask-writes", "ask-all", "read-only"];
4603
4737
  var ModeIcon = ({ mode }) => mode === "autopilot" ? /* @__PURE__ */ jsx5(BoltIcon, { size: 14 }) : mode === "read-only" ? /* @__PURE__ */ jsx5(EyeIcon, { size: 14 }) : /* @__PURE__ */ jsx5(ShieldIcon, { size: 14 });
4604
4738
  var attachSeq = 0;
4605
- var useIsoLayoutEffect2 = typeof window === "undefined" ? useEffect8 : useLayoutEffect2;
4739
+ var useIsoLayoutEffect3 = typeof window === "undefined" ? useEffect9 : useLayoutEffect3;
4606
4740
  var useMenuPlacement = (open, anchor, align) => {
4607
4741
  const [style, setStyle] = useState9();
4608
- useIsoLayoutEffect2(() => {
4742
+ useIsoLayoutEffect3(() => {
4609
4743
  if (!open) return;
4610
4744
  const place = () => {
4611
4745
  const el = anchor.current;
@@ -4689,12 +4823,12 @@ var AgentComposer = ({
4689
4823
  const [dismissed, setDismissed] = useState9(() => /* @__PURE__ */ new Set());
4690
4824
  const [attachError, setAttachError] = useState9();
4691
4825
  const [dragging, setDragging] = useState9(false);
4692
- const rootRef = useRef7(null);
4693
- const modelRef = useRef7(null);
4694
- const modeRef = useRef7(null);
4826
+ const rootRef = useRef8(null);
4827
+ const modelRef = useRef8(null);
4828
+ const modeRef = useRef8(null);
4695
4829
  const [dropRect, setDropRect] = useState9();
4696
4830
  const [compactBar, setCompactBar] = useState9(false);
4697
- useEffect8(() => {
4831
+ useEffect9(() => {
4698
4832
  const el = rootRef.current;
4699
4833
  if (!el || typeof ResizeObserver === "undefined") return;
4700
4834
  const ro = new ResizeObserver(
@@ -4703,11 +4837,11 @@ var AgentComposer = ({
4703
4837
  ro.observe(el);
4704
4838
  return () => ro.disconnect();
4705
4839
  }, [compactWidth]);
4706
- const fileRef = useRef7(null);
4707
- const inputRef = useRef7(null);
4840
+ const fileRef = useRef8(null);
4841
+ const inputRef = useRef8(null);
4708
4842
  const draftId = draft?.id;
4709
4843
  const draftText = draft?.text;
4710
- useEffect8(() => {
4844
+ useEffect9(() => {
4711
4845
  if (draftId === void 0 || !draftText) return;
4712
4846
  setText((t) => t.trim() ? `${t.trimEnd()}
4713
4847
  ${draftText}` : draftText);
@@ -4727,7 +4861,7 @@ ${draftText}` : draftText);
4727
4861
  const [startedAt, setStartedAt] = useState9();
4728
4862
  const [now, setNow] = useState9(() => Date.now());
4729
4863
  const [lastElapsed, setLastElapsed] = useState9();
4730
- useEffect8(() => {
4864
+ useEffect9(() => {
4731
4865
  if (!busy) {
4732
4866
  if (startedAt !== void 0) setLastElapsed(Date.now() - startedAt);
4733
4867
  setStartedAt(void 0);
@@ -4820,8 +4954,8 @@ ${draftText}` : draftText);
4820
4954
  const commandsStyle = useMenuPlacement(paletteOpen, rootRef, "stretch");
4821
4955
  const modelStyle = useMenuPlacement(menu === "model", modelRef, "left");
4822
4956
  const modeStyle = useMenuPlacement(menu === "mode", modeRef, "right");
4823
- useEffect8(() => setActive(0), [text, menu]);
4824
- useEffect8(() => {
4957
+ useEffect9(() => setActive(0), [text, menu]);
4958
+ useEffect9(() => {
4825
4959
  if (!menu) return;
4826
4960
  const onDown = (e) => {
4827
4961
  if (!rootRef.current?.contains(e.target)) setMenu(void 0);
@@ -4914,9 +5048,9 @@ ${draftText}` : draftText);
4914
5048
  e.preventDefault();
4915
5049
  void addFiles(pasted);
4916
5050
  };
4917
- const addFilesRef = useRef7(addFiles);
5051
+ const addFilesRef = useRef8(addFiles);
4918
5052
  addFilesRef.current = addFiles;
4919
- useEffect8(() => {
5053
+ useEffect9(() => {
4920
5054
  if (attachments === false) return;
4921
5055
  const target = dropZone === "window" ? globalThis.window : dropZone === "self" ? rootRef.current : dropZone.current;
4922
5056
  if (!target) return;
@@ -5555,7 +5689,7 @@ var ContextMeter = ({
5555
5689
  };
5556
5690
 
5557
5691
  // src/components/ElicitationPrompt.tsx
5558
- import { useEffect as useEffect9, useId, useState as useState10 } from "react";
5692
+ import { useEffect as useEffect10, useId, useState as useState10 } from "react";
5559
5693
  import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
5560
5694
  var reasonText = (outcome, L) => {
5561
5695
  const reason = outcome.reason;
@@ -5566,7 +5700,7 @@ var reasonText = (outcome, L) => {
5566
5700
  };
5567
5701
  var useNow = (active) => {
5568
5702
  const [now, setNow] = useState10(() => Date.now());
5569
- useEffect9(() => {
5703
+ useEffect10(() => {
5570
5704
  if (!active) return;
5571
5705
  setNow(Date.now());
5572
5706
  const timer = setInterval(() => setNow(Date.now()), 1e3);
@@ -5878,8 +6012,256 @@ var ElicitationPrompt = ({
5878
6012
  };
5879
6013
 
5880
6014
  // src/components/FilesPanel.tsx
5881
- import { Fragment as Fragment4, useEffect as useEffect10, useRef as useRef8, useState as useState11 } from "react";
5882
- import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
6015
+ import { Fragment as Fragment5, useEffect as useEffect12, useRef as useRef10, useState as useState12 } from "react";
6016
+
6017
+ // src/components/ImageViewer.tsx
6018
+ import { createContext as createContext3, useContext as useContext3, useEffect as useEffect11, useRef as useRef9, useState as useState11 } from "react";
6019
+ import { createPortal } from "react-dom";
6020
+ import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
6021
+ var fileNameOf = (name) => name.split(/[\\/]/).filter(Boolean).pop() ?? name;
6022
+ var SWIPE_PX = 48;
6023
+ var ImageViewer = ({ images, index, onIndex, onClose, labels }) => {
6024
+ const L = useLabels(labels);
6025
+ const rootRef = useRef9(null);
6026
+ const closeRef = useRef9(null);
6027
+ const imgRef = useRef9(null);
6028
+ const touch = useRef9(void 0);
6029
+ const [zoom, setZoom] = useState11(void 0);
6030
+ const count = images.length;
6031
+ const at = Math.min(Math.max(index, 0), count - 1);
6032
+ const image = images[at];
6033
+ const go = (step) => {
6034
+ if (count < 2) return;
6035
+ setZoom(void 0);
6036
+ onIndex((at + step + count) % count);
6037
+ };
6038
+ useEffect11(() => {
6039
+ closeRef.current?.focus();
6040
+ const root = document.documentElement;
6041
+ const before = root.style.overflow;
6042
+ root.style.overflow = "hidden";
6043
+ return () => {
6044
+ root.style.overflow = before;
6045
+ };
6046
+ }, []);
6047
+ const keys = useRef9(() => {
6048
+ });
6049
+ keys.current = (e) => {
6050
+ if (e.key === "Escape") {
6051
+ e.preventDefault();
6052
+ e.stopPropagation();
6053
+ onClose();
6054
+ } else if (e.key === "ArrowLeft") go(-1);
6055
+ else if (e.key === "ArrowRight") go(1);
6056
+ else if (e.key === "Tab") {
6057
+ const stops = [
6058
+ ...rootRef.current?.querySelectorAll("button, a[href]") ?? []
6059
+ ].filter((el) => !el.hasAttribute("disabled"));
6060
+ if (!stops.length) return;
6061
+ const first = stops[0];
6062
+ const last = stops[stops.length - 1];
6063
+ const active = document.activeElement;
6064
+ if (!rootRef.current?.contains(active)) {
6065
+ e.preventDefault();
6066
+ (e.shiftKey ? last : first).focus();
6067
+ } else if (e.shiftKey ? active === first : active === last) {
6068
+ e.preventDefault();
6069
+ (e.shiftKey ? last : first).focus();
6070
+ }
6071
+ }
6072
+ };
6073
+ useEffect11(() => {
6074
+ const onKey = (e) => keys.current(e);
6075
+ document.addEventListener("keydown", onKey, true);
6076
+ return () => document.removeEventListener("keydown", onKey, true);
6077
+ }, []);
6078
+ if (!image) return null;
6079
+ const toggleZoom = () => {
6080
+ const img = imgRef.current;
6081
+ if (zoom !== void 0 || !img) return setZoom(void 0);
6082
+ setZoom(Math.max(img.naturalWidth, Math.round(img.clientWidth * 2)));
6083
+ };
6084
+ const onTouchStart = (e) => {
6085
+ touch.current = e.touches.length === 1 ? { x: e.touches[0].clientX, y: e.touches[0].clientY } : void 0;
6086
+ };
6087
+ const onTouchEnd = (e) => {
6088
+ const from = touch.current;
6089
+ touch.current = void 0;
6090
+ if (!from || zoom !== void 0 || e.changedTouches.length !== 1) return;
6091
+ const dx = e.changedTouches[0].clientX - from.x;
6092
+ const dy = e.changedTouches[0].clientY - from.y;
6093
+ if (Math.abs(dx) > SWIPE_PX && Math.abs(dx) > Math.abs(dy) * 1.5) go(dx < 0 ? 1 : -1);
6094
+ };
6095
+ const name = fileNameOf(image.name);
6096
+ return /* @__PURE__ */ jsxs7("div", { ref: rootRef, className: "awr-viewer", role: "dialog", "aria-modal": "true", "aria-label": name, children: [
6097
+ /* @__PURE__ */ jsxs7("div", { className: "awr-viewer__bar", children: [
6098
+ /* @__PURE__ */ jsx9("span", { className: "awr-viewer__name", title: image.name, children: name }),
6099
+ count > 1 && /* @__PURE__ */ jsx9("span", { className: "awr-viewer__count", "aria-live": "polite", children: L.imageCount(at + 1, count) }),
6100
+ /* @__PURE__ */ jsx9(
6101
+ "button",
6102
+ {
6103
+ type: "button",
6104
+ className: "awr-iconbtn awr-viewer__zoom",
6105
+ "aria-label": L.imageZoom,
6106
+ title: L.imageZoom,
6107
+ "aria-pressed": zoom !== void 0,
6108
+ onClick: toggleZoom,
6109
+ children: zoom !== void 0 ? /* @__PURE__ */ jsx9(ShrinkIcon, { size: 18 }) : /* @__PURE__ */ jsx9(ExpandIcon, { size: 18 })
6110
+ }
6111
+ ),
6112
+ /* @__PURE__ */ jsx9(
6113
+ "a",
6114
+ {
6115
+ className: "awr-iconbtn awr-viewer__download",
6116
+ href: image.src,
6117
+ download: name,
6118
+ "aria-label": L.fileDownload(name),
6119
+ title: L.download,
6120
+ children: /* @__PURE__ */ jsx9(DownloadIcon, { size: 18 })
6121
+ }
6122
+ ),
6123
+ /* @__PURE__ */ jsx9(
6124
+ "button",
6125
+ {
6126
+ ref: closeRef,
6127
+ type: "button",
6128
+ className: "awr-iconbtn awr-viewer__close",
6129
+ "aria-label": L.close,
6130
+ title: L.close,
6131
+ onClick: onClose,
6132
+ children: /* @__PURE__ */ jsx9(XIcon, { size: 18 })
6133
+ }
6134
+ )
6135
+ ] }),
6136
+ /* @__PURE__ */ jsx9(
6137
+ "div",
6138
+ {
6139
+ className: `awr-viewer__stage${zoom !== void 0 ? " is-zoomed" : ""}`,
6140
+ onClick: (e) => {
6141
+ if (e.target === e.currentTarget) onClose();
6142
+ },
6143
+ onTouchStart,
6144
+ onTouchEnd,
6145
+ children: /* @__PURE__ */ jsx9(
6146
+ "img",
6147
+ {
6148
+ ref: imgRef,
6149
+ className: "awr-viewer__img",
6150
+ src: image.src,
6151
+ alt: image.alt ?? name,
6152
+ style: zoom !== void 0 ? { width: zoom } : void 0,
6153
+ onClick: toggleZoom,
6154
+ onDoubleClick: (e) => e.preventDefault(),
6155
+ draggable: false
6156
+ },
6157
+ image.src
6158
+ )
6159
+ }
6160
+ ),
6161
+ count > 1 && /* @__PURE__ */ jsxs7(Fragment4, { children: [
6162
+ /* @__PURE__ */ jsx9(
6163
+ "button",
6164
+ {
6165
+ type: "button",
6166
+ className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--prev",
6167
+ "aria-label": L.imagePrevious,
6168
+ title: L.imagePrevious,
6169
+ onClick: () => go(-1),
6170
+ children: /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u2039" })
6171
+ }
6172
+ ),
6173
+ /* @__PURE__ */ jsx9(
6174
+ "button",
6175
+ {
6176
+ type: "button",
6177
+ className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--next",
6178
+ "aria-label": L.imageNext,
6179
+ title: L.imageNext,
6180
+ onClick: () => go(1),
6181
+ children: /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u203A" })
6182
+ }
6183
+ )
6184
+ ] })
6185
+ ] });
6186
+ };
6187
+ var ImageViewerContext = createContext3({ enabled: true });
6188
+ var ImageViewerProvider = ({
6189
+ enabled = true,
6190
+ render,
6191
+ children
6192
+ }) => /* @__PURE__ */ jsx9(ImageViewerContext.Provider, { value: { enabled, render }, children });
6193
+ var imageExtensionOf = (src) => {
6194
+ const type = /^data:image\/([a-z0-9.+-]+)/i.exec(src)?.[1]?.toLowerCase();
6195
+ return !type ? "" : type === "jpeg" ? ".jpg" : type === "svg+xml" ? ".svg" : `.${type}`;
6196
+ };
6197
+ var groupOf = (button) => {
6198
+ const scope = button.closest(".awr-msg") ?? button.parentElement ?? button;
6199
+ const buttons = [...scope.querySelectorAll("[data-awr-image]")];
6200
+ const images = buttons.flatMap((b) => {
6201
+ const img = b.querySelector("img");
6202
+ return img ? [{ src: img.currentSrc || img.src, name: b.dataset.awrImage || img.alt, alt: img.alt }] : [];
6203
+ });
6204
+ return { images, index: Math.max(0, buttons.indexOf(button)) };
6205
+ };
6206
+ var ImageThumb = ({
6207
+ src,
6208
+ name,
6209
+ alt,
6210
+ className,
6211
+ imgClassName,
6212
+ title,
6213
+ labels
6214
+ }) => {
6215
+ const L = useLabels(labels);
6216
+ const { enabled, render } = useContext3(ImageViewerContext);
6217
+ const ref = useRef9(null);
6218
+ const [open, setOpen] = useState11(void 0);
6219
+ const img = /* @__PURE__ */ jsx9("img", { className: imgClassName, src, alt });
6220
+ if (!enabled) {
6221
+ return /* @__PURE__ */ jsx9("a", { className, href: src, target: "_blank", rel: "noopener noreferrer", title, children: img });
6222
+ }
6223
+ const close = () => {
6224
+ setOpen(void 0);
6225
+ ref.current?.focus();
6226
+ };
6227
+ const viewer = (o) => ({
6228
+ images: o.images,
6229
+ index: o.index,
6230
+ onIndex: (index) => setOpen({ ...o, index }),
6231
+ onClose: close,
6232
+ labels
6233
+ });
6234
+ return /* @__PURE__ */ jsxs7(Fragment4, { children: [
6235
+ /* @__PURE__ */ jsx9(
6236
+ "button",
6237
+ {
6238
+ ref,
6239
+ type: "button",
6240
+ className: ["awr-imgbtn", className].filter(Boolean).join(" "),
6241
+ "data-awr-image": name,
6242
+ "aria-label": L.imageOpen(fileNameOf(name)),
6243
+ "aria-haspopup": "dialog",
6244
+ title,
6245
+ onClick: (e) => {
6246
+ const button = e.currentTarget;
6247
+ setOpen({
6248
+ ...groupOf(button),
6249
+ // Inside the chat's element, so its theme applies; it covers the window from there.
6250
+ host: button.closest(".awr-chat, .awr-theme") ?? document.body
6251
+ });
6252
+ },
6253
+ children: img
6254
+ }
6255
+ ),
6256
+ open && createPortal(
6257
+ render ? render(viewer(open), /* @__PURE__ */ jsx9(ImageViewer, { ...viewer(open) })) : /* @__PURE__ */ jsx9(ImageViewer, { ...viewer(open) }),
6258
+ open.host
6259
+ )
6260
+ ] });
6261
+ };
6262
+
6263
+ // src/components/FilesPanel.tsx
6264
+ import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
5883
6265
  var PREVIEW_CHARS = 2e4;
5884
6266
  var FilesPanel = ({
5885
6267
  files: vfs,
@@ -5895,9 +6277,9 @@ var FilesPanel = ({
5895
6277
  }) => {
5896
6278
  const L = useLabels(labels);
5897
6279
  const fs = useVirtualFiles(vfs, prefix);
5898
- const [preview, setPreview] = useState11();
5899
- const inputRef = useRef8(null);
5900
- useEffect10(() => {
6280
+ const [preview, setPreview] = useState12();
6281
+ const inputRef = useRef10(null);
6282
+ useEffect12(() => {
5901
6283
  if (preview && !fs.files.some((f) => f.path === preview.path)) setPreview(void 0);
5902
6284
  }, [fs.files, preview]);
5903
6285
  const open = async (f) => {
@@ -5920,11 +6302,11 @@ var FilesPanel = ({
5920
6302
  a.download = f.path.split("/").pop() || "file";
5921
6303
  a.click();
5922
6304
  };
5923
- return /* @__PURE__ */ jsxs7("div", { className: ["awr-filespanel", className].filter(Boolean).join(" "), children: [
5924
- /* @__PURE__ */ jsxs7("div", { className: "awr-panel__head", children: [
5925
- /* @__PURE__ */ jsx9("span", { className: "awr-panel__title", children: title ?? L.files }),
5926
- allowUpload && /* @__PURE__ */ jsxs7(Fragment5, { children: [
5927
- /* @__PURE__ */ jsx9(
6305
+ return /* @__PURE__ */ jsxs8("div", { className: ["awr-filespanel", className].filter(Boolean).join(" "), children: [
6306
+ /* @__PURE__ */ jsxs8("div", { className: "awr-panel__head", children: [
6307
+ /* @__PURE__ */ jsx10("span", { className: "awr-panel__title", children: title ?? L.files }),
6308
+ allowUpload && /* @__PURE__ */ jsxs8(Fragment6, { children: [
6309
+ /* @__PURE__ */ jsx10(
5928
6310
  "button",
5929
6311
  {
5930
6312
  type: "button",
@@ -5932,10 +6314,10 @@ var FilesPanel = ({
5932
6314
  "aria-label": L.upload,
5933
6315
  title: L.upload,
5934
6316
  onClick: () => inputRef.current?.click(),
5935
- children: /* @__PURE__ */ jsx9(PlusIcon, { size: 16 })
6317
+ children: /* @__PURE__ */ jsx10(PlusIcon, { size: 16 })
5936
6318
  }
5937
6319
  ),
5938
- /* @__PURE__ */ jsx9(
6320
+ /* @__PURE__ */ jsx10(
5939
6321
  "input",
5940
6322
  {
5941
6323
  ref: inputRef,
@@ -5950,15 +6332,15 @@ var FilesPanel = ({
5950
6332
  )
5951
6333
  ] })
5952
6334
  ] }),
5953
- fs.error && /* @__PURE__ */ jsx9("div", { className: "awr-notice awr-notice--warn", children: fs.error }),
5954
- !fs.loading && fs.files.length === 0 && /* @__PURE__ */ jsx9("div", { className: "awr-panel__empty", children: L.filesEmpty }),
5955
- /* @__PURE__ */ jsx9("ul", { className: "awr-filelist", children: fs.files.map((f) => {
5956
- const row = /* @__PURE__ */ jsxs7(
6335
+ fs.error && /* @__PURE__ */ jsx10("div", { className: "awr-notice awr-notice--warn", children: fs.error }),
6336
+ !fs.loading && fs.files.length === 0 && /* @__PURE__ */ jsx10("div", { className: "awr-panel__empty", children: L.filesEmpty }),
6337
+ /* @__PURE__ */ jsx10("ul", { className: "awr-filelist", children: fs.files.map((f) => {
6338
+ const row = /* @__PURE__ */ jsxs8(
5957
6339
  "li",
5958
6340
  {
5959
6341
  className: `awr-filelist__item${preview?.path === f.path ? " is-active" : ""}`,
5960
6342
  children: [
5961
- /* @__PURE__ */ jsxs7(
6343
+ /* @__PURE__ */ jsxs8(
5962
6344
  "button",
5963
6345
  {
5964
6346
  type: "button",
@@ -5966,13 +6348,13 @@ var FilesPanel = ({
5966
6348
  onClick: () => void open(f),
5967
6349
  title: `${L.preview}: ${f.path}`,
5968
6350
  children: [
5969
- /* @__PURE__ */ jsx9(FileIcon, { size: 14 }),
5970
- /* @__PURE__ */ jsx9("span", { className: "awr-filelist__path", children: f.path }),
5971
- /* @__PURE__ */ jsx9("span", { className: "awr-filelist__size", children: L.bytes(f.size) })
6351
+ /* @__PURE__ */ jsx10(FileIcon, { size: 14 }),
6352
+ /* @__PURE__ */ jsx10("span", { className: "awr-filelist__path", children: f.path }),
6353
+ /* @__PURE__ */ jsx10("span", { className: "awr-filelist__size", children: L.bytes(f.size) })
5972
6354
  ]
5973
6355
  }
5974
6356
  ),
5975
- /* @__PURE__ */ jsx9(
6357
+ /* @__PURE__ */ jsx10(
5976
6358
  "button",
5977
6359
  {
5978
6360
  type: "button",
@@ -5980,10 +6362,10 @@ var FilesPanel = ({
5980
6362
  "aria-label": `${L.download} ${f.path}`,
5981
6363
  title: L.download,
5982
6364
  onClick: () => void download(f),
5983
- children: /* @__PURE__ */ jsx9(DownloadIcon, { size: 14 })
6365
+ children: /* @__PURE__ */ jsx10(DownloadIcon, { size: 14 })
5984
6366
  }
5985
6367
  ),
5986
- allowDelete && /* @__PURE__ */ jsx9(
6368
+ allowDelete && /* @__PURE__ */ jsx10(
5987
6369
  "button",
5988
6370
  {
5989
6371
  type: "button",
@@ -5991,22 +6373,34 @@ var FilesPanel = ({
5991
6373
  "aria-label": `${L.delete} ${f.path}`,
5992
6374
  title: L.delete,
5993
6375
  onClick: () => void fs.remove(f.path),
5994
- children: /* @__PURE__ */ jsx9(XIcon, { size: 14 })
6376
+ children: /* @__PURE__ */ jsx10(XIcon, { size: 14 })
5995
6377
  }
5996
6378
  )
5997
6379
  ]
5998
6380
  },
5999
6381
  f.path
6000
6382
  );
6001
- return renderFile ? /* @__PURE__ */ jsx9(Fragment4, { children: renderFile(f, row) }, f.path) : row;
6383
+ return renderFile ? /* @__PURE__ */ jsx10(Fragment5, { children: renderFile(f, row) }, f.path) : row;
6002
6384
  }) }),
6003
- preview && /* @__PURE__ */ jsx9("div", { className: "awr-filepreview", children: preview.kind === "image" ? /* @__PURE__ */ jsx9("img", { src: preview.src, alt: preview.path }) : /* @__PURE__ */ jsx9("pre", { children: preview.text.length > PREVIEW_CHARS ? `${preview.text.slice(0, PREVIEW_CHARS)}
6385
+ preview && /* @__PURE__ */ jsx10("div", { className: "awr-filepreview", children: preview.kind === "image" ? (
6386
+ // A click (Enter, Space) opens it over the chat, fitted to the screen.
6387
+ /* @__PURE__ */ jsx10(
6388
+ ImageThumb,
6389
+ {
6390
+ src: preview.src,
6391
+ name: preview.path,
6392
+ alt: preview.path,
6393
+ title: preview.path,
6394
+ labels
6395
+ }
6396
+ )
6397
+ ) : /* @__PURE__ */ jsx10("pre", { children: preview.text.length > PREVIEW_CHARS ? `${preview.text.slice(0, PREVIEW_CHARS)}
6004
6398
  \u2026` : preview.text }) })
6005
6399
  ] });
6006
6400
  };
6007
6401
 
6008
6402
  // src/components/FileChips.tsx
6009
- import { Fragment as Fragment6, useEffect as useEffect12, useMemo as useMemo7, useState as useState13 } from "react";
6403
+ import { Fragment as Fragment7, useEffect as useEffect14, useMemo as useMemo7, useState as useState14 } from "react";
6010
6404
 
6011
6405
  // src/file-kinds.ts
6012
6406
  import { MEDIA_IMAGE_TYPES, isTextMime } from "@dudko.dev/agent-web";
@@ -6024,12 +6418,12 @@ var fileKindOf = (path, mediaType) => {
6024
6418
  if (mime === "text/plain" || /\.(?:txt|log)$/i.test(path) || isTextMime(mime)) return "text";
6025
6419
  return "file";
6026
6420
  };
6027
- var fileNameOf = (path) => path.split("/").filter(Boolean).pop() || "file";
6421
+ var fileNameOf2 = (path) => path.split("/").filter(Boolean).pop() || "file";
6028
6422
 
6029
6423
  // src/components/Media.tsx
6030
- import { useEffect as useEffect11, useState as useState12 } from "react";
6424
+ import { useEffect as useEffect13, useState as useState13 } from "react";
6031
6425
  import { MEDIA_AUDIO_TYPES, MEDIA_IMAGE_TYPES as MEDIA_IMAGE_TYPES2 } from "@dudko.dev/agent-web";
6032
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
6426
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
6033
6427
  var mediaFamilyOf = (mediaType) => {
6034
6428
  const type = mediaType.toLowerCase().split(";")[0].trim();
6035
6429
  if (Object.hasOwn(MEDIA_IMAGE_TYPES2, type)) return "image";
@@ -6044,8 +6438,8 @@ var bytesOf = (content, encoding) => {
6044
6438
  return bytes;
6045
6439
  };
6046
6440
  var useFileUrl = (files, path, mediaType) => {
6047
- const [url, setUrl] = useState12(void 0);
6048
- useEffect11(() => {
6441
+ const [url, setUrl] = useState13(void 0);
6442
+ useEffect13(() => {
6049
6443
  if (!files || !mediaType) return;
6050
6444
  let made;
6051
6445
  let gone = false;
@@ -6071,20 +6465,21 @@ var GeneratedMedia = ({ media, files, labels }) => {
6071
6465
  const type = family ? media.mediaType.toLowerCase().split(";")[0].trim() : void 0;
6072
6466
  const url = useFileUrl(files, media.path, type);
6073
6467
  if (url && family === "image") {
6074
- return /* @__PURE__ */ jsx10(
6075
- "a",
6468
+ return /* @__PURE__ */ jsx11(
6469
+ ImageThumb,
6076
6470
  {
6077
6471
  className: "awr-media awr-media--image",
6078
- href: url,
6079
- target: "_blank",
6080
- rel: "noopener noreferrer",
6472
+ imgClassName: "awr-media__img",
6473
+ src: url,
6474
+ name: media.path,
6475
+ alt: L.mediaImage(media.path),
6081
6476
  title: media.path,
6082
- children: /* @__PURE__ */ jsx10("img", { className: "awr-media__img", src: url, alt: L.mediaImage(media.path) })
6477
+ labels
6083
6478
  }
6084
6479
  );
6085
6480
  }
6086
6481
  if (url && family === "audio") {
6087
- return /* @__PURE__ */ jsx10("span", { className: "awr-media awr-media--audio", title: media.path, children: /* @__PURE__ */ jsx10(
6482
+ return /* @__PURE__ */ jsx11("span", { className: "awr-media awr-media--audio", title: media.path, children: /* @__PURE__ */ jsx11(
6088
6483
  "audio",
6089
6484
  {
6090
6485
  className: "awr-media__audio",
@@ -6095,27 +6490,27 @@ var GeneratedMedia = ({ media, files, labels }) => {
6095
6490
  }
6096
6491
  ) });
6097
6492
  }
6098
- return /* @__PURE__ */ jsxs8("span", { className: "awr-chip awr-file awr-media awr-media--file", title: L.mediaFile(media.path), children: [
6099
- /* @__PURE__ */ jsx10(FileIcon, { size: 13 }),
6493
+ return /* @__PURE__ */ jsxs9("span", { className: "awr-chip awr-file awr-media awr-media--file", title: L.mediaFile(media.path), children: [
6494
+ /* @__PURE__ */ jsx11(FileIcon, { size: 13 }),
6100
6495
  " ",
6101
6496
  media.path
6102
6497
  ] });
6103
6498
  };
6104
6499
  var TranscriptBlock = ({ transcript, labels }) => {
6105
6500
  const L = useLabels(labels);
6106
- return /* @__PURE__ */ jsxs8("details", { className: "awr-transcript", children: [
6107
- /* @__PURE__ */ jsxs8("summary", { className: "awr-transcript__summary", children: [
6108
- /* @__PURE__ */ jsx10(FileIcon, { size: 13 }),
6501
+ return /* @__PURE__ */ jsxs9("details", { className: "awr-transcript", children: [
6502
+ /* @__PURE__ */ jsxs9("summary", { className: "awr-transcript__summary", children: [
6503
+ /* @__PURE__ */ jsx11(FileIcon, { size: 13 }),
6109
6504
  " ",
6110
6505
  L.transcriptOf(transcript.name)
6111
6506
  ] }),
6112
- /* @__PURE__ */ jsx10("p", { className: "awr-transcript__note", children: L.transcriptNote }),
6113
- /* @__PURE__ */ jsx10("blockquote", { className: "awr-transcript__text", children: transcript.text })
6507
+ /* @__PURE__ */ jsx11("p", { className: "awr-transcript__note", children: L.transcriptNote }),
6508
+ /* @__PURE__ */ jsx11("blockquote", { className: "awr-transcript__text", children: transcript.text })
6114
6509
  ] });
6115
6510
  };
6116
6511
 
6117
6512
  // src/components/SandboxedFrame.tsx
6118
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
6513
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
6119
6514
  var FRAME_MIN_HEIGHT = 120;
6120
6515
  var FRAME_MAX_HEIGHT = 800;
6121
6516
  var clampFrameHeight = (height) => Math.min(
@@ -6132,12 +6527,12 @@ var SandboxedFrame = ({
6132
6527
  height = 300,
6133
6528
  children,
6134
6529
  className
6135
- }) => /* @__PURE__ */ jsxs9("div", { className: ["awr-frame", className].filter(Boolean).join(" "), children: [
6136
- /* @__PURE__ */ jsxs9("div", { className: "awr-frame__head", children: [
6137
- /* @__PURE__ */ jsx11("div", { className: "awr-frame__label", children: label }),
6530
+ }) => /* @__PURE__ */ jsxs10("div", { className: ["awr-frame", className].filter(Boolean).join(" "), children: [
6531
+ /* @__PURE__ */ jsxs10("div", { className: "awr-frame__head", children: [
6532
+ /* @__PURE__ */ jsx12("div", { className: "awr-frame__label", children: label }),
6138
6533
  actions
6139
6534
  ] }),
6140
- html !== void 0 && children === void 0 ? /* @__PURE__ */ jsx11("div", { className: "awr-frame__well", children: /* @__PURE__ */ jsx11(
6535
+ html !== void 0 && children === void 0 ? /* @__PURE__ */ jsx12("div", { className: "awr-frame__well", children: /* @__PURE__ */ jsx12(
6141
6536
  "iframe",
6142
6537
  {
6143
6538
  className: "awr-frame__iframe",
@@ -6149,11 +6544,11 @@ var SandboxedFrame = ({
6149
6544
  },
6150
6545
  scripts ? "scripts" : "static"
6151
6546
  ) }) : children,
6152
- footer ? /* @__PURE__ */ jsx11("div", { className: "awr-frame__foot", children: footer }) : null
6547
+ footer ? /* @__PURE__ */ jsx12("div", { className: "awr-frame__foot", children: footer }) : null
6153
6548
  ] });
6154
6549
 
6155
6550
  // src/components/FileChips.tsx
6156
- import { Fragment as Fragment7, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
6551
+ import { Fragment as Fragment8, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
6157
6552
  var FILE_PREVIEW_CHARS = 2e4;
6158
6553
  var textOf = (file) => file.encoding === "base64" ? new TextDecoder().decode(bytesOf(file.content, "base64")) : file.content;
6159
6554
  var KIND_ICON = {
@@ -6174,11 +6569,11 @@ var downloadFile = async (vfs, path) => {
6174
6569
  );
6175
6570
  const a = document.createElement("a");
6176
6571
  a.href = url;
6177
- a.download = fileNameOf(path);
6572
+ a.download = fileNameOf2(path);
6178
6573
  a.click();
6179
6574
  setTimeout(() => URL.revokeObjectURL(url), 1e3);
6180
6575
  };
6181
- var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ jsx12("div", { className: "awr-seg", role: "group", "aria-label": label, children: options.map((o) => /* @__PURE__ */ jsxs10(
6576
+ var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ jsx13("div", { className: "awr-seg", role: "group", "aria-label": label, children: options.map((o) => /* @__PURE__ */ jsxs11(
6182
6577
  "button",
6183
6578
  {
6184
6579
  type: "button",
@@ -6217,14 +6612,14 @@ var SourceView = ({
6217
6612
  () => linesOf(html ? tokenizeHtml(shown) : [{ kind: "text", text: shown }]),
6218
6613
  [shown, html]
6219
6614
  );
6220
- return /* @__PURE__ */ jsxs10(Fragment7, { children: [
6221
- /* @__PURE__ */ jsx12("pre", { className: ["awr-source", className].filter(Boolean).join(" "), tabIndex: 0, children: lines.map((line, i) => /* @__PURE__ */ jsxs10("span", { className: "awr-source__line", children: [
6615
+ return /* @__PURE__ */ jsxs11(Fragment8, { children: [
6616
+ /* @__PURE__ */ jsx13("pre", { className: ["awr-source", className].filter(Boolean).join(" "), tabIndex: 0, children: lines.map((line, i) => /* @__PURE__ */ jsxs11("span", { className: "awr-source__line", children: [
6222
6617
  line.map(
6223
- (t, k) => t.kind === "text" ? /* @__PURE__ */ jsx12(Fragment6, { children: t.text }, k) : /* @__PURE__ */ jsx12("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
6618
+ (t, k) => t.kind === "text" ? /* @__PURE__ */ jsx13(Fragment7, { children: t.text }, k) : /* @__PURE__ */ jsx13("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
6224
6619
  ),
6225
6620
  "\n"
6226
6621
  ] }, i)) }),
6227
- cut && /* @__PURE__ */ jsx12("p", { className: "awr-fileview__cut", children: L.fileCut(maxChars) })
6622
+ cut && /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.fileCut(maxChars) })
6228
6623
  ] });
6229
6624
  };
6230
6625
  var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
@@ -6232,13 +6627,13 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
6232
6627
  const options = htmlPreview === false ? void 0 : htmlPreview;
6233
6628
  const tooLarge = html.length > HTML_PREVIEW_MAX_CHARS;
6234
6629
  const canFrame = Boolean(options) && !tooLarge;
6235
- const [view, setView] = useState13(canFrame ? "preview" : "source");
6236
- const [tall, setTall] = useState13(false);
6630
+ const [view, setView] = useState14(canFrame ? "preview" : "source");
6631
+ const [tall, setTall] = useState14(false);
6237
6632
  const showing = canFrame ? view : "source";
6238
6633
  const scripts = options?.scripts === true;
6239
6634
  const height = options?.height ?? 300;
6240
6635
  const linked = useMemo7(() => showing === "preview" ? linkedFilesOf(html) : [], [html, showing]);
6241
- return /* @__PURE__ */ jsx12(
6636
+ return /* @__PURE__ */ jsx13(
6242
6637
  SandboxedFrame,
6243
6638
  {
6244
6639
  className: "awr-frame--html",
@@ -6246,35 +6641,35 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
6246
6641
  html: showing === "preview" ? html : void 0,
6247
6642
  scripts,
6248
6643
  height: tall ? height * 2 : height,
6249
- label: /* @__PURE__ */ jsxs10(Fragment7, { children: [
6250
- /* @__PURE__ */ jsx12(CodeIcon, { size: 14, className: "awr-frame__icon" }),
6251
- /* @__PURE__ */ jsxs10("span", { className: "awr-frame__titles", children: [
6252
- /* @__PURE__ */ jsx12("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
6253
- /* @__PURE__ */ jsx12("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
6254
- /* @__PURE__ */ jsx12(LockIcon, { size: 11 }),
6644
+ label: /* @__PURE__ */ jsxs11(Fragment8, { children: [
6645
+ /* @__PURE__ */ jsx13(CodeIcon, { size: 14, className: "awr-frame__icon" }),
6646
+ /* @__PURE__ */ jsxs11("span", { className: "awr-frame__titles", children: [
6647
+ /* @__PURE__ */ jsx13("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
6648
+ /* @__PURE__ */ jsx13("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
6649
+ /* @__PURE__ */ jsx13(LockIcon, { size: 11 }),
6255
6650
  " ",
6256
6651
  L.htmlSandboxed,
6257
6652
  " \xB7 ",
6258
- /* @__PURE__ */ jsx12(NoNetworkIcon, { size: 11 }),
6653
+ /* @__PURE__ */ jsx13(NoNetworkIcon, { size: 11 }),
6259
6654
  " ",
6260
6655
  L.htmlNoNetwork
6261
6656
  ] }) : L.htmlSourceNote })
6262
6657
  ] })
6263
6658
  ] }),
6264
- actions: canFrame ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
6265
- /* @__PURE__ */ jsx12(
6659
+ actions: canFrame ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
6660
+ /* @__PURE__ */ jsx13(
6266
6661
  Seg,
6267
6662
  {
6268
6663
  label: L.htmlFrameTitle,
6269
6664
  value: showing,
6270
6665
  onChange: setView,
6271
6666
  options: [
6272
- { value: "preview", label: L.preview, icon: /* @__PURE__ */ jsx12(EyeIcon, { size: 13 }) },
6273
- { value: "source", label: L.fileSource, icon: /* @__PURE__ */ jsx12(CodeIcon, { size: 13 }) }
6667
+ { value: "preview", label: L.preview, icon: /* @__PURE__ */ jsx13(EyeIcon, { size: 13 }) },
6668
+ { value: "source", label: L.fileSource, icon: /* @__PURE__ */ jsx13(CodeIcon, { size: 13 }) }
6274
6669
  ]
6275
6670
  }
6276
6671
  ),
6277
- /* @__PURE__ */ jsx12(
6672
+ /* @__PURE__ */ jsx13(
6278
6673
  "button",
6279
6674
  {
6280
6675
  type: "button",
@@ -6284,14 +6679,14 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
6284
6679
  "aria-pressed": tall,
6285
6680
  disabled: showing !== "preview",
6286
6681
  onClick: () => setTall((t) => !t),
6287
- children: /* @__PURE__ */ jsx12(ExpandIcon, { size: 15 })
6682
+ children: /* @__PURE__ */ jsx13(ExpandIcon, { size: 15 })
6288
6683
  }
6289
6684
  )
6290
6685
  ] }) : void 0,
6291
- footer: /* @__PURE__ */ jsxs10(Fragment7, { children: [
6292
- /* @__PURE__ */ jsx12(FileIcon, { size: 11 }),
6293
- /* @__PURE__ */ jsx12("code", { children: written.path }),
6294
- /* @__PURE__ */ jsxs10("span", { className: "awr-frame__footmeta", children: [
6686
+ footer: /* @__PURE__ */ jsxs11(Fragment8, { children: [
6687
+ /* @__PURE__ */ jsx13(FileIcon, { size: 11 }),
6688
+ /* @__PURE__ */ jsx13("code", { children: written.path }),
6689
+ /* @__PURE__ */ jsxs11("span", { className: "awr-frame__footmeta", children: [
6295
6690
  "\xB7 ",
6296
6691
  L.bytes(file.size),
6297
6692
  " \xB7",
@@ -6300,18 +6695,18 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
6300
6695
  linked.length > 0 ? ` \xB7 ${L.htmlLinkedFiles(linked.join(", "))}` : ""
6301
6696
  ] })
6302
6697
  ] }),
6303
- children: showing === "source" ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
6304
- tooLarge && options ? /* @__PURE__ */ jsx12("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
6305
- /* @__PURE__ */ jsx12(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
6698
+ children: showing === "source" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
6699
+ tooLarge && options ? /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
6700
+ /* @__PURE__ */ jsx13(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
6306
6701
  ] }) : void 0
6307
6702
  }
6308
6703
  );
6309
6704
  };
6310
6705
  var ImagePreview = ({ written, vfs, onClose, L }) => {
6311
6706
  const url = useFileUrl(vfs, written.path, written.mediaType.toLowerCase().split(";")[0].trim());
6312
- return /* @__PURE__ */ jsxs10("div", { className: "awr-fileview", children: [
6313
- /* @__PURE__ */ jsx12(FileViewHead, { written, kind: "image", onClose, L }),
6314
- /* @__PURE__ */ jsx12("div", { className: "awr-fileview__image", children: url ? /* @__PURE__ */ jsx12("img", { src: url, alt: fileNameOf(written.path) }) : null })
6707
+ return /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
6708
+ /* @__PURE__ */ jsx13(FileViewHead, { written, kind: "image", onClose, L }),
6709
+ /* @__PURE__ */ jsx13("div", { className: "awr-fileview__image", children: url ? /* @__PURE__ */ jsx13("img", { src: url, alt: fileNameOf2(written.path) }) : null })
6315
6710
  ] });
6316
6711
  };
6317
6712
  var FileViewHead = ({
@@ -6320,15 +6715,15 @@ var FileViewHead = ({
6320
6715
  onClose,
6321
6716
  L,
6322
6717
  children
6323
- }) => /* @__PURE__ */ jsxs10("div", { className: "awr-fileview__head", children: [
6324
- /* @__PURE__ */ jsx12("span", { className: "awr-fileview__name", title: written.path, children: fileNameOf(written.path) }),
6325
- /* @__PURE__ */ jsxs10("span", { className: "awr-fileview__kind", children: [
6718
+ }) => /* @__PURE__ */ jsxs11("div", { className: "awr-fileview__head", children: [
6719
+ /* @__PURE__ */ jsx13("span", { className: "awr-fileview__name", title: written.path, children: fileNameOf2(written.path) }),
6720
+ /* @__PURE__ */ jsxs11("span", { className: "awr-fileview__kind", children: [
6326
6721
  "\xB7 ",
6327
6722
  L.fileKinds[kind]
6328
6723
  ] }),
6329
- /* @__PURE__ */ jsxs10("span", { className: "awr-fileview__actions", children: [
6724
+ /* @__PURE__ */ jsxs11("span", { className: "awr-fileview__actions", children: [
6330
6725
  children,
6331
- /* @__PURE__ */ jsx12(
6726
+ /* @__PURE__ */ jsx13(
6332
6727
  "button",
6333
6728
  {
6334
6729
  type: "button",
@@ -6336,7 +6731,7 @@ var FileViewHead = ({
6336
6731
  "aria-label": L.closePreview,
6337
6732
  title: L.closePreview,
6338
6733
  onClick: onClose,
6339
- children: /* @__PURE__ */ jsx12(XIcon, { size: 14 })
6734
+ children: /* @__PURE__ */ jsx13(XIcon, { size: 14 })
6340
6735
  }
6341
6736
  )
6342
6737
  ] })
@@ -6356,15 +6751,15 @@ var TextPreview = ({
6356
6751
  [renderFileContent, written, text, previewChars]
6357
6752
  );
6358
6753
  const hasRendered = rendered !== void 0 && rendered !== null && rendered !== false;
6359
- const [view, setView] = useState13("rendered");
6360
- const [all, setAll] = useState13(false);
6754
+ const [view, setView] = useState14("rendered");
6755
+ const [all, setAll] = useState14(false);
6361
6756
  const showing = hasRendered ? view : "source";
6362
6757
  const long = text.length > 1200 || text.split("\n").length > 16;
6363
- return /* @__PURE__ */ jsxs10("div", { className: "awr-fileview", children: [
6364
- /* @__PURE__ */ jsx12(FileViewHead, { written, kind, onClose, L, children: hasRendered && /* @__PURE__ */ jsx12(
6758
+ return /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
6759
+ /* @__PURE__ */ jsx13(FileViewHead, { written, kind, onClose, L, children: hasRendered && /* @__PURE__ */ jsx13(
6365
6760
  Seg,
6366
6761
  {
6367
- label: fileNameOf(written.path),
6762
+ label: fileNameOf2(written.path),
6368
6763
  value: showing,
6369
6764
  onChange: setView,
6370
6765
  options: [
@@ -6373,16 +6768,16 @@ var TextPreview = ({
6373
6768
  ]
6374
6769
  }
6375
6770
  ) }),
6376
- /* @__PURE__ */ jsx12("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
6377
- /* @__PURE__ */ jsx12("div", { className: "awr-fileview__rendered", children: rendered }),
6378
- text.length > previewChars && /* @__PURE__ */ jsx12("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
6379
- ] }) : /* @__PURE__ */ jsx12(SourceView, { text, maxChars: previewChars }) }),
6380
- long && /* @__PURE__ */ jsx12("div", { className: "awr-fileview__more", children: /* @__PURE__ */ jsx12("button", { type: "button", className: "awr-linkbtn", onClick: () => setAll((a) => !a), children: all ? L.fileShowLess : L.fileShowRest }) })
6771
+ /* @__PURE__ */ jsx13("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ jsxs11(Fragment8, { children: [
6772
+ /* @__PURE__ */ jsx13("div", { className: "awr-fileview__rendered", children: rendered }),
6773
+ text.length > previewChars && /* @__PURE__ */ jsx13("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
6774
+ ] }) : /* @__PURE__ */ jsx13(SourceView, { text, maxChars: previewChars }) }),
6775
+ long && /* @__PURE__ */ jsx13("div", { className: "awr-fileview__more", children: /* @__PURE__ */ jsx13("button", { type: "button", className: "awr-linkbtn", onClick: () => setAll((a) => !a), children: all ? L.fileShowLess : L.fileShowRest }) })
6381
6776
  ] });
6382
6777
  };
6383
- var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ jsxs10("div", { className: "awr-fileview", children: [
6384
- /* @__PURE__ */ jsx12(FileViewHead, { written, kind, onClose, L }),
6385
- /* @__PURE__ */ jsx12("p", { className: "awr-fileview__none", children: L.fileNoPreview })
6778
+ var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ jsxs11("div", { className: "awr-fileview", children: [
6779
+ /* @__PURE__ */ jsx13(FileViewHead, { written, kind, onClose, L }),
6780
+ /* @__PURE__ */ jsx13("p", { className: "awr-fileview__none", children: L.fileNoPreview })
6386
6781
  ] });
6387
6782
  var FileChips = ({
6388
6783
  written,
@@ -6399,11 +6794,11 @@ var FileChips = ({
6399
6794
  }) => {
6400
6795
  const L = useLabels(labels);
6401
6796
  const live = useVirtualFiles(vfs);
6402
- const [openPath, setOpenPath] = useState13(defaultOpen);
6403
- const [file, setFile] = useState13();
6797
+ const [openPath, setOpenPath] = useState14(defaultOpen);
6798
+ const [file, setFile] = useState14();
6404
6799
  const open = written.find((f) => f.path === openPath);
6405
6800
  const stamp = live.files.find((f) => f.path === openPath)?.updatedAt;
6406
- useEffect12(() => {
6801
+ useEffect14(() => {
6407
6802
  if (!vfs || !openPath) return setFile(void 0);
6408
6803
  let gone = false;
6409
6804
  vfs.read(openPath).then((f) => {
@@ -6430,23 +6825,23 @@ var FileChips = ({
6430
6825
  onClose: () => setOpenPath(void 0),
6431
6826
  L
6432
6827
  };
6433
- if (kind === "html") return /* @__PURE__ */ jsx12(HtmlPreview, { ...props }, open.path);
6434
- if (kind === "image") return /* @__PURE__ */ jsx12(ImagePreview, { ...props }, open.path);
6435
- if (kind === "file") return /* @__PURE__ */ jsx12(NoPreview, { ...props }, open.path);
6436
- return /* @__PURE__ */ jsx12(TextPreview, { ...props }, open.path);
6828
+ if (kind === "html") return /* @__PURE__ */ jsx13(HtmlPreview, { ...props }, open.path);
6829
+ if (kind === "image") return /* @__PURE__ */ jsx13(ImagePreview, { ...props }, open.path);
6830
+ if (kind === "file") return /* @__PURE__ */ jsx13(NoPreview, { ...props }, open.path);
6831
+ return /* @__PURE__ */ jsx13(TextPreview, { ...props }, open.path);
6437
6832
  };
6438
- return /* @__PURE__ */ jsxs10("div", { className: ["awr-msg__files", className].filter(Boolean).join(" "), children: [
6439
- showHeader && /* @__PURE__ */ jsxs10("div", { className: "awr-msg__fileshead", children: [
6440
- /* @__PURE__ */ jsx12(FileIcon, { size: 13 }),
6441
- /* @__PURE__ */ jsx12("span", { children: L.filesWritten(written.length) }),
6442
- onShowFiles && /* @__PURE__ */ jsx12("button", { type: "button", className: "awr-linkbtn", onClick: onShowFiles, children: L.showInFiles })
6833
+ return /* @__PURE__ */ jsxs11("div", { className: ["awr-msg__files", className].filter(Boolean).join(" "), children: [
6834
+ showHeader && /* @__PURE__ */ jsxs11("div", { className: "awr-msg__fileshead", children: [
6835
+ /* @__PURE__ */ jsx13(FileIcon, { size: 13 }),
6836
+ /* @__PURE__ */ jsx13("span", { children: L.filesWritten(written.length) }),
6837
+ onShowFiles && /* @__PURE__ */ jsx13("button", { type: "button", className: "awr-linkbtn", onClick: onShowFiles, children: L.showInFiles })
6443
6838
  ] }),
6444
- /* @__PURE__ */ jsx12("ul", { className: "awr-filechips", children: written.map((w) => {
6839
+ /* @__PURE__ */ jsx13("ul", { className: "awr-filechips", children: written.map((w) => {
6445
6840
  const info = live.files.find((f) => f.path === w.path);
6446
6841
  const gone = Boolean(vfs) && !live.loading && !info;
6447
6842
  const usable = Boolean(vfs) && !gone;
6448
6843
  const isOpen = openPath === w.path && usable;
6449
- const chip = /* @__PURE__ */ jsx12(
6844
+ const chip = /* @__PURE__ */ jsx13(
6450
6845
  FileChip,
6451
6846
  {
6452
6847
  written: w,
@@ -6459,7 +6854,7 @@ var FileChips = ({
6459
6854
  labels
6460
6855
  }
6461
6856
  );
6462
- return /* @__PURE__ */ jsx12("li", { className: "awr-filechips__item", children: renderFile ? renderFile(w, chip) : chip }, w.path);
6857
+ return /* @__PURE__ */ jsx13("li", { className: "awr-filechips__item", children: renderFile ? renderFile(w, chip) : chip }, w.path);
6463
6858
  }) }),
6464
6859
  preview()
6465
6860
  ] });
@@ -6476,7 +6871,7 @@ var FileChip = ({
6476
6871
  }) => {
6477
6872
  const L = useLabels(labels);
6478
6873
  const kind = fileKindOf(written.path, mediaType);
6479
- const name = fileNameOf(written.path);
6874
+ const name = fileNameOf2(written.path);
6480
6875
  const Icon = KIND_ICON[kind];
6481
6876
  const thumb = useFileUrl(
6482
6877
  kind === "image" ? vfs : void 0,
@@ -6484,19 +6879,19 @@ var FileChip = ({
6484
6879
  kind === "image" ? mediaType.toLowerCase().split(";")[0].trim() : void 0
6485
6880
  );
6486
6881
  const meta = gone ? L.fileGone : [L.fileKinds[kind], L.bytes(bytes), written.by ? L.fileBy(written.by.name) : ""].filter(Boolean).join(" \xB7 ");
6487
- return /* @__PURE__ */ jsxs10(
6882
+ return /* @__PURE__ */ jsxs11(
6488
6883
  "div",
6489
6884
  {
6490
6885
  className: `awr-filechip${open ? " is-open" : ""}${gone ? " is-gone" : ""}`,
6491
6886
  title: written.path,
6492
6887
  children: [
6493
- /* @__PURE__ */ jsx12("span", { className: "awr-filechip__thumb", children: thumb ? /* @__PURE__ */ jsx12("img", { src: thumb, alt: "" }) : /* @__PURE__ */ jsx12(Icon, { size: 16 }) }),
6494
- /* @__PURE__ */ jsxs10("span", { className: "awr-filechip__text", children: [
6495
- /* @__PURE__ */ jsx12("span", { className: "awr-filechip__name", children: name }),
6496
- /* @__PURE__ */ jsx12("span", { className: "awr-filechip__meta", children: meta })
6888
+ /* @__PURE__ */ jsx13("span", { className: "awr-filechip__thumb", children: thumb ? /* @__PURE__ */ jsx13("img", { src: thumb, alt: "" }) : /* @__PURE__ */ jsx13(Icon, { size: 16 }) }),
6889
+ /* @__PURE__ */ jsxs11("span", { className: "awr-filechip__text", children: [
6890
+ /* @__PURE__ */ jsx13("span", { className: "awr-filechip__name", children: name }),
6891
+ /* @__PURE__ */ jsx13("span", { className: "awr-filechip__meta", children: meta })
6497
6892
  ] }),
6498
- vfs && /* @__PURE__ */ jsxs10("span", { className: "awr-filechip__actions", children: [
6499
- onToggle && /* @__PURE__ */ jsx12(
6893
+ vfs && /* @__PURE__ */ jsxs11("span", { className: "awr-filechip__actions", children: [
6894
+ onToggle && /* @__PURE__ */ jsx13(
6500
6895
  "button",
6501
6896
  {
6502
6897
  type: "button",
@@ -6505,10 +6900,10 @@ var FileChip = ({
6505
6900
  title: open ? L.closePreview : L.preview,
6506
6901
  "aria-expanded": open,
6507
6902
  onClick: onToggle,
6508
- children: open ? /* @__PURE__ */ jsx12(ChevronUpIcon, { size: 15 }) : /* @__PURE__ */ jsx12(EyeIcon, { size: 15 })
6903
+ children: open ? /* @__PURE__ */ jsx13(ChevronUpIcon, { size: 15 }) : /* @__PURE__ */ jsx13(EyeIcon, { size: 15 })
6509
6904
  }
6510
6905
  ),
6511
- /* @__PURE__ */ jsx12(
6906
+ /* @__PURE__ */ jsx13(
6512
6907
  "button",
6513
6908
  {
6514
6909
  type: "button",
@@ -6516,7 +6911,7 @@ var FileChip = ({
6516
6911
  "aria-label": L.fileDownload(name),
6517
6912
  title: L.download,
6518
6913
  onClick: () => void downloadFile(vfs, written.path),
6519
- children: /* @__PURE__ */ jsx12(DownloadIcon, { size: 15 })
6914
+ children: /* @__PURE__ */ jsx13(DownloadIcon, { size: 15 })
6520
6915
  }
6521
6916
  )
6522
6917
  ] })
@@ -6526,14 +6921,14 @@ var FileChip = ({
6526
6921
  };
6527
6922
 
6528
6923
  // src/components/StepList.tsx
6529
- import { Fragment as Fragment9 } from "react";
6924
+ import { Fragment as Fragment10 } from "react";
6530
6925
 
6531
6926
  // src/components/SubagentTree.tsx
6532
- import { Fragment as Fragment8, useEffect as useEffect13, useState as useState14 } from "react";
6533
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
6927
+ import { Fragment as Fragment9, useEffect as useEffect15, useState as useState15 } from "react";
6928
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
6534
6929
  var useElapsed = (startedAt, running) => {
6535
- const [now, setNow] = useState14(void 0);
6536
- useEffect13(() => {
6930
+ const [now, setNow] = useState15(void 0);
6931
+ useEffect15(() => {
6537
6932
  if (!running || startedAt === void 0) return;
6538
6933
  setNow(Date.now());
6539
6934
  const timer = setInterval(() => setNow(Date.now()), 1e3);
@@ -6561,19 +6956,19 @@ var SubagentRow = ({
6561
6956
  sub.toolCalls > 0 ? L.toolCalls(sub.toolCalls) : "",
6562
6957
  time !== void 0 ? formatDuration(time) : ""
6563
6958
  ].filter(Boolean);
6564
- return /* @__PURE__ */ jsxs11(
6959
+ return /* @__PURE__ */ jsxs12(
6565
6960
  "li",
6566
6961
  {
6567
6962
  className: `awr-subagent awr-subagent--${sub.status}${sub.dynamic ? " awr-subagent--dynamic" : ""}`,
6568
6963
  "data-depth": sub.depth,
6569
6964
  children: [
6570
- /* @__PURE__ */ jsxs11("div", { className: "awr-subagent__head", children: [
6571
- /* @__PURE__ */ jsx13("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ jsx13(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ jsx13(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ jsx13(StopIcon, { size: 13 }) : /* @__PURE__ */ jsx13(AlertIcon, { size: 13 }) }),
6572
- /* @__PURE__ */ jsx13("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
6573
- sub.dynamic && role && /* @__PURE__ */ jsx13("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
6574
- sub.profile && /* @__PURE__ */ jsx13("span", { className: "awr-subagent__profile", children: sub.profile }),
6575
- /* @__PURE__ */ jsx13("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
6576
- running && onStop && /* @__PURE__ */ jsx13(
6965
+ /* @__PURE__ */ jsxs12("div", { className: "awr-subagent__head", children: [
6966
+ /* @__PURE__ */ jsx14("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ jsx14(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ jsx14(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ jsx14(StopIcon, { size: 13 }) : /* @__PURE__ */ jsx14(AlertIcon, { size: 13 }) }),
6967
+ /* @__PURE__ */ jsx14("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
6968
+ sub.dynamic && role && /* @__PURE__ */ jsx14("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
6969
+ sub.profile && /* @__PURE__ */ jsx14("span", { className: "awr-subagent__profile", children: sub.profile }),
6970
+ /* @__PURE__ */ jsx14("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
6971
+ running && onStop && /* @__PURE__ */ jsx14(
6577
6972
  "button",
6578
6973
  {
6579
6974
  type: "button",
@@ -6581,16 +6976,16 @@ var SubagentRow = ({
6581
6976
  "aria-label": L.stopSubagent,
6582
6977
  title: L.stopSubagent,
6583
6978
  onClick: () => onStop(sub.id),
6584
- children: /* @__PURE__ */ jsx13(StopIcon, { size: 12 })
6979
+ children: /* @__PURE__ */ jsx14(StopIcon, { size: 12 })
6585
6980
  }
6586
6981
  )
6587
6982
  ] }),
6588
- showUsage && /* @__PURE__ */ jsxs11("div", { className: "awr-subagent__meta", children: [
6589
- /* @__PURE__ */ jsx13("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
6590
- meta.map((part, i) => /* @__PURE__ */ jsx13("span", { className: "awr-subagent__metaitem", children: part }, i))
6983
+ showUsage && /* @__PURE__ */ jsxs12("div", { className: "awr-subagent__meta", children: [
6984
+ /* @__PURE__ */ jsx14("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
6985
+ meta.map((part, i) => /* @__PURE__ */ jsx14("span", { className: "awr-subagent__metaitem", children: part }, i))
6591
6986
  ] }),
6592
- showTools && sub.tools && /* @__PURE__ */ jsx13("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
6593
- /* @__PURE__ */ jsx13("div", { className: "awr-subagent__activity", children: sub.status === "error" ? sub.error : sub.status === "stopped" ? L.subagentStopped : sub.status === "done" ? previewValue(sub.text, 160) : `${sub.activity}${!showUsage && sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` }),
6987
+ showTools && sub.tools && /* @__PURE__ */ jsx14("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
6988
+ /* @__PURE__ */ jsx14("div", { className: "awr-subagent__activity", children: sub.status === "error" ? sub.error : sub.status === "stopped" ? L.subagentStopped : sub.status === "done" ? previewValue(sub.text, 160) : `${sub.activity}${!showUsage && sub.toolCalls ? ` \xB7 ${L.toolCalls(sub.toolCalls)}` : ""}` }),
6594
6989
  children
6595
6990
  ]
6596
6991
  }
@@ -6606,12 +7001,12 @@ var SubagentTree = ({
6606
7001
  className
6607
7002
  }) => {
6608
7003
  if (subagents.length === 0) return null;
6609
- const branch = (nodes, nested) => /* @__PURE__ */ jsx13(
7004
+ const branch = (nodes, nested) => /* @__PURE__ */ jsx14(
6610
7005
  "ul",
6611
7006
  {
6612
7007
  className: ["awr-subagents", nested ? "awr-subagents--nested" : className].filter(Boolean).join(" "),
6613
7008
  children: nodes.map((node) => {
6614
- const row = /* @__PURE__ */ jsx13(
7009
+ const row = /* @__PURE__ */ jsx14(
6615
7010
  SubagentRow,
6616
7011
  {
6617
7012
  sub: node,
@@ -6623,7 +7018,7 @@ var SubagentTree = ({
6623
7018
  },
6624
7019
  node.id
6625
7020
  );
6626
- return renderSubagent ? /* @__PURE__ */ jsx13(Fragment8, { children: renderSubagent(node, row) }, node.id) : row;
7021
+ return renderSubagent ? /* @__PURE__ */ jsx14(Fragment9, { children: renderSubagent(node, row) }, node.id) : row;
6627
7022
  })
6628
7023
  }
6629
7024
  );
@@ -6631,7 +7026,7 @@ var SubagentTree = ({
6631
7026
  };
6632
7027
 
6633
7028
  // src/components/StepList.tsx
6634
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
7029
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
6635
7030
  var WEB_SEARCH = "web_search";
6636
7031
  var ToolCallRow = ({
6637
7032
  call,
@@ -6649,37 +7044,47 @@ var ToolCallRow = ({
6649
7044
  call.outputTokens ? `\u2248${formatTokens(call.outputTokens)} out` : "",
6650
7045
  call.durationMs !== void 0 ? formatDuration(call.durationMs) : ""
6651
7046
  ].filter(Boolean).join(" \xB7 ");
6652
- return /* @__PURE__ */ jsxs12(
7047
+ return /* @__PURE__ */ jsxs13(
6653
7048
  "li",
6654
7049
  {
6655
7050
  className: `awr-tool awr-tool--${state}${showTiers && call.attempt !== void 0 ? " awr-tool--earlier" : ""}`,
6656
7051
  children: [
6657
- /* @__PURE__ */ jsxs12("div", { className: "awr-tool__row", children: [
6658
- /* @__PURE__ */ jsx14(ToolIcon, { size: 13, className: "awr-tool__icon" }),
6659
- /* @__PURE__ */ jsx14("code", { className: "awr-tool__name", children: call.name }),
6660
- previewValue(call.input) && /* @__PURE__ */ jsx14("span", { className: "awr-tool__args", children: previewValue(call.input) }),
6661
- call.status === "calling" && /* @__PURE__ */ jsx14(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
6662
- call.status === "done" && call.ok === false && /* @__PURE__ */ jsx14("span", { className: "awr-tool__badge", children: L.failed }),
6663
- showTiers && call.replayed && /* @__PURE__ */ jsx14("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
6664
- showTiers && call.attempt !== void 0 && /* @__PURE__ */ jsx14("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
6665
- call.app && /* @__PURE__ */ jsxs12("span", { className: "awr-tool__tag awr-tool__tag--app", "data-app": call.app, children: [
6666
- /* @__PURE__ */ jsx14(AppIcon, { size: 10 }),
7052
+ /* @__PURE__ */ jsxs13("div", { className: "awr-tool__row", children: [
7053
+ /* @__PURE__ */ jsx15(ToolIcon, { size: 13, className: "awr-tool__icon" }),
7054
+ /* @__PURE__ */ jsx15("code", { className: "awr-tool__name", children: call.name }),
7055
+ previewValue(call.input) && /* @__PURE__ */ jsx15("span", { className: "awr-tool__args", children: previewValue(call.input) }),
7056
+ call.status === "calling" && /* @__PURE__ */ jsx15(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
7057
+ call.status === "done" && call.ok === false && /* @__PURE__ */ jsx15("span", { className: "awr-tool__badge", children: L.failed }),
7058
+ showTiers && call.replayed && /* @__PURE__ */ jsx15("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
7059
+ showTiers && call.attempt !== void 0 && /* @__PURE__ */ jsx15("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
7060
+ call.app && /* @__PURE__ */ jsxs13("span", { className: "awr-tool__tag awr-tool__tag--app", "data-app": call.app, children: [
7061
+ /* @__PURE__ */ jsx15(AppIcon, { size: 10 }),
6667
7062
  " ",
6668
7063
  L.appTag
6669
7064
  ] }),
6670
- showUsage && cost && /* @__PURE__ */ jsx14("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
7065
+ showUsage && cost && /* @__PURE__ */ jsx15("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
6671
7066
  ] }),
6672
- images.length > 0 && /* @__PURE__ */ jsx14("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ jsx14("a", { href: src, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx14("img", { className: "awr-thumb", src, alt: `${call.name} result ${i + 1}` }) }, i)) }),
6673
- search && /* @__PURE__ */ jsxs12("div", { className: "awr-search", children: [
6674
- /* @__PURE__ */ jsxs12("p", { className: "awr-search__query", children: [
6675
- /* @__PURE__ */ jsx14(GlobeIcon, { size: 12 }),
7067
+ images.length > 0 && /* @__PURE__ */ jsx15("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ jsx15(
7068
+ ImageThumb,
7069
+ {
7070
+ src,
7071
+ name: `${call.name}-${i + 1}${imageExtensionOf(src)}`,
7072
+ alt: `${call.name} result ${i + 1}`,
7073
+ imgClassName: "awr-thumb",
7074
+ labels
7075
+ },
7076
+ i
7077
+ )) }),
7078
+ search && /* @__PURE__ */ jsxs13("div", { className: "awr-search", children: [
7079
+ /* @__PURE__ */ jsxs13("p", { className: "awr-search__query", children: [
7080
+ /* @__PURE__ */ jsx15(GlobeIcon, { size: 12 }),
6676
7081
  " ",
6677
7082
  L.searchQuery,
6678
7083
  " ",
6679
- /* @__PURE__ */ jsx14("q", { children: search.query })
7084
+ /* @__PURE__ */ jsx15("q", { children: search.query })
6680
7085
  ] }),
6681
- search.results.length > 0 ? /* @__PURE__ */ jsx14("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ jsxs12("li", { className: "awr-search__result", children: [
6682
- /* @__PURE__ */ jsx14(
7086
+ search.results.length > 0 ? /* @__PURE__ */ jsx15("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ jsxs13("li", { className: "awr-search__result", children: [
7087
+ /* @__PURE__ */ jsx15(
6683
7088
  "a",
6684
7089
  {
6685
7090
  className: "awr-search__title",
@@ -6690,13 +7095,13 @@ var ToolCallRow = ({
6690
7095
  }
6691
7096
  ),
6692
7097
  " ",
6693
- /* @__PURE__ */ jsxs12("span", { className: "awr-search__host", children: [
7098
+ /* @__PURE__ */ jsxs13("span", { className: "awr-search__host", children: [
6694
7099
  r.host,
6695
7100
  r.date ? ` \xB7 ${r.date}` : ""
6696
7101
  ] }),
6697
- r.snippet && /* @__PURE__ */ jsx14("p", { className: "awr-search__snippet", children: r.snippet })
6698
- ] }, i)) }) : /* @__PURE__ */ jsx14("p", { className: "awr-search__note", children: L.searchNoResults }),
6699
- (search.filtered > 0 || search.truncated) && /* @__PURE__ */ jsx14("p", { className: "awr-search__note", children: [
7102
+ r.snippet && /* @__PURE__ */ jsx15("p", { className: "awr-search__snippet", children: r.snippet })
7103
+ ] }, i)) }) : /* @__PURE__ */ jsx15("p", { className: "awr-search__note", children: L.searchNoResults }),
7104
+ (search.filtered > 0 || search.truncated) && /* @__PURE__ */ jsx15("p", { className: "awr-search__note", children: [
6700
7105
  search.filtered > 0 ? L.searchFiltered(search.filtered) : "",
6701
7106
  search.truncated ? L.searchTruncated : ""
6702
7107
  ].filter(Boolean).join(" \xB7 ") })
@@ -6710,11 +7115,11 @@ var UserNoteRow = ({
6710
7115
  labels
6711
7116
  }) => {
6712
7117
  const L = useLabels(labels);
6713
- return /* @__PURE__ */ jsxs12("li", { className: `awr-note awr-note--${note.at}`, children: [
6714
- /* @__PURE__ */ jsx14(SendIcon, { size: 12, className: "awr-note__icon" }),
6715
- /* @__PURE__ */ jsx14("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
6716
- /* @__PURE__ */ jsx14("q", { className: "awr-note__text", children: note.text }),
6717
- note.origin === "another-tab" && /* @__PURE__ */ jsx14("span", { className: "awr-note__origin", children: L.fromAnotherTab })
7118
+ return /* @__PURE__ */ jsxs13("li", { className: `awr-note awr-note--${note.at}`, children: [
7119
+ /* @__PURE__ */ jsx15(SendIcon, { size: 12, className: "awr-note__icon" }),
7120
+ /* @__PURE__ */ jsx15("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
7121
+ /* @__PURE__ */ jsx15("q", { className: "awr-note__text", children: note.text }),
7122
+ note.origin === "another-tab" && /* @__PURE__ */ jsx15("span", { className: "awr-note__origin", children: L.fromAnotherTab })
6718
7123
  ] });
6719
7124
  };
6720
7125
  var decisionNote = (d, L) => {
@@ -6745,18 +7150,14 @@ var StepItem = ({
6745
7150
  renderToolCall,
6746
7151
  renderSubagent,
6747
7152
  L
6748
- }) => /* @__PURE__ */ jsxs12("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
6749
- /* @__PURE__ */ jsxs12("div", { className: "awr-step__head", children: [
6750
- /* @__PURE__ */ jsx14("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ jsx14(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ jsx14(AlertIcon, { size: 14 }) : /* @__PURE__ */ jsx14(CheckIcon, { size: 14 }) }),
6751
- /* @__PURE__ */ jsxs12("span", { className: "awr-step__index", children: [
6752
- step.index,
6753
- "/",
6754
- step.total
6755
- ] }),
6756
- /* @__PURE__ */ jsx14("span", { className: "awr-step__desc", children: step.step.description })
7153
+ }) => /* @__PURE__ */ jsxs13("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
7154
+ /* @__PURE__ */ jsxs13("div", { className: "awr-step__head", children: [
7155
+ /* @__PURE__ */ jsx15("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ jsx15(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ jsx15(AlertIcon, { size: 14 }) : /* @__PURE__ */ jsx15(CheckIcon, { size: 14 }) }),
7156
+ /* @__PURE__ */ jsx15("span", { className: "awr-step__index", children: `${step.index}/${step.total}` }),
7157
+ /* @__PURE__ */ jsx15("span", { className: "awr-step__desc", children: step.step.description })
6757
7158
  ] }),
6758
- showTiers && step.tier && /* @__PURE__ */ jsxs12("div", { className: "awr-step__meta", children: [
6759
- /* @__PURE__ */ jsx14(
7159
+ showTiers && step.tier && /* @__PURE__ */ jsxs13("div", { className: "awr-step__meta", children: [
7160
+ /* @__PURE__ */ jsx15(
6760
7161
  "span",
6761
7162
  {
6762
7163
  className: `awr-step__tier awr-step__tier--${step.tier}`,
@@ -6764,29 +7165,29 @@ var StepItem = ({
6764
7165
  children: L.tierNames[step.tier]
6765
7166
  }
6766
7167
  ),
6767
- step.model && /* @__PURE__ */ jsx14("span", { className: "awr-step__model", children: step.model })
7168
+ step.model && /* @__PURE__ */ jsx15("span", { className: "awr-step__model", children: step.model })
6768
7169
  ] }),
6769
- showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ jsxs12("div", { className: "awr-step__escalated", children: [
6770
- /* @__PURE__ */ jsxs12("p", { className: "awr-step__escalated-line", children: [
6771
- /* @__PURE__ */ jsx14(ArrowUpIcon, { size: 12 }),
6772
- /* @__PURE__ */ jsx14("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
7170
+ showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ jsxs13("div", { className: "awr-step__escalated", children: [
7171
+ /* @__PURE__ */ jsxs13("p", { className: "awr-step__escalated-line", children: [
7172
+ /* @__PURE__ */ jsx15(ArrowUpIcon, { size: 12 }),
7173
+ /* @__PURE__ */ jsx15("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
6773
7174
  ] }),
6774
- e.text?.trim() && /* @__PURE__ */ jsxs12("details", { className: "awr-step__attempt", children: [
6775
- /* @__PURE__ */ jsx14("summary", { children: L.escalatedAttemptText }),
6776
- /* @__PURE__ */ jsx14("p", { className: "awr-step__text", children: e.text.trim() })
7175
+ e.text?.trim() && /* @__PURE__ */ jsxs13("details", { className: "awr-step__attempt", children: [
7176
+ /* @__PURE__ */ jsx15("summary", { children: L.escalatedAttemptText }),
7177
+ /* @__PURE__ */ jsx15("p", { className: "awr-step__text", children: e.text.trim() })
6777
7178
  ] })
6778
7179
  ] }, i)),
6779
- showThoughts && step.reasoning.trim() && /* @__PURE__ */ jsxs12("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
6780
- /* @__PURE__ */ jsxs12("summary", { children: [
6781
- /* @__PURE__ */ jsx14(BrainIcon, { size: 13 }),
7180
+ showThoughts && step.reasoning.trim() && /* @__PURE__ */ jsxs13("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
7181
+ /* @__PURE__ */ jsxs13("summary", { children: [
7182
+ /* @__PURE__ */ jsx15(BrainIcon, { size: 13 }),
6782
7183
  " ",
6783
7184
  L.stepThoughts
6784
7185
  ] }),
6785
- /* @__PURE__ */ jsx14("p", { className: "awr-thought__text", children: step.reasoning.trim() })
7186
+ /* @__PURE__ */ jsx15("p", { className: "awr-thought__text", children: step.reasoning.trim() })
6786
7187
  ] }),
6787
- step.text.trim() && /* @__PURE__ */ jsx14("p", { className: "awr-step__text", children: step.text.trim() }),
6788
- showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ jsx14("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
6789
- const row = /* @__PURE__ */ jsx14(
7188
+ step.text.trim() && /* @__PURE__ */ jsx15("p", { className: "awr-step__text", children: step.text.trim() }),
7189
+ showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ jsx15("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
7190
+ const row = /* @__PURE__ */ jsx15(
6790
7191
  ToolCallRow,
6791
7192
  {
6792
7193
  call,
@@ -6796,15 +7197,15 @@ var StepItem = ({
6796
7197
  },
6797
7198
  i
6798
7199
  );
6799
- return renderToolCall ? /* @__PURE__ */ jsx14(Fragment9, { children: renderToolCall(call, row) }, i) : row;
7200
+ return renderToolCall ? /* @__PURE__ */ jsx15(Fragment10, { children: renderToolCall(call, row) }, i) : row;
6800
7201
  }) }),
6801
- approvals.length > 0 && /* @__PURE__ */ jsx14("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ jsxs12("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
6802
- /* @__PURE__ */ jsx14(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
6803
- /* @__PURE__ */ jsx14("code", { className: "awr-tool__name", children: a.name }),
6804
- /* @__PURE__ */ jsx14("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
6805
- a.subagent && /* @__PURE__ */ jsx14("span", { className: "awr-tool__tag", children: L.subagentHelper })
7202
+ approvals.length > 0 && /* @__PURE__ */ jsx15("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ jsxs13("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
7203
+ /* @__PURE__ */ jsx15(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
7204
+ /* @__PURE__ */ jsx15("code", { className: "awr-tool__name", children: a.name }),
7205
+ /* @__PURE__ */ jsx15("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
7206
+ a.subagent && /* @__PURE__ */ jsx15("span", { className: "awr-tool__tag", children: L.subagentHelper })
6806
7207
  ] }, a.id)) }),
6807
- showSubagents && /* @__PURE__ */ jsx14(
7208
+ showSubagents && /* @__PURE__ */ jsx15(
6808
7209
  SubagentTree,
6809
7210
  {
6810
7211
  subagents,
@@ -6813,14 +7214,14 @@ var StepItem = ({
6813
7214
  renderSubagent
6814
7215
  }
6815
7216
  ),
6816
- notes.length > 0 && /* @__PURE__ */ jsx14("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ jsx14(UserNoteRow, { note: n }, n.id)) }),
6817
- step.blocked && step.summary && /* @__PURE__ */ jsx14("p", { className: "awr-step__blocked", children: step.summary }),
6818
- showReplanFailed && step.replanFailed && /* @__PURE__ */ jsxs12("p", { className: "awr-step__warn", title: step.replanFailed, children: [
6819
- /* @__PURE__ */ jsx14(AlertIcon, { size: 12 }),
7217
+ notes.length > 0 && /* @__PURE__ */ jsx15("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ jsx15(UserNoteRow, { note: n }, n.id)) }),
7218
+ step.blocked && step.summary && /* @__PURE__ */ jsx15("p", { className: "awr-step__blocked", children: step.summary }),
7219
+ showReplanFailed && step.replanFailed && /* @__PURE__ */ jsxs13("p", { className: "awr-step__warn", title: step.replanFailed, children: [
7220
+ /* @__PURE__ */ jsx15(AlertIcon, { size: 12 }),
6820
7221
  " ",
6821
7222
  L.replanFailed
6822
7223
  ] }),
6823
- showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ jsx14(
7224
+ showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ jsx15(
6824
7225
  "p",
6825
7226
  {
6826
7227
  className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
@@ -6855,8 +7256,8 @@ var StepList = ({
6855
7256
  const known = new Set(steps.map((s) => s.id));
6856
7257
  const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
6857
7258
  const loose = showSubagents ? subagents.filter((s) => !s.stepId || !known.has(s.stepId)) : [];
6858
- return /* @__PURE__ */ jsxs12("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
6859
- steps.map((step) => /* @__PURE__ */ jsx14(
7259
+ return /* @__PURE__ */ jsxs13("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
7260
+ steps.map((step) => /* @__PURE__ */ jsx15(
6860
7261
  StepItem,
6861
7262
  {
6862
7263
  step,
@@ -6878,7 +7279,7 @@ var StepList = ({
6878
7279
  },
6879
7280
  step.id
6880
7281
  )),
6881
- loose.length > 0 && /* @__PURE__ */ jsx14("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ jsx14(
7282
+ loose.length > 0 && /* @__PURE__ */ jsx15("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ jsx15(
6882
7283
  SubagentTree,
6883
7284
  {
6884
7285
  subagents: loose,
@@ -6887,12 +7288,12 @@ var StepList = ({
6887
7288
  renderSubagent
6888
7289
  }
6889
7290
  ) }),
6890
- atEnd.length > 0 && /* @__PURE__ */ jsx14("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ jsx14("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ jsx14(UserNoteRow, { note: n }, n.id)) }) })
7291
+ atEnd.length > 0 && /* @__PURE__ */ jsx15("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ jsx15("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ jsx15(UserNoteRow, { note: n }, n.id)) }) })
6891
7292
  ] });
6892
7293
  };
6893
7294
 
6894
7295
  // src/components/MessageList.tsx
6895
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
7296
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
6896
7297
  var usageLine = (usage, durationMs) => {
6897
7298
  const parts = [];
6898
7299
  if (usage && usage.totalTokens > 0) {
@@ -6903,8 +7304,17 @@ var usageLine = (usage, durationMs) => {
6903
7304
  if (durationMs !== void 0) parts.push(formatDuration(durationMs));
6904
7305
  return parts.join(" \xB7 ");
6905
7306
  };
6906
- var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ jsx15("a", { href: a.dataUrl, target: "_blank", rel: "noreferrer", title: a.path ?? a.name, children: /* @__PURE__ */ jsx15("img", { className: "awr-thumb awr-thumb--msg", src: a.dataUrl, alt: a.name }) }) : /* @__PURE__ */ jsxs13("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
6907
- /* @__PURE__ */ jsx15(FileIcon, { size: 13 }),
7307
+ var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ jsx16(
7308
+ ImageThumb,
7309
+ {
7310
+ src: a.dataUrl,
7311
+ name: a.path ?? a.name,
7312
+ alt: a.name,
7313
+ imgClassName: "awr-thumb awr-thumb--msg",
7314
+ title: a.path ?? a.name
7315
+ }
7316
+ ) : /* @__PURE__ */ jsxs14("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
7317
+ /* @__PURE__ */ jsx16(FileIcon, { size: 13 }),
6908
7318
  " ",
6909
7319
  a.name
6910
7320
  ] });
@@ -6955,24 +7365,26 @@ var MessageList = ({
6955
7365
  renderToolCall,
6956
7366
  renderApp,
6957
7367
  showApps = true,
7368
+ imageViewer = true,
7369
+ renderImageViewer,
6958
7370
  labels,
6959
7371
  className
6960
7372
  }) => {
6961
7373
  const L = useLabels(labels);
6962
7374
  if (messages.length === 0) {
6963
- return empty ? /* @__PURE__ */ jsx15("div", { className: "awr-messages__empty", children: empty }) : null;
7375
+ return empty ? /* @__PURE__ */ jsx16("div", { className: "awr-messages__empty", children: empty }) : null;
6964
7376
  }
6965
- return /* @__PURE__ */ jsx15("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
7377
+ return /* @__PURE__ */ jsx16(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ jsx16("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
6966
7378
  const steps = m.steps ?? [];
6967
7379
  const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
6968
7380
  const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
6969
- const node = /* @__PURE__ */ jsx15(
7381
+ const node = /* @__PURE__ */ jsx16(
6970
7382
  "div",
6971
7383
  {
6972
7384
  className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
6973
- children: /* @__PURE__ */ jsxs13("div", { className: "awr-msg__col", children: [
6974
- m.role === "assistant" && hasActivity && /* @__PURE__ */ jsxs13("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
6975
- /* @__PURE__ */ jsx15("summary", { className: "awr-activity__summary", children: activitySummary(
7385
+ children: /* @__PURE__ */ jsxs14("div", { className: "awr-msg__col", children: [
7386
+ m.role === "assistant" && hasActivity && /* @__PURE__ */ jsxs14("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
7387
+ /* @__PURE__ */ jsx16("summary", { className: "awr-activity__summary", children: activitySummary(
6976
7388
  m,
6977
7389
  showToolCalls,
6978
7390
  showLearned,
@@ -6982,7 +7394,7 @@ var MessageList = ({
6982
7394
  showApps && Boolean(renderApp)
6983
7395
  ) }),
6984
7396
  m.pending && liveExtra,
6985
- /* @__PURE__ */ jsx15(
7397
+ /* @__PURE__ */ jsx16(
6986
7398
  StepList,
6987
7399
  {
6988
7400
  steps,
@@ -7004,45 +7416,45 @@ var MessageList = ({
7004
7416
  labels
7005
7417
  }
7006
7418
  ),
7007
- showLearned && m.fetches?.length ? /* @__PURE__ */ jsx15("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ jsxs13(
7419
+ showLearned && m.fetches?.length ? /* @__PURE__ */ jsx16("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ jsxs14(
7008
7420
  "li",
7009
7421
  {
7010
7422
  className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
7011
7423
  children: [
7012
- /* @__PURE__ */ jsx15(GlobeIcon, { size: 12 }),
7424
+ /* @__PURE__ */ jsx16(GlobeIcon, { size: 12 }),
7013
7425
  " ",
7014
- /* @__PURE__ */ jsx15("code", { children: f.url }),
7426
+ /* @__PURE__ */ jsx16("code", { children: f.url }),
7015
7427
  " ",
7016
- /* @__PURE__ */ jsx15("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
7428
+ /* @__PURE__ */ jsx16("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
7017
7429
  ]
7018
7430
  },
7019
7431
  i
7020
7432
  )) }) : null,
7021
- showLearned && m.learned?.length ? /* @__PURE__ */ jsxs13("p", { className: "awr-learned", children: [
7022
- /* @__PURE__ */ jsx15(BookIcon, { size: 12 }),
7433
+ showLearned && m.learned?.length ? /* @__PURE__ */ jsxs14("p", { className: "awr-learned", children: [
7434
+ /* @__PURE__ */ jsx16(BookIcon, { size: 12 }),
7023
7435
  " ",
7024
7436
  L.learnedNow(m.learned.join(", "))
7025
7437
  ] }) : null,
7026
- showThoughts && m.reasoning?.trim() && /* @__PURE__ */ jsxs13("details", { className: "awr-thought", children: [
7027
- /* @__PURE__ */ jsxs13("summary", { children: [
7028
- /* @__PURE__ */ jsx15(BrainIcon, { size: 13 }),
7438
+ showThoughts && m.reasoning?.trim() && /* @__PURE__ */ jsxs14("details", { className: "awr-thought", children: [
7439
+ /* @__PURE__ */ jsxs14("summary", { children: [
7440
+ /* @__PURE__ */ jsx16(BrainIcon, { size: 13 }),
7029
7441
  " ",
7030
7442
  L.answerThoughts
7031
7443
  ] }),
7032
- /* @__PURE__ */ jsx15("p", { className: "awr-thought__text", children: m.reasoning.trim() })
7444
+ /* @__PURE__ */ jsx16("p", { className: "awr-thought__text", children: m.reasoning.trim() })
7033
7445
  ] })
7034
7446
  ] }),
7035
- showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ jsx15("div", { className: "awr-msg__apps", children: m.apps.map((app) => /* @__PURE__ */ jsx15("div", { className: "awr-msg__app", children: renderApp(app, m) }, app.id)) }) : null,
7036
- showMedia && m.transcripts?.length ? /* @__PURE__ */ jsx15("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ jsx15(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
7037
- (m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ jsxs13("div", { className: "awr-msg__bubble", children: [
7447
+ showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__apps", children: m.apps.map((app) => /* @__PURE__ */ jsx16("div", { className: "awr-msg__app", children: renderApp(app, m) }, app.id)) }) : null,
7448
+ showMedia && m.transcripts?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ jsx16(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
7449
+ (m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ jsxs14("div", { className: "awr-msg__bubble", children: [
7038
7450
  m.content ? renderContent ? renderContent(m) : m.content : null,
7039
- m.pending && !m.content && /* @__PURE__ */ jsx15(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
7451
+ m.pending && !m.content && /* @__PURE__ */ jsx16(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
7040
7452
  ] }),
7041
- showMedia && m.media?.length ? /* @__PURE__ */ jsx15("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
7042
- const built = /* @__PURE__ */ jsx15(GeneratedMedia, { media: item, files, labels }, i);
7043
- return renderMedia ? /* @__PURE__ */ jsx15("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
7453
+ showMedia && m.media?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
7454
+ const built = /* @__PURE__ */ jsx16(GeneratedMedia, { media: item, files, labels }, i);
7455
+ return renderMedia ? /* @__PURE__ */ jsx16("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
7044
7456
  }) }) : null,
7045
- showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ jsx15(
7457
+ showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ jsx16(
7046
7458
  FileChips,
7047
7459
  {
7048
7460
  written: m.writtenFiles,
@@ -7054,34 +7466,34 @@ var MessageList = ({
7054
7466
  labels
7055
7467
  }
7056
7468
  ) : null,
7057
- m.attachments?.length ? /* @__PURE__ */ jsx15("div", { className: "awr-msg__attachments", "aria-label": L.attachments, children: m.attachments.map((a, i) => /* @__PURE__ */ jsx15("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ jsx15(AttachmentView, { attachment: a }) }, i)) }) : null,
7058
- m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ jsx15("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
7469
+ m.attachments?.length ? /* @__PURE__ */ jsx16("div", { className: "awr-msg__attachments", "aria-label": L.attachments, children: m.attachments.map((a, i) => /* @__PURE__ */ jsx16("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ jsx16(AttachmentView, { attachment: a }) }, i)) }) : null,
7470
+ m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ jsx16("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
7059
7471
  ] })
7060
7472
  },
7061
7473
  m.id
7062
7474
  );
7063
- return renderMessage ? /* @__PURE__ */ jsx15("div", { children: renderMessage(m, node) }, m.id) : node;
7064
- }) });
7475
+ return renderMessage ? /* @__PURE__ */ jsx16("div", { children: renderMessage(m, node) }, m.id) : node;
7476
+ }) }) });
7065
7477
  };
7066
7478
 
7067
7479
  // src/components/ModelLoadBar.tsx
7068
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
7480
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
7069
7481
  var ModelLoadBar = ({ load, className }) => {
7070
7482
  const pct = Math.round(Math.max(0, Math.min(1, load.progress)) * 100);
7071
- return /* @__PURE__ */ jsxs14("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
7072
- /* @__PURE__ */ jsxs14("div", { className: "awr-modelload__head", children: [
7073
- /* @__PURE__ */ jsx16("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
7074
- /* @__PURE__ */ jsxs14("span", { className: "awr-modelload__pct", children: [
7483
+ return /* @__PURE__ */ jsxs15("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
7484
+ /* @__PURE__ */ jsxs15("div", { className: "awr-modelload__head", children: [
7485
+ /* @__PURE__ */ jsx17("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
7486
+ /* @__PURE__ */ jsxs15("span", { className: "awr-modelload__pct", children: [
7075
7487
  pct,
7076
7488
  "%"
7077
7489
  ] })
7078
7490
  ] }),
7079
- /* @__PURE__ */ jsx16("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ jsx16("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
7491
+ /* @__PURE__ */ jsx17("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ jsx17("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
7080
7492
  ] });
7081
7493
  };
7082
7494
 
7083
7495
  // src/components/ToolApprovalPrompt.tsx
7084
- import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
7496
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
7085
7497
  var SkillConsentCard = ({
7086
7498
  approval: a,
7087
7499
  skill,
@@ -7091,7 +7503,7 @@ var SkillConsentCard = ({
7091
7503
  showPreview,
7092
7504
  onApprove,
7093
7505
  onDeny
7094
- }) => /* @__PURE__ */ jsxs15(
7506
+ }) => /* @__PURE__ */ jsxs16(
7095
7507
  "div",
7096
7508
  {
7097
7509
  className: `awr-approval awr-approval--skill${helper ? " awr-approval--helper" : ""}`,
@@ -7099,28 +7511,28 @@ var SkillConsentCard = ({
7099
7511
  "data-skill-server": skill.server,
7100
7512
  "data-subagent": helper?.id,
7101
7513
  children: [
7102
- /* @__PURE__ */ jsxs15("div", { className: "awr-approval__head", children: [
7103
- /* @__PURE__ */ jsx17(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
7104
- /* @__PURE__ */ jsx17("span", { children: L.skillConsentLead(skill.server, skill.skill) })
7514
+ /* @__PURE__ */ jsxs16("div", { className: "awr-approval__head", children: [
7515
+ /* @__PURE__ */ jsx18(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
7516
+ /* @__PURE__ */ jsx18("span", { children: L.skillConsentLead(skill.server, skill.skill) })
7105
7517
  ] }),
7106
- skill.description && /* @__PURE__ */ jsx17("p", { className: "awr-approval__quote", children: skill.description }),
7107
- /* @__PURE__ */ jsxs15("p", { className: "awr-approval__skillmeta", children: [
7108
- /* @__PURE__ */ jsx17("code", { className: "awr-tool__name", children: skill.name }),
7109
- /* @__PURE__ */ jsx17("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
7518
+ skill.description && /* @__PURE__ */ jsx18("p", { className: "awr-approval__quote", children: skill.description }),
7519
+ /* @__PURE__ */ jsxs16("p", { className: "awr-approval__skillmeta", children: [
7520
+ /* @__PURE__ */ jsx18("code", { className: "awr-tool__name", children: skill.name }),
7521
+ /* @__PURE__ */ jsx18("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
7110
7522
  ] }),
7111
- skill.byUri && /* @__PURE__ */ jsx17("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
7112
- skill.nestedIn && /* @__PURE__ */ jsx17("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
7113
- skill.dynamic && /* @__PURE__ */ jsx17("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
7114
- skill.dynamic && skill.noFileListing && /* @__PURE__ */ jsx17("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
7115
- showPreview && skill.body !== void 0 && /* @__PURE__ */ jsxs15("details", { className: "awr-approval__preview", children: [
7116
- /* @__PURE__ */ jsx17("summary", { children: L.skillConsentPreview }),
7117
- /* @__PURE__ */ jsx17("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
7118
- skill.files.length > 0 && /* @__PURE__ */ jsx17("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
7523
+ skill.byUri && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
7524
+ skill.nestedIn && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
7525
+ skill.dynamic && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
7526
+ skill.dynamic && skill.noFileListing && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
7527
+ showPreview && skill.body !== void 0 && /* @__PURE__ */ jsxs16("details", { className: "awr-approval__preview", children: [
7528
+ /* @__PURE__ */ jsx18("summary", { children: L.skillConsentPreview }),
7529
+ /* @__PURE__ */ jsx18("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
7530
+ skill.files.length > 0 && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
7119
7531
  ] }),
7120
- /* @__PURE__ */ jsx17("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
7121
- /* @__PURE__ */ jsxs15("div", { className: "awr-approval__actions", children: [
7122
- /* @__PURE__ */ jsx17("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
7123
- allowRemember && /* @__PURE__ */ jsx17(
7532
+ /* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
7533
+ /* @__PURE__ */ jsxs16("div", { className: "awr-approval__actions", children: [
7534
+ /* @__PURE__ */ jsx18("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
7535
+ allowRemember && /* @__PURE__ */ jsx18(
7124
7536
  "button",
7125
7537
  {
7126
7538
  type: "button",
@@ -7129,7 +7541,7 @@ var SkillConsentCard = ({
7129
7541
  children: L.skillConsentAlways
7130
7542
  }
7131
7543
  ),
7132
- /* @__PURE__ */ jsx17(
7544
+ /* @__PURE__ */ jsx18(
7133
7545
  "button",
7134
7546
  {
7135
7547
  type: "button",
@@ -7155,9 +7567,9 @@ var ToolApprovalPrompt = ({
7155
7567
  }) => {
7156
7568
  const L = useLabels(labels);
7157
7569
  if (approvals.length === 0) return null;
7158
- return /* @__PURE__ */ jsx17("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
7570
+ return /* @__PURE__ */ jsx18("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
7159
7571
  if (a.skill) {
7160
- const card2 = /* @__PURE__ */ jsx17(
7572
+ const card2 = /* @__PURE__ */ jsx18(
7161
7573
  SkillConsentCard,
7162
7574
  {
7163
7575
  approval: a,
@@ -7171,33 +7583,33 @@ var ToolApprovalPrompt = ({
7171
7583
  },
7172
7584
  a.id
7173
7585
  );
7174
- return renderApproval ? /* @__PURE__ */ jsx17("div", { children: renderApproval(a, card2) }, a.id) : card2;
7586
+ return renderApproval ? /* @__PURE__ */ jsx18("div", { children: renderApproval(a, card2) }, a.id) : card2;
7175
7587
  }
7176
7588
  const helper = showHelper ? a.subagent : void 0;
7177
7589
  const app = a.app;
7178
- const card = /* @__PURE__ */ jsxs15(
7590
+ const card = /* @__PURE__ */ jsxs16(
7179
7591
  "div",
7180
7592
  {
7181
7593
  className: `awr-approval${helper ? " awr-approval--helper" : ""}${app ? " awr-approval--app" : ""}`,
7182
7594
  "data-subagent": helper?.id,
7183
7595
  "data-app-server": app?.server,
7184
7596
  children: [
7185
- /* @__PURE__ */ jsxs15("div", { className: "awr-approval__head", children: [
7186
- /* @__PURE__ */ jsx17(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
7187
- /* @__PURE__ */ jsxs15("span", { children: [
7597
+ /* @__PURE__ */ jsxs16("div", { className: "awr-approval__head", children: [
7598
+ /* @__PURE__ */ jsx18(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
7599
+ /* @__PURE__ */ jsxs16("span", { children: [
7188
7600
  app ? L.approvalLeadApp(app.server) : helper ? L.approvalLeadHelper(
7189
7601
  previewValue(helper.role ?? "", 60) || void 0,
7190
7602
  helper.depth
7191
7603
  ) : L.approvalLead,
7192
7604
  " ",
7193
- /* @__PURE__ */ jsx17("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
7605
+ /* @__PURE__ */ jsx18("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
7194
7606
  a.readOnly && !app ? ` (${L.readOnlyTool})` : ""
7195
7607
  ] })
7196
7608
  ] }),
7197
- previewValue(a.input, 300) && /* @__PURE__ */ jsx17("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
7198
- app && /* @__PURE__ */ jsx17("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
7199
- /* @__PURE__ */ jsxs15("div", { className: "awr-approval__actions", children: [
7200
- /* @__PURE__ */ jsx17(
7609
+ previewValue(a.input, 300) && /* @__PURE__ */ jsx18("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
7610
+ app && /* @__PURE__ */ jsx18("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
7611
+ /* @__PURE__ */ jsxs16("div", { className: "awr-approval__actions", children: [
7612
+ /* @__PURE__ */ jsx18(
7201
7613
  "button",
7202
7614
  {
7203
7615
  type: "button",
@@ -7206,7 +7618,7 @@ var ToolApprovalPrompt = ({
7206
7618
  children: L.approve
7207
7619
  }
7208
7620
  ),
7209
- allowRemember && /* @__PURE__ */ jsx17(
7621
+ allowRemember && /* @__PURE__ */ jsx18(
7210
7622
  "button",
7211
7623
  {
7212
7624
  type: "button",
@@ -7215,7 +7627,7 @@ var ToolApprovalPrompt = ({
7215
7627
  children: L.alwaysAllow
7216
7628
  }
7217
7629
  ),
7218
- /* @__PURE__ */ jsx17(
7630
+ /* @__PURE__ */ jsx18(
7219
7631
  "button",
7220
7632
  {
7221
7633
  type: "button",
@@ -7229,12 +7641,12 @@ var ToolApprovalPrompt = ({
7229
7641
  },
7230
7642
  a.id
7231
7643
  );
7232
- return renderApproval ? /* @__PURE__ */ jsx17("div", { children: renderApproval(a, card) }, a.id) : card;
7644
+ return renderApproval ? /* @__PURE__ */ jsx18("div", { children: renderApproval(a, card) }, a.id) : card;
7233
7645
  }) });
7234
7646
  };
7235
7647
 
7236
7648
  // src/components/UsageBadge.tsx
7237
- import { jsxs as jsxs16 } from "react/jsx-runtime";
7649
+ import { jsxs as jsxs17 } from "react/jsx-runtime";
7238
7650
  var UsageBadge = ({
7239
7651
  usage,
7240
7652
  compact = false,
@@ -7246,35 +7658,40 @@ var UsageBadge = ({
7246
7658
  const media = showCalls ? usage.mediaCalls ?? 0 : 0;
7247
7659
  const decisions = showCalls ? usage.decisionCalls ?? 0 : 0;
7248
7660
  if (usage.totalTokens === 0 && media === 0 && decisions === 0) return null;
7661
+ const mediaText = media ? L.usageMedia(media, {
7662
+ imagesGenerated: usage.imagesGenerated ?? 0,
7663
+ speechCharacters: usage.speechCharacters ?? 0,
7664
+ transcriptionSeconds: usage.transcriptionSeconds ?? 0
7665
+ }) : "";
7249
7666
  const reasoning = usage.reasoningTokens ?? 0;
7250
7667
  const cached = usage.cachedInputTokens ?? 0;
7251
7668
  const title = [
7252
7669
  `${usage.inputTokens} in + ${usage.outputTokens} out = ${usage.totalTokens} tokens`,
7253
7670
  reasoning ? `${reasoning} thinking` : "",
7254
7671
  cached ? `${cached} input tokens from the prompt cache` : "",
7255
- media ? L.usageMedia(media) : "",
7672
+ mediaText,
7256
7673
  decisions ? L.usageDecisions(decisions) : ""
7257
7674
  ].filter(Boolean).join(" \xB7 ");
7258
- return /* @__PURE__ */ jsxs16("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
7675
+ return /* @__PURE__ */ jsxs17("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
7259
7676
  formatTokens(usage.inputTokens),
7260
7677
  "\u2191 ",
7261
7678
  formatTokens(usage.outputTokens),
7262
7679
  "\u2193",
7263
7680
  !compact && reasoning > 0 && ` \xB7 ${formatTokens(reasoning)} think`,
7264
7681
  !compact && cached > 0 && ` \xB7 ${formatTokens(cached)} cached`,
7265
- !compact && media > 0 && ` \xB7 ${L.usageMedia(media)}`,
7682
+ !compact && mediaText && ` \xB7 ${mediaText}`,
7266
7683
  !compact && decisions > 0 && ` \xB7 ${L.usageDecisions(decisions)}`
7267
7684
  ] });
7268
7685
  };
7269
7686
 
7270
7687
  // src/components/AgentChat.tsx
7271
- import { Fragment as Fragment10, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
7688
+ import { Fragment as Fragment11, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
7272
7689
  var usePrefersDark = () => {
7273
7690
  const query = "(prefers-color-scheme: dark)";
7274
- const [dark, setDark] = useState15(
7691
+ const [dark, setDark] = useState16(
7275
7692
  () => typeof matchMedia === "function" && matchMedia(query).matches
7276
7693
  );
7277
- useEffect14(() => {
7694
+ useEffect16(() => {
7278
7695
  if (typeof matchMedia !== "function") return;
7279
7696
  const mq = matchMedia(query);
7280
7697
  const on = () => setDark(mq.matches);
@@ -7285,7 +7702,7 @@ var usePrefersDark = () => {
7285
7702
  };
7286
7703
  var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
7287
7704
  var cx = (...names) => names.filter(Boolean).join(" ");
7288
- var AgentChat = (props) => /* @__PURE__ */ jsx18(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ jsx18(AgentChatInner, { ...props }) });
7705
+ var AgentChat = (props) => /* @__PURE__ */ jsx19(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ jsx19(AgentChatInner, { ...props }) });
7289
7706
  var NO_LABELS = {};
7290
7707
  var AgentChatInner = ({
7291
7708
  controller,
@@ -7334,6 +7751,8 @@ var AgentChatInner = ({
7334
7751
  renderFileContent,
7335
7752
  renderApproval,
7336
7753
  slots = {},
7754
+ imageViewer = true,
7755
+ renderImageViewer,
7337
7756
  components = {},
7338
7757
  theme = "auto",
7339
7758
  classNames = {},
@@ -7360,7 +7779,7 @@ var AgentChatInner = ({
7360
7779
  }
7361
7780
  const L = useLabels();
7362
7781
  const external = isHistoryHook(history) ? history : void 0;
7363
- const [ownStore] = useState15(
7782
+ const [ownStore] = useState16(
7364
7783
  () => history instanceof ChatHistoryStore ? history : new ChatHistoryStore()
7365
7784
  );
7366
7785
  const own = useChatHistory(agent, {
@@ -7368,20 +7787,20 @@ var AgentChatInner = ({
7368
7787
  enabled: Boolean(history) && !external
7369
7788
  });
7370
7789
  const chats = history ? external ?? own : void 0;
7371
- const rootRef = useRef9(null);
7372
- const [narrow, setNarrow] = useState15(void 0);
7373
- useEffect14(() => {
7790
+ const rootRef = useRef11(null);
7791
+ const [narrow, setNarrow] = useState16(void 0);
7792
+ useEffect16(() => {
7374
7793
  const el = rootRef.current;
7375
7794
  if (!el || typeof ResizeObserver === "undefined") return setNarrow(false);
7376
- const measure = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
7377
- measure();
7378
- const ro = new ResizeObserver(measure);
7795
+ const measure2 = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
7796
+ measure2();
7797
+ const ro = new ResizeObserver(measure2);
7379
7798
  ro.observe(el);
7380
7799
  return () => ro.disconnect();
7381
7800
  }, [narrowWidth]);
7382
- const [historyChoice, setHistoryOpen] = useState15(defaultHistoryOpen);
7801
+ const [historyChoice, setHistoryOpen] = useState16(defaultHistoryOpen);
7383
7802
  const historyOpen = historyChoice ?? narrow === false;
7384
- const [filesOpen, setFilesOpen] = useState15(defaultFilesOpen);
7803
+ const [filesOpen, setFilesOpen] = useState16(defaultFilesOpen);
7385
7804
  const toggleHistory = () => {
7386
7805
  setHistoryOpen(!historyOpen);
7387
7806
  if (narrow && !historyOpen) setFilesOpen(false);
@@ -7394,19 +7813,22 @@ var AgentChatInner = ({
7394
7813
  setFilesOpen(true);
7395
7814
  if (narrow) setHistoryOpen(false);
7396
7815
  };
7397
- const bodyRef = useRef9(null);
7398
- const stickRef = useRef9(true);
7399
- useEffect14(() => {
7400
- const el = bodyRef.current;
7401
- if (el && stickRef.current) el.scrollTop = el.scrollHeight;
7402
- }, [
7403
- agent.messages,
7404
- agent.steps,
7405
- agent.finalText,
7406
- agent.modelLoad,
7407
- agent.pendingApprovals,
7408
- elicitations
7409
- ]);
7816
+ const overlayOpen = narrow === true && (Boolean(chats) && historyOpen || Boolean(files) && filesOpen);
7817
+ const closeOverlays = () => {
7818
+ setHistoryOpen(false);
7819
+ setFilesOpen(false);
7820
+ };
7821
+ useEffect16(() => {
7822
+ if (!overlayOpen) return;
7823
+ const onKey = (e) => {
7824
+ if (e.key !== "Escape" || e.defaultPrevented) return;
7825
+ setHistoryOpen(false);
7826
+ setFilesOpen(false);
7827
+ };
7828
+ document.addEventListener("keydown", onKey);
7829
+ return () => document.removeEventListener("keydown", onKey);
7830
+ }, [overlayOpen]);
7831
+ const bodyRef = useRef11(null);
7410
7832
  const appHost = useMcpAppHost({
7411
7833
  connection: mcpApps,
7412
7834
  approve: agent.approveAppToolCall,
@@ -7418,23 +7840,28 @@ var AgentChatInner = ({
7418
7840
  });
7419
7841
  const prefersDark = usePrefersDark();
7420
7842
  const appTheme = theme === "auto" ? prefersDark ? "dark" : "light" : theme;
7421
- const [panelApp, setPanelAppState] = useState15();
7843
+ const [panelApp, setPanelAppState] = useState16();
7422
7844
  const setPanelApp = (app) => {
7423
7845
  setPanelAppState(app);
7424
7846
  onAppPanel?.(app);
7425
7847
  };
7426
7848
  const appsOn = showApps && Boolean(mcpApps);
7849
+ useFollowScroll(
7850
+ bodyRef,
7851
+ agent.messages.filter((m) => m.role === "user").length,
7852
+ agent.isRunning || agent.messages.some((m) => m.pending)
7853
+ );
7427
7854
  const panelAllowed = appPanel !== false && appPanel !== null;
7428
7855
  const panelTarget = typeof appPanel === "object" && appPanel ? appPanel : void 0;
7429
7856
  const asSheet = !panelTarget && (appPanel === "sheet" || Boolean(narrow));
7430
- useEffect14(() => {
7857
+ useEffect16(() => {
7431
7858
  if (panelApp && !agent.messages.some((m) => m.apps?.some((a) => a.id === panelApp.id))) {
7432
7859
  setPanelAppState(void 0);
7433
7860
  onAppPanel?.(void 0);
7434
7861
  }
7435
7862
  }, [agent.messages, panelApp, onAppPanel]);
7436
7863
  const drawApp = (app, message) => {
7437
- const built = panelApp?.id === app.id ? /* @__PURE__ */ jsx18(
7864
+ const built = panelApp?.id === app.id ? /* @__PURE__ */ jsx19(
7438
7865
  McpAppLine,
7439
7866
  {
7440
7867
  app,
@@ -7442,7 +7869,7 @@ var AgentChatInner = ({
7442
7869
  action: L.appBringBack,
7443
7870
  onAction: () => setPanelApp(void 0)
7444
7871
  }
7445
- ) : /* @__PURE__ */ jsx18(
7872
+ ) : /* @__PURE__ */ jsx19(
7446
7873
  McpAppFrame,
7447
7874
  {
7448
7875
  app,
@@ -7455,7 +7882,7 @@ var AgentChatInner = ({
7455
7882
  );
7456
7883
  return renderApp ? renderApp(app, message, built) : built;
7457
7884
  };
7458
- const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ jsx18(
7885
+ const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ jsx19(
7459
7886
  McpAppFrame,
7460
7887
  {
7461
7888
  app: panelApp,
@@ -7467,7 +7894,7 @@ var AgentChatInner = ({
7467
7894
  },
7468
7895
  panelApp.id
7469
7896
  ) : null;
7470
- const [compacting, setCompacting] = useState15(false);
7897
+ const [compacting, setCompacting] = useState16(false);
7471
7898
  const compact = () => {
7472
7899
  setCompacting(true);
7473
7900
  void agent.compact().finally(() => setCompacting(false));
@@ -7488,18 +7915,18 @@ var AgentChatInner = ({
7488
7915
  const showReplan = agent.replan && agent.replan.mode !== "continue";
7489
7916
  const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
7490
7917
  const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
7491
- const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ jsxs17(Fragment10, { children: [
7492
- agent.planThought.trim() && /* @__PURE__ */ jsxs17("details", { className: "awr-activity__plan", children: [
7493
- /* @__PURE__ */ jsx18("summary", { children: L.planned }),
7494
- /* @__PURE__ */ jsx18("p", { className: "awr-activity__thought", children: agent.planThought })
7918
+ const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ jsxs18(Fragment11, { children: [
7919
+ agent.planThought.trim() && /* @__PURE__ */ jsxs18("details", { className: "awr-activity__plan", children: [
7920
+ /* @__PURE__ */ jsx19("summary", { children: L.planned }),
7921
+ /* @__PURE__ */ jsx19("p", { className: "awr-activity__thought", children: agent.planThought })
7495
7922
  ] }),
7496
- showReplan && /* @__PURE__ */ jsx18("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
7497
- replanFailedEarly && /* @__PURE__ */ jsxs17("p", { className: "awr-step__warn", title: agent.replan.error, children: [
7498
- /* @__PURE__ */ jsx18(AlertIcon, { size: 12 }),
7923
+ showReplan && /* @__PURE__ */ jsx19("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
7924
+ replanFailedEarly && /* @__PURE__ */ jsxs18("p", { className: "awr-step__warn", title: agent.replan.error, children: [
7925
+ /* @__PURE__ */ jsx19(AlertIcon, { size: 12 }),
7499
7926
  " ",
7500
7927
  L.replanFailed
7501
7928
  ] }),
7502
- earlyDecisions.map((d, i) => /* @__PURE__ */ jsx18(
7929
+ earlyDecisions.map((d, i) => /* @__PURE__ */ jsx19(
7503
7930
  "p",
7504
7931
  {
7505
7932
  className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
@@ -7508,8 +7935,8 @@ var AgentChatInner = ({
7508
7935
  i
7509
7936
  ))
7510
7937
  ] }) : void 0;
7511
- const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ jsxs17("div", { className: cx("awr-chat__header", classNames.header), children: [
7512
- chats && /* @__PURE__ */ jsx18(
7938
+ const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ jsxs18("div", { className: cx("awr-chat__header", classNames.header), children: [
7939
+ chats && /* @__PURE__ */ jsx19(
7513
7940
  "button",
7514
7941
  {
7515
7942
  type: "button",
@@ -7518,17 +7945,17 @@ var AgentChatInner = ({
7518
7945
  title: L.showHistory,
7519
7946
  "aria-pressed": historyOpen,
7520
7947
  onClick: toggleHistory,
7521
- children: /* @__PURE__ */ jsx18(HistoryIcon, { size: 16 })
7948
+ children: /* @__PURE__ */ jsx19(HistoryIcon, { size: 16 })
7522
7949
  }
7523
7950
  ),
7524
7951
  slots.headerStart,
7525
- /* @__PURE__ */ jsx18("div", { className: "awr-chat__title", children: title }),
7526
- showStatus && /* @__PURE__ */ jsxs17("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
7527
- /* @__PURE__ */ jsx18("span", { className: "awr-status__dot" }),
7528
- /* @__PURE__ */ jsx18("span", { className: "awr-status__text", children: L.status[agent.status] })
7952
+ /* @__PURE__ */ jsx19("div", { className: "awr-chat__title", children: title }),
7953
+ showStatus && /* @__PURE__ */ jsxs18("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
7954
+ /* @__PURE__ */ jsx19("span", { className: "awr-status__dot" }),
7955
+ /* @__PURE__ */ jsx19("span", { className: "awr-status__text", children: L.status[agent.status] })
7529
7956
  ] }),
7530
- showTotalUsage && /* @__PURE__ */ jsx18("span", { title: L.totalUsage, children: /* @__PURE__ */ jsx18(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
7531
- files && /* @__PURE__ */ jsx18(
7957
+ showTotalUsage && /* @__PURE__ */ jsx19("span", { title: L.totalUsage, children: /* @__PURE__ */ jsx19(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
7958
+ files && /* @__PURE__ */ jsx19(
7532
7959
  "button",
7533
7960
  {
7534
7961
  type: "button",
@@ -7537,12 +7964,12 @@ var AgentChatInner = ({
7537
7964
  title: L.showFiles,
7538
7965
  "aria-pressed": filesOpen,
7539
7966
  onClick: toggleFiles,
7540
- children: /* @__PURE__ */ jsx18(FileIcon, { size: 16 })
7967
+ children: /* @__PURE__ */ jsx19(FileIcon, { size: 16 })
7541
7968
  }
7542
7969
  ),
7543
7970
  slots.headerEnd
7544
7971
  ] });
7545
- return /* @__PURE__ */ jsxs17(
7972
+ return /* @__PURE__ */ jsxs18(
7546
7973
  "div",
7547
7974
  {
7548
7975
  ref: rootRef,
@@ -7550,8 +7977,16 @@ var AgentChatInner = ({
7550
7977
  style,
7551
7978
  "data-awr-theme": theme === "auto" ? void 0 : theme,
7552
7979
  children: [
7553
- chats && historyOpen && /* @__PURE__ */ jsxs17("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
7554
- /* @__PURE__ */ jsx18(
7980
+ overlayOpen && /* @__PURE__ */ jsx19(
7981
+ "div",
7982
+ {
7983
+ className: cx("awr-chat__scrim", classNames.scrim),
7984
+ "aria-hidden": "true",
7985
+ onClick: closeOverlays
7986
+ }
7987
+ ),
7988
+ chats && historyOpen && /* @__PURE__ */ jsxs18("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
7989
+ /* @__PURE__ */ jsx19(
7555
7990
  HistoryList,
7556
7991
  {
7557
7992
  history: {
@@ -7570,7 +8005,7 @@ var AgentChatInner = ({
7570
8005
  }
7571
8006
  ),
7572
8007
  slots.sidebar,
7573
- /* @__PURE__ */ jsx18(
8008
+ /* @__PURE__ */ jsx19(
7574
8009
  "button",
7575
8010
  {
7576
8011
  type: "button",
@@ -7581,91 +8016,82 @@ var AgentChatInner = ({
7581
8016
  }
7582
8017
  )
7583
8018
  ] }),
7584
- /* @__PURE__ */ jsxs17("div", { className: cx("awr-chat__main", classNames.main), children: [
8019
+ /* @__PURE__ */ jsxs18("div", { className: cx("awr-chat__main", classNames.main), children: [
7585
8020
  header,
7586
- /* @__PURE__ */ jsxs17(
7587
- "div",
7588
- {
7589
- className: cx("awr-chat__body", classNames.body),
7590
- ref: bodyRef,
7591
- onScroll: (e) => {
7592
- const el = e.currentTarget;
7593
- stickRef.current = el.scrollHeight - el.scrollTop - el.clientHeight < 80;
7594
- },
7595
- children: [
7596
- slots.beforeMessages,
7597
- /* @__PURE__ */ jsx18(
7598
- Messages,
7599
- {
7600
- messages: agent.messages,
7601
- empty: emptyState ?? L.emptyState,
7602
- showActivity,
7603
- showToolCalls,
7604
- showUsage,
7605
- showThoughts,
7606
- showNotes,
7607
- showLearned,
7608
- showTiers,
7609
- showReplanFailed,
7610
- showDecisions,
7611
- showSearchResults,
7612
- showSubagents,
7613
- showMedia,
7614
- showFileChips,
7615
- files,
7616
- htmlPreview,
7617
- onShowFiles: files ? showFiles : void 0,
7618
- renderFile,
7619
- renderFileContent,
7620
- renderMedia,
7621
- renderSubagent,
7622
- onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
7623
- activityOpen,
7624
- liveExtra,
7625
- renderContent,
7626
- renderMessage,
7627
- renderAttachment,
7628
- renderToolCall,
7629
- showApps: appsOn,
7630
- renderApp: appsOn ? drawApp : void 0
7631
- }
7632
- ),
7633
- /* @__PURE__ */ jsx18(
7634
- Approvals,
7635
- {
7636
- approvals: agent.pendingApprovals,
7637
- onApprove: agent.approve,
7638
- onDeny: agent.deny,
7639
- showSkillPreview,
7640
- renderApproval
7641
- }
7642
- ),
7643
- appsOn && /* @__PURE__ */ jsx18(
7644
- AppRequestPrompt,
7645
- {
7646
- requests: appHost.requests,
7647
- onAnswer: appHost.answer,
7648
- renderRequest: renderAppRequest
7649
- }
7650
- ),
7651
- showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ jsx18(
7652
- Elicitations,
7653
- {
7654
- elicitations,
7655
- onAnswer: onElicitationAnswer,
7656
- outcomes: agent.elicitations,
7657
- renderElicitation
7658
- }
7659
- ),
7660
- agent.modelLoad && loading && /* @__PURE__ */ jsx18(ModelLoadBar, { load: agent.modelLoad }),
7661
- slots.afterMessages
7662
- ]
7663
- }
7664
- ),
7665
- /* @__PURE__ */ jsxs17("div", { className: cx("awr-chat__footer", classNames.footer), children: [
8021
+ /* @__PURE__ */ jsxs18("div", { className: cx("awr-chat__body", classNames.body), ref: bodyRef, children: [
8022
+ slots.beforeMessages,
8023
+ /* @__PURE__ */ jsx19(
8024
+ Messages,
8025
+ {
8026
+ messages: agent.messages,
8027
+ empty: emptyState ?? L.emptyState,
8028
+ showActivity,
8029
+ showToolCalls,
8030
+ showUsage,
8031
+ showThoughts,
8032
+ showNotes,
8033
+ showLearned,
8034
+ showTiers,
8035
+ showReplanFailed,
8036
+ showDecisions,
8037
+ showSearchResults,
8038
+ showSubagents,
8039
+ showMedia,
8040
+ showFileChips,
8041
+ files,
8042
+ htmlPreview,
8043
+ onShowFiles: files ? showFiles : void 0,
8044
+ renderFile,
8045
+ renderFileContent,
8046
+ renderMedia,
8047
+ renderSubagent,
8048
+ onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
8049
+ activityOpen,
8050
+ liveExtra,
8051
+ renderContent,
8052
+ renderMessage,
8053
+ renderAttachment,
8054
+ renderToolCall,
8055
+ showApps: appsOn,
8056
+ renderApp: appsOn ? drawApp : void 0,
8057
+ imageViewer,
8058
+ renderImageViewer
8059
+ }
8060
+ ),
8061
+ /* @__PURE__ */ jsx19(
8062
+ Approvals,
8063
+ {
8064
+ approvals: agent.pendingApprovals,
8065
+ onApprove: agent.approve,
8066
+ onDeny: agent.deny,
8067
+ showSkillPreview,
8068
+ renderApproval
8069
+ }
8070
+ ),
8071
+ appsOn && /* @__PURE__ */ jsx19(
8072
+ AppRequestPrompt,
8073
+ {
8074
+ requests: appHost.requests,
8075
+ onAnswer: appHost.answer,
8076
+ renderRequest: renderAppRequest
8077
+ }
8078
+ ),
8079
+ showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ jsx19(
8080
+ Elicitations,
8081
+ {
8082
+ elicitations,
8083
+ onAnswer: onElicitationAnswer,
8084
+ outcomes: agent.elicitations,
8085
+ renderElicitation
8086
+ }
8087
+ ),
8088
+ agent.modelLoad && loading && /* @__PURE__ */ jsx19(ModelLoadBar, { load: agent.modelLoad }),
8089
+ slots.afterMessages
8090
+ ] }),
8091
+ /* @__PURE__ */ jsxs18("div", { className: cx("awr-chat__footer", classNames.footer), children: [
7666
8092
  slots.footerStart,
7667
- tabNotes.length > 0 && /* @__PURE__ */ jsx18("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text) => /* @__PURE__ */ jsx18("p", { className: "awr-tabnote__text", children: text }, text)) }),
7668
- showContext !== false && /* @__PURE__ */ jsx18(
8093
+ tabNotes.length > 0 && /* @__PURE__ */ jsx19("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text) => /* @__PURE__ */ jsx19("p", { className: "awr-tabnote__text", children: text }, text)) }),
8094
+ showContext !== false && /* @__PURE__ */ jsx19(
7669
8095
  ContextMeter,
7670
8096
  {
7671
8097
  usage: agent.usage,
@@ -7676,11 +8102,11 @@ var AgentChatInner = ({
7676
8102
  compacting
7677
8103
  }
7678
8104
  ),
7679
- composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ jsxs17("div", { className: "awr-chat__error", children: [
7680
- /* @__PURE__ */ jsx18(AlertIcon, { size: 14 }),
8105
+ composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ jsxs18("div", { className: "awr-chat__error", children: [
8106
+ /* @__PURE__ */ jsx19(AlertIcon, { size: 14 }),
7681
8107
  " ",
7682
8108
  agent.error
7683
- ] }) : /* @__PURE__ */ jsx18(
8109
+ ] }) : /* @__PURE__ */ jsx19(
7684
8110
  Composer2,
7685
8111
  {
7686
8112
  controller: agent,
@@ -7696,8 +8122,8 @@ var AgentChatInner = ({
7696
8122
  ] }),
7697
8123
  appPanelNode && (panelTarget ? (
7698
8124
  // Outside the chat: the theme tokens come with it.
7699
- createPortal(
7700
- /* @__PURE__ */ jsx18(
8125
+ createPortal2(
8126
+ /* @__PURE__ */ jsx19(
7701
8127
  "div",
7702
8128
  {
7703
8129
  className: "awr-theme awr-apppanel",
@@ -7707,24 +8133,24 @@ var AgentChatInner = ({
7707
8133
  ),
7708
8134
  panelTarget
7709
8135
  )
7710
- ) : asSheet ? /* @__PURE__ */ jsxs17(Fragment10, { children: [
7711
- /* @__PURE__ */ jsx18("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
7712
- /* @__PURE__ */ jsxs17(
8136
+ ) : asSheet ? /* @__PURE__ */ jsxs18(Fragment11, { children: [
8137
+ /* @__PURE__ */ jsx19("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
8138
+ /* @__PURE__ */ jsxs18(
7713
8139
  "aside",
7714
8140
  {
7715
8141
  className: "awr-chat__appsheet",
7716
8142
  role: "dialog",
7717
8143
  "aria-label": L.appFrom(panelApp.server),
7718
8144
  children: [
7719
- /* @__PURE__ */ jsx18("div", { className: "awr-sheet__grab" }),
8145
+ /* @__PURE__ */ jsx19("div", { className: "awr-sheet__grab" }),
7720
8146
  appPanelNode
7721
8147
  ]
7722
8148
  }
7723
8149
  )
7724
- ] }) : /* @__PURE__ */ jsx18("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
7725
- files && filesOpen && /* @__PURE__ */ jsxs17("aside", { className: cx("awr-chat__files", classNames.files), children: [
7726
- /* @__PURE__ */ jsx18(Files, { files }),
7727
- /* @__PURE__ */ jsx18(
8150
+ ] }) : /* @__PURE__ */ jsx19("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
8151
+ files && filesOpen && /* @__PURE__ */ jsxs18("aside", { className: cx("awr-chat__files", classNames.files), children: [
8152
+ /* @__PURE__ */ jsx19(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ jsx19(Files, { files }) }),
8153
+ /* @__PURE__ */ jsx19(
7728
8154
  "button",
7729
8155
  {
7730
8156
  type: "button",
@@ -7741,7 +8167,7 @@ var AgentChatInner = ({
7741
8167
  };
7742
8168
 
7743
8169
  // src/components/LearnedSkills.tsx
7744
- import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
8170
+ import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
7745
8171
  var LearnedSkills = ({
7746
8172
  controller,
7747
8173
  lessons,
@@ -7757,18 +8183,18 @@ var LearnedSkills = ({
7757
8183
  const c = controller ?? ctx;
7758
8184
  const list = lessons ?? c?.learned ?? [];
7759
8185
  const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
7760
- return /* @__PURE__ */ jsxs18("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
7761
- !hideTitle && /* @__PURE__ */ jsxs18("h3", { className: "awr-notebook__title", children: [
7762
- /* @__PURE__ */ jsx19(BookIcon, { size: 14 }),
8186
+ return /* @__PURE__ */ jsxs19("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
8187
+ !hideTitle && /* @__PURE__ */ jsxs19("h3", { className: "awr-notebook__title", children: [
8188
+ /* @__PURE__ */ jsx20(BookIcon, { size: 14 }),
7763
8189
  " ",
7764
8190
  L.notebookTitle,
7765
- list.length > 0 && /* @__PURE__ */ jsx19("span", { className: "awr-notebook__count", children: list.length })
8191
+ list.length > 0 && /* @__PURE__ */ jsx20("span", { className: "awr-notebook__count", children: list.length })
7766
8192
  ] }),
7767
- list.length === 0 ? /* @__PURE__ */ jsx19("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ jsx19("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ jsxs18("li", { className: "awr-lesson", children: [
7768
- /* @__PURE__ */ jsxs18("div", { className: "awr-lesson__head", children: [
7769
- /* @__PURE__ */ jsx19("code", { className: "awr-lesson__name", children: l.name }),
7770
- l.revision > 1 && /* @__PURE__ */ jsx19("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
7771
- forget && /* @__PURE__ */ jsx19(
8193
+ list.length === 0 ? /* @__PURE__ */ jsx20("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ jsx20("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ jsxs19("li", { className: "awr-lesson", children: [
8194
+ /* @__PURE__ */ jsxs19("div", { className: "awr-lesson__head", children: [
8195
+ /* @__PURE__ */ jsx20("code", { className: "awr-lesson__name", children: l.name }),
8196
+ l.revision > 1 && /* @__PURE__ */ jsx20("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
8197
+ forget && /* @__PURE__ */ jsx20(
7772
8198
  "button",
7773
8199
  {
7774
8200
  type: "button",
@@ -7776,12 +8202,12 @@ var LearnedSkills = ({
7776
8202
  title: `${L.notebookForget}: ${l.name}`,
7777
8203
  "aria-label": `${L.notebookForget}: ${l.name}`,
7778
8204
  onClick: () => void forget(l.name),
7779
- children: /* @__PURE__ */ jsx19(XIcon, { size: 12 })
8205
+ children: /* @__PURE__ */ jsx20(XIcon, { size: 12 })
7780
8206
  }
7781
8207
  )
7782
8208
  ] }),
7783
- /* @__PURE__ */ jsx19("p", { className: "awr-lesson__when", children: l.description }),
7784
- showSources && l.sources.length > 0 && /* @__PURE__ */ jsxs18("p", { className: "awr-lesson__from", children: [
8209
+ /* @__PURE__ */ jsx20("p", { className: "awr-lesson__when", children: l.description }),
8210
+ showSources && l.sources.length > 0 && /* @__PURE__ */ jsxs19("p", { className: "awr-lesson__from", children: [
7785
8211
  L.notebookFrom,
7786
8212
  " ",
7787
8213
  l.sources.join(", ")
@@ -7791,8 +8217,8 @@ var LearnedSkills = ({
7791
8217
  };
7792
8218
 
7793
8219
  // src/components/Composer.tsx
7794
- import { useState as useState16 } from "react";
7795
- import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
8220
+ import { useState as useState17 } from "react";
8221
+ import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
7796
8222
  var Composer = ({
7797
8223
  onSubmit,
7798
8224
  busy = false,
@@ -7801,7 +8227,7 @@ var Composer = ({
7801
8227
  placeholder = "Ask the agent to do something\u2026",
7802
8228
  className
7803
8229
  }) => {
7804
- const [text, setText] = useState16("");
8230
+ const [text, setText] = useState17("");
7805
8231
  const submit = () => {
7806
8232
  const value = text.trim();
7807
8233
  if (!value || busy || disabled) return;
@@ -7814,7 +8240,7 @@ var Composer = ({
7814
8240
  submit();
7815
8241
  }
7816
8242
  };
7817
- return /* @__PURE__ */ jsxs19(
8243
+ return /* @__PURE__ */ jsxs20(
7818
8244
  "form",
7819
8245
  {
7820
8246
  className: ["awr-composer", className].filter(Boolean).join(" "),
@@ -7823,7 +8249,7 @@ var Composer = ({
7823
8249
  submit();
7824
8250
  },
7825
8251
  children: [
7826
- /* @__PURE__ */ jsx20(
8252
+ /* @__PURE__ */ jsx21(
7827
8253
  "textarea",
7828
8254
  {
7829
8255
  className: "awr-composer__input",
@@ -7835,23 +8261,23 @@ var Composer = ({
7835
8261
  rows: 1
7836
8262
  }
7837
8263
  ),
7838
- busy ? /* @__PURE__ */ jsx20(
8264
+ busy ? /* @__PURE__ */ jsx21(
7839
8265
  "button",
7840
8266
  {
7841
8267
  type: "button",
7842
8268
  className: "awr-composer__btn awr-composer__btn--stop",
7843
8269
  onClick: onStop,
7844
8270
  "aria-label": "Stop",
7845
- children: /* @__PURE__ */ jsx20(StopIcon, { size: 18 })
8271
+ children: /* @__PURE__ */ jsx21(StopIcon, { size: 18 })
7846
8272
  }
7847
- ) : /* @__PURE__ */ jsx20(
8273
+ ) : /* @__PURE__ */ jsx21(
7848
8274
  "button",
7849
8275
  {
7850
8276
  type: "submit",
7851
8277
  className: "awr-composer__btn",
7852
8278
  disabled: disabled || !text.trim(),
7853
8279
  "aria-label": "Send",
7854
- children: disabled ? /* @__PURE__ */ jsx20(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ jsx20(SendIcon, { size: 18 })
8280
+ children: disabled ? /* @__PURE__ */ jsx21(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ jsx21(SendIcon, { size: 18 })
7855
8281
  }
7856
8282
  )
7857
8283
  ]
@@ -7860,17 +8286,17 @@ var Composer = ({
7860
8286
  };
7861
8287
 
7862
8288
  // src/components/PlanView.tsx
7863
- import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
8289
+ import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
7864
8290
  var PlanView = ({ plan, showThought = true, className }) => {
7865
8291
  if (!plan.steps.length && !plan.thought) return null;
7866
- return /* @__PURE__ */ jsxs20("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
7867
- showThought && plan.thought.trim() && /* @__PURE__ */ jsx21("p", { className: "awr-plan__thought", children: plan.thought }),
7868
- plan.steps.length > 0 && /* @__PURE__ */ jsx21("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ jsx21("li", { className: "awr-plan__step", children: step.description }, step.id)) })
8292
+ return /* @__PURE__ */ jsxs21("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
8293
+ showThought && plan.thought.trim() && /* @__PURE__ */ jsx22("p", { className: "awr-plan__thought", children: plan.thought }),
8294
+ plan.steps.length > 0 && /* @__PURE__ */ jsx22("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ jsx22("li", { className: "awr-plan__step", children: step.description }, step.id)) })
7869
8295
  ] });
7870
8296
  };
7871
8297
 
7872
8298
  // src/components/ApprovalModeSwitch.tsx
7873
- import { jsx as jsx22 } from "react/jsx-runtime";
8299
+ import { jsx as jsx23 } from "react/jsx-runtime";
7874
8300
  var DEFAULT_LABELS = {
7875
8301
  autopilot: "Autopilot",
7876
8302
  "ask-writes": "Ask before changes",
@@ -7890,13 +8316,13 @@ var ApprovalModeSwitch = ({
7890
8316
  labels,
7891
8317
  disabled,
7892
8318
  className
7893
- }) => /* @__PURE__ */ jsx22(
8319
+ }) => /* @__PURE__ */ jsx23(
7894
8320
  "div",
7895
8321
  {
7896
8322
  className: ["awr-modeswitch", className].filter(Boolean).join(" "),
7897
8323
  role: "radiogroup",
7898
8324
  "aria-label": "Tool consent",
7899
- children: modes.map((m) => /* @__PURE__ */ jsx22(
8325
+ children: modes.map((m) => /* @__PURE__ */ jsx23(
7900
8326
  "button",
7901
8327
  {
7902
8328
  type: "button",
@@ -7914,8 +8340,8 @@ var ApprovalModeSwitch = ({
7914
8340
  );
7915
8341
 
7916
8342
  // src/components/ApiKeyForm.tsx
7917
- import { useEffect as useEffect15, useState as useState17 } from "react";
7918
- import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
8343
+ import { useEffect as useEffect17, useState as useState18 } from "react";
8344
+ import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
7919
8345
  var ApiKeyForm = ({
7920
8346
  credentials,
7921
8347
  credentialRef,
@@ -7924,10 +8350,10 @@ var ApiKeyForm = ({
7924
8350
  onChange,
7925
8351
  className
7926
8352
  }) => {
7927
- const [value, setValue] = useState17("");
7928
- const [present, setPresent] = useState17(false);
7929
- const [busy, setBusy] = useState17(false);
7930
- useEffect15(() => {
8353
+ const [value, setValue] = useState18("");
8354
+ const [present, setPresent] = useState18(false);
8355
+ const [busy, setBusy] = useState18(false);
8356
+ useEffect17(() => {
7931
8357
  let active = true;
7932
8358
  credentials.hasKey(credentialRef).then((has) => {
7933
8359
  if (active) setPresent(has);
@@ -7959,16 +8385,16 @@ var ApiKeyForm = ({
7959
8385
  setBusy(false);
7960
8386
  }
7961
8387
  };
7962
- return /* @__PURE__ */ jsxs21("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
7963
- /* @__PURE__ */ jsxs21("label", { className: "awr-keyform__label", children: [
8388
+ return /* @__PURE__ */ jsxs22("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
8389
+ /* @__PURE__ */ jsxs22("label", { className: "awr-keyform__label", children: [
7964
8390
  label,
7965
- present && /* @__PURE__ */ jsxs21("span", { className: "awr-keyform__saved", children: [
7966
- /* @__PURE__ */ jsx23(CheckIcon, { size: 12 }),
8391
+ present && /* @__PURE__ */ jsxs22("span", { className: "awr-keyform__saved", children: [
8392
+ /* @__PURE__ */ jsx24(CheckIcon, { size: 12 }),
7967
8393
  " stored, encrypted"
7968
8394
  ] })
7969
8395
  ] }),
7970
- /* @__PURE__ */ jsxs21("div", { className: "awr-keyform__row", children: [
7971
- /* @__PURE__ */ jsx23(
8396
+ /* @__PURE__ */ jsxs22("div", { className: "awr-keyform__row", children: [
8397
+ /* @__PURE__ */ jsx24(
7972
8398
  "input",
7973
8399
  {
7974
8400
  className: "awr-keyform__input",
@@ -7986,7 +8412,7 @@ var ApiKeyForm = ({
7986
8412
  disabled: busy
7987
8413
  }
7988
8414
  ),
7989
- /* @__PURE__ */ jsx23(
8415
+ /* @__PURE__ */ jsx24(
7990
8416
  "button",
7991
8417
  {
7992
8418
  type: "button",
@@ -7996,7 +8422,7 @@ var ApiKeyForm = ({
7996
8422
  children: "Save"
7997
8423
  }
7998
8424
  ),
7999
- present && /* @__PURE__ */ jsx23(
8425
+ present && /* @__PURE__ */ jsx24(
8000
8426
  "button",
8001
8427
  {
8002
8428
  type: "button",
@@ -8061,6 +8487,8 @@ export {
8061
8487
  ContextMeter,
8062
8488
  ElicitationPrompt,
8063
8489
  FILE_PREVIEW_CHARS,
8490
+ FOLLOW_LEAVE_PX,
8491
+ FOLLOW_REJOIN_PX,
8064
8492
  FRAME_MAX_HEIGHT,
8065
8493
  FRAME_MIN_HEIGHT,
8066
8494
  FileChip,
@@ -8068,6 +8496,9 @@ export {
8068
8496
  FilesPanel,
8069
8497
  GeneratedMedia,
8070
8498
  HTML_PREVIEW_MAX_CHARS,
8499
+ ImageThumb,
8500
+ ImageViewer,
8501
+ ImageViewerProvider,
8071
8502
  ImagesNotSupportedError,
8072
8503
  IndexedDBStore,
8073
8504
  LearnedSkills,
@@ -8157,11 +8588,14 @@ export {
8157
8588
  elicitationLink,
8158
8589
  escapeAttribute,
8159
8590
  fileKindOf,
8160
- fileNameOf,
8591
+ fileNameOf2 as fileNameOf,
8161
8592
  filterCommands,
8593
+ followsAfterResize,
8594
+ followsAfterScroll,
8162
8595
  formatCountdown,
8163
8596
  formatElapsed,
8164
8597
  grantedAppCsp,
8598
+ imageExtensionOf,
8165
8599
  isMcpAppSandboxMessage,
8166
8600
  isWebGPUAvailable2 as isWebGPUAvailable,
8167
8601
  lessonsOf,
@@ -8203,6 +8637,7 @@ export {
8203
8637
  useAgentContext,
8204
8638
  useChatHistory,
8205
8639
  useCredentials,
8640
+ useFollowScroll,
8206
8641
  useLabels,
8207
8642
  useLocalModel,
8208
8643
  useMcpAppHost,