@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.cjs CHANGED
@@ -48,6 +48,8 @@ __export(src_exports, {
48
48
  ContextMeter: () => ContextMeter,
49
49
  ElicitationPrompt: () => ElicitationPrompt,
50
50
  FILE_PREVIEW_CHARS: () => FILE_PREVIEW_CHARS,
51
+ FOLLOW_LEAVE_PX: () => FOLLOW_LEAVE_PX,
52
+ FOLLOW_REJOIN_PX: () => FOLLOW_REJOIN_PX,
51
53
  FRAME_MAX_HEIGHT: () => FRAME_MAX_HEIGHT,
52
54
  FRAME_MIN_HEIGHT: () => FRAME_MIN_HEIGHT,
53
55
  FileChip: () => FileChip,
@@ -55,6 +57,9 @@ __export(src_exports, {
55
57
  FilesPanel: () => FilesPanel,
56
58
  GeneratedMedia: () => GeneratedMedia,
57
59
  HTML_PREVIEW_MAX_CHARS: () => HTML_PREVIEW_MAX_CHARS,
60
+ ImageThumb: () => ImageThumb,
61
+ ImageViewer: () => ImageViewer,
62
+ ImageViewerProvider: () => ImageViewerProvider,
58
63
  ImagesNotSupportedError: () => import_agent_web8.ImagesNotSupportedError,
59
64
  IndexedDBStore: () => import_agent_web8.IndexedDBStore,
60
65
  LearnedSkills: () => LearnedSkills,
@@ -144,11 +149,14 @@ __export(src_exports, {
144
149
  elicitationLink: () => elicitationLink,
145
150
  escapeAttribute: () => escapeAttribute,
146
151
  fileKindOf: () => fileKindOf,
147
- fileNameOf: () => fileNameOf,
152
+ fileNameOf: () => fileNameOf2,
148
153
  filterCommands: () => filterCommands,
154
+ followsAfterResize: () => followsAfterResize,
155
+ followsAfterScroll: () => followsAfterScroll,
149
156
  formatCountdown: () => formatCountdown,
150
157
  formatElapsed: () => formatElapsed,
151
158
  grantedAppCsp: () => grantedAppCsp,
159
+ imageExtensionOf: () => imageExtensionOf,
152
160
  isMcpAppSandboxMessage: () => isMcpAppSandboxMessage,
153
161
  isWebGPUAvailable: () => import_agent_web8.isWebGPUAvailable,
154
162
  lessonsOf: () => lessonsOf,
@@ -190,6 +198,7 @@ __export(src_exports, {
190
198
  useAgentContext: () => useAgentContext,
191
199
  useChatHistory: () => useChatHistory,
192
200
  useCredentials: () => useCredentials,
201
+ useFollowScroll: () => useFollowScroll,
193
202
  useLabels: () => useLabels,
194
203
  useLocalModel: () => useLocalModel,
195
204
  useMcpAppHost: () => useMcpAppHost,
@@ -329,6 +338,7 @@ var createInitialAgentState = () => ({
329
338
  events: [],
330
339
  seq: 0
331
340
  });
341
+ var BLOCKER_MARK = "[BLOCKER]";
332
342
  var resetRun = (state) => ({
333
343
  ...createInitialAgentState(),
334
344
  status: state.status,
@@ -832,7 +842,10 @@ var applyEvent = (state, event, ctx) => {
832
842
  ...event.model !== void 0 ? { model: event.model } : {},
833
843
  ...event.tierReason !== void 0 ? { tierReason: event.tierReason } : {}
834
844
  };
835
- return { ...state, steps: [...state.steps, view] };
845
+ const steps = state.steps.map(
846
+ (s) => s.total === event.total ? s : { ...s, total: event.total }
847
+ );
848
+ return { ...state, steps: [...steps, view] };
836
849
  }
837
850
  case "step.escalated":
838
851
  return {
@@ -870,7 +883,13 @@ var applyEvent = (state, event, ctx) => {
870
883
  case "step.text-delta":
871
884
  return {
872
885
  ...state,
873
- steps: patchStep(state.steps, event.step.id, (s) => ({ ...s, text: s.text + event.delta }))
886
+ // "[BLOCKER]" is the executor's signal to the core that a step cannot be completed (the
887
+ // core strips it from the step's summary): never a word for the user. Stripped from the
888
+ // text as it accumulates, so a marker split across two deltas goes too.
889
+ steps: patchStep(state.steps, event.step.id, (s) => ({
890
+ ...s,
891
+ text: (s.text + event.delta).split(BLOCKER_MARK).join("")
892
+ }))
874
893
  };
875
894
  case "step.tool-call": {
876
895
  const tagged = new Set(
@@ -1225,6 +1244,7 @@ var applyEvent = (state, event, ctx) => {
1225
1244
  return event.phase === "run" ? {
1226
1245
  ...withoutBusy(keepSubmitted(state)),
1227
1246
  error: event.error,
1247
+ errorCode: event.code,
1228
1248
  messages: finalizeAssistant(
1229
1249
  state.messages,
1230
1250
  state.finalText || `Error: ${event.error}`,
@@ -1306,7 +1326,8 @@ var agentStateReducer = (state, action) => {
1306
1326
  return {
1307
1327
  ...state,
1308
1328
  status: action.status,
1309
- error: action.status === "error" ? action.error : void 0
1329
+ error: action.status === "error" ? action.error : void 0,
1330
+ errorCode: void 0
1310
1331
  };
1311
1332
  case "remote": {
1312
1333
  const remote = action.remote;
@@ -2669,6 +2690,11 @@ var defaultLabels = {
2669
2690
  subagentNoTools: "no tools",
2670
2691
  approvalLeadHelper: (role) => role ? `The helper \u201C${role}\u201D wants to run` : "A helper the agent started wants to run",
2671
2692
  mediaImage: (path) => `Generated image ${path}`,
2693
+ imageOpen: (name) => `Open image ${name}`,
2694
+ imagePrevious: "Previous image",
2695
+ imageNext: "Next image",
2696
+ imageZoom: "Zoom",
2697
+ imageCount: (index, total) => `${index} of ${total}`,
2672
2698
  mediaAudio: (path) => `Generated audio ${path}`,
2673
2699
  mediaFile: (path) => `Generated file ${path}`,
2674
2700
  transcriptOf: (name) => `Transcript of ${name}`,
@@ -3162,12 +3188,129 @@ var formatCountdown = (ms) => {
3162
3188
  };
3163
3189
 
3164
3190
  // src/components/AgentChat.tsx
3165
- var import_react19 = require("react");
3166
- var import_react_dom = require("react-dom");
3191
+ var import_react21 = require("react");
3192
+ var import_react_dom2 = require("react-dom");
3167
3193
 
3168
- // src/hooks/use-mcp-app-host.ts
3194
+ // src/hooks/use-follow-scroll.ts
3169
3195
  var import_react9 = require("react");
3170
3196
 
3197
+ // src/follow-scroll.ts
3198
+ var FOLLOW_REJOIN_PX = 80;
3199
+ var FOLLOW_LEAVE_PX = 2;
3200
+ var endGap = (m) => m.scrollHeight - m.scrollTop - m.clientHeight;
3201
+ var reach = (m) => Math.min(m.scrollTop, Math.max(0, m.scrollHeight - m.clientHeight));
3202
+ var followsAfterScroll = (following, before, now) => {
3203
+ if (before.scrollHeight !== now.scrollHeight || before.clientHeight !== now.clientHeight)
3204
+ return following;
3205
+ if (now.scrollTop < reach(before) - FOLLOW_LEAVE_PX) return false;
3206
+ if (now.scrollTop > before.scrollTop) return endGap(now) < FOLLOW_REJOIN_PX ? true : following;
3207
+ return following;
3208
+ };
3209
+ var followsAfterResize = (following, before, now) => following && !(now.clientHeight === before.clientHeight && now.scrollHeight >= before.scrollHeight && now.scrollTop < reach(before) - FOLLOW_LEAVE_PX);
3210
+
3211
+ // src/hooks/use-follow-scroll.ts
3212
+ var useIsoLayoutEffect = typeof window === "undefined" ? import_react9.useEffect : import_react9.useLayoutEffect;
3213
+ var measure = (el) => ({
3214
+ scrollTop: el.scrollTop,
3215
+ scrollHeight: el.scrollHeight,
3216
+ clientHeight: el.clientHeight
3217
+ });
3218
+ var anchorOf = (el) => {
3219
+ const box = el.getBoundingClientRect();
3220
+ if (box.width === 0 || box.height === 0) return void 0;
3221
+ const doc = el.ownerDocument;
3222
+ const marks = [];
3223
+ for (const dy of [8, 24, 48, 80, 120, 180]) {
3224
+ if (dy >= box.height) break;
3225
+ const node = doc.elementFromPoint(box.left + box.width / 2, box.top + dy);
3226
+ if (!node || node === el || !el.contains(node) || marks.some((m) => m.node === node)) continue;
3227
+ const r = node.getBoundingClientRect();
3228
+ marks.push({ node, offset: r.top - box.top, height: r.height });
3229
+ }
3230
+ marks.sort((a, b) => a.height - b.height);
3231
+ return marks.length ? { marks, top: el.scrollTop } : void 0;
3232
+ };
3233
+ var useFollowScroll = (ref, turn, live = true) => {
3234
+ const following = (0, import_react9.useRef)(true);
3235
+ const last = (0, import_react9.useRef)(void 0);
3236
+ const anchor = (0, import_react9.useRef)(void 0);
3237
+ const settle = (0, import_react9.useRef)(() => {
3238
+ });
3239
+ const arriving = (0, import_react9.useRef)(live);
3240
+ arriving.current = live;
3241
+ useIsoLayoutEffect(() => {
3242
+ const el = ref.current;
3243
+ if (!el) return;
3244
+ last.current = measure(el);
3245
+ const anchoring = el.style.getPropertyValue("overflow-anchor");
3246
+ el.style.setProperty("overflow-anchor", "none");
3247
+ const toEnd = () => {
3248
+ const top = el.scrollHeight - el.clientHeight;
3249
+ if (top - el.scrollTop > 0.5) el.scrollTop = top;
3250
+ };
3251
+ const keep = (render) => {
3252
+ const now = measure(el);
3253
+ const before = last.current;
3254
+ if (before) following.current = followsAfterResize(following.current, before, now);
3255
+ if (following.current) {
3256
+ if (render || arriving.current || !before || now.clientHeight !== before.clientHeight)
3257
+ toEnd();
3258
+ else if (endGap(now) > 0.5) following.current = false;
3259
+ } else if (anchor.current) {
3260
+ const seenAt = anchor.current.top;
3261
+ const mark = anchor.current.marks.find(
3262
+ (m) => m.node.isConnected && m.node.getClientRects().length > 0
3263
+ );
3264
+ if (mark) {
3265
+ const shift = mark.node.getBoundingClientRect().top - el.getBoundingClientRect().top - mark.offset + (el.scrollTop - seenAt);
3266
+ if (Math.abs(shift) > 0.5) el.scrollTop += shift;
3267
+ }
3268
+ }
3269
+ last.current = measure(el);
3270
+ if (!following.current) anchor.current = anchorOf(el);
3271
+ };
3272
+ settle.current = () => keep(true);
3273
+ const onScroll = () => {
3274
+ const now = measure(el);
3275
+ const was = following.current;
3276
+ following.current = followsAfterScroll(was, last.current ?? now, now);
3277
+ last.current = now;
3278
+ anchor.current = following.current ? void 0 : anchorOf(el);
3279
+ };
3280
+ el.addEventListener("scroll", onScroll, { passive: true });
3281
+ const restore = () => {
3282
+ el.removeEventListener("scroll", onScroll);
3283
+ if (anchoring) el.style.setProperty("overflow-anchor", anchoring);
3284
+ else el.style.removeProperty("overflow-anchor");
3285
+ };
3286
+ if (typeof ResizeObserver === "undefined") return restore;
3287
+ const sizes = new ResizeObserver(() => keep(false));
3288
+ const watch = () => {
3289
+ sizes.disconnect();
3290
+ sizes.observe(el);
3291
+ for (const child of el.children) sizes.observe(child);
3292
+ };
3293
+ watch();
3294
+ const parts = typeof MutationObserver === "undefined" ? void 0 : new MutationObserver((records) => {
3295
+ if (records.some((r) => r.type === "childList")) watch();
3296
+ });
3297
+ parts?.observe(el, { childList: true });
3298
+ return () => {
3299
+ restore();
3300
+ sizes.disconnect();
3301
+ parts?.disconnect();
3302
+ };
3303
+ }, [ref]);
3304
+ useIsoLayoutEffect(() => {
3305
+ following.current = true;
3306
+ anchor.current = void 0;
3307
+ }, [turn]);
3308
+ useIsoLayoutEffect(() => settle.current());
3309
+ };
3310
+
3311
+ // src/hooks/use-mcp-app-host.ts
3312
+ var import_react10 = require("react");
3313
+
3171
3314
  // src/mcp-app.ts
3172
3315
  var import_agent_web5 = require("@dudko.dev/agent-web");
3173
3316
 
@@ -4032,27 +4175,27 @@ var useMcpAppHost = ({
4032
4175
  sampling = false,
4033
4176
  sample: sampleFn
4034
4177
  }) => {
4035
- const [requests, setRequests] = (0, import_react9.useState)([]);
4036
- const [draft, setDraft] = (0, import_react9.useState)();
4037
- const waiting = (0, import_react9.useRef)(
4178
+ const [requests, setRequests] = (0, import_react10.useState)([]);
4179
+ const [draft, setDraft] = (0, import_react10.useState)();
4180
+ const waiting = (0, import_react10.useRef)(
4038
4181
  /* @__PURE__ */ new Map()
4039
4182
  );
4040
- const samplingAllowed = (0, import_react9.useRef)(/* @__PURE__ */ new Set());
4041
- const sampleRef = (0, import_react9.useRef)(sampleFn);
4183
+ const samplingAllowed = (0, import_react10.useRef)(/* @__PURE__ */ new Set());
4184
+ const sampleRef = (0, import_react10.useRef)(sampleFn);
4042
4185
  sampleRef.current = sampleFn;
4043
- const [gated, setGated] = (0, import_react9.useState)({});
4044
- const connectionRef = (0, import_react9.useRef)(connection);
4186
+ const [gated, setGated] = (0, import_react10.useState)({});
4187
+ const connectionRef = (0, import_react10.useRef)(connection);
4045
4188
  connectionRef.current = connection;
4046
- const approveRef = (0, import_react9.useRef)(approve);
4189
+ const approveRef = (0, import_react10.useRef)(approve);
4047
4190
  approveRef.current = approve;
4048
- (0, import_react9.useEffect)(
4191
+ (0, import_react10.useEffect)(
4049
4192
  () => () => {
4050
4193
  for (const { resolve } of waiting.current.values()) resolve(false);
4051
4194
  waiting.current.clear();
4052
4195
  },
4053
4196
  []
4054
4197
  );
4055
- const ask = (0, import_react9.useCallback)(
4198
+ const ask = (0, import_react10.useCallback)(
4056
4199
  (request, signal, extra = {}) => {
4057
4200
  for (const w of waiting.current.values()) {
4058
4201
  if (w.request.appId === request.appId) {
@@ -4077,7 +4220,7 @@ var useMcpAppHost = ({
4077
4220
  },
4078
4221
  []
4079
4222
  );
4080
- const answer = (0, import_react9.useCallback)((id, accept, options) => {
4223
+ const answer = (0, import_react10.useCallback)((id, accept, options) => {
4081
4224
  const w = waiting.current.get(id);
4082
4225
  if (!w) return;
4083
4226
  if (accept && w.request.kind === "link" && w.request.link) {
@@ -4103,16 +4246,16 @@ var useMcpAppHost = ({
4103
4246
  }
4104
4247
  w.resolve(accept);
4105
4248
  }, []);
4106
- const read = (0, import_react9.useCallback)((app, signal) => {
4249
+ const read = (0, import_react10.useCallback)((app, signal) => {
4107
4250
  const c = connectionRef.current;
4108
4251
  if (!c) return Promise.reject(new Error(`no connection to the server \u201C${app.server}\u201D`));
4109
4252
  return c.readUiResource(app.server, app.resourceUri, signal ? { signal } : void 0);
4110
4253
  }, []);
4111
- const tool = (0, import_react9.useCallback)(
4254
+ const tool = (0, import_react10.useCallback)(
4112
4255
  (app) => connectionRef.current?.appTool(app.server, app.toolName),
4113
4256
  []
4114
4257
  );
4115
- const callTool = (0, import_react9.useCallback)(
4258
+ const callTool = (0, import_react10.useCallback)(
4116
4259
  async (app, name, args, signal) => {
4117
4260
  const c = connectionRef.current;
4118
4261
  if (!c) throw refused(`The server \u201C${app.server}\u201D is not connected`);
@@ -4149,15 +4292,15 @@ var useMcpAppHost = ({
4149
4292
  },
4150
4293
  []
4151
4294
  );
4152
- const openLink = (0, import_react9.useCallback)(
4295
+ const openLink = (0, import_react10.useCallback)(
4153
4296
  (app, link, signal) => ask({ appId: app.id, server: app.server, kind: "link", link }, signal),
4154
4297
  [ask]
4155
4298
  );
4156
- const message = (0, import_react9.useCallback)(
4299
+ const message = (0, import_react10.useCallback)(
4157
4300
  (app, text2, signal) => ask({ appId: app.id, server: app.server, kind: "message", text: text2 }, signal),
4158
4301
  [ask]
4159
4302
  );
4160
- const downloadFile2 = (0, import_react9.useCallback)(
4303
+ const downloadFile2 = (0, import_react10.useCallback)(
4161
4304
  async (app, file, signal) => {
4162
4305
  const c = connectionRef.current;
4163
4306
  if (file.kind === "link" && !c) throw refused(`The server \u201C${app.server}\u201D is not connected`);
@@ -4180,7 +4323,7 @@ var useMcpAppHost = ({
4180
4323
  },
4181
4324
  [ask]
4182
4325
  );
4183
- const sample = (0, import_react9.useCallback)(
4326
+ const sample = (0, import_react10.useCallback)(
4184
4327
  async (app, params, signal) => {
4185
4328
  const fn = sampleRef.current;
4186
4329
  if (!fn) throw refused("This host cannot answer sampling requests");
@@ -4201,19 +4344,19 @@ var useMcpAppHost = ({
4201
4344
  },
4202
4345
  [ask]
4203
4346
  );
4204
- const pendingAppServers = (0, import_react9.useMemo)(
4347
+ const pendingAppServers = (0, import_react10.useMemo)(
4205
4348
  () => new Set(
4206
4349
  approvals.filter((a) => a.app && a.status === "pending").map((a) => `${a.app.server}\0${a.app.resourceUri}`)
4207
4350
  ),
4208
4351
  [approvals]
4209
4352
  );
4210
- const isWaiting = (0, import_react9.useCallback)(
4353
+ const isWaiting = (0, import_react10.useCallback)(
4211
4354
  (app) => requests.some((r) => r.appId === app.id) || Boolean(gated[app.id]) && pendingAppServers.has(`${app.server}\0${app.resourceUri}`),
4212
4355
  [requests, gated, pendingAppServers]
4213
4356
  );
4214
4357
  const sandboxUrl = sandbox?.url;
4215
4358
  const sandboxTimeout = sandbox?.timeoutMs;
4216
- const sandboxSetting = (0, import_react9.useMemo)(
4359
+ const sandboxSetting = (0, import_react10.useMemo)(
4217
4360
  () => sandboxUrl === void 0 ? void 0 : {
4218
4361
  url: sandboxUrl,
4219
4362
  ...sandboxTimeout !== void 0 ? { timeoutMs: sandboxTimeout } : {}
@@ -4221,7 +4364,7 @@ var useMcpAppHost = ({
4221
4364
  [sandboxUrl, sandboxTimeout]
4222
4365
  );
4223
4366
  const samplingOn = sampling && Boolean(sampleFn);
4224
- return (0, import_react9.useMemo)(
4367
+ return (0, import_react10.useMemo)(
4225
4368
  () => ({
4226
4369
  connected: Boolean(connection),
4227
4370
  read,
@@ -4504,11 +4647,11 @@ var AppRequestPrompt = ({
4504
4647
  };
4505
4648
 
4506
4649
  // src/components/McpAppFrame.tsx
4507
- var import_react10 = require("react");
4650
+ var import_react11 = require("react");
4508
4651
  var import_jsx_runtime5 = require("react/jsx-runtime");
4509
4652
  var HOST_INFO = { name: "@dudko.dev/agent-web-react", version: "1" };
4510
4653
  var MAX_LISTED_CALLS = 12;
4511
- var useIsoLayoutEffect = typeof window === "undefined" ? import_react10.useEffect : import_react10.useLayoutEffect;
4654
+ var useIsoLayoutEffect2 = typeof window === "undefined" ? import_react11.useEffect : import_react11.useLayoutEffect;
4512
4655
  var userActivation = () => typeof navigator === "undefined" ? void 0 : navigator.userActivation?.isActive;
4513
4656
  var silentSandboxes = /* @__PURE__ */ new Set();
4514
4657
  var warned = /* @__PURE__ */ new Set();
@@ -4541,36 +4684,36 @@ var McpAppFrame = ({
4541
4684
  className
4542
4685
  }) => {
4543
4686
  const L = useLabels(labels);
4544
- const [collapsed, setCollapsed] = (0, import_react10.useState)(defaultCollapsed);
4545
- const [menu, setMenu] = (0, import_react10.useState)(false);
4546
- const [reload, setReload] = (0, import_react10.useState)(0);
4547
- const [loaded, setLoaded] = (0, import_react10.useState)();
4548
- const [height, setHeight] = (0, import_react10.useState)(APP_DEFAULT_HEIGHT);
4549
- const [calls, setCalls] = (0, import_react10.useState)([]);
4550
- const [fallback, setFallback] = (0, import_react10.useState)();
4551
- const [broken, setBroken] = (0, import_react10.useState)(false);
4552
- const [onOrigin, setOnOrigin] = (0, import_react10.useState)(false);
4553
- const shellLoaded = (0, import_react10.useRef)(void 0);
4554
- const [mode, setMode] = (0, import_react10.useState)("inline");
4555
- const modeRef = (0, import_react10.useRef)("inline");
4556
- const [holder, setHolder] = (0, import_react10.useState)(0);
4557
- const [fullRect, setFullRect] = (0, import_react10.useState)();
4558
- const leaveRef = (0, import_react10.useRef)(void 0);
4559
- const rootRef = (0, import_react10.useRef)(null);
4560
- const exitRef = (0, import_react10.useRef)(null);
4561
- const allowFullscreenRef = (0, import_react10.useRef)(allowFullscreen);
4687
+ const [collapsed, setCollapsed] = (0, import_react11.useState)(defaultCollapsed);
4688
+ const [menu, setMenu] = (0, import_react11.useState)(false);
4689
+ const [reload, setReload] = (0, import_react11.useState)(0);
4690
+ const [loaded, setLoaded] = (0, import_react11.useState)();
4691
+ const [height, setHeight] = (0, import_react11.useState)(APP_DEFAULT_HEIGHT);
4692
+ const [calls, setCalls] = (0, import_react11.useState)([]);
4693
+ const [fallback, setFallback] = (0, import_react11.useState)();
4694
+ const [broken, setBroken] = (0, import_react11.useState)(false);
4695
+ const [onOrigin, setOnOrigin] = (0, import_react11.useState)(false);
4696
+ const shellLoaded = (0, import_react11.useRef)(void 0);
4697
+ const [mode, setMode] = (0, import_react11.useState)("inline");
4698
+ const modeRef = (0, import_react11.useRef)("inline");
4699
+ const [holder, setHolder] = (0, import_react11.useState)(0);
4700
+ const [fullRect, setFullRect] = (0, import_react11.useState)();
4701
+ const leaveRef = (0, import_react11.useRef)(void 0);
4702
+ const rootRef = (0, import_react11.useRef)(null);
4703
+ const exitRef = (0, import_react11.useRef)(null);
4704
+ const allowFullscreenRef = (0, import_react11.useRef)(allowFullscreen);
4562
4705
  allowFullscreenRef.current = allowFullscreen;
4563
- const iframeRef = (0, import_react10.useRef)(null);
4564
- const bridgeRef = (0, import_react10.useRef)(void 0);
4565
- const menuRef = (0, import_react10.useRef)(null);
4566
- const themeRef = (0, import_react10.useRef)(theme);
4706
+ const iframeRef = (0, import_react11.useRef)(null);
4707
+ const bridgeRef = (0, import_react11.useRef)(void 0);
4708
+ const menuRef = (0, import_react11.useRef)(null);
4709
+ const themeRef = (0, import_react11.useRef)(theme);
4567
4710
  themeRef.current = theme;
4568
- const hostRef = (0, import_react10.useRef)(host);
4711
+ const hostRef = (0, import_react11.useRef)(host);
4569
4712
  hostRef.current = host;
4570
- const appRef = (0, import_react10.useRef)(app);
4713
+ const appRef = (0, import_react11.useRef)(app);
4571
4714
  appRef.current = app;
4572
4715
  const live = !collapsed;
4573
- (0, import_react10.useEffect)(() => {
4716
+ (0, import_react11.useEffect)(() => {
4574
4717
  if (!live) return;
4575
4718
  if (!hostRef.current.connected) {
4576
4719
  setLoaded({ unavailable: true });
@@ -4593,7 +4736,7 @@ var McpAppFrame = ({
4593
4736
  const resource = loaded && "resource" in loaded ? loaded.resource : void 0;
4594
4737
  const sandboxUrl = host.sandbox?.url;
4595
4738
  const timeoutMs = host.sandbox?.timeoutMs ?? MCP_APP_SANDBOX_TIMEOUT_MS;
4596
- const placement = (0, import_react10.useMemo)(() => {
4739
+ const placement = (0, import_react11.useMemo)(() => {
4597
4740
  if (!resource) return void 0;
4598
4741
  if (sandboxUrl === void 0) return { mode: "opaque" };
4599
4742
  if (fallback) return { mode: "opaque", reason: fallback };
@@ -4604,11 +4747,11 @@ var McpAppFrame = ({
4604
4747
  if (!url) return { mode: "opaque", reason: "too-many-origins" };
4605
4748
  return { mode: "origin", origin: target.origin, url };
4606
4749
  }, [resource, sandboxUrl, fallback, app.server, reload]);
4607
- const doc = (0, import_react10.useMemo)(
4750
+ const doc = (0, import_react11.useMemo)(
4608
4751
  () => !resource || !placement ? void 0 : placement.mode === "origin" ? buildMcpAppSandboxShell(placement.url) : buildMcpAppDocument(resource.html, resource.csp),
4609
4752
  [resource, placement]
4610
4753
  );
4611
- (0, import_react10.useEffect)(() => {
4754
+ (0, import_react11.useEffect)(() => {
4612
4755
  const reason = placement?.mode === "opaque" ? placement.reason : void 0;
4613
4756
  if (reason && reason !== "no-answer" && sandboxUrl !== void 0) {
4614
4757
  warnOnce(
@@ -4617,7 +4760,7 @@ var McpAppFrame = ({
4617
4760
  );
4618
4761
  }
4619
4762
  }, [placement, sandboxUrl]);
4620
- (0, import_react10.useEffect)(() => {
4763
+ (0, import_react11.useEffect)(() => {
4621
4764
  const frame = iframeRef.current;
4622
4765
  if (!live || !resource || !frame || !placement || broken) return;
4623
4766
  const abort = new AbortController();
@@ -4762,10 +4905,10 @@ var McpAppFrame = ({
4762
4905
  }, [live, resource, reload, variant, app.id, placement, broken, timeoutMs]);
4763
4906
  const fullscreen = mode === "fullscreen" && live && !broken;
4764
4907
  const waitingNow = host.isWaiting(app);
4765
- (0, import_react10.useEffect)(() => {
4908
+ (0, import_react11.useEffect)(() => {
4766
4909
  if (fullscreen && waitingNow) leaveRef.current?.();
4767
4910
  }, [fullscreen, waitingNow]);
4768
- useIsoLayoutEffect(() => {
4911
+ useIsoLayoutEffect2(() => {
4769
4912
  if (!fullscreen) return;
4770
4913
  const place = () => {
4771
4914
  const chat2 = rootRef.current?.closest(".awr-chat");
@@ -4797,7 +4940,7 @@ var McpAppFrame = ({
4797
4940
  ro?.disconnect();
4798
4941
  };
4799
4942
  }, [fullscreen]);
4800
- (0, import_react10.useEffect)(() => {
4943
+ (0, import_react11.useEffect)(() => {
4801
4944
  if (!fullscreen) return;
4802
4945
  const before = document.activeElement;
4803
4946
  exitRef.current?.focus();
@@ -4814,10 +4957,10 @@ var McpAppFrame = ({
4814
4957
  if (frame && (before === frame || document.activeElement === document.body)) frame.focus();
4815
4958
  };
4816
4959
  }, [fullscreen]);
4817
- (0, import_react10.useEffect)(() => {
4960
+ (0, import_react11.useEffect)(() => {
4818
4961
  if (theme) bridgeRef.current?.updateContext({ theme });
4819
4962
  }, [theme]);
4820
- (0, import_react10.useEffect)(() => {
4963
+ (0, import_react11.useEffect)(() => {
4821
4964
  if (!menu) return;
4822
4965
  const close = (e) => {
4823
4966
  if (e instanceof KeyboardEvent ? e.key === "Escape" : !menuRef.current?.contains(e.target)) {
@@ -5122,7 +5265,7 @@ var McpAppLine = ({ app, note, action, onAction, labels, className }) => {
5122
5265
  };
5123
5266
 
5124
5267
  // src/components/AgentComposer.tsx
5125
- var import_react11 = require("react");
5268
+ var import_react12 = require("react");
5126
5269
  var import_jsx_runtime6 = require("react/jsx-runtime");
5127
5270
  var thinkingDefaults = (l) => [
5128
5271
  { id: "off", label: l.thinkingLevels.off },
@@ -5134,10 +5277,10 @@ var thinkingDefaults = (l) => [
5134
5277
  var MODES = ["autopilot", "ask-writes", "ask-all", "read-only"];
5135
5278
  var ModeIcon = ({ mode }) => mode === "autopilot" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BoltIcon, { size: 14 }) : mode === "read-only" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EyeIcon, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ShieldIcon, { size: 14 });
5136
5279
  var attachSeq = 0;
5137
- var useIsoLayoutEffect2 = typeof window === "undefined" ? import_react11.useEffect : import_react11.useLayoutEffect;
5280
+ var useIsoLayoutEffect3 = typeof window === "undefined" ? import_react12.useEffect : import_react12.useLayoutEffect;
5138
5281
  var useMenuPlacement = (open, anchor, align) => {
5139
- const [style, setStyle] = (0, import_react11.useState)();
5140
- useIsoLayoutEffect2(() => {
5282
+ const [style, setStyle] = (0, import_react12.useState)();
5283
+ useIsoLayoutEffect3(() => {
5141
5284
  if (!open) return;
5142
5285
  const place = () => {
5143
5286
  const el = anchor.current;
@@ -5214,19 +5357,19 @@ var AgentComposer = ({
5214
5357
  const L = useLabels(labelsOverride);
5215
5358
  const MODE_CHIP = L.modes;
5216
5359
  const DEFAULT_THINKING = thinkingDefaults(L);
5217
- const [text2, setText] = (0, import_react11.useState)("");
5218
- const [pending, setPending] = (0, import_react11.useState)([]);
5219
- const [menu, setMenu] = (0, import_react11.useState)(void 0);
5220
- const [active, setActive] = (0, import_react11.useState)(0);
5221
- const [dismissed, setDismissed] = (0, import_react11.useState)(() => /* @__PURE__ */ new Set());
5222
- const [attachError, setAttachError] = (0, import_react11.useState)();
5223
- const [dragging, setDragging] = (0, import_react11.useState)(false);
5224
- const rootRef = (0, import_react11.useRef)(null);
5225
- const modelRef = (0, import_react11.useRef)(null);
5226
- const modeRef = (0, import_react11.useRef)(null);
5227
- const [dropRect, setDropRect] = (0, import_react11.useState)();
5228
- const [compactBar, setCompactBar] = (0, import_react11.useState)(false);
5229
- (0, import_react11.useEffect)(() => {
5360
+ const [text2, setText] = (0, import_react12.useState)("");
5361
+ const [pending, setPending] = (0, import_react12.useState)([]);
5362
+ const [menu, setMenu] = (0, import_react12.useState)(void 0);
5363
+ const [active, setActive] = (0, import_react12.useState)(0);
5364
+ const [dismissed, setDismissed] = (0, import_react12.useState)(() => /* @__PURE__ */ new Set());
5365
+ const [attachError, setAttachError] = (0, import_react12.useState)();
5366
+ const [dragging, setDragging] = (0, import_react12.useState)(false);
5367
+ const rootRef = (0, import_react12.useRef)(null);
5368
+ const modelRef = (0, import_react12.useRef)(null);
5369
+ const modeRef = (0, import_react12.useRef)(null);
5370
+ const [dropRect, setDropRect] = (0, import_react12.useState)();
5371
+ const [compactBar, setCompactBar] = (0, import_react12.useState)(false);
5372
+ (0, import_react12.useEffect)(() => {
5230
5373
  const el = rootRef.current;
5231
5374
  if (!el || typeof ResizeObserver === "undefined") return;
5232
5375
  const ro = new ResizeObserver(
@@ -5235,11 +5378,11 @@ var AgentComposer = ({
5235
5378
  ro.observe(el);
5236
5379
  return () => ro.disconnect();
5237
5380
  }, [compactWidth]);
5238
- const fileRef = (0, import_react11.useRef)(null);
5239
- const inputRef = (0, import_react11.useRef)(null);
5381
+ const fileRef = (0, import_react12.useRef)(null);
5382
+ const inputRef = (0, import_react12.useRef)(null);
5240
5383
  const draftId = draft?.id;
5241
5384
  const draftText = draft?.text;
5242
- (0, import_react11.useEffect)(() => {
5385
+ (0, import_react12.useEffect)(() => {
5243
5386
  if (draftId === void 0 || !draftText) return;
5244
5387
  setText((t) => t.trim() ? `${t.trimEnd()}
5245
5388
  ${draftText}` : draftText);
@@ -5256,10 +5399,10 @@ ${draftText}` : draftText);
5256
5399
  onFinal: (heard) => setText((t) => t.trim() ? `${t.trimEnd()} ${heard}` : heard)
5257
5400
  });
5258
5401
  const showMic = speech !== false && stt.supported;
5259
- const [startedAt, setStartedAt] = (0, import_react11.useState)();
5260
- const [now, setNow] = (0, import_react11.useState)(() => Date.now());
5261
- const [lastElapsed, setLastElapsed] = (0, import_react11.useState)();
5262
- (0, import_react11.useEffect)(() => {
5402
+ const [startedAt, setStartedAt] = (0, import_react12.useState)();
5403
+ const [now, setNow] = (0, import_react12.useState)(() => Date.now());
5404
+ const [lastElapsed, setLastElapsed] = (0, import_react12.useState)();
5405
+ (0, import_react12.useEffect)(() => {
5263
5406
  if (!busy) {
5264
5407
  if (startedAt !== void 0) setLastElapsed(Date.now() - startedAt);
5265
5408
  setStartedAt(void 0);
@@ -5272,7 +5415,7 @@ ${draftText}` : draftText);
5272
5415
  return () => clearInterval(id);
5273
5416
  }, [busy]);
5274
5417
  const elapsed = startedAt !== void 0 ? now - startedAt : lastElapsed;
5275
- const allCommands = (0, import_react11.useMemo)(() => {
5418
+ const allCommands = (0, import_react12.useMemo)(() => {
5276
5419
  const out = [];
5277
5420
  if (builtinCommands) {
5278
5421
  out.push(
@@ -5352,8 +5495,8 @@ ${draftText}` : draftText);
5352
5495
  const commandsStyle = useMenuPlacement(paletteOpen, rootRef, "stretch");
5353
5496
  const modelStyle = useMenuPlacement(menu === "model", modelRef, "left");
5354
5497
  const modeStyle = useMenuPlacement(menu === "mode", modeRef, "right");
5355
- (0, import_react11.useEffect)(() => setActive(0), [text2, menu]);
5356
- (0, import_react11.useEffect)(() => {
5498
+ (0, import_react12.useEffect)(() => setActive(0), [text2, menu]);
5499
+ (0, import_react12.useEffect)(() => {
5357
5500
  if (!menu) return;
5358
5501
  const onDown = (e) => {
5359
5502
  if (!rootRef.current?.contains(e.target)) setMenu(void 0);
@@ -5446,9 +5589,9 @@ ${draftText}` : draftText);
5446
5589
  e.preventDefault();
5447
5590
  void addFiles(pasted);
5448
5591
  };
5449
- const addFilesRef = (0, import_react11.useRef)(addFiles);
5592
+ const addFilesRef = (0, import_react12.useRef)(addFiles);
5450
5593
  addFilesRef.current = addFiles;
5451
- (0, import_react11.useEffect)(() => {
5594
+ (0, import_react12.useEffect)(() => {
5452
5595
  if (attachments === false) return;
5453
5596
  const target = dropZone === "window" ? globalThis.window : dropZone === "self" ? rootRef.current : dropZone.current;
5454
5597
  if (!target) return;
@@ -5933,7 +6076,7 @@ ${draftText}` : draftText);
5933
6076
  };
5934
6077
 
5935
6078
  // src/components/ChatHistoryList.tsx
5936
- var import_react12 = require("react");
6079
+ var import_react13 = require("react");
5937
6080
  var import_jsx_runtime7 = require("react/jsx-runtime");
5938
6081
  var defaultTime = (ms) => {
5939
6082
  const d = new Date(ms);
@@ -6003,7 +6146,7 @@ var ChatHistoryList = ({
6003
6146
  }
6004
6147
  )
6005
6148
  ] }, c.id);
6006
- return renderChat ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react12.Fragment, { children: renderChat(c, active, row) }, c.id) : row;
6149
+ return renderChat ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react13.Fragment, { children: renderChat(c, active, row) }, c.id) : row;
6007
6150
  }) })
6008
6151
  ] });
6009
6152
  };
@@ -6169,7 +6312,7 @@ var ContextMeter = ({
6169
6312
  };
6170
6313
 
6171
6314
  // src/components/ElicitationPrompt.tsx
6172
- var import_react13 = require("react");
6315
+ var import_react14 = require("react");
6173
6316
  var import_jsx_runtime9 = require("react/jsx-runtime");
6174
6317
  var reasonText = (outcome, L) => {
6175
6318
  const reason = outcome.reason;
@@ -6179,8 +6322,8 @@ var reasonText = (outcome, L) => {
6179
6322
  return reason || outcome.status;
6180
6323
  };
6181
6324
  var useNow = (active) => {
6182
- const [now, setNow] = (0, import_react13.useState)(() => Date.now());
6183
- (0, import_react13.useEffect)(() => {
6325
+ const [now, setNow] = (0, import_react14.useState)(() => Date.now());
6326
+ (0, import_react14.useEffect)(() => {
6184
6327
  if (!active) return;
6185
6328
  setNow(Date.now());
6186
6329
  const timer = setInterval(() => setNow(Date.now()), 1e3);
@@ -6308,11 +6451,11 @@ var FieldControl = ({ field, id, value, issue, onChange, L }) => {
6308
6451
  ] });
6309
6452
  };
6310
6453
  var FormBody = ({ elicitation, answer, L }) => {
6311
- const baseId = (0, import_react13.useId)();
6454
+ const baseId = (0, import_react14.useId)();
6312
6455
  const schema = elicitation.requestedSchema;
6313
6456
  const fields = elicitationFields(schema);
6314
- const [draft, setDraft] = (0, import_react13.useState)(() => elicitationInitialDraft(schema));
6315
- const [issues, setIssues] = (0, import_react13.useState)(void 0);
6457
+ const [draft, setDraft] = (0, import_react14.useState)(() => elicitationInitialDraft(schema));
6458
+ const [issues, setIssues] = (0, import_react14.useState)(void 0);
6316
6459
  const fieldId = (i) => `${baseId}-f${i}`;
6317
6460
  const submit = (e) => {
6318
6461
  e.preventDefault();
@@ -6367,7 +6510,7 @@ var FormBody = ({ elicitation, answer, L }) => {
6367
6510
  };
6368
6511
  var UrlBody = ({ elicitation, answer, L }) => {
6369
6512
  const link = elicitationLink(elicitation.url);
6370
- const [opened, setOpened] = (0, import_react13.useState)(false);
6513
+ const [opened, setOpened] = (0, import_react14.useState)(false);
6371
6514
  const open = () => {
6372
6515
  if (!link.openable || typeof window === "undefined") return;
6373
6516
  window.open(link.href, "_blank", "noopener,noreferrer");
@@ -6431,7 +6574,7 @@ var ElicitationPrompt = ({
6431
6574
  className
6432
6575
  }) => {
6433
6576
  const L = useLabels(labels);
6434
- const [dismissed, setDismissed] = (0, import_react13.useState)(() => /* @__PURE__ */ new Set());
6577
+ const [dismissed, setDismissed] = (0, import_react14.useState)(() => /* @__PURE__ */ new Set());
6435
6578
  const automatic = showOutcomes ? (outcomes ?? []).filter(
6436
6579
  (o) => o.automatic === true && o.status !== "pending" && !dismissed.has(o.id)
6437
6580
  ) : [];
@@ -6492,8 +6635,256 @@ var ElicitationPrompt = ({
6492
6635
  };
6493
6636
 
6494
6637
  // src/components/FilesPanel.tsx
6495
- var import_react14 = require("react");
6638
+ var import_react16 = require("react");
6639
+
6640
+ // src/components/ImageViewer.tsx
6641
+ var import_react15 = require("react");
6642
+ var import_react_dom = require("react-dom");
6496
6643
  var import_jsx_runtime10 = require("react/jsx-runtime");
6644
+ var fileNameOf = (name) => name.split(/[\\/]/).filter(Boolean).pop() ?? name;
6645
+ var SWIPE_PX = 48;
6646
+ var ImageViewer = ({ images, index, onIndex, onClose, labels }) => {
6647
+ const L = useLabels(labels);
6648
+ const rootRef = (0, import_react15.useRef)(null);
6649
+ const closeRef = (0, import_react15.useRef)(null);
6650
+ const imgRef = (0, import_react15.useRef)(null);
6651
+ const touch = (0, import_react15.useRef)(void 0);
6652
+ const [zoom, setZoom] = (0, import_react15.useState)(void 0);
6653
+ const count = images.length;
6654
+ const at = Math.min(Math.max(index, 0), count - 1);
6655
+ const image = images[at];
6656
+ const go = (step) => {
6657
+ if (count < 2) return;
6658
+ setZoom(void 0);
6659
+ onIndex((at + step + count) % count);
6660
+ };
6661
+ (0, import_react15.useEffect)(() => {
6662
+ closeRef.current?.focus();
6663
+ const root = document.documentElement;
6664
+ const before = root.style.overflow;
6665
+ root.style.overflow = "hidden";
6666
+ return () => {
6667
+ root.style.overflow = before;
6668
+ };
6669
+ }, []);
6670
+ const keys = (0, import_react15.useRef)(() => {
6671
+ });
6672
+ keys.current = (e) => {
6673
+ if (e.key === "Escape") {
6674
+ e.preventDefault();
6675
+ e.stopPropagation();
6676
+ onClose();
6677
+ } else if (e.key === "ArrowLeft") go(-1);
6678
+ else if (e.key === "ArrowRight") go(1);
6679
+ else if (e.key === "Tab") {
6680
+ const stops = [
6681
+ ...rootRef.current?.querySelectorAll("button, a[href]") ?? []
6682
+ ].filter((el) => !el.hasAttribute("disabled"));
6683
+ if (!stops.length) return;
6684
+ const first = stops[0];
6685
+ const last = stops[stops.length - 1];
6686
+ const active = document.activeElement;
6687
+ if (!rootRef.current?.contains(active)) {
6688
+ e.preventDefault();
6689
+ (e.shiftKey ? last : first).focus();
6690
+ } else if (e.shiftKey ? active === first : active === last) {
6691
+ e.preventDefault();
6692
+ (e.shiftKey ? last : first).focus();
6693
+ }
6694
+ }
6695
+ };
6696
+ (0, import_react15.useEffect)(() => {
6697
+ const onKey = (e) => keys.current(e);
6698
+ document.addEventListener("keydown", onKey, true);
6699
+ return () => document.removeEventListener("keydown", onKey, true);
6700
+ }, []);
6701
+ if (!image) return null;
6702
+ const toggleZoom = () => {
6703
+ const img = imgRef.current;
6704
+ if (zoom !== void 0 || !img) return setZoom(void 0);
6705
+ setZoom(Math.max(img.naturalWidth, Math.round(img.clientWidth * 2)));
6706
+ };
6707
+ const onTouchStart = (e) => {
6708
+ touch.current = e.touches.length === 1 ? { x: e.touches[0].clientX, y: e.touches[0].clientY } : void 0;
6709
+ };
6710
+ const onTouchEnd = (e) => {
6711
+ const from = touch.current;
6712
+ touch.current = void 0;
6713
+ if (!from || zoom !== void 0 || e.changedTouches.length !== 1) return;
6714
+ const dx = e.changedTouches[0].clientX - from.x;
6715
+ const dy = e.changedTouches[0].clientY - from.y;
6716
+ if (Math.abs(dx) > SWIPE_PX && Math.abs(dx) > Math.abs(dy) * 1.5) go(dx < 0 ? 1 : -1);
6717
+ };
6718
+ const name = fileNameOf(image.name);
6719
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref: rootRef, className: "awr-viewer", role: "dialog", "aria-modal": "true", "aria-label": name, children: [
6720
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "awr-viewer__bar", children: [
6721
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-viewer__name", title: image.name, children: name }),
6722
+ count > 1 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-viewer__count", "aria-live": "polite", children: L.imageCount(at + 1, count) }),
6723
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6724
+ "button",
6725
+ {
6726
+ type: "button",
6727
+ className: "awr-iconbtn awr-viewer__zoom",
6728
+ "aria-label": L.imageZoom,
6729
+ title: L.imageZoom,
6730
+ "aria-pressed": zoom !== void 0,
6731
+ onClick: toggleZoom,
6732
+ children: zoom !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ShrinkIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ExpandIcon, { size: 18 })
6733
+ }
6734
+ ),
6735
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6736
+ "a",
6737
+ {
6738
+ className: "awr-iconbtn awr-viewer__download",
6739
+ href: image.src,
6740
+ download: name,
6741
+ "aria-label": L.fileDownload(name),
6742
+ title: L.download,
6743
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DownloadIcon, { size: 18 })
6744
+ }
6745
+ ),
6746
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6747
+ "button",
6748
+ {
6749
+ ref: closeRef,
6750
+ type: "button",
6751
+ className: "awr-iconbtn awr-viewer__close",
6752
+ "aria-label": L.close,
6753
+ title: L.close,
6754
+ onClick: onClose,
6755
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(XIcon, { size: 18 })
6756
+ }
6757
+ )
6758
+ ] }),
6759
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6760
+ "div",
6761
+ {
6762
+ className: `awr-viewer__stage${zoom !== void 0 ? " is-zoomed" : ""}`,
6763
+ onClick: (e) => {
6764
+ if (e.target === e.currentTarget) onClose();
6765
+ },
6766
+ onTouchStart,
6767
+ onTouchEnd,
6768
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6769
+ "img",
6770
+ {
6771
+ ref: imgRef,
6772
+ className: "awr-viewer__img",
6773
+ src: image.src,
6774
+ alt: image.alt ?? name,
6775
+ style: zoom !== void 0 ? { width: zoom } : void 0,
6776
+ onClick: toggleZoom,
6777
+ onDoubleClick: (e) => e.preventDefault(),
6778
+ draggable: false
6779
+ },
6780
+ image.src
6781
+ )
6782
+ }
6783
+ ),
6784
+ count > 1 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
6785
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6786
+ "button",
6787
+ {
6788
+ type: "button",
6789
+ className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--prev",
6790
+ "aria-label": L.imagePrevious,
6791
+ title: L.imagePrevious,
6792
+ onClick: () => go(-1),
6793
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u2039" })
6794
+ }
6795
+ ),
6796
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6797
+ "button",
6798
+ {
6799
+ type: "button",
6800
+ className: "awr-iconbtn awr-viewer__nav awr-viewer__nav--next",
6801
+ "aria-label": L.imageNext,
6802
+ title: L.imageNext,
6803
+ onClick: () => go(1),
6804
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u203A" })
6805
+ }
6806
+ )
6807
+ ] })
6808
+ ] });
6809
+ };
6810
+ var ImageViewerContext = (0, import_react15.createContext)({ enabled: true });
6811
+ var ImageViewerProvider = ({
6812
+ enabled = true,
6813
+ render,
6814
+ children
6815
+ }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageViewerContext.Provider, { value: { enabled, render }, children });
6816
+ var imageExtensionOf = (src) => {
6817
+ const type = /^data:image\/([a-z0-9.+-]+)/i.exec(src)?.[1]?.toLowerCase();
6818
+ return !type ? "" : type === "jpeg" ? ".jpg" : type === "svg+xml" ? ".svg" : `.${type}`;
6819
+ };
6820
+ var groupOf = (button) => {
6821
+ const scope = button.closest(".awr-msg") ?? button.parentElement ?? button;
6822
+ const buttons = [...scope.querySelectorAll("[data-awr-image]")];
6823
+ const images = buttons.flatMap((b) => {
6824
+ const img = b.querySelector("img");
6825
+ return img ? [{ src: img.currentSrc || img.src, name: b.dataset.awrImage || img.alt, alt: img.alt }] : [];
6826
+ });
6827
+ return { images, index: Math.max(0, buttons.indexOf(button)) };
6828
+ };
6829
+ var ImageThumb = ({
6830
+ src,
6831
+ name,
6832
+ alt,
6833
+ className,
6834
+ imgClassName,
6835
+ title,
6836
+ labels
6837
+ }) => {
6838
+ const L = useLabels(labels);
6839
+ const { enabled, render } = (0, import_react15.useContext)(ImageViewerContext);
6840
+ const ref = (0, import_react15.useRef)(null);
6841
+ const [open, setOpen] = (0, import_react15.useState)(void 0);
6842
+ const img = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { className: imgClassName, src, alt });
6843
+ if (!enabled) {
6844
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("a", { className, href: src, target: "_blank", rel: "noopener noreferrer", title, children: img });
6845
+ }
6846
+ const close = () => {
6847
+ setOpen(void 0);
6848
+ ref.current?.focus();
6849
+ };
6850
+ const viewer = (o) => ({
6851
+ images: o.images,
6852
+ index: o.index,
6853
+ onIndex: (index) => setOpen({ ...o, index }),
6854
+ onClose: close,
6855
+ labels
6856
+ });
6857
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
6858
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6859
+ "button",
6860
+ {
6861
+ ref,
6862
+ type: "button",
6863
+ className: ["awr-imgbtn", className].filter(Boolean).join(" "),
6864
+ "data-awr-image": name,
6865
+ "aria-label": L.imageOpen(fileNameOf(name)),
6866
+ "aria-haspopup": "dialog",
6867
+ title,
6868
+ onClick: (e) => {
6869
+ const button = e.currentTarget;
6870
+ setOpen({
6871
+ ...groupOf(button),
6872
+ // Inside the chat's element, so its theme applies; it covers the window from there.
6873
+ host: button.closest(".awr-chat, .awr-theme") ?? document.body
6874
+ });
6875
+ },
6876
+ children: img
6877
+ }
6878
+ ),
6879
+ open && (0, import_react_dom.createPortal)(
6880
+ render ? render(viewer(open), /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageViewer, { ...viewer(open) })) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImageViewer, { ...viewer(open) }),
6881
+ open.host
6882
+ )
6883
+ ] });
6884
+ };
6885
+
6886
+ // src/components/FilesPanel.tsx
6887
+ var import_jsx_runtime11 = require("react/jsx-runtime");
6497
6888
  var PREVIEW_CHARS = 2e4;
6498
6889
  var FilesPanel = ({
6499
6890
  files: vfs,
@@ -6509,9 +6900,9 @@ var FilesPanel = ({
6509
6900
  }) => {
6510
6901
  const L = useLabels(labels);
6511
6902
  const fs = useVirtualFiles(vfs, prefix);
6512
- const [preview, setPreview] = (0, import_react14.useState)();
6513
- const inputRef = (0, import_react14.useRef)(null);
6514
- (0, import_react14.useEffect)(() => {
6903
+ const [preview, setPreview] = (0, import_react16.useState)();
6904
+ const inputRef = (0, import_react16.useRef)(null);
6905
+ (0, import_react16.useEffect)(() => {
6515
6906
  if (preview && !fs.files.some((f) => f.path === preview.path)) setPreview(void 0);
6516
6907
  }, [fs.files, preview]);
6517
6908
  const open = async (f) => {
@@ -6534,11 +6925,11 @@ var FilesPanel = ({
6534
6925
  a.download = f.path.split("/").pop() || "file";
6535
6926
  a.click();
6536
6927
  };
6537
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: ["awr-filespanel", className].filter(Boolean).join(" "), children: [
6538
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "awr-panel__head", children: [
6539
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-panel__title", children: title ?? L.files }),
6540
- allowUpload && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
6541
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6928
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: ["awr-filespanel", className].filter(Boolean).join(" "), children: [
6929
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "awr-panel__head", children: [
6930
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-panel__title", children: title ?? L.files }),
6931
+ allowUpload && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
6932
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6542
6933
  "button",
6543
6934
  {
6544
6935
  type: "button",
@@ -6546,10 +6937,10 @@ var FilesPanel = ({
6546
6937
  "aria-label": L.upload,
6547
6938
  title: L.upload,
6548
6939
  onClick: () => inputRef.current?.click(),
6549
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PlusIcon, { size: 16 })
6940
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PlusIcon, { size: 16 })
6550
6941
  }
6551
6942
  ),
6552
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6943
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6553
6944
  "input",
6554
6945
  {
6555
6946
  ref: inputRef,
@@ -6564,15 +6955,15 @@ var FilesPanel = ({
6564
6955
  )
6565
6956
  ] })
6566
6957
  ] }),
6567
- fs.error && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "awr-notice awr-notice--warn", children: fs.error }),
6568
- !fs.loading && fs.files.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "awr-panel__empty", children: L.filesEmpty }),
6569
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "awr-filelist", children: fs.files.map((f) => {
6570
- const row = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6958
+ fs.error && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-notice awr-notice--warn", children: fs.error }),
6959
+ !fs.loading && fs.files.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-panel__empty", children: L.filesEmpty }),
6960
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "awr-filelist", children: fs.files.map((f) => {
6961
+ const row = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
6571
6962
  "li",
6572
6963
  {
6573
6964
  className: `awr-filelist__item${preview?.path === f.path ? " is-active" : ""}`,
6574
6965
  children: [
6575
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6966
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
6576
6967
  "button",
6577
6968
  {
6578
6969
  type: "button",
@@ -6580,13 +6971,13 @@ var FilesPanel = ({
6580
6971
  onClick: () => void open(f),
6581
6972
  title: `${L.preview}: ${f.path}`,
6582
6973
  children: [
6583
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FileIcon, { size: 14 }),
6584
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-filelist__path", children: f.path }),
6585
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "awr-filelist__size", children: L.bytes(f.size) })
6974
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FileIcon, { size: 14 }),
6975
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-filelist__path", children: f.path }),
6976
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-filelist__size", children: L.bytes(f.size) })
6586
6977
  ]
6587
6978
  }
6588
6979
  ),
6589
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6980
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6590
6981
  "button",
6591
6982
  {
6592
6983
  type: "button",
@@ -6594,10 +6985,10 @@ var FilesPanel = ({
6594
6985
  "aria-label": `${L.download} ${f.path}`,
6595
6986
  title: L.download,
6596
6987
  onClick: () => void download(f),
6597
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DownloadIcon, { size: 14 })
6988
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(DownloadIcon, { size: 14 })
6598
6989
  }
6599
6990
  ),
6600
- allowDelete && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6991
+ allowDelete && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6601
6992
  "button",
6602
6993
  {
6603
6994
  type: "button",
@@ -6605,22 +6996,34 @@ var FilesPanel = ({
6605
6996
  "aria-label": `${L.delete} ${f.path}`,
6606
6997
  title: L.delete,
6607
6998
  onClick: () => void fs.remove(f.path),
6608
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(XIcon, { size: 14 })
6999
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(XIcon, { size: 14 })
6609
7000
  }
6610
7001
  )
6611
7002
  ]
6612
7003
  },
6613
7004
  f.path
6614
7005
  );
6615
- return renderFile ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react14.Fragment, { children: renderFile(f, row) }, f.path) : row;
7006
+ return renderFile ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react16.Fragment, { children: renderFile(f, row) }, f.path) : row;
6616
7007
  }) }),
6617
- preview && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "awr-filepreview", children: preview.kind === "image" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { src: preview.src, alt: preview.path }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("pre", { children: preview.text.length > PREVIEW_CHARS ? `${preview.text.slice(0, PREVIEW_CHARS)}
7008
+ preview && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "awr-filepreview", children: preview.kind === "image" ? (
7009
+ // A click (Enter, Space) opens it over the chat, fitted to the screen.
7010
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7011
+ ImageThumb,
7012
+ {
7013
+ src: preview.src,
7014
+ name: preview.path,
7015
+ alt: preview.path,
7016
+ title: preview.path,
7017
+ labels
7018
+ }
7019
+ )
7020
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("pre", { children: preview.text.length > PREVIEW_CHARS ? `${preview.text.slice(0, PREVIEW_CHARS)}
6618
7021
  \u2026` : preview.text }) })
6619
7022
  ] });
6620
7023
  };
6621
7024
 
6622
7025
  // src/components/FileChips.tsx
6623
- var import_react16 = require("react");
7026
+ var import_react18 = require("react");
6624
7027
 
6625
7028
  // src/file-kinds.ts
6626
7029
  var import_agent_web6 = require("@dudko.dev/agent-web");
@@ -6638,12 +7041,12 @@ var fileKindOf = (path, mediaType) => {
6638
7041
  if (mime === "text/plain" || /\.(?:txt|log)$/i.test(path) || (0, import_agent_web6.isTextMime)(mime)) return "text";
6639
7042
  return "file";
6640
7043
  };
6641
- var fileNameOf = (path) => path.split("/").filter(Boolean).pop() || "file";
7044
+ var fileNameOf2 = (path) => path.split("/").filter(Boolean).pop() || "file";
6642
7045
 
6643
7046
  // src/components/Media.tsx
6644
- var import_react15 = require("react");
7047
+ var import_react17 = require("react");
6645
7048
  var import_agent_web7 = require("@dudko.dev/agent-web");
6646
- var import_jsx_runtime11 = require("react/jsx-runtime");
7049
+ var import_jsx_runtime12 = require("react/jsx-runtime");
6647
7050
  var mediaFamilyOf = (mediaType) => {
6648
7051
  const type = mediaType.toLowerCase().split(";")[0].trim();
6649
7052
  if (Object.hasOwn(import_agent_web7.MEDIA_IMAGE_TYPES, type)) return "image";
@@ -6658,8 +7061,8 @@ var bytesOf = (content, encoding) => {
6658
7061
  return bytes;
6659
7062
  };
6660
7063
  var useFileUrl = (files, path, mediaType) => {
6661
- const [url, setUrl] = (0, import_react15.useState)(void 0);
6662
- (0, import_react15.useEffect)(() => {
7064
+ const [url, setUrl] = (0, import_react17.useState)(void 0);
7065
+ (0, import_react17.useEffect)(() => {
6663
7066
  if (!files || !mediaType) return;
6664
7067
  let made;
6665
7068
  let gone = false;
@@ -6685,20 +7088,21 @@ var GeneratedMedia = ({ media, files, labels }) => {
6685
7088
  const type = family ? media.mediaType.toLowerCase().split(";")[0].trim() : void 0;
6686
7089
  const url = useFileUrl(files, media.path, type);
6687
7090
  if (url && family === "image") {
6688
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6689
- "a",
7091
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
7092
+ ImageThumb,
6690
7093
  {
6691
7094
  className: "awr-media awr-media--image",
6692
- href: url,
6693
- target: "_blank",
6694
- rel: "noopener noreferrer",
7095
+ imgClassName: "awr-media__img",
7096
+ src: url,
7097
+ name: media.path,
7098
+ alt: L.mediaImage(media.path),
6695
7099
  title: media.path,
6696
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", { className: "awr-media__img", src: url, alt: L.mediaImage(media.path) })
7100
+ labels
6697
7101
  }
6698
7102
  );
6699
7103
  }
6700
7104
  if (url && family === "audio") {
6701
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "awr-media awr-media--audio", title: media.path, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7105
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "awr-media awr-media--audio", title: media.path, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
6702
7106
  "audio",
6703
7107
  {
6704
7108
  className: "awr-media__audio",
@@ -6709,27 +7113,27 @@ var GeneratedMedia = ({ media, files, labels }) => {
6709
7113
  }
6710
7114
  ) });
6711
7115
  }
6712
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "awr-chip awr-file awr-media awr-media--file", title: L.mediaFile(media.path), children: [
6713
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FileIcon, { size: 13 }),
7116
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "awr-chip awr-file awr-media awr-media--file", title: L.mediaFile(media.path), children: [
7117
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FileIcon, { size: 13 }),
6714
7118
  " ",
6715
7119
  media.path
6716
7120
  ] });
6717
7121
  };
6718
7122
  var TranscriptBlock = ({ transcript, labels }) => {
6719
7123
  const L = useLabels(labels);
6720
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("details", { className: "awr-transcript", children: [
6721
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("summary", { className: "awr-transcript__summary", children: [
6722
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FileIcon, { size: 13 }),
7124
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("details", { className: "awr-transcript", children: [
7125
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("summary", { className: "awr-transcript__summary", children: [
7126
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FileIcon, { size: 13 }),
6723
7127
  " ",
6724
7128
  L.transcriptOf(transcript.name)
6725
7129
  ] }),
6726
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "awr-transcript__note", children: L.transcriptNote }),
6727
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("blockquote", { className: "awr-transcript__text", children: transcript.text })
7130
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "awr-transcript__note", children: L.transcriptNote }),
7131
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("blockquote", { className: "awr-transcript__text", children: transcript.text })
6728
7132
  ] });
6729
7133
  };
6730
7134
 
6731
7135
  // src/components/SandboxedFrame.tsx
6732
- var import_jsx_runtime12 = require("react/jsx-runtime");
7136
+ var import_jsx_runtime13 = require("react/jsx-runtime");
6733
7137
  var FRAME_MIN_HEIGHT = 120;
6734
7138
  var FRAME_MAX_HEIGHT = 800;
6735
7139
  var clampFrameHeight = (height) => Math.min(
@@ -6746,12 +7150,12 @@ var SandboxedFrame = ({
6746
7150
  height = 300,
6747
7151
  children,
6748
7152
  className
6749
- }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: ["awr-frame", className].filter(Boolean).join(" "), children: [
6750
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "awr-frame__head", children: [
6751
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "awr-frame__label", children: label }),
7153
+ }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: ["awr-frame", className].filter(Boolean).join(" "), children: [
7154
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "awr-frame__head", children: [
7155
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-frame__label", children: label }),
6752
7156
  actions
6753
7157
  ] }),
6754
- html !== void 0 && children === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "awr-frame__well", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
7158
+ html !== void 0 && children === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-frame__well", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
6755
7159
  "iframe",
6756
7160
  {
6757
7161
  className: "awr-frame__iframe",
@@ -6763,11 +7167,11 @@ var SandboxedFrame = ({
6763
7167
  },
6764
7168
  scripts ? "scripts" : "static"
6765
7169
  ) }) : children,
6766
- footer ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "awr-frame__foot", children: footer }) : null
7170
+ footer ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-frame__foot", children: footer }) : null
6767
7171
  ] });
6768
7172
 
6769
7173
  // src/components/FileChips.tsx
6770
- var import_jsx_runtime13 = require("react/jsx-runtime");
7174
+ var import_jsx_runtime14 = require("react/jsx-runtime");
6771
7175
  var FILE_PREVIEW_CHARS = 2e4;
6772
7176
  var textOf = (file) => file.encoding === "base64" ? new TextDecoder().decode(bytesOf(file.content, "base64")) : file.content;
6773
7177
  var KIND_ICON = {
@@ -6788,11 +7192,11 @@ var downloadFile = async (vfs, path) => {
6788
7192
  );
6789
7193
  const a = document.createElement("a");
6790
7194
  a.href = url;
6791
- a.download = fileNameOf(path);
7195
+ a.download = fileNameOf2(path);
6792
7196
  a.click();
6793
7197
  setTimeout(() => URL.revokeObjectURL(url), 1e3);
6794
7198
  };
6795
- var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-seg", role: "group", "aria-label": label, children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
7199
+ var Seg = ({ value, options, onChange, label }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "awr-seg", role: "group", "aria-label": label, children: options.map((o) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
6796
7200
  "button",
6797
7201
  {
6798
7202
  type: "button",
@@ -6827,32 +7231,32 @@ var SourceView = ({
6827
7231
  const L = useLabels(labels);
6828
7232
  const cut = text2.length > maxChars;
6829
7233
  const shown = cut ? text2.slice(0, maxChars) : text2;
6830
- const lines = (0, import_react16.useMemo)(
7234
+ const lines = (0, import_react18.useMemo)(
6831
7235
  () => linesOf(html ? tokenizeHtml(shown) : [{ kind: "text", text: shown }]),
6832
7236
  [shown, html]
6833
7237
  );
6834
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
6835
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("pre", { className: ["awr-source", className].filter(Boolean).join(" "), tabIndex: 0, children: lines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "awr-source__line", children: [
7238
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
7239
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("pre", { className: ["awr-source", className].filter(Boolean).join(" "), tabIndex: 0, children: lines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-source__line", children: [
6836
7240
  line.map(
6837
- (t, k) => t.kind === "text" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react16.Fragment, { children: t.text }, k) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
7241
+ (t, k) => t.kind === "text" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react18.Fragment, { children: t.text }, k) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: `awr-source__${t.kind}`, children: t.text }, k)
6838
7242
  ),
6839
7243
  "\n"
6840
7244
  ] }, i)) }),
6841
- cut && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "awr-fileview__cut", children: L.fileCut(maxChars) })
7245
+ cut && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-fileview__cut", children: L.fileCut(maxChars) })
6842
7246
  ] });
6843
7247
  };
6844
7248
  var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
6845
- const html = (0, import_react16.useMemo)(() => textOf(file), [file]);
7249
+ const html = (0, import_react18.useMemo)(() => textOf(file), [file]);
6846
7250
  const options = htmlPreview === false ? void 0 : htmlPreview;
6847
7251
  const tooLarge = html.length > HTML_PREVIEW_MAX_CHARS;
6848
7252
  const canFrame = Boolean(options) && !tooLarge;
6849
- const [view, setView] = (0, import_react16.useState)(canFrame ? "preview" : "source");
6850
- const [tall, setTall] = (0, import_react16.useState)(false);
7253
+ const [view, setView] = (0, import_react18.useState)(canFrame ? "preview" : "source");
7254
+ const [tall, setTall] = (0, import_react18.useState)(false);
6851
7255
  const showing = canFrame ? view : "source";
6852
7256
  const scripts = options?.scripts === true;
6853
7257
  const height = options?.height ?? 300;
6854
- const linked = (0, import_react16.useMemo)(() => showing === "preview" ? linkedFilesOf(html) : [], [html, showing]);
6855
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
7258
+ const linked = (0, import_react18.useMemo)(() => showing === "preview" ? linkedFilesOf(html) : [], [html, showing]);
7259
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6856
7260
  SandboxedFrame,
6857
7261
  {
6858
7262
  className: "awr-frame--html",
@@ -6860,35 +7264,35 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
6860
7264
  html: showing === "preview" ? html : void 0,
6861
7265
  scripts,
6862
7266
  height: tall ? height * 2 : height,
6863
- label: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
6864
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CodeIcon, { size: 14, className: "awr-frame__icon" }),
6865
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "awr-frame__titles", children: [
6866
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
6867
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
6868
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LockIcon, { size: 11 }),
7267
+ label: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
7268
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CodeIcon, { size: 14, className: "awr-frame__icon" }),
7269
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-frame__titles", children: [
7270
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-frame__title", children: L.htmlFrameTitle }),
7271
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-frame__badges", children: showing === "preview" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
7272
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LockIcon, { size: 11 }),
6869
7273
  " ",
6870
7274
  L.htmlSandboxed,
6871
7275
  " \xB7 ",
6872
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NoNetworkIcon, { size: 11 }),
7276
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NoNetworkIcon, { size: 11 }),
6873
7277
  " ",
6874
7278
  L.htmlNoNetwork
6875
7279
  ] }) : L.htmlSourceNote })
6876
7280
  ] })
6877
7281
  ] }),
6878
- actions: canFrame ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
6879
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
7282
+ actions: canFrame ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
7283
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6880
7284
  Seg,
6881
7285
  {
6882
7286
  label: L.htmlFrameTitle,
6883
7287
  value: showing,
6884
7288
  onChange: setView,
6885
7289
  options: [
6886
- { value: "preview", label: L.preview, icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EyeIcon, { size: 13 }) },
6887
- { value: "source", label: L.fileSource, icon: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CodeIcon, { size: 13 }) }
7290
+ { value: "preview", label: L.preview, icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EyeIcon, { size: 13 }) },
7291
+ { value: "source", label: L.fileSource, icon: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CodeIcon, { size: 13 }) }
6888
7292
  ]
6889
7293
  }
6890
7294
  ),
6891
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
7295
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6892
7296
  "button",
6893
7297
  {
6894
7298
  type: "button",
@@ -6898,14 +7302,14 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
6898
7302
  "aria-pressed": tall,
6899
7303
  disabled: showing !== "preview",
6900
7304
  onClick: () => setTall((t) => !t),
6901
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ExpandIcon, { size: 15 })
7305
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ExpandIcon, { size: 15 })
6902
7306
  }
6903
7307
  )
6904
7308
  ] }) : void 0,
6905
- footer: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
6906
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FileIcon, { size: 11 }),
6907
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("code", { children: written.path }),
6908
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "awr-frame__footmeta", children: [
7309
+ footer: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
7310
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileIcon, { size: 11 }),
7311
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { children: written.path }),
7312
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-frame__footmeta", children: [
6909
7313
  "\xB7 ",
6910
7314
  L.bytes(file.size),
6911
7315
  " \xB7",
@@ -6914,18 +7318,18 @@ var HtmlPreview = ({ written, file, htmlPreview, previewChars, L }) => {
6914
7318
  linked.length > 0 ? ` \xB7 ${L.htmlLinkedFiles(linked.join(", "))}` : ""
6915
7319
  ] })
6916
7320
  ] }),
6917
- children: showing === "source" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
6918
- tooLarge && options ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
6919
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
7321
+ children: showing === "source" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
7322
+ tooLarge && options ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-fileview__cut", children: L.htmlTooLarge }) : null,
7323
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SourceView, { text: html, html: true, maxChars: previewChars, className: "awr-frame__source" })
6920
7324
  ] }) : void 0
6921
7325
  }
6922
7326
  );
6923
7327
  };
6924
7328
  var ImagePreview = ({ written, vfs, onClose, L }) => {
6925
7329
  const url = useFileUrl(vfs, written.path, written.mediaType.toLowerCase().split(";")[0].trim());
6926
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "awr-fileview", children: [
6927
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FileViewHead, { written, kind: "image", onClose, L }),
6928
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-fileview__image", children: url ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: url, alt: fileNameOf(written.path) }) : null })
7330
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-fileview", children: [
7331
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileViewHead, { written, kind: "image", onClose, L }),
7332
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "awr-fileview__image", children: url ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: url, alt: fileNameOf2(written.path) }) : null })
6929
7333
  ] });
6930
7334
  };
6931
7335
  var FileViewHead = ({
@@ -6934,15 +7338,15 @@ var FileViewHead = ({
6934
7338
  onClose,
6935
7339
  L,
6936
7340
  children
6937
- }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "awr-fileview__head", children: [
6938
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "awr-fileview__name", title: written.path, children: fileNameOf(written.path) }),
6939
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "awr-fileview__kind", children: [
7341
+ }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-fileview__head", children: [
7342
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-fileview__name", title: written.path, children: fileNameOf2(written.path) }),
7343
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-fileview__kind", children: [
6940
7344
  "\xB7 ",
6941
7345
  L.fileKinds[kind]
6942
7346
  ] }),
6943
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "awr-fileview__actions", children: [
7347
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-fileview__actions", children: [
6944
7348
  children,
6945
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
7349
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6946
7350
  "button",
6947
7351
  {
6948
7352
  type: "button",
@@ -6950,7 +7354,7 @@ var FileViewHead = ({
6950
7354
  "aria-label": L.closePreview,
6951
7355
  title: L.closePreview,
6952
7356
  onClick: onClose,
6953
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(XIcon, { size: 14 })
7357
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(XIcon, { size: 14 })
6954
7358
  }
6955
7359
  )
6956
7360
  ] })
@@ -6964,21 +7368,21 @@ var TextPreview = ({
6964
7368
  onClose,
6965
7369
  L
6966
7370
  }) => {
6967
- const text2 = (0, import_react16.useMemo)(() => textOf(file), [file]);
6968
- const rendered = (0, import_react16.useMemo)(
7371
+ const text2 = (0, import_react18.useMemo)(() => textOf(file), [file]);
7372
+ const rendered = (0, import_react18.useMemo)(
6969
7373
  () => renderFileContent?.(written, text2.slice(0, previewChars)),
6970
7374
  [renderFileContent, written, text2, previewChars]
6971
7375
  );
6972
7376
  const hasRendered = rendered !== void 0 && rendered !== null && rendered !== false;
6973
- const [view, setView] = (0, import_react16.useState)("rendered");
6974
- const [all, setAll] = (0, import_react16.useState)(false);
7377
+ const [view, setView] = (0, import_react18.useState)("rendered");
7378
+ const [all, setAll] = (0, import_react18.useState)(false);
6975
7379
  const showing = hasRendered ? view : "source";
6976
7380
  const long = text2.length > 1200 || text2.split("\n").length > 16;
6977
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "awr-fileview", children: [
6978
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FileViewHead, { written, kind, onClose, L, children: hasRendered && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
7381
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-fileview", children: [
7382
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileViewHead, { written, kind, onClose, L, children: hasRendered && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
6979
7383
  Seg,
6980
7384
  {
6981
- label: fileNameOf(written.path),
7385
+ label: fileNameOf2(written.path),
6982
7386
  value: showing,
6983
7387
  onChange: setView,
6984
7388
  options: [
@@ -6987,16 +7391,16 @@ var TextPreview = ({
6987
7391
  ]
6988
7392
  }
6989
7393
  ) }),
6990
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
6991
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-fileview__rendered", children: rendered }),
6992
- text2.length > previewChars && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
6993
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SourceView, { text: text2, maxChars: previewChars }) }),
6994
- long && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "awr-fileview__more", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: () => setAll((a) => !a), children: all ? L.fileShowLess : L.fileShowRest }) })
7394
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `awr-fileview__body${long && !all ? " is-folded" : ""}`, children: showing === "rendered" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
7395
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "awr-fileview__rendered", children: rendered }),
7396
+ text2.length > previewChars && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-fileview__cut", children: L.fileCut(previewChars) })
7397
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SourceView, { text: text2, maxChars: previewChars }) }),
7398
+ long && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "awr-fileview__more", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: () => setAll((a) => !a), children: all ? L.fileShowLess : L.fileShowRest }) })
6995
7399
  ] });
6996
7400
  };
6997
- var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "awr-fileview", children: [
6998
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FileViewHead, { written, kind, onClose, L }),
6999
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "awr-fileview__none", children: L.fileNoPreview })
7401
+ var NoPreview = ({ written, kind, onClose, L }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-fileview", children: [
7402
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileViewHead, { written, kind, onClose, L }),
7403
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "awr-fileview__none", children: L.fileNoPreview })
7000
7404
  ] });
7001
7405
  var FileChips = ({
7002
7406
  written,
@@ -7013,11 +7417,11 @@ var FileChips = ({
7013
7417
  }) => {
7014
7418
  const L = useLabels(labels);
7015
7419
  const live = useVirtualFiles(vfs);
7016
- const [openPath, setOpenPath] = (0, import_react16.useState)(defaultOpen);
7017
- const [file, setFile] = (0, import_react16.useState)();
7420
+ const [openPath, setOpenPath] = (0, import_react18.useState)(defaultOpen);
7421
+ const [file, setFile] = (0, import_react18.useState)();
7018
7422
  const open = written.find((f) => f.path === openPath);
7019
7423
  const stamp = live.files.find((f) => f.path === openPath)?.updatedAt;
7020
- (0, import_react16.useEffect)(() => {
7424
+ (0, import_react18.useEffect)(() => {
7021
7425
  if (!vfs || !openPath) return setFile(void 0);
7022
7426
  let gone = false;
7023
7427
  vfs.read(openPath).then((f) => {
@@ -7044,23 +7448,23 @@ var FileChips = ({
7044
7448
  onClose: () => setOpenPath(void 0),
7045
7449
  L
7046
7450
  };
7047
- if (kind === "html") return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(HtmlPreview, { ...props }, open.path);
7048
- if (kind === "image") return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ImagePreview, { ...props }, open.path);
7049
- if (kind === "file") return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NoPreview, { ...props }, open.path);
7050
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TextPreview, { ...props }, open.path);
7451
+ if (kind === "html") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(HtmlPreview, { ...props }, open.path);
7452
+ if (kind === "image") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ImagePreview, { ...props }, open.path);
7453
+ if (kind === "file") return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NoPreview, { ...props }, open.path);
7454
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TextPreview, { ...props }, open.path);
7051
7455
  };
7052
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: ["awr-msg__files", className].filter(Boolean).join(" "), children: [
7053
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "awr-msg__fileshead", children: [
7054
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FileIcon, { size: 13 }),
7055
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: L.filesWritten(written.length) }),
7056
- onShowFiles && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: onShowFiles, children: L.showInFiles })
7456
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: ["awr-msg__files", className].filter(Boolean).join(" "), children: [
7457
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-msg__fileshead", children: [
7458
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FileIcon, { size: 13 }),
7459
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: L.filesWritten(written.length) }),
7460
+ onShowFiles && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: "awr-linkbtn", onClick: onShowFiles, children: L.showInFiles })
7057
7461
  ] }),
7058
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "awr-filechips", children: written.map((w) => {
7462
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "awr-filechips", children: written.map((w) => {
7059
7463
  const info = live.files.find((f) => f.path === w.path);
7060
7464
  const gone = Boolean(vfs) && !live.loading && !info;
7061
7465
  const usable = Boolean(vfs) && !gone;
7062
7466
  const isOpen = openPath === w.path && usable;
7063
- const chip = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
7467
+ const chip = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
7064
7468
  FileChip,
7065
7469
  {
7066
7470
  written: w,
@@ -7073,7 +7477,7 @@ var FileChips = ({
7073
7477
  labels
7074
7478
  }
7075
7479
  );
7076
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("li", { className: "awr-filechips__item", children: renderFile ? renderFile(w, chip) : chip }, w.path);
7480
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: "awr-filechips__item", children: renderFile ? renderFile(w, chip) : chip }, w.path);
7077
7481
  }) }),
7078
7482
  preview()
7079
7483
  ] });
@@ -7090,7 +7494,7 @@ var FileChip = ({
7090
7494
  }) => {
7091
7495
  const L = useLabels(labels);
7092
7496
  const kind = fileKindOf(written.path, mediaType);
7093
- const name = fileNameOf(written.path);
7497
+ const name = fileNameOf2(written.path);
7094
7498
  const Icon = KIND_ICON[kind];
7095
7499
  const thumb = useFileUrl(
7096
7500
  kind === "image" ? vfs : void 0,
@@ -7098,19 +7502,19 @@ var FileChip = ({
7098
7502
  kind === "image" ? mediaType.toLowerCase().split(";")[0].trim() : void 0
7099
7503
  );
7100
7504
  const meta = gone ? L.fileGone : [L.fileKinds[kind], L.bytes(bytes), written.by ? L.fileBy(written.by.name) : ""].filter(Boolean).join(" \xB7 ");
7101
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
7505
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
7102
7506
  "div",
7103
7507
  {
7104
7508
  className: `awr-filechip${open ? " is-open" : ""}${gone ? " is-gone" : ""}`,
7105
7509
  title: written.path,
7106
7510
  children: [
7107
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "awr-filechip__thumb", children: thumb ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("img", { src: thumb, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { size: 16 }) }),
7108
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "awr-filechip__text", children: [
7109
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "awr-filechip__name", children: name }),
7110
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "awr-filechip__meta", children: meta })
7511
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-filechip__thumb", children: thumb ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: thumb, alt: "" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { size: 16 }) }),
7512
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-filechip__text", children: [
7513
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-filechip__name", children: name }),
7514
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-filechip__meta", children: meta })
7111
7515
  ] }),
7112
- vfs && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "awr-filechip__actions", children: [
7113
- onToggle && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
7516
+ vfs && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "awr-filechip__actions", children: [
7517
+ onToggle && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
7114
7518
  "button",
7115
7519
  {
7116
7520
  type: "button",
@@ -7119,10 +7523,10 @@ var FileChip = ({
7119
7523
  title: open ? L.closePreview : L.preview,
7120
7524
  "aria-expanded": open,
7121
7525
  onClick: onToggle,
7122
- children: open ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ChevronUpIcon, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EyeIcon, { size: 15 })
7526
+ children: open ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronUpIcon, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(EyeIcon, { size: 15 })
7123
7527
  }
7124
7528
  ),
7125
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
7529
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
7126
7530
  "button",
7127
7531
  {
7128
7532
  type: "button",
@@ -7130,7 +7534,7 @@ var FileChip = ({
7130
7534
  "aria-label": L.fileDownload(name),
7131
7535
  title: L.download,
7132
7536
  onClick: () => void downloadFile(vfs, written.path),
7133
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DownloadIcon, { size: 15 })
7537
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DownloadIcon, { size: 15 })
7134
7538
  }
7135
7539
  )
7136
7540
  ] })
@@ -7140,14 +7544,14 @@ var FileChip = ({
7140
7544
  };
7141
7545
 
7142
7546
  // src/components/StepList.tsx
7143
- var import_react18 = require("react");
7547
+ var import_react20 = require("react");
7144
7548
 
7145
7549
  // src/components/SubagentTree.tsx
7146
- var import_react17 = require("react");
7147
- var import_jsx_runtime14 = require("react/jsx-runtime");
7550
+ var import_react19 = require("react");
7551
+ var import_jsx_runtime15 = require("react/jsx-runtime");
7148
7552
  var useElapsed = (startedAt, running) => {
7149
- const [now, setNow] = (0, import_react17.useState)(void 0);
7150
- (0, import_react17.useEffect)(() => {
7553
+ const [now, setNow] = (0, import_react19.useState)(void 0);
7554
+ (0, import_react19.useEffect)(() => {
7151
7555
  if (!running || startedAt === void 0) return;
7152
7556
  setNow(Date.now());
7153
7557
  const timer = setInterval(() => setNow(Date.now()), 1e3);
@@ -7175,19 +7579,19 @@ var SubagentRow = ({
7175
7579
  sub.toolCalls > 0 ? L.toolCalls(sub.toolCalls) : "",
7176
7580
  time !== void 0 ? formatDuration(time) : ""
7177
7581
  ].filter(Boolean);
7178
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
7582
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
7179
7583
  "li",
7180
7584
  {
7181
7585
  className: `awr-subagent awr-subagent--${sub.status}${sub.dynamic ? " awr-subagent--dynamic" : ""}`,
7182
7586
  "data-depth": sub.depth,
7183
7587
  children: [
7184
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-subagent__head", children: [
7185
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StopIcon, { size: 13 }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AlertIcon, { size: 13 }) }),
7186
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
7187
- sub.dynamic && role && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
7188
- sub.profile && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-subagent__profile", children: sub.profile }),
7189
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
7190
- running && onStop && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
7588
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-subagent__head", children: [
7589
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__icon", children: running ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SpinnerIcon, { size: 13 }) : sub.status === "done" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BotIcon, { size: 13 }) : sub.status === "stopped" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StopIcon, { size: 13 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AlertIcon, { size: 13 }) }),
7590
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__name", title: sub.role, children: role || (sub.dynamic ? L.subagentHelper : sub.name) }),
7591
+ sub.dynamic && role && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__profile", children: L.subagentHelper }),
7592
+ sub.profile && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__profile", children: sub.profile }),
7593
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__task", title: sub.task, children: previewValue(sub.task, 90) }),
7594
+ running && onStop && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7191
7595
  "button",
7192
7596
  {
7193
7597
  type: "button",
@@ -7195,16 +7599,16 @@ var SubagentRow = ({
7195
7599
  "aria-label": L.stopSubagent,
7196
7600
  title: L.stopSubagent,
7197
7601
  onClick: () => onStop(sub.id),
7198
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StopIcon, { size: 12 })
7602
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StopIcon, { size: 12 })
7199
7603
  }
7200
7604
  )
7201
7605
  ] }),
7202
- showUsage && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "awr-subagent__meta", children: [
7203
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
7204
- meta.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "awr-subagent__metaitem", children: part }, i))
7606
+ showUsage && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-subagent__meta", children: [
7607
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__status", children: L.subagentStatus[sub.status] }),
7608
+ meta.map((part, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-subagent__metaitem", children: part }, i))
7205
7609
  ] }),
7206
- showTools && sub.tools && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
7207
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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)}` : ""}` }),
7610
+ showTools && sub.tools && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "awr-subagent__tools", children: sub.tools.length > 0 ? L.subagentTools(sub.tools.join(", ")) : L.subagentNoTools }),
7611
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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)}` : ""}` }),
7208
7612
  children
