@lukeashford/aurelius 3.5.0 → 3.6.0

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.mjs CHANGED
@@ -4157,7 +4157,7 @@ var StreamingCursor = React56.forwardRef(
4157
4157
  StreamingCursor.displayName = "StreamingCursor";
4158
4158
 
4159
4159
  // src/components/chat/ChatInterface.tsx
4160
- import React73, { useCallback as useCallback19, useEffect as useEffect15, useMemo as useMemo4, useRef as useRef13, useState as useState20 } from "react";
4160
+ import React74, { useCallback as useCallback20, useEffect as useEffect16, useMemo as useMemo5, useRef as useRef14, useState as useState21 } from "react";
4161
4161
 
4162
4162
  // src/components/chat/ChatView.tsx
4163
4163
  import React58, { useEffect as useEffect9 } from "react";
@@ -4645,6 +4645,7 @@ var ChatInput = React59.forwardRef(
4645
4645
  acceptedFileTypes,
4646
4646
  notice,
4647
4647
  onInputChange,
4648
+ autoFocus = false,
4648
4649
  className,
4649
4650
  ...rest
4650
4651
  }, ref) => {
@@ -4697,10 +4698,10 @@ var ChatInput = React59.forwardRef(
4697
4698
  textarea.style.height = `${Math.min(textarea.scrollHeight, 200)}px`;
4698
4699
  }, [onInputChange]);
