@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.mjs CHANGED
@@ -142,6 +142,9 @@ var AuthProvider = ({
142
142
  window.addEventListener("lattice:unauthorized", handler);
143
143
  return () => window.removeEventListener("lattice:unauthorized", handler);
144
144
  }, [logout]);
145
+ const handleUnauthorized = useCallback(() => {
146
+ logout();
147
+ }, [logout]);
145
148
  const selectTenant = useCallback(async (tenantId) => {
146
149
  if (!user) return;
147
150
  setIsLoading(true);
@@ -157,11 +160,10 @@ var AuthProvider = ({
157
160
  body: JSON.stringify({ tenantId })
158
161
  });
159
162
  if (response.status === 401) {
160
- const data = await response.json().catch(() => ({}));
161
- if (data.error?.includes("Token expired")) {
162
- handleUnauthorized();
163
- return;
164
- }
163
+ const data = await response.json().catch(() => null);
164
+ handleUnauthorized();
165
+ const message35 = data && typeof data === "object" && "error" in data && typeof data.error === "string" ? data.error : "Unauthorized";
166
+ throw new Error(message35);
165
167
  }
166
168
  if (!response.ok) {
167
169
  const data = await response.json();
@@ -193,10 +195,7 @@ var AuthProvider = ({
193
195
  } finally {
194
196
  setIsLoading(false);
195
197
  }
196
- }, [baseURL, user, onTenantSelected]);
197
- const handleUnauthorized = useCallback(() => {
198
- logout();
199
- }, [logout]);
198
+ }, [baseURL, user, onTenantSelected, handleUnauthorized]);
200
199
  const fetchUserTenants = useCallback(async () => {
201
200
  if (!user) return;
202
201
  setIsLoading(true);
@@ -1120,6 +1119,7 @@ var DEFAULT_MIDDLEWARE_TYPES = [
1120
1119
  { id: "read_file", name: "read_file", description: "Read file contents" },
1121
1120
  { id: "write_file", name: "write_file", description: "Write or create a file" },
1122
1121
  { id: "edit_file", name: "edit_file", description: "Edit file with find-and-replace" },
1122
+ { id: "delete_file", name: "delete_file", description: "Permanently delete a regular file" },
1123
1123
  { id: "glob", name: "glob", description: "Find files by pattern" },
1124
1124
  { id: "grep", name: "grep", description: "Search file contents with regex" }
1125
1125
  ]
@@ -33381,18 +33381,18 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
33381
33381
  const [editingCase, setEditingCase] = useState84(null);
33382
33382
  const [form] = Form9.useForm();
33383
33383
  const [agents, setAgents] = useState84([]);
33384
+ const [agentsLoading, setAgentsLoading] = useState84(false);
33384
33385
  const suite = suites.find((s) => s.id === suiteId) || {};
33385
33386
  const isEditing = !!editingCase;
33386
33387
  const loadAgents = async () => {
33388
+ setAgents([]);
33389
+ setAgentsLoading(true);
33387
33390
  try {
33388
- const baseURL = client.config?.baseURL || "";
33389
- const apiKey = client.config?.apiKey || "";
33390
- const res = await fetch(`${baseURL}/api/assistants`, {
33391
- headers: apiKey ? { Authorization: `Bearer ${apiKey}` } : {}
33392
- });
33393
- const d = await res.json();
33394
- if (d.success) setAgents(d.data?.records || []);
33391
+ setAgents(await client.assistants.list());
33395
33392
  } catch {
33393
+ message20.error("Failed to load agents");
33394
+ } finally {
33395
+ setAgentsLoading(false);
33396
33396
  }
33397
33397
  };
33398
33398
  const openCreateModal = () => {
@@ -33531,6 +33531,7 @@ var EvalSuiteDetail = ({ projectId, suiteId, onBack, onRun }) => {
33531
33531
  {
33532
33532
  placeholder: "Select agent",
33533
33533
  showSearch: true,
33534
+ loading: agentsLoading,
33534
33535
  optionFilterProp: "label",
33535
33536
  options: agents.map((a) => ({
33536
33537
  value: a.id,