7209
7613
  ]
7210
7614
  }
@@ -7220,12 +7624,12 @@ var SubagentTree = ({
7220
7624
  className
7221
7625
  }) => {
7222
7626
  if (subagents.length === 0) return null;
7223
- const branch = (nodes, nested) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
7627
+ const branch = (nodes, nested) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7224
7628
  "ul",
7225
7629
  {
7226
7630
  className: ["awr-subagents", nested ? "awr-subagents--nested" : className].filter(Boolean).join(" "),
7227
7631
  children: nodes.map((node) => {
7228
- const row = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
7632
+ const row = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7229
7633
  SubagentRow,
7230
7634
  {
7231
7635
  sub: node,
@@ -7237,7 +7641,7 @@ var SubagentTree = ({
7237
7641
  },
7238
7642
  node.id
7239
7643
  );
7240
- return renderSubagent ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react17.Fragment, { children: renderSubagent(node, row) }, node.id) : row;
7644
+ return renderSubagent ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react19.Fragment, { children: renderSubagent(node, row) }, node.id) : row;
7241
7645
  })
7242
7646
  }
7243
7647
  );
@@ -7245,7 +7649,7 @@ var SubagentTree = ({
7245
7649
  };
7246
7650
 
7247
7651
  // src/components/StepList.tsx
7248
- var import_jsx_runtime15 = require("react/jsx-runtime");
7652
+ var import_jsx_runtime16 = require("react/jsx-runtime");
7249
7653
  var WEB_SEARCH = "web_search";
7250
7654
  var ToolCallRow = ({
7251
7655
  call,
@@ -7263,37 +7667,47 @@ var ToolCallRow = ({
7263
7667
  call.outputTokens ? `\u2248${formatTokens(call.outputTokens)} out` : "",
7264
7668
  call.durationMs !== void 0 ? formatDuration(call.durationMs) : ""
7265
7669
  ].filter(Boolean).join(" \xB7 ");
7266
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
7670
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
7267
7671
  "li",
7268
7672
  {
7269
7673
  className: `awr-tool awr-tool--${state}${showTiers && call.attempt !== void 0 ? " awr-tool--earlier" : ""}`,
7270
7674
  children: [
7271
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-tool__row", children: [
7272
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ToolIcon, { size: 13, className: "awr-tool__icon" }),
7273
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { className: "awr-tool__name", children: call.name }),
7274
- previewValue(call.input) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-tool__args", children: previewValue(call.input) }),
7275
- call.status === "calling" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
7276
- call.status === "done" && call.ok === false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-tool__badge", children: L.failed }),
7277
- showTiers && call.replayed && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
7278
- showTiers && call.attempt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
7279
- call.app && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-tool__tag awr-tool__tag--app", "data-app": call.app, children: [
7280
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AppIcon, { size: 10 }),
7675
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-tool__row", children: [
7676
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolIcon, { size: 13, className: "awr-tool__icon" }),
7677
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { className: "awr-tool__name", children: call.name }),
7678
+ previewValue(call.input) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__args", children: previewValue(call.input) }),
7679
+ call.status === "calling" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { size: 12, className: "awr-tool__spin" }),
7680
+ call.status === "done" && call.ok === false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__badge", children: L.failed }),
7681
+ showTiers && call.replayed && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__tag", title: L.replayedTitle, children: L.replayed }),
7682
+ showTiers && call.attempt !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__tag", children: L.attemptTag(call.attempt) }),
7683
+ call.app && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "awr-tool__tag awr-tool__tag--app", "data-app": call.app, children: [
7684
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AppIcon, { size: 10 }),
7281
7685
  " ",
