@inkeep/open-knowledge 0.9.0-beta.11 → 0.9.0-beta.13
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.
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +50 -50
- package/dist/constants-EfhRR_gr.mjs +2 -0
- package/dist/{dist-C5vyt2gE.mjs → dist-BBbP7DxV.mjs} +4 -4
- package/dist/{dist-D-usc-3E.mjs → dist-CpYAbkBw.mjs} +1 -1
- package/dist/{gh-detect-lzLKmmPa.mjs → gh-detect-D3_evne3.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/init-Cfa2w3tX.mjs +1 -0
- package/dist/{init-BGiBx-dh.mjs → init-DIFyMBZs.mjs} +6 -6
- package/dist/loader-Cd8qUPSh.mjs +1 -0
- package/dist/{loader-YWHDdTmw.mjs → loader-Mg7RInsh.mjs} +3 -3
- package/dist/{preview-1onz6LlI.mjs → preview-BUNvNkcD.mjs} +2 -2
- package/dist/preview-D2GxxtXj.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-Bm0U64-P.js → ActivityModeContent-BscrBati.js} +1 -1
- package/dist/public/assets/DocumentContext-CCtVCYnM.js +62 -0
- package/dist/public/assets/{GraphPanel-7INU_4XO.js → GraphPanel-BZLyzZlB.js} +3 -3
- package/dist/public/assets/SettingsDialogBody-CIS9SfKb.js +7 -0
- package/dist/public/assets/SourceEditor-CXHj9br1.js +2 -0
- package/dist/public/assets/{config-validation-events-BTvynJE_.js → config-validation-events-DaxQexzg.js} +5 -5
- package/dist/public/assets/index-U93cGbUs.css +1 -0
- package/dist/public/assets/index-mHmG_FVB.js +1914 -0
- package/dist/public/assets/{prop-types-kmSrjLlV.js → prop-types-aT575Fhm.js} +152 -152
- package/dist/public/assets/{target-navigation-intent-CoXNdpnE.js → target-navigation-intent-BPXK-fNF.js} +1 -1
- package/dist/public/assets/{toggle-group-5aVb_hvg.js → toggle-group-BxyYbA6G.js} +1 -1
- package/dist/public/assets/typing-burst-detector-D3uL_-1i.js +1 -0
- package/dist/public/index.html +9 -9
- package/dist/{repair-launch-json-A1apGhDa.mjs → repair-launch-json-CHoyWCeo.mjs} +2 -2
- package/dist/{repair-mcp-configs-CfjGV42_.mjs → repair-mcp-configs-Cbol0R2Q.mjs} +2 -2
- package/dist/repair-skills-CaLjuijU.mjs +1 -0
- package/dist/{repair-skills-CYk7FdgE.mjs → repair-skills-DL_fR7iS.mjs} +2 -2
- package/dist/{server-lock-BpjJj3OD-DTrUUOuT.mjs → server-lock-BpjJj3OD-B9uBbH7Z.mjs} +2 -2
- package/dist/server-lock-CyhBidkz-Bp84kpW5.mjs +1 -0
- package/dist/{src-CxPEB13L.mjs → src-gAvXPDY3.mjs} +2 -2
- package/dist/{start-CI3--hV-.mjs → start-CfcNOkrG.mjs} +2 -2
- package/dist/start-DzCcS7aH.mjs +1 -0
- package/dist/{write-project-skill-4i2U2-lw.mjs → write-project-skill-BNMnZE-x.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-Op3gxR6V.mjs +0 -2
- package/dist/init-ocjYxfXH.mjs +0 -1
- package/dist/loader-D-NfPdsY.mjs +0 -1
- package/dist/preview-C72bqupY.mjs +0 -1
- package/dist/public/assets/DocumentContext-CgD8AejB.js +0 -61
- package/dist/public/assets/SettingsDialogBody-D8T0NRov.js +0 -7
- package/dist/public/assets/SourceEditor-CpS1HdDh.js +0 -2
- package/dist/public/assets/index-BuqVcYKx.css +0 -1
- package/dist/public/assets/index-D1lV0gmE.js +0 -1914
- package/dist/public/assets/typing-burst-detector-CnVF7lj5.js +0 -2
- package/dist/repair-skills-cLf2y4ac.mjs +0 -1
- package/dist/server-lock-CyhBidkz-wSdcUU--.mjs +0 -1
- package/dist/start-BQZztUkg.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./prop-types-
|
|
1
|
+
import{m as e}from"./prop-types-aT575Fhm.js";function t(e){switch(e.kind){case`doc`:case`large-file`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:case`asset`:return`missing`}}function n(n,r){let i=e(n,r);return{resolvedTarget:i,hashDocName:i.target,displayState:t(i)}}export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{X as i,Z as a}from"./prop-types-kmSrjLlV.js";import{C as o,S as s,b as c,d as l,l as u,m as d,o as f,p,s as m,x as h}from"./button-DenIdY-r.js";var g=o(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),_=e(t(),1),v=n(),y=`rovingFocusGroup.onEntryFocus`,b={bubbles:!1,cancelable:!0},x=`RovingFocusGroup`,[S,C,w]=a(x),[T,E]=p(x,[w]),[ee,D]=T(x),O=_.forwardRef((e,t)=>(0,v.jsx)(S.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(S.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(k,{...e,ref:t})})}));O.displayName=x;var k=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:g=!1,...S}=e,w=_.useRef(null),T=c(t,w),E=i(o),[D,O]=u({prop:s,defaultProp:p??null,onChange:m,caller:x}),[k,A]=_.useState(!1),j=f(h),M=C(n),N=_.useRef(!1),[P,I]=_.useState(0);return _.useEffect(()=>{let e=w.current;if(e)return e.addEventListener(y,j),()=>e.removeEventListener(y,j)},[j]),(0,v.jsx)(ee,{scope:n,orientation:r,dir:E,loop:a,currentTabStopId:D,onItemFocus:_.useCallback(e=>O(e),[O]),onItemShiftTab:_.useCallback(()=>A(!0),[]),onFocusableItemAdd:_.useCallback(()=>I(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>I(e=>e-1),[]),children:(0,v.jsx)(d.div,{tabIndex:k||P===0?-1:0,"data-orientation":r,...S,ref:T,style:{outline:`none`,...e.style},onMouseDown:l(e.onMouseDown,()=>{N.current=!0}),onFocus:l(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!k){let t=new CustomEvent(y,b);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=M().filter(e=>e.focusable);F([e.find(e=>e.active),e.find(e=>e.id===D),...e].filter(Boolean).map(e=>e.ref.current),g)}}N.current=!1}),onBlur:l(e.onBlur,()=>A(!1))})})}),A=`RovingFocusGroupItem`,j=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=m(),u=a||c,f=D(A,n),p=f.currentTabStopId===u,h=C(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:b}=f;return _.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),(0,v.jsx)(S.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,v.jsx)(d.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...s,ref:t,onMouseDown:l(e.onMouseDown,e=>{r?f.onItemFocus(u):e.preventDefault()}),onFocus:l(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:l(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){f.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=P(e,f.orientation,f.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=h().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=f.loop?I(n,r+1):n.slice(r+1)}setTimeout(()=>F(n))}}),children:typeof o==`function`?o({isCurrentTabStop:p,hasTabStop:b!=null}):o})})});j.displayName=A;var M={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function N(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function P(e,t,n){let r=N(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return M[r]}function F(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function I(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var L=O,R=j,z=`Toggle`,B=_.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=u({prop:n,onChange:i,defaultProp:r??!1,caller:z});return(0,v.jsx)(d.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:l(e.onClick,()=>{e.disabled||s(!o)})})});B.displayName=z;var te=B,V=`ToggleGroup`,[H,ne]=p(V,[E]),U=E(),W=_.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,v.jsx)(re,{...r,ref:t});if(n===`multiple`)return(0,v.jsx)(ie,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${V}\``)});W.displayName=V;var[G,K]=H(V),re=_.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??``,onChange:i,caller:V});return(0,v.jsx)(G,{scope:e.__scopeToggleGroup,type:`single`,value:_.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:_.useCallback(()=>s(``),[s]),children:(0,v.jsx)(q,{...a,ref:t})})}),ie=_.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??[],onChange:i,caller:V}),c=_.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=_.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,v.jsx)(G,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,v.jsx)(q,{...a,ref:t})})});W.displayName=V;var[ae,oe]=H(V),q=_.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:a=!0,orientation:o,dir:s,loop:c=!0,...l}=e,u=U(n),f=i(s),p={role:`group`,dir:f,...l};return(0,v.jsx)(ae,{scope:n,rovingFocus:a,disabled:r,children:a?(0,v.jsx)(L,{asChild:!0,...u,orientation:o,dir:f,loop:c,children:(0,v.jsx)(d.div,{...p,ref:t})}):(0,v.jsx)(d.div,{...p,ref:t})})}),J=`ToggleGroupItem`,Y=_.forwardRef((e,t)=>{let n=K(J,e.__scopeToggleGroup),r=oe(J,e.__scopeToggleGroup),i=U(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=_.useRef(null);return r.rovingFocus?(0,v.jsx)(R,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,v.jsx)(X,{...s,ref:t})}):(0,v.jsx)(X,{...s,ref:t})});Y.displayName=J;var X=_.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=K(J,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,v.jsx)(B,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),se=W,ce=Y,Z=r(),Q=h(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}});function le(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,c=a===void 0?`default`:a,l;t[5]!==n||t[6]!==c||t[7]!==o?(l=s(Q({variant:o,size:c,className:n})),t[5]=n,t[6]=c,t[7]=o,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==c||t[11]!==l||t[12]!==o?(u=(0,v.jsx)(te,{"data-slot":`toggle`,"data-variant":o,"data-size":c,className:l,...r}),t[9]=r,t[10]=c,t[11]=l,t[12]=o,t[13]=u):u=t[13],u}var $=_.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function ue(e){let t=(0,Z.c)(29),n,r,i,a,o,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7]):({className:r,variant:l,size:a,spacing:o,orientation:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l);let u=o===void 0?0:o,d=c===void 0?`horizontal`:c,f;t[8]===u?f=t[9]:(f={"--gap":u},t[8]=u,t[9]=f);let p=f,m;t[10]===r?m=t[11]:(m=s(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==d||t[13]!==a||t[14]!==u||t[15]!==l?(h={variant:l,size:a,spacing:u,orientation:d},t[12]=d,t[13]=a,t[14]=u,t[15]=l,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==h?(g=(0,v.jsx)($.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==d||t[21]!==i||t[22]!==a||t[23]!==u||t[24]!==p||t[25]!==m||t[26]!==g||t[27]!==l?(_=(0,v.jsx)(se,{"data-slot":`toggle-group`,"data-variant":l,"data-size":a,"data-spacing":u,"data-orientation":d,style:p,className:m,...i,children:g}),t[20]=d,t[21]=i,t[22]=a,t[23]=u,t[24]=p,t[25]=m,t[26]=g,t[27]=l,t[28]=_):_=t[28],_}function de(e){let t=(0,Z.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c=a===void 0?`default`:a,l=o===void 0?`default`:o,u=_.use($),d=u.variant||c,f=u.size||l,p=u.spacing,m;t[6]!==r||t[7]!==u.size||t[8]!==u.variant||t[9]!==l||t[10]!==c?(m=s(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t text-muted-foreground data-[state=on]:text-foreground`,Q({variant:u.variant||c,size:u.size||l}),r),t[6]=r,t[7]=u.size,t[8]=u.variant,t[9]=l,t[10]=c,t[11]=m):m=t[11];let h;return t[12]!==n||t[13]!==u.spacing||t[14]!==i||t[15]!==d||t[16]!==f||t[17]!==m?(h=(0,v.jsx)(ce,{"data-slot":`toggle-group-item`,"data-variant":d,"data-size":f,"data-spacing":p,className:m,...i,children:n}),t[12]=n,t[13]=u.spacing,t[14]=i,t[15]=d,t[16]=f,t[17]=m,t[18]=h):h=t[18],h}export{L as a,R as i,de as n,E as o,le as r,g as s,ue as t};
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,o as n,t as r}from"./compiler-runtime-Cs91PcD2.js";import{X as i,Z as a}from"./prop-types-aT575Fhm.js";import{C as o,S as s,b as c,d as l,l as u,m as d,o as f,p,s as m,x as h}from"./button-DenIdY-r.js";var g=o(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),_=e(t(),1),v=n(),y=`rovingFocusGroup.onEntryFocus`,b={bubbles:!1,cancelable:!0},x=`RovingFocusGroup`,[S,C,w]=a(x),[T,E]=p(x,[w]),[ee,D]=T(x),O=_.forwardRef((e,t)=>(0,v.jsx)(S.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(S.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(k,{...e,ref:t})})}));O.displayName=x;var k=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:m,onEntryFocus:h,preventScrollOnEntryFocus:g=!1,...S}=e,w=_.useRef(null),T=c(t,w),E=i(o),[D,O]=u({prop:s,defaultProp:p??null,onChange:m,caller:x}),[k,A]=_.useState(!1),j=f(h),M=C(n),N=_.useRef(!1),[P,I]=_.useState(0);return _.useEffect(()=>{let e=w.current;if(e)return e.addEventListener(y,j),()=>e.removeEventListener(y,j)},[j]),(0,v.jsx)(ee,{scope:n,orientation:r,dir:E,loop:a,currentTabStopId:D,onItemFocus:_.useCallback(e=>O(e),[O]),onItemShiftTab:_.useCallback(()=>A(!0),[]),onFocusableItemAdd:_.useCallback(()=>I(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>I(e=>e-1),[]),children:(0,v.jsx)(d.div,{tabIndex:k||P===0?-1:0,"data-orientation":r,...S,ref:T,style:{outline:`none`,...e.style},onMouseDown:l(e.onMouseDown,()=>{N.current=!0}),onFocus:l(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!k){let t=new CustomEvent(y,b);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=M().filter(e=>e.focusable);F([e.find(e=>e.active),e.find(e=>e.id===D),...e].filter(Boolean).map(e=>e.ref.current),g)}}N.current=!1}),onBlur:l(e.onBlur,()=>A(!1))})})}),A=`RovingFocusGroupItem`,j=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=m(),u=a||c,f=D(A,n),p=f.currentTabStopId===u,h=C(n),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:b}=f;return _.useEffect(()=>{if(r)return g(),()=>y()},[r,g,y]),(0,v.jsx)(S.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:(0,v.jsx)(d.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...s,ref:t,onMouseDown:l(e.onMouseDown,e=>{r?f.onItemFocus(u):e.preventDefault()}),onFocus:l(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:l(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){f.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=P(e,f.orientation,f.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=h().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=f.loop?I(n,r+1):n.slice(r+1)}setTimeout(()=>F(n))}}),children:typeof o==`function`?o({isCurrentTabStop:p,hasTabStop:b!=null}):o})})});j.displayName=A;var M={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function N(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function P(e,t,n){let r=N(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return M[r]}function F(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function I(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var L=O,R=j,z=`Toggle`,B=_.forwardRef((e,t)=>{let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=u({prop:n,onChange:i,defaultProp:r??!1,caller:z});return(0,v.jsx)(d.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:l(e.onClick,()=>{e.disabled||s(!o)})})});B.displayName=z;var te=B,V=`ToggleGroup`,[H,ne]=p(V,[E]),U=E(),W=_.forwardRef((e,t)=>{let{type:n,...r}=e;if(n===`single`)return(0,v.jsx)(re,{...r,ref:t});if(n===`multiple`)return(0,v.jsx)(ie,{...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${V}\``)});W.displayName=V;var[G,K]=H(V),re=_.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??``,onChange:i,caller:V});return(0,v.jsx)(G,{scope:e.__scopeToggleGroup,type:`single`,value:_.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:_.useCallback(()=>s(``),[s]),children:(0,v.jsx)(q,{...a,ref:t})})}),ie=_.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:i=()=>{},...a}=e,[o,s]=u({prop:n,defaultProp:r??[],onChange:i,caller:V}),c=_.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=_.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,v.jsx)(G,{scope:e.__scopeToggleGroup,type:`multiple`,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,v.jsx)(q,{...a,ref:t})})});W.displayName=V;var[ae,oe]=H(V),q=_.forwardRef((e,t)=>{let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:a=!0,orientation:o,dir:s,loop:c=!0,...l}=e,u=U(n),f=i(s),p={role:`group`,dir:f,...l};return(0,v.jsx)(ae,{scope:n,rovingFocus:a,disabled:r,children:a?(0,v.jsx)(L,{asChild:!0,...u,orientation:o,dir:f,loop:c,children:(0,v.jsx)(d.div,{...p,ref:t})}):(0,v.jsx)(d.div,{...p,ref:t})})}),J=`ToggleGroupItem`,Y=_.forwardRef((e,t)=>{let n=K(J,e.__scopeToggleGroup),r=oe(J,e.__scopeToggleGroup),i=U(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=_.useRef(null);return r.rovingFocus?(0,v.jsx)(R,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,v.jsx)(X,{...s,ref:t})}):(0,v.jsx)(X,{...s,ref:t})});Y.displayName=J;var X=_.forwardRef((e,t)=>{let{__scopeToggleGroup:n,value:r,...i}=e,a=K(J,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0};return(0,v.jsx)(B,{...a.type===`single`?o:void 0,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})}),se=W,ce=Y,Z=r(),Q=h(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}});function le(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,variant:i,size:a,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`default`:i,c=a===void 0?`default`:a,l;t[5]!==n||t[6]!==c||t[7]!==o?(l=s(Q({variant:o,size:c,className:n})),t[5]=n,t[6]=c,t[7]=o,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==c||t[11]!==l||t[12]!==o?(u=(0,v.jsx)(te,{"data-slot":`toggle`,"data-variant":o,"data-size":c,className:l,...r}),t[9]=r,t[10]=c,t[11]=l,t[12]=o,t[13]=u):u=t[13],u}var $=_.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function ue(e){let t=(0,Z.c)(29),n,r,i,a,o,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],c=t[6],l=t[7]):({className:r,variant:l,size:a,spacing:o,orientation:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=c,t[7]=l);let u=o===void 0?0:o,d=c===void 0?`horizontal`:c,f;t[8]===u?f=t[9]:(f={"--gap":u},t[8]=u,t[9]=f);let p=f,m;t[10]===r?m=t[11]:(m=s(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=m);let h;t[12]!==d||t[13]!==a||t[14]!==u||t[15]!==l?(h={variant:l,size:a,spacing:u,orientation:d},t[12]=d,t[13]=a,t[14]=u,t[15]=l,t[16]=h):h=t[16];let g;t[17]!==n||t[18]!==h?(g=(0,v.jsx)($.Provider,{value:h,children:n}),t[17]=n,t[18]=h,t[19]=g):g=t[19];let _;return t[20]!==d||t[21]!==i||t[22]!==a||t[23]!==u||t[24]!==p||t[25]!==m||t[26]!==g||t[27]!==l?(_=(0,v.jsx)(se,{"data-slot":`toggle-group`,"data-variant":l,"data-size":a,"data-spacing":u,"data-orientation":d,style:p,className:m,...i,children:g}),t[20]=d,t[21]=i,t[22]=a,t[23]=u,t[24]=p,t[25]=m,t[26]=g,t[27]=l,t[28]=_):_=t[28],_}function de(e){let t=(0,Z.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let c=a===void 0?`default`:a,l=o===void 0?`default`:o,u=_.use($),d=u.variant||c,f=u.size||l,p=u.spacing,m;t[6]!==r||t[7]!==u.size||t[8]!==u.variant||t[9]!==l||t[10]!==c?(m=s(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t text-muted-foreground data-[state=on]:text-foreground`,Q({variant:u.variant||c,size:u.size||l}),r),t[6]=r,t[7]=u.size,t[8]=u.variant,t[9]=l,t[10]=c,t[11]=m):m=t[11];let h;return t[12]!==n||t[13]!==u.spacing||t[14]!==i||t[15]!==d||t[16]!==f||t[17]!==m?(h=(0,v.jsx)(ce,{"data-slot":`toggle-group-item`,"data-variant":d,"data-size":f,"data-spacing":p,className:m,...i,children:n}),t[12]=n,t[13]=u.spacing,t[14]=i,t[15]=d,t[16]=f,t[17]=m,t[18]=h):h=t[18],h}export{L as a,R as i,de as n,E as o,le as r,g as s,ue as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{a as t,i as n,o as r,r as i,t as a}from"./compiler-runtime-Cs91PcD2.js";import{Sn as o,ct as s,n as c}from"./DocumentContext-CCtVCYnM.js";import{a as l,c as ee,i as u,n as d,o as te,r as ne,s as re,t as f,u as p}from"./panel-BNBODYwB.js";import{Jt as m,Vi as h,Zt as g,u as ie}from"./prop-types-aT575Fhm.js";import{S as ae}from"./button-DenIdY-r.js";var _=e(t(),1),v=a(),y=new Map;function b(e,t){y.set(e,t)}function x(e){let t=y.get(e)??null;return y.delete(e),t}function S(e){y.delete(e)}function C(e,t){let n=(0,v.c)(4),r=t===void 0?!1:t,[i,a]=(0,_.useState)(void 0),o=(0,_.useRef)(null),s,c;return n[0]!==r||n[1]!==e?(s=()=>{if(r||e.length===0){a(void 0);return}let t=function(){let t=window.innerHeight/2,n,r;for(let i of e){let e=document.getElementById(i);if(!e)continue;let a=e.getBoundingClientRect().top;a<0?n=i:r===void 0&&a<t&&(r=i)}a(r??n??e[0])},n=function(){o.current===null&&(o.current=requestAnimationFrame(()=>{o.current=null,t()}))};return document.addEventListener(`scroll`,n,{capture:!0,passive:!0}),t(),()=>{document.removeEventListener(`scroll`,n,{capture:!0}),o.current!==null&&(cancelAnimationFrame(o.current),o.current=null)}},c=[e,r],n[0]=r,n[1]=e,n[2]=s,n[3]=c):(s=n[2],c=n[3]),(0,_.useEffect)(s,c),i}var w=r(),oe=300;async function se(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new s(h._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=g.safeParse(n);throw e.success?Error(e.data.title):new s(h._({id:`zlErBl`}),{status:t.status})}let r=m.safeParse(n);if(!r.success)throw new s(h._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var T=32,E=12,D=6,O=`open-knowledge:outline-nav`;function k(e){let t=(0,v.c)(2),n;return t[0]===e?n=t[1]:(n=(0,w.jsx)(o,{name:`outline-panel`,children:(0,w.jsx)(A,{...e})}),t[0]=e,t[1]=n),n}function A(e){let t=(0,v.c)(50),{docName:r,isSourceMode:a,className:o}=e,s=o===void 0?``:o,{_:m}=n(),{pages:h,loading:g}=ie(),y=p(),{activeProvider:x,activeDocName:S}=c(),k,A;t[0]===r?(k=t[1],A=t[2]):(k=[`page-headings`,r],A=()=>se(r),t[0]=r,t[1]=k,t[2]=A);let j;t[3]!==r||t[4]!==g||t[5]!==h?(j=!g&&h.has(r),t[3]=r,t[4]=g,t[5]=h,t[6]=j):j=t[6];let M;t[7]!==k||t[8]!==A||t[9]!==j?(M={queryKey:k,queryFn:A,enabled:j,staleTime:1/0},t[7]=k,t[8]=A,t[9]=j,t[10]=M):M=t[10];let{data:N,isLoading:P,error:F}=ee(M),I;t[11]===N?I=t[12]:(I=N===void 0?[]:N,t[11]=N,t[12]=I);let L=I,R,z;t[13]!==S||t[14]!==x||t[15]!==r||t[16]!==y?(R=()=>{if(!x||S!==r)return;let e=x.document,t=null,n=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,y.invalidateQueries({queryKey:[`page-headings`,r]})},oe)};return e.on(`update`,n),()=>{e.off(`update`,n),t!==null&&clearTimeout(t)}},z=[x,S,r,y],t[13]=S,t[14]=x,t[15]=r,t[16]=y,t[17]=R,t[18]=z):(R=t[17],z=t[18]),(0,_.useEffect)(R,z);let B;t[19]===L?B=t[20]:(B=L.map(ce),t[19]=L,t[20]=B);let V=C(B,a),H;t[21]!==V||t[22]!==L?(H=V?L.findIndex(e=>e.slug===V):-1,t[21]=V,t[22]=L,t[23]=H):H=t[23];let U=H,W;t[24]!==r||t[25]!==a?(W=function(e,t){let n={index:e,slug:t,mode:a?`source`:`wysiwyg`};n.mode===`source`&&b(r,{kind:`outline`,detail:n}),window.dispatchEvent(new CustomEvent(O,{detail:n}))},t[24]=r,t[25]=a,t[26]=W):W=t[26];let G=W,K=((U>=0?L[U].level:1)-1)*E+(E-D)/2,q=U*T+(T-D)/2,J;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,w.jsx)(re,{children:(0,w.jsx)(i,{id:`dD7NPy`})}),t[27]=J):J=t[27];let Y;t[28]!==L.length||t[29]!==P?(Y=!P&&(0,w.jsx)(ne,{children:L.length}),t[28]=L.length,t[29]=P,t[30]=Y):Y=t[30];let X;t[31]===Y?X=t[32]:(X=(0,w.jsxs)(te,{children:[J,Y]}),t[31]=Y,t[32]=X);let Z;t[33]!==m||t[34]!==U||t[35]!==V||t[36]!==F||t[37]!==G||t[38]!==L||t[39]!==P||t[40]!==K||t[41]!==q?(Z=F?(0,w.jsx)(l,{className:`px-2`,children:F instanceof Error?F.message:m({id:`GuqOb1`})}):L.length===0&&!P?(0,w.jsx)(u,{className:`px-2`,children:(0,w.jsx)(i,{id:`0BB9ID`})}):(0,w.jsxs)(`nav`,{"aria-label":m({id:`BymzO4`}),className:`relative`,children:[U>=0&&(0,w.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-0 top-0 rounded-full bg-primary motion-safe:[transition:transform_0.25s_var(--ease-out-strong)]`,style:{width:D,height:D,transform:`translate(${K}px, ${q}px)`}}),L.map((e,t)=>{let n=e.slug===V;return(0,w.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>G(t,e.slug),className:ae(`w-full cursor-pointer truncate py-1.5 pe-2 text-left text-sm transition-colors`,n?`font-medium text-primary`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${(e.level-1)*E+20}px`},title:e.text,children:e.text},t)})]}),t[33]=m,t[34]=U,t[35]=V,t[36]=F,t[37]=G,t[38]=L,t[39]=P,t[40]=K,t[41]=q,t[42]=Z):Z=t[42];let Q;t[43]!==P||t[44]!==Z?(Q=(0,w.jsx)(d,{className:`px-3 py-2`,"aria-busy":P,children:Z}),t[43]=P,t[44]=Z,t[45]=Q):Q=t[45];let $;return t[46]!==s||t[47]!==X||t[48]!==Q?($=(0,w.jsxs)(f,{className:s,children:[X,Q]}),t[46]=s,t[47]=X,t[48]=Q,t[49]=$):$=t[49],$}function ce(e){return e.slug}export{b as a,x as i,k as n,S as r,O as t};
|
package/dist/public/index.html
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
-->
|
|
49
49
|
<script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } if (dark) document.documentElement.classList.add('dark'); if (window.okDesktop) document.documentElement.classList.add('electron-mode'); })();</script>
|
|
50
50
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
51
|
-
<script type="module" crossorigin src="./assets/index-
|
|
51
|
+
<script type="module" crossorigin src="./assets/index-mHmG_FVB.js"></script>
|
|
52
52
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CFjPhJqf.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
|
|
54
54
|
<link rel="modulepreload" crossorigin href="./assets/w3c-keyname-B5t0fahT.js">
|
|
@@ -61,24 +61,24 @@
|
|
|
61
61
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-Cs91PcD2.js">
|
|
62
62
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-CiCjX4Sz.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="./assets/button-DenIdY-r.js">
|
|
64
|
-
<link rel="modulepreload" crossorigin href="./assets/prop-types-
|
|
64
|
+
<link rel="modulepreload" crossorigin href="./assets/prop-types-aT575Fhm.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="./assets/propagation-api-3kmMXRwS.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="./assets/collapsible-BhpeB6tu.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="./assets/dialog-nKg9NzaE.js">
|
|
68
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
69
|
-
<link rel="modulepreload" crossorigin href="./assets/panel-BNBODYwB.js">
|
|
70
|
-
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-CnVF7lj5.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-CCtVCYnM.js">
|
|
71
69
|
<link rel="modulepreload" crossorigin href="./assets/checkbox-CBMLW0iM.js">
|
|
72
70
|
<link rel="modulepreload" crossorigin href="./assets/label-DCMZaJ38.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="./assets/toggle-group-
|
|
71
|
+
<link rel="modulepreload" crossorigin href="./assets/toggle-group-BxyYbA6G.js">
|
|
74
72
|
<link rel="modulepreload" crossorigin href="./assets/textarea-C_bHQrXh.js">
|
|
75
|
-
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-
|
|
73
|
+
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-DaxQexzg.js">
|
|
74
|
+
<link rel="modulepreload" crossorigin href="./assets/panel-BNBODYwB.js">
|
|
76
75
|
<link rel="modulepreload" crossorigin href="./assets/agent-presence-DxGcS3q2.js">
|
|
77
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
76
|
+
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-D3uL_-1i.js">
|
|
77
|
+
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-BPXK-fNF.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="./assets/project-paths-eyh51nmQ.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-19Boxoxe.js">
|
|
80
80
|
<link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
|
|
81
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
81
|
+
<link rel="stylesheet" crossorigin href="./assets/index-U93cGbUs.css">
|
|
82
82
|
</head>
|
|
83
83
|
|
|
84
84
|
<body class="antialiased">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,u as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{n as e,u as t}from"./init-DIFyMBZs.mjs";import{t as n}from"./is-object-C-4FJ0rP.mjs";import{join as r}from"node:path";import{existsSync as i,readFileSync as a}from"node:fs";const o=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`]];function s(t){if(t.runtimeExecutable!==`npx`||!Array.isArray(t.runtimeArgs))return`preserved`;if(c(t.runtimeArgs,e))return`canonical`;for(let e of o)if(c(t.runtimeArgs,e))return`legacy-bare`;return`preserved`}function c(e,t){if(e.length!==t.length)return!1;for(let n=0;n<t.length;n++)if(e[n]!==t[n])return!1;return!0}function l(e){let o=e.logger??u,c=r(e.projectDir,`.claude`,`launch.json`);if(e.reclaimDisableEnv===`1`)return o({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:c,outcome:`skipped-reclaim-disabled`},repairedCount:0};if(!i(c))return{outcome:{configPath:c,outcome:`no-file`},repairedCount:0};let l;try{let e=a(c,`utf-8`).trim();l=e?JSON.parse(e):{}}catch(e){let t=e instanceof Error?e.message:String(e);return o({event:`launch-json-repair-read-failed`,configPath:c,error:t}),{outcome:{configPath:c,outcome:`read-failed`,error:t},repairedCount:0}}if(!n(l)){let e=`launch.json root is not an object`;return o({event:`launch-json-repair-read-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`read-failed`,error:e},repairedCount:0}}let d=l.configurations;if(!Array.isArray(d))return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let f=d.find(e=>n(e)&&e.name===`open-knowledge-ui`);if(!f)return{outcome:{configPath:c,outcome:`no-entry`},repairedCount:0};let p=s(f);if(p===`canonical`)return{outcome:{configPath:c,outcome:`canonical`},repairedCount:0};if(p===`preserved`)return{outcome:{configPath:c,outcome:`preserved`},repairedCount:0};let m=t(e.projectDir,{mode:`published`});if(m.action===`failed`){let e=m.error??`unknown write failure`;return o({event:`launch-json-repair-write-failed`,configPath:c,error:e}),{outcome:{configPath:c,outcome:`write-failed`,error:e},repairedCount:0}}return o({event:`launch-json-repair-applied`,configPath:c}),{outcome:{configPath:c,outcome:`repaired`},repairedCount:1}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{l as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-CHoyWCeo.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e,g as t,m as n,s as r,v as i}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{d as e,g as t,m as n,s as r,v as i}from"./init-DIFyMBZs.mjs";import{t as a}from"./mcp-migrate-event-BF8ILHwp.mjs";import{homedir as o}from"node:os";function s(e){let r=e.logger??u,i=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of n){let n=t[o],s=c(()=>n.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:n,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),n.projectConfigPath){let t=n.projectConfigPath,i=c(()=>t(e.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:n,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(t){let n={scope:t.scope,editorId:t.editorId,configPath:t.configPath},o=r(t.target,t.cwd,t.home,t.configPathOverride);if(o===null)return{...n,outcome:`no-entry`};if(i(o))return{...n,outcome:`canonical`};t.logger(a({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:o}));let s=e(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...n,outcome:`write-failed`,error:e}}return{...n,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-Cbol0R2Q.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./repair-skills-DL_fR7iS.mjs";export{e as repairSkills};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{t as e}from"./esm-CEs3LWY3.mjs";import{Xn as t,di as n,er as r,ir as i,ur as a}from"./dist-
|
|
1
|
+
import{t as e}from"./esm-CEs3LWY3.mjs";import{Xn as t,di as n,er as r,ir as i,ur as a}from"./dist-BBbP7DxV.mjs";import{t as o}from"./write-project-skill-BNMnZE-x.mjs";import{dirname as s,join as c,resolve as l}from"node:path";import{existsSync as u,mkdirSync as d,readFileSync as f,readdirSync as p,rmSync as m,statSync as h,writeFileSync as g}from"node:fs";import{homedir as _}from"node:os";const v=[{hostDir:`.claude`,editorId:`claude`},{hostDir:`.cursor`,editorId:`cursor`},{hostDir:`.agents`,editorId:`codex`}],y=`open-knowledge-discovery`,b=[`.agents`,`skills`,y],x={existsSync:e=>u(e),isDirectory:e=>{try{return h(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>p(e),readFileSync:e=>f(e),writeFileSync:(e,t)=>{g(e,t)},mkdirSync:(e,t)=>{d(e,t)},rmSync:(e,t)=>{m(e,t)}},S={resolveProjectBundledSkillDir:()=>a(`project`,{checkDesktop:!1}),resolveDiscoveryBundledSkillDir:()=>a(`discovery`,{checkDesktop:!1}),readBundledVersion:()=>t(),readRecordedVersion:e=>r(e,`cli-hosts`),writeRecordedVersion:(e,t)=>n(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>i(e)};function C(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function w(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(s(t),{recursive:!0}),T(e,t,n)}function T(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=c(e,r),a=c(t,r);n.isDirectory(i)?T(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function E(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of v){let s=c(e,t.hostDir,`skills`,`open-knowledge`),l=c(s,`SKILL.md`);if(!n.existsSync(l)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:s});continue}try{o(s,e),w(i,s,n),a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`reclaimed`}),r({event:`project-skill-reclaim-reclaimed`,scope:`project`,editorId:t.editorId,path:s})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:s,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:s,error:n})}}return{outcome:`done`,entries:a}}async function D(e,t,n,r){let i=e=>{t.recordEvent(e).catch(()=>{})},a=()=>new Date().toISOString(),o;try{o=await t.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return r({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let s;try{s=await t.readRecordedVersion(e)}catch(e){r({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),s=null}if(s!==null&&s===o)return r({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:o}),{outcome:`skipped`,reason:`version-current`};let l;try{l=t.resolveDiscoveryBundledSkillDir()}catch(e){let t=e instanceof Error?e.message:String(e);return r({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:t}),i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`bundle-missing:${t}`}),{outcome:`skipped`,reason:`bundle-missing`}}let u=[],d=c(e,...b),f=n.existsSync(d);try{w(l,d,n),u.push({kind:`central`,path:d,outcome:f?`overwritten`:`written`}),r({event:`user-skill-reclaim-central-written`,scope:`user`,path:d,preexisting:f,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);u.push({kind:`central`,path:d,outcome:`failed`,error:t}),r({event:`user-skill-reclaim-central-failed`,scope:`user`,path:d,error:t})}for(let t of v){let i=c(e,t.hostDir),a=c(i,`skills`,y);if(a===d){u.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`skipped-collapsed-with-central`});continue}if(!n.existsSync(i)){u.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`skipped-host-absent`});continue}let s=n.existsSync(a);try{w(l,a,n),u.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:s?`overwritten`:`written`}),r({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:t.editorId,hostDir:t.hostDir,path:a,preexisting:s,version:o})}catch(e){let n=e instanceof Error?e.message:String(e);u.push({kind:`host`,editorId:t.editorId,hostDir:t.hostDir,path:a,outcome:`failed`,error:n}),r({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:t.editorId,hostDir:t.hostDir,path:a,error:n})}}let p=u.find(e=>e.kind===`central`);if(p?.outcome===`written`||p?.outcome===`overwritten`){let n=null;try{await t.writeRecordedVersion(e,o),r({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:o})}catch(e){n=e instanceof Error?e.message:String(e),r({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:o,error:n})}i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:n===null?`installed`:`failed`,version:o,...n===null?{}:{reason:`state-write-failed:${n}`}})}else{let e=u.some(e=>e.kind===`host`&&e.outcome===`failed`);i({ts:a(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,version:o,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:o,entries:u}}async function O(e){let t=e.logger??C,n=e.fs??x,r=e.home??_(),i={...S,...e.deps};return e.reclaimDisableEnv===`1`?(t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`}):{status:`done`,project:E(e.projectDir,i,n,t),user:await D(r,i,n,t)}}function k(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function A(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`reclaimed`).length,r=e.project.entries.filter(e=>e.outcome===`no-token`).length,i=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} no-token, ${i} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return t.join(`
|
|
2
2
|
`)}function j(){return new e(`repair-skills`).description("Refresh bundled SKILL.md files for installed AI editors (project-local + user-global). Runs automatically during `ok start`; this command forces an explicit sweep.").action(async()=>{let e=await O({projectDir:l(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null});process.stdout.write(`${A(e)}\n`),process.exitCode=k(e)})}export{j as n,O as t};
|
|
3
|
-
//# sourceMappingURL=repair-skills-
|
|
3
|
+
//# sourceMappingURL=repair-skills-DL_fR7iS.mjs.map
|
|
@@ -424,5 +424,5 @@ $2`).split(`
|
|
|
424
424
|
`;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length),p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}return`|${n.join(`|`)}|`},h=Array.from({length:f},()=>null);if(a.length===0)return m(p,h);let g=[];g.push(m(a[0],o[0]??[])),g.push(m(p,h));for(let e=1;e<a.length;e++)g.push(m(a[e],o[e]??[]));return g.join(`
|
|
425
425
|
`)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=bZ(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),o+=i.move(`==`),a(),o},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=bZ(e.attributes??[]);return r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>n?`>`:s?.[c++]===`none`?`>${e}`:`> ${e}`)}};function bZ(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function xZ(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function SZ(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function CZ(e){return e.replace(/(?<!\\)&(?=[A-Za-z][A-Za-z0-9]*;|#[0-9]+;|#[xX][0-9A-Fa-f]+;)/g,`\\&`)}function wZ(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`||e.character==="`"));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return CZ(i)}function TZ(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var EZ=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=_y(e.extensions),this.handlers=IZ(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=LZ(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=uZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=dZ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:yZ})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return fZ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?pZ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?zJ(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}return mZ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const DZ=OJ();function OZ(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function kZ(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function AZ(e){return e.attrs.sourceDirty||kZ(e)}function jZ(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function MZ(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),Object.keys(n).length===0?e:{...e,data:n}}function NZ(e,t){if(e.length===0)return MZ({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return MZ({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[NZ(n.children,t)]}}return MZ({type:`inlineCode`,value:PZ(e)},t)}function PZ(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=PZ(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const FZ=IG;function IZ(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=OL(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell)),n.tableRow&&(i.tableRow=OL(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=e===0&&n.tableHeader?n.tableHeader:n.tableCell,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null;return n.table.createAndFill({sourceDashCounts:s},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=vZ(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[],l=0;for(let t of s){if(t.offset>l){let r=n.slice(l,t.offset).replaceAll(`\xA0`,` `);r&&c.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);i&&(t.kind===`escape`?c.push(e.text(i,[r.escapeMark.create()])):r.sourceLiteral?c.push(e.text(i,[r.sourceLiteral.create({sourceRaw:t.raw})])):c.push(e.text(i))),l=t.offset+t.length}}if(l<n.length){let t=n.slice(l).replaceAll(`\xA0`,` `);t&&c.push(e.text(t))}return c.length===1?c[0]:c}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1})]));let a=r.strike??r.delete;if(a&&(i.delete=kL(a)),r.highlight&&(i.mark=kL(r.highlight)),r.comment&&(i.comment=kL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=OL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=kL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=kL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=OL(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3,sourceStyle:t.data?.sourceStyle??`fenced`},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`})),n.list&&(i.list=OL(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=OL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}if(n.jsxComponent){let r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=DZ.getOrWildcard(o),c=OZ(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=vZ(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null})),n.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=QK(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&FZ.has(l)&&n.jsxComponent&&DZ.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&LG.has(l)&&n.jsxComponent&&DZ.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&zG.has(l)&&n.jsxComponent&&DZ.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&BG.has(l)&&n.jsxComponent&&DZ.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:TZ(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(GG.has(l)&&r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=OL(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function LZ(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=PL(`paragraph`)),r.blockquote&&(t.blockquote=PL(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),r.heading&&(t.heading=PL(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0}}))),r.codeBlock&&(t.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t}}}),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=PL(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&jZ(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,children:i}}),r.table&&(t.table=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c=Array.isArray(s)&&s.length>0?{sourceDashCounts:s}:void 0,l={type:`table`,align:i,children:o};return c&&(l.data=c),l}),r.tableRow&&(t.tableRow=PL(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=PL(`tableCell`,a)),r.tableHeader&&(t.tableHeader=PL(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.imageReference&&(t.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title};return Object.keys(t).length>0&&(i.data=t),i}}if(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!AZ(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:DZ.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:DZ,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),r.rawMdxFallback&&(t.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.mathInline&&(t.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;return typeof n==`string`&&n.length>0?{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]}:{type:`inlineMath`,value:t}}),r.wikiLink&&(t.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),r.tag&&(t.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),r.wikiLinkEmbed&&(t.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),i.emphasis&&(n.emphasis=FL(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=FL(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return NZ(n,{sourceFenceChar:r,sourceFenceLength:i})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=FL(`delete`)}return i.highlight&&(n.highlight=FL(`mark`)),i.comment&&(n.comment=FL(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=PL(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),r.footnoteReference&&(t.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),r.footnoteDefinition&&(t.footnoteDefinition=PL(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),i.link&&(n.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}let r=e.attrs.linkStyle;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data=t.data??{},t.data.escapedChars=t.data.escapedChars??[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),i.sourceLiteral&&(n.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0],t=r||e.value;return BK(t,e.value)&&(e.data=e.data??{},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:t,markHandlers:n}}const RZ=/\p{M}+/gu,zZ=/[^\p{L}\p{N}]+/gu,BZ=/^-+|-+$/g;function VZ(e){return e.trim().normalize(`NFKD`).replace(RZ,``).toLowerCase().replace(zZ,`-`).replace(BZ,``)}function HZ(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function UZ(e,t){let n=VZ(e);return n?HZ(n,t):``}const WZ=wB(),GZ=Hz(),KZ=Uz();function qZ(){return EJ.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function JZ(){return qZ().filter(e=>YZ(e)!==`fence`)}function YZ(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function XZ(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:YZ(e)}}function ZZ(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function QZ(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function $Z(e){let t=[];for(let n of e.props){let e=ZZ(n);e!==void 0&&QZ(n,e)&&t.push(zq(n.name,e))}return t}function eQ(e){return XR(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[WZ],mdastExtensions:[GZ]}).children}function tQ(e){let t=YZ(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
|
|
426
426
|
A --> B`};else{let r=$Z(e),i=t===`jsx-block`?eQ(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return WN({type:`root`,children:[n]},{extensions:[KZ]}).trimEnd()}function nQ(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function rQ(e){return{...XZ(e),example:tQ(e),params:nQ(e)}}function iQ(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `get_components({ ids })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `get_authoring_palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...JZ().map(XZ).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
|
|
427
|
-
`)}const aQ=M({docName:aq,summary:sq,content:k().optional(),...oq}).loose(),oQ=M({docName:aq,summary:sq,markdown:k().min(1),position:N([`append`,`prepend`,`replace`]).optional(),...oq}).loose(),sQ=M({docName:aq,summary:sq,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...oq}).loose(),cQ=M({docName:aq,connectionId:k().min(1),scope:N([`last`,`session`,`file`]).optional(),...oq}).loose(),lQ=M({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),uQ=M({type:P(`orphan`),parentCandidates:j(k()),message:k()}).loose(),dQ=M({timestamp:k().min(1),summary:lQ.optional()}).loose(),fQ=M({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:j(uQ).optional(),summary:lQ.optional()}).loose(),pQ=M({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:lQ.optional()}).loose(),mQ=M({docName:k().min(1),scope:N([`last`,`session`]),undone:Ls()}).loose(),hQ=M({docName:aq,patch:nc(k(),Xs([hW,zs()])),types:nc(k(),N(pW)).optional(),summary:sq,...oq}).loose(),gQ=M({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:j(k()),summary:lQ.optional()}).loose(),_Q=M({status:k().min(1),reason:k()}).loose(),vQ=M({docName:k().min(1),content:k(),lifecycle:_Q.nullable()}).loose(),yQ=M({documents:j(M({kind:N([`document`,`asset`,`folder`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:Ls().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:N([`image`,`video`,`audio`,`pdf`,`text`]).nullable().optional(),referencedBy:j(k().min(1)).optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`}))}).loose(),bQ=M({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),xQ=M({docName:k().min(1),backlinks:j(bQ)}).loose(),SQ=M({counts:nc(k().min(1),A().int().nonnegative())}).loose(),CQ=Qs(`kind`,[M({kind:P(`doc`),docName:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),M({kind:P(`external`),url:k().min(1),title:k(),snippet:k().nullable()}).loose()]),wQ=M({docName:k().min(1),forwardLinks:j(CQ)}).loose(),TQ=Qs(`kind`,[M({id:k().min(1),kind:P(`doc`),docName:k().min(1),anchor:k().nullable(),label:k(),cluster:k().nullable(),category:k().nullable(),tags:j(k()).nullable()}).loose(),M({id:k().min(1),kind:P(`external`),url:k().min(1),label:k()}).loose()]),EQ=M({source:k().min(1),target:k().min(1)}).loose(),DQ=M({nodes:j(TQ),links:j(EQ)}).loose(),OQ=M({writers:j(M({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),...oq}).loose(),kQ=M({checkpointRef:k().min(1)}).loose(),AQ=M({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:j(k()),summaries:j(k()).optional()}).loose(),jQ=M({entries:j(M({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:N([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:j(AQ),checkpoint:Us().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:Ls().optional()}).loose(),MQ=M({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),NQ=M({lines:j(M({type:N([`added`,`removed`,`unchanged`]),text:k()}).loose()),additions:A().int().nonnegative(),deletions:A().int().nonnegative()}).loose(),PQ=M({contentDir:k().min(1),pathSeparator:N([`/`,`\\`]),symlinkResolved:Ls()}).loose(),FQ=j(Qs(`source`,[M({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:P(`flat`)}).loose(),M({docName:k().min(1),timestamp:k().min(1),source:P(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),IQ=M({orphans:j(M({docName:k().min(1),title:k()}).loose())}).loose(),LQ=M({hubs:j(M({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),RQ=M({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),zQ=M({deadLinks:j(M({target:k().min(1),sources:j(RQ)}).loose())}).loose(),BQ=M({target:M({docName:k().min(1),title:k(),aliases:j(k())}).loose(),mentions:j(M({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:Ls()}).loose(),VQ=M({dir:k().min(1)}).loose(),HQ=M({port:A().int().positive()}).loose(),UQ=M({projectPath:k().min(1)}).loose(),WQ=N([`not-a-git-worktree`,`init-failed`]),GQ=Qs(`ok`,[M({ok:P(!0),projectPath:k().min(1)}).loose(),M({ok:P(!1),reason:WQ,message:k().min(1)}).loose()]),KQ=M({host:k().min(1).optional()}).loose(),qQ=M({pat:k().min(1),host:k().min(1).optional()}).loose(),JQ=M({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),YQ=M({identity:M({name:k().min(1),email:k().min(1)}).loose().nullable()}).loose(),XQ=M({authenticated:Ls()}).loose(),ZQ=M({type:P(`complete`).optional(),login:k().min(1).optional()}).loose(),QQ=M({}).loose(),$Q=M({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),e$=M({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:j($Q)}).loose(),t$=M({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),n$=M({sessionAlive:Ls(),agent:t$.nullable(),files:j(e$)}).loose(),r$=M({diff:k(),generatedAt:A().int().min(0)}).loose(),i$=M({}).loose(),a$=M({}).loose(),o$=M({}).loose(),s$=M({}).loose(),c$=M({}).loose(),l$=M({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:N([`idle`,`writing`]),ts:A().int().min(0)}).loose(),u$=M({presence:nc(k().min(1),l$)}).loose(),d$=nc(k().min(1),Ls()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});M({path:k().min(1,`path must be non-empty`)}).loose();const f$=M({}).loose(),p$=M({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),m$=M({fromPath:k().min(1),toPath:k().min(1)}).loose(),h$=M({}).loose(),g$=M({path:k().min(1),...oq,summary:sq}).loose(),_$=M({docName:k().min(1)}).loose(),v$=M({path:k().min(1),...oq,summary:sq}).loose(),y$=M({path:k().min(1)}).loose(),b$=M({kind:N([`file`,`folder`]),path:k().min(1),...oq,summary:sq}).loose(),x$=M({kind:N([`file`,`folder`]),path:k().min(1),duplicatedDocNames:j(k().min(1))}).loose(),S$=M({pages:j(M({docName:k().min(1),title:k(),docExt:k().min(1),size:A().int().nonnegative(),modified:k().min(1),icon:k().min(1).max(2048).optional()}).loose())}).loose(),C$=M({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),w$=M({docName:k().min(1),headings:j(C$)}).loose();M({docName:k().min(1),newDocName:k().min(1),summary:sq,...oq}).loose();const T$=M({docName:k().min(1),rewrites:A().int().nonnegative()}).loose();M({renamed:j(p$),rewrittenDocs:j(T$),summary:lQ.optional()}).loose();const E$=M({kind:N([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...oq,summary:sq}).loose(),D$=M({renamed:j(p$),renamedAssets:j(m$),rewrittenDocs:j(T$).optional(),summary:lQ.optional()}).loose(),O$=M({kind:N([`file`,`folder`,`asset`]),path:k().min(1),...oq}).loose(),k$=M({deletedDocNames:j(k().min(1))}).loose(),A$=M({kind:N([`file`,`folder`,`asset`]),path:k().min(1),...oq,summary:sq}).loose(),j$=M({deletedDocNames:j(k().min(1))}).loose(),M$=M({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:sq,...oq}).loose(),N$=M({restoredFrom:k().min(1),timestamp:k().min(1),summary:lQ.optional()}).loose(),P$=N([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),F$=M({label:k().min(1),webUrl:_s().nullable()}).loose(),I$=Qs(`checkStatus`,[M({checkStatus:P(`allowed`)}).loose(),M({checkStatus:P(`denied`),deniedReason:N([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),M({checkStatus:P(`unknown`),unknownError:N([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),L$=M({state:P$,lastSyncUtc:k().nullable(),lastFetchUtc:k().nullable(),lastPushedSha:k().nullable(),ahead:A().int().min(0),behind:A().int().min(0),consecutiveFailures:A().int().min(0),conflictCount:A().int().min(0),hasRemote:Ls(),syncEnabled:Ls(),identityUnresolved:Ls(),remote:F$.nullable().optional(),error:k().optional(),errorCode:N([`auth-403`,`auth-401`,`auth-scope-mismatch`,`semantic-protected-branch`]).optional(),pausedReason:k().optional(),pushPermission:I$.optional()}).loose(),R$=M({op:N([`sync`,`push`,`pull`]).optional()}).loose(),z$=M({op:N([`sync`,`push`,`pull`])}).loose(),B$=M({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose(),V$=M({conflicts:j(B$)}).loose(),H$=M({file:k().min(1),strategy:N([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),U$=M({}).loose(),W$=M({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:N([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),G$=M({}).loose(),K$=M({plan:Ec(e=>e!==void 0,{message:`plan is required`})}).loose(),q$=M({plan:Ec(e=>e!==void 0,{message:`plan is required`})}).loose(),J$=M({result:Ec(e=>e!==void 0,{message:`result is required`})}).loose(),Y$=M({path:k().min(1),summary:k().min(1)}).loose(),X$=M({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),Z$=M({packs:j(M({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:j(Y$),entryCounts:X$}).loose())}).loose(),Q$=M({noOpen:Ls().optional(),out:k().min(1).optional()}).loose(),$$=M({reason:N([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),e1=Qs(`status`,[M({status:P(`installed`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k()}).loose(),M({status:P(`built`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k(),handoffError:$$.optional()}).loose(),M({status:P(`failed`),buildError:k()}).loose(),M({status:P(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),t1=M({tags:j(M({name:k().min(1),count:A().int().nonnegative(),isLeaf:Ls()}).loose())}).loose(),n1=M({docName:k().min(1),title:k(),matchingTags:j(k().min(1)),snippet:k().nullable()}).loose(),r1=M({name:k().min(1),docs:j(n1)}).loose(),i1=M({folder:Us(),frontmatter_local:nc(k(),Us()).nullable(),frontmatter_sources:nc(k(),k()).optional(),schema_declarations:nc(k(),Us()).optional(),schema_sources:nc(k(),k()).optional(),schema_local:nc(k(),Us()).nullable()}).loose(),a1=M({path:k(),frontmatter:nc(k(),Us()).optional(),declarations:nc(k(),Us()).optional()}).loose(),o1=M({applied:Us()}).loose(),s1=nc(k(),Us()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),c1=M({template:M({name:k().min(1),folder:k(),scope:N([`local`,`inherited`]),path:k().min(1),frontmatter:s1,body:k()}).strict()}).strict(),l1=M({folder:k(),name:k(),body:k().optional(),frontmatter:s1.optional()}).strict(),u1=M({path:k().min(1),created:Ls(),warnings:j(k())}).strict(),d1=M({existed:Ls(),path:k().min(1)}).strict(),f1=M({query:k().optional(),intent:N([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:j(N([`page`,`folder`,`content`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional()}).loose(),p1=M({kind:N([`page`,`folder`,`content`]),path:k().min(1),title:k(),score:A(),signals:nc(k(),Us()),snippet:k().optional()}).loose(),m1=M({query:k(),intent:N([`autocomplete`,`full_text`,`omnibar`]),results:j(p1),elapsedMs:A().nonnegative()}).loose(),h1=M({version:k().min(1),recordedAt:k().min(1)}).loose(),g1=M({currentVersion:k().min(1),targets:nc(k(),h1.nullable())}).loose(),_1=`server-info`,v1=`branch-switched`,y1=`disk-ack`,b1=`config-validation-rejected`,x1=`config-ignore-nested-error`,S1=N([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),C1=M({v:P(1),ch:P(_1),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),w1=M({v:P(1),ch:P(v1),seq:A(),branch:k().min(1)}).loose(),T1=M({v:P(1),ch:S1,seq:A()}).loose(),E1=M({v:P(1),ch:P(y1),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),D1=M({v:P(1),ch:P(b1),seq:A(),docName:k().min(1),error:uG}).loose(),O1=M({v:P(1),ch:P(x1),seq:A(),path:k().min(1),error:k().min(1)}).loose(),k1={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},A1=new WeakMap;function j1(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function M1(e){return e.trim().toLowerCase()}function N1(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function P1(e){return e.split(`/`).filter(Boolean).join(` `)}function F1(e){let t=N1(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:P1(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function I1(e){let t=mU({schema:k1});return e.length>0&&TU(t,e),t}function L1(e){let t={documents:e};return A1.set(t,I1(e)),t}function R1(e){let t=A1.get(e);if(t)return t;let n=I1(e.documents);return A1.set(e,n),n}function z1(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function B1(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function V1(e,t){let n=M1(t);if(!n)return 0;let r=M1(e.title),i=M1(e.name),a=M1(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function H1(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function U1(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function W1(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function G1(e,t){return M1(t).length<4?0:e===`full_text`?1:0}function K1(e,t,n={}){let r=n.intent??`omnibar`,i=j1(n.limit),a=new Set(n.scopes??z1(r)),o=e.documents.filter(e=>B1(e,a)),s=M1(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=tW(R1(e),{term:s,properties:U1(r),boost:W1(r),tolerance:G1(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>B1(e.document,a)).map(e=>[e.document.id,e.score])),u=H1(o),d=new Map;for(let e of o)V1(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)B1(e.document,a)&&d.set(e.document.id,e.document);return[...d.values()].map(e=>{let t=Math.max(0,V1(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}function q1(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),J1(n)}function J1(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const Y1=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),X1=globalThis;X1[Y1]===void 0&&(X1[Y1]=Fi());const Z1=X1[Y1],Q1=[`.ok`,`skill-state.yml`],$1=[`claude-cowork`,`cli-hosts`],e0=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],t0=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,n0=Js({version:k().regex(t0,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(Z1,{description:`Recorded skill version for this target.`}),recordedAt:Vo().register(Z1,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:N(e0).register(Z1,{description:`Install-source surface that recorded this entry.`}).optional()}),r0=Js({schema:P(1).register(Z1,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Js({"claude-cowork":n0.optional(),"cli-hosts":n0.optional()}).register(Z1,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function i0(){return{schema:1,targets:{}}}function a0(){let e=!1,t=``,n=0;return r=>{let i=o0(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function o0(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const s0=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],c0={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function l0(e,t=s0){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const u0={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function d0(e){return e?u0[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const f0={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function p0(e){let t=e?.trim();return t?f0[d0(t)]??t:`Agent`}function m0(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const h0=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function g0(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function _0(e){let t=e.trim();return h0.test(t)||t.startsWith(`//`)}function v0(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(_0(n))return{kind:`external`,url:n};let r=m0(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=g0(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function y0(e,t){let n=e.trim();if(!n)return null;if(_0(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=g0(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function b0(e,t){let n=e.trim();if(!n||h0.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function x0(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function S0(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function C0(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function w0(e){return e.split(`/`).filter(e=>e!==``)}function T0(e,t){let n=C0(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function E0(e,t){let n=C0(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:w0(r).length}function D0(e,t){let n=w0(e),r=w0(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function O0(){let e=new Map;function t(t){let n=x0(t);if(n===``)return;let r=S0(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=x0(t),r=S0(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=C0(x0(n)),o=[],s=[];for(let e of i)T0(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=E0(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=E0(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=D0(a,C0(t));for(let r=1;r<e.length;r++){let i=e[r],o=D0(a,C0(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function k0(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function A0(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function j0(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function M0(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function N0(){try{let e=l(c(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(m(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const P0=N0(),F0=1;var I0=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function L0(e,t){return l(e,`${t}.lock`)}const R0=new Map;function z0(e){R0.set(e,(R0.get(e)??0)+1)}function B0(e){let t=R0.get(e);return t===void 0||t<=1?(R0.delete(e),!0):(R0.set(e,t-1),!1)}function V0(e,t){try{let n=JSON.parse(m(e,`utf-8`));return n&&typeof n==`object`&&M0(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function H0(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;f(n,{recursive:!0});let a=L0(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??P0},s=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!d(a))try{let e=p(a,`wx`,384);try{_(e,s)}finally{u(e)}return z0(a),U0({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=V0(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return g(a,s,{encoding:`utf-8`,mode:384}),z0(a),U0({lockName:t,lockDir:n,lockPath:a});if(r&&j0(e.pid))throw new I0(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{h(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function U0(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>q0({lockName:t,lockDir:n}),updatePort:e=>W0({lockName:t,lockDir:n,port:e})}}function W0(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=L0(n,t);if(!d(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(m(a,`utf-8`));if(!e||typeof e!=`object`||!M0(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{g(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function G0(e){let{lockName:t,lockDir:n}=e,r=L0(n,t);if(!d(r))return null;let i;try{let e=JSON.parse(m(r,`utf-8`));if(!e||typeof e!=`object`||!M0(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!j0(i.pid)){try{h(r)}catch{}return null}return i}function K0(e){let{lockName:t,lockDir:n}=e,r=L0(n,t);if(!d(r))return{status:`absent`};let i;try{i=JSON.parse(m(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!M0(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!j0(o.pid)){try{h(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function q0(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=L0(n,t);if(B0(i)&&d(i))try{let e=JSON.parse(m(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;h(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var J0=class extends I0{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function Y0(e,t){try{return H0({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof I0&&e.lockName===`server`?new J0(e.existing,e.lockPath):e}}function X0(e,t){W0({lockName:`server`,lockDir:e,port:t})}function Z0(e){return G0({lockName:`server`,lockDir:e})}function Q0(e){q0({lockName:`server`,lockDir:e})}export{Eq as $,cn as $i,c1 as $n,b0 as $r,EZ as $t,SQ as A,j as Ai,kq as An,iq as Ar,gQ as At,C1 as B,kc as Bi,Lq as Bn,_W as Br,DQ as Bt,pQ as C,Hc as Ci,kQ as Cn,eG as Cr,pW as Ct,fQ as D,N as Di,J$ as Dn,i0 as Dr,yW as Dt,oQ as E,sc as Ei,q$ as En,p0 as Er,o1 as Et,w1 as F,P as Fi,vq as Fn,NJ as Fr,LQ as Ft,_1 as G,_s as Gi,H$ as Gn,BW as Gr,ZQ as Gt,x1 as H,k as Hi,G$ as Hn,TG as Hr,KQ as Ht,O1 as I,Js as Ii,bq as In,XK as Ir,UG as It,yG as J,da as Ji,R$ as Jn,SW as Jr,Iq as Jt,mG as K,Vo as Ki,U$ as Kn,QW as Kr,JQ as Kt,D1 as L,A as Li,g1 as Ln,fG as Lr,Q$ as Lt,Tq as M,Ec as Mi,dq as Mn,TZ as Mr,hW as Mt,RW as N,Qs as Ni,gq as Nn,JZ as Nr,jQ as Nt,aQ as O,zs as Oi,Z$ as On,q1 as Or,wQ as Ot,UW as P,ec as Pi,hq as Pn,UZ as Pr,MQ as Pt,gG as Q,vr as Qi,d1 as Qn,iQ as Qr,HQ as Qt,T1 as R,M as Ri,r0 as Rn,d0 as Rr,e1 as Rt,sQ as S,Yc as Si,OQ as Sn,F1 as Sr,h$ as St,mQ as T,Ns as Ti,m1 as Tn,DW as Tr,a1 as Tt,b1 as U,Xs as Ui,W$ as Un,xq as Ur,YQ as Ut,v1 as V,nc as Vi,BQ as Vn,dG as Vr,QQ as Vt,y1 as W,Us as Wi,V$ as Wn,rK as Wr,qQ as Wt,hG as X,Wa as Xi,r1 as Xn,rQ as Xr,GQ as Xt,vG as Y,Ua as Yi,z$ as Yn,kG as Yr,UQ as Yt,_G as Z,ai as Zi,t1 as Zn,AW as Zr,VQ as Zt,c0 as _,il as _i,Q1 as _n,l0 as _r,vQ as _t,H0 as a,Tt as aa,LW as ai,OG as an,A$ as ar,_$ as at,n$ as b,rl as bi,DG as bn,DX as br,SG as bt,M0 as c,pt as ca,_y as ci,w$ as cn,Pq as cr,jG as ct,K0 as d,$c as di,Nq as dn,lW as dr,zQ as dt,un as ea,m0 as ei,u$ as en,l1 as er,Oq as et,Z0 as f,Bc as fi,E$ as fn,FW as fr,vW as ft,X0 as g,al as gi,N$ as gn,rG as gr,yQ as gt,W0 as h,Ic as hi,M$ as hn,y0 as hr,NQ as ht,J0 as i,Lt as ia,A0 as ii,IQ as in,i$ as ir,g$ as it,xQ as j,Ls as ji,lq as jn,IW as jr,mW as jt,dQ as k,Vs as ki,K$ as kn,k0 as kr,hQ as kt,L0 as l,ft as la,sf as li,S$ as ln,PQ as lr,EG as lt,Q0 as m,Lc as mi,FQ as mn,v0 as mr,k$ as mt,P0 as n,mn as na,eq as ni,s$ as nn,a$ as nr,v$ as nt,Y0 as o,O as oa,VZ as oi,AG as on,j$ as or,WG as ot,q0 as p,Rc as pi,D$ as pn,Mq as pr,O$ as pt,nG as q,zo as qi,L$ as qn,TW as qr,XQ as qt,F0 as r,on as ra,xW as ri,wG as rn,o$ as rr,y$ as rt,j0 as s,D as sa,CW as si,tG as sn,Fq as sr,CG as st,I0 as t,fn as ta,K1 as ti,c$ as tn,u1 as tr,B$ as tt,G0 as u,F as ui,Aq as un,uW as ur,bG as ut,xG as v,Wc as vi,$1 as vn,O0 as vr,b$ as vt,cQ as w,Uc as wi,f1 as wn,$W as wr,i1 as wt,r$ as x,Qc as xi,pG as xn,L1 as xr,VG as xt,HG as y,Zc as yi,t0 as yn,a0 as yr,x$ as yt,E1 as z,cc as zi,f$ as zn,Cq as zr,d$ as zt};
|
|
428
|
-
//# sourceMappingURL=server-lock-BpjJj3OD-
|
|
427
|
+
`)}const aQ=M({docName:aq,summary:sq,content:k().optional(),...oq}).loose(),oQ=M({docName:aq,summary:sq,markdown:k().min(1),position:N([`append`,`prepend`,`replace`]).optional(),...oq}).loose(),sQ=M({docName:aq,summary:sq,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...oq}).loose(),cQ=M({docName:aq,connectionId:k().min(1),scope:N([`last`,`session`,`file`]).optional(),...oq}).loose(),lQ=M({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),uQ=M({type:P(`orphan`),parentCandidates:j(k()),message:k()}).loose(),dQ=M({timestamp:k().min(1),summary:lQ.optional()}).loose(),fQ=M({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:j(uQ).optional(),summary:lQ.optional()}).loose(),pQ=M({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:lQ.optional()}).loose(),mQ=M({docName:k().min(1),scope:N([`last`,`session`]),undone:Ls()}).loose(),hQ=M({docName:aq,patch:nc(k(),Xs([hW,zs()])),types:nc(k(),N(pW)).optional(),summary:sq,...oq}).loose(),gQ=M({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:j(k()),summary:lQ.optional()}).loose(),_Q=M({entries:j(M({level:N([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:nc(k(),Us()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),vQ=M({accepted:A().int().min(0)}).loose(),yQ=M({status:k().min(1),reason:k()}).loose(),bQ=M({docName:k().min(1),content:k(),lifecycle:yQ.nullable()}).loose(),xQ=M({documents:j(M({kind:N([`document`,`asset`,`folder`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:Ls().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:N([`image`,`video`,`audio`,`pdf`,`text`]).nullable().optional(),referencedBy:j(k().min(1)).optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0,{message:`document/asset/folder kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName)`}))}).loose(),SQ=M({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),CQ=M({docName:k().min(1),backlinks:j(SQ)}).loose(),wQ=M({counts:nc(k().min(1),A().int().nonnegative())}).loose(),TQ=Qs(`kind`,[M({kind:P(`doc`),docName:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),M({kind:P(`external`),url:k().min(1),title:k(),snippet:k().nullable()}).loose()]),EQ=M({docName:k().min(1),forwardLinks:j(TQ)}).loose(),DQ=Qs(`kind`,[M({id:k().min(1),kind:P(`doc`),docName:k().min(1),anchor:k().nullable(),label:k(),cluster:k().nullable(),category:k().nullable(),tags:j(k()).nullable()}).loose(),M({id:k().min(1),kind:P(`external`),url:k().min(1),label:k()}).loose()]),OQ=M({source:k().min(1),target:k().min(1)}).loose(),kQ=M({nodes:j(DQ),links:j(OQ)}).loose(),AQ=M({writers:j(M({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),...oq}).loose(),jQ=M({checkpointRef:k().min(1)}).loose(),MQ=M({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:j(k()),summaries:j(k()).optional()}).loose(),NQ=M({entries:j(M({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:N([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:j(MQ),checkpoint:Us().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:Ls().optional()}).loose(),PQ=M({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),FQ=M({lines:j(M({type:N([`added`,`removed`,`unchanged`]),text:k()}).loose()),additions:A().int().nonnegative(),deletions:A().int().nonnegative()}).loose(),IQ=M({contentDir:k().min(1),pathSeparator:N([`/`,`\\`]),symlinkResolved:Ls()}).loose(),LQ=j(Qs(`source`,[M({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:P(`flat`)}).loose(),M({docName:k().min(1),timestamp:k().min(1),source:P(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),RQ=M({orphans:j(M({docName:k().min(1),title:k()}).loose())}).loose(),zQ=M({hubs:j(M({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),BQ=M({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),VQ=M({deadLinks:j(M({target:k().min(1),sources:j(BQ)}).loose())}).loose(),HQ=M({target:M({docName:k().min(1),title:k(),aliases:j(k())}).loose(),mentions:j(M({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:Ls()}).loose(),UQ=M({dir:k().min(1)}).loose(),WQ=M({port:A().int().positive()}).loose(),GQ=M({projectPath:k().min(1)}).loose(),KQ=N([`not-a-git-worktree`,`init-failed`]),qQ=Qs(`ok`,[M({ok:P(!0),projectPath:k().min(1)}).loose(),M({ok:P(!1),reason:KQ,message:k().min(1)}).loose()]),JQ=M({host:k().min(1).optional()}).loose(),YQ=M({pat:k().min(1),host:k().min(1).optional()}).loose(),XQ=M({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),ZQ=M({identity:M({name:k().min(1),email:k().min(1)}).loose().nullable()}).loose(),QQ=M({authenticated:Ls()}).loose(),$Q=M({type:P(`complete`).optional(),login:k().min(1).optional()}).loose(),e$=M({}).loose(),t$=M({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),n$=M({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:j(t$)}).loose(),r$=M({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),i$=M({sessionAlive:Ls(),agent:r$.nullable(),files:j(n$)}).loose(),a$=M({diff:k(),generatedAt:A().int().min(0)}).loose(),o$=M({}).loose(),s$=M({}).loose(),c$=M({}).loose(),l$=M({}).loose(),u$=M({}).loose(),d$=M({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:N([`idle`,`writing`]),ts:A().int().min(0)}).loose(),f$=M({presence:nc(k().min(1),d$)}).loose(),p$=nc(k().min(1),Ls()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});M({path:k().min(1,`path must be non-empty`)}).loose();const m$=M({}).loose(),h$=M({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),g$=M({fromPath:k().min(1),toPath:k().min(1)}).loose(),_$=M({}).loose(),v$=M({path:k().min(1),...oq,summary:sq}).loose(),y$=M({docName:k().min(1)}).loose(),b$=M({path:k().min(1),...oq,summary:sq}).loose(),x$=M({path:k().min(1)}).loose(),S$=M({kind:N([`file`,`folder`]),path:k().min(1),...oq,summary:sq}).loose(),C$=M({kind:N([`file`,`folder`]),path:k().min(1),duplicatedDocNames:j(k().min(1))}).loose(),w$=M({pages:j(M({docName:k().min(1),title:k(),docExt:k().min(1),size:A().int().nonnegative(),modified:k().min(1),icon:k().min(1).max(2048).optional()}).loose())}).loose(),T$=M({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),E$=M({docName:k().min(1),headings:j(T$)}).loose();M({docName:k().min(1),newDocName:k().min(1),summary:sq,...oq}).loose();const D$=M({docName:k().min(1),rewrites:A().int().nonnegative()}).loose();M({renamed:j(h$),rewrittenDocs:j(D$),summary:lQ.optional()}).loose();const O$=M({kind:N([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...oq,summary:sq}).loose(),k$=M({renamed:j(h$),renamedAssets:j(g$),rewrittenDocs:j(D$).optional(),summary:lQ.optional()}).loose(),A$=M({kind:N([`file`,`folder`,`asset`]),path:k().min(1),...oq}).loose(),j$=M({deletedDocNames:j(k().min(1))}).loose(),M$=M({kind:N([`file`,`folder`,`asset`]),path:k().min(1),...oq,summary:sq}).loose(),N$=M({deletedDocNames:j(k().min(1))}).loose(),P$=M({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:sq,...oq}).loose(),F$=M({restoredFrom:k().min(1),timestamp:k().min(1),summary:lQ.optional()}).loose(),I$=N([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),L$=M({label:k().min(1),webUrl:_s().nullable()}).loose(),R$=Qs(`checkStatus`,[M({checkStatus:P(`allowed`)}).loose(),M({checkStatus:P(`denied`),deniedReason:N([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),M({checkStatus:P(`unknown`),unknownError:N([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),z$=M({state:I$,lastSyncUtc:k().nullable(),lastFetchUtc:k().nullable(),lastPushedSha:k().nullable(),ahead:A().int().min(0),behind:A().int().min(0),consecutiveFailures:A().int().min(0),conflictCount:A().int().min(0),hasRemote:Ls(),syncEnabled:Ls(),identityUnresolved:Ls(),remote:L$.nullable().optional(),error:k().optional(),errorCode:N([`auth-403`,`auth-401`,`auth-scope-mismatch`,`semantic-protected-branch`]).optional(),pausedReason:k().optional(),pushPermission:R$.optional()}).loose(),B$=M({op:N([`sync`,`push`,`pull`]).optional()}).loose(),V$=M({op:N([`sync`,`push`,`pull`])}).loose(),H$=M({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose(),U$=M({conflicts:j(H$)}).loose(),W$=M({file:k().min(1),strategy:N([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),G$=M({}).loose(),K$=M({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:N([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),q$=M({}).loose(),J$=M({plan:Ec(e=>e!==void 0,{message:`plan is required`})}).loose(),Y$=M({plan:Ec(e=>e!==void 0,{message:`plan is required`})}).loose(),X$=M({result:Ec(e=>e!==void 0,{message:`result is required`})}).loose(),Z$=M({path:k().min(1),summary:k().min(1)}).loose(),Q$=M({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),$$=M({packs:j(M({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:j(Z$),entryCounts:Q$}).loose())}).loose(),e1=M({noOpen:Ls().optional(),out:k().min(1).optional()}).loose(),t1=M({reason:N([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),n1=Qs(`status`,[M({status:P(`installed`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k()}).loose(),M({status:P(`built`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k(),handoffError:t1.optional()}).loose(),M({status:P(`failed`),buildError:k()}).loose(),M({status:P(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),r1=M({tags:j(M({name:k().min(1),count:A().int().nonnegative(),isLeaf:Ls()}).loose())}).loose(),i1=M({docName:k().min(1),title:k(),matchingTags:j(k().min(1)),snippet:k().nullable()}).loose(),a1=M({name:k().min(1),docs:j(i1)}).loose(),o1=M({folder:Us(),frontmatter_local:nc(k(),Us()).nullable(),frontmatter_sources:nc(k(),k()).optional(),schema_declarations:nc(k(),Us()).optional(),schema_sources:nc(k(),k()).optional(),schema_local:nc(k(),Us()).nullable()}).loose(),s1=M({path:k(),frontmatter:nc(k(),Us()).optional(),declarations:nc(k(),Us()).optional()}).loose(),c1=M({applied:Us()}).loose(),l1=nc(k(),Us()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),u1=M({template:M({name:k().min(1),folder:k(),scope:N([`local`,`inherited`]),path:k().min(1),frontmatter:l1,body:k()}).strict()}).strict(),d1=M({folder:k(),name:k(),body:k().optional(),frontmatter:l1.optional()}).strict(),f1=M({path:k().min(1),created:Ls(),warnings:j(k())}).strict(),p1=M({existed:Ls(),path:k().min(1)}).strict(),m1=M({query:k().optional(),intent:N([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:j(N([`page`,`folder`,`content`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional()}).loose(),h1=M({kind:N([`page`,`folder`,`content`]),path:k().min(1),title:k(),score:A(),signals:nc(k(),Us()),snippet:k().optional()}).loose(),g1=M({query:k(),intent:N([`autocomplete`,`full_text`,`omnibar`]),results:j(h1),elapsedMs:A().nonnegative()}).loose(),_1=M({version:k().min(1),recordedAt:k().min(1)}).loose(),v1=M({currentVersion:k().min(1),targets:nc(k(),_1.nullable())}).loose(),y1=`server-info`,b1=`branch-switched`,x1=`disk-ack`,S1=`config-validation-rejected`,C1=`config-ignore-nested-error`,w1=N([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),T1=M({v:P(1),ch:P(y1),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),E1=M({v:P(1),ch:P(b1),seq:A(),branch:k().min(1)}).loose(),D1=M({v:P(1),ch:w1,seq:A()}).loose(),O1=M({v:P(1),ch:P(x1),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),k1=M({v:P(1),ch:P(S1),seq:A(),docName:k().min(1),error:uG}).loose(),A1=M({v:P(1),ch:P(C1),seq:A(),path:k().min(1),error:k().min(1)}).loose(),j1={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},M1=new WeakMap;function N1(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function P1(e){return e.trim().toLowerCase()}function F1(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function I1(e){return e.split(`/`).filter(Boolean).join(` `)}function L1(e){let t=F1(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:I1(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function R1(e){let t=mU({schema:j1});return e.length>0&&TU(t,e),t}function z1(e){let t={documents:e};return M1.set(t,R1(e)),t}function B1(e){let t=M1.get(e);if(t)return t;let n=R1(e.documents);return M1.set(e,n),n}function V1(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function H1(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function U1(e,t){let n=P1(t);if(!n)return 0;let r=P1(e.title),i=P1(e.name),a=P1(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function W1(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function G1(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function K1(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function q1(e,t){return P1(t).length<4?0:e===`full_text`?1:0}function J1(e,t,n={}){let r=n.intent??`omnibar`,i=N1(n.limit),a=new Set(n.scopes??V1(r)),o=e.documents.filter(e=>H1(e,a)),s=P1(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=tW(B1(e),{term:s,properties:G1(r),boost:K1(r),tolerance:q1(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>H1(e.document,a)).map(e=>[e.document.id,e.score])),u=W1(o),d=new Map;for(let e of o)U1(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)H1(e.document,a)&&d.set(e.document.id,e.document);return[...d.values()].map(e=>{let t=Math.max(0,U1(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}function Y1(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),X1(n)}function X1(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const Z1=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),Q1=globalThis;Q1[Z1]===void 0&&(Q1[Z1]=Fi());const $1=Q1[Z1],e0=[`.ok`,`skill-state.yml`],t0=[`claude-cowork`,`cli-hosts`],n0=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],r0=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,i0=Js({version:k().regex(r0,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register($1,{description:`Recorded skill version for this target.`}),recordedAt:Vo().register($1,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:N(n0).register($1,{description:`Install-source surface that recorded this entry.`}).optional()}),a0=Js({schema:P(1).register($1,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Js({"claude-cowork":i0.optional(),"cli-hosts":i0.optional()}).register($1,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function o0(){return{schema:1,targets:{}}}function s0(){let e=!1,t=``,n=0;return r=>{let i=c0(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function c0(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}const l0=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],u0={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function d0(e,t=l0){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const f0={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function p0(e){return e?f0[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const m0={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function h0(e){let t=e?.trim();return t?m0[p0(t)]??t:`Agent`}function g0(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const _0=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function v0(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function y0(e){let t=e.trim();return _0.test(t)||t.startsWith(`//`)}function b0(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}if(y0(n))return{kind:`external`,url:n};let r=g0(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=v0(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function x0(e,t){let n=e.trim();if(!n)return null;if(y0(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=v0(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function S0(e,t){let n=e.trim();if(!n||_0.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function C0(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function w0(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function T0(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function E0(e){return e.split(`/`).filter(e=>e!==``)}function D0(e,t){let n=T0(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function O0(e,t){let n=T0(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:E0(r).length}function k0(e,t){let n=E0(e),r=E0(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function A0(){let e=new Map;function t(t){let n=C0(t);if(n===``)return;let r=w0(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=C0(t),r=w0(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=T0(C0(n)),o=[],s=[];for(let e of i)D0(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=O0(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=O0(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=k0(a,T0(t));for(let r=1;r<e.length;r++){let i=e[r],o=k0(a,T0(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function j0(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function M0(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}function N0(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function P0(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function F0(){try{let e=l(c(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(m(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const I0=F0(),L0=1;var R0=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function z0(e,t){return l(e,`${t}.lock`)}const B0=new Map;function V0(e){B0.set(e,(B0.get(e)??0)+1)}function H0(e){let t=B0.get(e);return t===void 0||t<=1?(B0.delete(e),!0):(B0.set(e,t-1),!1)}function U0(e,t){try{let n=JSON.parse(m(e,`utf-8`));return n&&typeof n==`object`&&P0(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function W0(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;f(n,{recursive:!0});let a=z0(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??I0},s=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!d(a))try{let e=p(a,`wx`,384);try{_(e,s)}finally{u(e)}return V0(a),G0({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=U0(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return g(a,s,{encoding:`utf-8`,mode:384}),V0(a),G0({lockName:t,lockDir:n,lockPath:a});if(r&&N0(e.pid))throw new R0(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{h(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function G0(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>Y0({lockName:t,lockDir:n}),updatePort:e=>K0({lockName:t,lockDir:n,port:e})}}function K0(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=z0(n,t);if(!d(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(m(a,`utf-8`));if(!e||typeof e!=`object`||!P0(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{g(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function q0(e){let{lockName:t,lockDir:n}=e,r=z0(n,t);if(!d(r))return null;let i;try{let e=JSON.parse(m(r,`utf-8`));if(!e||typeof e!=`object`||!P0(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!N0(i.pid)){try{h(r)}catch{}return null}return i}function J0(e){let{lockName:t,lockDir:n}=e,r=z0(n,t);if(!d(r))return{status:`absent`};let i;try{i=JSON.parse(m(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!P0(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!N0(o.pid)){try{h(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function Y0(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=z0(n,t);if(H0(i)&&d(i))try{let e=JSON.parse(m(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;h(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var X0=class extends R0{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function Z0(e,t){try{return W0({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof R0&&e.lockName===`server`?new X0(e.existing,e.lockPath):e}}function Q0(e,t){K0({lockName:`server`,lockDir:e,port:t})}function $0(e){return q0({lockName:`server`,lockDir:e})}function e2(e){Y0({lockName:`server`,lockDir:e})}export{Eq as $,ai as $i,r1 as $n,AW as $r,UQ as $t,wQ as A,zs as Ai,$$ as An,Y1 as Ar,EQ as At,T1 as B,M as Bi,a0 as Bn,p0 as Br,n1 as Bt,pQ as C,Qc as Ci,pG as Cn,z1 as Cr,VG as Ct,fQ as D,Ns as Di,g1 as Dn,DW as Dr,s1 as Dt,oQ as E,Uc as Ei,m1 as En,$W as Er,o1 as Et,E1 as F,Qs as Fi,gq as Fn,JZ as Fr,NQ as Ft,y1 as G,Xs as Gi,K$ as Gn,xq as Gr,ZQ as Gt,C1 as H,kc as Hi,Lq as Hn,_W as Hr,kQ as Ht,A1 as I,ec as Ii,hq as In,UZ as Ir,PQ as It,yG as J,Vo as Ji,G$ as Jn,QW as Jr,XQ as Jt,mG as K,Us as Ki,U$ as Kn,rK as Kr,YQ as Kt,k1 as L,P as Li,vq as Ln,NJ as Lr,zQ as Lt,Tq as M,j as Mi,kq as Mn,iq as Mr,gQ as Mt,RW as N,Ls as Ni,lq as Nn,IW as Nr,mW as Nt,aQ as O,sc as Oi,Y$ as On,h0 as Or,c1 as Ot,UW as P,Ec as Pi,dq as Pn,TZ as Pr,hW as Pt,gG as Q,Wa as Qi,a1 as Qn,rQ as Qr,qQ as Qt,D1 as R,Js as Ri,bq as Rn,XK as Rr,UG as Rt,sQ as S,rl as Si,DG as Sn,DX as Sr,SG as St,mQ as T,Hc as Ti,jQ as Tn,eG as Tr,pW as Tt,S1 as U,nc as Ui,HQ as Un,dG as Ur,e$ as Ut,b1 as V,cc as Vi,m$ as Vn,Cq as Vr,p$ as Vt,x1 as W,k as Wi,q$ as Wn,TG as Wr,JQ as Wt,hG as X,da as Xi,B$ as Xn,SW as Xr,Iq as Xt,vG as Y,zo as Yi,z$ as Yn,TW as Yr,QQ as Yt,_G as Z,Ua as Zi,V$ as Zn,kG as Zr,GQ as Zt,u0 as _,Ic as _i,P$ as _n,x0 as _r,FQ as _t,W0 as a,on as aa,xW as ai,wG as an,c$ as ar,x$ as at,i$ as b,Wc as bi,t0 as bn,A0 as br,S$ as bt,P0 as c,O as ca,VZ as ci,AG as cn,N$ as cr,WG as ct,J0 as d,ft as da,sf as di,w$ as dn,IQ as dr,EG as dt,vr as ea,iQ as ei,WQ as en,p1 as er,Oq as et,$0 as f,F as fi,Aq as fn,uW as fr,bG as ft,Q0 as g,Lc as gi,LQ as gn,b0 as gr,j$ as gt,K0 as h,Rc as hi,k$ as hn,Mq as hr,A$ as ht,X0 as i,mn as ia,eq as ii,l$ as in,s$ as ir,b$ as it,CQ as j,Vs as ji,J$ as jn,j0 as jr,hQ as jt,dQ as k,N as ki,X$ as kn,o0 as kr,yW as kt,z0 as l,D as la,CW as li,tG as ln,Fq as lr,CG as lt,e2 as m,Bc as mi,O$ as mn,FW as mr,vW as mt,I0 as n,un as na,g0 as ni,f$ as nn,d1 as nr,vQ as nt,Z0 as o,Lt as oa,M0 as oi,RQ as on,o$ as or,v$ as ot,Y0 as p,$c as pi,Nq as pn,lW as pr,VQ as pt,nG as q,_s as qi,W$ as qn,BW as qr,$Q as qt,L0 as r,fn as ra,J1 as ri,u$ as rn,f1 as rr,H$ as rt,N0 as s,Tt as sa,LW as si,OG as sn,M$ as sr,y$ as st,R0 as t,cn as ta,S0 as ti,EZ as tn,u1 as tr,_Q as tt,q0 as u,pt as ua,_y as ui,E$ as un,Pq as ur,jG as ut,xG as v,al as vi,F$ as vn,rG as vr,xQ as vt,cQ as w,Yc as wi,AQ as wn,L1 as wr,_$ as wt,a$ as x,Zc as xi,r0 as xn,s0 as xr,C$ as xt,HG as y,il as yi,e0 as yn,d0 as yr,bQ as yt,O1 as z,A as zi,v1 as zn,fG as zr,e1 as zt};
|
|
428
|
+
//# sourceMappingURL=server-lock-BpjJj3OD-B9uBbH7Z.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as e}from"./server-lock-BpjJj3OD-B9uBbH7Z.mjs";export{e as updateServerLockPort};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./gh-detect-
|
|
2
|
-
//# sourceMappingURL=src-
|
|
1
|
+
import"./gh-detect-D3_evne3.mjs";import{d as e,g as t,u as n}from"./init-DIFyMBZs.mjs";import"./loader-Mg7RInsh.mjs";import"./preview-BUNvNkcD.mjs";import{n as r}from"./write-project-skill-BNMnZE-x.mjs";import{dirname as i,isAbsolute as a,join as o,relative as s,resolve as c}from"node:path";import{statSync as l}from"node:fs";import{readFile as u,realpath as d}from"node:fs/promises";function f(e){return e.replace(/:\d+$/,``)}function p(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:f(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:f(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:f(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function m(e){let t;try{t=new URL(e)}catch{return null}if(t.hostname!==`github.com`&&t.hostname!==`www.github.com`)return null;let n=t.pathname.split(`/`).filter(e=>e.length>0);if(n.length<5||n[2]!==`blob`)return null;let r,i,a,o;try{r=decodeURIComponent(n[0]),i=decodeURIComponent(n[1]),a=decodeURIComponent(n[3]),o=n.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!r||!i||!a||o.length===0||o.some(e=>e.length===0)?null:{owner:r,repo:i,branch:a,path:o.join(`/`)}}async function h(e,t){let n,r;try{n=await d(c(e)),r=await d(c(i(e)))}catch{return{kind:`not-git`}}if(!_(n,r))return{kind:`symlink-escape`};let s=o(n,`.git`),f;try{f=l(s)}catch{return{kind:`not-git`}}let m;if(f.isDirectory()){let e;try{e=await d(s)}catch{return{kind:`not-git`}}if(!_(e,n))return{kind:`symlink-escape`};m=e}else if(f.isFile()){let e;try{e=await u(s,`utf-8`)}catch{return{kind:`not-git`}}let t=/^gitdir:\s*(.+)$/m.exec(e.trim());if(!t)return{kind:`not-git`};let r=t[1].trim(),i=a(r)?r:c(n,r);try{m=await d(i)}catch{return{kind:`not-git`}}}else return{kind:`not-git`};let h=o(await g(m),`config`),v;try{v=await u(h,`utf-8`)}catch{return{kind:`not-git`}}let b=y(v);if(b===null)return{kind:`no-origin`};let x=p(b);if(x===null||x.hostname!==`github.com`)return{kind:`non-github`};let S=x.owner.toLowerCase()===t.owner.toLowerCase(),C=x.name.toLowerCase()===t.repo.toLowerCase();return!S||!C?{kind:`wrong-repo`,actualOwner:x.owner,actualRepo:x.name}:{kind:`ok`,gitRemoteUrl:`https://github.com/${x.owner}/${x.name}.git`}}async function g(e){let t;try{t=(await u(o(e,`commondir`),`utf-8`)).trim()}catch{return e}if(t.length===0)return e;let n=a(t)?t:c(e,t);try{return await d(n)}catch{return n}}function _(e,t){if(e===t)return!0;let n=s(t,e);return n.length>0&&!n.startsWith(`..`)&&!a(n)}function v(e){let t=e.indexOf(`#`),n=e.indexOf(`;`),r=-1;return t>=0&&n>=0?r=Math.min(t,n):t>=0?r=t:n>=0&&(r=n),(r===-1?e:e.slice(0,r)).trim()}function y(e){let t=!1;for(let n of e.split(/\r?\n/)){let e=v(n);if(e.length===0)continue;if(e.startsWith(`[`)){t=/^\[\s*remote\s+["']origin["']\s*\]$/.test(e);continue}if(!t)continue;let r=/^url\s*=\s*(.+)$/.exec(e);if(r)return b(r[1])}return null}function b(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}const x=[{id:`mcp-config`,write(t,n,r){let i=t.projectConfigPath?.(n);if(!i)return{integration:`mcp-config`,editorId:t.id,action:`skipped-unsupported`};try{let a=e(t,n,r,void 0,i);return a.action===`written`||a.action===`overwritten`?{integration:`mcp-config`,editorId:t.id,action:a.action,path:a.configPath}:a.action===`failed`?{integration:`mcp-config`,editorId:t.id,action:`failed`,path:a.configPath,error:a.error??`unknown failure`}:{integration:`mcp-config`,editorId:t.id,action:`failed`,path:a.configPath,error:`unexpected project-scope action: ${a.action}`}}catch(e){return{integration:`mcp-config`,editorId:t.id,action:`failed`,path:i,error:e instanceof Error?e.message:String(e)}}}},{id:`project-skill`,write(e,t,n){try{let n=r(e,t);return{integration:`project-skill`,editorId:e.id,action:n.action,...n.path?{path:n.path}:{},...n.error?{error:n.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function S(e,n,r={},i=x){let a=[];for(let o of n){let n=t[o];for(let t of i)a.push(t.write(n,e,r))}return a}function C(e,t,r={}){return{integrations:S(e,t,r),claudeLaunchJson:t.includes(`claude`)?n(e,r):void 0}}export{p as i,h as n,m as r,C as t};
|
|
2
|
+
//# sourceMappingURL=src-gAvXPDY3.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,t}from"./esm-CEs3LWY3.mjs";import{bn as n,lt as r}from"./server-lock-BpjJj3OD-DTrUUOuT.mjs";import{i,t as a}from"./gh-detect-lzLKmmPa.mjs";import{kn as o}from"./dist-C5vyt2gE.mjs";import{n as s}from"./constants-Op3gxR6V.mjs";import{spawn as c}from"node:child_process";import{basename as l,dirname as u,join as d}from"node:path";import{closeSync as f,existsSync as p,mkdirSync as m,openSync as h,statSync as g}from"node:fs";import{homedir as _}from"node:os";import{setTimeout as v}from"node:timers/promises";const y=`Open Knowledge.app`,b=`/Applications/${y}`;function x(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return g(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function S(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(C(e,b))return b;let t=d(e.homeDir??_(),`Applications`,y);return C(e,t)?t:null}function C(e,t){try{let n=d(t,`Contents`,`MacOS`,`Open Knowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function w(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`)return{available:!1,reason:`darwin-only`};let t;try{t=S(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:e.isTTY!==!0||e.env.SSH_CONNECTION||e.env.SSH_TTY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function T(e){(e.log??(e=>console.error(e)))("Launching Open Knowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)");let t={...process.env};delete t.ELECTRON_RUN_AS_NODE,e.spawn(`open`,[`-b`,`com.inkeep.open-knowledge`],{detached:!0,stdio:`ignore`,env:t}).unref()}function E(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${b}. Install via DMG, or omit --mode for browser mode.`;case`darwin-only`:return`Desktop app is macOS-only on this release. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect desktop bundle at ${b} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${b} but launch dispatch did not fire (caller bug).`}}function D(e){return d(u(e),`..`,`Frameworks`,`Open Knowledge Server.app`,`Contents`,`MacOS`,`Open Knowledge Helper`)}const O=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function k(e){if(e.platform!==`darwin`||!O.test(e.execPath))return null;let t=D(e.execPath);return e.exists(t)?t:null}function A(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??p,a=r[1];return a?{command:k({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function j(e,t){return e.host??t.HOST??`localhost`}function M(e){let t=l(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var N=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function P(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){p(e.lockDir)||m(e.lockDir,{recursive:!0});let t=h(d(e.lockDir,n),`w`),r=e.spawn??c,{PORT:i,...a}=process.env,o=A();try{let n=r(o.command,[...o.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return n.unref(),n}finally{try{f(t)}catch{}}}async function I(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}const L=r;function R(e){let t=e.sigtermGraceMs??L,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>v(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 z(e){let{config:t,cwd:n,host:r}=e,s=e.skipAutoInit??!1,c=e.skipUiAutoSpawn??!1,l=e.idleThresholdMs??18e5,{existsSync:u,mkdirSync:d}=await import(`node:fs`),{bootServer:f,getLogger:p,isProcessAlive:m,readUiLock:h,resolveContentDir:g}=await import(`./dist-D-usc-3E.mjs`),_=e.log??p(`start`);if(!s&&!o(n))throw new N(n);let y=process.env.OK_RECLAIM_DISABLE??null;try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-CfjGV42_.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:y})}catch(e){_.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-A1apGhDa.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:y})}catch(e){_.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-cLf2y4ac.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:y})}catch(e){_.warn({err:e},`[start] skill repair sweep failed; continuing`)}let b=g(t,n);u(b)||(d(b,{recursive:!0}),_.info({contentDir:b},`Created content directory`));let x=null,S=async({lockDir:t})=>{if(x=P({uiLock:h(t),isAlive:m}),x.action===`spawn`&&!c)try{F({lockDir:t,cwd:n,spawn:e.spawn}),_.info({reason:x.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 x.action===`skip`&&_.info({port:x.port,pid:x.pid},`UI already running at port ${x.port}`)},C=e.reactShellDistDir===void 0,w=i(),T=await f({config:t,contentDir:b,projectDir:n,contentRoot:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:a,tokenStore:w,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:C,idleShutdownMs:l,skipAutoInit:!0,...C?{spawnUiSiblingFn:S}:{},idleShutdownHandler:e=>R({readUiLock:()=>h(T.lockDir),isAlive:m,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:_}),log:_,...e.serveContentAssets?{serveContentAssets:!0}:{},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});x||={action:`skip`,reason:`alive`,pid:0,port:0};let E=x,D=null;if(E.action===`skip`)D=E.port>0?E.port:null;else if(!c){let t=e.uiBindTimeoutMs??3e3;D=await I({readUiLock:()=>h(T.lockDir),now:Date.now,sleep:e=>v(e),timeoutMs:t,pollIntervalMs:50}),D===null&&_.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:T.httpServer,destroy:T.destroy,lockDir:T.lockDir,contentDir:b,port:T.port,ready:T.ready,degraded:T.degraded,uiSpawnDecision:x,resolvedUiPort:D}}function B(t){if(t===`browser`||t===`app`)return t;throw new e(`--mode must be 'browser' or 'app'`)}async function V(e,t){let{renderBanner:n}=await import(`./banner-D39r_H1d.mjs`),{dim:r,error:i,warning:a}=await import(`./colors-t2HkW8lF.mjs`),o=process.cwd(),c=e;process.title=M(o);let l=j(t,process.env),u=t.port===void 0?void 0:Number(t.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await z({config:c,cwd:o,host:l,port:f,...t.serveContentAssets?{serveContentAssets:!0}:{},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{}})}catch(e){e instanceof N&&(console.error(i(e.message)),process.exit(1));let t=await import(`./dist-D-usc-3E.mjs`);(e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78);let n=H(e,o,t);n!==null&&(console.error(i(n)),process.exit(1)),console.error(`${i(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let m=!1,h=async e=>{if(!m){m=!0,console.log(r(`\nShutting down (${e})`));try{await p.destroy()}catch(e){console.error(`${i(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{h(`SIGINT`)}),process.once(`SIGTERM`,()=>{h(`SIGTERM`)});let g=`http://${l}:${p.port}`,_=l===`0.0.0.0`||l===`::`?`http://0.0.0.0:${p.port}`:void 0,v=p.resolvedUiPort,y=v!==null&&v>0?`http://${l}:${v}`:g;console.log(n({name:`open-knowledge`,version:s,localUrl:y,apiUrl:y===g?void 0:g,networkUrl:_}));let b={"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`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=b[e]??`${e} (check server logs for details)`;console.warn(` ${a(`⚠`)} ${a(e)}: ${r(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-C6LU_1mt.mjs`);e(y)}}).catch(e=>{console.error(` ${i(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function H(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=d(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`Open Knowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function U(e){return new t(`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(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,B).option(`--serve-content-assets`,`Serve content assets from this server`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path> (suppresses ok ui sibling)`).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
|
|
1
|
+
import{n as e,t}from"./esm-CEs3LWY3.mjs";import{Sn as n,dt as r}from"./server-lock-BpjJj3OD-B9uBbH7Z.mjs";import{i,t as a}from"./gh-detect-D3_evne3.mjs";import{kn as o}from"./dist-BBbP7DxV.mjs";import{n as s}from"./constants-EfhRR_gr.mjs";import{spawn as c}from"node:child_process";import{basename as l,dirname as u,join as d}from"node:path";import{closeSync as f,existsSync as p,mkdirSync as m,openSync as h,statSync as g}from"node:fs";import{homedir as _}from"node:os";import{setTimeout as v}from"node:timers/promises";const y=`Open Knowledge.app`,b=`/Applications/${y}`;function x(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return g(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function S(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(C(e,b))return b;let t=d(e.homeDir??_(),`Applications`,y);return C(e,t)?t:null}function C(e,t){try{let n=d(t,`Contents`,`MacOS`,`Open Knowledge`),r=e.statSync(n);return r&&typeof r.isFile==`function`?r.isFile():!1}catch{return!1}}function w(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`)return{available:!1,reason:`darwin-only`};let t;try{t=S(e)}catch{return{available:!1,reason:`stat-error`}}return t?e.env.OK_FORCE_DESKTOP===`1`?{available:!0,reason:`available`,bundlePath:t}:e.isTTY!==!0||e.env.SSH_CONNECTION||e.env.SSH_TTY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function T(e){(e.log??(e=>console.error(e)))("Launching Open Knowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)");let t={...process.env};delete t.ELECTRON_RUN_AS_NODE,e.spawn(`open`,[`-b`,`com.inkeep.open-knowledge`],{detached:!0,stdio:`ignore`,env:t}).unref()}function E(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found at ${b}. Install via DMG, or omit --mode for browser mode.`;case`darwin-only`:return`Desktop app is macOS-only on this release. Use --mode=browser, or omit --mode for the server fallback.`;case`headless`:return`Desktop launch is gated in headless contexts (CI, SSH, non-TTY stdout). Set OK_FORCE_DESKTOP=1 to override, or use --mode=browser.`;case`force-browser`:return`OK_FORCE_BROWSER=1 is set — desktop dispatch is disabled. Unset it to use --mode=app.`;case`stat-error`:return`Failed to inspect desktop bundle at ${b} (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available at ${b} but launch dispatch did not fire (caller bug).`}}function D(e){return d(u(e),`..`,`Frameworks`,`Open Knowledge Server.app`,`Contents`,`MacOS`,`Open Knowledge Helper`)}const O=/\/[^/]+\.app\/Contents\/MacOS\/[^/]+$/;function k(e){if(e.platform!==`darwin`||!O.test(e.execPath))return null;let t=D(e.execPath);return e.exists(t)?t:null}function A(e={}){let t=e.execPath??process.execPath,n=e.platform??process.platform,r=e.argv??process.argv,i=e.exists??p,a=r[1];return a?{command:k({execPath:t,platform:n,exists:i})??t,prefixArgs:[a]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx -y @inkeep/open-knowledge@latest\`. This re-introduces the registry-fetch surface that re-exec was fixing. Observed argv: ${JSON.stringify(r)}`),{command:`npx`,prefixArgs:[`-y`,`@inkeep/open-knowledge@latest`]})}function j(e,t){return e.host??t.HOST??`localhost`}function M(e){let t=l(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var N=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function P(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){p(e.lockDir)||m(e.lockDir,{recursive:!0});let t=h(d(e.lockDir,n),`w`),r=e.spawn??c,{PORT:i,...a}=process.env,o=A();try{let n=r(o.command,[...o.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:{...a,ELECTRON_RUN_AS_NODE:`1`}});return n.unref(),n}finally{try{f(t)}catch{}}}async function I(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}const L=r;function R(e){let t=e.sigtermGraceMs??L,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>v(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 z(e){let{config:t,cwd:n,host:r}=e,s=e.skipAutoInit??!1,c=e.skipUiAutoSpawn??!1,l=e.idleThresholdMs??18e5,{existsSync:u,mkdirSync:d}=await import(`node:fs`),{bootServer:f,getLogger:p,isProcessAlive:m,readUiLock:h,resolveContentDir:g}=await import(`./dist-CpYAbkBw.mjs`),_=e.log??p(`start`);if(!s&&!o(n))throw new N(n);let y=process.env.OK_RECLAIM_DISABLE??null;try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-Cbol0R2Q.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:y})}catch(e){_.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-CHoyWCeo.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:y})}catch(e){_.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-CaLjuijU.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:y})}catch(e){_.warn({err:e},`[start] skill repair sweep failed; continuing`)}let b=g(t,n);u(b)||(d(b,{recursive:!0}),_.info({contentDir:b},`Created content directory`));let x=null,S=async({lockDir:t})=>{if(x=P({uiLock:h(t),isAlive:m}),x.action===`spawn`&&!c)try{F({lockDir:t,cwd:n,spawn:e.spawn}),_.info({reason:x.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 x.action===`skip`&&_.info({port:x.port,pid:x.pid},`UI already running at port ${x.port}`)},C=e.reactShellDistDir===void 0,w=i(),T=await f({config:t,contentDir:b,projectDir:n,contentRoot:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:a,tokenStore:w,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:C,idleShutdownMs:l,skipAutoInit:!0,...C?{spawnUiSiblingFn:S}:{},idleShutdownHandler:e=>R({readUiLock:()=>h(T.lockDir),isAlive:m,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:_}),log:_,...e.serveContentAssets?{serveContentAssets:!0}:{},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});x||={action:`skip`,reason:`alive`,pid:0,port:0};let E=x,D=null;if(E.action===`skip`)D=E.port>0?E.port:null;else if(!c){let t=e.uiBindTimeoutMs??3e3;D=await I({readUiLock:()=>h(T.lockDir),now:Date.now,sleep:e=>v(e),timeoutMs:t,pollIntervalMs:50}),D===null&&_.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:T.httpServer,destroy:T.destroy,lockDir:T.lockDir,contentDir:b,port:T.port,ready:T.ready,degraded:T.degraded,uiSpawnDecision:x,resolvedUiPort:D}}function B(t){if(t===`browser`||t===`app`)return t;throw new e(`--mode must be 'browser' or 'app'`)}async function V(e,t){let{renderBanner:n}=await import(`./banner-D39r_H1d.mjs`),{dim:r,error:i,warning:a}=await import(`./colors-t2HkW8lF.mjs`),o=process.cwd(),c=e;process.title=M(o);let l=j(t,process.env),u=t.port===void 0?void 0:Number(t.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await z({config:c,cwd:o,host:l,port:f,...t.serveContentAssets?{serveContentAssets:!0}:{},...t.reactShellDistDir?{reactShellDistDir:t.reactShellDistDir}:{}})}catch(e){e instanceof N&&(console.error(i(e.message)),process.exit(1));let t=await import(`./dist-CpYAbkBw.mjs`);(e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78);let n=H(e,o,t);n!==null&&(console.error(i(n)),process.exit(1)),console.error(`${i(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let m=!1,h=async e=>{if(!m){m=!0,console.log(r(`\nShutting down (${e})`));try{await p.destroy()}catch(e){console.error(`${i(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{h(`SIGINT`)}),process.once(`SIGTERM`,()=>{h(`SIGTERM`)});let g=`http://${l}:${p.port}`,_=l===`0.0.0.0`||l===`::`?`http://0.0.0.0:${p.port}`:void 0,v=p.resolvedUiPort,y=v!==null&&v>0?`http://${l}:${v}`:g;console.log(n({name:`open-knowledge`,version:s,localUrl:y,apiUrl:y===g?void 0:g,networkUrl:_}));let b={"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`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=b[e]??`${e} (check server logs for details)`;console.warn(` ${a(`⚠`)} ${a(e)}: ${r(t)}`)}console.log()}if(t.open){let{openBrowser:e}=await import(`./open-browser-C6LU_1mt.mjs`);e(y)}}).catch(e=>{console.error(` ${i(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}function H(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=d(t,`.ok`),r=n.readServerLock(e);return r?r.kind===`interactive`?`Open Knowledge desktop is currently running on this project. Quit it or use --cwd to point elsewhere.`:r.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`.":"Open Knowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function U(e){return new t(`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(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,B).option(`--serve-content-assets`,`Serve content assets from this server`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path> (suppresses ok ui sibling)`).action(async t=>{let n=e();if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
|
|
2
2
|
`),process.exit(2));let e=[];if(t.port!==void 0&&e.push(`--port`),t.host!==void 0&&e.push(`--host`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=w(x());if(n.available){T({spawn:c});return}console.error(E(n.reason)),process.exit(1)}await V(n,t)})}export{P as a,V as c,H as d,A as f,T as h,R as i,F as l,w as m,I as n,M as o,x as p,z as r,j as s,N as t,U as u};
|
|
3
|
-
//# sourceMappingURL=start-
|
|
3
|
+
//# sourceMappingURL=start-CfcNOkrG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as e}from"./start-CfcNOkrG.mjs";export{e as startCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ur as e}from"./dist-
|
|
2
|
-
//# sourceMappingURL=write-project-skill-
|
|
1
|
+
import{ur as e}from"./dist-BBbP7DxV.mjs";import{dirname as t,isAbsolute as n,relative as r,resolve as i,sep as a}from"node:path";import{cpSync as o,existsSync as s,lstatSync as c,mkdirSync as l,realpathSync as u,rmSync as d}from"node:fs";function f(e,o){let s;try{s=u(o)}catch{s=i(o)}let l;try{l=c(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(l?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);let d=t(e);for(;d.length>1&&d!==a;){let i;try{i=u(d)}catch(e){if(e.code===`ENOENT`){d=t(d);continue}throw e}let a=r(s,i);if(a===``||!a.startsWith(`..`)&&!n(a))return;throw Error(`Refusing to write at ${e}: ancestor ${d} resolves to ${i}, which is outside the project directory ${s}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function p(n,r){let i=n.projectSkillPath?.(r);if(!i)return{editorId:n.id,label:n.label,action:`skipped-unsupported`,path:``};try{let a=e(`project`,{checkDesktop:!0}),c=t(i);f(c,r);let u=s(i)?`overwritten`:`written`;return d(c,{recursive:!0,force:!0}),l(t(c),{recursive:!0}),o(a,c,{recursive:!0}),{editorId:n.id,label:n.label,action:u,path:i}}catch(e){return{editorId:n.id,label:n.label,action:`failed`,path:i,error:e instanceof Error?e.message:String(e)}}}export{p as n,f as t};
|
|
2
|
+
//# sourceMappingURL=write-project-skill-BNMnZE-x.mjs.map
|
package/package.json
CHANGED
package/dist/init-ocjYxfXH.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as e}from"./init-BGiBx-dh.mjs";export{e as runInit};
|
package/dist/loader-D-NfPdsY.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-YWHDdTmw.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-1onz6LlI.mjs";export{t as formatPreviewBlock,e as previewContent};
|