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