7282
7686
  L.appTag
7283
7687
  ] }),
7284
- showUsage && cost && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
7688
+ showUsage && cost && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__cost", title: L.toolCostTitle, children: cost })
7285
7689
  ] }),
7286
- images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("a", { href: src, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("img", { className: "awr-thumb", src, alt: `${call.name} result ${i + 1}` }) }, i)) }),
7287
- search && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-search", children: [
7288
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "awr-search__query", children: [
7289
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(GlobeIcon, { size: 12 }),
7690
+ images.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-tool__images", children: images.map((src, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7691
+ ImageThumb,
7692
+ {
7693
+ src,
7694
+ name: `${call.name}-${i + 1}${imageExtensionOf(src)}`,
7695
+ alt: `${call.name} result ${i + 1}`,
7696
+ imgClassName: "awr-thumb",
7697
+ labels
7698
+ },
7699
+ i
7700
+ )) }),
7701
+ search && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-search", children: [
7702
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "awr-search__query", children: [
7703
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GlobeIcon, { size: 12 }),
7290
7704
  " ",
7291
7705
  L.searchQuery,
7292
7706
  " ",
7293
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("q", { children: search.query })
7707
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("q", { children: search.query })
7294
7708
  ] }),
7295
- search.results.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: "awr-search__result", children: [
7296
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7709
+ search.results.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ol", { className: "awr-search__results", children: search.results.map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: "awr-search__result", children: [
7710
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7297
7711
  "a",
7298
7712
  {
7299
7713
  className: "awr-search__title",
@@ -7304,13 +7718,13 @@ var ToolCallRow = ({
7304
7718
  }
7305
7719
  ),
7306
7720
  " ",
7307
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-search__host", children: [
7721
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "awr-search__host", children: [
7308
7722
  r.host,
7309
7723
  r.date ? ` \xB7 ${r.date}` : ""
7310
7724
  ] }),
