@inkeep/agents-ui 0.0.0-dev-20260528172136 → 0.0.0-dev-20260529062200

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,3 +1,3 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../hooks/use-inkeep-api-client.cjs");function r(t){const e=Number(t.code)||Number(t.statusCode);if(e&&!Number.isNaN(e))return e;try{const s=Number(JSON.parse(t.message??"").status);return s&&!Number.isNaN(s)?s:null}catch{return null}}function o(t){const e=r(t),s=n.parseAuthError(e??0,{detail:t.message??""});return s!==null?s:e===401?"session":null}function a(t){const e=r(t);return e===400||e===429}const u=`Hmm..
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../hooks/use-inkeep-api-client.cjs");function s(t){const e=Number(t.code)||Number(t.statusCode);if(e&&!Number.isNaN(e))return e;try{const r=Number(JSON.parse(t.message??"").status);return r&&!Number.isNaN(r)?r:null}catch{return null}}function o(t){const e=s(t),r=n.parseAuthError(e??0,{detail:t.message??""});return r!==null?r:e===401?"session":e===403?"captcha":null}function a(t){const e=s(t);return e===400||e===429}const u=`Hmm..
2
2
 
3
- It seems I might be having some issues right now. Please clear the chat and try again.`,E="Please try again.",i="You're sending requests too quickly. Please wait a moment and try again.",c=8e3;exports.DEFAULT_ERROR_MESSAGE=u;exports.RATE_LIMIT_MESSAGE=i;exports.RECOVERABLE_FALLBACK_MESSAGE=E;exports.RECOVERABLE_NOTIFICATION_DURATION_MS=c;exports.isRecoverableError=a;exports.resolveHttpStatusCode=r;exports.resolveStreamingAuthError=o;
3
+ It seems I might be having some issues right now. Please clear the chat and try again.`,i="Please try again.",E="You're sending requests too quickly. Please wait a moment and try again.",c=8e3;exports.DEFAULT_ERROR_MESSAGE=u;exports.RATE_LIMIT_MESSAGE=E;exports.RECOVERABLE_FALLBACK_MESSAGE=i;exports.RECOVERABLE_NOTIFICATION_DURATION_MS=c;exports.isRecoverableError=a;exports.resolveHttpStatusCode=s;exports.resolveStreamingAuthError=o;
@@ -10,9 +10,9 @@ function n(t) {
10
10
  return null;
11
11
  }
12
12
  }
