@inkeep/agents-ui 0.0.0-dev-20260604220939 → 0.0.0-dev-20260604224637

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 +1 @@
1
- "use client";"use strict";var A=Object.create;var w=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var L=(r,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of S(n))!b.call(r,t)&&t!==e&&w(r,t,{get:()=>n[t],enumerable:!(o=P(n,t))||o.enumerable});return r};var C=(r,n,e)=>(e=r!=null?A(O(r)):{},L(n||!r||!r.__esModule?w(e,"default",{value:r,enumerable:!0}):e,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),h="[sentinel]",x=45e3,M=3e4,D=3,I=5,N=250,Y=4e3;let v=null;function F(){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(h,"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,c="mounted",s=!1,E=!1,u=null,i=null,a=0,m=!1;const R=d=>{const l=o;o=[];for(const p of l)p(d)},g=()=>{s||m||(t=void 0,c="resetting",e.reset?.(),e.verify?.())},_=()=>{u&&clearTimeout(u),u=setTimeout(()=>{u=null,!(!s||m)&&(s=!1,a=0,t=void 0,c="resetting",e.reset?.(),e.verify?.())},M)},y=d=>{const l=d.detail;if(l&&(c=l.state??c,l.state==="verified"&&l.payload&&(E=!0,a=0,t=l.payload,R(l.payload)),l.state==="error"))if(t=void 0,a++,a>=(E?I:D))R(void 0),s=!0,console.warn(h,`Sentinel unavailable after ${a} consecutive errors, requests will proceed without bot protection`),_();else{const T=Math.min(N*2**(a-1),Y);i&&clearTimeout(i),i=setTimeout(()=>{i=null,!(m||s)&&(c="resetting",e.reset?.(),e.verify?.())},T)}};return e.addEventListener("statechange",y),{getPayload:()=>{if(m||s)return Promise.resolve(void 0);if(t){const d=t;return t=void 0,g(),Promise.resolve(d)}return c==="verified"&&g(),new Promise(d=>{o.push(d),setTimeout(()=>{const l=o.indexOf(d);l!==-1&&(o.splice(l,1),d(void 0))},x)})},startNextSolve:g,destroy:()=>{m=!0,e.removeEventListener("statechange",y),u&&(clearTimeout(u),u=null),i&&(clearTimeout(i),i=null),R(void 0),n.remove()}}}const V=({baseUrl:r,appId:n,shouldBypassCaptcha:e=!1})=>{const o=f.useRef(null),t=f.useRef(null),c=f.useRef(!1),s=f.useCallback(()=>o.current?Promise.resolve():t.current?t.current:n?(t.current=F().then(()=>{if(!c.current&&!o.current){const i=`${r}/run/auth/sentinel/challenge?appId=${encodeURIComponent(n)}`;o.current=k(i)}}).catch(i=>{console.error(h,"failed to mount widget",i),t.current=null}),t.current):Promise.resolve(),[r,n]);f.useEffect(()=>{if(c.current=!1,!e)return s(),()=>{c.current=!0,o.current?.destroy(),o.current=null,t.current=null}},[e,s]);const E=f.useCallback(async()=>{if(e)return{};await s();const i=o.current;if(!i)return{};const a=await i.getPayload();return a?{"x-inkeep-challenge-solution":btoa(JSON.stringify({payload:a}))}:{}},[e,s]),u=f.useCallback(()=>{o.current?.startNextSolve()},[]);return{getCaptchaHeader:E,invalidate:u}};exports.useCaptcha=V;
1
+ "use client";"use strict";var A=Object.create;var w=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var L=(r,n,e,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of P(n))!O.call(r,t)&&t!==e&&w(r,t,{get:()=>n[t],enumerable:!(o=S(n,t))||o.enumerable});return r};var C=(r,n,e)=>(e=r!=null?A(b(r)):{},L(n||!r||!r.__esModule?w(e,"default",{value:r,enumerable:!0}):e,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),h="[sentinel]",x=45e3,M=3e4,N=3,D=5,F=250,I=4e3;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(h,"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"),e.setAttribute("configuration",JSON.stringify({disableAutoFocus:!0})),n.appendChild(e);let o=[],t,c="mounted",s=!1,E=!1,u=null,i=null,a=0,m=!1;const R=d=>{const l=o;o=[];for(const p of l)p(d)},g=()=>{s||m||(t=void 0,c="resetting",e.reset?.(),e.verify?.())},_=()=>{u&&clearTimeout(u),u=setTimeout(()=>{u=null,!(!s||m)&&(s=!1,a=0,t=void 0,c="resetting",e.reset?.(),e.verify?.())},M)},y=d=>{const l=d.detail;if(l&&(c=l.state??c,l.state==="verified"&&l.payload&&(E=!0,a=0,t=l.payload,R(l.payload)),l.state==="error"))if(t=void 0,a++,a>=(E?D:N))R(void 0),s=!0,console.warn(h,`Sentinel unavailable after ${a} consecutive errors, requests will proceed without bot protection`),_();else{const T=Math.min(F*2**(a-1),I);i&&clearTimeout(i),i=setTimeout(()=>{i=null,!(m||s)&&(c="resetting",e.reset?.(),e.verify?.())},T)}};return e.addEventListener("statechange",y),{getPayload:()=>{if(m||s)return Promise.resolve(void 0);if(t){const d=t;return t=void 0,g(),Promise.resolve(d)}return c==="verified"&&g(),new Promise(d=>{o.push(d),setTimeout(()=>{const l=o.indexOf(d);l!==-1&&(o.splice(l,1),d(void 0))},x)})},startNextSolve:g,destroy:()=>{m=!0,e.removeEventListener("statechange",y),u&&(clearTimeout(u),u=null),i&&(clearTimeout(i),i=null),R(void 0),n.remove()}}}const V=({baseUrl:r,appId:n,shouldBypassCaptcha:e=!1})=>{const o=f.useRef(null),t=f.useRef(null),c=f.useRef(!1),s=f.useCallback(()=>o.current?Promise.resolve():t.current?t.current:n?(t.current=Y().then(()=>{if(!c.current&&!o.current){const i=`${r}/run/auth/sentinel/challenge?appId=${encodeURIComponent(n)}`;o.current=k(i)}}).catch(i=>{console.error(h,"failed to mount widget",i),t.current=null}),t.current):Promise.resolve(),[r,n]);f.useEffect(()=>{if(c.current=!1,!e)return s(),()=>{c.current=!0,o.current?.destroy(),o.current=null,t.current=null}},[e,s]);const E=f.useCallback(async()=>{if(e)return{};await s();const i=o.current;if(!i)return{};const a=await i.getPayload();return a?{"x-inkeep-challenge-solution":btoa(JSON.stringify({payload:a}))}:{}},[e,s]),u=f.useCallback(()=>{o.current?.startNextSolve()},[]);return{getCaptchaHeader:E,invalidate:u}};exports.useCaptcha=V;
@@ -1,24 +1,24 @@
1
1
  "use client";
2
- import { useRef as g, useCallback as h, useEffect as A } from "react";
3
- const y = "[sentinel]", P = 45e3, S = 3e4, O = 3, L = 5, x = 250, b = 4e3;
2
+ import { useRef as R, useCallback as h, useEffect as A } from "react";
3
+ const y = "[sentinel]", P = 45e3, S = 3e4, O = 3, b = 5, L = 250, x = 4e3;
4
4
  let m = null;
5
- function C() {
5
+ function N() {
6
6
  return typeof customElements > "u" || customElements.get("altcha-widget") ? Promise.resolve() : m || (m = import("altcha").then(() => customElements.whenDefined("altcha-widget")).then(() => {
7
7
  }).catch((a) => {
8
8
  throw m = null, console.error(y, "failed to load altcha widget module", a), a instanceof Error ? a : new Error("Failed to load altcha widget module");
9
9
  }), m);
10
10
  }
11
- function D(a) {
11
+ function C(a) {
12
12
  const d = document.createElement("div");
13
13
  d.style.cssText = "position:fixed;left:-9999px;top:-9999px;width:0;height:0;overflow:hidden;pointer-events:none", document.body.appendChild(d);
14
14
  const e = document.createElement("altcha-widget");
15
- e.setAttribute("challenge", a), e.setAttribute("auto", "onload"), e.setAttribute("hidefooter", "true"), e.setAttribute("hidelogo", "true"), d.appendChild(e);
15
+ e.setAttribute("challenge", a), e.setAttribute("auto", "onload"), e.setAttribute("hidefooter", "true"), e.setAttribute("hidelogo", "true"), e.setAttribute("configuration", JSON.stringify({ disableAutoFocus: !0 })), d.appendChild(e);
16
16
  let n = [], t, l = "mounted", i = !1, E = !1, s = null, r = null, c = 0, f = !1;
17
17
  const v = (u) => {
18
18
  const o = n;
19
19
  n = [];
20
20
  for (const w of o) w(u);
21
- }, R = () => {
21
+ }, g = () => {
22
22
  i || f || (t = void 0, l = "resetting", e.reset?.(), e.verify?.());
23
23
  }, _ = () => {
24
24
  s && clearTimeout(s), s = setTimeout(() => {
@@ -27,15 +27,15 @@ function D(a) {
27
27
  }, p = (u) => {
28
28
  const o = u.detail;
29
29
  if (o && (l = o.state ?? l, o.state === "verified" && o.payload && (E = !0, c = 0, t = o.payload, v(o.payload)), o.state === "error"))
30
- if (t = void 0, c++, c >= (E ? L : O))
30
+ if (t = void 0, c++, c >= (E ? b : O))
31
31
  v(void 0), i = !0, console.warn(
32
32
  y,
33
33
  `Sentinel unavailable after ${c} consecutive errors, requests will proceed without bot protection`
34
34
  ), _();
35
35
  else {
36
36
  const T = Math.min(
37
- x * 2 ** (c - 1),
38
- b
37
+ L * 2 ** (c - 1),
38
+ x
39
39
  );
40
40
  r && clearTimeout(r), r = setTimeout(() => {
41
41
  r = null, !(f || i) && (l = "resetting", e.reset?.(), e.verify?.());
@@ -46,23 +46,23 @@ function D(a) {
46
46
  if (f || i) return Promise.resolve(void 0);
47
47
  if (t) {
48
48
  const u = t;
49
- return t = void 0, R(), Promise.resolve(u);
49
+ return t = void 0, g(), Promise.resolve(u);
50
50
  }
51
- return l === "verified" && R(), new Promise((u) => {
51
+ return l === "verified" && g(), new Promise((u) => {
52
52
  n.push(u), setTimeout(() => {
53
53
  const o = n.indexOf(u);
54
54
  o !== -1 && (n.splice(o, 1), u(void 0));
55
55
  }, P);
56
56
  });
57
- }, startNextSolve: R, destroy: () => {
57
+ }, startNextSolve: g, destroy: () => {
58
58
  f = !0, e.removeEventListener("statechange", p), s && (clearTimeout(s), s = null), r && (clearTimeout(r), r = null), v(void 0), d.remove();
59
59
  } };
60
60
  }
61
- const Y = ({ baseUrl: a, appId: d, shouldBypassCaptcha: e = !1 }) => {
62
- const n = g(null), t = g(null), l = g(!1), i = h(() => n.current ? Promise.resolve() : t.current ? t.current : d ? (t.current = C().then(() => {
61
+ const M = ({ baseUrl: a, appId: d, shouldBypassCaptcha: e = !1 }) => {
62
+ const n = R(null), t = R(null), l = R(!1), i = h(() => n.current ? Promise.resolve() : t.current ? t.current : d ? (t.current = N().then(() => {
63
63
  if (!l.current && !n.current) {
64
64
  const r = `${a}/run/auth/sentinel/challenge?appId=${encodeURIComponent(d)}`;
65
- n.current = D(r);
65
+ n.current = C(r);
66
66
  }
67
67
  }).catch((r) => {
68
68
  console.error(y, "failed to mount widget", r), t.current = null;
@@ -88,5 +88,5 @@ const Y = ({ baseUrl: a, appId: d, shouldBypassCaptcha: e = !1 }) => {
88
88
  return { getCaptchaHeader: E, invalidate: s };
89
89
  };
90
90
  export {
91
- Y as useCaptcha
91
+ M as useCaptcha
92
92
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),f=require("./utils.cjs");function y(g){const{defaultView:c="search",aiChatSettings:i,baseSettings:l,searchSettings:o,shouldAutoFocusInput:h=!0,onToggleView:S,onSelectAskAI:r,ref:R,...m}=g,s=t.useRef(null),w=f.composeRefs(s,i?.chatFunctionsRef),a=t.useRef(null),b=f.composeRefs(a,o?.searchFunctionsRef),d={...i,chatFunctionsRef:w},I={...o,searchFunctionsRef:b},[n,u]=t.useState(c),q=e=>{if(e.view==="chat"&&r){r({query:e.query,autoSubmit:e.autoSubmit});return}e.autoSubmit&&e.query&&s.current?.submitMessage(e.query),S?.(e),u(e.view)};return t.useImperativeHandle(R,()=>({setView:u})),t.useEffect(()=>{n==="chat"?s.current?.focusInput():a.current?.focusInput()},[n]),{config:{baseSettings:l,aiChatSettings:d,searchSettings:I},defaultView:c,view:n,setView:u,onToggleView:q,shouldAutoFocusInput:h,...m}}exports.useWidgetImpl=y;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),a=require("./utils.cjs");function p(f){const{defaultView:u="search",aiChatSettings:i,baseSettings:g,searchSettings:o,shouldAutoFocusInput:l=!0,onToggleView:h,ref:R,...S}=f,s=t.useRef(null),m=a.composeRefs(s,i?.chatFunctionsRef),r=t.useRef(null),d=a.composeRefs(r,o?.searchFunctionsRef),w={...i,chatFunctionsRef:m},I={...o,searchFunctionsRef:d},[n,c]=t.useState(u),b=e=>{e.autoSubmit&&e.query&&s.current?.submitMessage(e.query),h?.(e),c(e.view)};return t.useImperativeHandle(R,()=>({setView:c})),t.useEffect(()=>{n==="chat"?s.current?.focusInput():r.current?.focusInput()},[n]),{config:{baseSettings:g,aiChatSettings:w,searchSettings:I},defaultView:u,view:n,setView:c,onToggleView:b,shouldAutoFocusInput:l,...S}}exports.useWidgetImpl=p;
@@ -1,48 +1,43 @@
1
1
  "use client";
2
- import { useRef as a, useState as d, useImperativeHandle as q, useEffect as v } from "react";
3
- import { composeRefs as f } from "./utils.js";
4
- function T(g) {
2
+ import { useRef as r, useState as V, useImperativeHandle as d, useEffect as b } from "react";
3
+ import { composeRefs as a } from "./utils.js";
4
+ function _(f) {
5
5
  const {
6
6
  defaultView: c = "search",
7
- aiChatSettings: u,
8
- baseSettings: h,
9
- searchSettings: i,
10
- shouldAutoFocusInput: l = !0,
11
- onToggleView: S,
12
- onSelectAskAI: o,
7
+ aiChatSettings: i,
8
+ baseSettings: g,
9
+ searchSettings: o,
10
+ shouldAutoFocusInput: h = !0,
11
+ onToggleView: l,
13
12
  ref: m,
14
- ...w
15
- } = g, t = a(null), R = f(t, u?.chatFunctionsRef), r = a(null), I = f(r, i?.searchFunctionsRef), b = {
16
- ...u,
13
+ ...S
14
+ } = f, t = r(null), R = a(t, i?.chatFunctionsRef), u = r(null), w = a(u, o?.searchFunctionsRef), p = {
15
+ ...i,
17
16
  chatFunctionsRef: R
18
17
  }, F = {
19
- ...i,
20
- searchFunctionsRef: I
21
- }, [n, s] = d(c), V = (e) => {
22
- if (e.view === "chat" && o) {
23
- o({ query: e.query, autoSubmit: e.autoSubmit });
24
- return;
25
- }
26
- e.autoSubmit && e.query && t.current?.submitMessage(e.query), S?.(e), s(e.view);
18
+ ...o,
19
+ searchFunctionsRef: w
20
+ }, [n, s] = V(c), I = (e) => {
21
+ e.autoSubmit && e.query && t.current?.submitMessage(e.query), l?.(e), s(e.view);
27
22
  };
28
- return q(m, () => ({
23
+ return d(m, () => ({
29
24
  setView: s
30
- })), v(() => {
31
- n === "chat" ? t.current?.focusInput() : r.current?.focusInput();
25
+ })), b(() => {
26
+ n === "chat" ? t.current?.focusInput() : u.current?.focusInput();
32
27
  }, [n]), {
33
28
  config: {
34
- baseSettings: h,
35
- aiChatSettings: b,
29
+ baseSettings: g,
30
+ aiChatSettings: p,
36
31
  searchSettings: F
37
32
  },
38
33
  defaultView: c,
39
34
  view: n,
40
35
  setView: s,
41
- onToggleView: V,
42
- shouldAutoFocusInput: l,
43
- ...w
36
+ onToggleView: I,
37
+ shouldAutoFocusInput: h,
38
+ ...S
44
39
  };
45
40
  }
46
41
  export {
47
- T as useWidgetImpl
42
+ _ as useWidgetImpl
48
43
  };
@@ -12,27 +12,6 @@ export interface WidgetView {
12
12
  query?: string;
13
13
  autoSubmit?: boolean;
14
14
  }) => void;
15
- /**
16
- * Callback fired when the user selects "Ask AI" — via the Ask AI card or the
17
- * Search/Ask AI toggle — on a search-and-chat component.
18
- *
19
- * When provided, this replaces the default behavior of switching to the
20
- * component's internal chat view. The internal chat pane is not shown and no
21
- * message is submitted to it; instead the parent handles the Ask AI intent
22
- * (for example, closing the modal and opening a separate sidebar chat).
23
- *
24
- * `query` is the current search input, so the parent can autofill or submit it
25
- * in the destination chat.
26
- *
27
- * `autoSubmit` reflects the user's intent based on how they selected Ask AI:
28
- * `true` when they clicked the Ask AI card (a query-specific action), and
29
- * `false`/`undefined` when they used the Search/Ask AI toggle (a mode switch).
30
- * Honor it to decide between auto-submitting and only filling in the query.
31
- */
32
- onSelectAskAI?: (opts: {
33
- query?: string;
34
- autoSubmit?: boolean;
35
- }) => void;
36
15
  /**
37
16
  * The label for the Ask AI button.
38
17
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-ui",
3
- "version": "0.0.0-dev-20260604220939",
3
+ "version": "0.0.0-dev-20260604224637",
4
4
  "description": "",
5
5
  "homepage": "",
6
6
  "repository": {