7311
- r.snippet && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-search__snippet", children: r.snippet })
7312
- ] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-search__note", children: L.searchNoResults }),
7313
- (search.filtered > 0 || search.truncated) && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-search__note", children: [
7725
+ r.snippet && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-search__snippet", children: r.snippet })
7726
+ ] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-search__note", children: L.searchNoResults }),
7727
+ (search.filtered > 0 || search.truncated) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-search__note", children: [
7314
7728
  search.filtered > 0 ? L.searchFiltered(search.filtered) : "",
7315
7729
  search.truncated ? L.searchTruncated : ""
7316
7730
  ].filter(Boolean).join(" \xB7 ") })
@@ -7324,11 +7738,11 @@ var UserNoteRow = ({
7324
7738
  labels
7325
7739
  }) => {
7326
7740
  const L = useLabels(labels);
7327
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: `awr-note awr-note--${note.at}`, children: [
7328
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SendIcon, { size: 12, className: "awr-note__icon" }),
7329
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
7330
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("q", { className: "awr-note__text", children: note.text }),
7331
- note.origin === "another-tab" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-note__origin", children: L.fromAnotherTab })
7741
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: `awr-note awr-note--${note.at}`, children: [
7742
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SendIcon, { size: 12, className: "awr-note__icon" }),
7743
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-note__where", children: L.noteAt[note.at] }),
7744
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("q", { className: "awr-note__text", children: note.text }),
7745
+ note.origin === "another-tab" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-note__origin", children: L.fromAnotherTab })
7332
7746
  ] });