13
- function a(t) {
13
+ function o(t) {
14
14
  const e = n(t), s = r(e ?? 0, { detail: t.message ?? "" });
15
- return s !== null ? s : e === 401 ? "session" : null;
15
+ return s !== null ? s : e === 401 ? "session" : e === 403 ? "captcha" : null;
16
16
  }
17
17
  function u(t) {
18
18
  const e = n(t);
@@ -28,5 +28,5 @@ export {
28
28
  m as RECOVERABLE_NOTIFICATION_DURATION_MS,
29
29
  u as isRecoverableError,
30
30
  n as resolveHttpStatusCode,
31
- a as resolveStreamingAuthError
31
+ o as resolveStreamingAuthError
32
32
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),v="[sentinel]",y="https://cdn.jsdelivr.net/npm/altcha@3.0.9/dist/main/altcha.min.js",P="sha384-SAvZpYmIwEwxkbER1dijvBKm10sobAn/28KXy+Z7/lGbsCshTPhYrFJ2kU7LKiFM",T=1e4,R=3e4;let m=null;function S(){if(typeof customElements>"u"||customElements.get("altcha-widget"))return Promise.resolve();if(m)return m;const d=o=>e=>{m=null,o(e)};return m=new Promise((o,e)=>{const r=d(e);if(document.querySelector(`script[src="${y}"]`)){customElements.whenDefined("altcha-widget").then(()=>o()).catch(r);return}const t=document.createElement("script");t.src=y,t.integrity=P,t.crossOrigin="anonymous",t.type="module",t.async=!0,t.onload=()=>{customElements.whenDefined("altcha-widget").then(()=>o()).catch(()=>r(new Error("altcha-widget custom element never registered")))},t.onerror=()=>{console.error(v,"failed to load widget script"),r(new Error("Failed to load altcha-widget script"))},document.head.appendChild(t)}),m}function b(d){const o=document.createElement("div");o.style.cssText="position:fixed;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;pointer-events:none",document.body.appendChild(o);const e=document.createElement("altcha-widget");e.setAttribute("challenge",d),e.setAttribute("auto","onload"),e.setAttribute("hidefooter","true"),e.setAttribute("hidelogo","true"),o.appendChild(e);let r=[],n,t="mounted",l=!1,h=!1,c=null,s=!1;const f=a=>{const i=r;r=[];for(const E of i)E(a)},g=()=>{l||s||(n=void 0,t="resetting",e.reset?.(),e.verify?.())},w=()=>{c&&clearTimeout(c),c=setTimeout(()=>{c=null,!(!l||s)&&(l=!1,n=void 0,t="resetting",e.reset?.(),e.verify?.())},R)},p=a=>{const i=a.detail;i&&(t=i.state??t,i.state==="verified"&&i.payload&&(h=!0,n=i.payload,f(i.payload)),i.state==="error"&&(n=void 0,f(void 0),h||(l=!0,console.warn(v,"Sentinel unavailable, requests will proceed without bot protection"),w())))};return e.addEventListener("statechange",p),{getPayload:()=>{if(s||l)return Promise.resolve(void 0);if(n){const a=n;return n=void 0,g(),Promise.resolve(a)}return t==="verified"&&g(),new Promise(a=>{r.push(a),setTimeout(()=>{const i=r.indexOf(a);i!==-1&&(r.splice(i,1),a(void 0))},T)})},startNextSolve:g,destroy:()=>{s=!0,e.removeEventListener("statechange",p),c&&(clearTimeout(c),c=null),f(void 0),o.remove()}}}const A=({baseUrl:d,appId:o,shouldBypassCaptcha:e=!1})=>{const r=u.useRef(null),n=u.useRef(null),t=u.useRef(!1),l=u.useCallback(()=>r.current?Promise.resolve():n.current?n.current:o?(n.current=S().then(()=>{if(!t.current&&!r.current){const s=`${d}/run/auth/sentinel/challenge?appId=${encodeURIComponent(o)}`;r.current=b(s)}}).catch(s=>{console.error(v,"failed to mount widget",s),n.current=null}),n.current):Promise.resolve(),[d,o]);u.useEffect(()=>{if(t.current=!1,!e)return l(),()=>{t.current=!0,r.current?.destroy(),r.current=null,n.current=null}},[e,l]);const h=u.useCallback(async()=>{if(e)return{};await l();const s=r.current;if(!s)return{};const f=await s.getPayload();return f?{"x-inkeep-challenge-solution":btoa(JSON.stringify({payload:f}))}:{}},[e,l]),c=u.useCallback(()=>{r.current?.startNextSolve()},[]);return{getCaptchaHeader:h,invalidate:c}};exports.useCaptcha=A;
1
+ "use client";"use strict";var P=Object.create;var p=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var L=(r,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of S(n))!_.call(r,t)&&t!==e&&p(r,t,{get:()=>n[t],enumerable:!(o=A(n,t))||o.enumerable});return r};var O=(r,n,e)=>(e=r!=null?P(b(r)):{},L(n||!r||!r.__esModule?p(e,"default",{value:r,enumerable:!0}):e,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),y="[sentinel]",x=45e3,C=3e4,N=3,M=250;let v=null;function Y(){return typeof customElements>"u"||customElements.get("altcha-widget")?Promise.resolve():v||(v=import("altcha").then(()=>customElements.whenDefined("altcha-widget")).then(()=>{}).catch(r=>{throw v=null,console.error(y,"failed to load altcha widget module",r),r instanceof Error?r:new Error("Failed to load altcha widget module")}),v)}function k(r){const n=document.createElement("div");n.style.cssText="position:fixed;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;pointer-events:none",document.body.appendChild(n);const e=document.createElement("altcha-widget");e.setAttribute("challenge",r),e.setAttribute("auto","onload"),e.setAttribute("hidefooter","true"),e.setAttribute("hidelogo","true"),n.appendChild(e);let o=[],t,u="mounted",s=!1,g=!1,c=null,i=null,d=0,m=!1;const h=a=>{const l=o;o=[];for(const T of l)T(a)},E=()=>{s||m||(t=void 0,u="resetting",e.reset?.(),e.verify?.())},w=()=>{c&&clearTimeout(c),c=setTimeout(()=>{c=null,!(!s||m)&&(s=!1,t=void 0,u="resetting",e.reset?.(),e.verify?.())},C)},R=a=>{const l=a.detail;l&&(u=l.state??u,l.state==="verified"&&l.payload&&(g=!0,d=0,t=l.payload,h(l.payload)),l.state==="error"&&(t=void 0,d++,!g&&d>=N?(h(void 0),s=!0,console.warn(y,`Sentinel unavailable after ${d} consecutive errors, requests will proceed without bot protection`),w()):(i&&clearTimeout(i),i=setTimeout(()=>{i=null,!(m||s)&&(u="resetting",e.reset?.(),e.verify?.())},M))))};return e.addEventListener("statechange",R),{getPayload:()=>{if(m||s)return Promise.resolve(void 0);if(t){const a=t;return t=void 0,E(),Promise.resolve(a)}return u==="verified"&&E(),new Promise(a=>{o.push(a),setTimeout(()=>{const l=o.indexOf(a);l!==-1&&(o.splice(l,1),a(void 0))},x)})},startNextSolve:E,destroy:()=>{m=!0,e.removeEventListener("statechange",R),c&&(clearTimeout(c),c=null),i&&(clearTimeout(i),i=null),h(void 0),n.remove()}}}const D=({baseUrl:r,appId:n,shouldBypassCaptcha:e=!1})=>{const o=f.useRef(null),t=f.useRef(null),u=f.useRef(!1),s=f.useCallback(()=>o.current?Promise.resolve():t.current?t.current:n?(t.current=Y().then(()=>{if(!u.current&&!o.current){const i=`${r}/run/auth/sentinel/challenge?appId=${encodeURIComponent(n)}`;o.current=k(i)}}).catch(i=>{console.error(y,"failed to mount widget",i),t.current=null}),t.current):Promise.resolve(),[r,n]);f.useEffect(()=>{if(u.current=!1,!e)return s(),()=>{u.current=!0,o.current?.destroy(),o.current=null,t.current=null}},[e,s]);const g=f.useCallback(async()=>{if(e)return{};await s();const i=o.current;if(!i)return{};const d=await i.getPayload();return d?{"x-inkeep-challenge-solution":btoa(JSON.stringify({payload:d}))}:{}},[e,s]),c=f.useCallback(()=>{o.current?.startNextSolve()},[]);return{getCaptchaHeader:g,invalidate:c}};exports.useCaptcha=D;
@@ -1,97 +1,83 @@
1
1
  "use client";
2
- import { useRef as v, useCallback as g, useEffect as T } from "react";
3
- const p = "[sentinel]", y = "https://cdn.jsdelivr.net/npm/altcha@3.0.9/dist/main/altcha.min.js", A = "sha384-SAvZpYmIwEwxkbER1dijvBKm10sobAn/28KXy+Z7/lGbsCshTPhYrFJ2kU7LKiFM", R = 1e4, S = 3e4;
4
- let f = null;
2
+ import { useRef as E, useCallback as p, useEffect as P } from "react";
3
+ const y = "[sentinel]", A = 45e3, _ = 3e4, S = 3, L = 250;
4
+ let m = null;
5
5
  function x() {
6
- if (typeof customElements > "u" || customElements.get("altcha-widget")) return Promise.resolve();
7
- if (f) return f;
8
- const u = (o) => (e) => {
9
- f = null, o(e);
10
- };
11
- return f = new Promise((o, e) => {
12
- const r = u(e);
13
- if (document.querySelector(
14
- `script[src="${y}"]`
15
- )) {
16
- customElements.whenDefined("altcha-widget").then(() => o()).catch(r);
17
- return;
18
- }
19
- const t = document.createElement("script");
20
- t.src = y, t.integrity = A, t.crossOrigin = "anonymous", t.type = "module", t.async = !0, t.onload = () => {
21
- customElements.whenDefined("altcha-widget").then(() => o()).catch(() => r(new Error("altcha-widget custom element never registered")));
22
- }, t.onerror = () => {
23
- console.error(p, "failed to load widget script"), r(new Error("Failed to load altcha-widget script"));
24
- }, document.head.appendChild(t);
25
- }), f;
6
+ return typeof customElements > "u" || customElements.get("altcha-widget") ? Promise.resolve() : m || (m = import("altcha").then(() => customElements.whenDefined("altcha-widget")).then(() => {
7
+ }).catch((c) => {
8
+ throw m = null, console.error(y, "failed to load altcha widget module", c), c instanceof Error ? c : new Error("Failed to load altcha widget module");
9
+ }), m);
26
10
  }
27
- function b(u) {
28
- const o = document.createElement("div");
29
- o.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;pointer-events:none", document.body.appendChild(o);
11
+ function O(c) {
12
+ const a = document.createElement("div");
13
+ a.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;pointer-events:none", document.body.appendChild(a);
30
14
  const e = document.createElement("altcha-widget");
31
- e.setAttribute("challenge", u), e.setAttribute("auto", "onload"), e.setAttribute("hidefooter", "true"), e.setAttribute("hidelogo", "true"), o.appendChild(e);
32
- let r = [], n, t = "mounted", l = !1, m = !1, c = null, s = !1;
33
- const d = (a) => {
34
- const i = r;
35
- r = [];
36
- for (const P of i) P(a);
15
+ e.setAttribute("challenge", c), e.setAttribute("auto", "onload"), e.setAttribute("hidefooter", "true"), e.setAttribute("hidelogo", "true"), a.appendChild(e);
16
+ let n = [], t, l = "mounted", i = !1, v = !1, s = null, r = null, d = 0, f = !1;
17
+ const g = (u) => {
18
+ const o = n;
19
+ n = [];
20
+ for (const T of o) T(u);
37
21
  }, h = () => {
38
- l || s || (n = void 0, t = "resetting", e.reset?.(), e.verify?.());
39
- }, E = () => {
40
- c && clearTimeout(c), c = setTimeout(() => {
41
- c = null, !(!l || s) && (l = !1, n = void 0, t = "resetting", e.reset?.(), e.verify?.());
42
- }, S);
43
- }, w = (a) => {
44
- const i = a.detail;
45
- i && (t = i.state ?? t, i.state === "verified" && i.payload && (m = !0, n = i.payload, d(i.payload)), i.state === "error" && (n = void 0, d(void 0), m || (l = !0, console.warn(
46
- p,
47
- "Sentinel unavailable, requests will proceed without bot protection"
48
- ), E())));
22
+ i || f || (t = void 0, l = "resetting", e.reset?.(), e.verify?.());
23
+ }, w = () => {
24
+ s && clearTimeout(s), s = setTimeout(() => {
25
+ s = null, !(!i || f) && (i = !1, t = void 0, l = "resetting", e.reset?.(), e.verify?.());
26
+ }, _);
27
+ }, R = (u) => {
28
+ const o = u.detail;
29
+ o && (l = o.state ?? l, o.state === "verified" && o.payload && (v = !0, d = 0, t = o.payload, g(o.payload)), o.state === "error" && (t = void 0, d++, !v && d >= S ? (g(void 0), i = !0, console.warn(
30
+ y,
31
+ `Sentinel unavailable after ${d} consecutive errors, requests will proceed without bot protection`
32
+ ), w()) : (r && clearTimeout(r), r = setTimeout(() => {
33
+ r = null, !(f || i) && (l = "resetting", e.reset?.(), e.verify?.());
34
+ }, L))));
49
35
  };
50
- return e.addEventListener("statechange", w), { getPayload: () => {
51
- if (s || l) return Promise.resolve(void 0);
52
- if (n) {
53
- const a = n;
54
- return n = void 0, h(), Promise.resolve(a);
36
+ return e.addEventListener("statechange", R), { getPayload: () => {
37
+ if (f || i) return Promise.resolve(void 0);
38
+ if (t) {
39
+ const u = t;
40
+ return t = void 0, h(), Promise.resolve(u);
55
41
  }
56
- return t === "verified" && h(), new Promise((a) => {
57
- r.push(a), setTimeout(() => {
58
- const i = r.indexOf(a);
59
- i !== -1 && (r.splice(i, 1), a(void 0));
60
- }, R);
42
+ return l === "verified" && h(), new Promise((u) => {
43
+ n.push(u), setTimeout(() => {
44
+ const o = n.indexOf(u);
45
+ o !== -1 && (n.splice(o, 1), u(void 0));
46
+ }, A);
61
47
  });
62
48
  }, startNextSolve: h, destroy: () => {
63
- s = !0, e.removeEventListener("statechange", w), c && (clearTimeout(c), c = null), d(void 0), o.remove();
49
+ f = !0, e.removeEventListener("statechange", R), s && (clearTimeout(s), s = null), r && (clearTimeout(r), r = null), g(void 0), a.remove();
64
50
  } };
65
51
  }
66
- const L = ({ baseUrl: u, appId: o, shouldBypassCaptcha: e = !1 }) => {
67
- const r = v(null), n = v(null), t = v(!1), l = g(() => r.current ? Promise.resolve() : n.current ? n.current : o ? (n.current = x().then(() => {
68
- if (!t.current && !r.current) {
69
- const s = `${u}/run/auth/sentinel/challenge?appId=${encodeURIComponent(o)}`;
70
- r.current = b(s);
52
+ const Y = ({ baseUrl: c, appId: a, shouldBypassCaptcha: e = !1 }) => {
53
+ const n = E(null), t = E(null), l = E(!1), i = p(() => n.current ? Promise.resolve() : t.current ? t.current : a ? (t.current = x().then(() => {
54
+ if (!l.current && !n.current) {
55
+ const r = `${c}/run/auth/sentinel/challenge?appId=${encodeURIComponent(a)}`;
56
+ n.current = O(r);
71
57
  }
72
- }).catch((s) => {
73
- console.error(p, "failed to mount widget", s), n.current = null;
74
- }), n.current) : Promise.resolve(), [u, o]);
75
- T(() => {
76
- if (t.current = !1, !e)
77
- return l(), () => {
78
- t.current = !0, r.current?.destroy(), r.current = null, n.current = null;
58
+ }).catch((r) => {
59
+ console.error(y, "failed to mount widget", r), t.current = null;
60
+ }), t.current) : Promise.resolve(), [c, a]);
61
+ P(() => {
62
+ if (l.current = !1, !e)
63
+ return i(), () => {
64
+ l.current = !0, n.current?.destroy(), n.current = null, t.current = null;
79
65
  };
80
- }, [e, l]);
81
- const m = g(async () => {
66
+ }, [e, i]);
67
+ const v = p(async () => {
82
68
  if (e) return {};
83
- await l();
84
- const s = r.current;
85
- if (!s) return {};
86
- const d = await s.getPayload();
69
+ await i();
70
+ const r = n.current;
71
+ if (!r) return {};
72
+ const d = await r.getPayload();
87
73
  return d ? {
88
74
  "x-inkeep-challenge-solution": btoa(JSON.stringify({ payload: d }))
89
75
  } : {};
90
- }, [e, l]), c = g(() => {
91
- r.current?.startNextSolve();
76
+ }, [e, i]), s = p(() => {
77
+ n.current?.startNextSolve();
92
78
  }, []);
93
- return { getCaptchaHeader: m, invalidate: c };
79
+ return { getCaptchaHeader: v, invalidate: s };
94
80
  };
95
81
  export {
96
- L as useCaptcha
82
+ Y as useCaptcha
97
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-ui",
3
- "version": "0.0.0-dev-20260528172136",
3
+ "version": "0.0.0-dev-20260529062200",
4
4
  "description": "",
5
5
  "homepage": "",
6
6
  "repository": {
@@ -72,7 +72,7 @@
72
72
  "@zag-js/react": "^1.38.1",
73
73
  "@zag-js/remove-scroll": "^1.38.1",
74
74
  "ai": "6.0.44",
75
- "altcha-lib": "^1.2.0",
75
+ "altcha": "^3.0.9",
76
76
  "aria-hidden": "^1.2.4",
77
77
  "class-variance-authority": "0.7.1",
78
78
  "clsx": "2.1.1",