@inkeep/cxkit-primitives 0.5.58 → 0.5.59

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.
Files changed (17) hide show
  1. package/dist/atoms/cmdk/index.cjs +1 -1
  2. package/dist/atoms/cmdk/index.js +1 -1
  3. package/dist/components/intelligent-form/actions/context-model-response.cjs +60 -4
  4. package/dist/components/intelligent-form/actions/context-model-response.js +65 -9
  5. package/dist/components/intelligent-form/actions/qa-model-messages.cjs +66 -14
  6. package/dist/components/intelligent-form/actions/qa-model-messages.js +67 -15
  7. package/dist/providers/base-events-provider.cjs +1 -1
  8. package/dist/providers/base-events-provider.js +1 -1
  9. package/dist/providers/chat-events-provider.cjs +1 -1
  10. package/dist/providers/chat-events-provider.js +21 -19
  11. package/package.json +4 -4
  12. /package/dist/node_modules/.pnpm/{use-sync-external-store@1.4.0_react@19.0.0 → use-sync-external-store@1.5.0_react@19.0.0}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs +0 -0
  13. /package/dist/node_modules/.pnpm/{use-sync-external-store@1.4.0_react@19.0.0 → use-sync-external-store@1.5.0_react@19.0.0}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -0
  14. /package/dist/node_modules/.pnpm/{use-sync-external-store@1.4.0_react@19.0.0 → use-sync-external-store@1.5.0_react@19.0.0}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.cjs +0 -0
  15. /package/dist/node_modules/.pnpm/{use-sync-external-store@1.4.0_react@19.0.0 → use-sync-external-store@1.5.0_react@19.0.0}/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -0
  16. /package/dist/node_modules/.pnpm/{use-sync-external-store@1.4.0_react@19.0.0 → use-sync-external-store@1.5.0_react@19.0.0}/node_modules/use-sync-external-store/shim/index.cjs +0 -0
  17. /package/dist/node_modules/.pnpm/{use-sync-external-store@1.4.0_react@19.0.0 → use-sync-external-store@1.5.0_react@19.0.0}/node_modules/use-sync-external-store/shim/index.js +0 -0
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),D=require("../dialog.cjs"),G=require("react"),je=require("./command-score.cjs"),I=require("@radix-ui/react-primitive"),q=require("@radix-ui/react-id"),Pe=require("../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs"),Ae=require("../../constants/search.cjs"),_e=require("../../utils/compose-event-handlers.cjs"),Me=require("../../providers/widget-provider.cjs"),Le=require("../shadow/context.cjs");function Oe(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const c=Oe(G),O='[cmdk-group=""]',ee='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',de='[cmdk-item=""]',ae=`${de}:not([aria-disabled="true"])`,te="cmdk-item-select",_="data-value",fe=(t,n,r)=>je.commandScore(t,n,r??[]),me=c.createContext(void 0),V=()=>c.useContext(me),ve=c.createContext(void 0),K=()=>c.useContext(ve),he=c.createContext(void 0),re=c.forwardRef((t,n)=>{const r=M(()=>new Set),s=M(()=>new Map),a=M(()=>new Map),f=M(()=>new Set),i=we(t),{label:h,children:d,value:S,onValueChange:E,filter:w,shouldFilter:C,loop:y,disablePointerSelection:A=!1,vimBindings:B=!0,defaultSearch:ne,...$}=t,g=M(()=>({search:ne??"",value:t.value??t.defaultValue??"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),U=q.useId(),z=q.useId(),H=q.useId(),R=c.useRef(null),b=Ge();j(()=>{if(S!==void 0){const e=S.trim();g.current.value=e,x.emit()}},[S]),j(()=>{b(6,ce)},[]);const F=Le.useShadow(),x=c.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>g.current,setState:(e,l,o)=>{if(!Object.is(g.current[e],l)){if(g.current[e]=l,e==="search")X(),J(),b(1,Q);else if(e==="value"&&(F?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input")||b(1,()=>{k()?.focus()}),b(7,()=>{g.current.selectedItemId=k()?.id,x.emit()}),o||b(5,ce),i.current?.value!==void 0)){const p=l??"";i.current.onValueChange?.(p);return}x.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),W=c.useMemo(()=>({value:(e,l,o)=>{l!==a.current.get(e)?.value&&(a.current.set(e,{value:l,keywords:o}),g.current.filtered.items.set(e,oe(l,o)),b(2,()=>{J(),x.emit()}))},item:(e,l)=>(r.current.add(e),l&&(s.current.has(l)?s.current?.get(l)?.add(e):s.current.set(l,new Set([e]))),b(3,()=>{X(),J(),g.current.value||Q(),x.emit()}),()=>{a.current.delete(e),r.current.delete(e),g.current.filtered.items.delete(e);const o=k();b(4,()=>{X(),o?.getAttribute("id")===e&&Q(),x.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{a.current.delete(e),s.current.delete(e)}),filter:()=>!!i.current.shouldFilter,label:h||t["aria-label"]||"",getDisablePointerSelection:()=>!!i.current.disablePointerSelection,listId:U,inputId:H,labelId:z,listInnerRef:R}),[]);function oe(e,l){const o=i.current?.filter??fe;return e?o?.(e,g.current.search,l):0}function J(){if(!g.current.search||i.current.shouldFilter===!1)return;const e=g.current.filtered.items,l=[];g.current.filtered.groups.forEach(u=>{const m=s.current.get(u);let p=0;m.forEach(Z=>{const ke=e.get(Z);p=Math.max(ke,p)}),l.push([u,p])});const o=R.current;L().sort((u,m)=>{const p=u.getAttribute("id"),Z=m.getAttribute("id");return(e.get(Z)??0)-(e.get(p)??0)}).forEach(u=>{const m=u.closest(ee);if(m){const p=u.parentElement===m?u:u.closest(`${ee} > *`);p&&m.appendChild(p)}else{const p=u.parentElement===o?u:u.closest(`${ee} > *`);p&&o?.appendChild(p)}}),l.sort((u,m)=>m[1]-u[1]).forEach(u=>{const m=R.current?.querySelector(`${O}[${_}="${encodeURIComponent(u[0])}"]`);m?.parentElement?.appendChild(m)})}function Q(){const l=L().find(o=>o.getAttribute("aria-disabled")!=="true"&&o.getAttribute("data-value")!==Ae.ASK_AI_TRIGGER_VALUE)?.getAttribute(_);x.setState("value",l||void 0)}function X(){if(!g.current.search||i.current.shouldFilter===!1){g.current.filtered.count=r.current.size;return}g.current.filtered.groups=new Set;let e=0;for(const l of r.current){const o=a.current.get(l)?.value??"",u=a.current.get(l)?.keywords??[],m=oe(o,u);g.current.filtered.items.set(l,m),m>0&&e++}for(const[l,o]of s.current)for(const u of o){const m=g.current.filtered.items.get(u);if(m&&m>0){g.current.filtered.groups.add(l);break}}g.current.filtered.count=e}function ce(){const e=k();e&&(e.parentElement?.firstChild===e&&e.closest(O)?.querySelector(qe)?.scrollIntoView({block:"nearest"}),e.scrollIntoView({block:"nearest"}))}function k(){return R.current?.querySelector(`${de}[aria-selected="true"]`)}function L(){return Array.from(R.current?.querySelectorAll(ae)||[])}function se(e){const o=L()[e];o&&x.setState("value",o.getAttribute(_))}function Y(e){const l=k(),o=L(),u=o.findIndex(p=>p===l);let m=o[u+e];i.current?.loop&&(m=u+e<0?o[o.length-1]:u+e===o.length?o[0]:o[u+e]),m&&x.setState("value",m.getAttribute(_))}function ie(e){let o=k()?.closest(O),u;for(;o&&!u;)o=e>0?Fe(o,O):De(o,O),u=o?.querySelector(ae);u?x.setState("value",u.getAttribute(_)):Y(e)}const Ie=()=>se(L().length-1),le=e=>{e.preventDefault(),e.metaKey?Ie():e.altKey?ie(1):Y(1)},ue=e=>{e.preventDefault(),e.metaKey?se(0):e.altKey?ie(-1):Y(-1)},Re=Me.useWidget();return v.jsxs(I.Primitive.div,{ref:n,tabIndex:-1,...$,"cmdk-root":"",onKeyDown:e=>{if(Re?.view==="search"&&($.onKeyDown?.(e),!e.defaultPrevented))switch(e.key){case"n":case"j":{B&&e.ctrlKey&&le(e);break}case"ArrowDown":{le(e);break}case"p":case"k":{B&&e.ctrlKey&&ue(e);break}case"ArrowUp":{ue(e);break}case"Enter":if(!e.nativeEvent.isComposing&&e.keyCode!==229){e.preventDefault();const l=k();if(l){const o=new Event(te);l.dispatchEvent(o)}}}},style:{display:"contents"},children:[v.jsx("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:Ne,children:h}),N(t,e=>v.jsx(ve.Provider,{value:x,children:v.jsx(me.Provider,{value:W,children:e})}))]})}),ge=c.forwardRef((t,n)=>{const{id:r}=t,s=c.useRef(null),a=c.useContext(he),f=V(),i=we(t),h=i.current?.forceMount??a?.forceMount;j(()=>{if(!h)return f.item(r,a?.id)},[h]);const d=ye(r,s,[t.value,t.children,s],t.keywords),S=K(),E=P(b=>b.value&&b.value===d.current),w=P(b=>h||f.filter()===!1?!0:b.search?b.filtered.items.get(r)>0:!0);c.useEffect(()=>{const b=s.current;if(!b||t.disabled)return;const F=()=>y("keyboard");return b.addEventListener(te,F),()=>b.removeEventListener(te,F)},[w,t.onSelect,t.disabled]);const C=G.useCallback(()=>{S.setState("value",d.current,!0)},[S,d]),y=G.useCallback((b="click")=>{C(),i.current.onSelect?.({value:d.current,trigger:b})},[C,i,d]);if(!w)return null;const{disabled:A,value:B,onSelect:ne,forceMount:$,keywords:g,onClick:U,...z}=t,H=G.useMemo(()=>T([s,n]),[s,n]),R=_e.composeEventHandlers(U,y);return v.jsx(I.Primitive.div,{ref:H,...z,id:r,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!E,"data-disabled":!!A,"data-selected":!!E,onPointerMove:A||f.getDisablePointerSelection()?void 0:C,onClick:A?void 0:R,onFocus:A?void 0:C,children:t.children})}),Te=c.forwardRef((t,n)=>{const{heading:r,children:s,forceMount:a,...f}=t,i=q.useId(),h=c.useRef(null),d=c.useRef(null),S=q.useId(),E=V(),w=P(y=>a||E.filter()===!1?!0:y.search?y.filtered.groups.has(i):!0);j(()=>E.group(i),[]),ye(i,h,[t.value,t.heading,d]);const C=c.useMemo(()=>({id:i,forceMount:a}),[a]);return v.jsxs(I.Primitive.div,{ref:T([h,n]),...f,"cmdk-group":"",role:"presentation",hidden:w?void 0:!0,children:[r&&v.jsx("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:S,children:r}),N(t,y=>v.jsx("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?S:void 0,children:v.jsx(he.Provider,{value:C,children:y})}))]})}),be=c.forwardRef((t,n)=>{const{alwaysRender:r,...s}=t,a=c.useRef(null),f=P(i=>!i.search);return!r&&!f?null:v.jsx(I.Primitive.div,{ref:T([a,n]),...s,"cmdk-separator":"",role:"separator"})}),pe=c.forwardRef((t,n)=>{const{onValueChange:r,...s}=t,a=t.value!=null,f=K(),i=P(d=>d.search),h=V();return c.useEffect(()=>{t.value!=null&&f.setState("search",t.value)},[t.value]),v.jsx(I.Primitive.input,{ref:n,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,id:h.inputId,type:"text",value:a?t.value:i,onChange:d=>{a||f.setState("search",d.target.value),r?.(d.target.value)}})}),Se=c.forwardRef((t,n)=>{const{children:r,label:s="Suggestions",...a}=t,f=c.useRef(null),i=c.useRef(null),h=V();return c.useEffect(()=>{if(i.current&&f.current){const d=i.current,S=f.current;let E;const w=new ResizeObserver(()=>{E=requestAnimationFrame(()=>{const C=d.offsetHeight;S.style.setProperty("--cmdk-list-height",C.toFixed(1)+"px")})});return w.observe(d),()=>{cancelAnimationFrame(E),w.unobserve(d)}}},[]),v.jsx(I.Primitive.div,{ref:T([f,n]),...a,"cmdk-list":"",tabIndex:-1,"aria-label":s,id:h.listId,children:N(t,d=>v.jsx("div",{ref:T([i,h.listInnerRef]),"cmdk-list-sizer":"",children:d}))})}),xe=c.forwardRef((t,n)=>{const{open:r,onOpenChange:s,overlayClassName:a,contentClassName:f,container:i,...h}=t;return v.jsx(D.Root,{open:r,onOpenChange:s,children:v.jsxs(D.Portal,{container:i,children:[v.jsx(D.Overlay,{"cmdk-overlay":"",className:a}),v.jsx(D.Content,{"aria-label":t.label,"cmdk-dialog":"",className:f,children:v.jsx(re,{ref:n,...h})})]})})}),Ee=c.forwardRef((t,n)=>P(s=>s.filtered.count===0)?v.jsx(I.Primitive.div,{ref:n,...t,"cmdk-empty":"",role:"presentation"}):null),Ce=c.forwardRef((t,n)=>{const{progress:r,children:s,label:a="Loading...",...f}=t;return v.jsx(I.Primitive.div,{ref:n,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a,children:N(t,i=>v.jsx("div",{"aria-hidden":!0,children:i}))})}),Ve=Object.assign(re,{List:Se,Item:ge,Input:pe,Group:Te,Separator:be,Dialog:xe,Empty:Ee,Loading:Ce});function Fe(t,n){let r=t.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function De(t,n){let r=t.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function we(t){const n=c.useRef(t);return j(()=>{n.current=t}),n}const j=typeof window>"u"?c.useEffect:c.useLayoutEffect;function M(t){const n=c.useRef(void 0);return n.current===void 0&&(n.current=t()),n}function T(t){return n=>{t.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}function P(t){const n=K(),r=()=>t(n.snapshot());return Pe.shimExports.useSyncExternalStore(n.subscribe,r,r)}function ye(t,n,r,s=[]){const a=c.useRef(void 0),f=V();return j(()=>{const i=(()=>{for(const d of r){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?d.current.textContent?.trim():a.current}})(),h=s.map(d=>d.trim());f.value(t,i,h),n.current?.setAttribute(_,i),a.current=i}),a}const Ge=()=>{const[t,n]=c.useState(),r=M(()=>new Map);return j(()=>{r.current.forEach(s=>s()),r.current=new Map},[t]),(s,a)=>{r.current.set(s,a),n({})}};function Ke(t){const n=t.type;return typeof n=="function"?n(t.props):"render"in n?n.render(t.props):t}function N({asChild:t,children:n},r){return t&&c.isValidElement(n)?c.cloneElement(Ke(n),{ref:n.ref},r(n.props.children)):r(n)}const Ne={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};exports.Command=Ve;exports.CommandDialog=xe;exports.CommandEmpty=Ee;exports.CommandInput=pe;exports.CommandItem=ge;exports.CommandList=Se;exports.CommandLoading=Ce;exports.CommandRoot=re;exports.CommandSeparator=be;exports.defaultFilter=fe;exports.useCommandState=P;exports.useCommandStore=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),D=require("../dialog.cjs"),G=require("react"),je=require("./command-score.cjs"),I=require("@radix-ui/react-primitive"),q=require("@radix-ui/react-id"),Pe=require("../../node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.cjs"),Ae=require("../../constants/search.cjs"),_e=require("../../utils/compose-event-handlers.cjs"),Me=require("../../providers/widget-provider.cjs"),Le=require("../shadow/context.cjs");function Oe(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>t[r]})}}return n.default=t,Object.freeze(n)}const c=Oe(G),O='[cmdk-group=""]',ee='[cmdk-group-items=""]',qe='[cmdk-group-heading=""]',de='[cmdk-item=""]',ae=`${de}:not([aria-disabled="true"])`,te="cmdk-item-select",_="data-value",fe=(t,n,r)=>je.commandScore(t,n,r??[]),me=c.createContext(void 0),V=()=>c.useContext(me),ve=c.createContext(void 0),K=()=>c.useContext(ve),he=c.createContext(void 0),re=c.forwardRef((t,n)=>{const r=M(()=>new Set),s=M(()=>new Map),a=M(()=>new Map),f=M(()=>new Set),i=we(t),{label:h,children:d,value:S,onValueChange:E,filter:w,shouldFilter:C,loop:y,disablePointerSelection:A=!1,vimBindings:B=!0,defaultSearch:ne,...$}=t,g=M(()=>({search:ne??"",value:t.value??t.defaultValue??"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),U=q.useId(),z=q.useId(),H=q.useId(),R=c.useRef(null),b=Ge();j(()=>{if(S!==void 0){const e=S.trim();g.current.value=e,x.emit()}},[S]),j(()=>{b(6,ce)},[]);const F=Le.useShadow(),x=c.useMemo(()=>({subscribe:e=>(f.current.add(e),()=>f.current.delete(e)),snapshot:()=>g.current,setState:(e,l,o)=>{if(!Object.is(g.current[e],l)){if(g.current[e]=l,e==="search")X(),J(),b(1,Q);else if(e==="value"&&(F?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("cmdk-input")||b(1,()=>{k()?.focus()}),b(7,()=>{g.current.selectedItemId=k()?.id,x.emit()}),o||b(5,ce),i.current?.value!==void 0)){const p=l??"";i.current.onValueChange?.(p);return}x.emit()}},emit:()=>{f.current.forEach(e=>e())}}),[]),W=c.useMemo(()=>({value:(e,l,o)=>{l!==a.current.get(e)?.value&&(a.current.set(e,{value:l,keywords:o}),g.current.filtered.items.set(e,oe(l,o)),b(2,()=>{J(),x.emit()}))},item:(e,l)=>(r.current.add(e),l&&(s.current.has(l)?s.current?.get(l)?.add(e):s.current.set(l,new Set([e]))),b(3,()=>{X(),J(),g.current.value||Q(),x.emit()}),()=>{a.current.delete(e),r.current.delete(e),g.current.filtered.items.delete(e);const o=k();b(4,()=>{X(),o?.getAttribute("id")===e&&Q(),x.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{a.current.delete(e),s.current.delete(e)}),filter:()=>!!i.current.shouldFilter,label:h||t["aria-label"]||"",getDisablePointerSelection:()=>!!i.current.disablePointerSelection,listId:U,inputId:H,labelId:z,listInnerRef:R}),[]);function oe(e,l){const o=i.current?.filter??fe;return e?o?.(e,g.current.search,l):0}function J(){if(!g.current.search||i.current.shouldFilter===!1)return;const e=g.current.filtered.items,l=[];g.current.filtered.groups.forEach(u=>{const m=s.current.get(u);let p=0;m.forEach(Z=>{const ke=e.get(Z);p=Math.max(ke,p)}),l.push([u,p])});const o=R.current;L().sort((u,m)=>{const p=u.getAttribute("id"),Z=m.getAttribute("id");return(e.get(Z)??0)-(e.get(p)??0)}).forEach(u=>{const m=u.closest(ee);if(m){const p=u.parentElement===m?u:u.closest(`${ee} > *`);p&&m.appendChild(p)}else{const p=u.parentElement===o?u:u.closest(`${ee} > *`);p&&o?.appendChild(p)}}),l.sort((u,m)=>m[1]-u[1]).forEach(u=>{const m=R.current?.querySelector(`${O}[${_}="${encodeURIComponent(u[0])}"]`);m?.parentElement?.appendChild(m)})}function Q(){const l=L().find(o=>o.getAttribute("aria-disabled")!=="true"&&o.getAttribute("data-value")!==Ae.ASK_AI_TRIGGER_VALUE)?.getAttribute(_);x.setState("value",l||void 0)}function X(){if(!g.current.search||i.current.shouldFilter===!1){g.current.filtered.count=r.current.size;return}g.current.filtered.groups=new Set;let e=0;for(const l of r.current){const o=a.current.get(l)?.value??"",u=a.current.get(l)?.keywords??[],m=oe(o,u);g.current.filtered.items.set(l,m),m>0&&e++}for(const[l,o]of s.current)for(const u of o){const m=g.current.filtered.items.get(u);if(m&&m>0){g.current.filtered.groups.add(l);break}}g.current.filtered.count=e}function ce(){const e=k();e&&(e.parentElement?.firstChild===e&&e.closest(O)?.querySelector(qe)?.scrollIntoView({block:"nearest"}),e.scrollIntoView({block:"nearest"}))}function k(){return R.current?.querySelector(`${de}[aria-selected="true"]`)}function L(){return Array.from(R.current?.querySelectorAll(ae)||[])}function se(e){const o=L()[e];o&&x.setState("value",o.getAttribute(_))}function Y(e){const l=k(),o=L(),u=o.findIndex(p=>p===l);let m=o[u+e];i.current?.loop&&(m=u+e<0?o[o.length-1]:u+e===o.length?o[0]:o[u+e]),m&&x.setState("value",m.getAttribute(_))}function ie(e){let o=k()?.closest(O),u;for(;o&&!u;)o=e>0?Fe(o,O):De(o,O),u=o?.querySelector(ae);u?x.setState("value",u.getAttribute(_)):Y(e)}const Ie=()=>se(L().length-1),le=e=>{e.preventDefault(),e.metaKey?Ie():e.altKey?ie(1):Y(1)},ue=e=>{e.preventDefault(),e.metaKey?se(0):e.altKey?ie(-1):Y(-1)},Re=Me.useWidget();return v.jsxs(I.Primitive.div,{ref:n,tabIndex:-1,...$,"cmdk-root":"",onKeyDown:e=>{if(Re?.view==="search"&&($.onKeyDown?.(e),!e.defaultPrevented))switch(e.key){case"n":case"j":{B&&e.ctrlKey&&le(e);break}case"ArrowDown":{le(e);break}case"p":case"k":{B&&e.ctrlKey&&ue(e);break}case"ArrowUp":{ue(e);break}case"Enter":if(!e.nativeEvent.isComposing&&e.keyCode!==229){e.preventDefault();const l=k();if(l){const o=new Event(te);l.dispatchEvent(o)}}}},style:{display:"contents"},children:[v.jsx("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:Ne,children:h}),N(t,e=>v.jsx(ve.Provider,{value:x,children:v.jsx(me.Provider,{value:W,children:e})}))]})}),ge=c.forwardRef((t,n)=>{const{id:r}=t,s=c.useRef(null),a=c.useContext(he),f=V(),i=we(t),h=i.current?.forceMount??a?.forceMount;j(()=>{if(!h)return f.item(r,a?.id)},[h]);const d=ye(r,s,[t.value,t.children,s],t.keywords),S=K(),E=P(b=>b.value&&b.value===d.current),w=P(b=>h||f.filter()===!1?!0:b.search?b.filtered.items.get(r)>0:!0);c.useEffect(()=>{const b=s.current;if(!b||t.disabled)return;const F=()=>y("keyboard");return b.addEventListener(te,F),()=>b.removeEventListener(te,F)},[w,t.onSelect,t.disabled]);const C=G.useCallback(()=>{S.setState("value",d.current,!0)},[S,d]),y=G.useCallback((b="click")=>{C(),i.current.onSelect?.({value:d.current,trigger:b})},[C,i,d]);if(!w)return null;const{disabled:A,value:B,onSelect:ne,forceMount:$,keywords:g,onClick:U,...z}=t,H=G.useMemo(()=>T([s,n]),[s,n]),R=_e.composeEventHandlers(U,y);return v.jsx(I.Primitive.div,{ref:H,...z,id:r,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!E,"data-disabled":!!A,"data-selected":!!E,onPointerMove:A||f.getDisablePointerSelection()?void 0:C,onClick:A?void 0:R,onFocus:A?void 0:C,children:t.children})}),Te=c.forwardRef((t,n)=>{const{heading:r,children:s,forceMount:a,...f}=t,i=q.useId(),h=c.useRef(null),d=c.useRef(null),S=q.useId(),E=V(),w=P(y=>a||E.filter()===!1?!0:y.search?y.filtered.groups.has(i):!0);j(()=>E.group(i),[]),ye(i,h,[t.value,t.heading,d]);const C=c.useMemo(()=>({id:i,forceMount:a}),[a]);return v.jsxs(I.Primitive.div,{ref:T([h,n]),...f,"cmdk-group":"",role:"presentation",hidden:w?void 0:!0,children:[r&&v.jsx("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:S,children:r}),N(t,y=>v.jsx("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?S:void 0,children:v.jsx(he.Provider,{value:C,children:y})}))]})}),be=c.forwardRef((t,n)=>{const{alwaysRender:r,...s}=t,a=c.useRef(null),f=P(i=>!i.search);return!r&&!f?null:v.jsx(I.Primitive.div,{ref:T([a,n]),...s,"cmdk-separator":"",role:"separator"})}),pe=c.forwardRef((t,n)=>{const{onValueChange:r,...s}=t,a=t.value!=null,f=K(),i=P(d=>d.search),h=V();return c.useEffect(()=>{t.value!=null&&f.setState("search",t.value)},[t.value]),v.jsx(I.Primitive.input,{ref:n,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,id:h.inputId,type:"text",value:a?t.value:i,onChange:d=>{a||f.setState("search",d.target.value),r?.(d.target.value)}})}),Se=c.forwardRef((t,n)=>{const{children:r,label:s="Suggestions",...a}=t,f=c.useRef(null),i=c.useRef(null),h=V();return c.useEffect(()=>{if(i.current&&f.current){const d=i.current,S=f.current;let E;const w=new ResizeObserver(()=>{E=requestAnimationFrame(()=>{const C=d.offsetHeight;S.style.setProperty("--cmdk-list-height",C.toFixed(1)+"px")})});return w.observe(d),()=>{cancelAnimationFrame(E),w.unobserve(d)}}},[]),v.jsx(I.Primitive.div,{ref:T([f,n]),...a,"cmdk-list":"",tabIndex:-1,"aria-label":s,id:h.listId,children:N(t,d=>v.jsx("div",{ref:T([i,h.listInnerRef]),"cmdk-list-sizer":"",children:d}))})}),xe=c.forwardRef((t,n)=>{const{open:r,onOpenChange:s,overlayClassName:a,contentClassName:f,container:i,...h}=t;return v.jsx(D.Root,{open:r,onOpenChange:s,children:v.jsxs(D.Portal,{container:i,children:[v.jsx(D.Overlay,{"cmdk-overlay":"",className:a}),v.jsx(D.Content,{"aria-label":t.label,"cmdk-dialog":"",className:f,children:v.jsx(re,{ref:n,...h})})]})})}),Ee=c.forwardRef((t,n)=>P(s=>s.filtered.count===0)?v.jsx(I.Primitive.div,{ref:n,...t,"cmdk-empty":"",role:"presentation"}):null),Ce=c.forwardRef((t,n)=>{const{progress:r,children:s,label:a="Loading...",...f}=t;return v.jsx(I.Primitive.div,{ref:n,...f,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a,children:N(t,i=>v.jsx("div",{"aria-hidden":!0,children:i}))})}),Ve=Object.assign(re,{List:Se,Item:ge,Input:pe,Group:Te,Separator:be,Dialog:xe,Empty:Ee,Loading:Ce});function Fe(t,n){let r=t.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function De(t,n){let r=t.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function we(t){const n=c.useRef(t);return j(()=>{n.current=t}),n}const j=typeof window>"u"?c.useEffect:c.useLayoutEffect;function M(t){const n=c.useRef(void 0);return n.current===void 0&&(n.current=t()),n}function T(t){return n=>{t.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}function P(t){const n=K(),r=()=>t(n.snapshot());return Pe.shimExports.useSyncExternalStore(n.subscribe,r,r)}function ye(t,n,r,s=[]){const a=c.useRef(void 0),f=V();return j(()=>{const i=(()=>{for(const d of r){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?d.current.textContent?.trim():a.current}})(),h=s.map(d=>d.trim());f.value(t,i,h),n.current?.setAttribute(_,i),a.current=i}),a}const Ge=()=>{const[t,n]=c.useState(),r=M(()=>new Map);return j(()=>{r.current.forEach(s=>s()),r.current=new Map},[t]),(s,a)=>{r.current.set(s,a),n({})}};function Ke(t){const n=t.type;return typeof n=="function"?n(t.props):"render"in n?n.render(t.props):t}function N({asChild:t,children:n},r){return t&&c.isValidElement(n)?c.cloneElement(Ke(n),{ref:n.ref},r(n.props.children)):r(n)}const Ne={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};exports.Command=Ve;exports.CommandDialog=xe;exports.CommandEmpty=Ee;exports.CommandInput=pe;exports.CommandItem=ge;exports.CommandList=Se;exports.CommandLoading=Ce;exports.CommandRoot=re;exports.CommandSeparator=be;exports.defaultFilter=fe;exports.useCommandState=P;exports.useCommandStore=K;
@@ -5,7 +5,7 @@ import { useCallback as le, useMemo as Ie } from "react";
5
5
  import { commandScore as Re } from "./command-score.js";
6
6
  import { Primitive as R } from "@radix-ui/react-primitive";
7
7
  import { useId as F } from "@radix-ui/react-id";
8
- import { s as ke } from "../../node_modules/.pnpm/use-sync-external-store@1.4.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
8
+ import { s as ke } from "../../node_modules/.pnpm/use-sync-external-store@1.5.0_react@19.0.0/node_modules/use-sync-external-store/shim/index.js";
9
9
  import { ASK_AI_TRIGGER_VALUE as xe } from "../../constants/search.js";
10
10
  import { composeEventHandlers as Ae } from "../../utils/compose-event-handlers.js";
11
11
  import { useWidget as _e } from "../../providers/widget-provider.js";
@@ -1,9 +1,65 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=async(t,o,s)=>{const i=JSON.stringify(t.primaryFieldValues,null,2),a=JSON.stringify(t.fieldsToGenerate,null,2),l=await o.chat.completions.create({model:"inkeep-base-expert",messages:[{role:"system",content:`You are a helpful assistant that suggests form field values based on context. You will receive form field information including field names, descriptions, input types, and available options for select fields.
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=async(t,o,i)=>{const n=JSON.stringify(t.primaryFieldValues,null,2),l=JSON.stringify(t.fieldsToGenerate,null,2),a=await o.chat.completions.create({model:"inkeep-base-expert",messages:[{role:"system",content:`You are a helpful assistant that suggests form field values based on context. You will receive form field information including field names, descriptions, input types, and available options for select fields.
2
2
 
3
3
  For each field, consider its description, input type, and available options (for select fields).
4
4
 
5
- You must respond with a JSON object where keys are the field names and values match the expected input type and length for that field.`},{role:"user",content:`Based on these primary field values:
6
- ${i}
5
+ You must respond with a JSON object where keys are the field names and values match the expected input type and length for that field.
6
+
7
+ <context>
8
+ You are quickly suggesting form field values on behalf of an end-user. Think of yourself as the user filling out this form - keep suggestions simple, direct, and user-centric.
9
+
10
+ You will receive:
11
+ - Field metadata (names, descriptions, types)
12
+ - For dropdown/select fields, their valid choice options
13
+ - Initial form field values as context
14
+ </context>
15
+
16
+ <guidance>
17
+ <rule>
18
+ <name>Field Value Suggestions</name>
19
+ <actions>
20
+ <action>
21
+ Return a JSON object where:
22
+ - Keys are field names
23
+ - Values must match field type requirements:
24
+ - Text fields: Plain text strings
25
+ - Dropdown/select fields: ONLY values from provided options list
26
+ - Number fields: Valid numbers
27
+ - Boolean fields: true/false
28
+
29
+ <good_example>
30
+ ✅ Example (fields will vary based on actual form configuration):
31
+ {
32
+ "issueType": "bug", // from options: ["bug", "feature", "question"]
33
+ "severity": "high", // from options: ["low", "medium", "high"]
34
+ "shortDescription": "Cannot log in to dashboard"
35
+ }
36
+ </good_example>
37
+
38
+ <bad_example>
39
+ ❌ Bad Example (using same illustrative fields):
40
+ {
41
+ "issueType": "not sure but maybe bug?", // invalid: not from options list
42
+ "severity": "very very high", // invalid: not from options list
43
+ "shortDescription": null // invalid: should be string
44
+ }
45
+ </bad_example>
46
+
47
+ Note: The actual field names, types and valid options will be provided in the form configuration.
48
+ Above examples are only illustrative of the expected format and validation rules.
49
+ </action>
50
+ </actions>
51
+ </rule>
52
+
53
+ <global_prohibitions>
54
+ <never>Include explanations or comments in the JSON</never>
55
+ <never>Suggest multiple values for a single field</never>
56
+ <never>Return values not from the provided options for dropdown/select fields</never>
57
+ <never>Skip required fields</never>
58
+ <never>Add fields not present in the input metadata</never>
59
+ <never>Overthink suggestions - keep them straightforward</never>
60
+ </global_prohibitions>
61
+ `},{role:"user",content:`Based on these primary field values:
62
+ ${n}
7
63
 
8
64
  Suggest values for these additional fields:
9
- ${a}`}],stream:!0,response_format:{type:"json_object"}},s?{headers:s}:void 0);let e="";for await(const r of l){const n=r.choices?.[0]?.delta?.content;n&&(e+=n)}return{suggestedValues:e?JSON.parse(e):{}}};exports.generateContextModelResponse=d;
65
+ ${l}`}],stream:!0,response_format:{type:"json_object"}},i?{headers:i}:void 0);let e="";for await(const r of a){const s=r.choices?.[0]?.delta?.content;s&&(e+=s)}return{suggestedValues:e?JSON.parse(e):{}}};exports.generateContextModelResponse=d;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- const d = async (t, o, s) => {
3
- const i = JSON.stringify(t.primaryFieldValues, null, 2), a = JSON.stringify(t.fieldsToGenerate, null, 2), l = await o.chat.completions.create(
2
+ const d = async (t, o, i) => {
3
+ const n = JSON.stringify(t.primaryFieldValues, null, 2), l = JSON.stringify(t.fieldsToGenerate, null, 2), a = await o.chat.completions.create(
4
4
  {
5
5
  model: "inkeep-base-expert",
6
6
  messages: [
@@ -10,15 +10,71 @@ const d = async (t, o, s) => {
10
10
 
11
11
  For each field, consider its description, input type, and available options (for select fields).
12
12
 
13
- You must respond with a JSON object where keys are the field names and values match the expected input type and length for that field.`
13
+ You must respond with a JSON object where keys are the field names and values match the expected input type and length for that field.
14
+
15
+ <context>
16
+ You are quickly suggesting form field values on behalf of an end-user. Think of yourself as the user filling out this form - keep suggestions simple, direct, and user-centric.
17
+
18
+ You will receive:
19
+ - Field metadata (names, descriptions, types)
20
+ - For dropdown/select fields, their valid choice options
21
+ - Initial form field values as context
22
+ </context>
23
+
24
+ <guidance>
25
+ <rule>
26
+ <name>Field Value Suggestions</name>
27
+ <actions>
28
+ <action>
29
+ Return a JSON object where:
30
+ - Keys are field names
31
+ - Values must match field type requirements:
32
+ - Text fields: Plain text strings
33
+ - Dropdown/select fields: ONLY values from provided options list
34
+ - Number fields: Valid numbers
35
+ - Boolean fields: true/false
36
+
37
+ <good_example>
38
+ ✅ Example (fields will vary based on actual form configuration):
39
+ {
40
+ "issueType": "bug", // from options: ["bug", "feature", "question"]
41
+ "severity": "high", // from options: ["low", "medium", "high"]
42
+ "shortDescription": "Cannot log in to dashboard"
43
+ }
44
+ </good_example>
45
+
46
+ <bad_example>
47
+ ❌ Bad Example (using same illustrative fields):
48
+ {
49
+ "issueType": "not sure but maybe bug?", // invalid: not from options list
50
+ "severity": "very very high", // invalid: not from options list
51
+ "shortDescription": null // invalid: should be string
52
+ }
53
+ </bad_example>
54
+
55
+ Note: The actual field names, types and valid options will be provided in the form configuration.
56
+ Above examples are only illustrative of the expected format and validation rules.
57
+ </action>
58
+ </actions>
59
+ </rule>
60
+
61
+ <global_prohibitions>
62
+ <never>Include explanations or comments in the JSON</never>
63
+ <never>Suggest multiple values for a single field</never>
64
+ <never>Return values not from the provided options for dropdown/select fields</never>
65
+ <never>Skip required fields</never>
66
+ <never>Add fields not present in the input metadata</never>
67
+ <never>Overthink suggestions - keep them straightforward</never>
68
+ </global_prohibitions>
69
+ `
14
70
  },
15
71
  {
16
72
  role: "user",
17
73
  content: `Based on these primary field values:
18
- ${i}
74
+ ${n}
19
75
 
20
76
  Suggest values for these additional fields:
21
- ${a}`
77
+ ${l}`
22
78
  }
23
79
  ],
24
80
  stream: !0,
@@ -27,12 +83,12 @@ ${a}`
27
83
  type: "json_object"
28
84
  }
29
85
  },
30
- s ? { headers: s } : void 0
86
+ i ? { headers: i } : void 0
31
87
  );
32
88
  let e = "";
33
- for await (const r of l) {
34
- const n = r.choices?.[0]?.delta?.content;
35
- n && (e += n);
89
+ for await (const r of a) {
90
+ const s = r.choices?.[0]?.delta?.content;
91
+ s && (e += s);
36
92
  }
37
93
  return {
38
94
  suggestedValues: e ? JSON.parse(e) : {}
@@ -1,27 +1,79 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=e=>{const o=JSON.stringify(e,null,2);return[{id:`${Date.now()}1`,role:"system",content:`
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=o=>{const e=JSON.stringify(o,null,2);return[{id:`${Date.now()}1`,role:"system",content:`
2
+ <context>
3
+ You are evaluating a support form submission to determine if an immediate solution can be provided. Your response is final and non-conversational - the user cannot respond or ask follow-ups. You must either provide a complete solution or explain why one cannot be provided.
4
+ </context>
2
5
  <guidance>
3
6
  <rule>
4
- <name>Direct Answer Provision</name>
7
+ <name>High Confidence Response</name>
5
8
  <conditions>
6
- <condition>When responding to form field inputs</condition>
9
+ <and>
10
+ <condition>Form provides clear, specific problem description</condition>
11
+ <condition>Authoritative information exists for this exact issue</condition>
12
+ <condition>Complete solution can be provided from available information</condition>
13
+ <condition>Solution requires no clarification or follow-up</condition>
14
+ </and>
7
15
  </conditions>
8
16
  <actions>
9
17
  <action>
10
- **Provide direct, complete answers** based solely on the form fields provided. Never ask follow-up questions or request additional information.
18
+ Provide complete solution in this format:
19
+ 1. State identified problem
20
+ 2. List solution steps
21
+ 3. Include any necessary implementation details
11
22
 
12
- ✅ Good Example:
13
- "Based on the provided information, the issue appears to be X. Here's how to resolve it..."
23
+ <good_example>
24
+ "To resolve [...paraphrased problem...], try [...solution steps]."
25
+ </good_example>
14
26
 
15
- ❌ Bad Example:
16
- "Could you provide more details about...?" or "Would you like me to explain...?"
27
+ <bad_example>
28
+ "I think this might be related to [problem]. Would you like me to explain more about...? If you could clarify [X], I could better assist..."
29
+ </bad_example>
17
30
 
18
- Guidelines:
19
- - Always provide the best possible answer with available information
20
- - Never use phrases like "would you like" or "do you need"
21
- - Focus on actionable solutions rather than gathering more information
22
- - Maintain a professional, direct tone throughout the response
31
+ <guidance>
32
+ <should>Use only information from form fields</should>
33
+ <should>State solution directly and completely</should>
34
+ <should>Include all necessary steps</should>
35
+ <should>Maintain professional, instructional tone</should>
36
+ </guidance>
23
37
  </action>
24
38
  </actions>
25
39
  </rule>
40
+ <rule>
41
+ <name>Low Confidence Response</name>
42
+ <conditions>
43
+ <or>
44
+ <condition>Problem description is unclear/ambiguous</condition>
45
+ <condition>Authoritative information is missing</condition>
46
+ <condition>Solution would require additional details</condition>
47
+ <condition>Cannot provide complete confidence in solution</condition>
48
+ </or>
49
+ </conditions>
50
+ <actions>
51
+ <action>
52
+ Provide single-sentence explanation focusing on specific information gap.
53
+
54
+ <good_example>
55
+ "The information sources don't cover [specific detail[s]]"
56
+ </good_example>
57
+
58
+ <bad_example>
59
+ "I'm not entirely sure about this, but here are some possibilities... Could you provide more details about [X]? Have you tried [Y]? It might also help if..."
60
+ </bad_example>
61
+
62
+ <guidance>
63
+ <should>State only the primary information gap</should>
64
+ <should>Keep explanation BRIEF and specific</should>
65
+ <should>Focus on what's missing, not what's known</should>
66
+ </guidance>
67
+ </action>
68
+ </actions>
69
+ </rule>
70
+ <global_prohibitions>
71
+ <never>Ask questions or request clarification</never>
72
+ <never>Use conditional phrases ("would you like", "do you need")</never>
73
+ <never>Suggest contacting support</never>
74
+ <never>Provide partial or uncertain solutions</never>
75
+ <never>Offer multiple possible solutions</never>
76
+ <never>Speculate beyond available information</never>
77
+ </global_prohibitions>
26
78
  </guidance>
27
- `},{id:`${Date.now()}2`,role:"user",content:`${o}`}]};exports.getQAModelMessages=i;
79
+ `},{id:`${Date.now()}2`,role:"user",content:`${e}`}]};exports.getQAModelMessages=i;
@@ -1,42 +1,94 @@
1
1
  "use client";
2
- const n = (e) => {
3
- const o = JSON.stringify(e, null, 2);
2
+ const n = (o) => {
3
+ const e = JSON.stringify(o, null, 2);
4
4
  return [
5
5
  {
6
6
  id: `${Date.now()}1`,
7
7
  role: "system",
8
8
  content: `
9
+ <context>
10
+ You are evaluating a support form submission to determine if an immediate solution can be provided. Your response is final and non-conversational - the user cannot respond or ask follow-ups. You must either provide a complete solution or explain why one cannot be provided.
11
+ </context>
9
12
  <guidance>
10
13
  <rule>
11
- <name>Direct Answer Provision</name>
14
+ <name>High Confidence Response</name>
12
15
  <conditions>
13
- <condition>When responding to form field inputs</condition>
16
+ <and>
17
+ <condition>Form provides clear, specific problem description</condition>
18
+ <condition>Authoritative information exists for this exact issue</condition>
19
+ <condition>Complete solution can be provided from available information</condition>
20
+ <condition>Solution requires no clarification or follow-up</condition>
21
+ </and>
14
22
  </conditions>
15
23
  <actions>
16
24
  <action>
17
- **Provide direct, complete answers** based solely on the form fields provided. Never ask follow-up questions or request additional information.
25
+ Provide complete solution in this format:
26
+ 1. State identified problem
27
+ 2. List solution steps
28
+ 3. Include any necessary implementation details
18
29
 
19
- ✅ Good Example:
20
- "Based on the provided information, the issue appears to be X. Here's how to resolve it..."
30
+ <good_example>
31
+ "To resolve [...paraphrased problem...], try [...solution steps]."
32
+ </good_example>
21
33
 
22
- ❌ Bad Example:
23
- "Could you provide more details about...?" or "Would you like me to explain...?"
34
+ <bad_example>
35
+ "I think this might be related to [problem]. Would you like me to explain more about...? If you could clarify [X], I could better assist..."
36
+ </bad_example>
24
37
 
25
- Guidelines:
26
- - Always provide the best possible answer with available information
27
- - Never use phrases like "would you like" or "do you need"
28
- - Focus on actionable solutions rather than gathering more information
29
- - Maintain a professional, direct tone throughout the response
38
+ <guidance>
39
+ <should>Use only information from form fields</should>
40
+ <should>State solution directly and completely</should>
41
+ <should>Include all necessary steps</should>
42
+ <should>Maintain professional, instructional tone</should>
43
+ </guidance>
30
44
  </action>
31
45
  </actions>
32
46
  </rule>
47
+ <rule>
48
+ <name>Low Confidence Response</name>
49
+ <conditions>
50
+ <or>
51
+ <condition>Problem description is unclear/ambiguous</condition>
52
+ <condition>Authoritative information is missing</condition>
53
+ <condition>Solution would require additional details</condition>
54
+ <condition>Cannot provide complete confidence in solution</condition>
55
+ </or>
56
+ </conditions>
57
+ <actions>
58
+ <action>
59
+ Provide single-sentence explanation focusing on specific information gap.
60
+
61
+ <good_example>
62
+ "The information sources don't cover [specific detail[s]]"
63
+ </good_example>
64
+
65
+ <bad_example>
66
+ "I'm not entirely sure about this, but here are some possibilities... Could you provide more details about [X]? Have you tried [Y]? It might also help if..."
67
+ </bad_example>
68
+
69
+ <guidance>
70
+ <should>State only the primary information gap</should>
71
+ <should>Keep explanation BRIEF and specific</should>
72
+ <should>Focus on what's missing, not what's known</should>
73
+ </guidance>
74
+ </action>
75
+ </actions>
76
+ </rule>
77
+ <global_prohibitions>
78
+ <never>Ask questions or request clarification</never>
79
+ <never>Use conditional phrases ("would you like", "do you need")</never>
80
+ <never>Suggest contacting support</never>
81
+ <never>Provide partial or uncertain solutions</never>
82
+ <never>Offer multiple possible solutions</never>
83
+ <never>Speculate beyond available information</never>
84
+ </global_prohibitions>
33
85
  </guidance>
34
86
  `
35
87
  },
36
88
  {
37
89
  id: `${Date.now()}2`,
38
90
  role: "user",
39
- content: `${o}`
91
+ content: `${e}`
40
92
  }
41
93
  ];
42
94
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.58",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.59",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
@@ -7,7 +7,7 @@ import { useUser as b } from "./user-provider.js";
7
7
  const u = x(void 0), U = ({ children: e }) => {
8
8
  const { baseSettings: t, componentType: n } = C(), { apiKey: s, analyticsApiBaseUrl: r, tags: i, privacyPreferences: l, env: E } = t, { userProperties: a } = b(), c = g(
9
9
  () => ({
10
- widgetLibraryVersion: "0.5.58",
10
+ widgetLibraryVersion: "0.5.59",
11
11
  componentType: n,
12
12
  tags: i
13
13
  }),
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("react"),j=require("../atoms/api/analytics/conversation.cjs"),w=require("./config-provider.cjs"),B=require("./conversation-provider.cjs"),k=require("./user-provider.cjs"),f=require("./base-events-provider.cjs"),g=t.createContext(void 0),b=({children:e})=>{const{baseSettings:x}=w.useInkeepConfig(),{apiKey:C,analyticsApiBaseUrl:d,tags:E,privacyPreferences:{optOutAllAnalytics:i},env:a}=x,{userProperties:h}=k.useUser(),{logEvent:p}=f.useBaseEvents(),{conversation:c,setConversation:y}=B.useInkeepConversation(),v=t.useRef(c);t.useEffect(()=>{v.current=c},[c]);const u=t.useCallback(async n=>{const s=v.current,r=!i&&a!=="development";let o=Object.assign({},s,{messages:n});if(r){const P=await j.logConversation(s.id,{messages:n,tags:E,userProperties:h},C,d);P&&(o=P)}return o},[d,C,E,h,i,a]),q={logEvent:t.useCallback(async(n,s)=>{let r=v.current;s&&(r=await u(s),y(r));const o={...n,properties:{conversation:r,...n.properties}};p(o)},[p,u,i,a]),logConversation:u};return l.jsx(g.Provider,{value:q,children:e})},A=({children:e})=>l.jsx(f.BaseEventsProvider,{children:l.jsx(b,{children:e})}),O=()=>{const e=t.useContext(g);if(!e)throw new Error("useChatEvents must be used within a ChatEventsProvider");return e};exports.ChatEventsProvider=b;exports.ChatEventsProviderWithBase=A;exports.useChatEvents=O;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("react"),j=require("../atoms/api/analytics/conversation.cjs"),w=require("./config-provider.cjs"),B=require("./conversation-provider.cjs"),k=require("./user-provider.cjs"),g=require("./base-events-provider.cjs"),U=require("../utils/generate-uid.cjs"),f=t.createContext(void 0),b=({children:e})=>{const{baseSettings:q}=w.useInkeepConfig(),{apiKey:d,analyticsApiBaseUrl:C,tags:E,privacyPreferences:{optOutAllAnalytics:i},env:a}=q,{userProperties:h}=k.useUser(),{logEvent:p}=g.useBaseEvents(),{conversation:c,setConversation:x}=B.useInkeepConversation(),v=t.useRef(c);t.useEffect(()=>{v.current=c},[c]);const u=t.useCallback(async n=>{const r=v.current,s=!i&&a!=="development";let o=Object.assign({},r,{messages:n});if(s){const P=await j.logConversation(r.id,{messages:n,tags:E,userProperties:h},d,C);P&&(o=P)}else o.id="conv_"+U.generateUid(16);return o},[C,d,E,h,i,a]),y={logEvent:t.useCallback(async(n,r)=>{let s=v.current;r&&(s=await u(r),x(s));const o={...n,properties:{conversation:s,...n.properties}};p(o)},[p,u,i,a]),logConversation:u};return l.jsx(f.Provider,{value:y,children:e})},A=({children:e})=>l.jsx(g.BaseEventsProvider,{children:l.jsx(b,{children:e})}),O=()=>{const e=t.useContext(f);if(!e)throw new Error("useChatEvents must be used within a ChatEventsProvider");return e};exports.ChatEventsProvider=b;exports.ChatEventsProviderWithBase=A;exports.useChatEvents=O;
@@ -1,28 +1,29 @@
1
1
  "use client";
2
2
  import { jsx as u } from "react/jsx-runtime";
3
- import { useRef as y, useEffect as w, useCallback as h, createContext as b, useContext as B } from "react";
3
+ import { useRef as y, useEffect as w, useCallback as E, createContext as b, useContext as B } from "react";
4
4
  import { logConversation as k } from "../atoms/api/analytics/conversation.js";
5
5
  import { useInkeepConfig as A } from "./config-provider.js";
6
- import { useInkeepConversation as j } from "./conversation-provider.js";
7
- import { useUser as I } from "./user-provider.js";
8
- import { useBaseEvents as O, BaseEventsProvider as U } from "./base-events-provider.js";
9
- const m = b(void 0), K = ({ children: t }) => {
6
+ import { useInkeepConversation as U } from "./conversation-provider.js";
7
+ import { useUser as j } from "./user-provider.js";
8
+ import { useBaseEvents as I, BaseEventsProvider as O } from "./base-events-provider.js";
9
+ import { generateUid as K } from "../utils/generate-uid.js";
10
+ const h = b(void 0), L = ({ children: t }) => {
10
11
  const { baseSettings: g } = A(), {
11
12
  apiKey: p,
12
13
  analyticsApiBaseUrl: l,
13
14
  tags: C,
14
15
  privacyPreferences: { optOutAllAnalytics: s },
15
16
  env: i
16
- } = g, { userProperties: f } = I(), { logEvent: E } = O(), { conversation: a, setConversation: P } = j(), c = y(a);
17
+ } = g, { userProperties: f } = j(), { logEvent: d } = I(), { conversation: a, setConversation: P } = U(), c = y(a);
17
18
  w(() => {
18
19
  c.current = a;
19
20
  }, [a]);
20
- const v = h(
21
+ const v = E(
21
22
  async (e) => {
22
23
  const n = c.current, o = !s && i !== "development";
23
24
  let r = Object.assign({}, n, { messages: e });
24
25
  if (o) {
25
- const d = await k(
26
+ const m = await k(
26
27
  n.id,
27
28
  {
28
29
  messages: e,
@@ -32,13 +33,14 @@ const m = b(void 0), K = ({ children: t }) => {
32
33
  p,
33
34
  l
34
35
  );
35
- d && (r = d);
36
- }
36
+ m && (r = m);
37
+ } else
38
+ r.id = "conv_" + K(16);
37
39
  return r;
38
40
  },
39
41
  [l, p, C, f, s, i]
40
42
  ), x = {
41
- logEvent: h(
43
+ logEvent: E(
42
44
  async (e, n) => {
43
45
  let o = c.current;
44
46
  n && (o = await v(n), P(o));
@@ -49,21 +51,21 @@ const m = b(void 0), K = ({ children: t }) => {
49
51
  ...e.properties
50
52
  }
51
53
  };
52
- E(r);
54
+ d(r);
53
55
  },
54
- [E, v, s, i]
56
+ [d, v, s, i]
55
57
  ),
56
58
  logConversation: v
57
59
  };
58
- return /* @__PURE__ */ u(m.Provider, { value: x, children: t });
59
- }, F = ({ children: t }) => /* @__PURE__ */ u(U, { children: /* @__PURE__ */ u(K, { children: t }) }), G = () => {
60
- const t = B(m);
60
+ return /* @__PURE__ */ u(h.Provider, { value: x, children: t });
61
+ }, G = ({ children: t }) => /* @__PURE__ */ u(O, { children: /* @__PURE__ */ u(L, { children: t }) }), H = () => {
62
+ const t = B(h);
61
63
  if (!t)
62
64
  throw new Error("useChatEvents must be used within a ChatEventsProvider");
63
65
  return t;
64
66
  };
65
67
  export {
66
- K as ChatEventsProvider,
67
- F as ChatEventsProviderWithBase,
68
- G as useChatEvents
68
+ L as ChatEventsProvider,
69
+ G as ChatEventsProviderWithBase,
70
+ H as useChatEvents
69
71
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.5.58",
3
+ "version": "0.5.59",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -59,9 +59,9 @@
59
59
  "remark-gfm": "^4.0.1",
60
60
  "unist-util-visit": "^5.0.0",
61
61
  "use-sync-external-store": "^1.4.0",
62
- "@inkeep/cxkit-color-mode": "0.5.58",
63
- "@inkeep/cxkit-theme": "0.5.58",
64
- "@inkeep/cxkit-types": "0.5.58"
62
+ "@inkeep/cxkit-color-mode": "0.5.59",
63
+ "@inkeep/cxkit-theme": "0.5.59",
64
+ "@inkeep/cxkit-types": "0.5.59"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@biomejs/biome": "1.9.4",