@inkeep/open-knowledge 0.69.0-beta.8 → 0.69.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist/THIRD_PARTY_NOTICES.md +14 -4
  2. package/dist/cli.mjs +67 -65
  3. package/dist/constants-CCuK4nUG.mjs +1 -0
  4. package/dist/{dist-CJ5qX39u.mjs → dist-CGh73TLX.mjs} +1 -1
  5. package/dist/{dist-B_lhaeFJ.mjs → dist-asnPGf9w.mjs} +1 -1
  6. package/dist/index.d.mts +48 -16
  7. package/dist/index.mjs +228 -224
  8. package/dist/init-ACza8zdW.mjs +1 -0
  9. package/dist/{init-CoCCZEvS.mjs → init-DzKFDT_8.mjs} +18 -18
  10. package/dist/launch-json-removal-BkycSqGv.mjs +1 -0
  11. package/dist/loader-C6NXM2jh.mjs +1 -0
  12. package/dist/{loader-B0EV14F-.mjs → loader-DpwyreRY.mjs} +1 -1
  13. package/dist/native/native-config.darwin-arm64.node +0 -0
  14. package/dist/native/native-config.darwin-x64.node +0 -0
  15. package/dist/native/native-config.linux-arm64-gnu.node +0 -0
  16. package/dist/native/native-config.linux-arm64-musl.node +0 -0
  17. package/dist/native/native-config.linux-x64-musl.node +0 -0
  18. package/dist/native/native-config.win32-arm64-msvc.node +0 -0
  19. package/dist/native/native-config.win32-x64-msvc.node +0 -0
  20. package/dist/{open-browser-CdtzidpR.mjs → open-browser-BtsloeTq.mjs} +1 -1
  21. package/dist/{preview-BWs_Rq1J.mjs → preview-C97i0S8P.mjs} +1 -1
  22. package/dist/preview-NxKFiLb_.mjs +1 -0
  23. package/dist/public/assets/{ActivityModeContent-CximtPXo.js → ActivityModeContent-CJlrWQa-.js} +1 -1
  24. package/dist/public/assets/{AddPropertiesButton-CLAxY4Kp.js → AddPropertiesButton-D468kNkw.js} +1 -1
  25. package/dist/public/assets/{AgentDiffPane-CZ6Irl2N.js → AgentDiffPane-sN8K8hX3.js} +1 -1
  26. package/dist/public/assets/{CodeMirrorPropInput-DyT36_0H.js → CodeMirrorPropInput-YBL6ju2M.js} +1 -1
  27. package/dist/public/assets/{DocumentContext-DS_dUWBr.js → DocumentContext-lxWo-jIX.js} +1 -1
  28. package/dist/public/assets/{EditorModeToggle-Nq_bPbVL.js → EditorModeToggle-txU-peDb.js} +1 -1
  29. package/dist/public/assets/{EnableSyncConfirmDialog-N-3Oe5uz.js → EnableSyncConfirmDialog-CP-AFV9K.js} +1 -1
  30. package/dist/public/assets/{ExcalidrawDocEditor-C-NOBDVO.js → ExcalidrawDocEditor-Cstpu2_d.js} +1 -1
  31. package/dist/public/assets/FeedbackForm-E4Q8vBaR.js +1 -0
  32. package/dist/public/assets/{ImportSkillDialog-BASlWroD.js → ImportSkillDialog-5TJ-bV4O.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-BL1ZjbK7.js → LintConfigEditor-BpZOqNp4.js} +1 -1
  34. package/dist/public/assets/ManagedArtifactProperties-Biz5eD2a.js +1 -0
  35. package/dist/public/assets/{ManagedArtifactProperties-E5_ddR_p.js → ManagedArtifactProperties-Kaq-aeZC.js} +1 -1
  36. package/dist/public/assets/{MermaidDocEditor-DE4hSQJD.js → MermaidDocEditor-S6EkQTtg.js} +1 -1
  37. package/dist/public/assets/{PropertyDisplayRow-B3v_6w4O.js → PropertyDisplayRow-B4v4jTNF.js} +1 -1
  38. package/dist/public/assets/{SchemaConfigEditor-DlZbi0BH.js → SchemaConfigEditor-CETZMgsw.js} +1 -1
  39. package/dist/public/assets/{SessionsHost-Df5IVb6O.js → SessionsHost-COCtd6o1.js} +2 -2
  40. package/dist/public/assets/{SettingsDialogBody-BOCtv6zl.js → SettingsDialogBody-CcRSiycI.js} +1 -1
  41. package/dist/public/assets/{ShareReceiveMissDialog-CrjCM6hU.js → ShareReceiveMissDialog-BjdTmTYS.js} +1 -1
  42. package/dist/public/assets/{SkillInstallMenu-CVK9zId1.js → SkillInstallMenu-WFsTLGd_.js} +1 -1
  43. package/dist/public/assets/{SkillToolbarControls-CMvIOhEL.js → SkillToolbarControls-BnFTgfQe.js} +1 -1
  44. package/dist/public/assets/{SourceEditor-C74huF53.js → SourceEditor-DPQ2zSrD.js} +1 -1
  45. package/dist/public/assets/{TerminalWindowApp-BusqUG6y.js → TerminalWindowApp-D81J8emi.js} +1 -1
  46. package/dist/public/assets/{TextDocEditor-LT7YyAwm.js → TextDocEditor-CqczBIHK.js} +1 -1
  47. package/dist/public/assets/{ThreadView-CMGgpD7W.js → ThreadView-DfQx3701.js} +2 -2
  48. package/dist/public/assets/{TimelineDiffPane-Bv8dQirf.js → TimelineDiffPane-Dn6JCVyO.js} +1 -1
  49. package/dist/public/assets/{agent-diff-store-Cle15UKh.js → agent-diff-store-CpmA3--m.js} +1 -1
  50. package/dist/public/assets/{auth-state-cache-qvH-oSfq.js → auth-state-cache-vp_V8EAT.js} +1 -1
  51. package/dist/public/assets/{comment-chips-vgbpHTuL.js → comment-chips-CJc_efRz.js} +1 -1
  52. package/dist/public/assets/{config-provider-Ck1DNDm7.js → config-provider-BQeo1rKk.js} +3 -3
  53. package/dist/public/assets/{doc-undo-manager-VvINx_vq.js → doc-undo-manager-C6JcFJSX.js} +1 -1
  54. package/dist/public/assets/globals-_QjAtVtE.css +1 -0
  55. package/dist/public/assets/i18n-DM0BEdRu.js +1 -0
  56. package/dist/public/assets/{index-IpcP5FTX.js → index-B53eHRq2.js} +7 -7
  57. package/dist/public/assets/{messages-Bx4IehS7.js → messages-B-oO73eg.js} +1 -1
  58. package/dist/public/assets/{messages-c4jjA_8H.js → messages-Bg2HaNYA.js} +1 -1
  59. package/dist/public/assets/{messages-DGVl_E7x.js → messages-BiprhPpU.js} +1 -1
  60. package/dist/public/assets/{messages-CUzLexij.js → messages-BqoENAsj.js} +1 -1
  61. package/dist/public/assets/{messages-CR_I7Cp3.js → messages-BxQHRPNQ.js} +1 -1
  62. package/dist/public/assets/{messages-Bms9ZCX3.js → messages-BxQj38iM.js} +1 -1
  63. package/dist/public/assets/{messages-CX2LIRPQ.js → messages-CmyAC5iB.js} +1 -1
  64. package/dist/public/assets/{messages-BvsAGBeC.js → messages-CxtA76-S.js} +1 -1
  65. package/dist/public/assets/{messages-GcLNaJaR.js → messages-FlRc5cWj.js} +1 -1
  66. package/dist/public/assets/{messages-BjR7N346.js → messages-W23UWkLV.js} +1 -1
  67. package/dist/public/assets/{messages-C3zAHKSk.js → messages-YdP7RJ5x.js} +1 -1
  68. package/dist/public/assets/{messages-zMV5QHq9.js → messages-jHGaUnYF.js} +1 -1
  69. package/dist/public/assets/{pending-receive-nav-store-X1voDf8F.js → pending-receive-nav-store-BqDvv-YD.js} +1 -1
  70. package/dist/public/assets/{progress-tXfeh49A.js → progress-qgBnDfAe.js} +1 -1
  71. package/dist/public/assets/{selection-context-VgoGxndZ.js → selection-context-h5CTJIN3.js} +1 -1
  72. package/dist/public/assets/{src-_s2f2_6g.js → src-Cn36aoiu.js} +1 -1
  73. package/dist/public/assets/{typing-burst-detector-BIDnBCHc.js → typing-burst-detector-CS7W7tHL.js} +1 -1
  74. package/dist/public/assets/uninstall-_xLJMVOG.js +1 -0
  75. package/dist/public/assets/{use-activity-panel-0Kzpvkwn.js → use-activity-panel-Bpfx38V_.js} +1 -1
  76. package/dist/public/assets/{use-open-skill-CCmJFvMI.js → use-open-skill-nfPlyj-n.js} +1 -1
  77. package/dist/public/assets/{use-terminal-enabled-BlfoUmdn.js → use-terminal-enabled-TCwFmXL1.js} +1 -1
  78. package/dist/public/assets/{use-timeline-entry-diff-BUFMqeVp.js → use-timeline-entry-diff-CdGbaZQg.js} +1 -1
  79. package/dist/public/index.html +22 -22
  80. package/dist/public/uninstall.html +5 -5
  81. package/dist/registry-probes-D2kUXGAq.mjs +17 -0
  82. package/dist/removal-file-path-fM0ywRil.mjs +1 -0
  83. package/dist/{repair-launch-json-I0JPbY-j.mjs → repair-launch-json-BKo3Lz3S.mjs} +1 -1
  84. package/dist/repair-mcp-configs-yh6okVpv.mjs +1 -0
  85. package/dist/src-DvVUm3ha.mjs +11 -0
  86. package/dist/src-Pb0YKsZP.mjs +1 -0
  87. package/dist/start-Bh73EAYz.mjs +5 -0
  88. package/dist/start-Db5WX93d.mjs +1 -0
  89. package/package.json +7 -5
  90. package/dist/constants-C2Waxo4E.mjs +0 -1
  91. package/dist/init-AV62II7K.mjs +0 -1
  92. package/dist/launch-json-removal-DOsPqTe0.mjs +0 -1
  93. package/dist/loader-BJKo02P9.mjs +0 -1
  94. package/dist/preview-BFGhI49k.mjs +0 -1
  95. package/dist/public/assets/FeedbackForm-Cbz8L9V-.js +0 -1
  96. package/dist/public/assets/ManagedArtifactProperties-1Jje2JUZ.js +0 -1
  97. package/dist/public/assets/globals-D927wlz4.css +0 -1
  98. package/dist/public/assets/i18n-LLIw89QS.js +0 -1
  99. package/dist/public/assets/uninstall-BPhdiudT.js +0 -1
  100. package/dist/registry-probes-B_UapTQA.mjs +0 -13
  101. package/dist/repair-mcp-configs-CHDcjBGn.mjs +0 -1
  102. package/dist/src-BVPWIiic.mjs +0 -11
  103. package/dist/src-e37AQ3jI.mjs +0 -1
  104. package/dist/start-CV9e5XLw.mjs +0 -5
  105. package/dist/start-DtlPjkSc.mjs +0 -1
  106. /package/dist/public/assets/{globals-BoP7p4Dy.js → globals-BeDeKpJB.js} +0 -0