7333
7747
  };
7334
7748
  var decisionNote = (d, L) => {
@@ -7359,18 +7773,14 @@ var StepItem = ({
7359
7773
  renderToolCall,
7360
7774
  renderSubagent,
7361
7775
  L
7362
- }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
7363
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-step__head", children: [
7364
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AlertIcon, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CheckIcon, { size: 14 }) }),
7365
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "awr-step__index", children: [
7366
- step.index,
7367
- "/",
7368
- step.total
7369
- ] }),
7370
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-step__desc", children: step.step.description })
7776
+ }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: `awr-step awr-step--${step.blocked ? "blocked" : step.status}`, children: [
7777
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-step__head", children: [
7778
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-step__marker", children: step.status === "running" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { size: 14 }) : step.blocked ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlertIcon, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckIcon, { size: 14 }) }),
7779
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-step__index", children: `${step.index}/${step.total}` }),
7780
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-step__desc", children: step.step.description })
7371
7781
  ] }),
7372
- showTiers && step.tier && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-step__meta", children: [
7373
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7782
+ showTiers && step.tier && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-step__meta", children: [
7783
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7374
7784
  "span",
7375
7785
  {
7376
7786
  className: `awr-step__tier awr-step__tier--${step.tier}`,
@@ -7378,29 +7788,29 @@ var StepItem = ({
7378
7788
  children: L.tierNames[step.tier]
7379
7789
  }
7380
7790
  ),
7381
- step.model && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-step__model", children: step.model })
7791
+ step.model && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-step__model", children: step.model })
7382
7792
  ] }),