4699
4700
  useEffect10(() => {
4700
- if (!disabled && !isStreaming && textareaRef.current) {
4701
+ if (autoFocus && !disabled && !isStreaming && textareaRef.current) {
4701
4702
  textareaRef.current.focus();
4702
4703
  }
4703
- }, [disabled, isStreaming]);
4704
+ }, [disabled, isStreaming, autoFocus]);
4704
4705
  const addFiles = useCallback13(
4705
4706
  (files) => {
4706
4707
  const newAttachments = Array.from(files).map((file) => ({
@@ -5926,8 +5927,346 @@ var ArtifactsPanelToggle = React69.forwardRef(({ artifactCount = 0, onExpand, cl
5926
5927
  });
5927
5928
  ArtifactsPanelToggle.displayName = "ArtifactsPanelToggle";
5928
5929
 
5930
+ // src/components/chat/HistoryPanel.tsx
5931
+ import React70, { useCallback as useCallback16, useEffect as useEffect13, useMemo as useMemo3, useRef as useRef11, useState as useState17 } from "react";
5932
+ function parseTimestamp(ts) {
5933
+ if (ts == null) {
5934
+ return null;
5935
+ }
5936
+ const d = ts instanceof Date ? ts : new Date(ts);
5937
+ return Number.isNaN(d.getTime()) ? null : d;
5938
+ }
5939
+ function startOfDay(d) {
5940
+ const x = new Date(d);
5941
+ x.setHours(0, 0, 0, 0);
5942
+ return x;
5943
+ }
5944
+ function groupConversations(conversations) {
5945
+ const today = startOfDay(/* @__PURE__ */ new Date());
5946
+ const yesterday = new Date(today);
5947
+ yesterday.setDate(yesterday.getDate() - 1);
5948
+ const todayList = [];
5949
+ const yesterdayList = [];
5950
+ const olderList = [];
5951
+ for (const c of conversations) {
5952
+ const d = parseTimestamp(c.timestamp);
5953
+ if (d && d >= today) {
5954
+ todayList.push(c);
5955
+ } else if (d && d >= yesterday) {
5956
+ yesterdayList.push(c);
5957
+ } else {
5958
+ olderList.push(c);
5959
+ }
5960
+ }
5961
+ return [
5962
+ { key: "today", label: "Today", conversations: todayList },
5963
+ { key: "yesterday", label: "Yesterday", conversations: yesterdayList },
5964
+ { key: "older", label: "Older", conversations: olderList }
5965
+ ].filter((g) => g.conversations.length > 0);
5966
+ }
5967
+ function ChevronDownIcon({ className }) {
5968
+ return /* @__PURE__ */ React70.createElement(
5969
+ "svg",
5970
+ {
5971
+ xmlns: "http://www.w3.org/2000/svg",
5972
+ viewBox: "0 0 20 20",
5973
+ fill: "currentColor",
5974
+ className,
5975
+ "aria-hidden": "true"
5976
+ },
5977
+ /* @__PURE__ */ React70.createElement(
5978
+ "path",
5979
+ {
5980
+ fillRule: "evenodd",
5981
+ d: "M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z",
5982
+ clipRule: "evenodd"
5983
+ }
5984
+ )
5985
+ );
5986
+ }
5987
+ function PencilIcon2({ className }) {
5988
+ return /* @__PURE__ */ React70.createElement(
5989
+ "svg",
5990
+ {
5991
+ xmlns: "http://www.w3.org/2000/svg",
5992
+ viewBox: "0 0 20 20",
5993
+ fill: "currentColor",
5994
+ className,
5995
+ "aria-hidden": "true"
5996
+ },
5997
+ /* @__PURE__ */ React70.createElement(
5998
+ "path",
5999
+ {
6000
+ d: "M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"
6001
+ }
6002
+ )
6003
+ );
6004
+ }
6005
+ function ProjectFilter({
6006
+ projects,
6007
+ value,
6008
+ onChange,
6009
+ className
6010
+ }) {
6011
+ const [open, setOpen] = useState17(false);
6012
+ const ref = useRef11(null);
6013
+ useEffect13(() => {
6014
+ if (!open) {
6015
+ return;
6016
+ }
6017
+ const handler = (e) => {
6018
+ if (ref.current && !ref.current.contains(e.target)) {
6019
+ setOpen(false);
6020
+ }
6021
+ };
6022
+ document.addEventListener("mousedown", handler);
6023
+ return () => document.removeEventListener("mousedown", handler);
6024
+ }, [open]);
6025
+ const label = value ?? "All projects";
6026
+ return /* @__PURE__ */ React70.createElement("div", { className: cx("relative min-w-0", className), ref }, /* @__PURE__ */ React70.createElement(
6027
+ "button",
6028
+ {
6029
+ type: "button",
6030
+ onClick: () => setOpen((o) => !o),
6031
+ "aria-haspopup": "listbox",
6032
+ "aria-expanded": open,
6033
+ className: cx(
6034
+ "w-full flex items-center justify-between gap-1 px-2 py-1.5",
6035
+ "bg-obsidian/60 hover:bg-ash/30",
6036
+ "text-silver hover:text-white",
6037
+ "border border-ash/40",
6038
+ "text-xs",
6039
+ "transition-colors duration-150 min-w-0"
6040
+ )
6041
+ },
6042
+ /* @__PURE__ */ React70.createElement("span", { className: "truncate" }, label),
6043
+ /* @__PURE__ */ React70.createElement(ChevronDownIcon, { className: "w-3 h-3 shrink-0" })
6044
+ ), open && /* @__PURE__ */ React70.createElement(
6045
+ "div",
6046
+ {
6047
+ role: "listbox",
6048
+ className: cx(
6049
+ "absolute top-full left-0 right-0 mt-1 z-20",
6050
+ "bg-charcoal border border-ash/40",
6051
+ "max-h-60 overflow-y-auto"
6052
+ )
6053
+ },
6054
+ /* @__PURE__ */ React70.createElement(
6055
+ "button",
6056
+ {
6057
+ type: "button",
6058
+ role: "option",
6059
+ "aria-selected": value === null,
6060
+ onClick: () => {
6061
+ onChange(null);
6062
+ setOpen(false);
6063
+ },
6064
+ className: cx(
6065
+ "w-full px-2 py-1.5 text-left text-xs truncate",
6066
+ "transition-colors duration-150",
6067
+ value === null ? "bg-gold/10 text-gold" : "text-silver hover:bg-ash/20 hover:text-white"
6068
+ )
6069
+ },
6070
+ "All projects"
6071
+ ),
6072
+ projects.map((p) => /* @__PURE__ */ React70.createElement(
6073
+ "button",
6074
+ {
6075
+ key: p,
6076
+ type: "button",
6077
+ role: "option",
6078
+ "aria-selected": value === p,
6079
+ onClick: () => {
6080
+ onChange(p);
6081
+ setOpen(false);
6082
+ },
6083
+ className: cx(
6084
+ "w-full px-2 py-1.5 text-left text-xs truncate",
6085
+ "transition-colors duration-150",
6086
+ value === p ? "bg-gold/10 text-gold" : "text-silver hover:bg-ash/20 hover:text-white"
6087
+ )
6088
+ },
6089
+ p
6090
+ ))
6091
+ ));
6092
+ }
6093
+ function ConversationRow({
6094
+ conversation,
6095
+ onSelect,
6096
+ onRename
6097
+ }) {
6098
+ const [isEditing, setIsEditing] = useState17(false);
6099
+ const [draft, setDraft] = useState17(conversation.title);
6100
+ const inputRef = useRef11(null);
6101
+ useEffect13(() => {
6102
+ if (isEditing && inputRef.current) {
6103
+ inputRef.current.focus();
6104
+ inputRef.current.select();
6105
+ }
6106
+ }, [isEditing]);
6107
+ const startEdit = useCallback16((e) => {
6108
+ e.stopPropagation();
6109
+ setDraft(conversation.title);
6110
+ setIsEditing(true);
6111
+ }, [conversation.title]);
6112
+ const commit = useCallback16(() => {
6113
+ const trimmed = draft.trim();
6114
+ if (trimmed && trimmed !== conversation.title) {
6115
+ onRename?.(conversation.id, trimmed);
6116
+ }
6117
+ setIsEditing(false);
6118
+ }, [draft, conversation.id, conversation.title, onRename]);
6119
+ const cancel = useCallback16(() => {
6120
+ setDraft(conversation.title);
6121
+ setIsEditing(false);
6122
+ }, [conversation.title]);
6123
+ if (isEditing) {
6124
+ return /* @__PURE__ */ React70.createElement(
6125
+ "div",
6126
+ {
6127
+ className: cx(
6128
+ "w-full px-3 py-2",
6129
+ conversation.isActive ? "bg-ash/40" : "bg-ash/20"
6130
+ )
6131
+ },
6132
+ /* @__PURE__ */ React70.createElement(
6133
+ "input",
6134
+ {
6135
+ ref: inputRef,
6136
+ type: "text",
6137
+ value: draft,
6138
+ onChange: (e) => setDraft(e.target.value),
6139
+ onBlur: commit,
6140
+ onKeyDown: (e) => {
6141
+ if (e.key === "Enter") {
6142
+ e.preventDefault();
6143
+ commit();
6144
+ } else if (e.key === "Escape") {
6145
+ e.preventDefault();
6146
+ cancel();
6147
+ }
6148
+ },
6149
+ className: cx(
6150
+ "w-full px-2 py-1 text-sm font-medium text-white",
6151
+ "bg-obsidian border border-gold/40",
6152
+ "outline-none focus:border-gold"
6153
+ ),
6154
+ "aria-label": "Conversation title"
6155
+ }
6156
+ ),
6157
+ conversation.project && /* @__PURE__ */ React70.createElement("p", { className: "text-xs text-silver/60 truncate mt-1" }, conversation.project)
6158
+ );
6159
+ }
6160
+ return /* @__PURE__ */ React70.createElement("div", { className: "relative group" }, /* @__PURE__ */ React70.createElement(
6161
+ "button",
6162
+ {
6163
+ onClick: () => onSelect?.(conversation.id),
6164
+ className: cx(
6165
+ "w-full px-3 py-2 text-left",
6166
+ "transition-colors duration-150",
6167
+ conversation.isActive ? "bg-ash/40 text-white" : "text-silver hover:bg-ash/20 hover:text-white"
6168
+ )
6169
+ },
6170
+ /* @__PURE__ */ React70.createElement(
6171
+ "p",
6172
+ {
6173
+ className: cx(
6174
+ "text-sm font-medium truncate",
6175
+ onRename ? "pr-6" : ""
6176
+ )
6177
+ },
6178
+ conversation.title
6179
+ ),
6180
+ conversation.project && /* @__PURE__ */ React70.createElement("p", { className: "text-xs text-silver/60 truncate mt-0.5" }, conversation.project)
6181
+ ), onRename && /* @__PURE__ */ React70.createElement(
6182
+ "button",
6183
+ {
6184
+ type: "button",
6185
+ onClick: startEdit,
6186
+ "aria-label": "Rename conversation",
6187
+ className: cx(
6188
+ "absolute right-2 top-2",
6189
+ "p-1 text-silver/60 hover:text-gold hover:bg-ash/40",
6190
+ "opacity-0 group-hover:opacity-100 focus:opacity-100",
6191
+ "transition-opacity duration-150"
6192
+ )
6193
+ },
6194
+ /* @__PURE__ */ React70.createElement(PencilIcon2, { className: "w-3.5 h-3.5" })
6195
+ ));
6196
+ }
6197
+ function HistoryPanel({
6198
+ conversations,
6199
+ onSelectConversation,
6200
+ onNewChat,
6201
+ onRenameConversation
6202
+ }) {
6203
+ const [projectFilter, setProjectFilter] = useState17(null);
6204
+ const projects = useMemo3(() => {
6205
+ const set = /* @__PURE__ */ new Set();
6206
+ for (const c of conversations) {
6207
+ if (c.project) {
6208
+ set.add(c.project);
6209
+ }
6210
+ }
6211
+ return Array.from(set).sort((a, b) => a.localeCompare(b));
6212
+ }, [conversations]);
6213
+ useEffect13(() => {
6214
+ if (projectFilter && !projects.includes(projectFilter)) {
6215
+ setProjectFilter(null);
6216
+ }
6217
+ }, [projects, projectFilter]);
6218
+ const filteredConversations = useMemo3(() => {
6219
+ if (!projectFilter) {
6220
+ return conversations;
6221
+ }
6222
+ return conversations.filter((c) => c.project === projectFilter);
6223
+ }, [conversations, projectFilter]);
6224
+ const groups = useMemo3(
6225
+ () => groupConversations(filteredConversations),
6226
+ [filteredConversations]
6227
+ );
6228
+ const hasFilter = projects.length > 0;
6229
+ return /* @__PURE__ */ React70.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ React70.createElement("div", { className: "px-4 py-3 border-b border-ash/40 shrink-0 flex items-center gap-2" }, /* @__PURE__ */ React70.createElement("h3", { className: "text-xs font-medium text-white shrink-0" }, "History"), (hasFilter || onNewChat) && /* @__PURE__ */ React70.createElement("div", { className: "flex items-center gap-2 flex-1 min-w-0" }, hasFilter && /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement("div", { className: "w-px h-3 bg-ash/40 shrink-0 mx-1" }), /* @__PURE__ */ React70.createElement(
6230
+ ProjectFilter,
6231
+ {
6232
+ projects,
6233
+ value: projectFilter,
6234
+ onChange: setProjectFilter,
6235
+ className: "flex-1"
6236
+ }
6237
+ )), onNewChat && /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement("div", { className: "w-px h-3 bg-ash/40 shrink-0 mx-1" }), /* @__PURE__ */ React70.createElement(
6238
+ "button",
6239
+ {
6240
+ onClick: onNewChat,
6241
+ className: cx(
6242
+ "flex items-center gap-1 px-2.5 py-1.5 shrink-0",
6243
+ "bg-gold/10 hover:bg-gold/20 text-gold",
6244
+ "border border-gold/30",
6245
+ "text-xs font-medium",
6246
+ "transition-colors duration-200"
6247
+ )
6248
+ },
6249
+ /* @__PURE__ */ React70.createElement(PlusIcon, { className: "w-4 h-4" }),
6250
+ /* @__PURE__ */ React70.createElement("span", { className: "truncate" }, "New Chat")
6251
+ )))), /* @__PURE__ */ React70.createElement("div", { className: "flex-1 overflow-y-auto py-2" }, conversations.length === 0 ? /* @__PURE__ */ React70.createElement("p", { className: "px-4 py-2 text-xs text-silver/60" }, "No conversations yet") : groups.length === 0 ? /* @__PURE__ */ React70.createElement("p", { className: "px-4 py-2 text-xs text-silver/60" }, "No conversations match this filter") : /* @__PURE__ */ React70.createElement("div", null, groups.map((group, index) => /* @__PURE__ */ React70.createElement("section", { key: group.key, className: cx(index > 0 && "mt-3") }, /* @__PURE__ */ React70.createElement("div", { className: "flex items-center gap-2 px-3 pb-2" }, /* @__PURE__ */ React70.createElement(
6252
+ "span",
6253
+ {
6254
+ className: "text-xs font-medium uppercase tracking-wider text-gold/70"
6255
+ },
6256
+ group.label
6257
+ ), /* @__PURE__ */ React70.createElement("div", { className: "flex-1 h-px bg-gold/20" })), /* @__PURE__ */ React70.createElement("div", { className: "space-y-1 px-2" }, group.conversations.map((conversation) => /* @__PURE__ */ React70.createElement(
6258
+ ConversationRow,
6259
+ {
6260
+ key: conversation.id,
6261
+ conversation,
6262
+ onSelect: onSelectConversation,
6263
+ onRename: onRenameConversation
6264
+ }
6265
+ ))))))));
6266
+ }
6267
+
5929
6268
  // src/components/chat/TodosList.tsx
5930
- import React70, { useCallback as useCallback16, useMemo as useMemo3, useState as useState17 } from "react";
6269
+ import React71, { useCallback as useCallback17, useMemo as useMemo4, useState as useState18 } from "react";
5931
6270
  import { Loader2 as Loader22, Square as Square2 } from "lucide-react";
5932
6271
  var TASK_STATUSES = {
5933
6272
  PENDING: "pending",
@@ -5939,16 +6278,16 @@ var TASK_STATUSES = {
5939
6278
  function TaskIcon({ status }) {
5940
6279
  switch (status) {
5941
6280
  case "done":
5942
- return /* @__PURE__ */ React70.createElement(CheckSquareIcon, null);
6281
+ return /* @__PURE__ */ React71.createElement(CheckSquareIcon, null);
5943
6282
  case "in_progress":
5944
- return /* @__PURE__ */ React70.createElement(SquareLoaderIcon, null);
6283
+ return /* @__PURE__ */ React71.createElement(SquareLoaderIcon, null);
5945
6284
  case "cancelled":
5946
- return /* @__PURE__ */ React70.createElement(CrossSquareIcon, { variant: "cancelled" });
6285
+ return /* @__PURE__ */ React71.createElement(CrossSquareIcon, { variant: "cancelled" });
5947
6286
  case "failed":
5948
- return /* @__PURE__ */ React70.createElement(CrossSquareIcon, { variant: "failed" });
6287
+ return /* @__PURE__ */ React71.createElement(CrossSquareIcon, { variant: "failed" });
5949
6288
  case "pending":
5950
6289
  default:
5951
- return /* @__PURE__ */ React70.createElement(EmptySquareIcon, null);
6290
+ return /* @__PURE__ */ React71.createElement(EmptySquareIcon, null);
5952
6291
  }
5953
6292
  }
5954
6293
  function sortTasks(tasks) {
@@ -5968,7 +6307,7 @@ function TaskItem({ task, depth = 0 }) {
5968
6307
  const isSubtle = task.status === "cancelled" || task.status === "failed";
5969
6308
  const showSubtasks = (task.status === "in_progress" || task.status === "done") && task.subtasks && task.subtasks.length > 0;
5970
6309
  const sortedSubtasks = showSubtasks ? sortTasks(task.subtasks) : [];
5971
- return /* @__PURE__ */ React70.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React70.createElement(
6310
+ return /* @__PURE__ */ React71.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React71.createElement(
5972
6311
  "div",
5973
6312
  {
5974
6313
  className: cx(
@@ -5976,8 +6315,8 @@ function TaskItem({ task, depth = 0 }) {
5976
6315
  depth > 0 && "pl-6"
5977
6316
  )
5978
6317
  },
5979
- /* @__PURE__ */ React70.createElement(TaskIcon, { status: task.status }),
5980
- /* @__PURE__ */ React70.createElement(
6318
+ /* @__PURE__ */ React71.createElement(TaskIcon, { status: task.status }),
6319
+ /* @__PURE__ */ React71.createElement(
5981
6320
  "span",
5982
6321
  {
5983
6322
  className: cx(
@@ -5989,10 +6328,10 @@ function TaskItem({ task, depth = 0 }) {
5989
6328
  )
5990
6329
  },
5991
6330
  task.label,
5992
- task.status === "cancelled" && /* @__PURE__ */ React70.createElement("span", { className: "text-silver/40 ml-1" }, "(cancelled)"),
5993
- task.status === "failed" && /* @__PURE__ */ React70.createElement("span", { className: "text-error/60 ml-1" }, "(failed)")
6331
+ task.status === "cancelled" && /* @__PURE__ */ React71.createElement("span", { className: "text-silver/40 ml-1" }, "(cancelled)"),
6332
+ task.status === "failed" && /* @__PURE__ */ React71.createElement("span", { className: "text-error/60 ml-1" }, "(failed)")
5994
6333
  )
5995
- ), showSubtasks && /* @__PURE__ */ React70.createElement("div", { className: "flex flex-col" }, sortedSubtasks.map((subtask) => /* @__PURE__ */ React70.createElement(TaskItem, { key: subtask.id, task: subtask, depth: depth + 1 }))));
6334
+ ), showSubtasks && /* @__PURE__ */ React71.createElement("div", { className: "flex flex-col" }, sortedSubtasks.map((subtask) => /* @__PURE__ */ React71.createElement(TaskItem, { key: subtask.id, task: subtask, depth: depth + 1 }))));
5996
6335
  }
5997
6336
  function hasInProgressTask(tasks) {
5998
6337
  return tasks.some((t) => {
@@ -6001,11 +6340,11 @@ function hasInProgressTask(tasks) {
6001
6340
  return false;
6002
6341
  });
6003
6342
  }
6004
- var TodosList = React70.forwardRef(
6343
+ var TodosList = React71.forwardRef(
6005
6344
  ({ tasks, title = "Tasks", onStopAllTasks, className, ...rest }, ref) => {
6006
- const sortedTasks = useMemo3(() => sortTasks(tasks), [tasks]);
6007
- const [isStopping, setIsStopping] = useState17(false);
6008
- const handleStopClick = useCallback16(async () => {
6345
+ const sortedTasks = useMemo4(() => sortTasks(tasks), [tasks]);
6346
+ const [isStopping, setIsStopping] = useState18(false);
6347
+ const handleStopClick = useCallback17(async () => {
6009
6348
  if (!onStopAllTasks || isStopping) return;
6010
6349
  try {
6011
6350
  setIsStopping(true);
@@ -6039,7 +6378,7 @@ var TodosList = React70.forwardRef(
6039
6378
  if (tasks.length === 0) {
6040
6379
  return null;
6041
6380
  }
6042
- return /* @__PURE__ */ React70.createElement(
6381
+ return /* @__PURE__ */ React71.createElement(
6043
6382
  "div",
6044
6383
  {
6045
6384
  ref,
@@ -6050,16 +6389,16 @@ var TodosList = React70.forwardRef(
6050
6389
  ),
6051
6390
  ...rest
6052
6391
  },
6053
- /* @__PURE__ */ React70.createElement(
6392
+ /* @__PURE__ */ React71.createElement(
6054
6393
  "div",
6055
6394
  {
6056
6395
  className: "flex items-center justify-between px-4 py-2 border-b border-ash/40 flex-shrink-0"
6057
6396
  },
6058
- /* @__PURE__ */ React70.createElement("h4", { className: "text-xs font-medium text-white" }, title),
6059
- /* @__PURE__ */ React70.createElement("span", { className: "text-xs text-silver/60" }, countCompleted(tasks), "/", countTotal(tasks))
6397
+ /* @__PURE__ */ React71.createElement("h4", { className: "text-xs font-medium text-white" }, title),
6398
+ /* @__PURE__ */ React71.createElement("span", { className: "text-xs text-silver/60" }, countCompleted(tasks), "/", countTotal(tasks))
6060
6399
  ),
6061
- /* @__PURE__ */ React70.createElement("div", { className: "flex-1 overflow-y-auto px-4 py-2" }, sortedTasks.map((task) => /* @__PURE__ */ React70.createElement(TaskItem, { key: task.id, task }))),
6062
- showStopButton && /* @__PURE__ */ React70.createElement("div", { className: "px-4 py-2 border-t border-ash/40 flex-shrink-0" }, /* @__PURE__ */ React70.createElement(
6400
+ /* @__PURE__ */ React71.createElement("div", { className: "flex-1 overflow-y-auto px-4 py-2" }, sortedTasks.map((task) => /* @__PURE__ */ React71.createElement(TaskItem, { key: task.id, task }))),
6401
+ showStopButton && /* @__PURE__ */ React71.createElement("div", { className: "px-4 py-2 border-t border-ash/40 flex-shrink-0" }, /* @__PURE__ */ React71.createElement(
6063
6402
  "button",
6064
6403
  {
6065
6404
  type: "button",
@@ -6076,7 +6415,7 @@ var TodosList = React70.forwardRef(
6076
6415
  isStopping ? "cursor-not-allowed opacity-70" : "hover:bg-error/20"
6077
6416
  )
6078
6417
  },
6079
- isStopping ? /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement(Loader22, { className: "w-3 h-3 animate-spin" }), "Stopping tasks") : /* @__PURE__ */ React70.createElement(React70.Fragment, null, /* @__PURE__ */ React70.createElement(Square2, { className: "w-3 h-3 fill-current" }), "Stop All Tasks")
6418
+ isStopping ? /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(Loader22, { className: "w-3 h-3 animate-spin" }), "Stopping tasks") : /* @__PURE__ */ React71.createElement(React71.Fragment, null, /* @__PURE__ */ React71.createElement(Square2, { className: "w-3 h-3 fill-current" }), "Stop All Tasks")
6080
6419
  ))
6081
6420
  );
6082
6421
  }
@@ -6092,8 +6431,8 @@ function areAllTasksSettled(tasks) {
6092
6431
  }
6093
6432
 
6094
6433
  // src/components/chat/ToolSidebar.tsx
6095
- import React71 from "react";
6096
- var ToolSidebar = React71.forwardRef(
6434
+ import React72 from "react";
6435
+ var ToolSidebar = React72.forwardRef(
6097
6436
  ({ tools, activeTools, onToggleTool, side, className, ...rest }, ref) => {
6098
6437
  const topTools = tools.filter((t) => t.group === `top-${side}`);
6099
6438
  const bottomTools = tools.filter((t) => t.group === `bottom-${side}`);
@@ -6104,7 +6443,7 @@ var ToolSidebar = React71.forwardRef(
6104
6443
  };
6105
6444
  const renderButton = (tool) => {
6106
6445
  const active = isActive(tool.id);
6107
- return /* @__PURE__ */ React71.createElement(
6446
+ return /* @__PURE__ */ React72.createElement(
6108
6447
  "button",
6109
6448
  {
6110
6449
  key: tool.id,
@@ -6116,10 +6455,10 @@ var ToolSidebar = React71.forwardRef(
6116
6455
  "aria-label": tool.label,
6117
6456
  "aria-pressed": active
6118
6457
  },
6119
- /* @__PURE__ */ React71.createElement("span", { className: "w-4 h-4 block" }, tool.icon)
6458
+ /* @__PURE__ */ React72.createElement("span", { className: "w-4 h-4 block" }, tool.icon)
6120
6459
  );
6121
6460
  };
6122
- return /* @__PURE__ */ React71.createElement(
6461
+ return /* @__PURE__ */ React72.createElement(
6123
6462
  "div",
6124
6463
  {
6125
6464
  ref,
@@ -6130,17 +6469,17 @@ var ToolSidebar = React71.forwardRef(
6130
6469
  ),
6131
6470
  ...rest
6132
6471
  },
6133
- /* @__PURE__ */ React71.createElement("div", { className: "flex flex-col items-center gap-1" }, topTools.map(renderButton)),
6134
- /* @__PURE__ */ React71.createElement("div", { className: "flex-1 flex items-center justify-center" }, /* @__PURE__ */ React71.createElement("div", { className: "w-5 border-t border-ash/30" })),
6135
- /* @__PURE__ */ React71.createElement("div", { className: "flex flex-col items-center gap-1" }, bottomTools.map(renderButton))
6472
+ /* @__PURE__ */ React72.createElement("div", { className: "flex flex-col items-center gap-1" }, topTools.map(renderButton)),
6473
+ /* @__PURE__ */ React72.createElement("div", { className: "flex-1 flex items-center justify-center" }, /* @__PURE__ */ React72.createElement("div", { className: "w-5 border-t border-ash/30" })),
6474
+ /* @__PURE__ */ React72.createElement("div", { className: "flex flex-col items-center gap-1" }, bottomTools.map(renderButton))
6136
6475
  );
6137
6476
  }
6138
6477
  );
6139
6478
  ToolSidebar.displayName = "ToolSidebar";
6140
6479
 
6141
6480
  // src/components/chat/ToolPanelContainer.tsx
6142
- import React72, { useCallback as useCallback17, useEffect as useEffect13, useRef as useRef11, useState as useState18 } from "react";
6143
- var ToolPanelContainer = React72.forwardRef(
6481
+ import React73, { useCallback as useCallback18, useEffect as useEffect14, useRef as useRef12, useState as useState19 } from "react";
6482
+ var ToolPanelContainer = React73.forwardRef(
6144
6483
  ({
6145
6484
  topContent,
6146
6485
  bottomContent,
@@ -6151,21 +6490,21 @@ var ToolPanelContainer = React72.forwardRef(
6151
6490
  initialTopPercent = 60,
6152
6491
  ...rest
6153
6492
  }, ref) => {
6154
- const [topPercent, setTopPercent] = useState18(initialTopPercent);
6155
- const [isResizingHeight, setIsResizingHeight] = useState18(false);
6156
- const containerRef = useRef11(null);
6157
- const lastY = useRef11(null);
6493
+ const [topPercent, setTopPercent] = useState19(initialTopPercent);
6494
+ const [isResizingHeight, setIsResizingHeight] = useState19(false);
6495
+ const containerRef = useRef12(null);
6496
+ const lastY = useRef12(null);
6158
6497
  const hasBoth = topContent !== null && bottomContent !== null;
6159
- const startHeightResize = useCallback17((e) => {
6498
+ const startHeightResize = useCallback18((e) => {
6160
6499
  e.preventDefault();
6161
6500
  setIsResizingHeight(true);
6162
6501
  lastY.current = e.clientY;
6163
6502
  }, []);
6164
- const stopHeightResize = useCallback17(() => {
6503
+ const stopHeightResize = useCallback18(() => {
6165
6504
  setIsResizingHeight(false);
6166
6505
  lastY.current = null;
6167
6506
  }, []);
6168
- const resizeHeight = useCallback17(
6507
+ const resizeHeight = useCallback18(
6169
6508
  (e) => {
6170
6509
  if (!isResizingHeight || lastY.current === null || !containerRef.current) {
6171
6510
  return;
@@ -6184,7 +6523,7 @@ var ToolPanelContainer = React72.forwardRef(
6184
6523
  },
6185
6524
  [isResizingHeight]
6186
6525
  );
6187
- useEffect13(() => {
6526
+ useEffect14(() => {
6188
6527
  if (isResizingHeight) {
6189
6528
  window.addEventListener("mousemove", resizeHeight);
6190
6529
  window.addEventListener("mouseup", stopHeightResize);
@@ -6203,7 +6542,7 @@ var ToolPanelContainer = React72.forwardRef(
6203
6542
  document.body.style.userSelect = "";
6204
6543
  };
6205
6544
  }, [isResizingHeight, resizeHeight, stopHeightResize]);
6206
- return /* @__PURE__ */ React72.createElement(
6545
+ return /* @__PURE__ */ React73.createElement(
6207
6546
  "div",
6208
6547
  {
6209
6548
  ref: (node) => {
@@ -6222,7 +6561,7 @@ var ToolPanelContainer = React72.forwardRef(
6222
6561
  style: width ? { width } : void 0,
6223
6562
  ...rest
6224
6563
  },
6225
- /* @__PURE__ */ React72.createElement(
6564
+ /* @__PURE__ */ React73.createElement(
6226
6565
  "div",
6227
6566
  {
6228
6567
  onMouseDown: onResizeStart,
@@ -6233,7 +6572,7 @@ var ToolPanelContainer = React72.forwardRef(
6233
6572
  )
6234
6573
  }
6235
6574
  ),
6236
- topContent !== null && /* @__PURE__ */ React72.createElement(
6575
+ topContent !== null && /* @__PURE__ */ React73.createElement(
6237
6576
  "div",
6238
6577
  {
6239
6578
  className: "min-h-0 overflow-hidden flex flex-col",
@@ -6241,7 +6580,7 @@ var ToolPanelContainer = React72.forwardRef(
6241
6580
  },
6242
6581
  topContent
6243
6582
  ),
6244
- hasBoth && /* @__PURE__ */ React72.createElement(
6583
+ hasBoth && /* @__PURE__ */ React73.createElement(
6245
6584
  "div",
6246
6585
  {
6247
6586
  onMouseDown: startHeightResize,
@@ -6253,7 +6592,7 @@ var ToolPanelContainer = React72.forwardRef(
6253
6592
  )
6254
6593
  }
6255
6594
  ),
6256
- bottomContent !== null && /* @__PURE__ */ React72.createElement(
6595
+ bottomContent !== null && /* @__PURE__ */ React73.createElement(
6257
6596
  "div",
6258
6597
  {
6259
6598
  className: "min-h-0 overflow-hidden flex flex-col",
@@ -6267,26 +6606,26 @@ var ToolPanelContainer = React72.forwardRef(
6267
6606
  ToolPanelContainer.displayName = "ToolPanelContainer";
6268
6607
 
6269
6608
  // src/components/chat/hooks/useResizable.ts
6270
- import { useCallback as useCallback18, useEffect as useEffect14, useRef as useRef12, useState as useState19 } from "react";
6609
+ import { useCallback as useCallback19, useEffect as useEffect15, useRef as useRef13, useState as useState20 } from "react";
6271
6610
  function useResizable({
6272
6611
  initialWidthPercent,
6273
6612
  minWidthPercent,
6274
6613
  maxWidthPercent,
6275
6614
  direction
6276
6615
  }) {
6277
- const [widthPercent, setWidthPercent] = useState19(initialWidthPercent);
6278
- const [isResizing, setIsResizing] = useState19(false);
6279
- const lastX = useRef12(null);
6280
- const startResizing = useCallback18((e) => {
6616
+ const [widthPercent, setWidthPercent] = useState20(initialWidthPercent);
6617
+ const [isResizing, setIsResizing] = useState20(false);
6618
+ const lastX = useRef13(null);
6619
+ const startResizing = useCallback19((e) => {
6281
6620
  e.preventDefault();
6282
6621
  setIsResizing(true);
6283
6622
  lastX.current = e.clientX;
6284
6623
  }, []);
6285
- const stopResizing = useCallback18(() => {
6624
+ const stopResizing = useCallback19(() => {
6286
6625
  setIsResizing(false);
6287
6626
  lastX.current = null;
6288
6627
  }, []);
6289
- const resize = useCallback18(
6628
+ const resize = useCallback19(
6290
6629
  (e) => {
6291
6630
  if (!isResizing || lastX.current === null) {
6292
6631
  return;
@@ -6302,7 +6641,7 @@ function useResizable({
6302
6641
  },
6303
6642
  [isResizing, direction, minWidthPercent, maxWidthPercent]
6304
6643
  );
6305
- useEffect14(() => {
6644
+ useEffect15(() => {
6306
6645
  if (isResizing) {
6307
6646
  window.addEventListener("mousemove", resize);
6308
6647
  window.addEventListener("mouseup", stopResizing);
@@ -6326,7 +6665,7 @@ function useResizable({
6326
6665
  }
6327
6666
 
6328
6667
  // src/components/chat/ChatInterface.tsx
6329
- var ChatInterface = React73.forwardRef(
6668
+ var ChatInterface = React74.forwardRef(
6330
6669
  ({
6331
6670
  messages = [],
6332
6671
  conversationTree,
@@ -6338,6 +6677,7 @@ var ChatInterface = React73.forwardRef(
6338
6677
  onStop,
6339
6678
  onSelectConversation,
6340
6679
  onNewChat,
6680
+ onRenameConversation,
6341
6681
  isStreaming = false,
6342
6682
  isThinking = false,
6343
6683
  placeholder = "Send a message...",
@@ -6356,20 +6696,21 @@ var ChatInterface = React73.forwardRef(
6356
6696
  inputNotice,
6357
6697
  onInputChange,
6358
6698
  tools: externalTools = [],
6699
+ autoFocus = true,
6359
6700
  className,
6360
6701
  ...rest
6361
6702
  }, ref) => {
6362
- const prevArtifactNodesRef = useRef13([]);
6363
- const prevTasksRef = useRef13([]);
6364
- const [internalTools, setInternalTools] = useState20({
6703
+ const prevArtifactNodesRef = useRef14([]);
6704
+ const prevTasksRef = useRef14([]);
6705
+ const [internalTools, setInternalTools] = useState21({
6365
6706
  "top-left": "history",
6366
6707
  "bottom-left": null,
6367
6708
  "top-right": null,
6368
6709
  "bottom-right": null
6369
6710
  });
6370
- const dismissedToolsRef = useRef13(/* @__PURE__ */ new Set());
6711
+ const dismissedToolsRef = useRef14(/* @__PURE__ */ new Set());
6371
6712
  const isPanelControlled = isArtifactsPanelOpen !== void 0;
6372
- const activeTools = useMemo4(() => {
6713
+ const activeTools = useMemo5(() => {
6373
6714
  if (isPanelControlled) {
6374
6715
  return {
6375
6716
  ...internalTools,
@@ -6399,13 +6740,13 @@ var ChatInterface = React73.forwardRef(
6399
6740
  direction: "right"
6400
6741
  });
6401
6742
  const allSettled = tasks.length === 0 || areAllTasksSettled(tasks);
6402
- const allToolDefinitions = useMemo4(() => {
6743
+ const allToolDefinitions = useMemo5(() => {
6403
6744
  const builtIn = [
6404
- { id: "history", icon: /* @__PURE__ */ React73.createElement(ChatBubbleIcon, null), label: "History", group: "top-left" },
6405
- { id: "artifacts", icon: /* @__PURE__ */ React73.createElement(MediaIcon, null), label: "Artifacts", group: "top-right" },
6745
+ { id: "history", icon: /* @__PURE__ */ React74.createElement(ChatBubbleIcon, null), label: "History", group: "top-left" },
6746
+ { id: "artifacts", icon: /* @__PURE__ */ React74.createElement(MediaIcon, null), label: "Artifacts", group: "top-right" },
6406
6747
  {
6407
6748
  id: "todos",
6408
- icon: allSettled ? /* @__PURE__ */ React73.createElement(CheckSquareIcon, null) : /* @__PURE__ */ React73.createElement(SquareLoaderIcon, null),
6749
+ icon: allSettled ? /* @__PURE__ */ React74.createElement(CheckSquareIcon, null) : /* @__PURE__ */ React74.createElement(SquareLoaderIcon, null),
6409
6750
  label: "Tasks",
6410
6751
  group: "bottom-right"
6411
6752
  }
@@ -6413,7 +6754,7 @@ var ChatInterface = React73.forwardRef(
6413
6754
  const external = externalTools.map(({ content: _content, ...def }) => def);
6414
6755
  return [...builtIn, ...external];
6415
6756
  }, [allSettled, externalTools]);
6416
- const toggleTool = useCallback19((toolId) => {
6757
+ const toggleTool = useCallback20((toolId) => {
6417
6758
  const toolDef = allToolDefinitions.find((t) => t.id === toolId);
6418
6759
  if (!toolDef) {
6419
6760
  return;
@@ -6443,7 +6784,7 @@ var ChatInterface = React73.forwardRef(
6443
6784
  });
6444
6785
  }, [allToolDefinitions, isPanelControlled, activeTools, onArtifactsPanelOpenChange]);
6445
6786
  const isTreeMode = !!conversationTree;
6446
- const effectiveMessages = useMemo4(() => {
6787
+ const effectiveMessages = useMemo5(() => {
6447
6788
  if (isTreeMode && conversationTree) {
6448
6789
  const pathNodes = getActivePathMessages(conversationTree);
6449
6790
  return pathNodes.map((node) => ({
@@ -6455,7 +6796,7 @@ var ChatInterface = React73.forwardRef(
6455
6796
  }
6456
6797
  return messages;
6457
6798
  }, [isTreeMode, conversationTree, messages]);
6458
- const latestUserMessageIndex = useMemo4(() => {
6799
+ const latestUserMessageIndex = useMemo5(() => {
6459
6800
  for (let i = effectiveMessages.length - 1; i >= 0; i--) {
6460
6801
  if (effectiveMessages[i].variant === "user") {
6461
6802
  return i;
@@ -6463,7 +6804,7 @@ var ChatInterface = React73.forwardRef(
6463
6804
  }
6464
6805
  return -1;
6465
6806
  }, [effectiveMessages]);
6466
- useEffect15(() => {
6807
+ useEffect16(() => {
6467
6808
  const nodes = artifactNodes || [];
6468
6809
  const prevNodes = prevArtifactNodesRef.current;
6469
6810
  const hasNewOrChangedNode = nodes.length !== prevNodes.length || nodes.some((n, i) => n.id !== prevNodes[i]?.id);
@@ -6488,7 +6829,7 @@ var ChatInterface = React73.forwardRef(
6488
6829
  prevArtifactNodesRef.current = nodes;
6489
6830
  prevTasksRef.current = tasks;
6490
6831
  }, [artifactNodes, tasks, isPanelControlled]);
6491
- const handleBranchSwitch = useCallback19(
6832
+ const handleBranchSwitch = useCallback20(
6492
6833
  (nodeId, direction) => {
6493
6834
  if (!isTreeMode || !conversationTree || !onTreeChange) {
6494
6835
  return;
@@ -6498,7 +6839,7 @@ var ChatInterface = React73.forwardRef(
6498
6839
  },
6499
6840
  [isTreeMode, conversationTree, onTreeChange]
6500
6841
  );
6501
- const displayMessages = useMemo4(() => {
6842
+ const displayMessages = useMemo5(() => {
6502
6843
  return effectiveMessages.map((msg) => {
6503
6844
  let branchInfo = void 0;
6504
6845
  if (isTreeMode && conversationTree) {
@@ -6528,18 +6869,18 @@ var ChatInterface = React73.forwardRef(
6528
6869
  onRetryMessage,
6529
6870
  handleBranchSwitch
6530
6871
  ]);
6531
- const handleSubmit = useCallback19(
6872
+ const handleSubmit = useCallback20(
6532
6873
  (message, attachments) => {
6533
6874
  onMessageSubmit?.(message, attachments);
6534
6875
  },
6535
6876
  [onMessageSubmit]
6536
6877
  );
6537
6878
  const isEmpty = effectiveMessages.length === 0;
6538
- const leftToolDefs = useMemo4(
6879
+ const leftToolDefs = useMemo5(
6539
6880
  () => allToolDefinitions.filter((t) => t.group === "top-left" || t.group === "bottom-left"),
6540
6881
  [allToolDefinitions]
6541
6882
  );
6542
- const rightToolDefs = useMemo4(
6883
+ const rightToolDefs = useMemo5(
6543
6884
  () => allToolDefinitions.filter(
6544
6885
  (t) => t.group === "top-right" || t.group === "bottom-right"
6545
6886
  ),
@@ -6553,58 +6894,17 @@ var ChatInterface = React73.forwardRef(
6553
6894
  }
6554
6895
  switch (toolId) {
6555
6896
  case "history":
6556
- return /* @__PURE__ */ React73.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ React73.createElement(
6557
- "div",
6897
+ return /* @__PURE__ */ React74.createElement(
6898
+ HistoryPanel,
6558
6899
  {
6559
- className: "flex items-center justify-between p-4 border-b border-ash/40 shrink-0"
6560
- },
6561
- /* @__PURE__ */ React73.createElement("h3", { className: "text-xs font-medium text-white" }, "History"),
6562
- onNewChat && /* @__PURE__ */ React73.createElement(
6563
- "button",
6564
- {
6565
- onClick: onNewChat,
6566
- className: cx(
6567
- "flex px-3 py-1.5",
6568
- "bg-gold/10 hover:bg-gold/20 text-gold",
6569
- "border border-gold/30",
6570
- "text-xs font-medium",
6571
- "transition-colors duration-200"
6572
- )
6573
- },
6574
- /* @__PURE__ */ React73.createElement(
6575
- "svg",
6576
- {
6577
- xmlns: "http://www.w3.org/2000/svg",
6578
- viewBox: "0 0 20 20",
6579
- fill: "currentColor",
6580
- className: "w-4 h-4"
6581
- },
6582
- /* @__PURE__ */ React73.createElement(
6583
- "path",
6584
- {
6585
- d: "M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z"
6586
- }
6587
- )
6588
- ),
6589
- "New Chat"
6590
- )
6591
- ), /* @__PURE__ */ React73.createElement("div", { className: "flex-1 overflow-y-auto py-2" }, conversations.length === 0 ? /* @__PURE__ */ React73.createElement("p", { className: "px-4 py-2 text-xs text-silver/60" }, "No conversations yet") : /* @__PURE__ */ React73.createElement("div", { className: "space-y-1 px-2" }, conversations.map((conversation) => /* @__PURE__ */ React73.createElement(
6592
- "button",
6593
- {
6594
- key: conversation.id,
6595
- onClick: () => onSelectConversation?.(conversation.id),
6596
- className: cx(
6597
- "w-full px-3 py-2 text-left",
6598
- "transition-colors duration-150",
6599
- conversation.isActive ? "bg-ash/40 text-white" : "text-silver hover:bg-ash/20 hover:text-white"
6600
- )
6601
- },
6602
- /* @__PURE__ */ React73.createElement("p", { className: "text-sm font-medium truncate" }, conversation.title),
6603
- conversation.preview && /* @__PURE__ */ React73.createElement("p", { className: "text-xs text-silver/60 truncate mt-0.5" }, conversation.preview),
6604
- conversation.timestamp && /* @__PURE__ */ React73.createElement("p", { className: "text-xs text-silver/40 mt-1" }, conversation.timestamp)
6605
- )))));
6900
+ conversations,
6901
+ onSelectConversation,
6902
+ onNewChat,
6903
+ onRenameConversation
6904
+ }
6905
+ );
6606
6906
  case "artifacts":
6607
- return /* @__PURE__ */ React73.createElement(
6907
+ return /* @__PURE__ */ React74.createElement(
6608
6908
  ArtifactsPanel,
6609
6909
  {
6610
6910
  nodes: artifactNodes,
@@ -6612,7 +6912,7 @@ var ChatInterface = React73.forwardRef(
6612
6912
  }
6613
6913
  );
6614
6914
  case "todos":
6615
- return tasks.length > 0 ? /* @__PURE__ */ React73.createElement(
6915
+ return tasks.length > 0 ? /* @__PURE__ */ React74.createElement(
6616
6916
  TodosList,
6617
6917
  {
6618
6918
  tasks,
@@ -6620,21 +6920,21 @@ var ChatInterface = React73.forwardRef(
6620
6920
  onStopAllTasks,
6621
6921
  className: "h-full"
6622
6922
  }
6623
- ) : /* @__PURE__ */ React73.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ React73.createElement("div", { className: "flex items-center p-4 border-b border-ash/40 shrink-0" }, /* @__PURE__ */ React73.createElement("h3", { className: "text-xs font-medium text-white" }, "Tasks")), /* @__PURE__ */ React73.createElement("div", { className: "flex-1 flex items-center justify-center" }, /* @__PURE__ */ React73.createElement("p", { className: "text-xs text-silver/60" }, "No tasks")));
6923
+ ) : /* @__PURE__ */ React74.createElement("div", { className: "h-full flex flex-col" }, /* @__PURE__ */ React74.createElement("div", { className: "flex items-center p-4 border-b border-ash/40 shrink-0" }, /* @__PURE__ */ React74.createElement("h3", { className: "text-xs font-medium text-white" }, "Tasks")), /* @__PURE__ */ React74.createElement("div", { className: "flex-1 flex items-center justify-center" }, /* @__PURE__ */ React74.createElement("p", { className: "text-xs text-silver/60" }, "No tasks")));
6624
6924
  default: {
6625
6925
  const externalTool = externalTools.find((t) => t.id === toolId);
6626
6926
  return externalTool?.content ?? null;
6627
6927
  }
6628
6928
  }
6629
6929
  };
6630
- return /* @__PURE__ */ React73.createElement(
6930
+ return /* @__PURE__ */ React74.createElement(
6631
6931
  "div",
6632
6932
  {
6633
6933
  ref,
6634
6934
  className: cx("flex h-full w-full bg-obsidian overflow-hidden", className),
6635
6935
  ...rest
6636
6936
  },
6637
- hasLeftTools && /* @__PURE__ */ React73.createElement(
6937
+ hasLeftTools && /* @__PURE__ */ React74.createElement(
6638
6938
  ToolSidebar,
6639
6939
  {
6640
6940
  tools: leftToolDefs,
@@ -6643,7 +6943,7 @@ var ChatInterface = React73.forwardRef(
6643
6943
  side: "left"
6644
6944
  }
6645
6945
  ),
6646
- isLeftPanelOpen && /* @__PURE__ */ React73.createElement(
6946
+ isLeftPanelOpen && /* @__PURE__ */ React74.createElement(
6647
6947
  ToolPanelContainer,
6648
6948
  {
6649
6949
  topContent: renderToolContent(activeTools["top-left"]),
@@ -6654,16 +6954,16 @@ var ChatInterface = React73.forwardRef(
6654
6954
  initialTopPercent: 30
6655
6955
  }
6656
6956
  ),
6657
- /* @__PURE__ */ React73.createElement("div", { className: "flex-1 flex flex-col min-w-0 relative" }, /* @__PURE__ */ React73.createElement("div", { className: cx(
6957
+ /* @__PURE__ */ React74.createElement("div", { className: "flex-1 flex flex-col min-w-0 relative" }, /* @__PURE__ */ React74.createElement("div", { className: cx(
6658
6958
  "flex-1 flex flex-col min-h-0 relative",
6659
6959
  isEmpty ? "justify-center" : "justify-start"
6660
- ) }, /* @__PURE__ */ React73.createElement("div", { className: cx(
6960
+ ) }, /* @__PURE__ */ React74.createElement("div", { className: cx(
6661
6961
  "transition-all duration-500 ease-in-out",
6662
6962
  isEmpty ? "flex-1" : "flex-zero"
6663
- ) }), /* @__PURE__ */ React73.createElement("div", { className: cx(
6963
+ ) }), /* @__PURE__ */ React74.createElement("div", { className: cx(
6664
6964
  "transition-all duration-500 ease-in-out overflow-hidden flex flex-col",
6665
6965
  isEmpty ? "flex-zero opacity-0" : "flex-1 opacity-100"
6666
- ) }, /* @__PURE__ */ React73.createElement(
6966
+ ) }, /* @__PURE__ */ React74.createElement(
6667
6967
  ChatView,
6668
6968
  {
6669
6969
  messages: displayMessages,
@@ -6672,10 +6972,10 @@ var ChatInterface = React73.forwardRef(
6672
6972
  isThinking,
6673
6973
  className: "flex-1"
6674
6974
  }
6675
- )), /* @__PURE__ */ React73.createElement("div", { className: cx(
6975
+ )), /* @__PURE__ */ React74.createElement("div", { className: cx(
6676
6976
  "transition-all duration-500 ease-in-out z-10 w-full flex flex-col items-center",
6677
6977
  isEmpty ? "p-4" : "shrink-0 p-4 border-t border-ash/40 bg-obsidian"
6678
- ) }, isEmpty && /* @__PURE__ */ React73.createElement("div", { className: "mb-8 text-center animate-fade-in duration-500" }, emptyState ? emptyState : /* @__PURE__ */ React73.createElement("h1", { className: "text-4xl md:text-5xl font-heading text-gold mb-2 tracking-tight" }, "Welcome!")), /* @__PURE__ */ React73.createElement(
6978
+ ) }, isEmpty && /* @__PURE__ */ React74.createElement("div", { className: "mb-8 text-center animate-fade-in duration-500" }, emptyState ? emptyState : /* @__PURE__ */ React74.createElement("h1", { className: "text-4xl md:text-5xl font-heading text-gold mb-2 tracking-tight" }, "Welcome!")), /* @__PURE__ */ React74.createElement(
6679
6979
  ChatInput,
6680
6980
  {
6681
6981
  position: isEmpty ? "centered" : "bottom",
@@ -6689,13 +6989,14 @@ var ChatInterface = React73.forwardRef(
6689
6989
  attachments: propsAttachments,
6690
6990
  onAttachmentsChange,
6691
6991
  notice: inputNotice,
6692
- onInputChange
6992
+ onInputChange,
6993
+ autoFocus
6693
6994
  }
6694
- )), /* @__PURE__ */ React73.createElement("div", { className: cx(
6995
+ )), /* @__PURE__ */ React74.createElement("div", { className: cx(
6695
6996
  "transition-all duration-500 ease-in-out",
6696
6997
  isEmpty ? "flex-1" : "flex-zero"
6697
6998
  ) }))),
6698
- isRightPanelOpen && /* @__PURE__ */ React73.createElement(
6999
+ isRightPanelOpen && /* @__PURE__ */ React74.createElement(
6699
7000
  ToolPanelContainer,
6700
7001
  {
6701
7002
  topContent: renderToolContent(activeTools["top-right"]),
@@ -6706,7 +7007,7 @@ var ChatInterface = React73.forwardRef(
6706
7007
  initialTopPercent: 70
6707
7008
  }
6708
7009
  ),
6709
- hasRightTools && /* @__PURE__ */ React73.createElement(
7010
+ hasRightTools && /* @__PURE__ */ React74.createElement(
6710
7011
  ToolSidebar,
6711
7012
  {
6712
7013
  tools: rightToolDefs,
@@ -6721,9 +7022,9 @@ var ChatInterface = React73.forwardRef(
6721
7022
  ChatInterface.displayName = "ChatInterface";
6722
7023
 
6723
7024
  // src/components/chat/MessageActions.tsx
6724
- import React74, { useCallback as useCallback20, useState as useState21 } from "react";
7025
+ import React75, { useCallback as useCallback21, useState as useState22 } from "react";
6725
7026
  import { Check as Check3, Copy, Pencil, RotateCcw, Send as Send2, X as X6 } from "lucide-react";
6726
- var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */ React74.createElement(
7027
+ var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @__PURE__ */ React75.createElement(
6727
7028
  "button",
6728
7029
  {
6729
7030
  type: "button",
@@ -6739,7 +7040,7 @@ var ActionButton2 = ({ onClick, label, children, className, disabled }) => /* @_
6739
7040
  },
6740
7041
  children
6741
7042
  );
6742
- var MessageActions = React74.forwardRef(
7043
+ var MessageActions = React75.forwardRef(
6743
7044
  ({
6744
7045
  variant,
6745
7046
  content,
@@ -6751,12 +7052,12 @@ var MessageActions = React74.forwardRef(
6751
7052
  className,
6752
7053
  ...rest
6753
7054
  }, ref) => {
6754
- const [localIsEditing, setLocalIsEditing] = useState21(false);
6755
- const [localEditValue, setLocalEditValue] = useState21(content);
6756
- const [copied, setCopied] = useState21(false);
7055
+ const [localIsEditing, setLocalIsEditing] = useState22(false);
7056
+ const [localEditValue, setLocalEditValue] = useState22(content);
7057
+ const [copied, setCopied] = useState22(false);
6757
7058
  const isEditing = controlledIsEditing ?? localIsEditing;
6758
7059
  const editValue = controlledEditValue ?? localEditValue;
6759
- const setIsEditing = useCallback20(
7060
+ const setIsEditing = useCallback21(
6760
7061
  (value) => {
6761
7062
  if (onEditingChange) {
6762
7063
  onEditingChange(value);
@@ -6766,10 +7067,10 @@ var MessageActions = React74.forwardRef(
6766
7067
  },
6767
7068
  [onEditingChange]
6768
7069
  );
6769
- const setEditValue = useCallback20((value) => {
7070
+ const setEditValue = useCallback21((value) => {
6770
7071
  setLocalEditValue(value);
6771
7072
  }, []);
6772
- const handleCopy = useCallback20(async () => {
7073
+ const handleCopy = useCallback21(async () => {
6773
7074
  try {
6774
7075
  await navigator.clipboard.writeText(content);
6775
7076
  setCopied(true);
@@ -6785,22 +7086,22 @@ var MessageActions = React74.forwardRef(
6785
7086
  setTimeout(() => setCopied(false), 2e3);
6786
7087
  }
6787
7088
  }, [content]);
6788
- const handleStartEdit = useCallback20(() => {
7089
+ const handleStartEdit = useCallback21(() => {
6789
7090
  setLocalEditValue(content);
6790
7091
  setIsEditing(true);
6791
7092
  }, [content, setIsEditing]);
6792
- const handleCancelEdit = useCallback20(() => {
7093
+ const handleCancelEdit = useCallback21(() => {
6793
7094
  setIsEditing(false);
6794
7095
  setLocalEditValue(content);
6795
7096
  }, [content, setIsEditing]);
6796
- const handleSubmitEdit = useCallback20(() => {
7097
+ const handleSubmitEdit = useCallback21(() => {
6797
7098
  const trimmed = editValue.trim();
6798
7099
  if (trimmed && trimmed !== content) {
6799
7100
  onEdit?.(trimmed);
6800
7101
  }
6801
7102
  setIsEditing(false);
6802
7103
  }, [editValue, content, onEdit, setIsEditing]);
6803
- const handleEditKeyDown = useCallback20(
7104
+ const handleEditKeyDown = useCallback21(
6804
7105
  (e) => {
6805
7106
  if (e.key === "Enter" && !e.shiftKey) {
6806
7107
  e.preventDefault();
@@ -6813,19 +7114,19 @@ var MessageActions = React74.forwardRef(
6813
7114
  );
6814
7115
  const isUser = variant === "user";
6815
7116
  if (isUser && isEditing) {
6816
- return /* @__PURE__ */ React74.createElement(
7117
+ return /* @__PURE__ */ React75.createElement(
6817
7118
  "div",
6818
7119
  {
6819
7120
  ref,
6820
7121
  className: cx("mt-2", className),
6821
7122
  ...rest
6822
7123
  },
6823
- /* @__PURE__ */ React74.createElement(
7124
+ /* @__PURE__ */ React75.createElement(
6824
7125
  "div",
6825
7126
  {
6826
7127
  className: "relative bg-charcoal border border-ash/60 focus-within:border-gold/60 focus-within:ring-1 focus-within:ring-gold/20"
6827
7128
  },
6828
- /* @__PURE__ */ React74.createElement(
7129
+ /* @__PURE__ */ React75.createElement(
6829
7130
  "textarea",
6830
7131
  {
6831
7132
  value: editValue,
@@ -6836,15 +7137,15 @@ var MessageActions = React74.forwardRef(
6836
7137
  rows: 2
6837
7138
  }
6838
7139
  ),
6839
- /* @__PURE__ */ React74.createElement("div", { className: "absolute right-2 bottom-2 flex gap-1" }, /* @__PURE__ */ React74.createElement(
7140
+ /* @__PURE__ */ React75.createElement("div", { className: "absolute right-2 bottom-2 flex gap-1" }, /* @__PURE__ */ React75.createElement(
6840
7141
  ActionButton2,
6841
7142
  {
6842
7143
  onClick: handleCancelEdit,
6843
7144
  label: "Cancel edit",
6844
7145
  className: "text-silver/60 hover:text-error"
6845
7146
  },
6846
- /* @__PURE__ */ React74.createElement(X6, { className: "w-4 h-4" })
6847
- ), /* @__PURE__ */ React74.createElement(
7147
+ /* @__PURE__ */ React75.createElement(X6, { className: "w-4 h-4" })
7148
+ ), /* @__PURE__ */ React75.createElement(
6848
7149
  ActionButton2,
6849
7150
  {
6850
7151
  onClick: handleSubmitEdit,
@@ -6852,13 +7153,13 @@ var MessageActions = React74.forwardRef(
6852
7153
  className: "text-silver/60 hover:text-gold",
6853
7154
  disabled: !editValue.trim() || editValue.trim() === content
6854
7155
  },
6855
- /* @__PURE__ */ React74.createElement(Send2, { className: "w-4 h-4" })
7156
+ /* @__PURE__ */ React75.createElement(Send2, { className: "w-4 h-4" })
6856
7157
  ))
6857
7158
  ),
6858
- /* @__PURE__ */ React74.createElement("p", { className: "text-xs text-silver/50 mt-1" }, "Press Enter to submit, Esc to cancel. This will create a new branch.")
7159
+ /* @__PURE__ */ React75.createElement("p", { className: "text-xs text-silver/50 mt-1" }, "Press Enter to submit, Esc to cancel. This will create a new branch.")
6859
7160
  );
6860
7161
  }
6861
- return /* @__PURE__ */ React74.createElement(
7162
+ return /* @__PURE__ */ React75.createElement(
6862
7163
  "div",
6863
7164
  {
6864
7165
  ref,
@@ -6869,18 +7170,18 @@ var MessageActions = React74.forwardRef(
6869
7170
  ),
6870
7171
  ...rest
6871
7172
  },
6872
- /* @__PURE__ */ React74.createElement(ActionButton2, { onClick: handleCopy, label: copied ? "Copied!" : "Copy message" }, copied ? /* @__PURE__ */ React74.createElement(Check3, { className: "w-3.5 h-3.5 text-success" }) : /* @__PURE__ */ React74.createElement(Copy, { className: "w-3.5 h-3.5" })),
6873
- isUser && onEdit && /* @__PURE__ */ React74.createElement(ActionButton2, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ React74.createElement(Pencil, { className: "w-3.5 h-3.5" })),
6874
- !isUser && onRetry && /* @__PURE__ */ React74.createElement(ActionButton2, { onClick: onRetry, label: "Regenerate response" }, /* @__PURE__ */ React74.createElement(RotateCcw, { className: "w-3.5 h-3.5" }))
7173
+ /* @__PURE__ */ React75.createElement(ActionButton2, { onClick: handleCopy, label: copied ? "Copied!" : "Copy message" }, copied ? /* @__PURE__ */ React75.createElement(Check3, { className: "w-3.5 h-3.5 text-success" }) : /* @__PURE__ */ React75.createElement(Copy, { className: "w-3.5 h-3.5" })),
7174
+ isUser && onEdit && /* @__PURE__ */ React75.createElement(ActionButton2, { onClick: handleStartEdit, label: "Edit message" }, /* @__PURE__ */ React75.createElement(Pencil, { className: "w-3.5 h-3.5" })),
7175
+ !isUser && onRetry && /* @__PURE__ */ React75.createElement(ActionButton2, { onClick: onRetry, label: "Regenerate response" }, /* @__PURE__ */ React75.createElement(RotateCcw, { className: "w-3.5 h-3.5" }))
6875
7176
  );
6876
7177
  }
6877
7178
  );
6878
7179
  MessageActions.displayName = "MessageActions";
6879
7180
 
6880
7181
  // src/components/chat/BranchNavigator.tsx
6881
- import React75 from "react";
7182
+ import React76 from "react";
6882
7183
  import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight3, GitBranch } from "lucide-react";
6883
- var BranchNavigator = React75.forwardRef(
7184
+ var BranchNavigator = React76.forwardRef(
6884
7185
  ({
6885
7186
  current,
6886
7187
  total,
@@ -6899,7 +7200,7 @@ var BranchNavigator = React75.forwardRef(
6899
7200
  const buttonSize = size === "sm" ? "p-0.5" : "p-1";
6900
7201
  const iconSize = size === "sm" ? "w-3 h-3" : "w-4 h-4";
6901
7202
  const textSize = size === "sm" ? "text-xs" : "text-sm";
6902
- return /* @__PURE__ */ React75.createElement(
7203
+ return /* @__PURE__ */ React76.createElement(
6903
7204
  "div",
6904
7205
  {
6905
7206
  ref,
@@ -6911,8 +7212,8 @@ var BranchNavigator = React75.forwardRef(
6911
7212
  "aria-label": "Branch navigation",
6912
7213
  ...rest
6913
7214
  },
6914
- showIcon && /* @__PURE__ */ React75.createElement(GitBranch, { className: cx(iconSize, "mr-0.5 text-silver/50"), "aria-hidden": "true" }),
6915
- /* @__PURE__ */ React75.createElement(
7215
+ showIcon && /* @__PURE__ */ React76.createElement(GitBranch, { className: cx(iconSize, "mr-0.5 text-silver/50"), "aria-hidden": "true" }),
7216
+ /* @__PURE__ */ React76.createElement(
6916
7217
  "button",
6917
7218
  {
6918
7219
  type: "button",
@@ -6925,10 +7226,10 @@ var BranchNavigator = React75.forwardRef(
6925
7226
  ),
6926
7227
  "aria-label": "Previous branch"
6927
7228
  },
6928
- /* @__PURE__ */ React75.createElement(ChevronLeft2, { className: iconSize })
7229
+ /* @__PURE__ */ React76.createElement(ChevronLeft2, { className: iconSize })
6929
7230
  ),
6930
- /* @__PURE__ */ React75.createElement("span", { className: cx(textSize, "tabular-nums min-w-6 text-center") }, current, "/", total),
6931
- /* @__PURE__ */ React75.createElement(
7231
+ /* @__PURE__ */ React76.createElement("span", { className: cx(textSize, "tabular-nums min-w-6 text-center") }, current, "/", total),
7232
+ /* @__PURE__ */ React76.createElement(
6932
7233
  "button",
6933
7234
  {
6934
7235
  type: "button",
@@ -6941,7 +7242,7 @@ var BranchNavigator = React75.forwardRef(
6941
7242
  ),
6942
7243
  "aria-label": "Next branch"
6943
7244
  },
6944
- /* @__PURE__ */ React75.createElement(ChevronRight3, { className: iconSize })
7245
+ /* @__PURE__ */ React76.createElement(ChevronRight3, { className: iconSize })
6945
7246
  )
6946
7247
  );
6947
7248
  }
@@ -6949,16 +7250,16 @@ var BranchNavigator = React75.forwardRef(
6949
7250
  BranchNavigator.displayName = "BranchNavigator";
6950
7251
 
6951
7252
  // src/components/BrandIcon.tsx
6952
- import React76 from "react";
7253
+ import React77 from "react";
6953
7254
  var sizeMap2 = {
6954
7255
  sm: "h-8 w-8 text-sm",
6955
7256
  md: "h-12 w-12 text-base",
6956
7257
  lg: "h-16 w-16 text-lg"
6957
7258
  };
6958
- var BrandIcon = React76.forwardRef(
7259
+ var BrandIcon = React77.forwardRef(
6959
7260
  ({ size = "md", variant = "solid", children, className, ...rest }, ref) => {
6960
7261
  const variantClasses = variant === "solid" ? "bg-gold text-obsidian border-2 border-gold" : "bg-transparent text-gold border-2 border-gold";
6961
- return /* @__PURE__ */ React76.createElement(
7262
+ return /* @__PURE__ */ React77.createElement(
6962
7263
  "div",
6963
7264
  {
6964
7265
  ref,
@@ -6977,17 +7278,17 @@ var BrandIcon = React76.forwardRef(
6977
7278
  BrandIcon.displayName = "BrandIcon";
6978
7279
 
6979
7280
  // src/components/ColorSwatch.tsx
6980
- import React77 from "react";
6981
- var ColorSwatch = React77.forwardRef(
7281
+ import React78 from "react";
7282
+ var ColorSwatch = React78.forwardRef(
6982
7283
  ({ color, label, className, ...rest }, ref) => {
6983
- return /* @__PURE__ */ React77.createElement(
7284
+ return /* @__PURE__ */ React78.createElement(
6984
7285
  "div",
6985
7286
  {
6986
7287
  ref,
6987
7288
  className: cx("flex flex-col items-center gap-2", className),
6988
7289
  ...rest
6989
7290
  },
6990
- /* @__PURE__ */ React77.createElement(
7291
+ /* @__PURE__ */ React78.createElement(
6991
7292
  "div",
6992
7293
  {
6993
7294
  className: "h-16 w-16 border-2 border-ash rounded-none shadow-sm",
@@ -6995,22 +7296,22 @@ var ColorSwatch = React77.forwardRef(
6995
7296
  "aria-label": label || color
6996
7297
  }
6997
7298
  ),
6998
- label && /* @__PURE__ */ React77.createElement("span", { className: "text-xs text-silver font-medium" }, label)
7299
+ label && /* @__PURE__ */ React78.createElement("span", { className: "text-xs text-silver font-medium" }, label)
6999
7300
  );
7000
7301
  }
7001
7302
  );
7002
7303
  ColorSwatch.displayName = "ColorSwatch";
7003
7304
 
7004
7305
  // src/components/SectionHeading.tsx
7005
- import React78 from "react";
7306
+ import React79 from "react";
7006
7307
  var levelStyles = {
7007
7308
  h2: "text-2xl mb-4",
7008
7309
  h3: "text-xl mb-3"
7009
7310
  };
7010
- var SectionHeading = React78.forwardRef(
7311
+ var SectionHeading = React79.forwardRef(
7011
7312
  ({ level = "h2", children, className, ...rest }, ref) => {
7012
7313
  const Component = level;
7013
- return /* @__PURE__ */ React78.createElement(
7314
+ return /* @__PURE__ */ React79.createElement(
7014
7315
  Component,
7015
7316
  {
7016
7317
  ref,
@@ -7081,6 +7382,7 @@ export {
7081
7382
  FileChip,
7082
7383
  HelperText,
7083
7384
  HistoryIcon,
7385
+ HistoryPanel,
7084
7386
  ImageCard,
7085
7387
  Input,
7086
7388
  InputGroup,