@inkeep/open-knowledge 0.0.0-dev-20260430200817 → 0.0.0-dev-20260430210834

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 (50) hide show
  1. package/dist/cli.mjs +9 -9
  2. package/dist/config-schema.json +8 -8
  3. package/dist/{config.workspace.schema.json → config.project.schema.json} +8 -8
  4. package/dist/config.user.schema.json +1 -1
  5. package/dist/constants-B4FrIR2k.mjs +2 -0
  6. package/dist/{dist-CgDgVcCw.mjs → dist-BEzp6mq0.mjs} +5 -5
  7. package/dist/{dist-CyHmPByB.mjs → dist-CSvz1VhR.mjs} +5 -5
  8. package/dist/{dist-C0_lRjzY.mjs → dist-U4KUxqv5.mjs} +1 -1
  9. package/dist/index.mjs +1 -1
  10. package/dist/init-BvWk9L0l.mjs +1 -0
  11. package/dist/{init-CqtfodiN.mjs → init-CVdO533i.mjs} +3 -3
  12. package/dist/{init-CwMxEhFD.mjs → init-D3Yojchz.mjs} +4 -4
  13. package/dist/init-j-n5IaoD.mjs +1 -0
  14. package/dist/loader-BQtG8M0N.mjs +1 -0
  15. package/dist/{loader-BgemTDND.mjs → loader-BrMaEBLv.mjs} +2 -2
  16. package/dist/paths-BAtxOytY.mjs +1 -0
  17. package/dist/paths-D_9I0rqP.mjs +2 -0
  18. package/dist/{preview-CPS0Ztsq.mjs → preview--FteQTQh.mjs} +2 -2
  19. package/dist/preview-BupX_Sly.mjs +1 -0
  20. package/dist/public/assets/{ActivityModeContent-CIQZepq7.js → ActivityModeContent-bov_rWcZ.js} +1 -1
  21. package/dist/public/assets/{DocumentContext-3eBmZPWH.js → DocumentContext-rp4iBare.js} +1 -1
  22. package/dist/public/assets/{GraphPanel-T5dT_tWz.js → GraphPanel-aktIAtaE.js} +1 -1
  23. package/dist/public/assets/SettingsPane-C_udh7jE.js +5 -0
  24. package/dist/public/assets/{SourceEditor-B7t-PKKk.js → SourceEditor-CAF7dX-w.js} +1 -1
  25. package/dist/public/assets/{clipboard-ZBAkT6co.js → clipboard-4Z4wXNiz.js} +1 -1
  26. package/dist/public/assets/{config-validation-events-BChsSyYz.js → config-validation-events-_DHiCvOD.js} +1 -1
  27. package/dist/public/assets/{index-DyrPnwkR.js → index-CM0vP7md.js} +4 -4
  28. package/dist/public/assets/{target-navigation-intent-DNQiDIT9.js → target-navigation-intent-rQkR_SWG.js} +1 -1
  29. package/dist/public/assets/{toggle-group-Dn9Kc8gY.js → toggle-group-DUoJt_Lj.js} +4 -4
  30. package/dist/public/assets/{tooltip-DHY5QgRr.js → tooltip-CSwVg9kb.js} +1 -1
  31. package/dist/public/index.html +7 -7
  32. package/dist/schemas/v0/{config.workspace.schema.json → config.project.schema.json} +8 -8
  33. package/dist/schemas/v0/config.user.schema.json +1 -1
  34. package/dist/server-C3JdctFI.mjs +3 -0
  35. package/dist/src-CQ68SgUW.mjs +1 -0
  36. package/dist/start-CEPUzVDV.mjs +1 -0
  37. package/dist/{start-Bv4eE1v8.mjs → start-CihiZnI_.mjs} +2 -2
  38. package/package.json +1 -1
  39. package/scripts/build-config-schema.mjs +10 -10
  40. package/dist/constants-CSxDNnD9.mjs +0 -2
  41. package/dist/init-BgiFHv8U.mjs +0 -1
  42. package/dist/init-YiJwIrhu.mjs +0 -1
  43. package/dist/loader-pfOe7-2p.mjs +0 -1
  44. package/dist/paths-B9wNf44E.mjs +0 -2
  45. package/dist/paths-BsZ93Rgt.mjs +0 -1
  46. package/dist/preview-Bz2pUZNV.mjs +0 -1
  47. package/dist/public/assets/SettingsPane-BT8SdOKS.js +0 -5
  48. package/dist/server-CTsFrqmD.mjs +0 -3
  49. package/dist/src-BZFhAIkZ.mjs +0 -1
  50. package/dist/start-B85YN_Nl.mjs +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{Cn as i,En as a,Sn as o,Tn as s,wn as c}from"./toggle-group-Dn9Kc8gY.js";import{_ as l,c as u,f as d,i as f,n as p,o as ee,p as m,r as h,s as g,u as _,y as v}from"./button-CXhPNzpp.js";var y=e(t(),1),b=n(),x=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),S=`VisuallyHidden`,C=y.forwardRef((e,t)=>(0,b.jsx)(m.span,{...e,ref:t,style:{...x,...e.style}}));C.displayName=S;var w=C,[T,E]=d(`Tooltip`,[a]),D=a(),O=`TooltipProvider`,k=700,A=`tooltip.open`,[te,j]=T(O),M=e=>{let{__scopeTooltip:t,delayDuration:n=k,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=y.useRef(!0),s=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,b.jsx)(te,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:y.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};M.displayName=O;var N=`Tooltip`,[P,F]=T(N),I=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:c}=e,l=j(N,e.__scopeTooltip),d=D(t),[f,p]=y.useState(null),m=ee(),h=y.useRef(0),g=o??l.disableHoverableContent,_=c??l.delayDuration,v=y.useRef(!1),[x,S]=u({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(A))):l.onClose(),a?.(e)},caller:N}),C=y.useMemo(()=>x?v.current?`delayed-open`:`instant-open`:`closed`,[x]),w=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,S(!0)},[S]),T=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,S(!1)},[S]),E=y.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,S(!0),h.current=0},_)},[_,S]);return y.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,b.jsx)(s,{...d,children:(0,b.jsx)(P,{scope:t,contentId:m,open:x,stateAttribute:C,trigger:f,onTriggerChange:p,onTriggerEnter:y.useCallback(()=>{l.isOpenDelayedRef.current?E():w()},[l.isOpenDelayedRef,E,w]),onTriggerLeave:y.useCallback(()=>{g?T():(window.clearTimeout(h.current),h.current=0)},[T,g]),onOpen:w,onClose:T,disableHoverableContent:g,children:n})})};I.displayName=N;var L=`TooltipTrigger`,R=y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=F(L,n),a=j(L,n),s=D(n),c=v(t,y.useRef(null),i.onTriggerChange),l=y.useRef(!1),u=y.useRef(!1),d=y.useCallback(()=>l.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,b.jsx)(o,{asChild:!0,...s,children:(0,b.jsx)(m.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:_(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:_(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:_(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:_(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:_(e.onBlur,i.onClose),onClick:_(e.onClick,i.onClose)})})});R.displayName=L;var z=`TooltipPortal`,[B,V]=T(z,{forceMount:void 0}),H=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=F(z,t);return(0,b.jsx)(B,{scope:t,forceMount:n,children:(0,b.jsx)(g,{present:n||a.open,children:(0,b.jsx)(h,{asChild:!0,container:i,children:r})})})};H.displayName=z;var U=`TooltipContent`,W=y.forwardRef((e,t)=>{let n=V(U,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=F(U,e.__scopeTooltip);return(0,b.jsx)(g,{present:r||o.open,children:o.disableHoverableContent?(0,b.jsx)(Y,{side:i,...a,ref:t}):(0,b.jsx)(G,{side:i,...a,ref:t})})}),G=y.forwardRef((e,t)=>{let n=F(U,e.__scopeTooltip),r=j(U,e.__scopeTooltip),i=y.useRef(null),a=v(t,i),[o,s]=y.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=y.useCallback(()=>{s(null),d(!1)},[d]),p=y.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=re(r,ne(r,n.getBoundingClientRect())),a=ie(t.getBoundingClientRect());s(oe([...i,...a])),d(!0)},[d]);return y.useEffect(()=>()=>f(),[f]),y.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),y.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!ae(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,b.jsx)(Y,{...e,ref:a})}),[K,q]=T(N,{isInside:!1}),J=l(`TooltipContent`),Y=y.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,l=F(U,n),u=D(n),{onClose:d}=l;return y.useEffect(()=>(document.addEventListener(A,d),()=>document.removeEventListener(A,d)),[d]),y.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,b.jsx)(f,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,b.jsxs)(c,{"data-state":l.stateAttribute,...u,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,b.jsx)(J,{children:r}),(0,b.jsx)(K,{scope:n,isInside:!0,children:(0,b.jsx)(w,{id:l.contentId,role:`tooltip`,children:i||r})})]})})});W.displayName=U;var X=`TooltipArrow`,Z=y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,a=D(n);return q(X,n).isInside?null:(0,b.jsx)(i,{...a,...r,ref:t})});Z.displayName=X;function ne(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function re(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ie(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function oe(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),se(t)}function se(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Q=M,ce=I,le=R,ue=H,de=W,fe=Z,$=r();function pe(e){let t=(0,$.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,b.jsx)(Q,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function me(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,b.jsx)(ce,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function he(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,b.jsx)(le,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function ge(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=p(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,b.jsx)(fe,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,b.jsx)(ue,{children:(0,b.jsxs)(de,{"data-slot":`tooltip-content`,sideOffset:o,className:s,...i,children:[n,c]})}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}export{he as i,ge as n,pe as r,me as t};
1
+ import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{Cn as i,En as a,Sn as o,Tn as s,wn as c}from"./toggle-group-DUoJt_Lj.js";import{_ as l,c as u,f as d,i as f,n as p,o as ee,p as m,r as h,s as g,u as _,y as v}from"./button-CXhPNzpp.js";var y=e(t(),1),b=n(),x=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),S=`VisuallyHidden`,C=y.forwardRef((e,t)=>(0,b.jsx)(m.span,{...e,ref:t,style:{...x,...e.style}}));C.displayName=S;var w=C,[T,E]=d(`Tooltip`,[a]),D=a(),O=`TooltipProvider`,k=700,A=`tooltip.open`,[te,j]=T(O),M=e=>{let{__scopeTooltip:t,delayDuration:n=k,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=y.useRef(!0),s=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,b.jsx)(te,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:y.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};M.displayName=O;var N=`Tooltip`,[P,F]=T(N),I=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:c}=e,l=j(N,e.__scopeTooltip),d=D(t),[f,p]=y.useState(null),m=ee(),h=y.useRef(0),g=o??l.disableHoverableContent,_=c??l.delayDuration,v=y.useRef(!1),[x,S]=u({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(A))):l.onClose(),a?.(e)},caller:N}),C=y.useMemo(()=>x?v.current?`delayed-open`:`instant-open`:`closed`,[x]),w=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,S(!0)},[S]),T=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,S(!1)},[S]),E=y.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,S(!0),h.current=0},_)},[_,S]);return y.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,b.jsx)(s,{...d,children:(0,b.jsx)(P,{scope:t,contentId:m,open:x,stateAttribute:C,trigger:f,onTriggerChange:p,onTriggerEnter:y.useCallback(()=>{l.isOpenDelayedRef.current?E():w()},[l.isOpenDelayedRef,E,w]),onTriggerLeave:y.useCallback(()=>{g?T():(window.clearTimeout(h.current),h.current=0)},[T,g]),onOpen:w,onClose:T,disableHoverableContent:g,children:n})})};I.displayName=N;var L=`TooltipTrigger`,R=y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=F(L,n),a=j(L,n),s=D(n),c=v(t,y.useRef(null),i.onTriggerChange),l=y.useRef(!1),u=y.useRef(!1),d=y.useCallback(()=>l.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener(`pointerup`,d),[d]),(0,b.jsx)(o,{asChild:!0,...s,children:(0,b.jsx)(m.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:_(e.onPointerMove,e=>{e.pointerType!==`touch`&&!u.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),u.current=!0)}),onPointerLeave:_(e.onPointerLeave,()=>{i.onTriggerLeave(),u.current=!1}),onPointerDown:_(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,d,{once:!0})}),onFocus:_(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:_(e.onBlur,i.onClose),onClick:_(e.onClick,i.onClose)})})});R.displayName=L;var z=`TooltipPortal`,[B,V]=T(z,{forceMount:void 0}),H=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=F(z,t);return(0,b.jsx)(B,{scope:t,forceMount:n,children:(0,b.jsx)(g,{present:n||a.open,children:(0,b.jsx)(h,{asChild:!0,container:i,children:r})})})};H.displayName=z;var U=`TooltipContent`,W=y.forwardRef((e,t)=>{let n=V(U,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=F(U,e.__scopeTooltip);return(0,b.jsx)(g,{present:r||o.open,children:o.disableHoverableContent?(0,b.jsx)(Y,{side:i,...a,ref:t}):(0,b.jsx)(G,{side:i,...a,ref:t})})}),G=y.forwardRef((e,t)=>{let n=F(U,e.__scopeTooltip),r=j(U,e.__scopeTooltip),i=y.useRef(null),a=v(t,i),[o,s]=y.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=y.useCallback(()=>{s(null),d(!1)},[d]),p=y.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=re(r,ne(r,n.getBoundingClientRect())),a=ie(t.getBoundingClientRect());s(oe([...i,...a])),d(!0)},[d]);return y.useEffect(()=>()=>f(),[f]),y.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),y.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!ae(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,b.jsx)(Y,{...e,ref:a})}),[K,q]=T(N,{isInside:!1}),J=l(`TooltipContent`),Y=y.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,l=F(U,n),u=D(n),{onClose:d}=l;return y.useEffect(()=>(document.addEventListener(A,d),()=>document.removeEventListener(A,d)),[d]),y.useEffect(()=>{if(l.trigger){let e=e=>{e.target?.contains(l.trigger)&&d()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[l.trigger,d]),(0,b.jsx)(f,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,b.jsxs)(c,{"data-state":l.stateAttribute,...u,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,b.jsx)(J,{children:r}),(0,b.jsx)(K,{scope:n,isInside:!0,children:(0,b.jsx)(w,{id:l.contentId,role:`tooltip`,children:i||r})})]})})});W.displayName=U;var X=`TooltipArrow`,Z=y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,a=D(n);return q(X,n).isInside?null:(0,b.jsx)(i,{...a,...r,ref:t})});Z.displayName=X;function ne(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function re(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ie(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function oe(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),se(t)}function se(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Q=M,ce=I,le=R,ue=H,de=W,fe=Z,$=r();function pe(e){let t=(0,$.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,b.jsx)(Q,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function me(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,b.jsx)(ce,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function he(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,b.jsx)(le,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function ge(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=p(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,b.jsx)(fe,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,b.jsx)(ue,{children:(0,b.jsxs)(de,{"data-slot":`tooltip-content`,sideOffset:o,className:s,...i,children:[n,c]})}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}export{he as i,ge as n,pe as r,me as t};
@@ -20,7 +20,7 @@
20
20
  nothing for the formatter to reindent.
21
21
  -->
22
22
  <script>(() => { let mode = 'wysiwyg'; try { const raw = localStorage.getItem('ok-editor-mode-v1'); if (raw === 'wysiwyg' || raw === 'source') mode = raw; } catch {} window.__OK_EDITOR_MODE__ = mode; })();</script>
23
- <script type="module" crossorigin src="./assets/index-DyrPnwkR.js"></script>
23
+ <script type="module" crossorigin src="./assets/index-CM0vP7md.js"></script>
24
24
  <link rel="modulepreload" crossorigin href="./assets/chunk-DECur_0Z.js">
25
25
  <link rel="modulepreload" crossorigin href="./assets/trace-api-CbLDdnQA.js">
26
26
  <link rel="modulepreload" crossorigin href="./assets/propagation-api-LnD10wq2.js">
@@ -29,17 +29,17 @@
29
29
  <link rel="modulepreload" crossorigin href="./assets/dist-oNAFjGrp.js">
30
30
  <link rel="modulepreload" crossorigin href="./assets/compiler-runtime-Y11fyRVL.js">
31
31
  <link rel="modulepreload" crossorigin href="./assets/button-CXhPNzpp.js">
32
- <link rel="modulepreload" crossorigin href="./assets/toggle-group-Dn9Kc8gY.js">
32
+ <link rel="modulepreload" crossorigin href="./assets/toggle-group-DUoJt_Lj.js">
33
33
  <link rel="modulepreload" crossorigin href="./assets/dist-RVD4DzGH.js">
34
34
  <link rel="modulepreload" crossorigin href="./assets/dialog-CJazZw1E.js">
35
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-3eBmZPWH.js">
35
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-rp4iBare.js">
36
36
  <link rel="modulepreload" crossorigin href="./assets/panel-DiSt1efw.js">
37
- <link rel="modulepreload" crossorigin href="./assets/clipboard-ZBAkT6co.js">
38
- <link rel="modulepreload" crossorigin href="./assets/tooltip-DHY5QgRr.js">
37
+ <link rel="modulepreload" crossorigin href="./assets/clipboard-4Z4wXNiz.js">
38
+ <link rel="modulepreload" crossorigin href="./assets/tooltip-CSwVg9kb.js">
39
39
  <link rel="modulepreload" crossorigin href="./assets/agent-presence-XtMgnv3n.js">
40
40
  <link rel="modulepreload" crossorigin href="./assets/circle-check-bKAq6pcI.js">
41
- <link rel="modulepreload" crossorigin href="./assets/config-validation-events-BChsSyYz.js">
42
- <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-DNQiDIT9.js">
41
+ <link rel="modulepreload" crossorigin href="./assets/config-validation-events-_DHiCvOD.js">
42
+ <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-rQkR_SWG.js">
43
43
  <link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-BBTXqzE6.js">
44
44
  <link rel="stylesheet" crossorigin href="./assets/index-C_wVGFTR.css">
45
45
  </head>
@@ -16,9 +16,9 @@
16
16
  "dir": {
17
17
  "default": ".",
18
18
  "type": "string",
19
- "scope": "workspace",
19
+ "scope": "project",
20
20
  "agentSettable": false,
21
- "defaultScope": "workspace"
21
+ "defaultScope": "project"
22
22
  },
23
23
  "include": {
24
24
  "default": [
@@ -30,9 +30,9 @@
30
30
  "items": {
31
31
  "type": "string"
32
32
  },
33
- "scope": "workspace",
33
+ "scope": "project",
34
34
  "agentSettable": true,
35
- "defaultScope": "workspace"
35
+ "defaultScope": "project"
36
36
  },
37
37
  "exclude": {
38
38
  "default": [],
@@ -40,9 +40,9 @@
40
40
  "items": {
41
41
  "type": "string"
42
42
  },
43
- "scope": "workspace",
43
+ "scope": "project",
44
44
  "agentSettable": true,
45
- "defaultScope": "workspace"
45
+ "defaultScope": "project"
46
46
  }
47
47
  },
48
48
  "additionalProperties": {}
@@ -95,7 +95,7 @@
95
95
  "baseUrl": {
96
96
  "type": "string",
97
97
  "format": "uri",
98
- "scope": "workspace",
98
+ "scope": "project",
99
99
  "agentSettable": false
100
100
  }
101
101
  },
@@ -138,7 +138,7 @@
138
138
  },
139
139
  "scope": "either",
140
140
  "agentSettable": true,
141
- "defaultScope": "workspace"
141
+ "defaultScope": "project"
142
142
  },
143
143
  "mcp": {
144
144
  "default": {
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "scope": "either",
82
82
  "agentSettable": true,
83
- "defaultScope": "workspace"
83
+ "defaultScope": "project"
84
84
  },
85
85
  "mcp": {
86
86
  "default": {
@@ -0,0 +1,3 @@
1
+ import{$ as e,Rt as t,X as n,Z as r,at as i,et as a,it as o,nt as s,rt as c,tt as l}from"./dist-BEzp6mq0.mjs";import{dirname as u,isAbsolute as d,resolve as f}from"node:path";import{existsSync as p,readFileSync as m,renameSync as h,unlinkSync as g}from"node:fs";import{homedir as _}from"node:os";import{mkdir as v,rename as y,writeFile as b}from"node:fs/promises";var x=t();function S(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${n}/${e===`user`?`config.user.schema.json`:`config.project.schema.json`}`}function C(e){return`# yaml-language-server: $schema=${S(e)}\n`}function w(t,n,r){return f(t===`user`?r??_():d(n)?n:f(n),e,`config.yml`)}function T(e){return{ok:!1,error:e}}function E(e){return{ok:!0,...e}}async function D(e,t){let n=`${e}.tmp.${crypto.randomUUID()}`;try{await b(n,t,{encoding:`utf-8`,mode:420}),await y(n,e)}catch(e){try{g(n)}catch{}throw e}}async function O(e){return o(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await k(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function k(e){let{cwd:t,scope:n,patch:o,homedirOverride:s,firstWriteHeader:d}=e,f=w(n,t,s),h=``,g=!1;if(p(f)){g=!0;try{h=m(f,`utf-8`)}catch(e){return T({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let _=(0,x.parseDocument)(h);if(_.errors.length>0)return T({code:`YAML_PARSE`,detail:_.errors.map(e=>e.message).join(`; `)});if(_.contents===null)_.contents=_.createNode({});else if(!(0,x.isMap)(_.contents))return T({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,x.isSeq)(_.contents)?`sequence`:`scalar`}`});let y=l(_,o),b=_.toJSON(),S=i(`config.validate`,{"config.scope":n,"config.validation.layer":`L2`},e=>{let t=r.safeParse(b);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)a(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!S.success)return T({code:`SCHEMA_INVALID`,issues:S.error.issues.map(c)});let O=_.toString();if(!g){let e=d===void 0?C(n):d??``;e.length>0&&(O=`${e.endsWith(`
2
+ `)?e:`${e}\n`}${O}`)}try{await v(u(f),{recursive:!0})}catch(e){return T({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${f}: ${e instanceof Error?e.message:String(e)}`})}try{await D(f,O)}catch(e){return T({code:`WRITE_ERROR`,detail:`Could not write ${f}: ${e instanceof Error?e.message:String(e)}`})}return E({effective:S.data,appliedPaths:y,path:f,created:!g})}function A(e){if(!p(e))return[];let t=(0,x.parseDocument)(m(e,`utf-8`));if(t.errors.length>0)return[];let n=t.toJSON();if(!n||typeof n!=`object`||Array.isArray(n))return[];let r=n.folders;return Array.isArray(r)?r:[]}function j(e){return{ok:!1,error:e}}function M(e){return{ok:!0,...e}}async function N(e){let t=e.scope??`project`,n=w(t,e.cwd,e.homedirOverride),r;try{r=A(n)}catch(e){return j({code:`WRITE_ERROR`,detail:`Could not read current folders: ${e instanceof Error?e.message:String(e)}`})}let i=r.map(e=>({match:e.match,frontmatter:{...e.frontmatter}}));for(let t of e.rules){let e=t.new_match??t.match,n=i.findIndex(e=>e.match===t.match);if(t.new_match!==void 0&&t.new_match!==t.match){if(n>=0){let e=i.findIndex((e,r)=>r!==n&&e.match===t.new_match);e>=0&&i.splice(e,1);let r=e>=0&&e<n?n-1:n;i[r]={match:t.new_match,frontmatter:{...t.frontmatter}}}else{let n=i.findIndex(t=>t.match===e);n>=0?i[n]={match:e,frontmatter:{...t.frontmatter}}:i.push({match:e,frontmatter:{...t.frontmatter}})}continue}n>=0?i[n]={match:t.match,frontmatter:{...t.frontmatter}}:i.push({match:t.match,frontmatter:{...t.frontmatter}})}let a=await O({cwd:e.cwd,scope:t,patch:{folders:i},homedirOverride:e.homedirOverride});return a.ok?M({effective:a.effective,appliedPaths:a.appliedPaths,path:a.path,created:a.created}):j(a.error)}function P(e,t){let n=F(`user`,t),r=F(`project`,t),i=new Map;for(let t of e){let e=t.join(`.`);i.set(e,{user:I(n,t),project:I(r,t)})}return i}function F(e,t){let n=w(e,t.cwd,t.homedirOverride);if(!p(n))return null;let r;try{r=m(n,`utf-8`)}catch(t){return t.code!==`ENOENT`&&console.warn(`[inspectConfigPaths] could not read ${e} config at ${n}: ${t.message??t}`),null}let i=(0,x.parseDocument)(r);return i.errors.length>0?(console.warn(`[inspectConfigPaths] ${e} config at ${n} has YAML parse errors; treating as absent for scope inference`),null):i.toJSON()}function I(e,t){if(t.length===0)return e!=null;let n=e;for(let e of t){if(n==null)return!1;if(Array.isArray(n)&&typeof e==`number`){n=n[e];continue}if(typeof n==`object`){let t=String(e);if(!(t in n))return!1;n=n[t];continue}return!1}return n!==void 0}function L(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=s({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function R(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return h(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function z(e){let{absPath:t,sideline:n=!0,timestamp:i=new Date().toISOString()}=e,a=e.warn??(e=>console.warn(e)),o=r.parse({});if(!p(t))return{valid:!0,value:o,source:void 0};let s;try{s=m(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);return a(`[config] Could not read ${t}: ${n}. Using schema defaults.`),{valid:!1,value:o,error:{code:`UNKNOWN`,message:`Read failed: ${n}`}}}let c=(0,x.parseDocument)(s);if(c.errors.length>0){let e=c.errors.map(e=>e.message).join(`; `);a(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let r=n?R(t,i,a):void 0;return{valid:!1,value:o,error:{code:`YAML_PARSE`,detail:e},...r===void 0?{}:{sidelinedTo:r}}}let l=c.toJSON()??{},u=r.safeParse(l);if(!u.success){let e=L(u,c,s,t);a(`[config] ${t} fails schema validation (${u.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let r=n?R(t,i,a):void 0;return{valid:!1,value:o,error:e,...r===void 0?{}:{sidelinedTo:r}}}return{valid:!0,value:u.data,source:t}}export{O as a,w as i,P as n,z as r,N as t};
3
+ //# sourceMappingURL=server-C3JdctFI.mjs.map
@@ -0,0 +1 @@
1
+ import"./loader-BrMaEBLv.mjs";import"./init-CVdO533i.mjs";export{};
@@ -0,0 +1 @@
1
+ import{o as e}from"./start-CihiZnI_.mjs";export{e as startCommand};
@@ -1,2 +1,2 @@
1
- import{t as e}from"./esm-wByiX8MO.mjs";import{$ as t}from"./dist-CgDgVcCw.mjs";import{i as n}from"./constants-CSxDNnD9.mjs";import{spawn as r}from"node:child_process";import{join as i}from"node:path";import{closeSync as a,existsSync as o,mkdirSync as s,openSync as c}from"node:fs";import{setTimeout as l}from"node:timers/promises";function u(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function d(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function f(e){o(e.lockDir)||s(e.lockDir,{recursive:!0});let t=c(i(e.lockDir,`last-spawn-error.log`),`w`),n=e.spawn??r,{PORT:l,...d}=process.env,f=u();try{let r=n(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return r.unref(),r}finally{try{a(t)}catch{}}}async function p(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}function m(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>l(e));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function h(e){let{config:n,cwd:r}=e,i=e.skipAutoInit??!1,a=e.skipUiAutoSpawn??!1,o=e.idleThresholdMs??18e5,{existsSync:s,mkdirSync:c}=await import(`node:fs`),{resolve:u}=await import(`node:path`),{bootServer:h,ensureProjectGit:g,getLogger:_,isProcessAlive:v,readUiLock:y}=await import(`./dist-C0_lRjzY.mjs`),{resolveContentDir:b}=await import(`./paths-BsZ93Rgt.mjs`),x=e.log??_(`start`),S=b(n,r);s(S)||(c(S,{recursive:!0}),x.info({contentDir:S},`Created content directory`));let C=!s(u(r,t)),w=i?void 0:async()=>{try{let{initContent:e}=await import(`./init-YiJwIrhu.mjs`),t=e(r);return C||t.created.length>0||t.updated.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},T=!1,E=u(S,t),D=n.server.openOnAgentEdit?()=>{if(T)return;let e=y(E);if(!e||e.port<=0||!v(e.pid))return;T=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-hvFa-TeR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,O=null,k=await h({contentDir:S,projectDir:r,contentRoot:n.content.dir,port:e.port,host:n.server.host,quiet:!1,includePatterns:n.content.include,excludePatterns:n.content.exclude,onAgentWrite:D,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:o,skipAutoInit:i,autoInitFn:w,ensureProjectGitFn:i?void 0:()=>g(r),spawnUiSiblingFn:async({lockDir:t})=>{if(O=d({uiLock:y(t),isAlive:v}),O.action===`spawn`&&!a)try{f({lockDir:t,cwd:r,spawn:e.spawn}),x.info({reason:O.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else O.action===`skip`&&x.info({port:O.port,pid:O.pid},`UI already running at port ${O.port}`)},idleShutdownHandler:e=>m({readUiLock:()=>y(k.lockDir),isAlive:v,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:x}),log:x});O||={action:`skip`,reason:`alive`,pid:0,port:0};let A=O,j=null;if(A.action===`skip`)j=A.port>0?A.port:null;else if(!a){let t=e.uiBindTimeoutMs??3e3;j=await p({readUiLock:()=>y(k.lockDir),now:Date.now,sleep:e=>l(e),timeoutMs:t,pollIntervalMs:50}),j===null&&x.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:k.httpServer,destroy:k.destroy,lockDir:k.lockDir,contentDir:S,port:k.port,ready:k.ready,degraded:k.degraded,uiSpawnDecision:O,resolvedUiPort:j,didAutoInit:k.didAutoInit,didGitInit:k.didGitInit}}function g(r){return new e(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--no-init`,`Skip auto-scaffolding of ${t}/`).action(async e=>{let{renderBanner:i}=await import(`./banner-DoFNyNUH.mjs`),{dim:a,error:o,info:s,warning:c}=await import(`./colors-CswooXAS.mjs`),l=r(),u=process.cwd();e.host!==void 0&&(l.server.host=e.host);let d=e.port===void 0?void 0:Number(e.port),f=process.env.PORT?Number(process.env.PORT):void 0,p=d??f,m;try{m=await h({config:l,cwd:u,port:p,skipAutoInit:e.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./dist-C0_lRjzY.mjs`);e instanceof t&&(console.error(o(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(a(e.stderr.trim())),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let g=!1,_=async e=>{if(!g){g=!0,console.log(a(`\nShutting down (${e})...`));try{await m.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{_(`SIGINT`)}),process.once(`SIGTERM`,()=>{_(`SIGTERM`)});let v=`http://${l.server.host}:${m.port}`,y=l.server.host===`0.0.0.0`||l.server.host===`::`?`http://0.0.0.0:${m.port}`:void 0,b=m.resolvedUiPort,x=b!==null&&b>0?`http://${l.server.host}:${b}`:v;console.log(i({name:`open-knowledge`,version:n,localUrl:x,apiUrl:x===v?void 0:v,networkUrl:y})),m.didAutoInit&&(console.log(` ${s(`✓`)} Scaffolded ${t}/ (first run)`),console.log(` ${a("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let S={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};m.ready.then(async()=>{if(m.degraded.length>0){console.log();for(let e of m.degraded){let t=S[e]??`${e} (check server logs for details)`;console.warn(` ${c(`⚠`)} ${c(e)}: ${a(t)}`)}console.log()}if(m.didAutoInit||m.didGitInit)if(m.didGitInit&&console.log(`\n ${s(`✓`)} Initialized git repo at ${u}/.git/ (default branch: main)`),m.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview-Bz2pUZNV.mjs`),n=e({projectDir:u,contentDir:m.contentDir,include:l.content.include,exclude:l.content.exclude});console.log(`\n${t(n,u)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(e.open){let{openBrowser:e}=await import(`./open-browser-hvFa-TeR.mjs`);e(x)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{f as a,d as i,h as n,g as o,m as r,u as s,p as t};
2
- //# sourceMappingURL=start-Bv4eE1v8.mjs.map
1
+ import{t as e}from"./esm-wByiX8MO.mjs";import{$ as t}from"./dist-BEzp6mq0.mjs";import{i as n}from"./constants-B4FrIR2k.mjs";import{spawn as r}from"node:child_process";import{join as i}from"node:path";import{closeSync as a,existsSync as o,mkdirSync as s,openSync as c}from"node:fs";import{setTimeout as l}from"node:timers/promises";function u(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function d(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function f(e){o(e.lockDir)||s(e.lockDir,{recursive:!0});let t=c(i(e.lockDir,`last-spawn-error.log`),`w`),n=e.spawn??r,{PORT:l,...d}=process.env,f=u();try{let r=n(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return r.unref(),r}finally{try{a(t)}catch{}}}async function p(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}function m(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>l(e));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function h(e){let{config:n,cwd:r}=e,i=e.skipAutoInit??!1,a=e.skipUiAutoSpawn??!1,o=e.idleThresholdMs??18e5,{existsSync:s,mkdirSync:c}=await import(`node:fs`),{resolve:u}=await import(`node:path`),{bootServer:h,ensureProjectGit:g,getLogger:_,isProcessAlive:v,readUiLock:y}=await import(`./dist-U4KUxqv5.mjs`),{resolveContentDir:b}=await import(`./paths-BAtxOytY.mjs`),x=e.log??_(`start`),S=b(n,r);s(S)||(c(S,{recursive:!0}),x.info({contentDir:S},`Created content directory`));let C=!s(u(r,t)),w=i?void 0:async()=>{try{let{initContent:e}=await import(`./init-BvWk9L0l.mjs`),t=e(r);return C||t.created.length>0||t.updated.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},T=!1,E=u(S,t),D=n.server.openOnAgentEdit?()=>{if(T)return;let e=y(E);if(!e||e.port<=0||!v(e.pid))return;T=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-hvFa-TeR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,O=null,k=await h({contentDir:S,projectDir:r,contentRoot:n.content.dir,port:e.port,host:n.server.host,quiet:!1,includePatterns:n.content.include,excludePatterns:n.content.exclude,onAgentWrite:D,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:o,skipAutoInit:i,autoInitFn:w,ensureProjectGitFn:i?void 0:()=>g(r),spawnUiSiblingFn:async({lockDir:t})=>{if(O=d({uiLock:y(t),isAlive:v}),O.action===`spawn`&&!a)try{f({lockDir:t,cwd:r,spawn:e.spawn}),x.info({reason:O.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else O.action===`skip`&&x.info({port:O.port,pid:O.pid},`UI already running at port ${O.port}`)},idleShutdownHandler:e=>m({readUiLock:()=>y(k.lockDir),isAlive:v,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:x}),log:x});O||={action:`skip`,reason:`alive`,pid:0,port:0};let A=O,j=null;if(A.action===`skip`)j=A.port>0?A.port:null;else if(!a){let t=e.uiBindTimeoutMs??3e3;j=await p({readUiLock:()=>y(k.lockDir),now:Date.now,sleep:e=>l(e),timeoutMs:t,pollIntervalMs:50}),j===null&&x.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:k.httpServer,destroy:k.destroy,lockDir:k.lockDir,contentDir:S,port:k.port,ready:k.ready,degraded:k.degraded,uiSpawnDecision:O,resolvedUiPort:j,didAutoInit:k.didAutoInit,didGitInit:k.didGitInit}}function g(r){return new e(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--no-init`,`Skip auto-scaffolding of ${t}/`).action(async e=>{let{renderBanner:i}=await import(`./banner-DoFNyNUH.mjs`),{dim:a,error:o,info:s,warning:c}=await import(`./colors-CswooXAS.mjs`),l=r(),u=process.cwd();e.host!==void 0&&(l.server.host=e.host);let d=e.port===void 0?void 0:Number(e.port),f=process.env.PORT?Number(process.env.PORT):void 0,p=d??f,m;try{m=await h({config:l,cwd:u,port:p,skipAutoInit:e.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./dist-U4KUxqv5.mjs`);e instanceof t&&(console.error(o(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(a(e.stderr.trim())),process.exit(1)),console.error(`${o(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let g=!1,_=async e=>{if(!g){g=!0,console.log(a(`\nShutting down (${e})...`));try{await m.destroy()}catch(e){console.error(`${o(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{_(`SIGINT`)}),process.once(`SIGTERM`,()=>{_(`SIGTERM`)});let v=`http://${l.server.host}:${m.port}`,y=l.server.host===`0.0.0.0`||l.server.host===`::`?`http://0.0.0.0:${m.port}`:void 0,b=m.resolvedUiPort,x=b!==null&&b>0?`http://${l.server.host}:${b}`:v;console.log(i({name:`open-knowledge`,version:n,localUrl:x,apiUrl:x===v?void 0:v,networkUrl:y})),m.didAutoInit&&(console.log(` ${s(`✓`)} Scaffolded ${t}/ (first run)`),console.log(` ${a("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let S={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};m.ready.then(async()=>{if(m.degraded.length>0){console.log();for(let e of m.degraded){let t=S[e]??`${e} (check server logs for details)`;console.warn(` ${c(`⚠`)} ${c(e)}: ${a(t)}`)}console.log()}if(m.didAutoInit||m.didGitInit)if(m.didGitInit&&console.log(`\n ${s(`✓`)} Initialized git repo at ${u}/.git/ (default branch: main)`),m.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview-BupX_Sly.mjs`),n=e({projectDir:u,contentDir:m.contentDir,include:l.content.include,exclude:l.content.exclude});console.log(`\n${t(n,u)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(e.open){let{openBrowser:e}=await import(`./open-browser-hvFa-TeR.mjs`);e(x)}}).catch(e=>{console.error(` ${o(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{f as a,d as i,h as n,g as o,m as r,u as s,p as t};
2
+ //# sourceMappingURL=start-CihiZnI_.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/open-knowledge",
3
- "version": "0.0.0-dev-20260430200817",
3
+ "version": "0.0.0-dev-20260430210834",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,22 +12,22 @@
12
12
  * to a new directory; the old directory keeps shipping for legacy YAMLs.
13
13
  *
14
14
  * Files emitted (per major):
15
- * - `dist/schemas/v<N>/config.workspace.schema.json` — workspace-valid
16
- * fields (scope: 'workspace' or 'either')
15
+ * - `dist/schemas/v<N>/config.project.schema.json` — project-valid
16
+ * fields (scope: 'project' or 'either')
17
17
  * - `dist/schemas/v<N>/config.user.schema.json` — user-valid fields
18
18
  * (scope: 'user' or 'either')
19
19
  *
20
20
  * Also emitted at the dist root (back-compat aliases for pre-versioning
21
21
  * magic comments still in the wild):
22
22
  * - `dist/config-schema.json` — full schema, every field
23
- * - `dist/config.workspace.schema.json` — same as v<current>/workspace
23
+ * - `dist/config.project.schema.json` — same as v<current>/project
24
24
  * - `dist/config.user.schema.json` — same as v<current>/user
25
25
  *
26
- * `ok init`'s scaffolded workspace `config.yml` magic-comment points at the
27
- * versioned workspace schema; `writeConfigPatch`'s lazy first-write of
26
+ * `ok init`'s scaffolded project `config.yml` magic-comment points at the
27
+ * versioned project schema; `writeConfigPatch`'s lazy first-write of
28
28
  * `~/.open-knowledge/config.yml` points at the versioned user schema.
29
29
  * Each file's autocomplete then surfaces only the fields that are valid
30
- * AT that scope — an `appearance.theme` typed in workspace YAML squiggles,
30
+ * AT that scope — an `appearance.theme` typed in project YAML squiggles,
31
31
  * a `content.dir` typed in user YAML squiggles.
32
32
  *
33
33
  * `io: 'input'` (not `'output'`) is load-bearing: the IDE must show the user
@@ -65,7 +65,7 @@ mkdirSync(versionedDir, { recursive: true });
65
65
  * - A leaf with no `scope` keyword → kept (nothing to filter).
66
66
  * - A leaf with `scope: 'either'` → kept everywhere.
67
67
  * - A leaf with `scope: 'user'` → kept only in the user schema.
68
- * - A leaf with `scope: 'workspace'` → kept only in the workspace schema.
68
+ * - A leaf with `scope: 'project'` → kept only in the project schema.
69
69
  * - An object with `properties` is walked; if EVERY child property is
70
70
  * pruned, the parent object itself is pruned (no dangling empty
71
71
  * sections in the IDE autocomplete).
@@ -113,18 +113,18 @@ const writeSchema = (path, schema) => {
113
113
  console.log(`[build:schema] wrote ${path} (${JSON.stringify(schema).length} bytes)`);
114
114
  };
115
115
 
116
- const workspaceSchema = pruneByScope(fullSchema, 'workspace');
116
+ const projectSchema = pruneByScope(fullSchema, 'project');
117
117
  const userSchema = pruneByScope(fullSchema, 'user');
118
118
 
119
119
  // Versioned (canonical) — the URLs `ok init` and `writeConfigPatch`
120
120
  // scaffold point here. Bump CONFIG_SCHEMA_MAJOR + emit to a new dir
121
121
  // for breaking changes; keep emitting old majors forever.
122
- writeSchema(resolve(versionedDir, 'config.workspace.schema.json'), workspaceSchema);
122
+ writeSchema(resolve(versionedDir, 'config.project.schema.json'), projectSchema);
123
123
  writeSchema(resolve(versionedDir, 'config.user.schema.json'), userSchema);
124
124
 
125
125
  // Back-compat aliases at dist root — pre-versioning magic comments
126
126
  // point here. Removing these would break existing `~/.open-knowledge/
127
127
  // config.yml` files that never re-pinned to a versioned URL.
128
128
  writeSchema(resolve(distDir, 'config-schema.json'), fullSchema);
129
- writeSchema(resolve(distDir, 'config.workspace.schema.json'), workspaceSchema);
129
+ writeSchema(resolve(distDir, 'config.project.schema.json'), projectSchema);
130
130
  writeSchema(resolve(distDir, 'config.user.schema.json'), userSchema);
@@ -1,2 +0,0 @@
1
- import"./dist-CgDgVcCw.mjs";var e=`0.0.0-dev-20260430200817`;const t=`config.yml`,n=`cache`,r=e,i=`open-knowledge`;export{r as i,t as n,i as r,n as t};
2
- //# sourceMappingURL=constants-CSxDNnD9.mjs.map
@@ -1 +0,0 @@
1
- import{o as e}from"./init-CqtfodiN.mjs";export{e as runInit};
@@ -1 +0,0 @@
1
- import{n as e}from"./init-CwMxEhFD.mjs";export{e as initContent};
@@ -1 +0,0 @@
1
- import{n as e}from"./loader-BgemTDND.mjs";export{e as loadConfig};
@@ -1,2 +0,0 @@
1
- import{$ as e}from"./dist-CgDgVcCw.mjs";import"./constants-CSxDNnD9.mjs";import{resolve as t}from"node:path";function n(e,n){return t(n,e.content.dir)}function r(n){return t(n,e)}export{r as n,n as t};
2
- //# sourceMappingURL=paths-B9wNf44E.mjs.map
@@ -1 +0,0 @@
1
- import{n as e,t}from"./paths-B9wNf44E.mjs";export{t as resolveContentDir,e as resolveLockDir};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./preview-CPS0Ztsq.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1,5 +0,0 @@
1
- import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{Et as i,G as a,Mt as o,Rt as s,T as c,gt as l,n as u,t as d,w as f,zt as p}from"./toggle-group-Dn9Kc8gY.js";import{t as m,x as h}from"./button-CXhPNzpp.js";import{N as g,V as _,Z as v,n as y,w as b}from"./DocumentContext-3eBmZPWH.js";import{i as x,n as S,r as C,s as w}from"./config-validation-events-BChsSyYz.js";import{S as T,x as E}from"./dialog-CJazZw1E.js";import{i as D,n as O,t as k}from"./tooltip-DHY5QgRr.js";var A=h(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),j=e(t(),1),M=r();function N(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:N(r,t)}}function P(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[String(e)]}return n}function F(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function I(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function ee(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}var L=n(),R=[{id:`content`,title:`Content`,description:`Where Open Knowledge looks for documents.`,fields:[{path:[`content`,`dir`],label:`Content directory`,description:`Project-relative path containing your markdown files.`},{path:[`content`,`include`],label:`Include patterns`,description:`Glob patterns selecting which files are content. One per line.`},{path:[`content`,`exclude`],label:`Exclude patterns`,description:`Glob patterns to skip. One per line.`}]},{id:`server`,title:`Server`,description:`Local server bind and behavior.`,fields:[{path:[`server`,`host`],label:`Host`,description:`Bind interface (e.g. localhost, 0.0.0.0).`},{path:[`server`,`openOnAgentEdit`],label:`Open preview on agent edit`,description:`When enabled, an agent write opens the preview tab if not already open.`}]},{id:`github`,title:`GitHub`,description:`OAuth app identity for sign-in. Tokens are stored in your OS keychain, not here.`,fields:[{path:[`github`,`oauthAppClientId`],label:`OAuth App client ID`,description:`Public client ID for the GitHub OAuth app. Defaults to the published Open Knowledge app.`}]},{id:`preview`,title:`Preview`,description:`Where the preview tab points when no local UI is running.`,fields:[{path:[`preview`,`baseUrl`],label:`Preview base URL`,description:`URL of your team’s deployed wiki (workspace-only).`}]},{id:`mcp`,title:`MCP`,description:`Model Context Protocol agent integration tuning.`,fields:[{path:[`mcp`,`autoStart`],label:`Auto-start server`,description:"When enabled, `ok mcp` spawns `ok start` automatically."},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],label:`read_document history depth`,description:`How many history entries the agent’s read_document tool returns.`},{path:[`mcp`,`tools`,`search`,`maxResults`],label:`search max results`,description:`Cap on results returned by the agent’s search tool.`}]},{id:`appearance`,title:`Appearance`,description:`UI preferences. Editor toggles continue to write localStorage as a cache.`,fields:[{path:[`appearance`,`theme`],label:`Theme`,description:`Light, dark, or follow the OS.`,control:`enum-toggle`},{path:[`appearance`,`editorModeDefault`],label:`Default editor mode`,description:`Which mode new docs open in by default.`,control:`enum-toggle`}]}];function z(e,t){let n=(0,M.c)(4),[r,i]=(0,j.useState)(null),o,s;return n[0]!==e||n[1]!==t?(o=()=>{if(e===null)return;let n=t===`workspace`?c:f,r=new v,o=new _({url:e,name:n,document:r}),s=a(o,t),l=!0,u=()=>{l&&i(e=>e?.provider===o?{...e,synced:!0,config:s.current()}:e)};o.on(`synced`,u);let d=s.subscribe(e=>{l&&i(t=>t?.provider===o?t&&{...t,config:e}:t)});return i({provider:o,binding:s,config:s.current(),synced:!1}),()=>{l=!1,d(),o.off(`synced`,u),s.dispose(),o.destroy(),r.destroy(),i(e=>e?.provider===o?null:e)}},s=[e,t],n[0]=e,n[1]=t,n[2]=o,n[3]=s):(o=n[2],s=n[3]),(0,j.useEffect)(o,s),r}function B(e){let t=(0,M.c)(28),{scope:n,onClose:r,onScopeChange:i}=e,{collabUrl:a}=y(),o=z(a,n),[s,c]=(0,j.useState)(null),f=(0,j.useRef)(null),p,h;t[0]===n?(p=t[1],h=t[2]):(p=()=>{let e=S(e=>{if(!(n===`workspace`&&e.docName===`__config__/workspace`||n===`user`&&e.docName===`__user__/config.yml`))return;E.error(l(e.error),{duration:8e3});let t=V(e.error);t&&(c(t),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>c(null),600))});return()=>{e(),f.current&&clearTimeout(f.current)}},h=[n],t[0]=n,t[1]=p,t[2]=h),(0,j.useEffect)(p,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,L.jsx)(`h1`,{className:`text-sm font-semibold`,children:`Settings`}),t[3]=g):g=t[3];let _;t[4]===i?_=t[5]:(_=e=>{(e===`workspace`||e===`user`)&&i(e)},t[4]=i,t[5]=_);let v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,L.jsx)(u,{value:`workspace`,className:`text-xs`,children:`This project`}),b=(0,L.jsx)(u,{value:`user`,className:`text-xs`,children:`User`}),t[6]=v,t[7]=b):(v=t[6],b=t[7]);let x;t[8]!==n||t[9]!==_?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g,(0,L.jsxs)(d,{type:`single`,value:n,onValueChange:_,"aria-label":`Settings scope`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,children:[v,b]})]}),t[8]=n,t[9]=_,t[10]=x):x=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,L.jsx)(T,{className:`size-4`}),t[11]=C):C=t[11];let w;t[12]===r?w=t[13]:(w=(0,L.jsx)(D,{asChild:!0,children:(0,L.jsx)(m,{variant:`ghost`,size:`icon`,onClick:r,"aria-label":`Close settings`,className:`text-muted-foreground`,children:C})}),t[12]=r,t[13]=w);let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,L.jsx)(O,{children:`Close`}),t[14]=A):A=t[14];let N;t[15]===w?N=t[16]:(N=(0,L.jsxs)(k,{children:[w,A]}),t[15]=w,t[16]=N);let P;t[17]!==N||t[18]!==x?(P=(0,L.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b px-4`,children:[x,N]}),t[17]=N,t[18]=x,t[19]=P):P=t[19];let F;t[20]!==o||t[21]!==s||t[22]!==n?(F=(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:o===null||!o.synced?(0,L.jsx)(H,{}):(0,L.jsx)(W,{scope:n,binding:o.binding,config:o.config,flashedPath:s})}),t[20]=o,t[21]=s,t[22]=n,t[23]=F):F=t[23];let I;return t[24]!==n||t[25]!==P||t[26]!==F?(I=(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-testid":`settings-pane`,"data-scope":n,children:[P,F]}),t[24]=n,t[25]=P,t[26]=F,t[27]=I):I=t[27],I}function V(e){if(!i(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function H(){let e=(0,M.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`space-y-6 p-6`,children:Array.from({length:3}).map(U)}),e[0]=t):t=e[0],t}function U(e,t){return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(x,{className:`h-5 w-32`}),(0,L.jsx)(x,{className:`h-4 w-64`}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(x,{className:`h-9 w-full`}),(0,L.jsx)(x,{className:`h-9 w-full`})]})]},t)}function W(e){let t=(0,M.c)(8),{scope:n,binding:r,config:i,flashedPath:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==n?(o=R.map(e=>{let t=e.fields.filter(e=>G(e.path,n));return t.length===0?null:(0,L.jsx)(K,{section:e,children:t.map(e=>(0,L.jsx)(q,{field:e,scope:n,binding:r,config:i,isFlashed:a===e.path.join(`.`)},e.path.join(`.`)))},e.id)}),t[0]=r,t[1]=i,t[2]=a,t[3]=n,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(se,{}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,L.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-6`,children:[o,s]}),t[6]=o,t[7]=c),c}function G(e,t){let n=o(s,e);if(!n)return!0;let r=p(n);return r?!(r.scope===`workspace`&&t!==`workspace`||r.scope===`user`&&t!==`user`):!0}function K(e){let t=(0,M.c)(14),{section:n,children:r}=e,i=`settings-${n.id}-title`,a=`settings-${n.id}-title`,o;t[0]!==n.title||t[1]!==a?(o=(0,L.jsx)(`h2`,{id:a,className:`text-base font-semibold`,children:n.title}),t[0]=n.title,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n.description?s=t[4]:(s=(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[3]=n.description,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,L.jsxs)(`div`,{className:`space-y-1`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===r?l=t[9]:(l=(0,L.jsx)(`div`,{className:`space-y-4`,children:r}),t[8]=r,t[9]=l);let u;return t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,L.jsxs)(`section`,{"aria-labelledby":i,className:`space-y-3`,children:[c,l]}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function q(e){let t=(0,M.c)(55),{field:n,scope:r,binding:i,config:a,isFlashed:c}=e,l,u,d,f,h,g;if(t[0]!==a||t[1]!==n.path){let e=o(s,n.path);g=e?I(e):void 0,u=e?F(e):void 0,l=P(a,n.path),f=e?p(e):void 0,d=e?ee(e):void 0,h=u===void 0?l!=null:!$(l,u),t[0]=a,t[1]=n.path,t[2]=l,t[3]=u,t[4]=d,t[5]=f,t[6]=h,t[7]=g}else l=t[2],u=t[3],d=t[4],f=t[5],h=t[6],g=t[7];let _=h,v;t[8]===n.path?v=t[9]:(v=n.path.join(`-`),t[8]=n.path,t[9]=v);let y=v,b=`${y}-error`,[x,S]=(0,j.useState)(null),C;t[10]!==i||t[11]!==n.path?(C=e=>{let t=N(n.path,e),r=i.patch(t);return r.ok?(S(null),!0):(S(oe(r.error)),!1)},t[10]=i,t[11]=n.path,t[12]=C):C=t[12];let w=C,T;t[13]!==w||t[14]!==u?(T=()=>{w(u===void 0?null:u)},t[13]=w,t[14]=u,t[15]=T):T=t[15];let E=T,R;t[16]===_?R=t[17]:(R=_?(0,L.jsx)(`span`,{"data-modified":`true`,"aria-hidden":`true`,className:`absolute -left-3 top-1 h-5 w-0.5 rounded-full bg-primary`}):null,t[16]=_,t[17]=R);let z=R,B=`relative space-y-1 ${c?`animate-settings-flash`:``}`,V;t[18]===n.path?V=t[19]:(V=n.path.join(`.`),t[18]=n.path,t[19]=V);let H;t[20]!==n.label||t[21]!==y?(H=(0,L.jsx)(`label`,{htmlFor:y,className:`text-sm font-medium`,children:n.label}),t[20]=n.label,t[21]=y,t[22]=H):H=t[22];let U;t[23]!==l||t[24]!==u||t[25]!==n.label||t[26]!==E?(U=u!==void 0||l!==void 0?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{asChild:!0,children:(0,L.jsx)(m,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-muted-foreground opacity-60 hover:opacity-100`,onClick:E,"aria-label":`Reset ${n.label} to default`,children:(0,L.jsx)(A,{className:`size-3.5`})})}),(0,L.jsx)(O,{children:`Reset to default`})]}):null,t[23]=l,t[24]=u,t[25]=n.label,t[26]=E,t[27]=U):U=t[27];let W;t[28]!==H||t[29]!==U?(W=(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[H,U]}),t[28]=H,t[29]=U,t[30]=W):W=t[30];let G;t[31]===n.description?G=t[32]:(G=n.description?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.description}):null,t[31]=n.description,t[32]=G);let K=x?b:void 0,q=f?.scope===`workspace`&&r!==`workspace`?`This field can only be set per-project. Switch to the 'This project' tab to edit it.`:f?.scope===`user`&&r!==`user`?`This field can only be set globally. Switch to the 'User' tab to edit it.`:null,J;t[33]!==w||t[34]!==l||t[35]!==d||t[36]!==n||t[37]!==y||t[38]!==K||t[39]!==q||t[40]!==g?(J=(0,L.jsx)(te,{field:n,fieldId:y,errorId:K,typeTag:g,currentValue:l,enumOptions:d,onCommit:w,readonlyReason:q}),t[33]=w,t[34]=l,t[35]=d,t[36]=n,t[37]=y,t[38]=K,t[39]=q,t[40]=g,t[41]=J):J=t[41];let Y;t[42]!==x||t[43]!==b||t[44]!==n.path?(Y=x?(0,L.jsx)(`p`,{id:b,role:`alert`,className:`text-xs text-destructive`,"data-field-error":n.path.join(`.`),children:x}):null,t[42]=x,t[43]=b,t[44]=n.path,t[45]=Y):Y=t[45];let X;return t[46]!==z||t[47]!==r||t[48]!==G||t[49]!==J||t[50]!==Y||t[51]!==V||t[52]!==W||t[53]!==B?(X=(0,L.jsxs)(`div`,{className:B,"data-field":V,"data-scope":r,children:[z,W,G,J,Y]}),t[46]=z,t[47]=r,t[48]=G,t[49]=J,t[50]=Y,t[51]=V,t[52]=W,t[53]=B,t[54]=X):X=t[54],X}function te(e){let t=(0,M.c)(32),{field:n,fieldId:r,errorId:i,typeTag:a,currentValue:o,enumOptions:s,onCommit:c,readonlyReason:l}=e;if(l){let e;return t[0]!==r||t[1]!==l?(e=(0,L.jsx)(`div`,{id:r,role:`note`,className:`rounded border border-dashed border-muted px-3 py-2 text-xs text-muted-foreground`,children:l}),t[0]=r,t[1]=l,t[2]=e):e=t[2],e}if(a===`boolean`){let e=!!o,n;return t[3]!==i||t[4]!==r||t[5]!==c||t[6]!==e?(n=(0,L.jsx)(X,{fieldId:r,errorId:i,value:e,onCommit:c}),t[3]=i,t[4]=r,t[5]=c,t[6]=e,t[7]=n):n=t[7],n}if(a===`enum`&&s&&s.length>0&&(n.control===`enum-toggle`||s.length<=4)){let e=typeof o==`string`?o:``,a;return t[8]!==s||t[9]!==i||t[10]!==n.label||t[11]!==r||t[12]!==c||t[13]!==e?(a=(0,L.jsx)(ne,{fieldId:r,errorId:i,ariaLabel:n.label,options:s,value:e,onCommit:c}),t[8]=s,t[9]=i,t[10]=n.label,t[11]=r,t[12]=c,t[13]=e,t[14]=a):a=t[14],a}if(a===`number`||a===`int`){let e=typeof o==`number`?o:0,n;return t[15]!==i||t[16]!==r||t[17]!==c||t[18]!==e?(n=(0,L.jsx)(Y,{fieldId:r,errorId:i,value:e,onCommit:c}),t[15]=i,t[16]=r,t[17]=c,t[18]=e,t[19]=n):n=t[19],n}if(a===`array`){let e;t[20]===o?e=t[21]:(e=Array.isArray(o)?o:[],t[20]=o,t[21]=e);let n;return t[22]!==i||t[23]!==r||t[24]!==c||t[25]!==e?(n=(0,L.jsx)(re,{fieldId:r,errorId:i,value:e,onCommit:c}),t[22]=i,t[23]=r,t[24]=c,t[25]=e,t[26]=n):n=t[26],n}let u=typeof o==`string`?o:``,d;return t[27]!==i||t[28]!==r||t[29]!==c||t[30]!==u?(d=(0,L.jsx)(J,{fieldId:r,errorId:i,value:u,onCommit:c}),t[27]=i,t[28]=r,t[29]=c,t[30]=u,t[31]=d):d=t[31],d}function J(e){let t=(0,M.c)(22),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(i),[c,l]=(0,j.useState)(!1),u=(0,j.useRef)(i),d,f;t[0]!==o||t[1]!==i?(d=()=>{o===u.current&&(s(i),u.current=i)},f=[i,o],t[0]=o,t[1]=i,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,j.useEffect)(d,f);let p;t[4]!==a||t[5]!==o?(p=()=>{o!==u.current&&a(o)&&(u.current=o,Q(l))},t[4]=a,t[5]=o,t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.target.value),t[7]=h):h=t[7];let _;t[8]===m?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),m())},t[8]=m,t[9]=_);let v=r?!0:void 0,y;t[10]!==m||t[11]!==r||t[12]!==n||t[13]!==o||t[14]!==_||t[15]!==v?(y=(0,L.jsx)(g,{id:n,value:o,onChange:h,onBlur:m,onKeyDown:_,"aria-describedby":r,"aria-invalid":v,className:`h-8 text-sm`}),t[10]=m,t[11]=r,t[12]=n,t[13]=o,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===c?b=t[18]:(b=(0,L.jsx)(Z,{visible:c}),t[17]=c,t[18]=b);let x;return t[19]!==y||t[20]!==b?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21],x}function Y(e){let t=(0,M.c)(22),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(String(i)),[c,l]=(0,j.useState)(!1),u=(0,j.useRef)(String(i)),d,f;t[0]!==o||t[1]!==i?(d=()=>{o===u.current&&(s(String(i)),u.current=String(i))},f=[i,o],t[0]=o,t[1]=i,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,j.useEffect)(d,f);let p;t[4]!==a||t[5]!==o?(p=()=>{if(o===u.current)return;let e=Number(o);if(!Number.isFinite(e)){a(o);return}a(e)&&(u.current=o,Q(l))},t[4]=a,t[5]=o,t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.target.value),t[7]=h):h=t[7];let _;t[8]===m?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),m())},t[8]=m,t[9]=_);let v=r?!0:void 0,y;t[10]!==m||t[11]!==r||t[12]!==n||t[13]!==o||t[14]!==_||t[15]!==v?(y=(0,L.jsx)(g,{id:n,type:`number`,value:o,onChange:h,onBlur:m,onKeyDown:_,"aria-describedby":r,"aria-invalid":v,className:`h-8 w-28 text-sm`}),t[10]=m,t[11]=r,t[12]=n,t[13]=o,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===c?b=t[18]:(b=(0,L.jsx)(Z,{visible:c}),t[17]=c,t[18]=b);let x;return t[19]!==y||t[20]!==b?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21],x}function X(e){let t=(0,M.c)(12),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(!1),c;t[0]===a?c=t[1]:(c=e=>{a(e)&&Q(s)},t[0]=a,t[1]=c);let l;t[2]!==r||t[3]!==n||t[4]!==c||t[5]!==i?(l=(0,L.jsx)(b,{id:n,checked:i,"aria-describedby":r,onCheckedChange:c}),t[2]=r,t[3]=n,t[4]=c,t[5]=i,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=(0,L.jsx)(Z,{visible:o}),t[7]=o,t[8]=u);let d;return t[9]!==l||t[10]!==u?(d=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function ne(e){let t=(0,M.c)(18),{fieldId:n,errorId:r,ariaLabel:i,options:a,value:o,onCommit:s}=e,[c,l]=(0,j.useState)(!1),f;t[0]===s?f=t[1]:(f=e=>{e&&s(e)&&Q(l)},t[0]=s,t[1]=f);let p;if(t[2]!==n||t[3]!==a){let e;t[5]===n?e=t[6]:(e=(e,t)=>(0,L.jsx)(u,{value:e,id:t===0?n:void 0,className:`text-xs capitalize`,children:e},e),t[5]=n,t[6]=e),p=a.map(e),t[2]=n,t[3]=a,t[4]=p}else p=t[4];let m;t[7]!==i||t[8]!==f||t[9]!==p||t[10]!==o?(m=(0,L.jsx)(d,{type:`single`,value:o,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":i,onValueChange:f,children:p}),t[7]=i,t[8]=f,t[9]=p,t[10]=o,t[11]=m):m=t[11];let h;t[12]===c?h=t[13]:(h=(0,L.jsx)(Z,{visible:c}),t[12]=c,t[13]=h);let g;return t[14]!==r||t[15]!==m||t[16]!==h?(g=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,"aria-describedby":r,children:[m,h]}),t[14]=r,t[15]=m,t[16]=h,t[17]=g):g=t[17],g}function re(e){let t=(0,M.c)(24),{fieldId:n,errorId:r,value:i,onCommit:a}=e,o;t[0]===i?o=t[1]:(o=i.join(`
2
- `),t[0]=i,t[1]=o);let s=o,[c,l]=(0,j.useState)(s),[u,d]=(0,j.useState)(!1),f=(0,j.useRef)(s),p,m;t[2]!==c||t[3]!==i?(p=()=>{let e=i.join(`
3
- `);c===f.current&&(l(e),f.current=e)},m=[i,c],t[2]=c,t[3]=i,t[4]=p,t[5]=m):(p=t[4],m=t[5]),(0,j.useEffect)(p,m);let h;t[6]!==a||t[7]!==c?(h=()=>{c!==f.current&&a(c.split(`
4
- `).map(ae).filter(ie))&&(f.current=c,Q(d))},t[6]=a,t[7]=c,t[8]=h):h=t[8];let g=h,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>l(e.target.value),t[9]=_):_=t[9];let v;t[10]===c?v=t[11]:(v=c.split(`
5
- `),t[10]=c,t[11]=v);let y=Math.max(2,Math.min(6,v.length)),b=r?!0:void 0,x;t[12]!==g||t[13]!==r||t[14]!==n||t[15]!==c||t[16]!==y||t[17]!==b?(x=(0,L.jsx)(`textarea`,{id:n,value:c,onChange:_,onBlur:g,rows:y,"aria-describedby":r,"aria-invalid":b,className:`min-h-16 w-full rounded-md border bg-background px-3 py-1.5 font-mono text-xs`}),t[12]=g,t[13]=r,t[14]=n,t[15]=c,t[16]=y,t[17]=b,t[18]=x):x=t[18];let S;t[19]===u?S=t[20]:(S=(0,L.jsx)(Z,{visible:u}),t[19]=u,t[20]=S);let C;return t[21]!==S||t[22]!==x?(C=(0,L.jsxs)(`div`,{className:`flex items-start gap-2`,children:[x,S]}),t[21]=S,t[22]=x,t[23]=C):C=t[23],C}function ie(e){return e.length>0}function ae(e){return e.trim()}function Z(e){let t=(0,M.c)(4),{visible:n}=e,r;t[0]===n?r=t[1]:(r=n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Saved`})]}):null,t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,L.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-emerald-600`,children:r}),t[2]=r,t[3]=i),i}function Q(e){e(!0),setTimeout(()=>e(!1),1200)}function $(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!$(e[n],t[n]))return!1;return!0}if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!$(e[r],t[r]))return!1;return!0}return!1}function oe(e){if(i(e)&&e.code===`SCHEMA_INVALID`){let t=e.issues[0];if(t)return t.message}return l(e)}function se(){let e=(0,M.c)(7),[t,n]=(0,j.useState)(!1),[r,i]=(0,j.useState)(!0),a,o;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=(typeof window<`u`?window.okDesktop:void 0)?.skill?.detectClaudeDesktop;if(!e){i(!0);return}let t=!1;return e().then(e=>{t||i(e)}).catch(()=>{t||i(!0)}),()=>{t=!0}},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,j.useEffect)(a,o),!r)return null;let s;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsxs)(`div`,{className:`space-y-1`,children:[(0,L.jsx)(`h2`,{id:`settings-integrations-title`,className:`text-base font-semibold`,children:`Integrations`}),(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect Open Knowledge to other tools you use.`})]}),e[2]=s):s=e[2];let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-sm font-medium`,children:`Install in Claude Desktop`}),(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Make this knowledge base available as a Claude Skill.`})]}),e[3]=c):c=e[3];let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`div`,{className:`rounded-md border p-3`,children:(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,(0,L.jsx)(m,{variant:`outline`,size:`sm`,onClick:()=>n(!0),"data-testid":`settings-install-claude-desktop`,children:`Install…`})]})}),e[4]=l):l=e[4];let u;return e[5]===t?u=e[6]:(u=(0,L.jsxs)(`section`,{"aria-labelledby":`settings-integrations-title`,className:`space-y-3`,children:[s,l,(0,L.jsx)(C,{open:t,onOpenChange:n})]}),e[5]=t,e[6]=u),u}export{B as SettingsPane};
@@ -1,3 +0,0 @@
1
- import{$ as e,Rt as t,X as n,Z as r,at as i,et as a,it as o,nt as s,rt as c,tt as l}from"./dist-CgDgVcCw.mjs";import{dirname as u,isAbsolute as d,resolve as f}from"node:path";import{existsSync as p,readFileSync as m,renameSync as h,unlinkSync as g}from"node:fs";import{homedir as _}from"node:os";import{mkdir as v,rename as y,writeFile as b}from"node:fs/promises";var x=t();function S(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${n}/${e===`user`?`config.user.schema.json`:`config.workspace.schema.json`}`}function C(e){return`# yaml-language-server: $schema=${S(e)}\n`}function w(t,n,r){return f(t===`user`?r??_():d(n)?n:f(n),e,`config.yml`)}function T(e){return{ok:!1,error:e}}function E(e){return{ok:!0,...e}}async function D(e,t){let n=`${e}.tmp.${crypto.randomUUID()}`;try{await b(n,t,{encoding:`utf-8`,mode:420}),await y(n,e)}catch(e){try{g(n)}catch{}throw e}}async function O(e){return o(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await k(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function k(e){let{cwd:t,scope:n,patch:o,homedirOverride:s,firstWriteHeader:d}=e,f=w(n,t,s),h=``,g=!1;if(p(f)){g=!0;try{h=m(f,`utf-8`)}catch(e){return T({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let _=(0,x.parseDocument)(h);if(_.errors.length>0)return T({code:`YAML_PARSE`,detail:_.errors.map(e=>e.message).join(`; `)});if(_.contents===null)_.contents=_.createNode({});else if(!(0,x.isMap)(_.contents))return T({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,x.isSeq)(_.contents)?`sequence`:`scalar`}`});let y=l(_,o),b=_.toJSON(),S=i(`config.validate`,{"config.scope":n,"config.validation.layer":`L2`},e=>{let t=r.safeParse(b);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)a(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!S.success)return T({code:`SCHEMA_INVALID`,issues:S.error.issues.map(c)});let O=_.toString();if(!g){let e=d===void 0?C(n):d??``;e.length>0&&(O=`${e.endsWith(`
2
- `)?e:`${e}\n`}${O}`)}try{await v(u(f),{recursive:!0})}catch(e){return T({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${f}: ${e instanceof Error?e.message:String(e)}`})}try{await D(f,O)}catch(e){return T({code:`WRITE_ERROR`,detail:`Could not write ${f}: ${e instanceof Error?e.message:String(e)}`})}return E({effective:S.data,appliedPaths:y,path:f,created:!g})}function A(e){if(!p(e))return[];let t=(0,x.parseDocument)(m(e,`utf-8`));if(t.errors.length>0)return[];let n=t.toJSON();if(!n||typeof n!=`object`||Array.isArray(n))return[];let r=n.folders;return Array.isArray(r)?r:[]}function j(e){return{ok:!1,error:e}}function M(e){return{ok:!0,...e}}async function N(e){let t=e.scope??`workspace`,n=w(t,e.cwd,e.homedirOverride),r;try{r=A(n)}catch(e){return j({code:`WRITE_ERROR`,detail:`Could not read current folders: ${e instanceof Error?e.message:String(e)}`})}let i=r.map(e=>({match:e.match,frontmatter:{...e.frontmatter}}));for(let t of e.rules){let e=t.new_match??t.match,n=i.findIndex(e=>e.match===t.match);if(t.new_match!==void 0&&t.new_match!==t.match){if(n>=0){let e=i.findIndex((e,r)=>r!==n&&e.match===t.new_match);e>=0&&i.splice(e,1);let r=e>=0&&e<n?n-1:n;i[r]={match:t.new_match,frontmatter:{...t.frontmatter}}}else{let n=i.findIndex(t=>t.match===e);n>=0?i[n]={match:e,frontmatter:{...t.frontmatter}}:i.push({match:e,frontmatter:{...t.frontmatter}})}continue}n>=0?i[n]={match:t.match,frontmatter:{...t.frontmatter}}:i.push({match:t.match,frontmatter:{...t.frontmatter}})}let a=await O({cwd:e.cwd,scope:t,patch:{folders:i},homedirOverride:e.homedirOverride});return a.ok?M({effective:a.effective,appliedPaths:a.appliedPaths,path:a.path,created:a.created}):j(a.error)}function P(e,t){let n=F(`user`,t),r=F(`workspace`,t),i=new Map;for(let t of e){let e=t.join(`.`);i.set(e,{user:I(n,t),workspace:I(r,t)})}return i}function F(e,t){let n=w(e,t.cwd,t.homedirOverride);if(!p(n))return null;let r;try{r=m(n,`utf-8`)}catch(t){return t.code!==`ENOENT`&&console.warn(`[inspectConfigPaths] could not read ${e} config at ${n}: ${t.message??t}`),null}let i=(0,x.parseDocument)(r);return i.errors.length>0?(console.warn(`[inspectConfigPaths] ${e} config at ${n} has YAML parse errors; treating as absent for scope inference`),null):i.toJSON()}function I(e,t){if(t.length===0)return e!=null;let n=e;for(let e of t){if(n==null)return!1;if(Array.isArray(n)&&typeof e==`number`){n=n[e];continue}if(typeof n==`object`){let t=String(e);if(!(t in n))return!1;n=n[t];continue}return!1}return n!==void 0}function L(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=s({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function R(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return h(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function z(e){let{absPath:t,sideline:n=!0,timestamp:i=new Date().toISOString()}=e,a=e.warn??(e=>console.warn(e)),o=r.parse({});if(!p(t))return{valid:!0,value:o,source:void 0};let s;try{s=m(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);return a(`[config] Could not read ${t}: ${n}. Using schema defaults.`),{valid:!1,value:o,error:{code:`UNKNOWN`,message:`Read failed: ${n}`}}}let c=(0,x.parseDocument)(s);if(c.errors.length>0){let e=c.errors.map(e=>e.message).join(`; `);a(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let r=n?R(t,i,a):void 0;return{valid:!1,value:o,error:{code:`YAML_PARSE`,detail:e},...r===void 0?{}:{sidelinedTo:r}}}let l=c.toJSON()??{},u=r.safeParse(l);if(!u.success){let e=L(u,c,s,t);a(`[config] ${t} fails schema validation (${u.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let r=n?R(t,i,a):void 0;return{valid:!1,value:o,error:e,...r===void 0?{}:{sidelinedTo:r}}}return{valid:!0,value:u.data,source:t}}export{O as a,w as i,P as n,z as r,N as t};
3
- //# sourceMappingURL=server-CTsFrqmD.mjs.map
@@ -1 +0,0 @@
1
- import"./loader-BgemTDND.mjs";import"./init-CqtfodiN.mjs";export{};
@@ -1 +0,0 @@
1
- import{o as e}from"./start-Bv4eE1v8.mjs";export{e as startCommand};