7383
- showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "awr-step__escalated", children: [
7384
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "awr-step__escalated-line", children: [
7385
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ArrowUpIcon, { size: 12 }),
7386
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
7793
+ showTiers && step.escalations?.map((e, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-step__escalated", children: [
7794
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "awr-step__escalated-line", children: [
7795
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArrowUpIcon, { size: 12 }),
7796
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: L.escalated(L.tierNames[e.from], L.tierNames[e.to], L.escalationReasons[e.reason]) })
7387
7797
  ] }),
7388
- e.text?.trim() && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { className: "awr-step__attempt", children: [
7389
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("summary", { children: L.escalatedAttemptText }),
7390
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-step__text", children: e.text.trim() })
7798
+ e.text?.trim() && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "awr-step__attempt", children: [
7799
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("summary", { children: L.escalatedAttemptText }),
7800
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-step__text", children: e.text.trim() })
7391
7801
  ] })
7392
7802
  ] }, i)),
7393
- showThoughts && step.reasoning.trim() && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
7394
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("summary", { children: [
7395
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(BrainIcon, { size: 13 }),
7803
+ showThoughts && step.reasoning.trim() && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "awr-thought", open: step.status === "running" && !step.text, children: [
7804
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("summary", { children: [
7805
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BrainIcon, { size: 13 }),
7396
7806
  " ",
7397
7807
  L.stepThoughts
7398
7808
  ] }),
7399
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-thought__text", children: step.reasoning.trim() })
7809
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-thought__text", children: step.reasoning.trim() })
7400
7810
  ] }),
7401
- step.text.trim() && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-step__text", children: step.text.trim() }),
7402
- showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
7403
- const row = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7811
+ step.text.trim() && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-step__text", children: step.text.trim() }),
7812
+ showToolCalls && step.toolCalls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-step__tools", children: step.toolCalls.map((call, i) => {
7813
+ const row = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7404
7814
  ToolCallRow,
7405
7815
  {
7406
7816
  call,
@@ -7410,15 +7820,15 @@ var StepItem = ({
7410
7820
  },
7411
7821
  i
7412
7822
  );
7413
- return renderToolCall ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react18.Fragment, { children: renderToolCall(call, row) }, i) : row;
7823
+ return renderToolCall ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react20.Fragment, { children: renderToolCall(call, row) }, i) : row;
7414
7824
  }) }),
7415
- approvals.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
7416
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
7417
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("code", { className: "awr-tool__name", children: a.name }),
7418
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
7419
- a.subagent && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "awr-tool__tag", children: L.subagentHelper })
7825
+ approvals.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-step__tools", children: approvals.map((a) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: `awr-tool awr-tool__row awr-tool--approval-${a.status}`, children: [
7826
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ShieldIcon, { size: 13, className: "awr-tool__icon" }),
7827
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { className: "awr-tool__name", children: a.name }),
7828
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__args", children: decisionLabel(a, L) }),
7829
+ a.subagent && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-tool__tag", children: L.subagentHelper })
7420
7830
  ] }, a.id)) }),
7421
- showSubagents && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7831
+ showSubagents && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7422
7832
  SubagentTree,
7423
7833
  {
7424
7834
  subagents,
@@ -7427,14 +7837,14 @@ var StepItem = ({
7427
7837
  renderSubagent
7428
7838
  }
7429
7839
  ),
7430
- notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(UserNoteRow, { note: n }, n.id)) }),
7431
- step.blocked && step.summary && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "awr-step__blocked", children: step.summary }),
7432
- showReplanFailed && step.replanFailed && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("p", { className: "awr-step__warn", title: step.replanFailed, children: [
7433
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AlertIcon, { size: 12 }),
7840
+ notes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-notes", children: notes.map((n) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UserNoteRow, { note: n }, n.id)) }),
7841
+ step.blocked && step.summary && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-step__blocked", children: step.summary }),
7842
+ showReplanFailed && step.replanFailed && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "awr-step__warn", title: step.replanFailed, children: [
7843
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlertIcon, { size: 12 }),
7434
7844
  " ",
7435
7845
  L.replanFailed
7436
7846
  ] }),
7437
- showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7847
+ showDecisions && step.decisions?.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7438
7848
  "p",
7439
7849
  {
7440
7850
  className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
@@ -7469,8 +7879,8 @@ var StepList = ({
7469
7879
  const known = new Set(steps.map((s) => s.id));
7470
7880
  const atEnd = showNotes ? notes.filter((n) => !n.stepId || !known.has(n.stepId)) : [];
7471
7881
  const loose = showSubagents ? subagents.filter((s) => !s.stepId || !known.has(s.stepId)) : [];
7472
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
7473
- steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7882
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("ol", { className: ["awr-steps", className].filter(Boolean).join(" "), children: [
7883
+ steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7474
7884
  StepItem,
7475
7885
  {
7476
7886
  step,
@@ -7492,7 +7902,7 @@ var StepList = ({
7492
7902
  },
7493
7903
  step.id
7494
7904
  )),
7495
- loose.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7905
+ loose.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { className: "awr-step awr-step--subagents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7496
7906
  SubagentTree,
7497
7907
  {
7498
7908
  subagents: loose,
@@ -7501,12 +7911,12 @@ var StepList = ({
7501
7911
  renderSubagent
7502
7912
  }
7503
7913
  ) }),
7504
- atEnd.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(UserNoteRow, { note: n }, n.id)) }) })
7914
+ atEnd.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("li", { className: "awr-step awr-step--notes", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-notes", children: atEnd.map((n) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UserNoteRow, { note: n }, n.id)) }) })
7505
7915
  ] });
7506
7916
  };
7507
7917
 
7508
7918
  // src/components/MessageList.tsx
7509
- var import_jsx_runtime16 = require("react/jsx-runtime");
7919
+ var import_jsx_runtime17 = require("react/jsx-runtime");
7510
7920
  var usageLine = (usage, durationMs) => {
7511
7921
  const parts = [];
7512
7922
  if (usage && usage.totalTokens > 0) {
@@ -7517,8 +7927,17 @@ var usageLine = (usage, durationMs) => {
7517
7927
  if (durationMs !== void 0) parts.push(formatDuration(durationMs));
7518
7928
  return parts.join(" \xB7 ");
7519
7929
  };
7520
- var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("a", { href: a.dataUrl, target: "_blank", rel: "noreferrer", title: a.path ?? a.name, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { className: "awr-thumb awr-thumb--msg", src: a.dataUrl, alt: a.name }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
7521
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FileIcon, { size: 13 }),
7930
+ var AttachmentView = ({ attachment: a }) => a.dataUrl && a.mediaType.startsWith("image/") ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7931
+ ImageThumb,
7932
+ {
7933
+ src: a.dataUrl,
7934
+ name: a.path ?? a.name,
7935
+ alt: a.name,
7936
+ imgClassName: "awr-thumb awr-thumb--msg",
7937
+ title: a.path ?? a.name
7938
+ }
7939
+ ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "awr-chip awr-file", title: a.path ?? a.mediaType, children: [
7940
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FileIcon, { size: 13 }),
7522
7941
  " ",
7523
7942
  a.name
7524
7943
  ] });
@@ -7569,24 +7988,26 @@ var MessageList = ({
7569
7988
  renderToolCall,
7570
7989
  renderApp,
7571
7990
  showApps = true,
7991
+ imageViewer = true,
7992
+ renderImageViewer,
7572
7993
  labels,
7573
7994
  className
7574
7995
  }) => {
7575
7996
  const L = useLabels(labels);
7576
7997
  if (messages.length === 0) {
7577
- return empty ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-messages__empty", children: empty }) : null;
7998
+ return empty ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-messages__empty", children: empty }) : null;
7578
7999
  }
7579
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
8000
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: ["awr-messages", className].filter(Boolean).join(" "), children: messages.map((m) => {
7580
8001
  const steps = m.steps ?? [];
7581
8002
  const hasActivity = showActivity && (steps.length > 0 || (m.subagents?.length ?? 0) > 0 || m.pending && !!liveExtra);
7582
8003
  const usage = showUsage ? usageLine(m.usage, m.durationMs) : "";
7583
- const node = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
8004
+ const node = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7584
8005
  "div",
7585
8006
  {
7586
8007
  className: `awr-msg awr-msg--${m.role}${m.error ? " awr-msg--error" : ""}${m.pending ? " is-pending" : ""}`,
7587
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-msg__col", children: [
7588
- m.role === "assistant" && hasActivity && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
7589
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("summary", { className: "awr-activity__summary", children: activitySummary(
8008
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-msg__col", children: [
8009
+ m.role === "assistant" && hasActivity && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("details", { className: "awr-activity", open: m.pending || activityOpen, children: [
8010
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("summary", { className: "awr-activity__summary", children: activitySummary(
7590
8011
  m,
7591
8012
  showToolCalls,
7592
8013
  showLearned,
@@ -7596,7 +8017,7 @@ var MessageList = ({
7596
8017
  showApps && Boolean(renderApp)
7597
8018
  ) }),
7598
8019
  m.pending && liveExtra,
7599
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
8020
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7600
8021
  StepList,
7601
8022
  {
7602
8023
  steps,
@@ -7618,45 +8039,45 @@ var MessageList = ({
7618
8039
  labels
7619
8040
  }
7620
8041
  ),
7621
- showLearned && m.fetches?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
8042
+ showLearned && m.fetches?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "awr-fetches", children: m.fetches.map((f, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
7622
8043
  "li",
7623
8044
  {
7624
8045
  className: `awr-fetch${f.allowed ? "" : " awr-fetch--refused"}`,
7625
8046
  children: [
7626
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GlobeIcon, { size: 12 }),
8047
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GlobeIcon, { size: 12 }),
7627
8048
  " ",
7628
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("code", { children: f.url }),
8049
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("code", { children: f.url }),
7629
8050
  " ",
7630
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
8051
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-fetch__result", children: f.allowed ? f.status ?? "ok" : L.fetchRefused(f.reason ?? "") })
7631
8052
  ]
7632
8053
  },
7633
8054
  i
7634
8055
  )) }) : null,
7635
- showLearned && m.learned?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "awr-learned", children: [
7636
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BookIcon, { size: 12 }),
8056
+ showLearned && m.learned?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "awr-learned", children: [
8057
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BookIcon, { size: 12 }),
7637
8058
  " ",
7638
8059
  L.learnedNow(m.learned.join(", "))
7639
8060
  ] }) : null,
7640
- showThoughts && m.reasoning?.trim() && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("details", { className: "awr-thought", children: [
7641
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("summary", { children: [
7642
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BrainIcon, { size: 13 }),
8061
+ showThoughts && m.reasoning?.trim() && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("details", { className: "awr-thought", children: [
8062
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("summary", { children: [
8063
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BrainIcon, { size: 13 }),
7643
8064
  " ",
7644
8065
  L.answerThoughts
7645
8066
  ] }),
7646
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "awr-thought__text", children: m.reasoning.trim() })
8067
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "awr-thought__text", children: m.reasoning.trim() })
7647
8068
  ] })
7648
8069
  ] }),
7649
- showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-msg__apps", children: m.apps.map((app) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-msg__app", children: renderApp(app, m) }, app.id)) }) : null,
7650
- showMedia && m.transcripts?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
7651
- (m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "awr-msg__bubble", children: [
8070
+ showApps && renderApp && m.role === "assistant" && m.apps?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__apps", children: m.apps.map((app) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__app", children: renderApp(app, m) }, app.id)) }) : null,
8071
+ showMedia && m.transcripts?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__transcripts", children: m.transcripts.map((t, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TranscriptBlock, { transcript: t, labels }, i)) }) : null,
8072
+ (m.content || m.pending || !m.attachments?.length) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-msg__bubble", children: [
7652
8073
  m.content ? renderContent ? renderContent(m) : m.content : null,
7653
- m.pending && !m.content && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
8074
+ m.pending && !m.content && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SpinnerIcon, { size: 14, className: "awr-msg__pending" })
7654
8075
  ] }),
7655
- showMedia && m.media?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
7656
- const built = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GeneratedMedia, { media: item, files, labels }, i);
7657
- return renderMedia ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
8076
+ showMedia && m.media?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__media", children: m.media.map((item, i) => {
8077
+ const built = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GeneratedMedia, { media: item, files, labels }, i);
8078
+ return renderMedia ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-msg__mediaitem", children: renderMedia(item, m, built) }, i) : built;
7658
8079
  }) }) : null,
7659
- showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
8080
+ showFileChips && m.role === "assistant" && m.writtenFiles?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7660
8081
  FileChips,
7661
8082
  {
7662
8083
  written: m.writtenFiles,
@@ -7668,34 +8089,34 @@ var MessageList = ({
7668
8089
  labels
7669
8090
  }
7670
8091
  ) : null,
7671
- m.attachments?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-msg__attachments", "aria-label": L.attachments, children: m.attachments.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AttachmentView, { attachment: a }) }, i)) }) : null,
7672
- m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
8092
+ m.attachments?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__attachments", "aria-label": L.attachments, children: m.attachments.map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-msg__attachment", children: renderAttachment ? renderAttachment(a, m) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AttachmentView, { attachment: a }) }, i)) }) : null,
8093
+ m.role === "assistant" && usage && !m.pending && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-msg__usage", title: L.usageTitle, children: usage })
7673
8094
  ] })
7674
8095
  },
7675
8096
  m.id
7676
8097
  );
7677
- return renderMessage ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: renderMessage(m, node) }, m.id) : node;
7678
- }) });
8098
+ return renderMessage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: renderMessage(m, node) }, m.id) : node;
8099
+ }) }) });
7679
8100
  };
7680
8101
 
7681
8102
  // src/components/ModelLoadBar.tsx
7682
- var import_jsx_runtime17 = require("react/jsx-runtime");
8103
+ var import_jsx_runtime18 = require("react/jsx-runtime");
7683
8104
  var ModelLoadBar = ({ load, className }) => {
7684
8105
  const pct = Math.round(Math.max(0, Math.min(1, load.progress)) * 100);
7685
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
7686
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "awr-modelload__head", children: [
7687
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
7688
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "awr-modelload__pct", children: [
8106
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: ["awr-modelload", className].filter(Boolean).join(" "), children: [
8107
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-modelload__head", children: [
8108
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "awr-modelload__text", children: load.text || "Loading model\u2026" }),
8109
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "awr-modelload__pct", children: [
7689
8110
  pct,
7690
8111
  "%"
7691
8112
  ] })
7692
8113
  ] }),
7693
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
8114
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-modelload__track", role: "progressbar", "aria-valuenow": pct, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "awr-modelload__fill", style: { width: `${pct}%` } }) })
7694
8115
  ] });
7695
8116
  };
7696
8117
 
7697
8118
  // src/components/ToolApprovalPrompt.tsx
7698
- var import_jsx_runtime18 = require("react/jsx-runtime");
8119
+ var import_jsx_runtime19 = require("react/jsx-runtime");
7699
8120
  var SkillConsentCard = ({
7700
8121
  approval: a,
7701
8122
  skill,
@@ -7705,7 +8126,7 @@ var SkillConsentCard = ({
7705
8126
  showPreview,
7706
8127
  onApprove,
7707
8128
  onDeny
7708
- }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
8129
+ }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7709
8130
  "div",
7710
8131
  {
7711
8132
  className: `awr-approval awr-approval--skill${helper ? " awr-approval--helper" : ""}`,
@@ -7713,28 +8134,28 @@ var SkillConsentCard = ({
7713
8134
  "data-skill-server": skill.server,
7714
8135
  "data-subagent": helper?.id,
7715
8136
  children: [
7716
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-approval__head", children: [
7717
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
7718
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: L.skillConsentLead(skill.server, skill.skill) })
8137
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-approval__head", children: [
8138
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
8139
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: L.skillConsentLead(skill.server, skill.skill) })
7719
8140
  ] }),
7720
- skill.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-approval__quote", children: skill.description }),
7721
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("p", { className: "awr-approval__skillmeta", children: [
7722
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { className: "awr-tool__name", children: skill.name }),
7723
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
8141
+ skill.description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__quote", children: skill.description }),
8142
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("p", { className: "awr-approval__skillmeta", children: [
8143
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("code", { className: "awr-tool__name", children: skill.name }),
8144
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: L.skillConsentSize(skill.size, skill.fileCount) })
7724
8145
  ] }),
7725
- skill.byUri && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
7726
- skill.nestedIn && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
7727
- skill.dynamic && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
7728
- skill.dynamic && skill.noFileListing && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
7729
- showPreview && skill.body !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("details", { className: "awr-approval__preview", children: [
7730
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("summary", { children: L.skillConsentPreview }),
7731
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
7732
- skill.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
8146
+ skill.byUri && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.skillConsentByUri }),
8147
+ skill.nestedIn && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from awr-approval__nested", children: L.skillConsentNested(skill.nestedIn) }),
8148
+ skill.dynamic && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from awr-approval__dynamic", children: L.skillConsentDynamic }),
8149
+ skill.dynamic && skill.noFileListing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNoFileListing }),
8150
+ showPreview && skill.body !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("details", { className: "awr-approval__preview", children: [
8151
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("summary", { children: L.skillConsentPreview }),
8152
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { className: "awr-approval__quote awr-approval__body", children: skill.body }),
8153
+ skill.files.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.skillConsentFiles(skill.files.join(", "), skill.fileCount - skill.files.length) })
7733
8154
  ] }),
7734
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
7735
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-approval__actions", children: [
7736
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
7737
- allowRemember && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8155
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.skillConsentNote(skill.server, skill.consent) }),
8156
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-approval__actions", children: [
8157
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", className: "awr-btn awr-btn--primary", onClick: () => onApprove(a.id), children: L.skillConsentAllow }),
8158
+ allowRemember && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7738
8159
  "button",
7739
8160
  {
7740
8161
  type: "button",
@@ -7743,7 +8164,7 @@ var SkillConsentCard = ({
7743
8164
  children: L.skillConsentAlways
7744
8165
  }
7745
8166
  ),
7746
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8167
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7747
8168
  "button",
7748
8169
  {
7749
8170
  type: "button",
@@ -7769,9 +8190,9 @@ var ToolApprovalPrompt = ({
7769
8190
  }) => {
7770
8191
  const L = useLabels(labels);
7771
8192
  if (approvals.length === 0) return null;
7772
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
8193
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: ["awr-approvals", className].filter(Boolean).join(" "), role: "alert", children: approvals.map((a) => {
7773
8194
  if (a.skill) {
7774
- const card2 = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8195
+ const card2 = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7775
8196
  SkillConsentCard,
7776
8197
  {
7777
8198
  approval: a,
@@ -7785,33 +8206,33 @@ var ToolApprovalPrompt = ({
7785
8206
  },
7786
8207
  a.id
7787
8208
  );
7788
- return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: renderApproval(a, card2) }, a.id) : card2;
8209
+ return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: renderApproval(a, card2) }, a.id) : card2;
7789
8210
  }
7790
8211
  const helper = showHelper ? a.subagent : void 0;
7791
8212
  const app = a.app;
7792
- const card = /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
8213
+ const card = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7793
8214
  "div",
7794
8215
  {
7795
8216
  className: `awr-approval${helper ? " awr-approval--helper" : ""}${app ? " awr-approval--app" : ""}`,
7796
8217
  "data-subagent": helper?.id,
7797
8218
  "data-app-server": app?.server,
7798
8219
  children: [
7799
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-approval__head", children: [
7800
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
7801
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
8220
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-approval__head", children: [
8221
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ShieldIcon, { size: 14, className: "awr-approval__icon" }),
8222
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
7802
8223
  app ? L.approvalLeadApp(app.server) : helper ? L.approvalLeadHelper(
7803
8224
  previewValue(helper.role ?? "", 60) || void 0,
7804
8225
  helper.depth
7805
8226
  ) : L.approvalLead,
7806
8227
  " ",
7807
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
8228
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("code", { className: "awr-tool__name", children: app ? app.tool : a.name }),
7808
8229
  a.readOnly && !app ? ` (${L.readOnlyTool})` : ""
7809
8230
  ] })
