@axiom-lattice/react-sdk 2.1.121 → 2.1.123

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -288,6 +288,9 @@ var AuthProvider = ({
288
288
  window.addEventListener("lattice:unauthorized", handler);
289
289
  return () => window.removeEventListener("lattice:unauthorized", handler);
290
290
  }, [logout]);
291
+ const handleUnauthorized = (0, import_react.useCallback)(() => {
292
+ logout();
293
+ }, [logout]);
291
294
  const selectTenant = (0, import_react.useCallback)(async (tenantId) => {
292
295
  if (!user) return;
293
296
  setIsLoading(true);
@@ -303,11 +306,10 @@ var AuthProvider = ({
303
306
  body: JSON.stringify({ tenantId })
304
307
  });
305
308
  if (response.status === 401) {
306
- const data = await response.json().catch(() => ({}));
307
- if (data.error?.includes("Token expired")) {
308
- handleUnauthorized();
309
- return;
310
- }
309
+ const data = await response.json().catch(() => null);
310
+ handleUnauthorized();
311
+ const message35 = data && typeof data === "object" && "error" in data && typeof data.error === "string" ? data.error : "Unauthorized";
312
+ throw new Error(message35);
311
313
  }
312
314
  if (!response.ok) {
313
315
  const data = await response.json();
@@ -339,10 +341,7 @@ var AuthProvider = ({
339
341
  } finally {
340
342
  setIsLoading(false);
341
343
  }
342
- }, [baseURL, user, onTenantSelected]);
343
- const handleUnauthorized = (0, import_react.useCallback)(() => {
344
- logout();
345
- }, [logout]);
344
+ }, [baseURL, user, onTenantSelected, handleUnauthorized]);
346
345
  const fetchUserTenants = (0, import_react.useCallback)(async () => {
347
346
  if (!user) return;
348
347
  setIsLoading(true);
@@ -1234,6 +1233,7 @@ var DEFAULT_MIDDLEWARE_TYPES = [
1234
1233
  { id: "read_file", name: "read_file", description: "Read file contents" },
1235
1234
  { id: "write_file", name: "write_file", description: "Write or create a file" },
1236
1235
  { id: "edit_file", name: "edit_file", description: "Edit file with find-and-replace" },
1236
+ { id: "delete_file", name: "delete_file", description: "Permanently delete a regular file" },
1237
1237
  { id: "glob", name: "glob", description: "Find files by pattern" },
1238
1238
  { id: "grep", name: "grep", description: "Search file contents with regex" }
1239
1239
  ]
@@ -33121,18 +33121,18 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
33121
33121
  const [editingCase, setEditingCase] = (0, import_react113.useState)(null);
33122
33122
  const [form] = import_antd99.Form.useForm();
33123
33123
  const [agents, setAgents] = (0, import_react113.useState)([]);
33124
+ const [agentsLoading, setAgentsLoading] = (0, import_react113.useState)(false);
33124
33125
  const suite = suites.find((s) => s.id === suiteId) || {};
33125
33126
  const isEditing = !!editingCase;
33126
33127
  const loadAgents = async () => {
33128
+ setAgents([]);
33129
+ setAgentsLoading(true);
33127
33130
  try {
33128
- const baseURL = client.config?.baseURL || "";
33129
- const apiKey = client.config?.apiKey || "";
33130
- const res = await fetch(`${baseURL}/api/assistants`, {
33131
- headers: apiKey ? { Authorization: `Bearer ${apiKey}` } : {}
33132
- });
33133
- const d = await res.json();
33134
- if (d.success) setAgents(d.data?.records || []);
33131
+ setAgents(await client.assistants.list());
33135
33132
  } catch {
33133
+ import_antd99.message.error("Failed to load agents");
33134
+ } finally {
33135
+ setAgentsLoading(false);
33136
33136
  }
33137
33137
  };
33138
33138
  const openCreateModal = () => {
@@ -33271,6 +33271,7 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
33271
33271
  {
33272
33272
  placeholder: "Select agent",
33273
33273
  showSearch: true,
33274
+ loading: agentsLoading,
33274
33275
  optionFilterProp: "label",
33275
33276
  options: agents.map((a) => ({
33276
33277
  value: a.id,