@@ -1 +0,0 @@
1
- import"./dist-CGNkoXKB.js";import{t as e}from"./dist-Cr4-nBVI.js";import{t}from"./messages-BjR7N346.js";e.load(`en`,t.messages),e.activate(`en`);
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./globals-BoP7p4Dy.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as a,t as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./utils-CPqDy6Hr.js";import{t as l}from"./button-Cym3gapE.js";import{t as u}from"./checkbox-Crs_F_Np.js";import{t as d}from"./label-D-K3fWtj.js";import{n as f,t as p}from"./radio-group-npdxiS6E.js";import{on as m,sn as h}from"./dist-CGNkoXKB.js";import{t as g}from"./dist-Cr4-nBVI.js";import{t as _}from"./check-BzfGb3KU.js";import{t as v}from"./spinner-Bp2_BYkl.js";import{t as y}from"./input-BJ0fEcsi.js";import"./i18n-LLIw89QS.js";import{t as b}from"./badge-C8hrUpuH.js";import{t as x}from"./textarea-Cqj1jsXK.js";var S=e(r(),1),C=t(),w=s();async function T(){let e=typeof window>`u`?void 0:window.okUninstall;if(e===void 0)return null;try{let t=await e.ready();return t.kind===`screen`?t.screen:null}catch{return null}}function E(e){let t=typeof window>`u`?void 0:window.okUninstall;t!==void 0&&t.send(e).catch(()=>void 0)}var D=n();function O(e){let t=(0,w.c)(6),{items:n}=e,r;if(t[0]!==n){let e;t[2]===n.length?e=t[3]:(e=(e,t)=>(0,D.jsxs)(`li`,{className:`relative pb-5 pl-[30px] last:pb-1`,children:[t<n.length-1&&(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-[22px] bottom-0.5 left-[9px] w-0.5 bg-border`}),(0,D.jsx)(`span`,{"aria-hidden":`true`,className:c(`absolute top-px left-0 inline-flex size-5 items-center justify-center rounded-full`,e.done?`bg-primary/15 text-primary`:`border-[1.5px] border-muted-foreground/50`),children:e.done&&(0,D.jsx)(_,{className:`size-3`})}),(0,D.jsx)(`span`,{className:`sr-only`,children:e.done?(0,D.jsx)(i,{id:`clJ3qM`}):(0,D.jsx)(i,{id:`yU_9ur`})}),(0,D.jsxs)(`span`,{className:`block`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:e.label}),e.detail!==void 0&&(0,D.jsx)(`span`,{className:`mt-0.5 block text-muted-foreground leading-snug`,children:e.detail})]})]},e.label),t[2]=n.length,t[3]=e),r=n.map(e),t[0]=n,t[1]=r}else r=t[1];let a;return t[4]===r?a=t[5]:(a=(0,D.jsx)(`ol`,{className:`mb-1.5`,children:r}),t[4]=r,t[5]=a),a}function k(e){let t=(0,w.c)(49),{notice:n,onConfirm:r,onCancel:i,onRevealLog:o}=e,{_:s}=a(),c=(0,S.useId)(),u=(0,S.useId)(),d=n.cancelLabel!==void 0,f,p;t[0]!==d||t[1]!==i||t[2]!==r?(f=()=>{let e=e=>{e.key===`Escape`&&(d?i():r())};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},p=[d,i,r],t[0]=d,t[1]=i,t[2]=r,t[3]=f,t[4]=p):(f=t[3],p=t[4]),(0,S.useEffect)(f,p);let m;t[5]!==n.title||t[6]!==c?(m=(0,D.jsx)(`h1`,{id:c,className:`font-medium text-base leading-none`,children:n.title}),t[5]=n.title,t[6]=c,t[7]=m):m=t[7];let h;t[8]===n.subtitle?h=t[9]:(h=n.subtitle!==void 0&&(0,D.jsx)(`p`,{className:`text-muted-foreground text-sm leading-snug`,children:n.subtitle}),t[8]=n.subtitle,t[9]=h);let g;t[10]!==m||t[11]!==h?(g=(0,D.jsxs)(`header`,{className:`shrink-0 space-y-4 px-6 pt-5 pb-3.5`,children:[m,h]}),t[10]=m,t[11]=h,t[12]=g):g=t[12];let _;t[13]===n.paragraphs?_=t[14]:(_=n.paragraphs.map(A),t[13]=n.paragraphs,t[14]=_);let v;t[15]===n.checklist?v=t[16]:(v=n.checklist!==void 0&&(0,D.jsx)(O,{items:n.checklist}),t[15]=n.checklist,t[16]=v);let y;t[17]!==s||t[18]!==n.log?(y=n.log!==void 0&&(0,D.jsx)(`section`,{"aria-label":s({id:`Oi56Cu`}),tabIndex:0,className:`subtle-scrollbar mt-0.5 mb-2.5 min-h-20 flex-1 overflow-auto rounded-lg border border-border border-dotted bg-muted/40 px-3 py-2.5 focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,children:(0,D.jsx)(`pre`,{className:`select-text whitespace-pre-wrap font-mono text-xs leading-relaxed wrap-anywhere`,children:n.log})}),t[17]=s,t[18]=n.log,t[19]=y):y=t[19];let b;t[20]===n.footnote?b=t[21]:(b=n.footnote!==void 0&&(0,D.jsx)(`p`,{className:`select-text text-muted-foreground text-xs wrap-anywhere`,children:n.footnote}),t[20]=n.footnote,t[21]=b);let x;t[22]!==n.logRevealLabel||t[23]!==o?(x=n.logRevealLabel!==void 0&&(0,D.jsx)(`p`,{className:`mt-0.5`,children:(0,D.jsx)(l,{type:`button`,variant:`link-muted`,size:`xs`,className:`h-auto px-0 underline underline-offset-2`,onClick:o,children:n.logRevealLabel})}),t[22]=n.logRevealLabel,t[23]=o,t[24]=x):x=t[24];let C;t[25]!==u||t[26]!==x||t[27]!==_||t[28]!==v||t[29]!==y||t[30]!==b?(C=(0,D.jsxs)(`div`,{id:u,className:`flex min-h-0 flex-1 flex-col px-6 pt-1 pb-4 text-sm`,children:[_,v,y,b,x]}),t[25]=u,t[26]=x,t[27]=_,t[28]=v,t[29]=y,t[30]=b,t[31]=C):C=t[31];let T;t[32]!==n.cancelLabel||t[33]!==i?(T=n.cancelLabel!==void 0&&(0,D.jsx)(l,{type:`button`,variant:`outline-mono`,autoFocus:!0,onClick:i,children:n.cancelLabel}),t[32]=n.cancelLabel,t[33]=i,t[34]=T):T=t[34];let E=n.danger===!0?`destructive`:`default`,k=!d,j;t[35]!==n.confirmLabel||t[36]!==r||t[37]!==E||t[38]!==k?(j=(0,D.jsx)(l,{type:`button`,variant:E,autoFocus:k,onClick:r,children:n.confirmLabel}),t[35]=n.confirmLabel,t[36]=r,t[37]=E,t[38]=k,t[39]=j):j=t[39];let M;t[40]!==T||t[41]!==j?(M=(0,D.jsxs)(`footer`,{className:`flex items-center justify-end gap-2.5 border-border border-t bg-muted/50 px-6 pt-3.5 pb-4`,children:[T,j]}),t[40]=T,t[41]=j,t[42]=M):M=t[42];let N;return t[43]!==u||t[44]!==C||t[45]!==M||t[46]!==g||t[47]!==c?(N=(0,D.jsxs)(`div`,{role:`alertdialog`,"aria-labelledby":c,"aria-describedby":u,className:`flex h-dvh flex-col bg-background text-foreground`,children:[g,C,M]}),t[43]=u,t[44]=C,t[45]=M,t[46]=g,t[47]=c,t[48]=N):N=t[48],N}function A(e){return(0,D.jsx)(`p`,{className:`mb-2.5 leading-normal`,children:e},e)}function j(e){return e.open||e.running?`active`:e.recent?`recent`:null}function M(e){return e.split(`/`).filter(Boolean).at(-1)??e}function N(e){let t=(0,w.c)(9),{status:n}=e,{_:r}=a(),i;t[0]===r?i=t[1]:(i=r({id:`s_ereB`}),t[0]=r,t[1]=i);let o;t[2]===r?o=t[3]:(o=r({id:`_2cM9E`}),t[2]=r,t[3]=o);let s;t[4]!==i||t[5]!==o?(s={active:i,recent:o},t[4]=i,t[5]=o,t[6]=s):s=t[6];let c=s[n],l;return t[7]===c?l=t[8]:(l=(0,D.jsx)(b,{variant:`secondary`,className:`rounded-sm text-muted-foreground`,children:c}),t[7]=c,t[8]=l),l}function P(e){let t=(0,w.c)(28),{project:n,checked:r,onCheckedChange:i}=e,{_:o}=a(),s=(0,S.useId)(),c;t[0]===n?c=t[1]:(c=j(n),t[0]=n,t[1]=c);let l=c,f;t[2]===i?f=t[3]:(f=e=>i(e===!0),t[2]=i,t[3]=f);let p;t[4]!==o||t[5]!==n.path?(p=o({id:`CHfFN_`,values:{0:n.path}}),t[4]=o,t[5]=n.path,t[6]=p):p=t[6];let m;t[7]!==s||t[8]!==r||t[9]!==f||t[10]!==p?(m=(0,D.jsx)(u,{id:s,className:`mt-0.5`,checked:r,onCheckedChange:f,"aria-label":p}),t[7]=s,t[8]=r,t[9]=f,t[10]=p,t[11]=m):m=t[11];let h;t[12]===n.path?h=t[13]:(h=M(n.path),t[12]=n.path,t[13]=h);let g;t[14]===h?g=t[15]:(g=(0,D.jsx)(`span`,{className:`w-full truncate font-medium text-sm`,children:h}),t[14]=h,t[15]=g);let _;t[16]===n.path?_=t[17]:(_=(0,D.jsx)(`span`,{className:`w-full select-text break-words text-muted-foreground text-xs`,children:n.path}),t[16]=n.path,t[17]=_);let v;t[18]!==s||t[19]!==g||t[20]!==_?(v=(0,D.jsxs)(d,{htmlFor:s,className:`min-w-0 flex-col items-start gap-0.5 font-normal`,children:[g,_]}),t[18]=s,t[19]=g,t[20]=_,t[21]=v):v=t[21];let y;t[22]===l?y=t[23]:(y=l!==null&&(0,D.jsx)(`div`,{className:`flex justify-end max-sm:col-start-2 max-sm:justify-start`,children:(0,D.jsx)(N,{status:l})}),t[22]=l,t[23]=y);let b;return t[24]!==m||t[25]!==v||t[26]!==y?(b=(0,D.jsxs)(`div`,{className:`grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2.5 border-border/60 border-b px-3 py-2.5 last:border-b-0 hover:bg-accent/40 max-sm:grid-cols-[auto_minmax(0,1fr)]`,children:[m,v,y]}),t[24]=m,t[25]=v,t[26]=y,t[27]=b):b=t[27],b}function F(e){let t=(0,w.c)(45),{projects:n,onConfirm:r,onCancel:o}=e,{_:s}=a(),[c,f]=(0,S.useState)(ne),p=(0,S.useId)(),m=(0,S.useId)(),h=(0,S.useId)(),g=n.length>0&&c.size===n.length?!0:c.size>0?`indeterminate`:!1,_;t[0]===n?_=t[1]:(_=e=>f(e?new Set(n.map(I)):new Set),t[0]=n,t[1]=_);let v=_,y,b;t[2]!==o||t[3]!==n?(y=()=>{let e=e=>{if(e.key===`Escape`){o();return}(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`a`&&(e.preventDefault(),f(new Set(n.map(te))))};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},b=[o,n],t[2]=o,t[3]=n,t[4]=y,t[5]=b):(y=t[4],b=t[5]),(0,S.useEffect)(y,b);let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,D.jsx)(i,{id:`PrVaZo`}),t[6]=x):x=t[6];let C;t[7]===p?C=t[8]:(C=(0,D.jsx)(`h1`,{id:p,className:`font-medium leading-none text-base`,children:x}),t[7]=p,t[8]=C);let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,D.jsx)(i,{id:`keop3U`}),t[9]=T):T=t[9];let E;t[10]===m?E=t[11]:(E=(0,D.jsx)(`p`,{id:m,className:`text-sm text-muted-foreground`,children:T}),t[10]=m,t[11]=E);let O;t[12]!==C||t[13]!==E?(O=(0,D.jsxs)(`header`,{className:`shrink-0 px-6 pt-5 pb-3.5 space-y-4`,children:[C,E]}),t[12]=C,t[13]=E,t[14]=O):O=t[14];let k;t[15]===s?k=t[16]:(k=s({id:`QySH4I`}),t[15]=s,t[16]=k);let A;t[17]!==s||t[18]!==n||t[19]!==h||t[20]!==g||t[21]!==c||t[22]!==v?(A=n.length===0?(0,D.jsx)(`div`,{className:`rounded-lg border border-border p-4`,children:(0,D.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:(0,D.jsx)(i,{id:`bKt9Jk`})})}):(0,D.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-border`,children:[(0,D.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5 border-border border-b px-3 py-2.5 bg-muted/30`,children:[(0,D.jsx)(u,{id:h,checked:g,onCheckedChange:e=>v(e===!0)}),(0,D.jsx)(d,{htmlFor:h,className:`flex-1 font-medium text-sm`,children:(0,D.jsx)(i,{id:`wgNoIs`})}),(0,D.jsxs)(`span`,{role:`status`,"aria-label":s({id:`nsUDL8`,values:{0:c.size,1:n.length}}),className:`text-muted-foreground text-xs tabular-nums`,children:[c.size,` / `,n.length]})]}),(0,D.jsx)(`div`,{className:`subtle-scrollbar min-h-0 flex-1 overflow-y-scroll [scrollbar-gutter:stable]`,children:n.map((e,t)=>(0,D.jsx)(P,{project:e,checked:c.has(t),onCheckedChange:e=>{f(n=>{let r=new Set(n);return e?r.add(t):r.delete(t),r})}},e.path))})]}),t[17]=s,t[18]=n,t[19]=h,t[20]=g,t[21]=c,t[22]=v,t[23]=A):A=t[23];let j;t[24]!==A||t[25]!==k?(j=(0,D.jsx)(`section`,{"aria-label":k,className:`flex min-h-0 flex-1 flex-col px-6 py-3.5`,children:A}),t[24]=A,t[25]=k,t[26]=j):j=t[26];let M;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,D.jsx)(i,{id:`dEgA5A`}),t[27]=M):M=t[27];let N;t[28]===o?N=t[29]:(N=(0,D.jsx)(l,{type:`button`,variant:`outline-mono`,autoFocus:!0,onClick:o,children:M}),t[28]=o,t[29]=N);let F;t[30]!==r||t[31]!==c?(F=()=>r([...c].sort(ee)),t[30]=r,t[31]=c,t[32]=F):F=t[32];let L;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,D.jsx)(i,{id:`J7nMqi`}),t[33]=L):L=t[33];let R;t[34]===F?R=t[35]:(R=(0,D.jsx)(l,{type:`button`,variant:`destructive`,onClick:F,children:L}),t[34]=F,t[35]=R);let z;t[36]!==N||t[37]!==R?(z=(0,D.jsxs)(`footer`,{className:`flex items-center justify-end gap-2.5 border-border border-t bg-muted/50 px-6 pt-3.5 pb-4`,children:[N,R]}),t[36]=N,t[37]=R,t[38]=z):z=t[38];let B;return t[39]!==m||t[40]!==j||t[41]!==z||t[42]!==O||t[43]!==p?(B=(0,D.jsxs)(`div`,{role:`dialog`,"aria-labelledby":p,"aria-describedby":m,className:`flex h-dvh flex-col overflow-hidden bg-background text-foreground`,children:[O,j,z]}),t[39]=m,t[40]=j,t[41]=z,t[42]=O,t[43]=p,t[44]=B):B=t[44],B}function ee(e,t){return e-t}function te(e,t){return t}function I(e,t){return t}function ne(){return new Set}function L(){let e=(0,w.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,D.jsx)(v,{"aria-hidden":`true`,className:`mx-auto mb-4 size-8 text-primary`}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,D.jsx)(`h1`,{className:`mb-2 font-medium text-base leading-none`,children:(0,D.jsx)(i,{id:`j2229h`})}),e[1]=n):n=e[1];let r;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,D.jsx)(`main`,{className:`grid h-dvh place-items-center bg-background text-foreground`,children:(0,D.jsxs)(`div`,{role:`status`,className:`max-w-vw px-7 py-7 text-center`,children:[t,n,(0,D.jsx)(`p`,{className:`text-muted-foreground text-sm leading-relaxed`,children:(0,D.jsx)(i,{id:`kCjkGY`})})]})}),e[2]=r):r=e[2],r}function R(){let{_:e}=a();return{"workflow-fit":e({id:`5vAI6Z`}),"missing-feature":e({id:`cH0dkG`}),"hard-to-start":e({id:`uoJF_D`}),unreliable:e({id:`WGMoTY`}),"switched-tool":e({id:`jO18NZ`}),"one-off":e({id:`S3qu11`}),other:e({id:`aQyGJc`})}}function z(e){let t=(0,w.c)(86),{onSend:n,onSkip:r}=e,{_:o}=a(),s=R(),[c,g]=(0,S.useState)(``),[_,v]=(0,S.useState)(``),[b,C]=(0,S.useState)(!1),[T,E]=(0,S.useState)(``),O=(0,S.useRef)(null),k=(0,S.useId)(),A=(0,S.useId)(),j=(0,S.useId)(),M=(0,S.useId)(),N=(0,S.useId)(),P=(0,S.useId)(),F,ee;t[0]===b?(F=t[1],ee=t[2]):(F=()=>{b&&O.current?.focus()},ee=[b],t[0]=b,t[1]=F,t[2]=ee),(0,S.useEffect)(F,ee);let te;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,D.jsx)(i,{id:`ElyuiT`}),t[3]=te):te=t[3];let I;t[4]===k?I=t[5]:(I=(0,D.jsx)(`h1`,{id:k,className:`font-medium leading-none text-base`,children:te}),t[4]=k,t[5]=I);let ne;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,D.jsx)(i,{id:`ZDOq9A`}),t[6]=ne):ne=t[6];let L;t[7]===A?L=t[8]:(L=(0,D.jsx)(`p`,{id:A,className:`text-muted-foreground text-sm`,children:ne}),t[7]=A,t[8]=L);let z;t[9]!==I||t[10]!==L?(z=(0,D.jsxs)(`header`,{className:`px-6 pt-5 pb-3.5 space-y-4`,children:[I,L]}),t[9]=I,t[10]=L,t[11]=z):z=t[11];let B;t[12]!==T||t[13]!==b||t[14]!==_||t[15]!==n||t[16]!==c?(B=e=>{e.preventDefault();let t=_.trim(),r=b?T.trim():``;n({...c===``?{}:{reason:c},...t===``?{}:{note:t},...r===``?{}:{email:r}})},t[12]=T,t[13]=b,t[14]=_,t[15]=n,t[16]=c,t[17]=B):B=t[17];let re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,D.jsx)(i,{id:`oxdGJn`}),t[18]=re):re=t[18];let V;t[19]===j?V=t[20]:(V=(0,D.jsx)(`p`,{id:j,className:`mb-2 font-medium text-sm`,children:re}),t[19]=j,t[20]=V);let H;t[21]!==j||t[22]!==s?(H=h.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md px-1 py-1`,children:[(0,D.jsx)(f,{id:`${j}-${e.value}`,value:e.value}),(0,D.jsx)(d,{htmlFor:`${j}-${e.value}`,className:`font-normal text-sm leading-snug`,children:s[e.value]})]},e.value)),t[21]=j,t[22]=s,t[23]=H):H=t[23];let U;t[24]!==j||t[25]!==c||t[26]!==H?(U=(0,D.jsx)(p,{"aria-labelledby":j,value:c,onValueChange:g,children:H}),t[24]=j,t[25]=c,t[26]=H,t[27]=U):U=t[27];let W;t[28]!==V||t[29]!==U?(W=(0,D.jsxs)(`div`,{className:`mb-6`,children:[V,U]}),t[28]=V,t[29]=U,t[30]=W):W=t[30];let ie;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,D.jsx)(i,{id:`axQ1h6`}),t[31]=ie):ie=t[31];let G;t[32]===M?G=t[33]:(G=(0,D.jsx)(d,{htmlFor:M,className:`mb-2 font-medium text-sm`,children:ie}),t[32]=M,t[33]=G);let K;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>v(e.target.value),t[34]=K):K=t[34];let q;t[35]!==_||t[36]!==M?(q=(0,D.jsx)(x,{id:M,rows:3,maxLength:m,value:_,onChange:K}),t[35]=_,t[36]=M,t[37]=q):q=t[37];let J;t[38]!==G||t[39]!==q?(J=(0,D.jsxs)(`div`,{className:`mb-6`,children:[G,q]}),t[38]=G,t[39]=q,t[40]=J):J=t[40];let ae;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(ae=e=>C(e===!0),t[41]=ae):ae=t[41];let Y;t[42]!==b||t[43]!==N?(Y=(0,D.jsx)(u,{id:N,checked:b,onCheckedChange:ae}),t[42]=b,t[43]=N,t[44]=Y):Y=t[44];let oe;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,D.jsx)(i,{id:`xEb24l`}),t[45]=oe):oe=t[45];let X;t[46]===N?X=t[47]:(X=(0,D.jsx)(d,{htmlFor:N,className:`font-medium text-sm`,children:oe}),t[46]=N,t[47]=X);let Z;t[48]!==Y||t[49]!==X?(Z=(0,D.jsxs)(`div`,{className:`mb-2 flex items-center gap-2.5`,children:[Y,X]}),t[48]=Y,t[49]=X,t[50]=Z):Z=t[50];let se=!b,ce;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,D.jsx)(i,{id:`ATGYL1`}),t[51]=ce):ce=t[51];let Q;t[52]===P?Q=t[53]:(Q=(0,D.jsx)(d,{htmlFor:P,className:`mb-2 font-medium text-sm sr-only`,children:ce}),t[52]=P,t[53]=Q);let le;t[54]===o?le=t[55]:(le=o({id:`JHf6qZ`}),t[54]=o,t[55]=le);let ue=!b,de;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(de=e=>E(e.target.value),t[56]=de):de=t[56];let fe;t[57]!==T||t[58]!==P||t[59]!==le||t[60]!==ue?(fe=(0,D.jsx)(y,{id:P,ref:O,type:`email`,maxLength:320,autoComplete:`email`,spellCheck:!1,placeholder:le,disabled:ue,value:T,onChange:de}),t[57]=T,t[58]=P,t[59]=le,t[60]=ue,t[61]=fe):fe=t[61];let $;t[62]!==se||t[63]!==Q||t[64]!==fe?($=(0,D.jsxs)(`div`,{className:`mb-6`,hidden:se,children:[Q,fe]}),t[62]=se,t[63]=Q,t[64]=fe,t[65]=$):$=t[65];let pe;t[66]!==W||t[67]!==J||t[68]!==Z||t[69]!==$?(pe=(0,D.jsxs)(`div`,{className:`subtle-scrollbar min-h-0 flex-1 overflow-y-auto px-6 pt-1 pb-4`,children:[W,J,Z,$]}),t[66]=W,t[67]=J,t[68]=Z,t[69]=$,t[70]=pe):pe=t[70];let me;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,D.jsx)(i,{id:`6Uau97`}),t[71]=me):me=t[71];let he;t[72]===r?he=t[73]:(he=(0,D.jsx)(l,{type:`button`,variant:`outline-mono`,autoFocus:!0,onClick:r,children:me}),t[72]=r,t[73]=he);let ge;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,D.jsx)(l,{type:`submit`,children:(0,D.jsx)(i,{id:`xMsnTe`})}),t[74]=ge):ge=t[74];let _e;t[75]===he?_e=t[76]:(_e=(0,D.jsxs)(`footer`,{className:`flex items-center justify-end gap-2.5 border-border border-t bg-muted/50 px-6 pt-3.5 pb-4`,children:[he,ge]}),t[75]=he,t[76]=_e);let ve;t[77]!==pe||t[78]!==_e||t[79]!==B?(ve=(0,D.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:B,children:[pe,_e]}),t[77]=pe,t[78]=_e,t[79]=B,t[80]=ve):ve=t[80];let ye;return t[81]!==A||t[82]!==ve||t[83]!==z||t[84]!==k?(ye=(0,D.jsxs)(`div`,{role:`dialog`,"aria-labelledby":k,"aria-describedby":A,className:`flex h-dvh flex-col bg-background text-foreground`,children:[z,ve]}),t[81]=A,t[82]=ve,t[83]=z,t[84]=k,t[85]=ye):ye=t[85],ye}function B(){let e=(0,w.c)(9),[t,n]=(0,S.useState)(null),r,a;if(e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=!0;return T().then(t=>{e&&n(t)}),()=>{e=!1}},a=[],e[0]=r,e[1]=a):(r=e[0],a=e[1]),(0,S.useEffect)(r,a),t!==null)switch(t.kind){case`picker`:{let n;return e[2]===t.projects?n=e[3]:(n=(0,D.jsx)(F,{projects:t.projects,onConfirm:G,onCancel:ie}),e[2]=t.projects,e[3]=n),n}case`survey`:{let t;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,D.jsx)(z,{onSend:W,onSkip:U}),e[4]=t):t=e[4],t}case`progress`:{let t;return e[5]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,D.jsx)(L,{}),e[5]=t):t=e[5],t}case`notice`:{let n;return e[6]===t.notice?n=e[7]:(n=(0,D.jsx)(k,{notice:t.notice,onConfirm:H,onCancel:V,onRevealLog:re}),e[6]=t.notice,e[7]=n),n}default:return t}let o;return e[8]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,D.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center bg-background p-8 text-foreground`,children:(0,D.jsx)(`p`,{className:`text-center text-muted-foreground text-sm`,children:(0,D.jsx)(i,{id:`tzGWeg`})})}),e[8]=o):o=e[8],o}function re(){return E({kind:`notice-reveal-log`})}function V(){return E({kind:`notice-cancel`})}function H(){return E({kind:`notice-confirm`})}function U(){return E({kind:`survey-skip`})}function W(e){return E({kind:`survey-send`,...e})}function ie(){return E({kind:`picker-cancel`})}function G(e){return E({kind:`picker-confirm`,selectedIndexes:e})}var K=document.getElementById(`root`);if(!K)throw Error(`Root element not found`);(0,C.createRoot)(K).render((0,D.jsx)(S.StrictMode,{children:(0,D.jsx)(o,{i18n:g,children:(0,D.jsx)(B,{})})}));
@@ -1,13 +0,0 @@
1
- import{Gl as e,Gu as t,Uu as n,Vu as r,Wu as i,eu as a,qc as o,qu as s}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{Nn as c,To as l,Vi as u,Xa as ee,do as te,m as d,wo as ne,yo as f}from"./dist-B_lhaeFJ.mjs";import{$ as p,A as m,C as re,D as h,K as g,O as _,P as ie,Q as ae,W as oe,Y as se,Z as ce,at as le,d as ue,et as v,f as de,it as y,k as fe,o as b,st as pe,tt as me,v as he,w as x,x as ge,y as _e}from"./init-CoCCZEvS.mjs";import{t as ve}from"./is-object-BGze3w87.mjs";import{spawn as S}from"node:child_process";import{basename as ye,dirname as C,join as w,resolve as be,win32 as xe}from"node:path";import{existsSync as T,mkdirSync as E,readFileSync as D,readdirSync as Se,rmSync as O,statSync as Ce,writeFileSync as we}from"node:fs";import{homedir as k}from"node:os";var A=e();const j=`open-knowledge`;function M(e){try{e()}catch{}}var N=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(j,e).getPassword()}catch(t){return M(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return M(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return M(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(j,e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(j,e).deletePassword()}catch{}}},P=class{backend=`file`;authFile;constructor(e){this.authFile=e??w(k(),`.ok`,`auth.yml`)}read(){if(!T(this.authFile))return{};try{let e=D(this.authFile,`utf-8`);return(0,A.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=C(this.authFile);T(t)||E(t,{recursive:!0,mode:448}),we(this.authFile,(0,A.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},Te=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ~/.ok/auth.yml to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function F(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(j,`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
2
- `),M(()=>t?.onBackendSelected?.({backend:`keyring`})),new Te(new N(t?.onKeychainRead),new P(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (~/.ok/auth.yml) — OS keychain unavailable: ${r}\n`),M(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new P(e)}}function I(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (~/.ok/auth.yml)\n`),r(new P(e))},n)});try{return await Promise.race([F(e),r])}catch{return new P(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function Ee(e){let t=I(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token,login:n.login}}}}function De(e){let t=I(e);return{backend:`file`,async get(e){return(await t()).get(e)},async set(e,n,r,i){return(await t()).set(e,n,r,i)},async clear(e){return(await t()).clear(e)}}}async function Oe(e,t){let n=[],r=new P(t);await r.get(e)!=null&&(await r.clear(e),n.push(`file`));let i;try{let{Entry:t}=await import(`@napi-rs/keyring`);new t(j,`__probe__`);let r,a=await new N(e=>{e.kind===`read-error`&&(r=e.error??`read-error`)}).get(e);if(r!==void 0)i=r;else if(a!=null)try{new t(j,e).deletePassword(),n.push(`keychain`)}catch(e){i=e instanceof Error?e.name:`delete-error`}}catch{}return{touched:n,keychainError:i}}function ke(e){let t={...e};return delete t.ELECTRON_RUN_AS_NODE,t}function L(e){let t=e?.code;return t===`ENOENT`||t===`EACCES`||t===`EPERM`?{ok:!1,reason:`not-installed`}:{ok:!1,reason:`spawn-error`}}function R(e){return ee({detached:!0,stdio:`ignore`,shell:!1,env:ke(e)})}function z(e,t,n={}){let r=(n.spawn??S)(e,[...t],R(n.env??process.env));return r.unref(),r}function Ae(e,t,n={}){let r=n.spawn??S,i=n.timeoutMs??2e3;return new Promise(a=>{let o=!1,s=e=>{o||(o=!0,a(e))},c=setTimeout(()=>s({ok:!1,reason:`timeout`}),i);try{let i=r(e,[...t],R(n.env??process.env));i.once(`error`,e=>{clearTimeout(c),s(L(e))}),i.once(`spawn`,()=>{clearTimeout(c),s({ok:!0})});try{i.unref()}catch{}}catch(e){clearTimeout(c),s(L(e))}})}const B=`com.inkeep.open-knowledge`,V=`OpenKnowledge.app`,H=`/Applications/${V}`;function je(){return{platform:process.platform,env:process.env,execPath:process.execPath,isTTY:process.stdout.isTTY,statSync:e=>{try{return Ce(e,{throwIfNoEntry:!1})??null}catch{return null}}}}function Me(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`){let t=/(.+?\.app)\/Contents\/MacOS\//.exec(e.execPath);if(t?.[1])return t[1]}if(U(e,H))return H;let t=e.homeDir??k(),n=w(t,`Applications`,V);return U(e,n)?n:null}function U(e,t){return W(e,w(t,`Contents`,`MacOS`,`OpenKnowledge`))}function W(e,t){try{let n=e.statSync(t);return n?typeof n.isFile==`function`&&n.isFile():!1}catch{return!1}}const Ne=[`@inkeepopen-knowledge-desktop`,`OpenKnowledge`];function Pe(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&/\\OpenKnowledge\.exe$/i.test(e.execPath))return e.execPath;let t=e.env.LOCALAPPDATA;if(t)for(let n of Ne){let r=xe.join(t,`Programs`,n,`OpenKnowledge.exe`);if(W(e,r))return r}return null}function Fe(e){if(e.env.ELECTRON_RUN_AS_NODE===`1`&&e.execPath.endsWith(`/openknowledge`))return e.execPath;let t=`/opt/OpenKnowledge/openknowledge`;return W(e,t)?t:null}function Ie(e){if(e.env.OK_FORCE_BROWSER===`1`)return{available:!1,reason:`force-browser`};if(e.platform!==`darwin`&&e.platform!==`win32`&&e.platform!==`linux`)return{available:!1,reason:`unsupported-platform`};let t;try{t=e.platform===`darwin`?Me(e):e.platform===`win32`?Pe(e):Fe(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.platform===`win32`&&e.isTTY===void 0&&!e.env.CI)||e.env.SSH_CONNECTION||e.env.SSH_TTY||e.platform===`linux`&&!e.env.DISPLAY&&!e.env.WAYLAND_DISPLAY?{available:!1,reason:`headless`,bundlePath:t}:{available:!0,reason:`available`,bundlePath:t}:{available:!1,reason:`no-bundle`}}function Le(e,t){let n=e.log??(e=>console.error(e)),r=e.platform??process.platform;if(n("Launching OpenKnowledge desktop (use `ok start` for the browser server, or `OK_FORCE_BROWSER=1` to always skip)"),r===`darwin`){z(`open`,[`-b`,B],{spawn:e.spawn});return}let i=t?.bundlePath;if(!i){n(`Desktop launch skipped: no resolved desktop executable (caller bug).`);return}z(i,[],{spawn:e.spawn})}function Re(e=`no-bundle`){switch(e){case`no-bundle`:return`Desktop app not found (checked the standard install locations for this OS). Install it from https://openknowledge.ai/download, or omit --mode for browser mode.`;case`darwin-only`:case`unsupported-platform`:return`Desktop app is not available on this platform. 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 the desktop install (filesystem error). Check permissions or use --mode=browser.`;case`available`:return`Desktop app appears available but launch dispatch did not fire (caller bug).`}}function G(e,t){let n=be(e),r=t===void 0?y():y({home:t,env:{}});return{cwd:n,bridgePath:g.pi.projectConfigPath?.(n)??``,trustPath:w(r,`trust.json`)}}function K(e,t,n){let r=b(g.pi,e,n,t);if(r.kind===`absent`)return{state:`absent`,text:null};if(r.kind!==`present`)return{state:`unreadable`,text:null};let i=r.entry,a=Array.isArray(i.args)&&typeof i.args[0]==`string`?i.args[0]:null;return p(i)?{state:`own-current`,text:a}:x(i)?{state:`own-stale`,text:a}:{state:`foreign`,text:a}}function q(e,t){let n;try{n=D(e,`utf-8`)}catch(e){let t=e.code;return t===`ENOENT`||t===`ENOTDIR`?{state:`untrusted`,entries:{},trailingNewline:!1}:{state:`unreadable`,entries:null,trailingNewline:!1}}if(n.trim()===``)return{state:`untrusted`,entries:{},trailingNewline:!1};let r;try{r=JSON.parse(n)}catch{return{state:`unreadable`,entries:null,trailingNewline:!1}}return ve(r)?{state:r[t]===!0?`trusted`:`untrusted`,entries:r,trailingNewline:n.endsWith(`
3
- `)}:{state:`unreadable`,entries:null,trailingNewline:!1}}function ze(e,t){let n=G(e,t),r=K(n.cwd,n.bridgePath,t).state,i=q(n.trustPath,n.cwd).state;return{...n,bridge:r,trust:i,bridgeLoadable:(r===`own-current`||r===`own-stale`)&&i===`trusted`,otherExtensions:J(n.bridgePath).names}}function J(e){let t=C(e),n=ye(e);try{return{names:Se(t).filter(e=>e!==n&&e.endsWith(`.ts`)).sort(),verified:!0}}catch(e){let t=e.code;return{names:[],verified:t===`ENOENT`||t===`ENOTDIR`}}}async function Be(e,t={mode:`published`},n){let r=G(e,n),i=K(r.cwd,r.bridgePath,n);if(i.state===`foreign`)return{...r,ok:!1,bridge:`refused-foreign`,trust:`skipped`};if(i.state===`unreadable`)return{...r,ok:!1,bridge:`refused-unreadable`,trust:`skipped`};let a;if(i.state===`absent`)a=`written`;else{let e;try{e=re(t)}catch{e=void 0}a=e!==void 0&&i.text===e?`unchanged`:`refreshed`}if(a!==`unchanged`){let e=_e(g.pi,r.cwd,t,n,r.bridgePath);if(e.action!==`written`&&e.action!==`overwritten`)return{...r,ok:!1,bridge:`failed`,trust:`skipped`,error:e.error??`bridge write ${e.action}`}}let o=await Ve(r.trustPath,r.cwd);return{...r,ok:o.action===`already-trusted`||o.action===`added`,bridge:a,trust:o.action,...o.error===void 0?{}:{error:o.error}}}async function Ve(e,t){try{E(C(e),{recursive:!0})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}let n={action:`added`};try{await ne(`${e}.lock`,async()=>{let r=q(e,t);if(r.state===`trusted`){n.action=`already-trusted`;return}if(r.entries===null){n.action=`refused-unreadable`;return}let i={...r.entries,[t]:!0},a=JSON.stringify(i,null,2)+(r.trailingNewline?`
4
- `:``),o=h(e);f(e,a,o===void 0?void 0:{mode:o}),n.action=`added`})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}return n.action===`refused-unreadable`?{action:`refused-unreadable`,error:`trust store is not a readable JSON object`}:{action:n.action}}function He(e,t){let n=G(e,t),r=J(n.bridgePath);if(!r.verified)return{action:`kept-unverified`,error:`could not read the Pi extensions folder`};if(r.names.length>0)return{action:`kept-shared`};if(!T(n.trustPath))return{action:`not-present`};let i={action:`removed`};try{l(`${n.trustPath}.lock`,()=>{let e=q(n.trustPath,n.cwd);if(e.entries===null){i.action=e.state===`unreadable`?`refused-unreadable`:`not-present`;return}if(!(n.cwd in e.entries)){i.action=`not-present`;return}let t={...e.entries};delete t[n.cwd];let r=JSON.stringify(t,null,2)+(e.trailingNewline?`
5
- `:``),a=h(n.trustPath);f(n.trustPath,r,a===void 0?void 0:{mode:a}),i.action=`removed`})}catch(e){return{action:`failed`,error:e instanceof Error?e.message:String(e)}}return i.action===`refused-unreadable`?{action:`refused-unreadable`,error:`trust store is not a readable JSON object`}:{action:i.action}}function Ue(e){return p(e)||v(e)||x(e)}const Y=10485760;function We(e,t,n,r){let i=b(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!Ue(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);if(e.format===`file`){O(a,{force:!0});let e=He(t,n);return{kind:`removed`,trust:e.action,...e.error===void 0?{}:{trustError:e.error}}}return e.format===`toml`?qe(a,o):e.format===`yaml`?Ke(a,e.topLevelKey,o):Ge(a,e.topLevelKey,e.serverMapSubKey,o)}function Ge(e,t,n,r){let i;try{i=D(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>Y)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=fe(i,he(t,n,r));return o?(f(e,a,{mode:h(e)}),{kind:`removed`}):{kind:`not-present`}}function Ke(e,t,n){let r;try{r=D(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>Y)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,A.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=_(a);a.trim()===``||a.endsWith(`
6
- `)?c.endsWith(`
7
- `)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
8
- `).replace(/\n/g,`\r
9
- `));let u=`${i?``:``}${c}`;return u!==r&&f(e,u,{mode:h(e)}),{kind:`removed`}}function qe(e,t){let n=pe();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=D(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=_(a),s=a.trim()===``||a.endsWith(`
10
- `),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
11
- `)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
12
- `).replace(/\n/g,`\r
13
- `));let u=`${i?``:``}${l}`;return u!==r&&f(e,u,{mode:h(e)}),{kind:`removed`}}function X(e,n){let r=t[e];return r===null?null:w(n,...r.split(`/`),d.discovery,`SKILL.md`)}function Je(e,t){let n=X(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};if(!c(t).some(t=>t.editorId===e))return{editorId:e,label:e,action:`skipped-unsupported`,path:n};try{let r=u(`discovery`,{checkDesktop:!0});return m(C(n),t),{editorId:e,label:e,action:ie(r,n),path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function Ye(e){return T(w(e,...`.agents/skills`.split(`/`),d.discovery))?!0:r.some(t=>{let n=X(t,e);return n!==null&&T(C(n))})}function Xe(e,t){let n=X(e,t);if(n===null)return{editorId:e,label:e,action:`skipped-unsupported`,path:``};let r=C(n);try{return T(n)?(m(r,t),O(r,{recursive:!0,force:!0}),{editorId:e,label:e,action:`removed`,path:n}):{editorId:e,label:e,action:`not-present`,path:n}}catch(t){return{editorId:e,label:e,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function Ze(e){return e===`opencode`?me:ae}function Qe(e,t,n){let r=g[e],i=Ze(e),a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=de(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}function Z(e,t,n=[]){let r=T(w(e,d[t]))?`satisfied`:`absent`;return{...r===`satisfied`?{state:r,strictness:[`reclaim-permissive`]}:{state:r},...n.length===0?{}:{sharedWith:n}}}function $e(e,t){let n=oe.flatMap(t=>{let n=e[t];return n===null?[]:[{editor:t,root:n}]}),r=s.filter(e=>e.scope===t).map(e=>({editor:e.editorId,root:o}));return[...n,...r]}function Q(e,t,n,r){let i=te(e,$e(t,r)),a=i.find(e=>e.host===n);if(a===void 0||a.state===`absent`)return[];let o=a.real;return i.filter(e=>e.host!==n&&e.state!==`absent`&&e.real===o).map(e=>e.host)}function et(e,t){let n=(t??k()).replace(/[\\/]+$/,``);if(!n.includes(`\\`))return e.startsWith(`${n}/`)?`~/${e.slice(n.length+1)}`:e;let r=e=>e.replace(/\\/g,`/`),i=r(n),a=r(e);return a.startsWith(`${i}/`)?`~/${a.slice(i.length+1)}`:e}function tt(e,t){let n=g[e];return ge(n,``,t)&&!ue(n,``,t)}function $(e,t,n,r,i){let a=g[e],o;if(i===void 0)try{o=a.configPath(n,r)}catch{return{state:`structural-na`}}else o=i;let s=i===void 0?et(o,r):void 0,c=b(a,n,r,i);switch(c.kind){case`absent`:case`no-entry`:return i===void 0&&tt(e,r)?{state:`structural-na`}:{state:`absent`,path:s};case`decline`:return{state:`unprobed`};case`present`:{let{entry:r}=c,i=[];p(r)&&i.push(`reclaim-permissive`),v(r)&&i.push(`pre-approval-exact`),Ze(e)(r)&&i.push(`injection-functional`);let o=se(a,n);return i.length>0&&(o!==null&&ce(r,o)||t.includes(`pre-approval-exact`)&&i.includes(`reclaim-permissive`)&&!i.includes(`pre-approval-exact`))?{state:`drifted`,strictness:i,path:s}:i.length>0?{state:`satisfied`,strictness:i,path:s}:le(a)?{state:`foreign-replaceable`,path:s}:{state:`foreign`,path:s}}}}function nt(e){let{cwd:r,home:s}=e;return e=>{if(e.pathId===null)return null;let l=a(e.pathId);if(l===null)return null;if(l.kind===`central-skill-store`)return s===void 0?null:Z(w(s,o),`discovery`,Q(s,t,e.agent,`global`));let u=l.editor;switch(l.kind){case`editor-user-skill-root`:{let e=t[u];return e===null||s===void 0?null:c(s).some(e=>e.editorId===u)?Z(w(s,e),`discovery`,Q(s,t,u,`global`)):{state:`structural-na`}}case`editor-project-skill-root`:{let e=i[u];return e===null?null:Z(w(r,e),`project`,Q(r,i,u,`project`))}case`editor-user-config`:return $(u,e.strictness,r,s);case`editor-project-config`:{let t=n[u];return t===null?null:$(u,e.strictness,r,s,w(r,t))}}}}export{F as _,Je as a,ze as c,Ie as d,Le as f,Oe as g,Ae as h,Ye as i,B as l,z as m,Qe as n,We as o,Re as p,Xe as r,Be as s,nt as t,je as u,Ee as v,De as y};
@@ -1 +0,0 @@
1
- import{ga as e}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{$ as t,K as n,W as r,X as i,f as a,y as o}from"./init-CoCCZEvS.mjs";import{homedir as s}from"node:os";function c(e){let{priorCommand:t,priorArgs:n}=l(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function l(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function u(e){let t=e.logger??m,i=e.home??s(),a=[];if(e.reclaimDisableEnv===`1`)return t({event:`mcp-config-repair-skipped`,severity:`info`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of r){let r=n[o],s=d(()=>r.configPath(``,i));if(s!==null&&a.push(f({scope:`user`,editorId:o,target:r,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:t})),r.projectConfigPath){let n=r.projectConfigPath,i=d(()=>n(e.projectDir));i!==null&&a.push(f({scope:`project`,editorId:o,target:r,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:t}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function d(e){try{return e()}catch{return null}}function f(n){let r={scope:n.scope,editorId:n.editorId,configPath:n.configPath},s=a(n.target,n.cwd,n.home,n.configPathOverride);if(s===null)return{...r,outcome:`no-entry`};if(n.target.format===`file`){if(t(s))return{...r,outcome:`canonical`}}else{let t=e(s);if(t.kind===`recognized`&&t.disposition===`keep`){let e=i(s,n.target.buildEntry(n.cwd,{}));if(e.length===0)return{...r,outcome:`canonical`};let t=p(n,r,o(n.target,n.cwd,{mode:`published`,skipAvailabilityCheck:!0,pruneOnly:!0},n.home,n.configPathOverride));return(t.outcome===`repaired`||t.outcome===`canonical`)&&n.logger({event:t.outcome===`repaired`?`mcp-config-repair-pruned`:`mcp-config-repair-prune-unchanged`,severity:t.outcome===`repaired`?`info`:`warn`,scope:n.scope,editorId:n.editorId,configPath:n.configPath,keys:e}),t.outcome===`canonical`?{...r,outcome:`prune-unchanged`}:t}if(t.kind===`declined`&&n.scope===`project`)return n.logger({event:`mcp-config-repair-skipped-foreign`,severity:`info`,scope:n.scope,editorId:n.editorId,configPath:n.configPath,reason:t.reason}),{...r,outcome:`foreign`,reason:t.reason}}return n.logger({...c({scope:n.scope,surface:`cli-repair`,editorId:n.editorId,configPath:n.configPath,priorEntry:s}),severity:`info`}),p(n,r,o(n.target,n.cwd,{mode:`published`,skipAvailabilityCheck:!0},n.home,n.configPathOverride))}function p(e,t,n){if(n.action===`failed`){let r=n.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,severity:`warn`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:r}),{...t,outcome:`write-failed`,error:r}}return n.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,severity:`warn`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:n.declineReason}),{...t,outcome:`declined`,reason:n.declineReason}):n.action===`skipped-flag`?{...t,outcome:`canonical`}:{...t,outcome:`repaired`}}function m(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{l as n,u as repairMcpConfigs,c as t};
@@ -1,11 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{$u as t,Bs as n,Dn as r,Gl as i,In as a,On as o,ac as s,ic as c,lo as l,ns as u,ps as d,sc as ee}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{Co as f,Ji as p,Jn as m,Lr as h,Pn as g,So as _,St as v,Ur as y,Wn as b,Xa as x,Xr as S,Yr as C,Zr as w,bn as T,m as E,mi as D,or as te,pi as O,xo as k}from"./dist-B_lhaeFJ.mjs";import{t as A}from"./yazl-BBz29IQN.mjs";import{ht as j,nt as M,rt as N}from"./init-CoCCZEvS.mjs";import{c as ne}from"./colors-r_owlCuY.mjs";import{l as P}from"./registry-probes-B_UapTQA.mjs";import{t as re}from"./is-object-BGze3w87.mjs";import{n as ie}from"./constants-C2Waxo4E.mjs";import"./loader-B0EV14F-.mjs";import"./preview-BWs_Rq1J.mjs";import{execSync as ae,spawnSync as oe}from"node:child_process";import{basename as F,dirname as I,isAbsolute as se,join as L,relative as R,resolve as z,sep as B}from"node:path";import{closeSync as ce,cpSync as le,createWriteStream as ue,existsSync as V,lstatSync as de,mkdirSync as H,mkdtempSync as fe,openSync as pe,readFileSync as U,readSync as me,readdirSync as W,rmSync as G,rmdirSync as he,statSync as ge,writeFileSync as K}from"node:fs";import{arch as _e,freemem as ve,homedir as q,hostname as ye,platform as be,release as xe,tmpdir as Se,totalmem as Ce,type as we,uptime as Te}from"node:os";import"node:fs/promises";import{createHash as Ee}from"node:crypto";let De;function Oe(){return De}function ke(e,t){if(t!==void 0&&t.length>0)return t;try{return m(e)?.rootPath}catch{return}}function Ae(e){let t=ke(e.cwd,e.configuredProjectName),n=T({name:`cli`,project:t});return De=n,n.info({command:e.command,cwd:e.cwd,project:t},`cli command started`),n}const je=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Me(e,t,n=m){if(e!==void 0&&!je.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Ne=null;function Pe(e){Ne=e}function Fe(){return Ne??process.cwd()}const Ie=`Open Knowledge`;function Le(e={}){let t=e.platformName??process.platform,n=e.productName??`OpenKnowledge`;return M(t).join(N({...e,platformName:t}),n)}function Re(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=M(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`@inkeepopen-knowledge-desktop-updater`)}function ze(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function Be(e){let t=L(e,`state.json`);if(!V(t))return[];let n;try{n=JSON.parse(U(t,`utf-8`))}catch{return[]}return ze(n)??[]}function Ve(e){let t=L(e,`state.json`);if(!V(t))return!1;try{return ze(JSON.parse(U(t,`utf-8`)))!==null}catch{return!1}}const He=8192;function Ue(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function We(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const Ge=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function Ke(e){return e.replace(Ge,`$1"[REDACTED-DEVICE-ID]"`)}function qe(e){return Ke(We(e))}const Je=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function Ye(e){if(typeof e!=`string`)return null;let t=Je.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function Xe(e){let t=pe(e,`r`);try{let e=Buffer.alloc(He),n=0,r=!1;for(;n<He;){let i=me(t,e,n,He-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{ce(t)}}function Ze(e){try{let t=Xe(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:Ye(a)}}catch{return{kind:`unreadable`}}}function Qe(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function $e(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=W(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=L(e,t.name),r;try{r=ge(n).mtimeMs}catch{continue}if(r<i)continue;let c=Ze(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!Qe(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}function J(){return L(q(),`.ok`,`bug-reports`)}function et(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=J(),r=`${t}-bugreport`,i=L(n,`${r}.zip`);for(let e=2;V(i);e+=1)i=L(n,`${r}-${e}.zip`);return i}function tt(e,t){let n=L(e,`.ok`,`config.yml`);if(V(n))try{let e=U(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return V(L(e,`.ok`))?Ee(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function nt(){let e={timestamp:new Date().toISOString(),platform:be(),osType:we(),osRelease:xe(),hostname:`[redacted]`,uptime:Te(),freeMem:ve(),totalMem:Ce(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ae(`sw_vers -productVersion 2>/dev/null`,x({encoding:`utf8`})).trim()}catch{}try{let t=L(__dirname,`..`,`..`,`package.json`);V(t)&&(e.okVersion=JSON.parse(U(t,`utf8`)).version)}catch{}return e}const rt=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function it(e){let t=F(e);return rt.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function at(e,t){return lt(e,t).files}const ot=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function st(e,t=P){let n=L(e,`${t}.ShipIt`);if(!V(n))return[];let r;try{r=W(n)}catch{return[]}return ot.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>L(n,e.entry)))}function ct(e){if(!V(e))return[];try{let t=new Map;for(let n of W(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-r.length):n.slice(0,-5),i=t.get(e);i===void 0?t.set(e,[n]):i.push(n)}return[...t.values()].slice(-25).flat().map(t=>L(e,t))}catch{return[]}}function lt(e,t){if(!V(t))return{files:[],excludedByProjectSlug:0};let n=W(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>L(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(it),i=[],a=r.filter(t=>{try{return U(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!it(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function ut(e){let t=L(e,`.ok`,`local`);return V(t)?{files:[`server.lock`,`last-spawn-error.log`,c].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function dt(e){let t=L(e,`.ok`,`local`,`logs`);return V(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function ft(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Ee(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function pt(e){let t=e.revealDocNames?e.content:ft(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=u(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function Y(e){for(let t of e.files)try{let n=U(t,`utf8`);pt({zipfile:e.zipfile,name:`${e.prefix}/${F(t)}`,content:t.endsWith(`.ips`)?qe(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function mt(t){let{redact:n,outputPath:r,logger:i}=t,s=t.revealDocNames??!1,c=t.userLogsDir??L(q(),`.ok`,`logs`),l=t.projectDir?tt(t.projectDir,i):null;H(I(r),{recursive:!0}),i?.info({projectSlug:l},`gathering diagnostic data`);let u=nt();u.desktop=t.desktop??null,u.language=t.language??null;let{files:d,excludedByProjectSlug:ee}=lt(l,c),{files:f}=t.projectDir?ut(t.projectDir):{files:[]},{files:p}=t.projectDir?dt(t.projectDir):{files:[]},m=t.shipItLogFiles??[],h=t.diagnosticReports?.files??[];i?.info({logFileCount:d.length,logFilesExcludedByProjectSlug:ee,lockFileCount:f.length,localSinkFileCount:p.length,shipItLogFileCount:m.length,diagnosticReportCount:h.length},`files collected`);let g=[],_=[],{ZipFile:v}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),y=new v;Y({zipfile:y,files:[...d,...m],prefix:`logs`,redact:n,revealDocNames:s,bundleFiles:_,redactions:g,logger:i}),Y({zipfile:y,files:f,prefix:`lockdir`,redact:n,revealDocNames:s,bundleFiles:_,redactions:g,logger:i}),Y({zipfile:y,files:p,prefix:`local-logs`,redact:n,revealDocNames:s,bundleFiles:_,redactions:g,logger:i}),Y({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:o,redact:n,revealDocNames:s,bundleFiles:_,redactions:g,logger:i}),Y({zipfile:y,files:h,prefix:`diagnostic-reports`,redact:n,revealDocNames:s,bundleFiles:_,redactions:g,logger:i});for(let e of t.extraFiles??[])try{let t=U(e.sourcePath),n=`extra/${e.zipName??F(e.sourcePath)}`;y.addBuffer(t,n),_.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&pt({zipfile:y,name:`note.txt`,content:t.note,redact:n,revealDocNames:s,bundleFiles:_,redactions:g});let b=new Set(h.map(e=>`diagnostic-reports/${F(e)}`)),x=_.filter(e=>b.has(e)),S=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Ue(t.diagnosticReports,x.length);y.addBuffer(Buffer.from(`${S}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`);let C=JSON.stringify(u,null,2);y.addBuffer(Buffer.from(C,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let w={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:l,files:_,redactions:g,sysinfo:u};y.addBuffer(Buffer.from(JSON.stringify(w,null,2),`utf8`),`MANIFEST.json`);let T=g.reduce((e,t)=>e+t.lineCount,0),E=new Set(m.map(e=>`logs/${F(e)}`)),D=_.filter(e=>E.has(e)),te=new Set((t.bugReportLedgerFiles??[]).map(e=>`${o}/${F(e)}`)),O=_.filter(e=>te.has(e)),k=l?_.filter(e=>e.startsWith(`logs/`)&&!it(e)&&!E.has(e)):[],A=x.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],j=A.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...A]:[`Redaction was disabled for this bundle; file contents are unmodified.`],M=[`# Bug Report Bundle`,``,`Generated: ${w.generatedAt}`,`Project: ${l??`(unscoped)`}`,`Discipline version: ${w.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...k.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...k.map(e=>`- ${e}`),``]:[],...D.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...D.map(e=>`- ${e}`),``]:[],...x.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...x.map(e=>`- ${e}`),``]:[],...O.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...O.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,T>0?`${T} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...A,``,`This bundle is safe to attach to a GitHub issue.`]:j].join(`
2
- `);y.addBuffer(Buffer.from(M,`utf8`),`README.md`),y.end();let N=ue(r);return y.outputStream.pipe(N),await new Promise((e,t)=>{N.on(`close`,e),N.on(`error`,t)}),i?.info({bundlePath:r,fileCount:_.length,redactionCount:T},`bundle written`),{zipPath:r,summary:{projectSlug:l,files:_,redactions:g,redactedLineCount:T,generatedAt:w.generatedAt}}}var ht=i(),gt=e(A(),1),X=e(ne(),1);function _t(e){let t=f(`user`,e,e);return k({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function vt({home:e=q(),env:t=process.env}={}){let r=_t(e),{override:i,preferenceList:a}=_(t),{locale:o,source:s}=d({override:i,storedPreference:r,supportedLocales:ee,preferenceList:a,autoDetectableLocales:n});return{preference:r,locale:o,source:s,systemLanguages:a}}function yt(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function bt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e,t){if(typeof e==`string`)return yt(e,t.contentDir);if(Array.isArray(e))return e.map(e=>Z(e,t));if(!bt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Z(i,t);return n}function xt(e,t){let n=U(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
3
- `),i=n.split(`
4
- `),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(e!==i.length-1||n!==``){if(n.length===0){a.push(``);continue}try{let e=Z(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
5
- `)}\n`:a.join(`
6
- `);K(e,o)}function St(e,t){let n=U(e,`utf-8`);if(n.trim().length!==0)try{let r=Z(JSON.parse(n),t),i=n.endsWith(`
7
- `)?`
8
- `:``;K(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=yt(n,t.contentDir);r!==n&&K(e,r)}}function Ct(e,t){let n=U(e,`utf-8`),r=yt(n,t.contentDir);r!==n&&K(e,r)}function wt(e){try{return W(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>L(e,t.name))}catch{return[]}}const Tt=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function Et(e){return/\.log\.\d+$/.test(e)}function Dt(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||Et(e)}const Ot=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function kt(e){let t={contentDir:e.contentDir};for(let n of Ot)for(let r of wt(L(e.stagingDir,n)))Dt(r)?xt(r,t):r.endsWith(`.json`)?St(r,t):Ct(r,t);for(let n of wt(L(e.stagingDir,`state`))){let e=F(n);n.endsWith(`.jsonl`)?xt(n,t):Tt.has(e)?St(n,t):Ct(n,t)}}const At=[`.ok`,`local`,`telemetry`],jt=[`.ok`,`local`,`logs`],Mt=[`.ok`,`local`,`loss-capture`],Nt=`spans-current.jsonl`,Pt=`spans-prev.jsonl`,Ft=`server-current.jsonl`,It=`server-prev.jsonl`,Lt=`loss-current.jsonl`,Rt=`loss-prev.jsonl`;function zt(e){return L(e,...At,Nt)}function Bt(e){return L(e,...At,Pt)}function Vt(e){return L(e,...jt,Ft)}function Ht(e){return L(e,...jt,It)}function Ut(e){return L(e,...Mt,Lt)}function Wt(e){return L(e,...Mt,Rt)}const Gt=1e3;async function Kt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(Gt)});return t.ok?await t.text():null}catch{return null}}async function qt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(Gt)});return t.ok?await t.text():null}catch{return null}}async function Jt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(Gt)});return t.ok?await t.text():null}catch{return null}}function Yt(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
9
- `)}\n`:null}catch{return null}}function Xt(e){let t=L(e,`.git`,`ok`);if(!V(t))return null;let n=oe(`git`,[`-C`,t,`log`,`--oneline`,`-50`],x({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Zt(e){let t=L(e,`.git`,`ok`);if(!V(t))return null;let n=oe(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],x({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Qt(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function $t(){return{nodeVersion:process.version,platform:be(),arch:_e()}}function en(){return process.env.OTEL_SDK_DISABLED===`false`}function tn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nn(e){if(!V(e))return{};let t;try{t=(0,ht.parse)(U(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!tn(t))return{};let n=t.telemetry;if(!tn(n))return{};let r=n.localSink;return tn(r)?r:{}}function rn(e){return typeof e==`boolean`?e:void 0}function an(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function on(e){if(tn(e))return an(e.maxBytes)}function sn(e){let t=nn(f(`project`,e)),n=nn(f(`project-local`,e));return{enabled:rn(n.enabled)??rn(t.enabled)??!0,spansMaxBytes:on(n.spans)??on(t.spans)??52428800,logsMaxBytes:on(n.logs)??on(t.logs)??26214400}}function cn(e){return Ee(`sha256`).update(e).digest(`hex`)}function ln(e){let t=U(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const un=[`"doc.name"`,`"docName"`];function dn(e){let t=U(e,`utf-8`),n=0;for(let e of un){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Q(e,t){if(!V(e))return!1;try{return H(I(t),{recursive:!0}),e.endsWith(`.ips`)?K(t,qe(U(e,`utf-8`))):le(e,t),!0}catch{return!1}}function fn(e){let t=[],n=e=>{let r=W(e,{withFileTypes:!0});for(let i of r){let r=L(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const pn=new Set([`.jsonl`]);function mn(e){let t=e.lastIndexOf(`.`);return t!==-1&&pn.has(e.slice(t))}const hn=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function gn(e){if(Et(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&hn.has(e.slice(t))}function _n(e){let t=[];for(let n of fn(e)){let r=vn(e,n);if(!gn(r))continue;let{redacted:i,patterns:a,lineCount:o}=u(U(n,`utf-8`));a.length!==0&&(K(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function vn(e,t){return R(e,t).split(B).join(`/`)}async function yn(e){let t=z(e.contentDir),n=z(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Kt,a=r.fetchAgentEffects??qt,l=r.fetchWatcherRecent??Jt,u=r.readShadowHead??Xt,d=r.readCheckpointRefs??Zt,ee=r.now??(()=>new Date),f=r.okVersion??(()=>ie),p=r.readDesktopEnv??Qt,m=r.readLanguage??vt,h=r.readRuntime??$t,g=r.isOtlpPushEnabled??en,_=fe(L(Se(),`ok-bundle-`));try{H(L(_,`telemetry`),{recursive:!0}),H(L(_,`logs`),{recursive:!0}),H(L(_,`state`),{recursive:!0}),Q(zt(n),L(_,`telemetry`,Nt)),Q(Bt(n),L(_,`telemetry`,Pt)),Q(Vt(n),L(_,`logs`,Ft)),Q(Ht(n),L(_,`logs`,It));for(let t of e.userLogFiles??[])Q(t,L(_,`logs`,F(t)));for(let t of e.userStateFiles??[])Q(t,L(_,o,F(t)));let v=0;for(let t of e.diagnosticReports?.files??[])Q(t,L(_,`diagnostic-reports`,F(t)))&&(v+=1);let y=L(n,`.ok`,`local`),b=L(y,`server.lock`),x=`not-running`,S=`no server.lock`,C=null;if(V(b)){Q(b,L(_,`state`,`server.lock`));try{let e=U(b,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?C=t.port:S=`lock present but no port`}catch{S=`lock present but unparseable`}}if(C!==null){let e=await i(C);e===null?S=`agent-presence endpoint at :${C} unreachable`:(K(L(_,`state`,`agent-presence.json`),e),x=`running`,S=``);let t=await a(C);t!==null&&K(L(_,`state`,`agent-effects.json`),t);let n=await l(C);if(n!==null){let e=Yt(n);e!==null&&K(L(_,`state`,`watcher-recent.jsonl`),e)}}let w=u(t);w!==null&&K(L(_,`state`,`shadow-head.txt`),w);let T=d(t);T!==null&&K(L(_,`state`,`checkpoint-refs.txt`),T),Q(Ut(n),L(_,`state`,Lt)),Q(Wt(n),L(_,`state`,Rt)),Q(L(y,`last-spawn-error.log`),L(_,`state`,`last-spawn-error.log`)),Q(L(y,s),L(_,`state`,s)),Q(L(y,c),L(_,`state`,c));let E=h(),D=p(),te=m(),O={ok:{version:f(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:D,language:te}};K(L(_,`state`,`runtime.json`),`${JSON.stringify(O,null,2)}\n`);let k=x===`running`?`running
10
- `:`not-running (${S})\n`;K(L(_,`state`,`server-status.txt`),k);let A=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:Ue(e.diagnosticReports,v);if(K(L(_,`state`,`diagnostic-reports-status.txt`),`${A}\n`),e.processDir&&V(e.processDir)){let t=L(_,`process`);H(t,{recursive:!0}),le(e.processDir,t,{recursive:!0})}let j=e.redact===!0;j&&kt({stagingDir:_,contentDir:t}),e.note&&K(L(_,`note.txt`),e.note);let M=null;e.scrubSecrets===!0&&(M=_n(_));for(let t of e.extraFiles??[])Q(t.sourcePath,L(_,`extra`,t.zipName??F(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let N=sn(n),ne=fn(_),P=[],re=0,ie=0;for(let e of ne){let t=vn(_,e),n=ge(e).size,r=mn(t)?ln(e):0;P.push({path:t,bytes:n,lines:r}),re+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(ie+=dn(e))}let ae={applied:j};M!==null&&(ae.secretScrub=M);let oe={schemaVersion:2,createdAt:ee().toISOString(),ok:{version:f(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:D,language:te},contentDir:{pathSha256:cn(t),absolutePath:j?`<CONTENT_DIR>`:t},telemetry:{localSink:N,otlpPushEnabled:g()},redaction:ae,serverStatus:x,files:P};K(L(_,`manifest.json`),`${JSON.stringify(oe,null,2)}\n`);let I=ne.some(e=>{try{return U(e,`utf-8`).includes(t)}catch{return!1}}),se={stagedDiagnosticReports:v,totalBytes:re,fileCount:P.length,docNameCount:ie,contentDirVisible:I,redacted:j},R=!1;return{stagingDir:_,manifest:oe,summary:se,cleanup:()=>{R||(R=!0,G(_,{recursive:!0,force:!0}))}}}catch(e){throw G(_,{recursive:!0,force:!0}),e}}async function bn(e){let{collected:t,outputPath:n}=e,r=I(n);if(!V(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new gt.ZipFile,a=fn(t.stagingDir);for(let e of a){let n=vn(t.stagingDir,e);i.addFile(e,n)}i.end();let o=ue(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function xn(e,t){let n=L(e,`.ok`,`config.yml`);if(V(n))try{let t=(0,ht.parse)(U(n,`utf-8`)),r=re(t)?t.content:void 0,i=re(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return z(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return z(e)}async function Sn(e,t,n,r,i){let a=tt(t,e.logger),o=await yn({contentDir:xn(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...at(a,e.userLogsDir??L(q(),`.ok`,`logs`)),...st(e.cachesDir??L(q(),`Library`,`Caches`))],userStateFiles:ct(e.bugReportsDir??J()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{H(I(e.outputPath),{recursive:!0}),await bn({collected:o,outputPath:e.outputPath});let t=o.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:a,files:o.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:o.manifest.createdAt}}}finally{o.cleanup()}}async function Cn(e){let{projectDir:t}=e,n=e.readDesktopEnv??Qt,r=e.readLanguage??vt,i=()=>$e(e.diagnosticReportsDir??L(q(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return Sn(e,t,n,r,i());let{zipPath:a,summary:o}=await mt({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:st(e.cachesDir??L(q(),`Library`,`Caches`)),bugReportLedgerFiles:ct(e.bugReportsDir??J()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}function $(e,t,n={}){let r=w(e,t);if(!V(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(U(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!y(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??h)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??te())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ye();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function wn(e){return e.replace(/:\d+$/,``)}function Tn(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:wn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:wn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:wn(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}const En=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],Dn=[...v.map(e=>E[e]),`open-knowledge`];function On(e){if(!se(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=z(e);if(t===B||I(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function kn(e,t){let n=R(e,t);if(n.startsWith(`..`)||se(n))return!1;let r=e;for(let e of n.split(B)){r=L(r,e);try{if(!de(r).isDirectory())return!1}catch{return!1}}return!0}function An(e,t){try{return W(e).every(n=>t.has(L(e,n)))}catch{return!1}}function jn(e){let t=On(e),n=[],r=[],i=new Set;for(let e of En){let a=L(t,e.hostDir,`skills`);if(!kn(t,a))continue;let o=Dn.map(e=>L(a,e)).filter(e=>V(e));n.push(...o);for(let e of o)i.add(e);let s=L(t,e.pruneRoot),c=a;for(;An(c,i)&&(r.push(c),i.add(c),c!==s);){let e=I(c);if(e===c||e===t||!e.startsWith(t+B))break;c=e}}return{skillDirs:n,emptyDirs:r}}function Mn(e){try{if(!de(e).isDirectory())return!1;let t=W(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function Nn(e){let t=new Set,n=new Set;for(let r of En){let i=L(e,r.hostDir,`skills`);for(let e of Dn)t.add(L(i,e));let a=L(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=I(o);if(t===o||t===e||!t.startsWith(e+B))break;o=t}}return{skillDirs:t,emptyDirs:n}}function Pn(e,t){let n=On(e),r=Nn(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(kn(n,e)&&Mn(e))try{G(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(kn(n,e))try{he(e),a.push(e)}catch{}return a}function Fn(e){let n=On(e),r=[];for(let e of v){let i=E[e];r.push({path:L(n,`.agents`,`skills`,i),bundleId:e,scope:`central`});for(let a of t)r.push({path:L(n,a.skillsRoot,i),bundleId:e,scope:`host`,hostDir:a.hostDir})}return r}function In(e,t){let n=[];for(let r of Fn(e))if(r.bundleId===t)try{G(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}function Ln(e){return e!=null&&e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function Rn(e,t=Date.now()){let n=l(e,t);return n===`unknown`?`—`:n}function zn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`)return null;let i=t.lock,a=t.status===`alive`&&C(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:b(n),command:n,isDesktop:Ln(n)}}function Bn(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:`stale`}const Vn=new Set([`running`,`desktop`,`foreign`]);function Hn(e){switch(e){case`running`:return X.default.green(e);case`desktop`:return X.default.blue(e);case`foreign`:return X.default.cyan(e);case`stale`:return X.default.yellow(e)}}function Un(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Wn(e){return`${Un(e.server.usage)} | ${Un(e.ui?.usage??null)}`}function Gn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function Kn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory,Gn(e),Wn(e),Bn(e),String(e.server.pid),Rn(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=Hn(Bn(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=X.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
11
- `)}async function qn(e={}){let t=e.discover??g,n=e.inspect??(e=>$(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??O,a=e.resolveUsage??D,o=await t(),s=[];for(let e of o){let t=n(e),r=zn(e,t,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Bn(e)}));r(JSON.stringify(e,null,2));return}r(Kn(e.all?s:s.filter(e=>Vn.has(Bn(e)))))}function Jn(){return new j(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await qn({all:t.all===!0||e===`all`,json:t.json===!0})})}async function Yn(e,t=Oe()){let n=$(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=S(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500)});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function Xn(e,t={}){return{targets:Qn(e,t.isAlive??h)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function Zn(e){let t=e.inspect??(()=>$(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??Yn,o=e.logger??Oe(),s=Xn(t(),{isAlive:e.isAlive});if(s.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function Qn(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}async function $n(e,t=h){let n=await g(),r=null;for(let i of n){let n=$(i,`server`);if(Qn(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function er(e,t){let n=await Zn({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function tr(e,t,n={}){return t===0?`Nothing was running for ${e}, and no other open-knowledge servers are running.`:`Nothing was running for ${e}. ${t} other open-knowledge server${t===1?` is`:`s are`} running${n.listingFollows===!0?``:" — run `ok ps` to list them"}.`}async function nr(e){let t=await g(),n=0;for(let r of t)r!==e&&Qn($(r,`server`),h)&&n++;return n}function rr(e){return new j(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the enclosing project — run it from anywhere inside the project. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).option(`--force`,`Stop even when editor windows or agents are still connected to the server`).action(async(t,n)=>{let r=n.force===!0,i=t.length===0?void 0:t.join(` `);if(i===void 0){e();let t=p(process.cwd()),n=await Zn({lockDir:t,force:r,log:()=>{}});if(n.hadTargets){if(n.stopped.length>0){let e=n.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1)}else{let e=await nr(t);console.log(tr(process.cwd(),e,{listingFollows:e>0})),e>0&&await qn({})}return}if(i===`all`){let e=await g();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)Qn($(n,`server`),h)&&(await er(n,r),t++);t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(i)){let e=Number.parseInt(i,10),t=await $n(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await er(t,r);return}let a=z(Fe(),i),o=p(a),s=[],c=await Zn({lockDir:o,force:r,log:e=>s.push(e)});if((c.failed.length>0||c.declined!==void 0)&&(process.exitCode=1),c.hadTargets)for(let e of s)console.log(e);else console.log(tr(a,await nr(o)))})}export{Fe as C,Ae as D,Oe as E,Ve as S,Me as T,Ue as _,Pn as a,Le as b,Fn as c,Cn as d,yn as f,$e as g,J as h,Jn as i,Tn as l,et as m,Zn as n,jn as o,bn as p,rr as r,In as s,Yn as t,$ as u,Ie as v,Pe as w,Be as x,Re as y};
@@ -1 +0,0 @@
1
- import"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import"./init-CoCCZEvS.mjs";import"./src-BVPWIiic.mjs";import"./registry-probes-B_UapTQA.mjs";import"./start-CV9e5XLw.mjs";import{n as e}from"./loader-B0EV14F-.mjs";import"./preview-BWs_Rq1J.mjs";import"./cli.mjs";import"./repair-mcp-configs-CHDcjBGn.mjs";export{e as loadConfig};
@@ -1,5 +0,0 @@
1
- import{Qs as e,Uu as t,Zi as n,ds as r,eu as i,ms as a,pt as o,vo as s}from"./md-manager-BGnqyqi1-Eez8IlhB.mjs";import{$r as c,Co as l,E as u,Po as d,Rr as f,Yr as p,fi as m,xo as h}from"./dist-B_lhaeFJ.mjs";import{F as g,K as _,N as v,_t as y,b,gt as x,ht as S,ot as C,y as w}from"./init-CoCCZEvS.mjs";import{a as T,c as E,d as D,f as O,i as ee,n as k,o as A,p as j,r as M,s as N,t as te,u as P,v as F}from"./registry-probes-B_UapTQA.mjs";import{n as ne}from"./constants-C2Waxo4E.mjs";import{execFileSync as I,spawn as L}from"node:child_process";import{basename as R,dirname as z,join as re,resolve as B}from"node:path";import{existsSync as V,realpathSync as ie}from"node:fs";import{homedir as ae,tmpdir as oe}from"node:os";import{rm as se}from"node:fs/promises";import{setTimeout as ce}from"node:timers/promises";const le=[`/opt/homebrew/bin/gh`,`/usr/local/bin/gh`,`/opt/local/bin/gh`,`/snap/bin/gh`,`/usr/bin/gh`],ue={encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`],timeout:5e3,windowsHide:!0};function H(e,t={}){let{login:n}=t,r=t._exec??I,i=U(t._fileExists??V),a=e?[`--hostname`,e]:[];if(n){let e=W(r,i,[`auth`,`token`,...a,`--user`,n]);if(e)return{available:!0,token:e,resolvedLogin:n,fallback:!1}}let o=W(r,i,[`auth`,`token`,...a]);return o?n?{available:!0,token:o,fallback:!0}:{available:!0,token:o}:{available:!1}}function U(e){return[`gh`,...le.filter(e)]}function W(e,t,n){for(let r of t)try{let t=e(r,n,ue).toString().trim();if(t.length>0)return t}catch{}}function de(e,t={}){let n=t._exec??I,r=U(t._fileExists??V),i=[`auth`,`status`,...e?[`--hostname`,e]:[]],a=W(n,r,[...i,`--json`,`hosts`]);if(a!==void 0){let t=fe(a,e);if(t)return t}let o=W(n,r,i);if(o!==void 0){let e=_e(o);if(e.length>0)return e}}function G(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function fe(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=G(G(n)?.hosts);if(!r||t!==void 0&&r[t]===void 0)return;let i=t===void 0?Object.values(r):[r[t]],a=[];for(let e of i){if(!Array.isArray(e))return;for(let t of e){let e=G(t);if(!e)continue;let n=e.login;typeof n==`string`&&n.length!==0&&a.push({login:n,active:e.active===!0})}}return a}const pe=/Logged in to \S+ account (\S+) \(/,me=/(?:Failed to log in to|Timeout trying to log in to) \S+/,he=/^\s*-\s*Active account:\s*true\s*$/,ge=/\u001b\[[0-9;]*m/g;function _e(e){let t=[],n;for(let r of e.split(`
2
- `)){let e=r.replace(ge,``),i=pe.exec(e)?.[1];if(i){n={login:i,active:!1},t.push(n);continue}if(me.test(e)){n=void 0;continue}n&&he.test(e)&&(n.active=!0)}return t}const ve={mode:`published`,skipAvailabilityCheck:!0,replaceEntry:!0};function K(){return{action:`failed`,errorId:`write-failed`}}function q(){return{action:`skipped-missing`,errorId:`surface-missing`}}function J(e,t,n){d(`agent-integrations-apply`).warn({editor:e,path:t,reason:n},`skill write failed`)}function Y(){return{action:`skipped-unsupported`,errorId:`no-writer`}}function ye(e){switch(e){case`removed`:return{action:`removed`};case`not-present`:return{action:`no-op`};case`left-foreign`:return{action:`skipped-foreign`,errorId:`foreign-artifact`};case`declined`:return{action:`declined`,errorId:`write-declined`}}}async function be(e,t,n){if(_[e].scope!==`global`)return q();if(n===`absent`)return ye(A(_[e],``,t.home).kind);let r=(await b({editors:[e],home:t.home,replaceEntry:!0})).find(t=>t.editorId===e);if(r===void 0)return K();switch(r.action){case`written`:case`overwritten`:return{action:r.action};case`declined`:return{action:`declined`,errorId:`write-declined`};case`skipped-missing`:return q();case`skipped-flag`:return Y();default:return K()}}function xe(e,n,r){let i=t[e];if(i===null)return q();let a=re(n.cwd,i);if(r===`absent`)return ye(A(_[e],n.cwd,void 0,a).kind);let o=w(_[e],n.cwd,ve,void 0,a);switch(o.action){case`written`:case`overwritten`:return{action:o.action};case`declined`:return{action:`declined`,errorId:`write-declined`};default:return K()}}function Se(e,t,n){let r=t.home??ae();if(n===`absent`){let t=M(e,r);switch(t.action){case`removed`:return{action:`removed`};case`not-present`:return{action:`no-op`};case`skipped-unsupported`:return q();case`failed`:return J(e,t.path,t.error),K()}}let i=T(e,r);switch(i.action){case`written`:return{action:`written`};case`overwritten`:return{action:`overwritten`};case`skipped-unsupported`:return q();case`failed`:return J(e,i.path,i.error),K()}}function Ce(e,t,n){if(n===`absent`){let n=v(_[e],t.cwd);switch(n.action){case`removed`:return{action:`removed`};case`not-present`:return{action:`no-op`};case`skipped-unsupported`:return q();case`failed`:return J(e,n.path,n.error),K()}}let r=g(_[e],t.cwd);switch(r.action){case`written`:return{action:`written`};case`overwritten`:return{action:`overwritten`};case`skipped-unsupported`:return q();case`skipped-prerequisite`:return{action:`skipped-prerequisite`,errorId:`dependency-failed`};case`failed`:return J(e,r.path,r.error),K()}}function we(e){return t=>{if(t.pathId===void 0)return Y();let n=i(t.pathId);if(n===null||n.kind===`central-skill-store`)return Y();switch(n.kind){case`editor-user-config`:return be(n.editor,e,t.desired);case`editor-project-config`:return xe(n.editor,e,t.desired);case`editor-project-skill-root`:return Ce(n.editor,e,t.desired);case`editor-user-skill-root`:return Se(n.editor,e,t.desired)}}}function Te(e,t){return e.bind?.[0]??t.HOST??`127.0.0.1`}function Ee(e){if(e===`server`)return e;throw new x(`--only must be 'server'`)}function De(e=V){let t=import.meta.dirname??new URL(`.`,import.meta.url).pathname;return[B(t,`public`),B(t,`../../app/dist`),B(t,`../../../app/dist`)].find(t=>e(t))}function Oe(e){if(e.explicitDir!==void 0)return{dir:e.explicitDir,missingBundle:!1};if(e.only===`server`)return{dir:void 0,missingBundle:!1};let t=e.findBundledDir();return{dir:t,missingBundle:t===void 0}}function ke(t){if(t===`off`)return`off`;if(!e.test(t))throw new x(`--idle-shutdown must be 'off' or a duration like 90s, 30m, 2h`);return t}function Ae(e){return e===`localhost`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}function je(e){return!e.flagBindSet&&!e.okBindSet&&e.hostEnvSet&&e.fileBindCount>1}function Me(e){return!e.openBrowser||e.ephemeral||e.only===`server`||!e.servesUi?!1:(e.explicitOn||Ae(e.host))&&e.isTTY}function Ne(e,t){let n;try{n=new URL(t)}catch{throw new x(`${e} is not a valid URL: ${t}`)}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw new x(`${e} must be an http(s) origin (got: ${t})`);return t}function Pe(e){return Ne(`--external-url`,e)}function Fe(e){let t=R(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var X=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}},Z=class extends Error{projectDir;constructor(e){super(`--project-dir must be a throwaway ${u}* directory under the OS temp dir. Refusing to write ephemeral session state into ${e}. Omit --project-dir to let ok start create (and clean up) its own.`),this.name=`EphemeralProjectDirNotThrowawayError`,this.projectDir=e}};function Q(e,t={}){let n=t.tmpdirFn??oe,r=t.realpathFn??ie,i=e=>{try{return r(e)}catch(t){return t.code===`ENOENT`?B(e):null}},a=B(e),o;try{o=r(a)}catch(e){if(e.code===`ENOENT`){let e=i(z(a));o=e===null?null:B(e,R(a))}else o=null}if(o===null)return!1;let s=i(n());return s!==null&&z(o)===s&&R(o).startsWith(`ok-ephemeral-`)}function Ie(e,t,n=e=>se(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{if(Q(t))try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}else process.stderr.write(`[start] leaving ${t} in place: only ${u}* dirs under the OS temp dir are removed on ephemeral teardown\n`)}}}function Le(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:+!!i,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}async function $(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.idleThresholdMs===void 0?18e5:e.idleThresholdMs,{existsSync:o,mkdirSync:s}=await import(`node:fs`),{basename:l,dirname:u,resolve:d}=await import(`node:path`),{bootServer:p,createEphemeralProjectDir:h,getLogger:g,resolveContentDir:_,resolveLockDir:v,seedEphemeralProjectDir:y,waitForServerLockDrain:b}=await import(`./dist-CJ5qX39u.mjs`),x=e.log??g(`start`),S=e.singleFile!==void 0,w=S?m(e.singleFile).canonicalFilePath:void 0,T=w?u(w):void 0,D=w?l(w):void 0,O,A=!1;if(T!==void 0){if(e.projectDir!==void 0){if(O=e.projectDir,!Q(O))throw new Z(O);o(d(O,`.ok`,`config.yml`))||y(O,T)}else O=h(T),A=!0}let j=async()=>{if(!(!A||O===void 0)){if(!Q(O)){x.warn({ephemeralProjectDir:O},`[start] refusing to reap self-provisioned ephemeral dir: no longer resolves to an ok-ephemeral-* temp dir`);return}try{await se(O,{recursive:!0,force:!0})}catch(e){x.warn({err:e,ephemeralProjectDir:O},`[start] failed to reap self-provisioned ephemeral temp dir`)}}},M=O;if(!S){if(!i&&!f(n))throw new X(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{e.severity===`info`?x.debug({event:e},`[start] reclaim sweep event`):x.warn({event:e},`[start] reclaim sweep reported a problem`)};try{let i=(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-CHDcjBGn.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r}).outcomes.filter(e=>e.outcome!==`no-entry`&&e.outcome!==`canonical`&&e.outcome!==`repaired`&&e.outcome!==`foreign`);i.length>0&&x.warn({unhealed:i},`[start] reclaim sweep left entries it could not heal`)}catch(e){x.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-I0JPbY-j.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){x.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}}let P=T??_(t,n);!S&&!o(P)&&(s(P,{recursive:!0}),x.info({contentDir:P},`Created content directory`));let ne=F(),I=c(),L;try{{let e=v(O??n),t=Date.now(),r=await b(e);r!==`no-drain`&&x.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}L=await p({config:t,contentDir:P,projectDir:O??n,contentRoot:S?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:H,detectGhAccounts:de,tokenStore:ne,embeddingsKeyStore:I,mcpTomlEditor:C(),...S?{ephemeral:!0,singleDocRelPath:D,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>k(e,t),probePiAcpBridge:e=>E(e),ensurePiAcpBridge:e=>N(e),agentIntegrations:(()=>{let e={cwd:O??n,home:ae()};return{probe:te(e),execute:we(e),userSkillPresentAnywhere:ee}})(),idleShutdownMs:a,...e.serverRuntime===void 0?{}:{serverRuntime:e.serverRuntime},...e.bind===void 0?{}:{bind:e.bind},skipAutoInit:!0,idleShutdownHandler:t=>{let n=t;return Le(M===void 0?n:Ie(n,M),{log:x,exit:e.idleExit})},log:x,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}})}catch(e){throw await j(),e}let R=L.destroy,z=A?async()=>{try{await R()}finally{await j()}}:R;return{httpServer:L.httpServer,destroy:z,lockDir:L.lockDir,contentDir:P,port:L.port,ready:L.ready,degraded:L.degraded}}function Re(e,t,n=()=>h({absPath:l(`user`,process.cwd()),sideline:!1,warn:()=>{}}).value){return t===void 0?e:n()}function ze(e){if(e===`browser`||e===`app`)return e;throw new x(`--mode must be 'browser' or 'app'`)}function Be(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function Ve(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function He(e,t){let i=Re(e,t.singleFile),c=Be(process.env);c!==null&&(process.env.OK_CONSOLE_LEVEL=c);let{renderBanner:l}=await import(`./banner-kywHhVaC.mjs`),{accent:u,dim:d,error:f,warning:p}=await import(`./colors-SgU3JHQu.mjs`),m=process.cwd();process.title=Fe(m);let h;try{h=r(process.env)}catch(e){throw e instanceof o&&(console.error(f(e.message)),process.exit(78)),e}for(let e of h.diagnostics)console.warn(p(`[config] ${e.message}`));let g=n(i,h.layer),_=h.overrides.some(e=>e.envVar===`OK_BIND`),v=t.bind!==void 0&&t.bind.length>0?t.bind:void 0,y=process.env.HOST,b=y!==void 0&&y.trim()!==``?y:void 0,x=a(g),S=v??(_||b===void 0?[...x.bind]:[b]);je({flagBindSet:v!==void 0,okBindSet:_,hostEnvSet:b!==void 0,fileBindCount:x.bind.length})&&console.warn(p(`[config] HOST=${b} overrides server.bind — dropping the file-configured addresses (${x.bind.join(`, `)}). Use OK_BIND with a space-separated list to keep multiple binds.`));let C=S[0]??`127.0.0.1`,w=S,T=t.externalUrl,E=a(n(g,{server:{bind:w,...T===void 0?{}:{externalUrl:T}}}));if(E.allowExternal&&(!E.loopbackOnly||E.externalUrl)){let e=E.externalUrl??E.bind.join(`, `);console.warn(p([``,`⚠ EXTERNAL ACCESS ENABLED (server.allowExternal) — no server-side authentication.`,` This server is reachable beyond this machine (${e}). Anyone who can`,` reach it has FULL control of this knowledge base — sync, publishing, GitHub`,` credentials, and local operations (clone, sign-in, repo spawn).`,` Restrict who can reach it at the edge: a Tailscale ACL, a reverse proxy with`,` auth (Cloudflare Access, oauth2-proxy), or a firewall.`,``].join(`
3
- `)))}let D=t.port===void 0?void 0:Number(t.port),O=h.overrides.find(e=>e.envVar===`PORT`)?.value,ee=D??O??i.server?.port,k=Oe({explicitDir:t.reactShellDistDir,only:t.only,findBundledDir:De}),A=k.dir;k.missingBundle&&console.warn(`bundled web UI not found — serving /api and /mcp only. Reinstall @inkeep/open-knowledge, or build packages/app in a source checkout.`);let j;try{j=await $({config:i,cwd:m,host:C,port:ee,bind:w,...t.serveContentAssets===void 0?{}:{serveContentAssets:t.serveContentAssets},...A?{reactShellDistDir:A}:{},idleThresholdMs:s(t.idleShutdown??E.idleShutdown),serverRuntime:E,...t.singleFile?{singleFile:t.singleFile}:{},...t.projectDir?{projectDir:t.projectDir}:{}})}catch(e){e instanceof X&&(console.error(f(e.message)),process.exit(1)),e instanceof Z&&(console.error(f(e.message)),process.exit(1));let t=await import(`./dist-CJ5qX39u.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),e instanceof t.ExposureConsentError&&(console.error(f(e.message)),process.exit(78)),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(f(e.message)),process.exit(1)),e instanceof t.MissingOkConfigError&&(console.error(f(e.message)),process.exit(1)),Ge(e,t)){let e=t.resolveLockDir(m),n=null;try{n=await Ue({readServerLock:()=>t.readServerLock(e),now:Date.now,sleep:e=>ce(e),timeoutMs:3e3,pollIntervalMs:50})}catch(e){process.stderr.write(`[start] spawn-or-reuse: lock poll failed (${e instanceof Error?e.message:String(e)}) — falling back to the collision message\n`)}if(n!==null){let[e,...t]=We(n);console.log(u(e));for(let e of t)console.log(d(e));process.exit(0)}}let n=Ke(e,m,t);n!==null&&(console.error(f(n)),process.exit(1)),console.error(`${f(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let M=!1,N=async e=>{if(M)return;M=!0;let[t,...n]=Ve(e);console.log(u(`\n${t}`));for(let e of n)console.log(d(` ${e}`));try{await j.destroy(`external-signal`)}catch(e){console.error(`${f(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)};process.once(`SIGINT`,()=>{N(`SIGINT`)}),process.once(`SIGTERM`,()=>{N(`SIGTERM`)});let te=`http://${C.includes(`:`)&&!C.startsWith(`[`)?`[${C}]`:C}:${j.port}`,P=C===`0.0.0.0`||C===`::`?`http://0.0.0.0:${j.port}`:void 0,F=te;console.log(l({name:`open-knowledge`,version:ne,localUrl:F,networkUrl:P,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let I={"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`};j.ready.then(async()=>{if(j.degraded.length>0){console.log();for(let e of j.degraded){let t=I[e]??`${e} (check server logs for details)`;console.warn(` ${p(`⚠`)} ${p(e)}: ${d(t)}`)}console.log()}if(Me({openBrowser:t.openBrowser!==!1&&E.openBrowser,explicitOn:t.openBrowser!==!1&&g.server?.openBrowser===!0,host:C,isTTY:process.stdout.isTTY===!0,ephemeral:t.singleFile!==void 0,only:t.only,servesUi:A!==void 0})){let{openBrowser:e}=await import(`./open-browser-CdtzidpR.mjs`);e(F)}}).catch(e=>{console.error(` ${f(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}async function Ue(e){let t=e.now()+e.timeoutMs,n=e.readServerLock();for(;n!==null&&n.draining!==!0&&n.port<=0&&e.now()<t;)await e.sleep(e.pollIntervalMs),n=e.readServerLock();return n===null||n.draining===!0||n.port<=0?null:p(n)&&n.url!==void 0?{url:n.url,kind:n.kind,pid:n.pid,servesUi:!0}:{url:n.url??`http://127.0.0.1:${n.port}`,kind:n.kind,pid:n.pid,servesUi:!1}}function We(e){return[`${e.kind===`mcp-spawned`?`An MCP-spawned OpenKnowledge server is already running on this project`:`OpenKnowledge is already running on this project`} (pid ${e.pid}).`,` ${e.url}`,"Leaving it running — run `ok stop` first if you want a fresh server."]}function Ge(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function Ke(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=n.readServerLock(n.resolveLockDir(t));return e&&e.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function qe(e){return new S(`start`).description(`Start the OpenKnowledge server (UI + API + MCP + collab on one port)`).option(`-p, --port <port>`,`Server port`,void 0).option(`--bind <address>`,`Bind address (repeatable; default 127.0.0.1 — loopback only)`,(e,t)=>[...t??[],e]).option(`--no-open-browser`,`Do not open the browser after start (interactive loopback starts open it by default)`).option(`--only <module>`,`Serve one module: 'server' (API + MCP only, no shell or browser)`,Ee).option(`--idle-shutdown <duration>`,`Shut the server down after this long with no connected clients ('off', or a duration like 90s, 30m, 2h; default 30m)`,ke).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,ze).option(`--serve-content-assets`,`Serve content assets from this server (now the default; kept for compatibility)`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path>`).addOption(new y(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).hideHelp()).addOption(new y(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).hideHelp()).option(`--external-url <url>`,`Canonical external origin clients dial (sets server.externalUrl for this run) — its host joins the Host/Origin allowlists (CORS + external-Host admission). External exposure additionally requires consent (OK_ALLOW_EXTERNAL=1 or server.allowExternal).`,Pe).action(async t=>{let n=e();if(t.only===`server`&&t.reactShellDistDir!==void 0&&(process.stderr.write(`error: option '--only server' cannot be combined with '--react-shell-dist-dir'
4
- `),process.exit(2)),t.projectDir!==void 0&&t.singleFile===void 0&&(process.stderr.write(`error: option '--project-dir' requires '--single-file'
5
- `),process.exit(2)),t.mode===`app`){let e=[];if(t.port!==void 0&&e.push(`--port`),t.bind!==void 0&&e.push(`--bind`),t.only!==void 0&&e.push(`--only`),t.idleShutdown!==void 0&&e.push(`--idle-shutdown`),t.openBrowser===!1&&e.push(`--no-open-browser`),t.externalUrl!==void 0&&e.push(`--external-url`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=D(P());if(n.available){O({spawn:L},n);return}console.error(j(n.reason)),process.exit(1)}await He(n,t)})}export{Ke as C,de as D,H as E,qe as S,Le as T,Be as _,We as a,Me as b,Q as c,ke as d,Ee as f,Re as g,Ue as h,Fe as i,Ge as l,Te as m,X as n,Ve as o,De as p,$ as r,Ae as s,Z as t,Pe as u,Oe as v,Ie as w,je as x,He as y};
@@ -1 +0,0 @@
1
- import{S as e,m as t,p as n,r}from"./start-CV9e5XLw.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};