7810
8231
  ] }),
7811
- previewValue(a.input, 300) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
7812
- app && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
7813
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "awr-approval__actions", children: [
7814
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8232
+ previewValue(a.input, 300) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("pre", { className: "awr-approval__input", children: previewValue(a.input, 300) }),
8233
+ app && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "awr-approval__from", children: L.approvalFromApp(app.server, a.readOnly) }),
8234
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "awr-approval__actions", children: [
8235
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7815
8236
  "button",
7816
8237
  {
7817
8238
  type: "button",
@@ -7820,7 +8241,7 @@ var ToolApprovalPrompt = ({
7820
8241
  children: L.approve
7821
8242
  }
7822
8243
  ),
7823
- allowRemember && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8244
+ allowRemember && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7824
8245
  "button",
7825
8246
  {
7826
8247
  type: "button",
@@ -7829,7 +8250,7 @@ var ToolApprovalPrompt = ({
7829
8250
  children: L.alwaysAllow
7830
8251
  }
7831
8252
  ),
7832
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8253
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7833
8254
  "button",
7834
8255
  {
7835
8256
  type: "button",
@@ -7843,12 +8264,12 @@ var ToolApprovalPrompt = ({
7843
8264
  },
7844
8265
  a.id
7845
8266
  );
7846
- return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: renderApproval(a, card) }, a.id) : card;
8267
+ return renderApproval ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: renderApproval(a, card) }, a.id) : card;
7847
8268
  }) });
7848
8269
  };
7849
8270
 
7850
8271
  // src/components/UsageBadge.tsx
7851
- var import_jsx_runtime19 = require("react/jsx-runtime");
8272
+ var import_jsx_runtime20 = require("react/jsx-runtime");
7852
8273
  var UsageBadge = ({
7853
8274
  usage,
7854
8275
  compact = false,
@@ -7860,35 +8281,40 @@ var UsageBadge = ({
7860
8281
  const media = showCalls ? usage.mediaCalls ?? 0 : 0;
7861
8282
  const decisions = showCalls ? usage.decisionCalls ?? 0 : 0;
7862
8283
  if (usage.totalTokens === 0 && media === 0 && decisions === 0) return null;
8284
+ const mediaText = media ? L.usageMedia(media, {
8285
+ imagesGenerated: usage.imagesGenerated ?? 0,
8286
+ speechCharacters: usage.speechCharacters ?? 0,
8287
+ transcriptionSeconds: usage.transcriptionSeconds ?? 0
8288
+ }) : "";
7863
8289
  const reasoning = usage.reasoningTokens ?? 0;
7864
8290
  const cached = usage.cachedInputTokens ?? 0;
7865
8291
  const title = [
7866
8292
  `${usage.inputTokens} in + ${usage.outputTokens} out = ${usage.totalTokens} tokens`,
7867
8293
  reasoning ? `${reasoning} thinking` : "",
7868
8294
  cached ? `${cached} input tokens from the prompt cache` : "",
7869
- media ? L.usageMedia(media) : "",
8295
+ mediaText,
7870
8296
  decisions ? L.usageDecisions(decisions) : ""
7871
8297
  ].filter(Boolean).join(" \xB7 ");
7872
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
8298
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: ["awr-usage", className].filter(Boolean).join(" "), title, children: [
7873
8299
  formatTokens(usage.inputTokens),
7874
8300
  "\u2191 ",
7875
8301
  formatTokens(usage.outputTokens),
7876
8302
  "\u2193",
7877
8303
  !compact && reasoning > 0 && ` \xB7 ${formatTokens(reasoning)} think`,
7878
8304
  !compact && cached > 0 && ` \xB7 ${formatTokens(cached)} cached`,
7879
- !compact && media > 0 && ` \xB7 ${L.usageMedia(media)}`,
8305
+ !compact && mediaText && ` \xB7 ${mediaText}`,
7880
8306
  !compact && decisions > 0 && ` \xB7 ${L.usageDecisions(decisions)}`
7881
8307
  ] });
7882
8308
  };
7883
8309
 
7884
8310
  // src/components/AgentChat.tsx
7885
- var import_jsx_runtime20 = require("react/jsx-runtime");
8311
+ var import_jsx_runtime21 = require("react/jsx-runtime");
7886
8312
  var usePrefersDark = () => {
7887
8313
  const query = "(prefers-color-scheme: dark)";
7888
- const [dark, setDark] = (0, import_react19.useState)(
8314
+ const [dark, setDark] = (0, import_react21.useState)(
7889
8315
  () => typeof matchMedia === "function" && matchMedia(query).matches
7890
8316
  );
7891
- (0, import_react19.useEffect)(() => {
8317
+ (0, import_react21.useEffect)(() => {
7892
8318
  if (typeof matchMedia !== "function") return;
7893
8319
  const mq = matchMedia(query);
7894
8320
  const on = () => setDark(mq.matches);
@@ -7899,7 +8325,7 @@ var usePrefersDark = () => {
7899
8325
  };
7900
8326
  var isHistoryHook = (h) => typeof h === "object" && h !== null && "select" in h && "chats" in h;
7901
8327
  var cx = (...names) => names.filter(Boolean).join(" ");
7902
- var AgentChat = (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AgentChatInner, { ...props }) });
8328
+ var AgentChat = (props) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AgentLabelsProvider, { labels: props.labels ?? NO_LABELS, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AgentChatInner, { ...props }) });
7903
8329
  var NO_LABELS = {};
7904
8330
  var AgentChatInner = ({
7905
8331
  controller,
@@ -7948,6 +8374,8 @@ var AgentChatInner = ({
7948
8374
  renderFileContent,
7949
8375
  renderApproval,
7950
8376
  slots = {},
8377
+ imageViewer = true,
8378
+ renderImageViewer,
7951
8379
  components = {},
7952
8380
  theme = "auto",
7953
8381
  classNames = {},
@@ -7974,7 +8402,7 @@ var AgentChatInner = ({
7974
8402
  }
7975
8403
  const L = useLabels();
7976
8404
  const external = isHistoryHook(history) ? history : void 0;
7977
- const [ownStore] = (0, import_react19.useState)(
8405
+ const [ownStore] = (0, import_react21.useState)(
7978
8406
  () => history instanceof ChatHistoryStore ? history : new ChatHistoryStore()
7979
8407
  );
7980
8408
  const own = useChatHistory(agent, {
@@ -7982,20 +8410,20 @@ var AgentChatInner = ({
7982
8410
  enabled: Boolean(history) && !external
7983
8411
  });
7984
8412
  const chats = history ? external ?? own : void 0;
7985
- const rootRef = (0, import_react19.useRef)(null);
7986
- const [narrow, setNarrow] = (0, import_react19.useState)(void 0);
7987
- (0, import_react19.useEffect)(() => {
8413
+ const rootRef = (0, import_react21.useRef)(null);
8414
+ const [narrow, setNarrow] = (0, import_react21.useState)(void 0);
8415
+ (0, import_react21.useEffect)(() => {
7988
8416
  const el = rootRef.current;
7989
8417
  if (!el || typeof ResizeObserver === "undefined") return setNarrow(false);
7990
- const measure = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
7991
- measure();
7992
- const ro = new ResizeObserver(measure);
8418
+ const measure2 = () => setNarrow(el.getBoundingClientRect().width < narrowWidth);
8419
+ measure2();
8420
+ const ro = new ResizeObserver(measure2);
7993
8421
  ro.observe(el);
7994
8422
  return () => ro.disconnect();
7995
8423
  }, [narrowWidth]);
7996
- const [historyChoice, setHistoryOpen] = (0, import_react19.useState)(defaultHistoryOpen);
8424
+ const [historyChoice, setHistoryOpen] = (0, import_react21.useState)(defaultHistoryOpen);
7997
8425
  const historyOpen = historyChoice ?? narrow === false;
7998
- const [filesOpen, setFilesOpen] = (0, import_react19.useState)(defaultFilesOpen);
8426
+ const [filesOpen, setFilesOpen] = (0, import_react21.useState)(defaultFilesOpen);
7999
8427
  const toggleHistory = () => {
8000
8428
  setHistoryOpen(!historyOpen);
8001
8429
  if (narrow && !historyOpen) setFilesOpen(false);
@@ -8008,19 +8436,22 @@ var AgentChatInner = ({
8008
8436
  setFilesOpen(true);
8009
8437
  if (narrow) setHistoryOpen(false);
8010
8438
  };
8011
- const bodyRef = (0, import_react19.useRef)(null);
8012
- const stickRef = (0, import_react19.useRef)(true);
8013
- (0, import_react19.useEffect)(() => {
8014
- const el = bodyRef.current;
8015
- if (el && stickRef.current) el.scrollTop = el.scrollHeight;
8016
- }, [
8017
- agent.messages,
8018
- agent.steps,
8019
- agent.finalText,
8020
- agent.modelLoad,
8021
- agent.pendingApprovals,
8022
- elicitations
8023
- ]);
8439
+ const overlayOpen = narrow === true && (Boolean(chats) && historyOpen || Boolean(files) && filesOpen);
8440
+ const closeOverlays = () => {
8441
+ setHistoryOpen(false);
8442
+ setFilesOpen(false);
8443
+ };
8444
+ (0, import_react21.useEffect)(() => {
8445
+ if (!overlayOpen) return;
8446
+ const onKey = (e) => {
8447
+ if (e.key !== "Escape" || e.defaultPrevented) return;
8448
+ setHistoryOpen(false);
8449
+ setFilesOpen(false);
8450
+ };
8451
+ document.addEventListener("keydown", onKey);
8452
+ return () => document.removeEventListener("keydown", onKey);
8453
+ }, [overlayOpen]);
8454
+ const bodyRef = (0, import_react21.useRef)(null);
8024
8455
  const appHost = useMcpAppHost({
8025
8456
  connection: mcpApps,
8026
8457
  approve: agent.approveAppToolCall,
@@ -8032,23 +8463,28 @@ var AgentChatInner = ({
8032
8463
  });
8033
8464
  const prefersDark = usePrefersDark();
8034
8465
  const appTheme = theme === "auto" ? prefersDark ? "dark" : "light" : theme;
8035
- const [panelApp, setPanelAppState] = (0, import_react19.useState)();
8466
+ const [panelApp, setPanelAppState] = (0, import_react21.useState)();
8036
8467
  const setPanelApp = (app) => {
8037
8468
  setPanelAppState(app);
8038
8469
  onAppPanel?.(app);
8039
8470
  };
8040
8471
  const appsOn = showApps && Boolean(mcpApps);
8472
+ useFollowScroll(
8473
+ bodyRef,
8474
+ agent.messages.filter((m) => m.role === "user").length,
8475
+ agent.isRunning || agent.messages.some((m) => m.pending)
8476
+ );
8041
8477
  const panelAllowed = appPanel !== false && appPanel !== null;
8042
8478
  const panelTarget = typeof appPanel === "object" && appPanel ? appPanel : void 0;
8043
8479
  const asSheet = !panelTarget && (appPanel === "sheet" || Boolean(narrow));
8044
- (0, import_react19.useEffect)(() => {
8480
+ (0, import_react21.useEffect)(() => {
8045
8481
  if (panelApp && !agent.messages.some((m) => m.apps?.some((a) => a.id === panelApp.id))) {
8046
8482
  setPanelAppState(void 0);
8047
8483
  onAppPanel?.(void 0);
8048
8484
  }
8049
8485
  }, [agent.messages, panelApp, onAppPanel]);
8050
8486
  const drawApp = (app, message) => {
8051
- const built = panelApp?.id === app.id ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8487
+ const built = panelApp?.id === app.id ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8052
8488
  McpAppLine,
8053
8489
  {
8054
8490
  app,
@@ -8056,7 +8492,7 @@ var AgentChatInner = ({
8056
8492
  action: L.appBringBack,
8057
8493
  onAction: () => setPanelApp(void 0)
8058
8494
  }
8059
- ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8495
+ ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8060
8496
  McpAppFrame,
8061
8497
  {
8062
8498
  app,
@@ -8069,7 +8505,7 @@ var AgentChatInner = ({
8069
8505
  );
8070
8506
  return renderApp ? renderApp(app, message, built) : built;
8071
8507
  };
8072
- const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8508
+ const appPanelNode = appsOn && panelApp ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8073
8509
  McpAppFrame,
8074
8510
  {
8075
8511
  app: panelApp,
@@ -8081,7 +8517,7 @@ var AgentChatInner = ({
8081
8517
  },
8082
8518
  panelApp.id
8083
8519
  ) : null;
8084
- const [compacting, setCompacting] = (0, import_react19.useState)(false);
8520
+ const [compacting, setCompacting] = (0, import_react21.useState)(false);
8085
8521
  const compact = () => {
8086
8522
  setCompacting(true);
8087
8523
  void agent.compact().finally(() => setCompacting(false));
@@ -8102,18 +8538,18 @@ var AgentChatInner = ({
8102
8538
  const showReplan = agent.replan && agent.replan.mode !== "continue";
8103
8539
  const replanFailedEarly = showReplanFailed && agent.replan?.failed === true && agent.steps.length === 0;
8104
8540
  const earlyDecisions = showDecisions ? agent.decisions ?? [] : [];
8105
- const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
8106
- agent.planThought.trim() && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("details", { className: "awr-activity__plan", children: [
8107
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("summary", { children: L.planned }),
8108
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-activity__thought", children: agent.planThought })
8541
+ const liveExtra = agent.planThought.trim() || showReplan || replanFailedEarly || earlyDecisions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
8542
+ agent.planThought.trim() && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("details", { className: "awr-activity__plan", children: [
8543
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("summary", { children: L.planned }),
8544
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-activity__thought", children: agent.planThought })
8109
8545
  ] }),
8110
- showReplan && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
8111
- replanFailedEarly && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "awr-step__warn", title: agent.replan.error, children: [
8112
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AlertIcon, { size: 12 }),
8546
+ showReplan && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-activity__replan", children: L.replanned(agent.replan.mode, agent.replan.reason) }),
8547
+ replanFailedEarly && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "awr-step__warn", title: agent.replan.error, children: [
8548
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AlertIcon, { size: 12 }),
8113
8549
  " ",
8114
8550
  L.replanFailed
8115
8551
  ] }),
8116
- earlyDecisions.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8552
+ earlyDecisions.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8117
8553
  "p",
8118
8554
  {
8119
8555
  className: `awr-step__decision${d.accepted ? "" : " awr-step__decision--fallback"}`,
@@ -8122,8 +8558,8 @@ var AgentChatInner = ({
8122
8558
  i
8123
8559
  ))
8124
8560
  ] }) : void 0;
8125
- const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cx("awr-chat__header", classNames.header), children: [
8126
- chats && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8561
+ const header = slots.header === false ? null : slots.header !== void 0 ? slots.header : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx("awr-chat__header", classNames.header), children: [
8562
+ chats && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8127
8563
  "button",
8128
8564
  {
8129
8565
  type: "button",
@@ -8132,17 +8568,17 @@ var AgentChatInner = ({
8132
8568
  title: L.showHistory,
8133
8569
  "aria-pressed": historyOpen,
8134
8570
  onClick: toggleHistory,
8135
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(HistoryIcon, { size: 16 })
8571
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(HistoryIcon, { size: 16 })
8136
8572
  }
8137
8573
  ),
8138
8574
  slots.headerStart,
8139
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "awr-chat__title", children: title }),
8140
- showStatus && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
8141
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-status__dot" }),
8142
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "awr-status__text", children: L.status[agent.status] })
8575
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-chat__title", children: title }),
8576
+ showStatus && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: `awr-status awr-status--${agent.status}`, title: L.status[agent.status], children: [
8577
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "awr-status__dot" }),
8578
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "awr-status__text", children: L.status[agent.status] })
8143
8579
  ] }),
8144
- showTotalUsage && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { title: L.totalUsage, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
8145
- files && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8580
+ showTotalUsage && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { title: L.totalUsage, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(UsageBadge, { usage: agent.totalUsage, compact: narrow !== false }) }),
8581
+ files && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8146
8582
  "button",
8147
8583
  {
8148
8584
  type: "button",
@@ -8151,12 +8587,12 @@ var AgentChatInner = ({
8151
8587
  title: L.showFiles,
8152
8588
  "aria-pressed": filesOpen,
8153
8589
  onClick: toggleFiles,
8154
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FileIcon, { size: 16 })
8590
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FileIcon, { size: 16 })
8155
8591
  }
8156
8592
  ),
8157
8593
  slots.headerEnd
8158
8594
  ] });
8159
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
8595
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
8160
8596
  "div",
8161
8597
  {
8162
8598
  ref: rootRef,
@@ -8164,8 +8600,16 @@ var AgentChatInner = ({
8164
8600
  style,
8165
8601
  "data-awr-theme": theme === "auto" ? void 0 : theme,
8166
8602
  children: [
8167
- chats && historyOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
8168
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8603
+ overlayOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8604
+ "div",
8605
+ {
8606
+ className: cx("awr-chat__scrim", classNames.scrim),
8607
+ "aria-hidden": "true",
8608
+ onClick: closeOverlays
8609
+ }
8610
+ ),
8611
+ chats && historyOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("aside", { className: cx("awr-chat__sidebar", classNames.sidebar), children: [
8612
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8169
8613
  HistoryList,
8170
8614
  {
8171
8615
  history: {
@@ -8184,7 +8628,7 @@ var AgentChatInner = ({
8184
8628
  }
8185
8629
  ),
8186
8630
  slots.sidebar,
8187
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8631
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8188
8632
  "button",
8189
8633
  {
8190
8634
  type: "button",
@@ -8195,91 +8639,82 @@ var AgentChatInner = ({
8195
8639
  }
8196
8640
  )
8197
8641
  ] }),
8198
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cx("awr-chat__main", classNames.main), children: [
8642
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx("awr-chat__main", classNames.main), children: [
8199
8643
  header,
8200
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
8201
- "div",
8202
- {
8203
- className: cx("awr-chat__body", classNames.body),
8204
- ref: bodyRef,
8205
- onScroll: (e) => {
8206
- const el = e.currentTarget;
8207
- stickRef.current = el.scrollHeight - el.scrollTop - el.clientHeight < 80;
8208
- },
8209
- children: [
8210
- slots.beforeMessages,
8211
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8212
- Messages,
8213
- {
8214
- messages: agent.messages,
8215
- empty: emptyState ?? L.emptyState,
8216
- showActivity,
8217
- showToolCalls,
8218
- showUsage,
8219
- showThoughts,
8220
- showNotes,
8221
- showLearned,
8222
- showTiers,
8223
- showReplanFailed,
8224
- showDecisions,
8225
- showSearchResults,
8226
- showSubagents,
8227
- showMedia,
8228
- showFileChips,
8229
- files,
8230
- htmlPreview,
8231
- onShowFiles: files ? showFiles : void 0,
8232
- renderFile,
8233
- renderFileContent,
8234
- renderMedia,
8235
- renderSubagent,
8236
- onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
8237
- activityOpen,
8238
- liveExtra,
8239
- renderContent,
8240
- renderMessage,
8241
- renderAttachment,
8242
- renderToolCall,
8243
- showApps: appsOn,
8244
- renderApp: appsOn ? drawApp : void 0
8245
- }
8246
- ),
8247
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8248
- Approvals,
8249
- {
8250
- approvals: agent.pendingApprovals,
8251
- onApprove: agent.approve,
8252
- onDeny: agent.deny,
8253
- showSkillPreview,
8254
- renderApproval
8255
- }
8256
- ),
8257
- appsOn && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8258
- AppRequestPrompt,
8259
- {
8260
- requests: appHost.requests,
8261
- onAnswer: appHost.answer,
8262
- renderRequest: renderAppRequest
8263
- }
8264
- ),
8265
- showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8266
- Elicitations,
8267
- {
8268
- elicitations,
8269
- onAnswer: onElicitationAnswer,
8270
- outcomes: agent.elicitations,
8271
- renderElicitation
8272
- }
8273
- ),
8274
- agent.modelLoad && loading && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ModelLoadBar, { load: agent.modelLoad }),
8275
- slots.afterMessages
8276
- ]
8277
- }
8278
- ),
8279
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cx("awr-chat__footer", classNames.footer), children: [
8644
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx("awr-chat__body", classNames.body), ref: bodyRef, children: [
8645
+ slots.beforeMessages,
8646
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8647
+ Messages,
8648
+ {
8649
+ messages: agent.messages,
8650
+ empty: emptyState ?? L.emptyState,
8651
+ showActivity,
8652
+ showToolCalls,
8653
+ showUsage,
8654
+ showThoughts,
8655
+ showNotes,
8656
+ showLearned,
8657
+ showTiers,
8658
+ showReplanFailed,
8659
+ showDecisions,
8660
+ showSearchResults,
8661
+ showSubagents,
8662
+ showMedia,
8663
+ showFileChips,
8664
+ files,
8665
+ htmlPreview,
8666
+ onShowFiles: files ? showFiles : void 0,
8667
+ renderFile,
8668
+ renderFileContent,
8669
+ renderMedia,
8670
+ renderSubagent,
8671
+ onStopSubagent: stoppableSubagents ? agent.stopSubagent : void 0,
8672
+ activityOpen,
8673
+ liveExtra,
8674
+ renderContent,
8675
+ renderMessage,
8676
+ renderAttachment,
8677
+ renderToolCall,
8678
+ showApps: appsOn,
8679
+ renderApp: appsOn ? drawApp : void 0,
8680
+ imageViewer,
8681
+ renderImageViewer
8682
+ }
8683
+ ),
8684
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8685
+ Approvals,
8686
+ {
8687
+ approvals: agent.pendingApprovals,
8688
+ onApprove: agent.approve,
8689
+ onDeny: agent.deny,
8690
+ showSkillPreview,
8691
+ renderApproval
8692
+ }
8693
+ ),
8694
+ appsOn && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8695
+ AppRequestPrompt,
8696
+ {
8697
+ requests: appHost.requests,
8698
+ onAnswer: appHost.answer,
8699
+ renderRequest: renderAppRequest
8700
+ }
8701
+ ),
8702
+ showElicitation && elicitations && onElicitationAnswer && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8703
+ Elicitations,
8704
+ {
8705
+ elicitations,
8706
+ onAnswer: onElicitationAnswer,
8707
+ outcomes: agent.elicitations,
8708
+ renderElicitation
8709
+ }
8710
+ ),
8711
+ agent.modelLoad && loading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ModelLoadBar, { load: agent.modelLoad }),
8712
+ slots.afterMessages
8713
+ ] }),
8714
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cx("awr-chat__footer", classNames.footer), children: [
8280
8715
  slots.footerStart,
8281
- tabNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text2) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "awr-tabnote__text", children: text2 }, text2)) }),
8282
- showContext !== false && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8716
+ tabNotes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-tabnote", role: "status", children: tabNotes.map((text2) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-tabnote__text", children: text2 }, text2)) }),
8717
+ showContext !== false && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8283
8718
  ContextMeter,
