@lukeashford/aurelius 3.3.0 → 3.4.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.d.mts CHANGED
@@ -850,8 +850,12 @@ interface TodosListProps extends React$1.HTMLAttributes<HTMLDivElement> {
850
850
  * Called when the "Stop All Tasks" button is clicked.
851
851
  * Only shown when at least one task is in_progress.
852
852
  * The consumer decides what stopping means (cancel API calls, mark cancelled, etc.).
853
+ *
854
+ * May return a Promise. While the Promise is pending, the button becomes
855
+ * disabled and displays a spinner with "Stopping tasks" to give the user
856
+ * feedback that the stop request is in flight.
853
857
  */
854
- onStopAllTasks?: () => void;
858
+ onStopAllTasks?: () => void | Promise<void>;
855
859
  }
856
860
  declare const TodosList: React$1.ForwardRefExoticComponent<TodosListProps & React$1.RefAttributes<HTMLDivElement>>;
857
861
  /**
@@ -1396,8 +1400,12 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
1396
1400
  * Called when the "Stop All Tasks" button is clicked in the tasks panel.
1397
1401
  * Only shown when at least one task has in_progress status.
1398
1402
  * The consumer app decides what stopping means (cancel API calls, mark tasks cancelled, etc.).
1403
+ *
1404
+ * May return a Promise. While the Promise is pending, the button becomes
1405
+ * disabled and displays a spinner with "Stopping tasks" so the user knows
1406
+ * the stop request is in flight.
1399
1407
  */
1400
- onStopAllTasks?: () => void;
1408
+ onStopAllTasks?: () => void | Promise<void>;
1401
1409
  /**
1402
1410
  * Additional tools to add to the tool sidebars. Each ExternalToolDefinition provides
1403
1411
  * an id, icon, label, group ('top-left' | 'bottom-left' | 'top-right' | 'bottom-right'),
package/dist/index.d.ts CHANGED
@@ -850,8 +850,12 @@ interface TodosListProps extends React$1.HTMLAttributes<HTMLDivElement> {
850
850
  * Called when the "Stop All Tasks" button is clicked.
851
851
  * Only shown when at least one task is in_progress.
852
852
  * The consumer decides what stopping means (cancel API calls, mark cancelled, etc.).
853
+ *
854
+ * May return a Promise. While the Promise is pending, the button becomes
855
+ * disabled and displays a spinner with "Stopping tasks" to give the user
856
+ * feedback that the stop request is in flight.
853
857
  */
854
- onStopAllTasks?: () => void;
858
+ onStopAllTasks?: () => void | Promise<void>;
855
859
  }
856
860
  declare const TodosList: React$1.ForwardRefExoticComponent<TodosListProps & React$1.RefAttributes<HTMLDivElement>>;
857
861
  /**
@@ -1396,8 +1400,12 @@ interface ChatInterfaceProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>
1396
1400
  * Called when the "Stop All Tasks" button is clicked in the tasks panel.
1397
1401
  * Only shown when at least one task has in_progress status.
1398
1402
  * The consumer app decides what stopping means (cancel API calls, mark tasks cancelled, etc.).
1403
+ *
1404
+ * May return a Promise. While the Promise is pending, the button becomes
1405
+ * disabled and displays a spinner with "Stopping tasks" so the user knows
1406
+ * the stop request is in flight.
1399
1407
  */
1400
- onStopAllTasks?: () => void;
1408
+ onStopAllTasks?: () => void | Promise<void>;
1401
1409
  /**
1402
1410
  * Additional tools to add to the tool sidebars. Each ExternalToolDefinition provides
1403
1411
  * an id, icon, label, group ('top-left' | 'bottom-left' | 'top-right' | 'bottom-right'),
package/dist/index.js CHANGED
@@ -6137,6 +6137,16 @@ function hasInProgressTask(tasks) {
6137
6137
  var TodosList = import_react73.default.forwardRef(
6138
6138
  ({ tasks, title = "Tasks", onStopAllTasks, className, ...rest }, ref) => {
6139
6139
  const sortedTasks = (0, import_react73.useMemo)(() => sortTasks(tasks), [tasks]);
6140
+ const [isStopping, setIsStopping] = (0, import_react73.useState)(false);
6141
+ const handleStopClick = (0, import_react73.useCallback)(async () => {
6142
+ if (!onStopAllTasks || isStopping) return;
6143
+ try {
6144
+ setIsStopping(true);
6145
+ await onStopAllTasks();
6146
+ } finally {
6147
+ setIsStopping(false);
6148
+ }
6149
+ }, [onStopAllTasks, isStopping]);
6140
6150
  const countCompleted = (taskList) => {
6141
6151
  let count = 0;
6142
6152
  for (const task of taskList) {
@@ -6158,7 +6168,7 @@ var TodosList = import_react73.default.forwardRef(
6158
6168
  }
6159
6169
  return count;
6160
6170
  };
6161
- const showStopButton = !!onStopAllTasks && hasInProgressTask(tasks);
6171
+ const showStopButton = !!onStopAllTasks && (hasInProgressTask(tasks) || isStopping);
6162
6172
  if (tasks.length === 0) {
6163
6173
  return null;
6164
6174
  }
@@ -6186,17 +6196,20 @@ var TodosList = import_react73.default.forwardRef(
6186
6196
  "button",
6187
6197
  {
6188
6198
  type: "button",
6189
- onClick: onStopAllTasks,
6199
+ onClick: handleStopClick,
6200
+ disabled: isStopping,
6201
+ "aria-busy": isStopping,
6202
+ "aria-label": isStopping ? "Stopping tasks" : "Stop all tasks",
6190
6203
  className: cx(
6191
6204
  "w-full flex items-center justify-center gap-2 px-3 py-1.5",
6192
- "bg-error/10 hover:bg-error/20 text-error",
6205
+ "bg-error/10 text-error",
6193
6206
  "border border-error/30",
6194
6207
  "text-xs font-medium",
6195
- "transition-colors duration-200"
6208
+ "transition-colors duration-200",
6209
+ isStopping ? "cursor-not-allowed opacity-70" : "hover:bg-error/20"
6196
6210
  )
6197
6211
  },
6198
- /* @__PURE__ */ import_react73.default.createElement(import_lucide_react14.Square, { className: "w-3 h-3 fill-current" }),
6199
- "Stop All Tasks"
6212
+ isStopping ? /* @__PURE__ */ import_react73.default.createElement(import_react73.default.Fragment, null, /* @__PURE__ */ import_react73.default.createElement(import_lucide_react14.Loader2, { className: "w-3 h-3 animate-spin" }), "Stopping tasks") : /* @__PURE__ */ import_react73.default.createElement(import_react73.default.Fragment, null, /* @__PURE__ */ import_react73.default.createElement(import_lucide_react14.Square, { className: "w-3 h-3 fill-current" }), "Stop All Tasks")
6200
6213
  ))
6201
6214
  );
6202
6215
  }