@inkeep/open-knowledge 0.35.0-beta.1 → 0.35.0-beta.10
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 +60 -60
- package/dist/constants-Dz2qZ4xq.mjs +2 -0
- package/dist/{gh-detect-DRUIjmmd.mjs → gh-detect-93wtg_nV.mjs} +2 -2
- package/dist/git-handle-CeejIzW4.mjs +1 -0
- package/dist/{git-handle-BCwv1aYd.mjs → git-handle-DPCY4VMM.mjs} +2 -2
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/init-BDDNvDb2.mjs +1 -0
- package/dist/{init-CVLKb3oz.mjs → init-BML9kFnm.mjs} +3 -3
- package/dist/{launch-json-removal-AdTwk3eT.mjs → launch-json-removal-B1WIOuxC.mjs} +2 -2
- package/dist/loader-CVlmzfQz.mjs +1 -0
- package/dist/{loader-CJD5H4rj.mjs → loader-Ctd2y8kQ.mjs} +2 -2
- package/dist/{open-browser-nDAvg8ub.mjs → open-browser-CP3YN1jA.mjs} +2 -2
- package/dist/{preview-Dq8FTDPe.mjs → preview-B0yncS2h.mjs} +2 -2
- package/dist/preview-BFe8JVVx.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-DBgWJhkx.js → ActivityModeContent-BzCteFud.js} +1 -1
- package/dist/public/assets/CodeMirrorPropInput-BaaMh183.js +3 -0
- package/dist/public/assets/DocumentContext-DVJ7yEqv.js +36 -0
- package/dist/public/assets/{EnableSyncConfirmDialog-BFsmDIV-.js → EnableSyncConfirmDialog-pUJ0-0Xd.js} +1 -1
- package/dist/public/assets/{GraphPanel-C5V7tN6C.js → GraphPanel-CLbL3_7S.js} +4 -4
- package/dist/public/assets/ManagedArtifactProperties-BbvAZvc9.js +1 -0
- package/dist/public/assets/{McpConsentDialogBody-BwgO2quE.js → McpConsentDialogBody-D_ALgiPf.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-dbbj76iW.js → MermaidDocEditor-C4zrJQLq.js} +1 -1
- package/dist/public/assets/PropertyPanel-D2cHpPyn.js +2 -0
- package/dist/public/assets/{ReportBugDialogBody-memFSmPS.js → ReportBugDialogBody-Bqt1KnSD.js} +1 -1
- package/dist/public/assets/SettingsDialogBody-Ivdm3ToR.js +7 -0
- package/dist/public/assets/{ShareBranchSwitchDialog-DI52ZkaG.js → ShareBranchSwitchDialog-COA225Wh.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-C8u6PgdG.js → ShareReceiveDialog-CGeUbVX5.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-PR-XSxN1.js → ShareReceiveMissDialog-BiFbvWX1.js} +1 -1
- package/dist/public/assets/SkillEditorActions-HOX1vQzN.js +1 -0
- package/dist/public/assets/{SourceEditor-FX3akQbF.js → SourceEditor-BbNBxNCg.js} +1 -1
- package/dist/public/assets/{TerminalPanel-N3nlUpP9.js → TerminalPanel-CJcXd9VC.js} +3 -3
- package/dist/public/assets/{agent-presence-CTUYlsSf.js → agent-presence-DWEqGNHh.js} +1 -1
- package/dist/public/assets/{auth-state-cache-ByjLRYDx.js → auth-state-cache-Di7tO3rZ.js} +5 -5
- package/dist/public/assets/{config-provider-CBrCc3Qp.js → config-provider-DGMqQCfP.js} +4 -4
- package/dist/public/assets/{dist-Cub6hBx7.js → dist-CN1nOe9M.js} +1 -1
- package/dist/public/assets/{dist-GfBYAWEU.js → dist-Cf-rDWvg.js} +137 -135
- package/dist/public/assets/{doc-hash-BMXWNo_I.js → doc-hash-vKFY-V-Y.js} +1 -1
- package/dist/public/assets/{documents-events-DJ1GG23v.js → documents-events-BzjmhSSx.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-DDhSPjxf.js → file-tree-adapter-DNsVn4SH.js} +1 -1
- package/dist/public/assets/{index-D2oet0wG.js → index-D0Ehy4r9.js} +103 -103
- package/dist/public/assets/{lint-config-client-BGM5HIsf.js → lint-config-client-C1xGkxTP.js} +1 -1
- package/dist/public/assets/{navigation-targets-CW61_XIz.js → navigation-targets-nvGLJ1po.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-BGW4m9f4.js → open-managed-artifact-tab-CUhx9b-j.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-9viWJ9VV.js → pending-receive-nav-store-HxClZpU_.js} +1 -1
- package/dist/public/assets/{prop-types-BvMtVAeG.js → prop-types-y7w6_eIH.js} +1 -1
- package/dist/public/assets/{receive-store-B3-FInQ9.js → receive-store-BBpK7Or2.js} +1 -1
- package/dist/public/assets/{selection-context-C_A_tH6W.js → selection-context-iozWEaD1.js} +1 -1
- package/dist/public/assets/skill-actions-DL-yNOVR.js +1 -0
- package/dist/public/assets/{skills-api-BhEjmNIn.js → skills-api-T6KNnXbb.js} +1 -1
- package/dist/public/assets/{src-G334Yrxd.js → src-DL3Zlx5X.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-oLHFF9_D.js → target-navigation-intent-JPOSvf1i.js} +1 -1
- package/dist/public/assets/{telemetry-startup-BtK87qj7.js → telemetry-startup-jMwHqIQ4.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-CwIqbcfm.js → typing-burst-detector-50DGt0NB.js} +2 -2
- package/dist/public/assets/{use-apply-config-color-theme-JH4tQfHA.js → use-apply-config-color-theme-C4-L1m1x.js} +1 -1
- package/dist/public/assets/{workspace-paths-DtvYoBMA.js → workspace-paths-BzYkZqjr.js} +1 -1
- package/dist/public/index.html +31 -31
- package/dist/{repair-launch-json-CxNjlqij.mjs → repair-launch-json-QSRMby2t.mjs} +2 -2
- package/dist/{repair-mcp-configs-Dtnsor_m.mjs → repair-mcp-configs-BmV1j3BR.mjs} +2 -2
- package/dist/{repair-skills-tJI8shk3.mjs → repair-skills-CZbrTVch.mjs} +2 -2
- package/dist/repair-skills-CyhWReZX.mjs +1 -0
- package/dist/server-lock-DGqK-4av.mjs +1 -0
- package/dist/{server-lock-CRw6jjM3.mjs → server-lock-wMKEjgnN.mjs} +2 -2
- package/dist/{src-CFHcsBtV.mjs → src-BU7I7py6.mjs} +126 -122
- package/dist/{src-BI8S8yWC.mjs → src-C0CgVA8i.mjs} +351 -351
- package/dist/{src-nG3ysTNI.mjs → src-CrcH2zRs.mjs} +2 -2
- package/dist/{src-Z2z9ztGi.mjs → src-FMIoftZv.mjs} +1 -1
- package/dist/start-CMGuisLc.mjs +1 -0
- package/dist/{start-DLha1qnz.mjs → start-D8mMdCQz.mjs} +2 -2
- package/dist/{write-project-skill-Bg3yDMEj.mjs → write-project-skill-DkTM_Oeh.mjs} +2 -2
- package/package.json +5 -5
- package/dist/constants-DZx62n7t.mjs +0 -2
- package/dist/git-handle-DcVL5mrG.mjs +0 -1
- package/dist/init-CzoKldU1.mjs +0 -1
- package/dist/loader-CU424QQ7.mjs +0 -1
- package/dist/preview-CM4FOiPe.mjs +0 -1
- package/dist/public/assets/CodeMirrorPropInput-DKUgIQit.js +0 -3
- package/dist/public/assets/DocumentContext-CWJ7hfZT.js +0 -36
- package/dist/public/assets/ManagedArtifactProperties-_V5aR-6k.js +0 -1
- package/dist/public/assets/PropertyPanel-hMoN4Hda.js +0 -2
- package/dist/public/assets/SettingsDialogBody-SwVDm-ay.js +0 -7
- package/dist/public/assets/SkillEditorActions-DG7dmv6Z.js +0 -1
- package/dist/public/assets/skill-actions-6AAhO9zY.js +0 -1
- package/dist/repair-skills-Drky8zkq.mjs +0 -1
- package/dist/server-lock-KfTPtASZ.mjs +0 -1
- package/dist/start-vpVar-h6.mjs +0 -1
- /package/dist/public/assets/{dist-o9cVHl8Q.js → dist-C87Ou6G5.js} +0 -0
- /package/dist/public/assets/{documents-fetch-YrVYNlaU.js → documents-fetch-CD85Qoe6.js} +0 -0
- /package/dist/public/assets/{file-tree-rename-validation-DgUQ0I0S.js → file-tree-rename-validation-BBSv40Qz.js} +0 -0
- /package/dist/public/assets/{parse-api-error-BcfaIWfX.js → parse-api-error-Mgtc4OJu.js} +0 -0
- /package/dist/public/assets/{startup-marks-Dq0rZGD-.js → startup-marks-BJwpvHMe.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./propagation-api-M_AcuP6N.js";import{n}from"./startup-marks-
|
|
1
|
+
import{n as e,t}from"./propagation-api-M_AcuP6N.js";import{n}from"./startup-marks-BJwpvHMe.js";import{getAppTracer as r}from"./telemetry-impl-jUMr-Cv1.js";var i;function a(){if(!i)try{let a=typeof window<`u`?window.okDesktop?.config.startupTraceparent:void 0;if(!a)return;let o=t.extract(e.active(),{traceparent:a}),s=r().startSpan(`ok.app-startup`,void 0,o);i=s,n(e=>{try{s.end(e)}catch{}i=void 0})}catch{}}export{a as initStartupTrace};
|
package/dist/public/assets/{typing-burst-detector-CwIqbcfm.js → typing-burst-detector-50DGt0NB.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,r as n,t as r}from"./compiler-runtime-DrcePeIl.js";import{n as i}from"./DocumentContext-CWJ7hfZT.js";import{n as a,r as o}from"./dist-CSDjUb5q.js";import{a as s,c,i as l,n as u,o as d,r as f,s as p,t as m,u as h}from"./panel-BGYdvxEm.js";import{n as g,t as _,u as v}from"./createLucideIcon-Wgamzz8_.js";import{n as y,r as b,t as x}from"./collapsible-UIgt0pSO.js";import{B as S,I as C}from"./CodeMirrorPropInput-DKUgIQit.js";import{n as w,t as T}from"./toggle-group-B30vKHKs.js";import{dt as E,mt as D,sr as O,zr as k}from"./dist-GfBYAWEU.js";import{t as A}from"./chevron-right-B2thM4kG.js";import{n as j,r as M}from"./CopyButton-B8lE78wK.js";import{i as ee}from"./prop-types-BvMtVAeG.js";import{l as N}from"./workspace-paths-DtvYoBMA.js";import{t as P}from"./refresh-cw-FMnveNBD.js";import{t as F}from"./triangle-alert-VZ_Cki-r.js";import{n as I}from"./dist-Qabe7wDM.js";import{t as L}from"./dist-o9cVHl8Q.js";import{i as R}from"./startup-marks-Dq0rZGD-.js";import{a as z,s as B}from"./doc-hash-BMXWNo_I.js";import{i as V,l as H,r as U}from"./lint-config-client-BGM5HIsf.js";var W=_(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),G=e(t(),1),K=r(),q=3e4,J=new Map;function Y(e){return e?Date.now()-e.rememberedAt>q?null:e.navigation:null}function te(e,t){J.set(e,{navigation:t,rememberedAt:Date.now()})}function X(e){return Y(J.get(e))}function Z(e){let t=J.get(e);return J.delete(e),Y(t)}function Q(e){J.delete(e)}function ne(e,t){let n=(0,K.c)(4),r=t===void 0?!1:t,[i,a]=(0,G.useState)(void 0),o=(0,G.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,G.useEffect)(s,c),i}var $=n(),re=300;async function ie(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new S(L._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=D.safeParse(n);throw e.success?Error(e.data.title):new S(L._({id:`zlErBl`}),{status:t.status})}let r=E.safeParse(n);if(!r.success)throw new S(L._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var ae=32,oe=12,se=6,ce=`open-knowledge:outline-nav`;function le(e){let t=(0,K.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(R,{name:`outline-panel`,children:(0,$.jsx)(ue,{...e})}),t[0]=e,t[1]=n),n}function ue(e){let t=(0,K.c)(50),{docName:n,isSourceMode:r,className:g}=e,_=g===void 0?``:g,{_:y}=o(),{pages:b,loading:x}=ee(),S=h(),{activeProvider:C,activeDocName:w}=i(),T,E;t[0]===n?(T=t[1],E=t[2]):(T=[`page-headings`,n],E=()=>ie(n),t[0]=n,t[1]=T,t[2]=E);let D;t[3]!==n||t[4]!==x||t[5]!==b?(D=!x&&(b.has(n)||O(n)),t[3]=n,t[4]=x,t[5]=b,t[6]=D):D=t[6];let k;t[7]!==T||t[8]!==E||t[9]!==D?(k={queryKey:T,queryFn:E,enabled:D,staleTime:1/0},t[7]=T,t[8]=E,t[9]=D,t[10]=k):k=t[10];let{data:A,isLoading:j,error:M}=c(k),N;t[11]===A?N=t[12]:(N=A===void 0?[]:A,t[11]=A,t[12]=N);let P=N,F,I;t[13]!==w||t[14]!==C||t[15]!==n||t[16]!==S?(F=()=>{if(!C||w!==n)return;let e=C.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,S.invalidateQueries({queryKey:[`page-headings`,n]})},re)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},I=[C,w,n,S],t[13]=w,t[14]=C,t[15]=n,t[16]=S,t[17]=F,t[18]=I):(F=t[17],I=t[18]),(0,G.useEffect)(F,I);let L;t[19]===P?L=t[20]:(L=P.map(de),t[19]=P,t[20]=L);let R=ne(L,r),z;t[21]!==R||t[22]!==P?(z=R?P.findIndex(e=>e.slug===R):-1,t[21]=R,t[22]=P,t[23]=z):z=t[23];let B=z,V;t[24]!==n||t[25]!==r?(V=function(e,t){let i={index:e,slug:t,mode:r?`source`:`wysiwyg`};i.mode===`source`&&te(n,{kind:`outline`,detail:i}),window.dispatchEvent(new CustomEvent(ce,{detail:i}))},t[24]=n,t[25]=r,t[26]=V):V=t[26];let H=V,U=((B>=0?P[B].level:1)-1)*oe+(oe-se)/2,W=B*ae+(ae-se)/2,q;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(p,{children:(0,$.jsx)(a,{id:`dD7NPy`})}),t[27]=q):q=t[27];let J;t[28]!==P.length||t[29]!==j?(J=!j&&(0,$.jsx)(f,{children:P.length}),t[28]=P.length,t[29]=j,t[30]=J):J=t[30];let Y;t[31]===J?Y=t[32]:(Y=(0,$.jsxs)(d,{children:[q,J]}),t[31]=J,t[32]=Y);let X;t[33]!==y||t[34]!==B||t[35]!==R||t[36]!==M||t[37]!==H||t[38]!==P||t[39]!==j||t[40]!==U||t[41]!==W?(X=M?(0,$.jsx)(s,{className:`px-2`,children:M instanceof Error?M.message:y({id:`GuqOb1`})}):P.length===0&&!j?(0,$.jsx)(l,{className:`px-2`,children:(0,$.jsx)(a,{id:`0BB9ID`})}):(0,$.jsxs)(`nav`,{"aria-label":y({id:`BymzO4`}),className:`relative`,children:[B>=0&&(0,$.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:se,height:se,transform:`translate(${U}px, ${W}px)`}}),P.map((e,t)=>{let n=e.slug===R;return(0,$.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>H(t,e.slug),className:v(`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)*oe+20}px`},title:e.text,children:e.text},t)})]}),t[33]=y,t[34]=B,t[35]=R,t[36]=M,t[37]=H,t[38]=P,t[39]=j,t[40]=U,t[41]=W,t[42]=X):X=t[42];let Z;t[43]!==j||t[44]!==X?(Z=(0,$.jsx)(u,{className:`px-3 py-2`,"aria-busy":j,children:X}),t[43]=j,t[44]=X,t[45]=Z):Z=t[45];let Q;return t[46]!==_||t[47]!==Y||t[48]!==Z?(Q=(0,$.jsxs)(m,{className:_,children:[Y,Z]}),t[46]=_,t[47]=Y,t[48]=Z,t[49]=Q):Q=t[49],Q}function de(e){return e.slug}function fe(e){let t=(0,K.c)(10),{scope:n,onScopeChange:r}=e,{_:i}=o(),s;t[0]===r?s=t[1]:(s=e=>{e&&r(e)},t[0]=r,t[1]=s);let c;t[2]===i?c=t[3]:(c=i({id:`aBgwis`}),t[2]=i,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(w,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,$.jsx)(a,{id:`UpCz01`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(w,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:(0,$.jsx)(a,{id:`e0NrBM`})}),t[5]=u):u=t[5];let d;return t[6]!==n||t[7]!==s||t[8]!==c?(d=(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,$.jsxs)(T,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:s,"aria-label":c,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[l,u]})}),t[6]=n,t[7]=s,t[8]=c,t[9]=d):d=t[9],d}var pe=`open-knowledge:lint-nav`;function me(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function he(e){return{line:e.range.start.line+1,column:e.range.start.character+1}}function ge(e){let t=(0,K.c)(19),{diagnostic:n}=e,{_:r}=o(),i=n.severity===`error`?M:F,a=`${n.source}/${n.code}`,s=n.range.start.line+1,c=n.severity===`error`?`text-destructive`:`text-amber-500`,l;t[0]===c?l=t[1]:(l=v(`mt-0.5 size-3.5 shrink-0`,c),t[0]=c,t[1]=l);let u;t[2]!==i||t[3]!==l?(u=(0,$.jsx)(i,{"aria-hidden":`true`,className:l}),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===n.message?d=t[6]:(d=(0,$.jsx)(`span`,{className:`text-foreground`,children:n.message}),t[5]=n.message,t[6]=d);let f;t[7]!==u||t[8]!==d?(f=(0,$.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[u,d]}),t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==r||t[11]!==s?(p=r({id:`enPTnx`,values:{displayLine:s}}),t[10]=r,t[11]=s,t[12]=p):p=t[12];let m;t[13]!==a||t[14]!==p?(m=(0,$.jsxs)(`span`,{className:`ps-5 font-mono text-xs text-muted-foreground`,children:[a,` · `,p]}),t[13]=a,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,$.jsxs)($.Fragment,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}function _e(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function ve(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function ye(e){let t=(0,K.c)(13),{count:n,disabled:r,onClick:i,children:s}=e,{_:c}=o(),l;t[0]!==c||t[1]!==s||t[2]!==n?(l=s===void 0?c({id:`Izb10l`,values:{count:n}}):void 0,t[0]=c,t[1]=s,t[2]=n,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(W,{"aria-hidden":`true`,className:`size-3`}),t[4]=u):u=t[4];let d;t[5]!==s||t[6]!==n?(d=s??(0,$.jsx)(a,{id:`5_8TCr`,values:{count:n}}),t[5]=s,t[6]=n,t[7]=d):d=t[7];let f;return t[8]!==r||t[9]!==i||t[10]!==l||t[11]!==d?(f=(0,$.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:i,"aria-label":l,"data-testid":`problems-fix-all`,children:[u,d]}),t[8]=r,t[9]=i,t[10]=l,t[11]=d,t[12]=f):f=t[12],f}function be(e){let t=(0,K.c)(21),{docName:n,diagnostics:r,onFix:i,onFixAll:s,onAskAi:c}=e,{_:h}=o(),[_,v]=(0,G.useState)(`doc`),y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y={status:`idle`},t[0]=y):y=t[0];let[b,x]=(0,G.useState)(y),[S,C]=(0,G.useState)(null),w=(0,G.useRef)(!0),T,E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>(w.current=!0,()=>{w.current=!1}),E=[],t[1]=T,t[2]=E):(T=t[1],E=t[2]),(0,G.useEffect)(T,E);let D;if(t[3]!==h||t[4]!==b||t[5]!==r||t[6]!==n||t[7]!==c||t[8]!==i||t[9]!==s||t[10]!==S||t[11]!==_){let e=[...r].sort(me),o=async function(){x({status:`loading`});let e=await V();w.current&&x(e===null?{status:`failed`}:{status:`loaded`,result:e})},y=b.status===`loaded`?b.result.files.filter(Ce):[],T=async function(){if(S!==null||y.length===0)return;C({done:0,total:y.length});let e=[];for(let t of y){let n=await U(z(t.file));if(!w.current)return;n.ok||e.push({file:t.file,detail:n.errorDetail}),C(Se)}if(C(null),e.length>0){let t=e[0];I.error(h({id:`fru3T7`,values:{0:e.length,1:y.length}}),{description:t===void 0?void 0:`${t.file}${t.detail===null?``:` — ${t.detail}`}`})}try{await o()}catch{w.current&&x({status:`failed`})}},E=function(e){v(e),e===`project`&&b.status===`idle`&&o()},O;t[13]===n?O=t[14]:(O=function(e){let t=he(e);te(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(pe,{detail:t}))},t[13]=n,t[14]=O);let k=O,A;t[15]!==n||t[16]!==k?(A=function(e,t){let r=z(e);if(r===n){k(t);return}te(r,{kind:`lint`,detail:he(t)}),window.location.hash=B(r)},t[15]=n,t[16]=k,t[17]=A):A=t[17];let j=A,M;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(p,{children:(0,$.jsx)(a,{id:`OXdGnd`})}),t[18]=M):M=t[18];let ee=_===`doc`&&e.length>0&&(0,$.jsx)(f,{children:e.length}),P;t[19]===ee?P=t[20]:(P=(0,$.jsxs)(d,{children:[M,ee]}),t[19]=ee,t[20]=P),D=(0,$.jsxs)(m,{children:[P,(0,$.jsx)(fe,{scope:_,onScopeChange:E}),_===`doc`?(0,$.jsx)(u,{className:`px-2 py-2`,children:e.length===0?(0,$.jsx)(l,{className:`px-2`,children:(0,$.jsx)(a,{id:`ZI8uvA`})}):(0,$.jsxs)($.Fragment,{children:[s!==void 0&&(0,$.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-2 pb-1`,children:(0,$.jsx)(ye,{count:ve(e),disabled:ve(e)===0,onClick:s})}),(0,$.jsx)(`ul`,{"aria-label":h({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:e.map(e=>{let t=e.range.start.line+1,n=i!==void 0&&(e.fixes?.length??0)>0,r=`${e.source}/${e.code}`;return(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>k(e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:h({id:`aHPdYV`,values:{displayLine:t}}),children:(0,$.jsx)(ge,{diagnostic:e})}),n||c!==void 0?(0,$.jsxs)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:[n?(0,$.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>i?.(e),"aria-label":h({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,$.jsx)(W,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(a,{id:`c4fVUV`})]}):null,c===void 0?null:(0,$.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>c(e),"aria-label":h({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,$.jsx)(N,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(a,{id:`xWEvuo`})]})]}):null]},_e(e))})})]})}):(0,$.jsx)(Te,{audit:b,onRefresh:()=>void o(),onNavigate:j,fixableCount:y.reduce(xe,0),fixing:S,onFixAll:()=>void T()})]}),t[3]=h,t[4]=b,t[5]=r,t[6]=n,t[7]=c,t[8]=i,t[9]=s,t[10]=S,t[11]=_,t[12]=D}else D=t[12];return D}function xe(e,t){return e+ve(t.diagnostics)}function Se(e){return e===null?e:{...e,done:e.done+1}}function Ce(e){return e.diagnostics.some(we)}function we(e){return(e.fixes?.length??0)>0}function Te(e){let t=(0,K.c)(43),{audit:n,onRefresh:r,onNavigate:i,fixableCount:c,fixing:l,onFixAll:d}=e,{_:f}=o(),p=n.status===`loading`||n.status===`idle`,m;t[0]!==n.result||t[1]!==n.status?(m=n.status===`loaded`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(a,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,$.jsx)(a,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[0]=n.result,t[1]=n.status,t[2]=m):m=t[2];let h;t[3]===m?h=t[4]:(h=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:m}),t[3]=m,t[4]=h);let _;t[5]!==f||t[6]!==l?(_=l===null?null:(0,$.jsx)(`span`,{className:`sr-only`,role:`status`,children:f({id:`gZElfU`,values:{0:l.done,1:l.total}})}),t[5]=f,t[6]=l,t[7]=_):_=t[7];let v=p||l!==null||c===0,y;t[8]===l?y=t[9]:(y=l===null?void 0:(0,$.jsx)(a,{id:`S9t1PI`,values:{0:l.done,1:l.total}}),t[8]=l,t[9]=y);let b;t[10]!==c||t[11]!==d||t[12]!==v||t[13]!==y?(b=(0,$.jsx)(ye,{count:c,disabled:v,onClick:d,children:y}),t[10]=c,t[11]=d,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]===f?x=t[16]:(x=f({id:`WRdYfS`}),t[15]=f,t[16]=x);let S=p||l!==null,C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(P,{"aria-hidden":`true`,className:`size-3.5`}),t[17]=C):C=t[17];let w;t[18]!==r||t[19]!==x||t[20]!==S?(w=(0,$.jsx)(g,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":x,"data-testid":`problems-audit-refresh`,disabled:S,onClick:r,children:C}),t[18]=r,t[19]=x,t[20]=S,t[21]=w):w=t[21];let T;t[22]!==w||t[23]!==_||t[24]!==b?(T=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[_,b,w]}),t[22]=w,t[23]=_,t[24]=b,t[25]=T):T=t[25];let E;t[26]!==T||t[27]!==h?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pb-1`,children:[h,T]}),t[26]=T,t[27]=h,t[28]=E):E=t[28];let D;t[29]!==f||t[30]!==p?(D=p&&(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":f({id:`dx-TwN`}),children:[1,2,3].map(Ee)}),t[29]=f,t[30]=p,t[31]=D):D=t[31];let O;t[32]===n.status?O=t[33]:(O=n.status===`failed`&&(0,$.jsx)(s,{className:`px-2 text-xs`,children:(0,$.jsx)(a,{id:`IFezUv`})}),t[32]=n.status,t[33]=O);let k;t[34]!==n.result||t[35]!==n.status||t[36]!==i?(k=n.status===`loaded`&&(0,$.jsx)(De,{result:n.result,onNavigate:i}),t[34]=n.result,t[35]=n.status,t[36]=i,t[37]=k):k=t[37];let A;return t[38]!==E||t[39]!==D||t[40]!==O||t[41]!==k?(A=(0,$.jsxs)(u,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[E,D,O,k]}),t[38]=E,t[39]=D,t[40]=O,t[41]=k,t[42]=A):A=t[42],A}function Ee(e){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,$.jsx)(H,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(H,{className:`h-3 w-28`}),(0,$.jsx)(H,{className:`h-3 w-40`})]})]},e)}function De(e){let t=(0,K.c)(10),{result:n,onNavigate:r}=e,{_:i}=o(),s;t[0]!==i||t[1]!==n.warnings?(s=n.warnings.length>0&&(0,$.jsx)(`ul`,{"aria-label":i({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:n.warnings.map(Oe)}),t[0]=i,t[1]=n.warnings,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n.fileCount||t[5]!==n.files?(c=n.files.length===0?(0,$.jsx)(l,{className:`px-2`,children:(0,$.jsx)(a,{id:`k_Dqw1`,values:{0:n.fileCount}})}):n.files.map(e=>(0,$.jsx)(ke,{file:e,onNavigate:r},e.file)),t[3]=r,t[4]=n.fileCount,t[5]=n.files,t[6]=c):c=t[6];let u;return t[7]!==s||t[8]!==c?(u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=u):u=t[9],u}function Oe(e,t){return(0,$.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,$.jsx)(F,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function ke(e){let t=(0,K.c)(37),{file:n,onNavigate:r}=e,{_:i}=o(),a,s,c,l,u,d,f,p,m;if(t[0]!==i||t[1]!==n.diagnostics||t[2]!==n.file||t[3]!==r){let e=[...n.diagnostics].sort(me);s=x,f=!0,p=`problems-audit-group`;let o;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(A,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[13]=o):o=t[13];let h;t[14]===n.file?h=t[15]:(h=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[14]=n.file,t[15]=h),m=(0,$.jsxs)(b,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[o,h,(0,$.jsx)(j,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),a=y,d=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[16]!==i||t[17]!==n.file?(c=i({id:`zAJzIg`,values:{0:n.file}}),t[16]=i,t[17]=n.file,t[18]=c):c=t[18],l=`flex flex-col gap-0.5 pb-1 ps-3`;let g;t[19]!==i||t[20]!==n.file||t[21]!==r?(g=e=>{let t=e.range.start.line+1;return(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(n.file,e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,title:i({id:`kDwcbW`,values:{0:n.file,displayLine:t}}),children:(0,$.jsx)(ge,{diagnostic:e})})},_e(e))},t[19]=i,t[20]=n.file,t[21]=r,t[22]=g):g=t[22],u=e.map(g),t[0]=i,t[1]=n.diagnostics,t[2]=n.file,t[3]=r,t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else a=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];let h;t[23]!==c||t[24]!==l||t[25]!==u?(h=(0,$.jsx)(`ul`,{"aria-label":c,className:l,children:u}),t[23]=c,t[24]=l,t[25]=u,t[26]=h):h=t[26];let g;t[27]!==a||t[28]!==d||t[29]!==h?(g=(0,$.jsx)(a,{className:d,children:h}),t[27]=a,t[28]=d,t[29]=h,t[30]=g):g=t[30];let _;return t[31]!==s||t[32]!==f||t[33]!==p||t[34]!==m||t[35]!==g?(_=(0,$.jsxs)(s,{defaultOpen:f,"data-testid":p,children:[m,g]}),t[31]=s,t[32]=f,t[33]=p,t[34]=m,t[35]=g,t[36]=_):_=t[36],_}var Ae={words:0,chars:0,tokens:0},je=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,Me=/[\p{L}\p{N}]/u,Ne=new Set([`text`,`inlineCode`,`code`,`tag`]),Pe=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),Fe=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Ie(e,t){if(!e)return;let n=e.type;if(!Pe.has(n)){if(Ne.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,r as n,t as r}from"./compiler-runtime-DrcePeIl.js";import{n as i}from"./DocumentContext-DVJ7yEqv.js";import{n as a,r as o}from"./dist-CSDjUb5q.js";import{a as s,c,i as l,n as u,o as d,r as f,s as p,t as m,u as h}from"./panel-BGYdvxEm.js";import{n as g,t as _,u as v}from"./createLucideIcon-Wgamzz8_.js";import{n as y,r as b,t as x}from"./collapsible-UIgt0pSO.js";import{B as S,I as C}from"./CodeMirrorPropInput-BaaMh183.js";import{n as w,t as T}from"./toggle-group-B30vKHKs.js";import{Vr as E,ft as D,ht as O,lr as k}from"./dist-Cf-rDWvg.js";import{t as A}from"./chevron-right-B2thM4kG.js";import{n as j,r as M}from"./CopyButton-B8lE78wK.js";import{i as ee}from"./prop-types-y7w6_eIH.js";import{l as N}from"./workspace-paths-BzYkZqjr.js";import{t as P}from"./refresh-cw-FMnveNBD.js";import{t as F}from"./triangle-alert-VZ_Cki-r.js";import{n as I}from"./dist-Qabe7wDM.js";import{t as L}from"./dist-C87Ou6G5.js";import{i as R,l as z,r as B}from"./lint-config-client-C1xGkxTP.js";import{i as V}from"./startup-marks-BJwpvHMe.js";import{a as H,s as U}from"./doc-hash-vKFY-V-Y.js";var W=_(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),G=e(t(),1),K=r(),q=3e4,J=new Map;function Y(e){return e?Date.now()-e.rememberedAt>q?null:e.navigation:null}function te(e,t){J.set(e,{navigation:t,rememberedAt:Date.now()})}function X(e){return Y(J.get(e))}function Z(e){let t=J.get(e);return J.delete(e),Y(t)}function Q(e){J.delete(e)}function ne(e,t){let n=(0,K.c)(4),r=t===void 0?!1:t,[i,a]=(0,G.useState)(void 0),o=(0,G.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,G.useEffect)(s,c),i}var $=n(),re=300;async function ie(e){let t=await fetch(`/api/page-headings?docName=${encodeURIComponent(e)}`),n;try{n=await t.json()}catch(e){throw new S(L._({id:`qAQVSD`}),{cause:e,status:t.status})}if(!t.ok){let e=O.safeParse(n);throw e.success?Error(e.data.title):new S(L._({id:`zlErBl`}),{status:t.status})}let r=D.safeParse(n);if(!r.success)throw new S(L._({id:`XW18jo`}),{status:t.status});return r.data.headings??[]}var ae=32,oe=12,se=6,ce=`open-knowledge:outline-nav`;function le(e){let t=(0,K.c)(2),n;return t[0]===e?n=t[1]:(n=(0,$.jsx)(V,{name:`outline-panel`,children:(0,$.jsx)(ue,{...e})}),t[0]=e,t[1]=n),n}function ue(e){let t=(0,K.c)(50),{docName:n,isSourceMode:r,className:g}=e,_=g===void 0?``:g,{_:y}=o(),{pages:b,loading:x}=ee(),S=h(),{activeProvider:C,activeDocName:w}=i(),T,E;t[0]===n?(T=t[1],E=t[2]):(T=[`page-headings`,n],E=()=>ie(n),t[0]=n,t[1]=T,t[2]=E);let D;t[3]!==n||t[4]!==x||t[5]!==b?(D=!x&&(b.has(n)||k(n)),t[3]=n,t[4]=x,t[5]=b,t[6]=D):D=t[6];let O;t[7]!==T||t[8]!==E||t[9]!==D?(O={queryKey:T,queryFn:E,enabled:D,staleTime:1/0},t[7]=T,t[8]=E,t[9]=D,t[10]=O):O=t[10];let{data:A,isLoading:j,error:M}=c(O),N;t[11]===A?N=t[12]:(N=A===void 0?[]:A,t[11]=A,t[12]=N);let P=N,F,I;t[13]!==w||t[14]!==C||t[15]!==n||t[16]!==S?(F=()=>{if(!C||w!==n)return;let e=C.document,t=null,r=()=>{t!==null&&clearTimeout(t),t=setTimeout(()=>{t=null,S.invalidateQueries({queryKey:[`page-headings`,n]})},re)};return e.on(`update`,r),()=>{e.off(`update`,r),t!==null&&clearTimeout(t)}},I=[C,w,n,S],t[13]=w,t[14]=C,t[15]=n,t[16]=S,t[17]=F,t[18]=I):(F=t[17],I=t[18]),(0,G.useEffect)(F,I);let L;t[19]===P?L=t[20]:(L=P.map(de),t[19]=P,t[20]=L);let R=ne(L,r),z;t[21]!==R||t[22]!==P?(z=R?P.findIndex(e=>e.slug===R):-1,t[21]=R,t[22]=P,t[23]=z):z=t[23];let B=z,V;t[24]!==n||t[25]!==r?(V=function(e,t){let i={index:e,slug:t,mode:r?`source`:`wysiwyg`};i.mode===`source`&&te(n,{kind:`outline`,detail:i}),window.dispatchEvent(new CustomEvent(ce,{detail:i}))},t[24]=n,t[25]=r,t[26]=V):V=t[26];let H=V,U=((B>=0?P[B].level:1)-1)*oe+(oe-se)/2,W=B*ae+(ae-se)/2,q;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(p,{children:(0,$.jsx)(a,{id:`dD7NPy`})}),t[27]=q):q=t[27];let J;t[28]!==P.length||t[29]!==j?(J=!j&&(0,$.jsx)(f,{children:P.length}),t[28]=P.length,t[29]=j,t[30]=J):J=t[30];let Y;t[31]===J?Y=t[32]:(Y=(0,$.jsxs)(d,{children:[q,J]}),t[31]=J,t[32]=Y);let X;t[33]!==y||t[34]!==B||t[35]!==R||t[36]!==M||t[37]!==H||t[38]!==P||t[39]!==j||t[40]!==U||t[41]!==W?(X=M?(0,$.jsx)(s,{className:`px-2`,children:M instanceof Error?M.message:y({id:`GuqOb1`})}):P.length===0&&!j?(0,$.jsx)(l,{className:`px-2`,children:(0,$.jsx)(a,{id:`0BB9ID`})}):(0,$.jsxs)(`nav`,{"aria-label":y({id:`BymzO4`}),className:`relative`,children:[B>=0&&(0,$.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:se,height:se,transform:`translate(${U}px, ${W}px)`}}),P.map((e,t)=>{let n=e.slug===R;return(0,$.jsx)(`button`,{type:`button`,"aria-current":n?`location`:void 0,onClick:()=>H(t,e.slug),className:v(`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)*oe+20}px`},title:e.text,children:e.text},t)})]}),t[33]=y,t[34]=B,t[35]=R,t[36]=M,t[37]=H,t[38]=P,t[39]=j,t[40]=U,t[41]=W,t[42]=X):X=t[42];let Z;t[43]!==j||t[44]!==X?(Z=(0,$.jsx)(u,{className:`px-3 py-2`,"aria-busy":j,children:X}),t[43]=j,t[44]=X,t[45]=Z):Z=t[45];let Q;return t[46]!==_||t[47]!==Y||t[48]!==Z?(Q=(0,$.jsxs)(m,{className:_,children:[Y,Z]}),t[46]=_,t[47]=Y,t[48]=Z,t[49]=Q):Q=t[49],Q}function de(e){return e.slug}function fe(e){let t=(0,K.c)(10),{scope:n,onScopeChange:r}=e,{_:i}=o(),s;t[0]===r?s=t[1]:(s=e=>{e&&r(e)},t[0]=r,t[1]=s);let c;t[2]===i?c=t[3]:(c=i({id:`aBgwis`}),t[2]=i,t[3]=c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(w,{value:`doc`,className:`flex-1`,"data-testid":`panel-scope-doc`,children:(0,$.jsx)(a,{id:`UpCz01`})}),t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(w,{value:`project`,className:`flex-1`,"data-testid":`panel-scope-project`,children:(0,$.jsx)(a,{id:`e0NrBM`})}),t[5]=u):u=t[5];let d;return t[6]!==n||t[7]!==s||t[8]!==c?(d=(0,$.jsx)(`div`,{className:`shrink-0 px-4 pb-2`,children:(0,$.jsxs)(T,{type:`single`,variant:`segmented`,size:`sm`,spacing:1,value:n,onValueChange:s,"aria-label":c,className:`w-full rounded-md bg-muted p-0.5 dark:bg-background`,children:[l,u]})}),t[6]=n,t[7]=s,t[8]=c,t[9]=d):d=t[9],d}var pe=`open-knowledge:lint-nav`;function me(e,t){return e.range.start.line-t.range.start.line||e.range.start.character-t.range.start.character}function he(e){return{line:e.range.start.line+1,column:e.range.start.character+1}}function ge(e){let t=(0,K.c)(19),{diagnostic:n}=e,{_:r}=o(),i=n.severity===`error`?M:F,a=`${n.source}/${n.code}`,s=n.range.start.line+1,c=n.severity===`error`?`text-destructive`:`text-amber-500`,l;t[0]===c?l=t[1]:(l=v(`mt-0.5 size-3.5 shrink-0`,c),t[0]=c,t[1]=l);let u;t[2]!==i||t[3]!==l?(u=(0,$.jsx)(i,{"aria-hidden":`true`,className:l}),t[2]=i,t[3]=l,t[4]=u):u=t[4];let d;t[5]===n.message?d=t[6]:(d=(0,$.jsx)(`span`,{className:`text-foreground`,children:n.message}),t[5]=n.message,t[6]=d);let f;t[7]!==u||t[8]!==d?(f=(0,$.jsxs)(`span`,{className:`flex items-start gap-1.5 text-sm`,children:[u,d]}),t[7]=u,t[8]=d,t[9]=f):f=t[9];let p;t[10]!==r||t[11]!==s?(p=r({id:`enPTnx`,values:{displayLine:s}}),t[10]=r,t[11]=s,t[12]=p):p=t[12];let m;t[13]!==a||t[14]!==p?(m=(0,$.jsxs)(`span`,{className:`ps-5 font-mono text-xs text-muted-foreground`,children:[a,` · `,p]}),t[13]=a,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==f||t[17]!==m?(h=(0,$.jsxs)($.Fragment,{children:[f,m]}),t[16]=f,t[17]=m,t[18]=h):h=t[18],h}function _e(e){return`${e.source}/${e.code}-${e.range.start.line}-${e.range.start.character}-${e.message}`}function ve(e){return e.reduce((e,t)=>e+ +((t.fixes?.length??0)>0),0)}function ye(e){let t=(0,K.c)(13),{count:n,disabled:r,onClick:i,children:s}=e,{_:c}=o(),l;t[0]!==c||t[1]!==s||t[2]!==n?(l=s===void 0?c({id:`Izb10l`,values:{count:n}}):void 0,t[0]=c,t[1]=s,t[2]=n,t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(W,{"aria-hidden":`true`,className:`size-3`}),t[4]=u):u=t[4];let d;t[5]!==s||t[6]!==n?(d=s??(0,$.jsx)(a,{id:`5_8TCr`,values:{count:n}}),t[5]=s,t[6]=n,t[7]=d):d=t[7];let f;return t[8]!==r||t[9]!==i||t[10]!==l||t[11]!==d?(f=(0,$.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,disabled:r,onClick:i,"aria-label":l,"data-testid":`problems-fix-all`,children:[u,d]}),t[8]=r,t[9]=i,t[10]=l,t[11]=d,t[12]=f):f=t[12],f}function be(e){let t=(0,K.c)(21),{docName:n,diagnostics:r,onFix:i,onFixAll:s,onAskAi:c}=e,{_:h}=o(),[_,v]=(0,G.useState)(`doc`),y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y={status:`idle`},t[0]=y):y=t[0];let[b,x]=(0,G.useState)(y),[S,C]=(0,G.useState)(null),w=(0,G.useRef)(!0),T,E;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>(w.current=!0,()=>{w.current=!1}),E=[],t[1]=T,t[2]=E):(T=t[1],E=t[2]),(0,G.useEffect)(T,E);let D;if(t[3]!==h||t[4]!==b||t[5]!==r||t[6]!==n||t[7]!==c||t[8]!==i||t[9]!==s||t[10]!==S||t[11]!==_){let e=[...r].sort(me),o=async function(){x({status:`loading`});let e=await R();w.current&&x(e===null?{status:`failed`}:{status:`loaded`,result:e})},y=b.status===`loaded`?b.result.files.filter(Ce):[],T=async function(){if(S!==null||y.length===0)return;C({done:0,total:y.length});let e=[];for(let t of y){let n=await B(H(t.file));if(!w.current)return;n.ok||e.push({file:t.file,detail:n.errorDetail}),C(Se)}if(C(null),e.length>0){let t=e[0];I.error(h({id:`fru3T7`,values:{0:e.length,1:y.length}}),{description:t===void 0?void 0:`${t.file}${t.detail===null?``:` — ${t.detail}`}`})}try{await o()}catch{w.current&&x({status:`failed`})}},E=function(e){v(e),e===`project`&&b.status===`idle`&&o()},O;t[13]===n?O=t[14]:(O=function(e){let t=he(e);te(n,{kind:`lint`,detail:t}),window.dispatchEvent(new CustomEvent(pe,{detail:t}))},t[13]=n,t[14]=O);let k=O,A;t[15]!==n||t[16]!==k?(A=function(e,t){let r=H(e);if(r===n){k(t);return}te(r,{kind:`lint`,detail:he(t)}),window.location.hash=U(r)},t[15]=n,t[16]=k,t[17]=A):A=t[17];let j=A,M;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(p,{children:(0,$.jsx)(a,{id:`OXdGnd`})}),t[18]=M):M=t[18];let ee=_===`doc`&&e.length>0&&(0,$.jsx)(f,{children:e.length}),P;t[19]===ee?P=t[20]:(P=(0,$.jsxs)(d,{children:[M,ee]}),t[19]=ee,t[20]=P),D=(0,$.jsxs)(m,{children:[P,(0,$.jsx)(fe,{scope:_,onScopeChange:E}),_===`doc`?(0,$.jsx)(u,{className:`px-2 py-2`,children:e.length===0?(0,$.jsx)(l,{className:`px-2`,children:(0,$.jsx)(a,{id:`ZI8uvA`})}):(0,$.jsxs)($.Fragment,{children:[s!==void 0&&(0,$.jsx)(`div`,{className:`flex items-center justify-end gap-2 px-2 pb-1`,children:(0,$.jsx)(ye,{count:ve(e),disabled:ve(e)===0,onClick:s})}),(0,$.jsx)(`ul`,{"aria-label":h({id:`OXdGnd`}),className:`flex flex-col gap-0.5`,children:e.map(e=>{let t=e.range.start.line+1,n=i!==void 0&&(e.fixes?.length??0)>0,r=`${e.source}/${e.code}`;return(0,$.jsxs)(`li`,{className:`group relative rounded transition-colors hover:bg-muted`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>k(e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left`,title:h({id:`aHPdYV`,values:{displayLine:t}}),children:(0,$.jsx)(ge,{diagnostic:e})}),n||c!==void 0?(0,$.jsxs)(`div`,{className:`absolute bottom-1 right-1 flex items-center gap-1 rounded bg-muted opacity-0 transition-opacity focus-within:opacity-100 group-hover:opacity-100 motion-reduce:transition-none`,children:[n?(0,$.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>i?.(e),"aria-label":h({id:`fZj9em`,values:{flatId:r}}),"data-testid":`problems-fix`,children:[(0,$.jsx)(W,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(a,{id:`c4fVUV`})]}):null,c===void 0?null:(0,$.jsxs)(g,{size:`sm`,variant:`ghost`,className:`h-6 shrink-0 px-2 text-xs`,onClick:()=>c(e),"aria-label":h({id:`hh4mVC`,values:{flatId:r}}),"data-testid":`problems-ask-ai`,children:[(0,$.jsx)(N,{"aria-hidden":`true`,className:`size-3`}),(0,$.jsx)(a,{id:`xWEvuo`})]})]}):null]},_e(e))})})]})}):(0,$.jsx)(Te,{audit:b,onRefresh:()=>void o(),onNavigate:j,fixableCount:y.reduce(xe,0),fixing:S,onFixAll:()=>void T()})]}),t[3]=h,t[4]=b,t[5]=r,t[6]=n,t[7]=c,t[8]=i,t[9]=s,t[10]=S,t[11]=_,t[12]=D}else D=t[12];return D}function xe(e,t){return e+ve(t.diagnostics)}function Se(e){return e===null?e:{...e,done:e.done+1}}function Ce(e){return e.diagnostics.some(we)}function we(e){return(e.fixes?.length??0)>0}function Te(e){let t=(0,K.c)(43),{audit:n,onRefresh:r,onNavigate:i,fixableCount:c,fixing:l,onFixAll:d}=e,{_:f}=o(),p=n.status===`loading`||n.status===`idle`,m;t[0]!==n.result||t[1]!==n.status?(m=n.status===`loaded`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(a,{id:`DsDwR-`,values:{0:n.result.errorCount}}),` · `,(0,$.jsx)(a,{id:`W1SI2K`,values:{0:n.result.warningCount}})]}),t[0]=n.result,t[1]=n.status,t[2]=m):m=t[2];let h;t[3]===m?h=t[4]:(h=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`problems-audit-summary`,children:m}),t[3]=m,t[4]=h);let _;t[5]!==f||t[6]!==l?(_=l===null?null:(0,$.jsx)(`span`,{className:`sr-only`,role:`status`,children:f({id:`gZElfU`,values:{0:l.done,1:l.total}})}),t[5]=f,t[6]=l,t[7]=_):_=t[7];let v=p||l!==null||c===0,y;t[8]===l?y=t[9]:(y=l===null?void 0:(0,$.jsx)(a,{id:`S9t1PI`,values:{0:l.done,1:l.total}}),t[8]=l,t[9]=y);let b;t[10]!==c||t[11]!==d||t[12]!==v||t[13]!==y?(b=(0,$.jsx)(ye,{count:c,disabled:v,onClick:d,children:y}),t[10]=c,t[11]=d,t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]===f?x=t[16]:(x=f({id:`WRdYfS`}),t[15]=f,t[16]=x);let S=p||l!==null,C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(P,{"aria-hidden":`true`,className:`size-3.5`}),t[17]=C):C=t[17];let w;t[18]!==r||t[19]!==x||t[20]!==S?(w=(0,$.jsx)(g,{variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground`,"aria-label":x,"data-testid":`problems-audit-refresh`,disabled:S,onClick:r,children:C}),t[18]=r,t[19]=x,t[20]=S,t[21]=w):w=t[21];let T;t[22]!==w||t[23]!==_||t[24]!==b?(T=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[_,b,w]}),t[22]=w,t[23]=_,t[24]=b,t[25]=T):T=t[25];let E;t[26]!==T||t[27]!==h?(E=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-2 pb-1`,children:[h,T]}),t[26]=T,t[27]=h,t[28]=E):E=t[28];let D;t[29]!==f||t[30]!==p?(D=p&&(0,$.jsx)(`div`,{className:`flex flex-col gap-1`,role:`status`,"aria-busy":`true`,"aria-label":f({id:`dx-TwN`}),children:[1,2,3].map(Ee)}),t[29]=f,t[30]=p,t[31]=D):D=t[31];let O;t[32]===n.status?O=t[33]:(O=n.status===`failed`&&(0,$.jsx)(s,{className:`px-2 text-xs`,children:(0,$.jsx)(a,{id:`IFezUv`})}),t[32]=n.status,t[33]=O);let k;t[34]!==n.result||t[35]!==n.status||t[36]!==i?(k=n.status===`loaded`&&(0,$.jsx)(De,{result:n.result,onNavigate:i}),t[34]=n.result,t[35]=n.status,t[36]=i,t[37]=k):k=t[37];let A;return t[38]!==E||t[39]!==D||t[40]!==O||t[41]!==k?(A=(0,$.jsxs)(u,{className:`px-2 py-2`,"data-testid":`problems-project-scope`,children:[E,D,O,k]}),t[38]=E,t[39]=D,t[40]=O,t[41]=k,t[42]=A):A=t[42],A}function Ee(e){return(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded px-2 py-1.5`,children:[(0,$.jsx)(z,{className:`mt-0.5 size-3.5 shrink-0 rounded`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-1.5`,children:[(0,$.jsx)(z,{className:`h-3 w-28`}),(0,$.jsx)(z,{className:`h-3 w-40`})]})]},e)}function De(e){let t=(0,K.c)(10),{result:n,onNavigate:r}=e,{_:i}=o(),s;t[0]!==i||t[1]!==n.warnings?(s=n.warnings.length>0&&(0,$.jsx)(`ul`,{"aria-label":i({id:`Rsdhj9`}),className:`flex flex-col gap-0.5 pb-1`,children:n.warnings.map(Oe)}),t[0]=i,t[1]=n.warnings,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n.fileCount||t[5]!==n.files?(c=n.files.length===0?(0,$.jsx)(l,{className:`px-2`,children:(0,$.jsx)(a,{id:`k_Dqw1`,values:{0:n.fileCount}})}):n.files.map(e=>(0,$.jsx)(ke,{file:e,onNavigate:r},e.file)),t[3]=r,t[4]=n.fileCount,t[5]=n.files,t[6]=c):c=t[6];let u;return t[7]!==s||t[8]!==c?(u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=u):u=t[9],u}function Oe(e,t){return(0,$.jsxs)(`li`,{className:`flex items-start gap-1.5 px-2 text-xs`,children:[(0,$.jsx)(F,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-amber-500`}),(0,$.jsx)(`span`,{className:`min-w-0 text-foreground`,children:e})]},`${t}-${e}`)}function ke(e){let t=(0,K.c)(37),{file:n,onNavigate:r}=e,{_:i}=o(),a,s,c,l,u,d,f,p,m;if(t[0]!==i||t[1]!==n.diagnostics||t[2]!==n.file||t[3]!==r){let e=[...n.diagnostics].sort(me);s=x,f=!0,p=`problems-audit-group`;let o;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(A,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`}),t[13]=o):o=t[13];let h;t[14]===n.file?h=t[15]:(h=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground`,title:n.file,children:n.file}),t[14]=n.file,t[15]=h),m=(0,$.jsxs)(b,{className:`group flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,children:[o,h,(0,$.jsx)(j,{variant:`gray`,"data-testid":`problems-audit-file-count`,className:`shrink-0`,children:e.length})]}),a=y,d=`overflow-hidden data-[state=open]:animate-[collapsible-down_150ms_ease-out] data-[state=closed]:animate-[collapsible-up_150ms_ease-in]`,t[16]!==i||t[17]!==n.file?(c=i({id:`zAJzIg`,values:{0:n.file}}),t[16]=i,t[17]=n.file,t[18]=c):c=t[18],l=`flex flex-col gap-0.5 pb-1 ps-3`;let g;t[19]!==i||t[20]!==n.file||t[21]!==r?(g=e=>{let t=e.range.start.line+1;return(0,$.jsx)(`li`,{children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(n.file,e),className:`flex w-full cursor-pointer flex-col gap-0.5 rounded px-2 py-1.5 text-left transition-colors hover:bg-muted`,title:i({id:`kDwcbW`,values:{0:n.file,displayLine:t}}),children:(0,$.jsx)(ge,{diagnostic:e})})},_e(e))},t[19]=i,t[20]=n.file,t[21]=r,t[22]=g):g=t[22],u=e.map(g),t[0]=i,t[1]=n.diagnostics,t[2]=n.file,t[3]=r,t[4]=a,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m}else a=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12];let h;t[23]!==c||t[24]!==l||t[25]!==u?(h=(0,$.jsx)(`ul`,{"aria-label":c,className:l,children:u}),t[23]=c,t[24]=l,t[25]=u,t[26]=h):h=t[26];let g;t[27]!==a||t[28]!==d||t[29]!==h?(g=(0,$.jsx)(a,{className:d,children:h}),t[27]=a,t[28]=d,t[29]=h,t[30]=g):g=t[30];let _;return t[31]!==s||t[32]!==f||t[33]!==p||t[34]!==m||t[35]!==g?(_=(0,$.jsxs)(s,{defaultOpen:f,"data-testid":p,children:[m,g]}),t[31]=s,t[32]=f,t[33]=p,t[34]=m,t[35]=g,t[36]=_):_=t[36],_}var Ae={words:0,chars:0,tokens:0},je=/[ -〿-ゟ゠-ヿ㐀-䶿一-鿿豈---ក-]/,Me=/[\p{L}\p{N}]/u,Ne=new Set([`text`,`inlineCode`,`code`,`tag`]),Pe=new Set([`html`,`definition`,`footnoteDefinition`,`yaml`,`toml`,`image`,`imageReference`,`mdxFlowExpression`,`mdxTextExpression`,`mdxjsEsm`,`rawMdxFallback`,`rawMdxFallbackMdast`]),Fe=new Set([`paragraph`,`heading`,`blockquote`,`list`,`listItem`,`thematicBreak`,`table`,`tableRow`,`tableCell`,`mdxJsxFlowElement`,`commentBlock`]);function Ie(e,t){if(!e)return;let n=e.type;if(!Pe.has(n)){if(Ne.has(n)){e.value&&(t.push(e.value),n===`code`&&t.push(`
|
|
2
2
|
`));return}if(n===`wikiLink`||n===`wikiLinkEmbed`){let n=e.data?.alias??e.value??``;n&&t.push(n);return}if(Array.isArray(e.children)){for(let n of e.children)Ie(n,t);if(Fe.has(n)&&t.length>0){let e=t[t.length-1];e&&!e.endsWith(`
|
|
3
3
|
`)&&t.push(`
|
|
4
|
-
`)}}}}function Le(e){try{let t=C().parseToMdast(e),n=[];return Ie(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function Re(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))Me.test(n)&&t++;return t}function ze(e){let t=globalThis.Intl.Segmenter;if(!t)return Re(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function Be(e){let t=je.test(e)?1.5:4;return Math.ceil(e.length/t)}function Ve(e){return e?{words:je.test(e)?ze(e):Re(e),chars:e.length,tokens:Be(e)}:{words:0,chars:0,tokens:0}}function He(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=
|
|
4
|
+
`)}}}}function Le(e){try{let t=C().parseToMdast(e),n=[];return Ie(t,n),n.join(``).trim()}catch(t){return console.warn(`[document-stats] mdast parse failed, falling back to raw text`,t),e.trim()}}function Re(e){if(!e)return 0;let t=0;for(let n of e.split(/\s+/))Me.test(n)&&t++;return t}function ze(e){let t=globalThis.Intl.Segmenter;if(!t)return Re(e);let n=new t(void 0,{granularity:`word`}),r=0;for(let t of n.segment(e))t.isWordLike&&r++;return r}function Be(e){let t=je.test(e)?1.5:4;return Math.ceil(e.length/t)}function Ve(e){return e?{words:je.test(e)?ze(e):Re(e),chars:e.length,tokens:Be(e)}:{words:0,chars:0,tokens:0}}function He(e){if(!e)return{words:0,chars:0,tokens:0};let{body:t}=E(e);return t.trim()?Ve(Le(t)):{words:0,chars:0,tokens:0}}function Ue(e,{isMarkdown:t}){let n=e.trim();return n?Ve(t?Le(e):n):Ae}var We=new Map,Ge=new Set,Ke=(e,t)=>`${t}:${e}`;function qe(){for(let e of Ge)e()}function Je(e,t,n){let r=Ke(e,t);if(n===null){We.delete(r)&&qe();return}let i=We.get(r);i&&i.words===n.words&&i.chars===n.chars&&i.tokens===n.tokens||(We.set(r,n),qe())}function Ye(e,t){return e===null?null:We.get(Ke(e,t))??null}function Xe(e){return Ge.add(e),()=>{Ge.delete(e)}}function Ze(e){let{from:t,to:n,empty:r}=e.state.selection;if(r)return null;let i=e.state.doc.textBetween(t,n,`
|
|
5
5
|
`,` `);return i.trim()?Ue(i,{isMarkdown:!1}):null}function Qe(e){let t=[];for(let n of e.state.selection.ranges)n.empty||t.push(e.state.sliceDoc(n.from,n.to));if(t.length===0)return null;let n=t.join(`
|
|
6
6
|
`);return n.trim()?Ue(n,{isMarkdown:!0}):null}export{Xe as a,pe as c,le as d,Q as f,te as h,Ze as i,be as l,X as m,Je as n,Ae as o,Z as p,Qe as r,He as s,Ye as t,ce as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,t as n}from"./compiler-runtime-DrcePeIl.js";import{
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{n as t,t as n}from"./compiler-runtime-DrcePeIl.js";import{ua as r,va as i}from"./dist-Cf-rDWvg.js";var a=e(t(),1),o=n(),s=/^#[0-9a-fA-F]{6}$/,c={background:`#0f172a`,surface:`#1e293b`,foreground:`#e2e8f0`,primary:`#6366f1`,accent:`#22d3ee`,border:`#334155`};function l(e){return typeof e==`string`&&s.test(e)}function u(e){let t={...c};if(e)for(let n of Object.keys(c)){let r=e[n];l(r)&&(t[n]=r)}return t}function d(e){let t=l(e)?e:`#000000`,n=e=>{let n=Number.parseInt(t.slice(1+e*2,3+e*2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(1)+.0722*n(2)}function f(e){return d(e.background)<.5?`dark`:`light`}function p(e){return d(e)<.5?`#ffffff`:`#0a0a0a`}function m(e){return{bg:e.background,bgElevated:e.surface,bgSubtle:e.surface,fg:e.foreground,fgMuted:`color-mix(in oklab, ${e.foreground} 55%, ${e.background})`,border:e.border,primary:e.primary,primaryFg:p(e.primary),red:`#e5534b`,green:`#3fb950`,yellow:`#d29922`,blue:e.accent,cyan:e.accent,orange:`#db8d3f`,purple:e.accent}}function h(e){let t=r(m(e)),n=Object.entries(t).map(([e,t])=>` --${e}: ${t};`);return`html[data-color-theme="custom"] {\n color-scheme: ${f(e)};\n${n.join(`
|
|
2
2
|
`)}\n}`}var g=`ok-color-theme-v1`,_=`ok-custom-theme-v1`,v=`data-color-theme`,y=`ok-custom-theme`;function b(e){let t=document.getElementById(y);t||(t=document.createElement(`style`),t.id=y,document.head.appendChild(t)),t.textContent!==e&&(t.textContent=e)}function x(){document.getElementById(y)?.remove()}function S(e,t,n=!0){if(typeof document>`u`)return;let r=i(n?e:`default`),a=document.documentElement;r.id===`default`?a.removeAttribute(v):a.setAttribute(v,r.id);let o=null;if(r.id===`custom`){let e=u(t),n=h(e);b(n),o=JSON.stringify({css:n,dark:f(e)===`dark`})}else x();try{r.id===`default`?localStorage.removeItem(g):localStorage.setItem(g,r.id),o?localStorage.setItem(_,o):localStorage.removeItem(_)}catch{}}function C(e,t,n){let r=(0,o.c)(12),i=n===void 0?!0:n,s;r[0]!==e||r[1]!==t||r[2]!==i?(s=i&&e===`custom`?JSON.stringify(t??null):``,r[0]=e,r[1]=t,r[2]=i,r[3]=s):s=r[3];let c=s,l;r[4]!==e||r[5]!==t||r[6]!==i?(l=()=>{S(e,t,i)},r[4]=e,r[5]=t,r[6]=i,r[7]=l):l=r[7];let u;r[8]!==e||r[9]!==i||r[10]!==c?(u=[e,c,i],r[8]=e,r[9]=i,r[10]=c,r[11]=u):u=r[11],(0,a.useEffect)(l,u)}export{f as a,u as c,c as i,S as n,m as o,C as r,l as s,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./chunk-DseTPa7n.js";import{n as t}from"./compiler-runtime-DrcePeIl.js";import{r as n}from"./dist-CSDjUb5q.js";import{t as r}from"./createLucideIcon-Wgamzz8_.js";import{
|
|
1
|
+
import{i as e}from"./chunk-DseTPa7n.js";import{n as t}from"./compiler-runtime-DrcePeIl.js";import{r as n}from"./dist-CSDjUb5q.js";import{t as r}from"./createLucideIcon-Wgamzz8_.js";import{Tn as i}from"./dist-Cf-rDWvg.js";var a=r(`copy-plus`,[[`line`,{x1:`15`,x2:`15`,y1:`12`,y2:`18`,key:`1p7wdc`}],[`line`,{x1:`12`,x2:`18`,y1:`15`,y2:`15`,key:`1nscbv`}],[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),o=r(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),s=r(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),c=[`global`,`project`];function l(e){return{project:new Set(e.filter(e=>e.scope===`project`).map(e=>e.name)),global:new Set(e.filter(e=>e.scope===`global`).map(e=>e.name))}}var u=`open-knowledge-pack-`;function d(e){return e.startsWith(u)?e.slice(20):e}function f(){let{_:e}=n();return{project:e({id:`e0NrBM`}),global:e({id:`2GT3Hf`})}}function p(){let{_:e}=n();return{project:e({id:`HyvSqq`}),global:e({id:`C7XjNB`})}}var m=e(t(),1);function h(){let[e]=(0,m.useState)(g);return e}function g(){return i()!=null}function _(e,t,n){let r=n===`\\`?t.replaceAll(`/`,`\\`):t;return`${e.endsWith(n)?e.slice(0,-1):e}${n}${r}`}var v=/\.(md|mdx)$/i;function y(e){return v.test(e)?e:`${e}.md`}export{d as a,p as c,a as d,c as i,s as l,_ as n,l as o,h as r,f as s,y as t,o as u};
|
package/dist/public/index.html
CHANGED
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
-->
|
|
59
59
|
<script>(() => { let t = 'system'; try { const r = localStorage.getItem('ok-theme-v1'); if (r === 'light' || r === 'dark' || r === 'system') t = r; } catch {} let ct = null; try { const c = localStorage.getItem('ok-color-theme-v1'); if (c && ['dracula', 'catppuccin-frappe', 'catppuccin-latte', 'monokai', 'gruvbox', 'solarized', 'custom'].includes(c)) ct = c; } catch {} let dark = t === 'dark'; if (t === 'system') { try { dark = window.matchMedia('(prefers-color-scheme: dark)').matches; } catch {} } let customCss = null; if (ct === 'custom') { try { const raw = localStorage.getItem('ok-custom-theme-v1'); if (raw) { const o = JSON.parse(raw); if (o?.css) { customCss = o.css; dark = !!o.dark; } } } catch {} if (!customCss) ct = null; } else if (ct) { dark = !['catppuccin-latte'].includes(ct); } if (dark) document.documentElement.classList.add('dark'); if (ct) document.documentElement.setAttribute('data-color-theme', ct); if (customCss) { const s = document.createElement('style'); s.id = 'ok-custom-theme'; s.textContent = customCss; document.head.appendChild(s); } if (window.okDesktop) document.documentElement.classList.add('electron-mode'); })();</script>
|
|
60
60
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
61
|
-
<script type="module" crossorigin src="./assets/index-
|
|
61
|
+
<script type="module" crossorigin src="./assets/index-D0Ehy4r9.js"></script>
|
|
62
62
|
<link rel="modulepreload" crossorigin href="./assets/chunk-DseTPa7n.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-2ej06EnG.js">
|
|
64
64
|
<link rel="modulepreload" crossorigin href="./assets/w3c-keyname-CRPBoZED.js">
|
|
@@ -75,28 +75,28 @@
|
|
|
75
75
|
<link rel="modulepreload" crossorigin href="./assets/floating-ui.dom-B3TJy2Tg.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-BIWqyPc9.js">
|
|
77
77
|
<link rel="modulepreload" crossorigin href="./assets/markdownit-DyWy6cMj.js">
|
|
78
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
78
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-Cf-rDWvg.js">
|
|
79
79
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-DrcePeIl.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="./assets/dist-DGbq0bSp.js">
|
|
81
|
-
<link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-
|
|
81
|
+
<link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-C4-L1m1x.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="./assets/config-context-BbS_JaHs.js">
|
|
83
|
-
<link rel="modulepreload" crossorigin href="./assets/config-provider-
|
|
84
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
83
|
+
<link rel="modulepreload" crossorigin href="./assets/config-provider-DGMqQCfP.js">
|
|
84
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-C87Ou6G5.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="./assets/dist-CSDjUb5q.js">
|
|
86
86
|
<link rel="modulepreload" crossorigin href="./assets/createLucideIcon-Wgamzz8_.js">
|
|
87
87
|
<link rel="modulepreload" crossorigin href="./assets/folder-open-ygPcz1xa.js">
|
|
88
88
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-Cgf308yS.js">
|
|
89
89
|
<link rel="modulepreload" crossorigin href="./assets/triangle-alert-VZ_Cki-r.js">
|
|
90
90
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-CMNLH3L-.js">
|
|
91
|
-
<link rel="modulepreload" crossorigin href="./assets/doc-hash-
|
|
92
|
-
<link rel="modulepreload" crossorigin href="./assets/navigation-targets-
|
|
91
|
+
<link rel="modulepreload" crossorigin href="./assets/doc-hash-vKFY-V-Y.js">
|
|
92
|
+
<link rel="modulepreload" crossorigin href="./assets/navigation-targets-nvGLJ1po.js">
|
|
93
93
|
<link rel="modulepreload" crossorigin href="./assets/external-link-BfiFPJEx.js">
|
|
94
|
-
<link rel="modulepreload" crossorigin href="./assets/documents-fetch-
|
|
95
|
-
<link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-
|
|
96
|
-
<link rel="modulepreload" crossorigin href="./assets/dist-
|
|
97
|
-
<link rel="modulepreload" crossorigin href="./assets/documents-events-
|
|
98
|
-
<link rel="modulepreload" crossorigin href="./assets/parse-api-error-
|
|
99
|
-
<link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-
|
|
94
|
+
<link rel="modulepreload" crossorigin href="./assets/documents-fetch-CD85Qoe6.js">
|
|
95
|
+
<link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-BaaMh183.js">
|
|
96
|
+
<link rel="modulepreload" crossorigin href="./assets/dist-CN1nOe9M.js">
|
|
97
|
+
<link rel="modulepreload" crossorigin href="./assets/documents-events-BzjmhSSx.js">
|
|
98
|
+
<link rel="modulepreload" crossorigin href="./assets/parse-api-error-Mgtc4OJu.js">
|
|
99
|
+
<link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-CUhx9b-j.js">
|
|
100
100
|
<link rel="modulepreload" crossorigin href="./assets/dist-DivkR5AO.js">
|
|
101
101
|
<link rel="modulepreload" crossorigin href="./assets/dist-DGkUVO6K.js">
|
|
102
102
|
<link rel="modulepreload" crossorigin href="./assets/propagation-api-M_AcuP6N.js">
|
|
@@ -112,45 +112,45 @@
|
|
|
112
112
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-B2thM4kG.js">
|
|
113
113
|
<link rel="modulepreload" crossorigin href="./assets/copy-CfDOH9N1.js">
|
|
114
114
|
<link rel="modulepreload" crossorigin href="./assets/CopyButton-B8lE78wK.js">
|
|
115
|
-
<link rel="modulepreload" crossorigin href="./assets/startup-marks-
|
|
116
|
-
<link rel="modulepreload" crossorigin href="./assets/prop-types-
|
|
117
|
-
<link rel="modulepreload" crossorigin href="./assets/workspace-paths-
|
|
115
|
+
<link rel="modulepreload" crossorigin href="./assets/startup-marks-BJwpvHMe.js">
|
|
116
|
+
<link rel="modulepreload" crossorigin href="./assets/prop-types-y7w6_eIH.js">
|
|
117
|
+
<link rel="modulepreload" crossorigin href="./assets/workspace-paths-BzYkZqjr.js">
|
|
118
118
|
<link rel="modulepreload" crossorigin href="./assets/eye-Cq1_8-Tk.js">
|
|
119
119
|
<link rel="modulepreload" crossorigin href="./assets/info-CVuSDi5Y.js">
|
|
120
120
|
<link rel="modulepreload" crossorigin href="./assets/loader-circle-BrJhrTc7.js">
|
|
121
121
|
<link rel="modulepreload" crossorigin href="./assets/dist-Qabe7wDM.js">
|
|
122
|
-
<link rel="modulepreload" crossorigin href="./assets/file-tree-rename-validation-
|
|
122
|
+
<link rel="modulepreload" crossorigin href="./assets/file-tree-rename-validation-BBSv40Qz.js">
|
|
123
123
|
<link rel="modulepreload" crossorigin href="./assets/input-BX4UDDMJ.js">
|
|
124
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
124
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-DVJ7yEqv.js">
|
|
125
125
|
<link rel="modulepreload" crossorigin href="./assets/checkbox-Ds7GA0j4.js">
|
|
126
126
|
<link rel="modulepreload" crossorigin href="./assets/dist-Ly1ZfY-Y.js">
|
|
127
|
-
<link rel="modulepreload" crossorigin href="./assets/skills-api-
|
|
127
|
+
<link rel="modulepreload" crossorigin href="./assets/skills-api-T6KNnXbb.js">
|
|
128
128
|
<link rel="modulepreload" crossorigin href="./assets/label-CveCqKNR.js">
|
|
129
129
|
<link rel="modulepreload" crossorigin href="./assets/radio-group-D9Wp487Q.js">
|
|
130
|
-
<link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-
|
|
130
|
+
<link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-pUJ0-0Xd.js">
|
|
131
131
|
<link rel="modulepreload" crossorigin href="./assets/arrow-up-right-BnJZWj8r.js">
|
|
132
132
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-FMnveNBD.js">
|
|
133
133
|
<link rel="modulepreload" crossorigin href="./assets/cursor-Rw-XIAht.js">
|
|
134
134
|
<link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-BHfhAZ-n.js">
|
|
135
|
-
<link rel="modulepreload" crossorigin href="./assets/skill-actions-
|
|
136
|
-
<link rel="modulepreload" crossorigin href="./assets/lint-config-client-
|
|
135
|
+
<link rel="modulepreload" crossorigin href="./assets/skill-actions-DL-yNOVR.js">
|
|
136
|
+
<link rel="modulepreload" crossorigin href="./assets/lint-config-client-C1xGkxTP.js">
|
|
137
137
|
<link rel="modulepreload" crossorigin href="./assets/textarea--26Ac0EI.js">
|
|
138
|
-
<link rel="modulepreload" crossorigin href="./assets/auth-state-cache-
|
|
138
|
+
<link rel="modulepreload" crossorigin href="./assets/auth-state-cache-Di7tO3rZ.js">
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/toggle-group-B30vKHKs.js">
|
|
140
140
|
<link rel="modulepreload" crossorigin href="./assets/panel-BGYdvxEm.js">
|
|
141
141
|
<link rel="modulepreload" crossorigin href="./assets/format-DJS8_tfZ.js">
|
|
142
|
-
<link rel="modulepreload" crossorigin href="./assets/selection-context-
|
|
143
|
-
<link rel="modulepreload" crossorigin href="./assets/PropertyPanel-
|
|
142
|
+
<link rel="modulepreload" crossorigin href="./assets/selection-context-iozWEaD1.js">
|
|
143
|
+
<link rel="modulepreload" crossorigin href="./assets/PropertyPanel-D2cHpPyn.js">
|
|
144
144
|
<link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-b0Uwu1ZT.js">
|
|
145
|
-
<link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-
|
|
145
|
+
<link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-HxClZpU_.js">
|
|
146
146
|
<link rel="modulepreload" crossorigin href="./assets/chevron-left-rxhGFFOu.js">
|
|
147
|
-
<link rel="modulepreload" crossorigin href="./assets/agent-presence-
|
|
148
|
-
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-
|
|
147
|
+
<link rel="modulepreload" crossorigin href="./assets/agent-presence-DWEqGNHh.js">
|
|
148
|
+
<link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-50DGt0NB.js">
|
|
149
149
|
<link rel="modulepreload" crossorigin href="./assets/project-paths-DJDWBB-8.js">
|
|
150
|
-
<link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-
|
|
151
|
-
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-
|
|
150
|
+
<link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-DNsVn4SH.js">
|
|
151
|
+
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-JPOSvf1i.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-O7e02Mi1.js">
|
|
153
|
-
<link rel="modulepreload" crossorigin href="./assets/receive-store-
|
|
153
|
+
<link rel="modulepreload" crossorigin href="./assets/receive-store-BBpK7Or2.js">
|
|
154
154
|
<link rel="modulepreload" crossorigin href="./assets/worktree-store-DFmh2OE1.js">
|
|
155
155
|
<link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
|
|
156
156
|
<link rel="stylesheet" crossorigin href="./assets/index-Zwl7lo8a.css">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./launch-json-removal-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{t as e}from"./launch-json-removal-B1WIOuxC.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-QSRMby2t.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as e,v as t}from"./init-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{d as e,v as t}from"./init-BML9kFnm.mjs";import{_ as n,d as r,s as i}from"./write-project-skill-DkTM_Oeh.mjs";import{t as a}from"./mcp-migrate-event-C35ikoh2.mjs";import{homedir as o}from"node:os";function s(e){let t=e.logger??u,n=e.home??o(),a=[];if(e.reclaimDisableEnv===`1`)return t({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of i){let i=r[o],s=c(()=>i.configPath(``,n));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:i,home:n,cwd:``,configPath:s,configPathOverride:void 0,logger:t})),i.projectConfigPath){let n=i.projectConfigPath,r=c(()=>n(e.projectDir));r!==null&&a.push(l({scope:`project`,editorId:o,target:i,home:void 0,cwd:e.projectDir,configPath:r,configPathOverride:r,logger:t}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(r){let i={scope:r.scope,editorId:r.editorId,configPath:r.configPath},o=e(r.target,r.cwd,r.home,r.configPathOverride);if(o===null)return{...i,outcome:`no-entry`};if(n(o))return{...i,outcome:`canonical`};r.logger(a({scope:r.scope,surface:`cli-repair`,editorId:r.editorId,configPath:r.configPath,priorEntry:o}));let s=t(r.target,r.cwd,{mode:`published`,skipAvailabilityCheck:!0},r.home,r.configPathOverride);if(s.action===`failed`){let e=s.error??`unknown write failure`;return r.logger({event:`mcp-config-repair-write-failed`,scope:r.scope,editorId:r.editorId,configPath:r.configPath,error:e}),{...i,outcome:`write-failed`,error:e}}return s.action===`declined`?(r.logger({event:`mcp-config-repair-declined`,scope:r.scope,editorId:r.editorId,configPath:r.configPath,reason:s.declineReason}),{...i,outcome:`declined`}):{...i,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-BmV1j3BR.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{S as e}from"./src-
|
|
1
|
+
import{S as e}from"./src-BU7I7py6.mjs";import{An as t,Bn as n,Dn as r,En as i,In as a,Mn as o,Pn as s,Vn as c,jn as l}from"./src-C0CgVA8i.mjs";import{t as u}from"./esm-EvSEzE_V.mjs";import{a as d,d as f,f as p,t as m}from"./write-project-skill-DkTM_Oeh.mjs";import{dirname as h,join as g,resolve as _}from"node:path";import{existsSync as v,mkdirSync as y,readFileSync as b,readdirSync as x,rmSync as S,statSync as C,writeFileSync as w}from"node:fs";import{homedir as T}from"node:os";const E={existsSync:e=>v(e),isDirectory:e=>{try{return C(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>x(e),readFileSync:e=>b(e),writeFileSync:(e,t)=>{w(e,t)},mkdirSync:(e,t)=>{y(e,t)},rmSync:(e,t)=>{S(e,t)}},D={resolveProjectBundledSkillDir:()=>a(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>a(e,{checkDesktop:!1}),readBundledVersion:()=>r(),readRecordedVersion:e=>t(e,`cli-hosts`),writeRecordedVersion:(e,t)=>o(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>s(e),readBundleDecision:(e,t)=>i(e,t),writeBundleDecision:(e,t,n)=>l(e,t,n),removeBundleFromDisk:(e,t)=>d(e,t)};function O(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function k(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(h(t),{recursive:!0}),A(e,t,n)}function A(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=g(e,r),a=g(t,r);n.isDirectory(i)?A(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function j(e,t,n,r,i,a){let o=[],s=g(e,`.agents`,`skills`,t),c=r.existsSync(s),l=!1;try{k(n,s,r),l=!0,o.push({kind:`central`,path:s,outcome:c?`overwritten`:`written`}),i({event:`user-skill-reclaim-central-written`,scope:`user`,path:s,preexisting:c,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`central`,path:s,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-central-failed`,scope:`user`,path:s,error:t})}for(let c of p){let l=g(e,c.hostDir),u=g(l,`skills`,t);if(u===s){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!r.existsSync(l)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-host-absent`});continue}let d=r.existsSync(u);try{k(n,u,r),o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:d?`overwritten`:`written`}),i({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,preexisting:d,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,error:t})}}return{entries:o,centralWritten:l}}function M(e,t){if(!e)return!1;try{if(!t.existsSync(e))return!1;let n=t.readFileSync(e).toString(`utf8`);return n.includes(`# ok-mcp-v1`)||n.includes(`# ok-mcp-win-v1`)}catch{return!1}}function N(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 p){let o=g(e,t.hostDir,`skills`,`open-knowledge`),s=g(o,`SKILL.md`),c=n.existsSync(s),l=f[t.editorId]?.projectConfigPath?.(e),u=!c&&M(l,n);if(!c&&!u){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{m(o,e),k(i,o,n);let s=c?`reclaimed`:`created`;a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:s}),r({event:c?`project-skill-reclaim-reclaimed`:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function P(t,r,i,a){let o=e=>{r.recordEvent(e).catch(()=>{})},s=()=>new Date().toISOString(),l;try{l=await r.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return a({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let u;try{u=await r.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),u=null}let d=[],f=null;for(let e of c)try{d.push({id:e,sourceDir:r.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(d.length===0)return a({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let o of d){let s=n[o.id],c=i.existsSync(g(t,`.agents`,`skills`,s)),l=await r.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{r.removeBundleFromDisk(t,o.id),a({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:o.id})}catch(e){a({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:o.id,error:e instanceof Error?e.message:String(e)})}continue}if(l===null&&c)try{await r.writeBundleDecision(t,s,!0)}catch(e){a({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:o.id,error:e instanceof Error?e.message:String(e)})}p.push(o)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>i.existsSync(g(t,`.agents`,`skills`,n[e.id])));if(u!==null&&u===l&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:l}),{outcome:`skipped`,reason:`version-current`};let h=[],_=d.length===c.length,v=!0;for(let{id:e,sourceDir:r}of p){let o=j(t,n[e],r,i,a,l);h.push(...o.entries),o.centralWritten||(v=!1)}let y=h.some(e=>e.kind===`central`&&(e.outcome===`written`||e.outcome===`overwritten`));if(_&&v&&y){let e=null;try{await r.writeRecordedVersion(t,l),a({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:l})}catch(t){e=t instanceof Error?t.message:String(t),a({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:l,error:e})}for(let{id:t}of p)o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?`installed`:`failed`,version:l,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{let e=h.some(e=>e.kind===`host`&&e.outcome===`failed`);o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:l,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:l,entries:h}}async function F(e){let t=e.logger??O,n=e.fs??E,r=e.home??T(),i={...D,...e.deps};return e.reclaimDisableEnv===`1`?(t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`}):{status:`done`,project:N(e.projectDir,i,n,t),user:await P(r,i,n,t)}}function I(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.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function L(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===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} reclaimed, ${r} created, ${i} no-token, ${a} 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 R(){return new u(`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 F({projectDir:_(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null});process.stdout.write(`${L(e)}\n`),process.exitCode=I(e)})}export{R as n,F as t};
|
|
3
|
-
//# sourceMappingURL=repair-skills-
|
|
3
|
+
//# sourceMappingURL=repair-skills-CZbrTVch.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./repair-skills-CZbrTVch.mjs";export{e as repairSkills};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,o as t,r as n}from"./server-lock-wMKEjgnN.mjs";export{n as markServerLockDraining,e as releaseServerLock,t as updateServerLockPort};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./src-
|
|
2
|
-
//# sourceMappingURL=server-lock-
|
|
1
|
+
import"./src-BU7I7py6.mjs";import{dirname as e,join as t,resolve as n}from"node:path";import{closeSync as r,existsSync as i,mkdirSync as a,openSync as o,readFileSync as s,unlinkSync as c,writeFileSync as l,writeSync as u}from"node:fs";import{homedir as d,hostname as f}from"node:os";import{fileURLToPath as p}from"node:url";import{randomUUID as m}from"node:crypto";function h(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function g(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}const _=/^[A-Za-z0-9-]{8,64}$/;let v=null;function y(e){return t(e??d(),`.ok`,`machine-id`)}function b(t){if(t===void 0&&v!==null)return v;let n=y(t),r=null;try{let e=s(n,`utf-8`).trim();_.test(e)&&(r=e)}catch{}if(r===null){r=m();try{a(e(n),{recursive:!0}),l(n,`${r}\n`,{encoding:`utf-8`,mode:384})}catch(e){console.warn(`[machine-id] Failed to persist ${n} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return t===void 0&&(v=r),r}function x(){try{let t=n(e(p(import.meta.url)),`..`,`package.json`),r=JSON.parse(s(t,`utf-8`));if(typeof r.version==`string`&&r.version.length>0)return r.version}catch{}return`0.0.0-unknown`}const S=x(),C=1;var w=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${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 T(e,t){return n(e,`${t}.lock`)}const E=new Map;function D(e){E.set(e,(E.get(e)??0)+1)}function O(e){let t=E.get(e);return t===void 0||t<=1?(E.delete(e),!0):(E.set(e,t-1),!1)}function k(e){return typeof e.machineId==`string`?e.machineId===b():e.hostname===f()}const A=new Set;let j=!1;function M(e){A.add(e),!j&&(j=!0,process.on(`exit`,()=>{for(let e of A)try{let t=JSON.parse(s(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==b()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==f())continue;c(e)}catch{}}))}function N(e,t){try{let n=JSON.parse(s(e,`utf-8`));return n&&typeof n==`object`&&g(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 P(e){let{lockName:t,lockDir:n,metadata:s}=e,d=`[${t}-lock]`;a(n,{recursive:!0});let p=T(n,t),m={pid:process.pid,hostname:f(),port:s.port,startedAt:new Date().toISOString(),worktreeRoot:s.worktreeRoot,machineId:b(),...s.kind!==void 0&&{kind:s.kind},...s.parentPid!==void 0&&{parentPid:s.parentPid},...s.capabilities!==void 0&&{capabilities:s.capabilities},protocolVersion:s.protocolVersion??1,runtimeVersion:s.runtimeVersion??S},g=JSON.stringify(m,null,2);for(let e=0;e<3;e++){if(!i(p))try{let e=o(p,`wx`,384);try{u(e,g)}finally{r(e)}return D(p),M(p),F({lockName:t,lockDir:n,lockPath:p})}catch(e){if(e.code!==`EEXIST`)throw e}let e=N(p,d);if(e){if(k(e)&&e.pid===process.pid)return l(p,g,{encoding:`utf-8`,mode:384}),D(p),M(p),F({lockName:t,lockDir:n,lockPath:p});if(h(e.pid))throw new w(e,p,t);console.warn(`${d} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{c(p)}catch{}}throw Error(`${d} Failed to acquire ${p} after 3 attempts (concurrent acquire contention).`)}function F(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>V({lockName:t,lockDir:n}),updatePort:e=>I({lockName:t,lockDir:n,port:e})}}function I(e){let{lockName:t,lockDir:n,port:r}=e,a=`[${t}-lock]`,o=T(n,t);if(!i(o)){console.warn(`${a} Lock file missing at ${o} during port update — skipping`);return}let c;try{let e=JSON.parse(s(o,`utf-8`));if(!e||typeof e!=`object`||!g(e.pid)){console.warn(`${a} Corrupt lock at ${o} during port update — skipping`);return}c=e}catch{console.warn(`${a} Unreadable lock at ${o} during port update — skipping`);return}if(c.pid===process.pid&&k(c)){c.port=r;try{l(o,JSON.stringify(c,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${a} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function L(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=T(n,t);if((E.get(i)??0)>1)return;let a;try{let e=JSON.parse(s(i,`utf-8`));if(!e||typeof e!=`object`||!g(e.pid)){console.warn(`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){e.code!==`ENOENT`&&console.warn(`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&k(a)&&a.draining!==!0){a.draining=!0;try{l(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function R(e){let{lockName:t,lockDir:n}=e,r=T(n,t);if(!i(r))return null;let a;try{let e=JSON.parse(s(r,`utf-8`));if(!e||typeof e!=`object`||!g(e.pid))return null;a=e}catch{return null}if(!k(a))return null;if(!h(a.pid)){try{c(r)}catch{}return null}return a}function z(e){let{lockName:t,lockDir:n}=e,r=T(n,t);if(!i(r))return{status:`absent`};let a;try{a=JSON.parse(s(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!a||typeof a!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:a};let o=a;if(!g(o.pid)||typeof o.hostname!=`string`||typeof o.port!=`number`||typeof o.startedAt!=`string`||typeof o.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:a};let l={pid:o.pid,hostname:o.hostname,port:o.port,startedAt:o.startedAt,worktreeRoot:o.worktreeRoot,machineId:typeof o.machineId==`string`?o.machineId:void 0,draining:o.draining===!0?!0:void 0,protocolVersion:typeof o.protocolVersion==`number`?o.protocolVersion:void 0,runtimeVersion:typeof o.runtimeVersion==`string`?o.runtimeVersion:void 0};if(!k(l))return{status:`stale`,lock:l};if(!h(l.pid)){try{c(r)}catch{}return{status:`stale`,lock:l}}return l.protocolVersion===void 0||l.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:a}:{status:`live`,lock:l}}async function B(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>R({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function V(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,a=`[${t}-lock]`,o=T(n,t);if(O(o)){if(r){L({lockName:t,lockDir:n});return}if(i(o))try{let e=JSON.parse(s(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!k(e))return;c(o),A.delete(o)}catch(e){console.warn(`${a} Failed to release ${o}: ${e instanceof Error?e.message:String(e)}`)}}}var H=class extends w{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function U(e,t){try{return P({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof w&&e.lockName===`server`?new H(e.existing,e.lockPath):e}}function W(e,t){I({lockName:`server`,lockDir:e,port:t})}function G(e){return R({lockName:`server`,lockDir:e})}function K(e,t){V({lockName:`server`,lockDir:e,...t})}function q(e){L({lockName:`server`,lockDir:e})}function J(e,t){return B({lockName:`server`,lockDir:e,...t})}export{C as _,K as a,g as b,w as c,L as d,R as f,S as g,I as h,G as i,P as l,V as m,U as n,W as o,z as p,q as r,J as s,H as t,T as u,b as v,h as y};
|
|
2
|
+
//# sourceMappingURL=server-lock-wMKEjgnN.mjs.map
|