@gentiq/core 1.0.0-alpha.8 → 1.0.0-beta.1

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.
@@ -1,33 +1,33 @@
1
- import { resolveAuthAdapter as m, createLocalStorageAuthAdapter as g } from "./auth.es.js";
2
- import { createComposerDrafts as b } from "../composer/composerDrafts.es.js";
3
- import { createComposerFiles as p } from "../composer/composerFiles.es.js";
4
- import { createChatRuntime as f } from "../thread/chatRuntime.es.js";
5
- import { createHttpClient as q, errorFromResponse as y } from "./http.es.js";
1
+ import { resolveAuthAdapter as m, createLocalStorageAuthAdapter as p } from "./auth.es.js";
2
+ import { createComposerDrafts as _ } from "../composer/composerDrafts.es.js";
3
+ import { createComposerFiles as q } from "../composer/composerFiles.es.js";
4
+ import { createChatRuntime as g } from "../thread/chatRuntime.es.js";
5
+ import { createHttpClient as b, errorFromResponse as y } from "./http.es.js";
6
6
  const h = 3e4;
7
- function _(t = {}, s = {}) {
8
- const n = m(
9
- t.authAdapter ?? g(t.cacheNamespace ?? "gentiq")
10
- ), d = q({
7
+ function f(t = {}, a = {}) {
8
+ const c = m(
9
+ t.authAdapter ?? p(t.cacheNamespace ?? "gentiq")
10
+ ), d = b({
11
11
  basePath: t.basePath ?? "/api",
12
12
  fetch: t.fetch,
13
13
  timeout: t.timeout ?? h,
14
- getHeaders: n.getHeaders,
15
- credentials: n.credentials
16
- }), c = T(d, n, t), e = p((r, u) => c.uploadAttachment(r, u)), a = f({
14
+ getHeaders: c.getHeaders,
15
+ credentials: c.credentials
16
+ }), n = T(d, c, t), e = q((s, u) => n.uploadAttachment(s, u)), r = g({
17
17
  http: d,
18
- resolveAttachment: (r) => c.getAttachmentBlobUrl(r),
19
- throttleMs: s.throttleMs,
20
- getRunOptions: s.getRunOptions
18
+ resolveAttachment: (s) => n.getAttachmentBlobUrl(s),
19
+ throttleMs: a.throttleMs,
20
+ getRunOptions: a.getRunOptions
21
21
  });
22
- return { api: c, http: d, auth: n, options: t, composerFiles: e, composerDrafts: b(), chat: a };
22
+ return { api: n, http: d, auth: c, options: t, composerFiles: e, composerDrafts: _(), chat: r };
23
23
  }
24
- function C(t) {
25
- return _(t).api;
24
+ function S(t) {
25
+ return f(t).api;
26
26
  }
27
27
  const o = (t) => t.replace(/^\//, "");
28
- function T(t, s, n) {
29
- const d = n.timeout ?? h;
30
- async function c(e) {
28
+ function T(t, a, c) {
29
+ const d = c.timeout ?? h;
30
+ async function n(e) {
31
31
  return URL.createObjectURL(await e.blob());
32
32
  }
33
33
  return {
@@ -44,29 +44,29 @@ function T(t, s, n) {
44
44
  const e = await t.fetch("/auth/logout", { method: "POST" });
45
45
  if (!e.ok && e.status !== 401)
46
46
  throw y(e, await e.text().catch(() => ""));
47
- s.clearToken();
47
+ a.clearToken();
48
48
  },
49
49
  /**
50
50
  * Sign in. `identifier` is matched against every enabled login field on the backend (the
51
51
  * combined "email or username" box).
52
52
  */
53
- login: async (e, a) => {
54
- const r = await t.request("post", "/public/auth/login", {
55
- body: { login: e, password: a },
53
+ login: async (e, r) => {
54
+ const s = await t.request("post", "/public/auth/login", {
55
+ body: { login: e, password: r },
56
56
  auth: !1
57
57
  });
58
- return s.setToken(r.token), r;
58
+ return a.setToken(s.token), s;
59
59
  },
60
60
  /**
61
61
  * Create an account and sign in. `values` maps each enabled login field to the value the
62
62
  * user gave for it; the backend requires at least one.
63
63
  */
64
- register: async (e, a, r, u, l) => {
64
+ register: async (e, r, s, u, l) => {
65
65
  const i = await t.request("post", "/public/auth/register", {
66
- body: { ...e, password: a, name: r, surname: u, metadata: l },
66
+ body: { ...e, password: r, name: s, surname: u, metadata: l },
67
67
  auth: !1
68
68
  });
69
- return s.setToken(i.token), i;
69
+ return a.setToken(i.token), i;
70
70
  },
71
71
  /** The signed-in user's access: their plan and its usage windows, or their credits. */
72
72
  getEntitlement: (e) => t.request("get", "/users/me/entitlement", { signal: e }),
@@ -79,9 +79,9 @@ function T(t, s, n) {
79
79
  * then hands the held session back (`resumed`), so a page reloaded with a spent code keeps
80
80
  * its user signed in rather than signing them out.
81
81
  */
82
- exchangeLoginCode: async (e, a) => {
83
- const r = await t.request("post", "/auth/exchange", { body: { code: e }, signal: a });
84
- return r.token && s.setToken(r.token), r;
82
+ exchangeLoginCode: async (e, r) => {
83
+ const s = await t.request("post", "/auth/exchange", { body: { code: e }, signal: r });
84
+ return s.token && a.setToken(s.token), s;
85
85
  },
86
86
  /**
87
87
  * A page of the user's threads, pinned first and then by last activity; with `query`, only
@@ -90,27 +90,27 @@ function T(t, s, n) {
90
90
  */
91
91
  getHistory: ({
92
92
  cursor: e,
93
- limit: a = 50,
94
- query: r
95
- } = {}) => t.request("get", "/chat/threads", { query: { cursor: e, limit: a, q: r } }),
93
+ limit: r = 50,
94
+ query: s
95
+ } = {}) => t.request("get", "/chat/threads", { query: { cursor: e, limit: r, q: s } }),
96
96
  /**
97
97
  * A page of a thread's messages, oldest first: its last `limit` (50 unless given), or with
98
98
  * `before`, a page's `next_cursor`, the `limit` before that page.
99
99
  */
100
- getThreadMessages: (e, { before: a, limit: r } = {}) => t.request("get", "/chat/threads/{thread_id}", {
100
+ getThreadMessages: (e, { before: r, limit: s } = {}) => t.request("get", "/chat/threads/{thread_id}", {
101
101
  path: { thread_id: o(e) },
102
- query: { before: a, limit: r }
102
+ query: { before: r, limit: s }
103
103
  }),
104
104
  deleteThread: (e) => t.request("delete", "/chat/threads/{thread_id}", {
105
105
  path: { thread_id: o(e) }
106
106
  }),
107
- updateThreadTitle: (e, a) => t.request("patch", "/chat/threads/{thread_id}", {
107
+ updateThreadTitle: (e, r) => t.request("patch", "/chat/threads/{thread_id}", {
108
108
  path: { thread_id: o(e) },
109
- body: { title: a }
109
+ body: { title: r }
110
110
  }),
111
- pinThread: (e, a) => t.request("patch", "/chat/threads/{thread_id}", {
111
+ pinThread: (e, r) => t.request("patch", "/chat/threads/{thread_id}", {
112
112
  path: { thread_id: o(e) },
113
- body: { pinned: a }
113
+ body: { pinned: r }
114
114
  }),
115
115
  shareThread: (e) => t.request("post", "/chat/threads/{thread_id}/share", {
116
116
  path: { thread_id: o(e) }
@@ -129,27 +129,27 @@ function T(t, s, n) {
129
129
  * Fetch an attachment and return a blob URL usable in `<img src>`. The caller revokes it
130
130
  * with `URL.revokeObjectURL` when done.
131
131
  */
132
- getAttachmentBlobUrl: async (e) => n.attachmentResolver ? n.attachmentResolver(e) : c(await t.send(`/chat/attachments/${e}`)),
132
+ getAttachmentBlobUrl: async (e) => c.attachmentResolver ? c.attachmentResolver(e) : n(await t.send(`/chat/attachments/${e}`)),
133
133
  /** Fetch an attachment of a shared snapshot and return a blob URL. */
134
- getPublicAttachmentBlobUrl: async (e, a) => c(
134
+ getPublicAttachmentBlobUrl: async (e, r) => n(
135
135
  await t.send(
136
- `/public/shared/${encodeURIComponent(e)}/attachments/${a}`,
136
+ `/public/shared/${encodeURIComponent(e)}/attachments/${r}`,
137
137
  {
138
138
  auth: !1
139
139
  }
140
140
  )
141
141
  ),
142
- saveFeedback: (e, a, r) => t.request("post", "/chat/feedback", {
143
- body: { thread_id: o(e), message_id: a, sentiment: r }
142
+ saveFeedback: (e, r, s) => t.request("post", "/chat/feedback", {
143
+ body: { thread_id: o(e), message_id: r, sentiment: s }
144
144
  }),
145
145
  /**
146
146
  * Transcribe a recording of the user into text for the composer. The text is empty
147
147
  * when no speech was heard. `id` names the transcription: a message sent with it in
148
148
  * `metadata.voice_inputs` pays for it, and shows as dictated in the admin panel.
149
149
  */
150
- transcribe: (e, a) => t.request("post", "/chat/transcribe", {
150
+ transcribe: (e, r) => t.request("post", "/chat/transcribe", {
151
151
  blob: e.type ? e : new Blob([e], { type: "audio/webm" }),
152
- signal: a,
152
+ signal: r,
153
153
  timeout: d * 4
154
154
  }),
155
155
  /**
@@ -158,24 +158,90 @@ function T(t, s, n) {
158
158
  * refuses a type it doesn't accept (`unsupported_media_type`) and a file over its size limit
159
159
  * (`request_too_large`); `getAppConfig()` lists both under `attachments`.
160
160
  */
161
- uploadAttachment: async (e, { signal: a, onProgress: r } = {}) => await (await t.upload(
161
+ uploadAttachment: async (e, { signal: r, onProgress: s } = {}) => await (await t.upload(
162
162
  `/chat/attachments?filename=${encodeURIComponent(e.name)}`,
163
163
  e,
164
- { signal: a, onProgress: r }
164
+ { signal: r, onProgress: s }
165
165
  )).json(),
166
166
  /** @param signal Optional AbortSignal, so callers can cancel on unmount. */
167
167
  getMe: (e) => t.request("get", "/users/me", { signal: e }),
168
168
  updateMe: async (e) => {
169
- const a = await t.request("patch", "/users/me", { body: e });
170
- return a.token && s.setToken(a.token), a;
169
+ const r = await t.request("patch", "/users/me", { body: e });
170
+ return r.token && a.setToken(r.token), r;
171
171
  },
172
172
  getAppConfig: (e) => t.request("get", "/config", { signal: e, auth: !1 }),
173
173
  /** Whether the service is under maintenance. Public; polled by `useGentiqStatus`. */
174
- getStatus: (e) => t.request("get", "/status", { signal: e, auth: !1 })
174
+ getStatus: (e) => t.request("get", "/status", { signal: e, auth: !1 }),
175
+ /** Submit a bug report, feature request or general feedback from the signed-in user. */
176
+ submitUserReport: (e, r) => t.request("post", "/users/me/reports", { body: e, signal: r }),
177
+ // --- Schedules ---
178
+ /** List all scheduled tasks belonging to the current user. */
179
+ listSchedules: (e) => t.request("get", "/schedules", { signal: e }),
180
+ /** Create a new scheduled task for the current user. */
181
+ createSchedule: (e) => t.request("post", "/schedules", { body: e }),
182
+ /** Fetch a single scheduled task by id. */
183
+ getSchedule: (e, r) => t.request("get", "/schedules/{schedule_id}", {
184
+ path: { schedule_id: e },
185
+ signal: r
186
+ }),
187
+ /** Update an existing scheduled task. */
188
+ updateSchedule: (e, r) => t.request("patch", "/schedules/{schedule_id}", {
189
+ path: { schedule_id: e },
190
+ body: r
191
+ }),
192
+ /** Delete a scheduled task and its run history. */
193
+ deleteSchedule: (e) => t.request("delete", "/schedules/{schedule_id}", { path: { schedule_id: e } }),
194
+ /** Pause an active scheduled task. */
195
+ pauseSchedule: (e) => t.request("post", "/schedules/{schedule_id}/pause", { path: { schedule_id: e } }),
196
+ /** Resume a paused scheduled task. */
197
+ resumeSchedule: (e) => t.request("post", "/schedules/{schedule_id}/resume", {
198
+ path: { schedule_id: e }
199
+ }),
200
+ /** Trigger an immediate run of a scheduled task. */
201
+ runScheduleNow: (e) => t.request("post", "/schedules/{schedule_id}/run", { path: { schedule_id: e } }),
202
+ /** List recent runs for a scheduled task. */
203
+ listScheduleRuns: (e, r = 20, s) => t.request("get", "/schedules/{schedule_id}/runs", {
204
+ path: { schedule_id: e },
205
+ query: { limit: r },
206
+ signal: s
207
+ }),
208
+ // --- Connectors ---
209
+ /** List external connectors available to the current user. */
210
+ listConnectors: (e) => t.request("get", "/connectors", { signal: e }),
211
+ /** Store an API key for a connector. */
212
+ connectConnector: (e, r) => t.request("post", "/connectors/{connector_id}/connect", {
213
+ path: { connector_id: e },
214
+ body: r
215
+ }),
216
+ /** Start an OAuth2 authorization flow for a connector. */
217
+ startConnectorOAuth: (e, r = "/") => t.request("post", "/connectors/{connector_id}/oauth/start", {
218
+ path: { connector_id: e },
219
+ body: { return_path: r }
220
+ }),
221
+ /** Wipe credentials and disable a connector. */
222
+ disconnectConnector: (e) => t.request("post", "/connectors/{connector_id}/disconnect", {
223
+ path: { connector_id: e }
224
+ }),
225
+ /** Enable/disable a connector or update per-tool approval overrides. */
226
+ updateConnector: (e, r) => t.request("patch", "/connectors/{connector_id}", {
227
+ path: { connector_id: e },
228
+ body: r
229
+ }),
230
+ /** List tools discovered from a connected connector. */
231
+ listConnectorTools: (e, r) => t.request("get", "/connectors/{connector_id}/tools", {
232
+ path: { connector_id: e },
233
+ signal: r
234
+ }),
235
+ /** Register a custom remote MCP server for the current user. */
236
+ createUserMCPConnector: (e) => t.request("post", "/connectors/user-mcp", { body: e }),
237
+ /** Delete a user-owned custom remote MCP server. */
238
+ deleteUserMCPConnector: (e) => t.request("delete", "/connectors/user-mcp/{connector_id}", {
239
+ path: { connector_id: e }
240
+ })
175
241
  };
176
242
  }
177
243
  export {
178
244
  h as DEFAULT_TIMEOUT_MS,
179
- C as createGentiqApi,
180
- _ as createGentiqRuntime
245
+ S as createGentiqApi,
246
+ f as createGentiqRuntime
181
247
  };
@@ -1,51 +1,55 @@
1
- function p(r) {
2
- return r ?? "";
1
+ import { normalizeWhitespace as p } from "./references.es.js";
2
+ function x(t) {
3
+ return t ?? "";
3
4
  }
4
- const u = { text: "", references: [], voiceInputs: [] };
5
- function d(r) {
5
+ const a = { text: "", references: [], voiceInputs: [] };
6
+ function u(t) {
6
7
  return [
7
- r.sourceId,
8
- r.messageId,
9
- r.partIndex,
10
- r.kind,
11
- r.excerpt.replace(/\s+/g, " ").trim()
12
- ].filter((s) => s !== void 0 && s !== "").join(":");
8
+ t.sourceId,
9
+ t.messageId,
10
+ t.partIndex,
11
+ t.kind,
12
+ p(t.excerpt)
13
+ ].filter((c) => c !== void 0 && c !== "").join(":");
13
14
  }
14
- function g() {
15
- const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), o = (e) => r.get(e) ?? u;
16
- function f(e, t) {
17
- const n = o(e), c = { ...n, ...t(n) };
18
- c.text === "" && c.references.length === 0 && c.voiceInputs.length === 0 ? r.delete(e) : r.set(e, c), s.forEach((i) => i());
15
+ function I() {
16
+ const t = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), o = (e) => t.get(e) ?? a;
17
+ function i(e, r) {
18
+ const n = o(e), s = { ...n, ...r(n) };
19
+ s.text === "" && s.references.length === 0 && s.voiceInputs.length === 0 ? t.delete(e) : t.set(e, s), c.forEach((f) => f());
19
20
  }
20
21
  return {
21
22
  get: o,
22
23
  subscribe(e) {
23
- return s.add(e), () => {
24
- s.delete(e);
24
+ return c.add(e), () => {
25
+ c.delete(e);
25
26
  };
26
27
  },
27
- setText: (e, t) => {
28
- o(e).text !== t && f(e, () => ({ text: t }));
28
+ setText: (e, r) => {
29
+ o(e).text !== r && i(e, () => ({ text: r }));
29
30
  },
30
- addReference: (e, t, n) => f(e, ({ references: c }) => {
31
- const i = d(t), a = c.filter((l) => d(l) !== i);
32
- return { references: [t, ...a].slice(0, n) };
31
+ addReference: (e, r, n) => i(e, ({ references: s }) => {
32
+ const f = u(r), d = s.filter((l) => u(l) !== f);
33
+ return { references: [r, ...d].slice(0, n) };
33
34
  }),
34
- removeReference: (e, t) => f(e, ({ references: n }) => ({
35
- references: n.filter((c) => c.id !== t)
35
+ removeReference: (e, r) => i(e, ({ references: n }) => ({
36
+ references: n.filter((s) => s.id !== r)
36
37
  })),
37
38
  clearReferences: (e) => {
38
- o(e).references.length > 0 && f(e, () => ({ references: [] }));
39
+ o(e).references.length > 0 && i(e, () => ({ references: [] }));
39
40
  },
40
- addVoiceInput: (e, t) => f(e, ({ voiceInputs: n }) => ({ voiceInputs: [...n, t] })),
41
+ addVoiceInput: (e, r) => i(e, ({ voiceInputs: n }) => ({ voiceInputs: [...n, r] })),
41
42
  take: (e) => {
42
- const t = o(e);
43
- return t !== u && (r.delete(e), s.forEach((n) => n())), t;
43
+ const r = o(e);
44
+ return r !== a && (t.delete(e), c.forEach((n) => n())), r;
45
+ },
46
+ clear() {
47
+ t.size !== 0 && (t.clear(), c.forEach((e) => e()));
44
48
  }
45
49
  };
46
50
  }
47
51
  export {
48
- p as composerScope,
49
- g as createComposerDrafts,
50
- d as referenceSourceKey
52
+ x as composerScope,
53
+ I as createComposerDrafts,
54
+ u as referenceSourceKey
51
55
  };
@@ -1,44 +1,44 @@
1
1
  import { isClientError as y } from "../errors.es.js";
2
- const a = [];
3
- function m(c) {
4
- const s = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Set();
2
+ const i = [];
3
+ function m(g) {
4
+ const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set();
5
5
  let k = 0;
6
- const i = () => d.forEach((e) => e());
7
- function f(e, t, n) {
8
- const r = s.get(e);
9
- r?.some((l) => l.key === t) && (s.set(
6
+ const a = () => u.forEach((e) => e());
7
+ function f(e, t, s) {
8
+ const r = n.get(e);
9
+ r?.some((l) => l.key === t) && (n.set(
10
10
  e,
11
- r.map((l) => l.key === t ? { ...l, ...n } : l)
12
- ), i());
11
+ r.map((l) => l.key === t ? { ...l, ...s } : l)
12
+ ), a());
13
13
  }
14
- function u(e, t) {
15
- const n = new AbortController();
16
- o.set(t.key, n), c(t.file, {
17
- signal: n.signal,
14
+ function c(e, t) {
15
+ const s = new AbortController();
16
+ o.set(t.key, s), g(t.file, {
17
+ signal: s.signal,
18
18
  onProgress: (r) => f(e, t.key, { progress: r })
19
19
  }).then(
20
20
  (r) => {
21
21
  o.delete(t.key), f(e, t.key, { status: "uploaded", progress: 1, attachment: r });
22
22
  },
23
23
  (r) => {
24
- o.delete(t.key), !n.signal.aborted && f(e, t.key, { status: "failed", error: r, retryable: !y(r) });
24
+ o.delete(t.key), !s.signal.aborted && f(e, t.key, { status: "failed", error: r, retryable: !y(r) });
25
25
  }
26
26
  );
27
27
  }
28
- function g(e) {
28
+ function d(e) {
29
29
  for (const t of e)
30
30
  o.get(t.key)?.abort(), o.delete(t.key);
31
31
  }
32
32
  return {
33
- get: (e) => s.get(e) ?? a,
33
+ get: (e) => n.get(e) ?? i,
34
34
  subscribe(e) {
35
- return d.add(e), () => {
36
- d.delete(e);
35
+ return u.add(e), () => {
36
+ u.delete(e);
37
37
  };
38
38
  },
39
39
  add(e, t) {
40
40
  if (t.length === 0) return;
41
- const n = t.map(
41
+ const s = t.map(
42
42
  (r) => ({
43
43
  key: `file-${k++}`,
44
44
  file: r,
@@ -47,30 +47,34 @@ function m(c) {
47
47
  retryable: !1
48
48
  })
49
49
  );
50
- s.set(e, [...s.get(e) ?? a, ...n]), i(), n.forEach((r) => u(e, r));
50
+ n.set(e, [...n.get(e) ?? i, ...s]), a(), s.forEach((r) => c(e, r));
51
51
  },
52
52
  remove(e, t) {
53
- const n = s.get(e) ?? a;
54
- g(n.filter((r) => r.key === t)), s.set(
53
+ const s = n.get(e) ?? i;
54
+ d(s.filter((r) => r.key === t)), n.set(
55
55
  e,
56
- n.filter((r) => r.key !== t)
57
- ), i();
56
+ s.filter((r) => r.key !== t)
57
+ ), a();
58
58
  },
59
59
  retry(e, t) {
60
- const n = s.get(e)?.find((l) => l.key === t);
61
- if (!n || n.status !== "failed") return;
60
+ const s = n.get(e)?.find((l) => l.key === t);
61
+ if (!s || s.status !== "failed") return;
62
62
  const r = {
63
- key: n.key,
64
- file: n.file,
63
+ key: s.key,
64
+ file: s.file,
65
65
  status: "uploading",
66
66
  progress: null,
67
67
  retryable: !1
68
68
  };
69
- f(e, t, { ...r, error: void 0, attachment: void 0 }), u(e, r);
69
+ f(e, t, { ...r, error: void 0, attachment: void 0 }), c(e, r);
70
70
  },
71
71
  take(e) {
72
- const t = s.get(e) ?? a;
73
- return t.length === 0 ? a : (g(t), s.delete(e), i(), t);
72
+ const t = n.get(e) ?? i;
73
+ return t.length === 0 ? i : (d(t), n.delete(e), a(), t);
74
+ },
75
+ clear() {
76
+ for (const e of n.values()) d(e);
77
+ n.size === 0 && o.size === 0 || (n.clear(), a());
74
78
  }
75
79
  };
76
80
  }
package/dist/errors.es.js CHANGED
@@ -53,6 +53,21 @@ const n = {
53
53
  ADMIN_NOT_FOUND: "admin_not_found",
54
54
  CANNOT_DELETE_SELF: "cannot_delete_self",
55
55
  ADMIN_UPDATE_FAILED: "admin_update_failed",
56
+ JOB_NOT_FOUND: "job_not_found",
57
+ RAW_JOBS_DISABLED: "raw_jobs_disabled",
58
+ // Schedules
59
+ SCHEDULE_NOT_FOUND: "schedule_not_found",
60
+ SCHEDULE_LIMIT_REACHED: "schedule_limit_reached",
61
+ INVALID_SCHEDULE: "invalid_schedule",
62
+ // Connectors
63
+ CONNECTOR_NOT_FOUND: "connector_not_found",
64
+ CONNECTOR_ALREADY_EXISTS: "connector_already_exists",
65
+ CONNECTOR_READ_ONLY: "connector_read_only",
66
+ CONNECTOR_AUTH_FAILED: "connector_auth_failed",
67
+ CONNECTOR_UNREACHABLE: "connector_unreachable",
68
+ CONNECTOR_OAUTH_INVALID_STATE: "connector_oauth_invalid_state",
69
+ CONNECTOR_URL_BLOCKED: "connector_url_blocked",
70
+ USER_MCP_DISABLED: "user_mcp_disabled",
56
71
  // System Errors
57
72
  INTERNAL_ERROR: "internal_error",
58
73
  VALIDATION_ERROR: "validation_error",
@@ -64,8 +79,11 @@ const n = {
64
79
  TIMEOUT: "timeout"
65
80
  };
66
81
  class t extends Error {
82
+ /** Machine-readable error code returned by the backend (or `'timeout'`). */
67
83
  code;
84
+ /** HTTP status code when the error came from a server response. */
68
85
  status;
86
+ /** Optional structured error metadata returned by the backend. */
69
87
  details;
70
88
  constructor(_, E) {
71
89
  super(_.error.message), this.name = "GentiqError", this.code = _.error.code, this.status = E, this.details = _.error.details;
@@ -74,13 +92,13 @@ class t extends Error {
74
92
  function r(e) {
75
93
  return e instanceof t;
76
94
  }
77
- function i(e) {
95
+ function d(e) {
78
96
  const _ = e?.status;
79
97
  return typeof _ == "number" && _ >= 400 && _ < 500 && _ !== 408 && _ !== 429;
80
98
  }
81
99
  export {
82
100
  t as GentiqError,
83
101
  n as GentiqErrorCode,
84
- i as isClientError,
102
+ d as isClientError,
85
103
  r as isGentiqError
86
104
  };