8284
8719
  {
8285
8720
  usage: agent.usage,
@@ -8290,11 +8725,11 @@ var AgentChatInner = ({
8290
8725
  compacting
8291
8726
  }
8292
8727
  ),
8293
- composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "awr-chat__error", children: [
8294
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AlertIcon, { size: 14 }),
8728
+ composer === false ? agent.error && agent.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "awr-chat__error", children: [
8729
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AlertIcon, { size: 14 }),
8295
8730
  " ",
8296
8731
  agent.error
8297
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8732
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8298
8733
  Composer2,
8299
8734
  {
8300
8735
  controller: agent,
@@ -8310,8 +8745,8 @@ var AgentChatInner = ({
8310
8745
  ] }),
8311
8746
  appPanelNode && (panelTarget ? (
8312
8747
  // Outside the chat: the theme tokens come with it.
8313
- (0, import_react_dom.createPortal)(
8314
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8748
+ (0, import_react_dom2.createPortal)(
8749
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8315
8750
  "div",
8316
8751
  {
8317
8752
  className: "awr-theme awr-apppanel",
@@ -8321,24 +8756,24 @@ var AgentChatInner = ({
8321
8756
  ),
8322
8757
  panelTarget
8323
8758
  )
8324
- ) : asSheet ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
8325
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
8326
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
8759
+ ) : asSheet ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
8760
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-sheet__scrim", onClick: () => setPanelApp(void 0) }),
8761
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
8327
8762
  "aside",
8328
8763
  {
8329
8764
  className: "awr-chat__appsheet",
8330
8765
  role: "dialog",
8331
8766
  "aria-label": L.appFrom(panelApp.server),
8332
8767
  children: [
8333
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "awr-sheet__grab" }),
8768
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "awr-sheet__grab" }),
8334
8769
  appPanelNode
8335
8770
  ]
8336
8771
  }
8337
8772
  )
8338
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
8339
- files && filesOpen && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("aside", { className: cx("awr-chat__files", classNames.files), children: [
8340
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Files, { files }),
8341
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8773
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("aside", { className: "awr-chat__apppanel", children: appPanelNode })),
8774
+ files && filesOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("aside", { className: cx("awr-chat__files", classNames.files), children: [
8775
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageViewerProvider, { enabled: imageViewer, render: renderImageViewer, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Files, { files }) }),
8776
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8342
8777
  "button",
8343
8778
  {
8344
8779
  type: "button",
@@ -8355,7 +8790,7 @@ var AgentChatInner = ({
8355
8790
  };
8356
8791
 
8357
8792
  // src/components/LearnedSkills.tsx
8358
- var import_jsx_runtime21 = require("react/jsx-runtime");
8793
+ var import_jsx_runtime22 = require("react/jsx-runtime");
8359
8794
  var LearnedSkills = ({
8360
8795
  controller,
8361
8796
  lessons,
@@ -8371,18 +8806,18 @@ var LearnedSkills = ({
8371
8806
  const c = controller ?? ctx;
8372
8807
  const list = lessons ?? c?.learned ?? [];
8373
8808
  const forget = onForget === false ? void 0 : onForget ?? c?.forgetSkill;
8374
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
8375
- !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("h3", { className: "awr-notebook__title", children: [
8376
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(BookIcon, { size: 14 }),
8809
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("section", { className: ["awr-notebook", className].filter(Boolean).join(" "), children: [
8810
+ !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("h3", { className: "awr-notebook__title", children: [
8811
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BookIcon, { size: 14 }),
8377
8812
  " ",
8378
8813
  L.notebookTitle,
8379
- list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "awr-notebook__count", children: list.length })
8814
+ list.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "awr-notebook__count", children: list.length })
8380
8815
  ] }),
8381
- list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("li", { className: "awr-lesson", children: [
8382
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "awr-lesson__head", children: [
8383
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("code", { className: "awr-lesson__name", children: l.name }),
8384
- l.revision > 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
8385
- forget && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8816
+ list.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "awr-notebook__empty", children: empty ?? L.notebookEmpty }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("ul", { className: "awr-notebook__list", children: list.map((l) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("li", { className: "awr-lesson", children: [
8817
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "awr-lesson__head", children: [
8818
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("code", { className: "awr-lesson__name", children: l.name }),
8819
+ l.revision > 1 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "awr-lesson__rev", children: L.notebookRevision(l.revision) }),
8820
+ forget && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
8386
8821
  "button",
8387
8822
  {
8388
8823
  type: "button",
@@ -8390,12 +8825,12 @@ var LearnedSkills = ({
8390
8825
  title: `${L.notebookForget}: ${l.name}`,
8391
8826
  "aria-label": `${L.notebookForget}: ${l.name}`,
8392
8827
  onClick: () => void forget(l.name),
8393
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(XIcon, { size: 12 })
8828
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(XIcon, { size: 12 })
8394
8829
  }
8395
8830
  )
8396
8831
  ] }),
8397
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "awr-lesson__when", children: l.description }),
8398
- showSources && l.sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { className: "awr-lesson__from", children: [
8832
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "awr-lesson__when", children: l.description }),
8833
+ showSources && l.sources.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("p", { className: "awr-lesson__from", children: [
8399
8834
  L.notebookFrom,
8400
8835
  " ",
8401
8836
  l.sources.join(", ")
@@ -8405,8 +8840,8 @@ var LearnedSkills = ({
8405
8840
  };
8406
8841
 
8407
8842
  // src/components/Composer.tsx
8408
- var import_react20 = require("react");
8409
- var import_jsx_runtime22 = require("react/jsx-runtime");
8843
+ var import_react22 = require("react");
8844
+ var import_jsx_runtime23 = require("react/jsx-runtime");
8410
8845
  var Composer = ({
8411
8846
  onSubmit,
8412
8847
  busy = false,
@@ -8415,7 +8850,7 @@ var Composer = ({
8415
8850
  placeholder = "Ask the agent to do something\u2026",
8416
8851
  className
8417
8852
  }) => {
8418
- const [text2, setText] = (0, import_react20.useState)("");
8853
+ const [text2, setText] = (0, import_react22.useState)("");
8419
8854
  const submit = () => {
8420
8855
  const value = text2.trim();
8421
8856
  if (!value || busy || disabled) return;
@@ -8428,7 +8863,7 @@ var Composer = ({
8428
8863
  submit();
8429
8864
  }
8430
8865
  };
8431
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
8866
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
8432
8867
  "form",
8433
8868
  {
8434
8869
  className: ["awr-composer", className].filter(Boolean).join(" "),
@@ -8437,7 +8872,7 @@ var Composer = ({
8437
8872
  submit();
8438
8873
  },
8439
8874
  children: [
8440
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
8875
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
8441
8876
  "textarea",
8442
8877
  {
8443
8878
  className: "awr-composer__input",
@@ -8449,23 +8884,23 @@ var Composer = ({
8449
8884
  rows: 1
8450
8885
  }
8451
8886
  ),
8452
- busy ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
8887
+ busy ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
8453
8888
  "button",
8454
8889
  {
8455
8890
  type: "button",
8456
8891
  className: "awr-composer__btn awr-composer__btn--stop",
8457
8892
  onClick: onStop,
8458
8893
  "aria-label": "Stop",
8459
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StopIcon, { size: 18 })
8894
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(StopIcon, { size: 18 })
8460
8895
  }
8461
- ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
8896
+ ) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
8462
8897
  "button",
8463
8898
  {
8464
8899
  type: "submit",
8465
8900
  className: "awr-composer__btn",
8466
8901
  disabled: disabled || !text2.trim(),
8467
8902
  "aria-label": "Send",
8468
- children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SendIcon, { size: 18 })
8903
+ children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SpinnerIcon, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SendIcon, { size: 18 })
8469
8904
  }
8470
8905
  )
8471
8906
  ]
@@ -8474,17 +8909,17 @@ var Composer = ({
8474
8909
  };
8475
8910
 
8476
8911
  // src/components/PlanView.tsx
8477
- var import_jsx_runtime23 = require("react/jsx-runtime");
8912
+ var import_jsx_runtime24 = require("react/jsx-runtime");
8478
8913
  var PlanView = ({ plan, showThought = true, className }) => {
8479
8914
  if (!plan.steps.length && !plan.thought) return null;
8480
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
8481
- showThought && plan.thought.trim() && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "awr-plan__thought", children: plan.thought }),
8482
- plan.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: "awr-plan__step", children: step.description }, step.id)) })
8915
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: ["awr-plan", className].filter(Boolean).join(" "), children: [
8916
+ showThought && plan.thought.trim() && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "awr-plan__thought", children: plan.thought }),
8917
+ plan.steps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ol", { className: "awr-plan__steps", children: plan.steps.map((step) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { className: "awr-plan__step", children: step.description }, step.id)) })
8483
8918
  ] });
8484
8919
  };
8485
8920
 
8486
8921
  // src/components/ApprovalModeSwitch.tsx
8487
- var import_jsx_runtime24 = require("react/jsx-runtime");
8922
+ var import_jsx_runtime25 = require("react/jsx-runtime");
8488
8923
  var DEFAULT_LABELS = {
8489
8924
  autopilot: "Autopilot",
8490
8925
  "ask-writes": "Ask before changes",
@@ -8504,13 +8939,13 @@ var ApprovalModeSwitch = ({
8504
8939
  labels,
8505
8940
  disabled,
8506
8941
  className
8507
- }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
8942
+ }) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
8508
8943
  "div",
8509
8944
  {
8510
8945
  className: ["awr-modeswitch", className].filter(Boolean).join(" "),
8511
8946
  role: "radiogroup",
8512
8947
  "aria-label": "Tool consent",
8513
- children: modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
8948
+ children: modes.map((m) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
8514
8949
  "button",
8515
8950
  {
8516
8951
  type: "button",
@@ -8528,8 +8963,8 @@ var ApprovalModeSwitch = ({
8528
8963
  );
8529
8964
 
8530
8965
  // src/components/ApiKeyForm.tsx
8531
- var import_react21 = require("react");
8532
- var import_jsx_runtime25 = require("react/jsx-runtime");
8966
+ var import_react23 = require("react");
8967
+ var import_jsx_runtime26 = require("react/jsx-runtime");
8533
8968
  var ApiKeyForm = ({
8534
8969
  credentials,
8535
8970
  credentialRef,
@@ -8538,10 +8973,10 @@ var ApiKeyForm = ({
8538
8973
  onChange,
8539
8974
  className
8540
8975
  }) => {
8541
- const [value, setValue] = (0, import_react21.useState)("");
8542
- const [present, setPresent] = (0, import_react21.useState)(false);
8543
- const [busy, setBusy] = (0, import_react21.useState)(false);
8544
- (0, import_react21.useEffect)(() => {
8976
+ const [value, setValue] = (0, import_react23.useState)("");
8977
+ const [present, setPresent] = (0, import_react23.useState)(false);
8978
+ const [busy, setBusy] = (0, import_react23.useState)(false);
8979
+ (0, import_react23.useEffect)(() => {
8545
8980
  let active = true;
8546
8981
  credentials.hasKey(credentialRef).then((has) => {
8547
8982
  if (active) setPresent(has);
@@ -8573,16 +9008,16 @@ var ApiKeyForm = ({
8573
9008
  setBusy(false);
8574
9009
  }
8575
9010
  };
8576
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
8577
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "awr-keyform__label", children: [
9011
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: ["awr-keyform", className].filter(Boolean).join(" "), children: [
9012
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "awr-keyform__label", children: [
8578
9013
  label,
8579
- present && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "awr-keyform__saved", children: [
8580
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CheckIcon, { size: 12 }),
9014
+ present && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "awr-keyform__saved", children: [
9015
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CheckIcon, { size: 12 }),
8581
9016
  " stored, encrypted"
8582
9017
  ] })
8583
9018
  ] }),
8584
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "awr-keyform__row", children: [
8585
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
9019
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "awr-keyform__row", children: [
9020
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8586
9021
  "input",
8587
9022
  {
8588
9023
  className: "awr-keyform__input",
@@ -8600,7 +9035,7 @@ var ApiKeyForm = ({
8600
9035
  disabled: busy
8601
9036
  }
8602
9037
  ),
8603
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
9038
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8604
9039
  "button",
8605
9040
  {
8606
9041
  type: "button",
@@ -8610,7 +9045,7 @@ var ApiKeyForm = ({
8610
9045
  children: "Save"
8611
9046
  }
8612
9047
  ),
8613
- present && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
9048
+ present && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
8614
9049
  "button",
8615
9050
  {
8616
9051
  type: "button",
@@ -8646,6 +9081,8 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
8646
9081
  ContextMeter,
8647
9082
  ElicitationPrompt,
8648
9083
  FILE_PREVIEW_CHARS,
9084
+ FOLLOW_LEAVE_PX,
9085
+ FOLLOW_REJOIN_PX,
8649
9086
  FRAME_MAX_HEIGHT,
8650
9087
  FRAME_MIN_HEIGHT,
8651
9088
  FileChip,
@@ -8653,6 +9090,9 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
8653
9090
  FilesPanel,
8654
9091
  GeneratedMedia,
8655
9092
  HTML_PREVIEW_MAX_CHARS,
9093
+ ImageThumb,
9094
+ ImageViewer,
9095
+ ImageViewerProvider,
8656
9096
  ImagesNotSupportedError,
8657
9097
  IndexedDBStore,
8658
9098
  LearnedSkills,
@@ -8744,9 +9184,12 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
8744
9184
  fileKindOf,
8745
9185
  fileNameOf,
8746
9186
  filterCommands,
9187
+ followsAfterResize,
9188
+ followsAfterScroll,
8747
9189
  formatCountdown,
8748
9190
  formatElapsed,
8749
9191
  grantedAppCsp,
9192
+ imageExtensionOf,
8750
9193
  isMcpAppSandboxMessage,
8751
9194
  isWebGPUAvailable,
8752
9195
  lessonsOf,
@@ -8788,6 +9231,7 @@ var import_agent_web8 = require("@dudko.dev/agent-web");
8788
9231
  useAgentContext,
8789
9232
  useChatHistory,
8790
9233
  useCredentials,
9234
+ useFollowScroll,
8791
9235
  useLabels,
8792
9236
  useLocalModel,
8793
9237
  useMcpAppHost,