@inkeep/open-knowledge 0.84.0-beta.8 → 0.84.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 (122) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-DB1LQ7ZB.mjs +1 -0
  3. package/dist/index.d.mts +1 -0
  4. package/dist/index.mjs +1 -1
  5. package/dist/init-CTlk5-Zb.mjs +1 -0
  6. package/dist/{init-BgqVi-9O.mjs → init-M54rry8h.mjs} +2 -2
  7. package/dist/{launch-json-removal-CnjxrLk6.mjs → launch-json-removal-BTInmedE.mjs} +1 -1
  8. package/dist/loader-BIVsqbQs.mjs +1 -0
  9. package/dist/{loader-B8U9rhyX.mjs → loader-C7uN3Y0b.mjs} +1 -1
  10. package/dist/{preview-CCxlCT_n.mjs → preview-B-Vnnn1H.mjs} +1 -1
  11. package/dist/preview-C3ycR4RK.mjs +1 -0
  12. package/dist/public/assets/{AccountSection-B014nDlY.js → AccountSection-D_ZWBqY9.js} +1 -1
  13. package/dist/public/assets/{ActivityModeContent-DYdjlBFR.js → ActivityModeContent-CNpMQTpC.js} +1 -1
  14. package/dist/public/assets/{AddPropertiesButton-DgNbHA4e.js → AddPropertiesButton-Bej6JqkA.js} +1 -1
  15. package/dist/public/assets/{AgentDiffPane-9W2g7aLW.js → AgentDiffPane-DwlqjVvq.js} +1 -1
  16. package/dist/public/assets/{AttachmentsSection-DgA2oYx3.js → AttachmentsSection-lWzz3fp_.js} +1 -1
  17. package/dist/public/assets/{CodeMirrorPropInput-I8b5kl2c.js → CodeMirrorPropInput-fUqL63QL.js} +1 -1
  18. package/dist/public/assets/{ContentRulesSection-CEhqKazM.js → ContentRulesSection-DBqT2CPL.js} +1 -1
  19. package/dist/public/assets/{DocumentContext-BU6384lO.js → DocumentContext-CPYny_LL.js} +1 -1
  20. package/dist/public/assets/{EditorModeToggle-Cf0LpUPt.js → EditorModeToggle-CwAAzRZS.js} +1 -1
  21. package/dist/public/assets/{ExcalidrawDocEditor-zIujqXar.js → ExcalidrawDocEditor-BgISOoix.js} +1 -1
  22. package/dist/public/assets/FeedbackForm-CUw8I5kf.js +1 -0
  23. package/dist/public/assets/{ImportSkillDialog-BsdzQosb.js → ImportSkillDialog-oocNaRhL.js} +1 -1
  24. package/dist/public/assets/{LinkPreviewsSection-bzaka6Vy.js → LinkPreviewsSection-BfIYdcgK.js} +1 -1
  25. package/dist/public/assets/{LintConfigEditor-Cc4OnPo8.js → LintConfigEditor-C7y-uwE0.js} +1 -1
  26. package/dist/public/assets/{LintingSection-BTbUA-sH.js → LintingSection-CVw0Trw4.js} +1 -1
  27. package/dist/public/assets/{ManagedArtifactProperties-DZWmH30D.js → ManagedArtifactProperties-CWYSaPwg.js} +1 -1
  28. package/dist/public/assets/ManagedArtifactProperties-DWbrw9Cj.js +1 -0
  29. package/dist/public/assets/{MermaidDocEditor-Cxe7FJmA.js → MermaidDocEditor-haNggOCz.js} +1 -1
  30. package/dist/public/assets/{NetworkAccessSection-Bco3oNmX.js → NetworkAccessSection-Dw2VIaTB.js} +1 -1
  31. package/dist/public/assets/{PropertyDisplayRow-kKXyb1ak.js → PropertyDisplayRow-BmJgg1G0.js} +1 -1
  32. package/dist/public/assets/{PublishToGitHubDialog-BVIwcP34.js → PublishToGitHubDialog-B3H1Ht_b.js} +1 -1
  33. package/dist/public/assets/ReportBugDialogBody-C4S54OZj.js +3 -0
  34. package/dist/public/assets/{ReportBugMenuTrigger-DIsDu8Oo.js → ReportBugMenuTrigger-C4Fua-En.js} +1 -1
  35. package/dist/public/assets/{SchemaConfigEditor-DbK-MAfN.js → SchemaConfigEditor-5332QPDb.js} +1 -1
  36. package/dist/public/assets/{SearchSection--sZel4Z5.js → SearchSection-BnUt0fix.js} +1 -1
  37. package/dist/public/assets/{SessionsHost-D9CZH55k.js → SessionsHost-Bsxh7bry.js} +2 -2
  38. package/dist/public/assets/{SettingsDialogBody-D7gXHHaO.js → SettingsDialogBody-DCZKsyME.js} +2 -2
  39. package/dist/public/assets/{ShareReceiveMissDialog-C4bznAx6.js → ShareReceiveMissDialog-QL8wnPd9.js} +1 -1
  40. package/dist/public/assets/{SkillToolbarControls-C6R2N9zy.js → SkillToolbarControls-BcZX2CeU.js} +1 -1
  41. package/dist/public/assets/{SourceEditor-DQP_Juhy.js → SourceEditor-UlWcsqxg.js} +1 -1
  42. package/dist/public/assets/{SpellingSettings-B_phbPpu.js → SpellingSettings-iTpt2iMJ.js} +1 -1
  43. package/dist/public/assets/{SyncSection-BXeUGdb9.js → SyncSection-CLK-Ok07.js} +1 -1
  44. package/dist/public/assets/{SyncStatusBadge-Du08o0Dw.js → SyncStatusBadge-WvBVHl4T.js} +1 -1
  45. package/dist/public/assets/{TerminalSection--ns50F78.js → TerminalSection-CutLJjli.js} +1 -1
  46. package/dist/public/assets/{TerminalWindowApp-DjqzdE_Z.js → TerminalWindowApp-DGqFnz7v.js} +1 -1
  47. package/dist/public/assets/{TextDocEditor-DalceEBj.js → TextDocEditor-BjyByWpD.js} +1 -1
  48. package/dist/public/assets/{ThemePluginSection-B6zsULe5.js → ThemePluginSection-rP66Rthq.js} +1 -1
  49. package/dist/public/assets/{ThreadView-C5ldWBBV.js → ThreadView-C8wEr90V.js} +1 -1
  50. package/dist/public/assets/{TimelineDiffPane-C5cs7cZg.js → TimelineDiffPane-B0JYgGU4.js} +1 -1
  51. package/dist/public/assets/{comment-chips-DpZR-ILM.js → comment-chips-CvvUuYYx.js} +1 -1
  52. package/dist/public/assets/{config-provider-Cu_pQedM.js → config-provider-CD_cgB5d.js} +1 -1
  53. package/dist/public/assets/config-schema-DqXlMZId.js +1 -0
  54. package/dist/public/assets/{doc-undo-manager--bnI6mEc.js → doc-undo-manager-bsfAZGVR.js} +1 -1
  55. package/dist/public/assets/field-controls-Cm0BRErk.js +1 -0
  56. package/dist/public/assets/{field-controls-zCgHwN0u.js → field-controls-DkllO0wI.js} +1 -1
  57. package/dist/public/assets/{index-BUNWe98_.js → index-CJCUy5_9.js} +7 -7
  58. package/dist/public/assets/{lint-config-client-t7VsdRdr.js → lint-config-client-cU_8Idn6.js} +1 -1
  59. package/dist/public/assets/{lint-plugins-CR0kd8mR.js → lint-plugins-1WQvmo32.js} +1 -1
  60. package/dist/public/assets/{markdown-lint-DvPODigW.js → markdown-lint-4M923uge.js} +1 -1
  61. package/dist/public/assets/{markdownlint-rule-browser-DAxdd3Fq.js → markdownlint-rule-browser-Dc7L583w.js} +1 -1
  62. package/dist/public/assets/messages-B4jVHhO2.js +1 -0
  63. package/dist/public/assets/messages-BITpzeqs.js +1 -0
  64. package/dist/public/assets/messages-BKeG34zQ.js +1 -0
  65. package/dist/public/assets/messages-BZqwpd3T.js +1 -0
  66. package/dist/public/assets/messages-BmTgZBud.js +1 -0
  67. package/dist/public/assets/messages-CN0W5gYM.js +1 -0
  68. package/dist/public/assets/messages-CNr5eJiC.js +1 -0
  69. package/dist/public/assets/messages-D9aZoadl.js +1 -0
  70. package/dist/public/assets/messages-Dm_MM5Ai.js +1 -0
  71. package/dist/public/assets/messages-DpDh8A5J.js +1 -0
  72. package/dist/public/assets/messages-DqAgxeC0.js +1 -0
  73. package/dist/public/assets/messages-DqhCdGJ4.js +1 -0
  74. package/dist/public/assets/{messages-DAEoyeao.js → messages-DriAIEni.js} +1 -1
  75. package/dist/public/assets/{pending-receive-nav-store-XWQOt6Fr.js → pending-receive-nav-store-DfHBKcP_.js} +1 -1
  76. package/dist/public/assets/{progress-BhRFeByh.js → progress-ygACLgn7.js} +1 -1
  77. package/dist/public/assets/{saved-themes-client-BKjZgSZ2.js → saved-themes-client-fH7y_UsP.js} +1 -1
  78. package/dist/public/assets/{schema-section-jPMt1scY.js → schema-section-CbL9NEzs.js} +1 -1
  79. package/dist/public/assets/{selection-context-Cuv7GyoN.js → selection-context-BRTYZqsU.js} +1 -1
  80. package/dist/public/assets/{src-B2A6Sl6H.js → src-BhR9d8T9.js} +1 -1
  81. package/dist/public/assets/{typing-burst-detector-DsqIPsLN.js → typing-burst-detector-C9wOG-_O.js} +1 -1
  82. package/dist/public/assets/{uninstall-Br5i6Ave.js → uninstall-DFi4o8aO.js} +1 -1
  83. package/dist/public/assets/{use-activity-panel-Cn_JBE3I.js → use-activity-panel-IWlPso5j.js} +1 -1
  84. package/dist/public/assets/{use-apply-config-language-BNapdqrK.js → use-apply-config-language-D16Z3UZW.js} +2 -2
  85. package/dist/public/assets/{use-installed-clis-Cr70uJek.js → use-installed-clis-D8r4Mco8.js} +2 -2
  86. package/dist/public/assets/{use-open-skill-Dz4e3fQ5.js → use-open-skill-CQIiO2Gq.js} +1 -1
  87. package/dist/public/assets/{use-terminal-enabled-DuxifgTs.js → use-terminal-enabled-PdxJ5Cxv.js} +1 -1
  88. package/dist/public/assets/{use-timeline-entry-diff-BTyhkiHh.js → use-timeline-entry-diff-DN-ESIxG.js} +1 -1
  89. package/dist/public/index.html +23 -23
  90. package/dist/public/uninstall.html +3 -3
  91. package/dist/{registry-probes-DAls8wRU.mjs → registry-probes-DiMSHaP4.mjs} +1 -1
  92. package/dist/{removal-file-path-6F2vYdal.mjs → removal-file-path-DIhBOx7s.mjs} +1 -1
  93. package/dist/{repair-launch-json-CVRIabb_.mjs → repair-launch-json-D1rIkiZe.mjs} +1 -1
  94. package/dist/{repair-mcp-configs-DzDCKebq.mjs → repair-mcp-configs-BCWosu__.mjs} +1 -1
  95. package/dist/{src-BftPhK_7.mjs → src-CyQBNnZm.mjs} +1 -1
  96. package/dist/src-DsfvNBEU.mjs +1 -0
  97. package/dist/start-ClaAiPMR.mjs +1 -0
  98. package/dist/{start-Dw9RbsG0.mjs → start-lANOh-Wm.mjs} +2 -2
  99. package/package.json +4 -4
  100. package/dist/constants-BV_h1uxC.mjs +0 -1
  101. package/dist/init-Go0uTZtY.mjs +0 -1
  102. package/dist/loader-DLHNUQH5.mjs +0 -1
  103. package/dist/preview-DHqUdp0G.mjs +0 -1
  104. package/dist/public/assets/FeedbackForm-BkNTltaq.js +0 -1
  105. package/dist/public/assets/ManagedArtifactProperties-BeqrkzNl.js +0 -1
  106. package/dist/public/assets/ReportBugDialogBody-DNZtJiE1.js +0 -3
  107. package/dist/public/assets/config-schema-k_oWDqyF.js +0 -1
  108. package/dist/public/assets/field-controls-D-TNpiqz.js +0 -1
  109. package/dist/public/assets/messages-2kQ70cnc.js +0 -1
  110. package/dist/public/assets/messages-6iQlSalY.js +0 -1
  111. package/dist/public/assets/messages-AZwAPuM-.js +0 -1
  112. package/dist/public/assets/messages-BFOwShYO.js +0 -1
  113. package/dist/public/assets/messages-BnxHXoYK.js +0 -1
  114. package/dist/public/assets/messages-C2KqS948.js +0 -1
  115. package/dist/public/assets/messages-CZk_YdoA.js +0 -1
  116. package/dist/public/assets/messages-CszehdID.js +0 -1
  117. package/dist/public/assets/messages-D7N1vQCQ.js +0 -1
  118. package/dist/public/assets/messages-RoeLbbVl.js +0 -1
  119. package/dist/public/assets/messages-aTjgW69a.js +0 -1
  120. package/dist/public/assets/messages-jWN9SatD.js +0 -1
  121. package/dist/src-qQwctWcT.mjs +0 -1
  122. package/dist/start-BIRIWVlY.mjs +0 -1
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{Gc as t,H as n,Kc as r,Ml as i,Nl as a,U as o,Vc as s,Vu as c,W as l,_a as u,cf as d,ga as ee,gf as f,l as p,u as te,vf as m,xf as h}from"./md-manager-BGnqyqi1-CfJ8BoFr.mjs";import{$o as g,Ca as _,Do as v,Fi as y,Ii as b,Ss as x,Zn as S,ai as C,bi as w,dr as T,fi as E,kt as D,m as O,ns as k,rs as A,sr as j,ts as M,vi as N,wr as P,yi as ne}from"./dist-TBK3T5VJ.mjs";import{t as F}from"./yazl-BBz29IQN.mjs";import{Ct as re,ot as ie,st as ae}from"./init-BgqVi-9O.mjs";import{l as oe,x as se}from"./registry-probes-DAls8wRU.mjs";import{c as ce}from"./colors-r_owlCuY.mjs";import{t as le}from"./is-object-BGze3w87.mjs";import{n as ue}from"./constants-BV_h1uxC.mjs";import"./loader-B8U9rhyX.mjs";import"./preview-CCxlCT_n.mjs";import{execSync as de,spawnSync as fe}from"node:child_process";import{basename as I,dirname as L,isAbsolute as pe,join as R,relative as me,resolve as z,sep as B}from"node:path";import{closeSync as he,cpSync as ge,createWriteStream as _e,existsSync as V,lstatSync as ve,mkdirSync as H,mkdtempSync as ye,openSync as be,readFileSync as U,readSync as xe,readdirSync as W,readlinkSync as Se,realpathSync as Ce,rmSync as G,rmdirSync as we,statSync as Te,writeFileSync as K}from"node:fs";import{arch as Ee,freemem as De,homedir as q,hostname as Oe,platform as ke,release as Ae,tmpdir as je,totalmem as Me,type as Ne,uptime as Pe}from"node:os";import"node:fs/promises";import{createHash as Fe}from"node:crypto";function Ie(e,t){let n=t.map(e=>[x(e),e]);for(let t of e){let e=x(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function Le(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=Ie([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=Ie(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function Re(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`unknown`;let r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}const ze=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`audit`,`deinit`,`auth`]);function Be(e,t,n=T){if(e!==void 0&&!ze.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Ve=null;function He(e){Ve=e}function Ue(){return Ve??process.cwd()}const We=`Open Knowledge`;function Ge(e={}){let t=e.platformName??process.platform,n=e.productName??f().productName;return ie(t).join(ae({...e,platformName:t}),n)}function Ke(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=ie(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,`${f().packageName.replaceAll(`/`,``)}-updater`)}function qe(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 Je(e){let t=R(e,`state.json`);if(!V(t))return[];let n;try{n=JSON.parse(U(t,`utf-8`))}catch{return[]}return qe(n)??[]}function Ye(e){let t=R(e,`state.json`);if(!V(t))return!1;try{return qe(JSON.parse(U(t,`utf-8`)))!==null}catch{return!1}}const Xe=8192;function Ze(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 Qe(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const $e=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function et(e){return e.replace($e,`$1"[REDACTED-DEVICE-ID]"`)}function tt(e){return et(Qe(e))}const nt=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function rt(e){if(typeof e!=`string`)return null;let t=nt.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 it(e){let t=be(e,`r`);try{let e=Buffer.alloc(Xe),n=0,r=!1;for(;n<Xe;){let i=xe(t,e,n,Xe-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{he(t)}}function at(e){try{let t=it(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:rt(a)}}catch{return{kind:`unreadable`}}}function ot(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function st(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=R(e,t.name),r;try{r=Te(n).mtimeMs}catch{continue}if(r<i)continue;let c=at(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!ot(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 R(g(),`bug-reports`)}function ct(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=J(),r=`${t}-bugreport`,i=R(n,`${r}.zip`);for(let e=2;V(i);e+=1)i=R(n,`${r}-${e}.zip`);return i}function lt(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function ut(e,t){let n=R(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(R(e,`.ok`))?Fe(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function dt(){let e={timestamp:new Date().toISOString(),platform:ke(),osType:Ne(),osRelease:Ae(),hostname:`[redacted]`,uptime:Pe(),freeMem:De(),totalMem:Me(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=de(`sw_vers -productVersion 2>/dev/null`,v({encoding:`utf8`})).trim()}catch{}try{let t=R(__dirname,`..`,`..`,`package.json`);V(t)&&(e.okVersion=JSON.parse(U(t,`utf8`)).version)}catch{}return e}const ft=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function pt(e){let t=I(e);return ft.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function mt(e,t){return vt(e,t).files}const ht=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function gt(e,t=oe){let n=R(e,`${t}.ShipIt`);if(!V(n))return[];let r;try{r=W(n)}catch{return[]}return ht.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=>R(n,e.entry)))}function _t(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,-p.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>R(e,t))}catch{return[]}}function vt(e,t){if(!V(t))return{files:[],excludedByProjectSlug:0};let n=W(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>R(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(pt),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=>!pt(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function yt(e){let n=R(e,`.ok`,`local`);return V(n)?{files:[`server.lock`,`last-spawn-error.log`,t,s].map(e=>R(n,e)).filter(e=>V(e))}:{files:[]}}function bt(e){let t=R(e,`.ok`,`local`,`logs`);return V(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>R(t,e)).filter(e=>V(e))}:{files:[]}}function xt(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#${Fe(`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 St(e){let t=e.revealDocNames?e.content:xt(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`);St({zipfile:e.zipfile,name:`${e.prefix}/${I(t)}`,content:t.endsWith(`.ips`)?tt(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 Ct(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??R(g(),`logs`),s=t.projectDir?ut(t.projectDir,i):null;H(L(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=dt();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=vt(s,o),{files:d}=t.projectDir?yt(t.projectDir):{files:[]},{files:f}=t.projectDir?bt(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let h=[],_=[],{ZipFile:v}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),y=new v;Y({zipfile:y,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i}),Y({zipfile:y,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i}),Y({zipfile:y,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i}),Y({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:te,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i}),Y({zipfile:y,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i});for(let e of t.extraFiles??[])try{let t=U(e.sourcePath),n=`extra/${e.zipName??I(e.sourcePath)}`;y.addBuffer(t,n),_.push(n);let r=lt(e,n);r!==null&&h.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&St({zipfile:y,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:_,redactions:h});let b=new Set(m.map(e=>`diagnostic-reports/${I(e)}`)),x=_.filter(e=>b.has(e)),S=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Ze(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(c,null,2);y.addBuffer(Buffer.from(C,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let w={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:_,redactions:h,sysinfo:c};y.addBuffer(Buffer.from(JSON.stringify(w,null,2),`utf8`),`MANIFEST.json`);let T=h.reduce((e,t)=>e+t.lineCount,0),E=new Set(p.map(e=>`logs/${I(e)}`)),D=_.filter(e=>E.has(e)),O=new Set((t.bugReportLedgerFiles??[]).map(e=>`${te}/${I(e)}`)),k=_.filter(e=>O.has(e)),A=s?_.filter(e=>e.startsWith(`logs/`)&&!pt(e)&&!E.has(e)):[],j=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.`]:[],M=j.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...j]:[`Redaction was disabled for this bundle; file contents are unmodified.`],N=[`# Bug Report Bundle`,``,`Generated: ${w.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${w.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...A.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:`,...A.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}`),``]:[],...k.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:`,...k.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${ee.join(`, `)}`,T>0?`${T} line(s) were scrubbed across ${h.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...j,``,`This bundle is safe to attach to a GitHub issue.`]:M].join(`
1
+ import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{Gc as t,H as n,Kc as r,Ml as i,Nl as a,U as o,Vc as s,Vu as c,W as l,_a as u,cf as d,ga as ee,gf as f,l as p,u as te,vf as m,xf as h}from"./md-manager-BGnqyqi1-CfJ8BoFr.mjs";import{$o as g,Ca as _,Do as v,Fi as y,Ii as b,Ss as x,Zn as S,ai as C,bi as w,dr as T,fi as E,kt as D,m as O,ns as k,rs as A,sr as j,ts as M,vi as N,wr as P,yi as ne}from"./dist-TBK3T5VJ.mjs";import{t as F}from"./yazl-BBz29IQN.mjs";import{Ct as re,ot as ie,st as ae}from"./init-M54rry8h.mjs";import{l as oe,x as se}from"./registry-probes-DiMSHaP4.mjs";import{c as ce}from"./colors-r_owlCuY.mjs";import{t as le}from"./is-object-BGze3w87.mjs";import{n as ue}from"./constants-DB1LQ7ZB.mjs";import"./loader-C7uN3Y0b.mjs";import"./preview-B-Vnnn1H.mjs";import{execSync as de,spawnSync as fe}from"node:child_process";import{basename as I,dirname as L,isAbsolute as pe,join as R,relative as me,resolve as z,sep as B}from"node:path";import{closeSync as he,cpSync as ge,createWriteStream as _e,existsSync as V,lstatSync as ve,mkdirSync as H,mkdtempSync as ye,openSync as be,readFileSync as U,readSync as xe,readdirSync as W,readlinkSync as Se,realpathSync as Ce,rmSync as G,rmdirSync as we,statSync as Te,writeFileSync as K}from"node:fs";import{arch as Ee,freemem as De,homedir as q,hostname as Oe,platform as ke,release as Ae,tmpdir as je,totalmem as Me,type as Ne,uptime as Pe}from"node:os";import"node:fs/promises";import{createHash as Fe}from"node:crypto";function Ie(e,t){let n=t.map(e=>[x(e),e]);for(let t of e){let e=x(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function Le(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=Ie([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=Ie(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function Re(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`unknown`;let r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}const ze=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`audit`,`deinit`,`auth`]);function Be(e,t,n=T){if(e!==void 0&&!ze.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Ve=null;function He(e){Ve=e}function Ue(){return Ve??process.cwd()}const We=`Open Knowledge`;function Ge(e={}){let t=e.platformName??process.platform,n=e.productName??f().productName;return ie(t).join(ae({...e,platformName:t}),n)}function Ke(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=ie(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,`${f().packageName.replaceAll(`/`,``)}-updater`)}function qe(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 Je(e){let t=R(e,`state.json`);if(!V(t))return[];let n;try{n=JSON.parse(U(t,`utf-8`))}catch{return[]}return qe(n)??[]}function Ye(e){let t=R(e,`state.json`);if(!V(t))return!1;try{return qe(JSON.parse(U(t,`utf-8`)))!==null}catch{return!1}}const Xe=8192;function Ze(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 Qe(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const $e=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function et(e){return e.replace($e,`$1"[REDACTED-DEVICE-ID]"`)}function tt(e){return et(Qe(e))}const nt=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function rt(e){if(typeof e!=`string`)return null;let t=nt.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 it(e){let t=be(e,`r`);try{let e=Buffer.alloc(Xe),n=0,r=!1;for(;n<Xe;){let i=xe(t,e,n,Xe-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{he(t)}}function at(e){try{let t=it(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:rt(a)}}catch{return{kind:`unreadable`}}}function ot(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function st(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=R(e,t.name),r;try{r=Te(n).mtimeMs}catch{continue}if(r<i)continue;let c=at(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!ot(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 R(g(),`bug-reports`)}function ct(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=J(),r=`${t}-bugreport`,i=R(n,`${r}.zip`);for(let e=2;V(i);e+=1)i=R(n,`${r}-${e}.zip`);return i}function lt(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function ut(e,t){let n=R(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(R(e,`.ok`))?Fe(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function dt(){let e={timestamp:new Date().toISOString(),platform:ke(),osType:Ne(),osRelease:Ae(),hostname:`[redacted]`,uptime:Pe(),freeMem:De(),totalMem:Me(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=de(`sw_vers -productVersion 2>/dev/null`,v({encoding:`utf8`})).trim()}catch{}try{let t=R(__dirname,`..`,`..`,`package.json`);V(t)&&(e.okVersion=JSON.parse(U(t,`utf8`)).version)}catch{}return e}const ft=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function pt(e){let t=I(e);return ft.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function mt(e,t){return vt(e,t).files}const ht=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function gt(e,t=oe){let n=R(e,`${t}.ShipIt`);if(!V(n))return[];let r;try{r=W(n)}catch{return[]}return ht.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=>R(n,e.entry)))}function _t(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,-p.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>R(e,t))}catch{return[]}}function vt(e,t){if(!V(t))return{files:[],excludedByProjectSlug:0};let n=W(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>R(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(pt),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=>!pt(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function yt(e){let n=R(e,`.ok`,`local`);return V(n)?{files:[`server.lock`,`last-spawn-error.log`,t,s].map(e=>R(n,e)).filter(e=>V(e))}:{files:[]}}function bt(e){let t=R(e,`.ok`,`local`,`logs`);return V(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>R(t,e)).filter(e=>V(e))}:{files:[]}}function xt(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#${Fe(`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 St(e){let t=e.revealDocNames?e.content:xt(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`);St({zipfile:e.zipfile,name:`${e.prefix}/${I(t)}`,content:t.endsWith(`.ips`)?tt(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 Ct(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??R(g(),`logs`),s=t.projectDir?ut(t.projectDir,i):null;H(L(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=dt();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=vt(s,o),{files:d}=t.projectDir?yt(t.projectDir):{files:[]},{files:f}=t.projectDir?bt(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let h=[],_=[],{ZipFile:v}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),y=new v;Y({zipfile:y,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i}),Y({zipfile:y,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i}),Y({zipfile:y,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i}),Y({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:te,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i}),Y({zipfile:y,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:_,redactions:h,logger:i});for(let e of t.extraFiles??[])try{let t=U(e.sourcePath),n=`extra/${e.zipName??I(e.sourcePath)}`;y.addBuffer(t,n),_.push(n);let r=lt(e,n);r!==null&&h.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&St({zipfile:y,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:_,redactions:h});let b=new Set(m.map(e=>`diagnostic-reports/${I(e)}`)),x=_.filter(e=>b.has(e)),S=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Ze(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(c,null,2);y.addBuffer(Buffer.from(C,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let w={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:_,redactions:h,sysinfo:c};y.addBuffer(Buffer.from(JSON.stringify(w,null,2),`utf8`),`MANIFEST.json`);let T=h.reduce((e,t)=>e+t.lineCount,0),E=new Set(p.map(e=>`logs/${I(e)}`)),D=_.filter(e=>E.has(e)),O=new Set((t.bugReportLedgerFiles??[]).map(e=>`${te}/${I(e)}`)),k=_.filter(e=>O.has(e)),A=s?_.filter(e=>e.startsWith(`logs/`)&&!pt(e)&&!E.has(e)):[],j=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.`]:[],M=j.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...j]:[`Redaction was disabled for this bundle; file contents are unmodified.`],N=[`# Bug Report Bundle`,``,`Generated: ${w.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${w.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...A.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:`,...A.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}`),``]:[],...k.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:`,...k.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${ee.join(`, `)}`,T>0?`${T} line(s) were scrubbed across ${h.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...j,``,`This bundle is safe to attach to a GitHub issue.`]:M].join(`
2
2
  `);y.addBuffer(Buffer.from(N,`utf8`),`README.md`),y.end();let P=_e(r);return y.outputStream.pipe(P),await new Promise((e,t)=>{P.on(`close`,e),P.on(`error`,t)}),i?.info({bundlePath:r,fileCount:_.length,redactionCount:T},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:_,redactions:h,redactedLineCount:T,generatedAt:w.generatedAt}}}var wt=c(),Tt=e(F(),1),X=e(ce(),1);function Et(e){let t=A(`user`,e,e);return M({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function Dt({home:e=q(),env:t=process.env}={}){let n=Et(e),{override:r,preferenceList:o}=k(t),{locale:s,source:c}=Le({override:r,storedPreference:n,supportedLocales:a,preferenceList:o,autoDetectableLocales:i});return{preference:n,locale:s,source:c,systemLanguages:o}}function Ot(e){let t=new Set([e]);try{t.add(Ce.native(e))}catch{return[e].filter(e=>e.length>0)}return[...t].filter(e=>e.length>0).sort((e,t)=>t.length-e.length)}function kt(e,t){let n=e;for(let e of t)n.includes(e)&&(n=n.split(e).join(`<CONTENT_DIR>`));return n}function At(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e,t){if(typeof e==`string`)return kt(e,t.contentDirSpellings);if(Array.isArray(e))return e.map(e=>Z(e,t));if(!At(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Z(i,t);return n}function jt(e,t){let n=U(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
3
3
  `),i=n.split(`
4
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(`
@@ -0,0 +1 @@
1
+ import"./md-manager-BGnqyqi1-CfJ8BoFr.mjs";import"./src-CyQBNnZm.mjs";import"./init-M54rry8h.mjs";import"./registry-probes-DiMSHaP4.mjs";import"./start-lANOh-Wm.mjs";import{n as e}from"./loader-C7uN3Y0b.mjs";import"./preview-B-Vnnn1H.mjs";import"./repair-mcp-configs-BCWosu__.mjs";export{e as loadConfig};
@@ -0,0 +1 @@
1
+ import{S as e,m as t,p as n,r}from"./start-lANOh-Wm.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
@@ -1,5 +1,5 @@
1
- import{F as e,S as t,X as n,Z as r,hl as i,i as a,sd as o}from"./md-manager-BGnqyqi1-CfJ8BoFr.mjs";import{Pi as s,Si as c,k as l,ms as u,oi as d,rs as f,ts as p,vi as m}from"./dist-TBK3T5VJ.mjs";import{Ct as h,L as g,Tt as _,X as v,b as y,ut as b,wt as x,y as S,z as C}from"./init-BgqVi-9O.mjs";import{a as w,c as T,d as E,f as D,i as ee,n as O,o as k,p as A,r as j,s as M,t as N,u as P,y as te}from"./registry-probes-DAls8wRU.mjs";import{n as F}from"./constants-BV_h1uxC.mjs";import{execFileSync as I,spawn as L}from"node:child_process";import{basename as R,dirname as z,resolve as B}from"node:path";import{existsSync as V,realpathSync as ne}from"node:fs";import{homedir as re,tmpdir as ie}from"node:os";import{rm as ae}from"node:fs/promises";import{setTimeout as oe}from"node:timers/promises";const se=[`/opt/homebrew/bin/gh`,`/usr/local/bin/gh`,`/opt/local/bin/gh`,`/snap/bin/gh`,`/usr/bin/gh`],ce={encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`],timeout:5e3,windowsHide:!0};function le(e,t={}){let{login:n}=t,r=t._exec??I,i=H(t._fileExists??V),a=e?[`--hostname`,e]:[];if(n){let e=U(r,i,[`auth`,`token`,...a,`--user`,n]);if(e)return{available:!0,token:e,resolvedLogin:n,fallback:!1}}let o=U(r,i,[`auth`,`token`,...a]);return o?n?{available:!0,token:o,fallback:!0}:{available:!0,token:o}:{available:!1}}function H(e){return[`gh`,...se.filter(e)]}function U(e,t,n){for(let r of t)try{let t=e(r,n,ce).toString().trim();if(t.length>0)return t}catch{}}function W(e,t={}){let n=t._exec??I,r=H(t._fileExists??V),i=[`auth`,`status`,...e?[`--hostname`,e]:[]],a=U(n,r,[...i,`--json`,`hosts`]);if(a!==void 0){let t=ue(a,e);if(t)return t}let o=U(n,r,i);if(o!==void 0){let e=he(o);if(e.length>0)return e}}function G(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function ue(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 de=/Logged in to \S+ account (\S+) \(/,fe=/(?:Failed to log in to|Timeout trying to log in to) \S+/,pe=/^\s*-\s*Active account:\s*true\s*$/,me=/\u001b\[[0-9;]*m/g;function he(e){let t=[],n;for(let r of e.split(`
2
- `)){let e=r.replace(me,``),i=de.exec(e)?.[1];if(i){n={login:i,active:!1},t.push(n);continue}if(fe.test(e)){n=void 0;continue}n&&pe.test(e)&&(n.active=!0)}return t}const ge={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){u(`agent-integrations-apply`).warn({editor:e,path:t,reason:n},`skill write failed`)}function Y(){return{action:`skipped-unsupported`,errorId:`no-writer`}}function _e(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`}}}function ve(e,t,n,r,i){let a=v[e];try{let o=k(a,t,n,r,i);return o.kind===`removed`&&o.trustDetail&&u(`agent-integrations-apply`).warn({editor:e,path:r??a.configPath(t,n),trust:o.trust,trustDetail:o.trustDetail},`MCP config removal retained Pi folder trust`),_e(o.kind)}catch(i){return u(`agent-integrations-apply`).warn({editor:e,path:r??a.configPath(t,n),reason:i instanceof Error?i.message:String(i)},`MCP config removal failed`),K()}}async function ye(e,t,n){if(v[e].scope!==`global`)return q();if(n===`absent`)return ve(e,``,t.home,void 0,t.env);let r=(await y({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 be(e,t,n){let r=v[e].projectConfigPath?.(t.cwd);if(r===void 0)return q();if(n===`absent`)return ve(e,t.cwd,t.home,r,t.env);let i=S(v[e],t.cwd,ge,void 0,r);switch(i.action){case`written`:case`overwritten`:return{action:i.action};case`declined`:return{action:`declined`,errorId:`write-declined`};default:return K()}}function xe(e,t,n){let r=t.home??re();if(n===`absent`){let t=j(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=w(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 Se(e,t,n){if(n===`absent`){let n=g(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=C(v[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 Ce(e){return t=>{if(t.pathId===void 0)return Y();let n=o(t.pathId);if(n===null||n.kind===`central-skill-store`)return Y();switch(n.kind){case`editor-user-config`:return ye(n.editor,e,t.desired);case`editor-project-config`:return be(n.editor,e,t.desired);case`editor-project-skill-root`:return Se(n.editor,e,t.desired);case`editor-user-skill-root`:return xe(n.editor,e,t.desired)}}}function we(e,t){return e.bind?.[0]??t.HOST??`127.0.0.1`}function Te(e){if(e===`server`)return e;throw new x(`--only must be 'server'`)}function Ee(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 De(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 Oe(e){if(e===`off`)return`off`;if(!i.test(e))throw new x(`--idle-shutdown must be 'off' or a duration like 90s, 30m, 2h`);return e}function ke(e){return e===`localhost`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}function Ae(e){return!e.flagBindSet&&!e.okBindSet&&e.hostEnvSet&&e.fileBindCount>1}function je(e){return!e.openBrowser||e.ephemeral||e.only===`server`||!e.servesUi?!1:(e.explicitOn||ke(e.host))&&e.isTTY}function Me(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 Ne(e){return Me(`--external-url`,e)}function Pe(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 ${l}* 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??ie,r=t.realpathFn??ne,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 $(e,t,n=e=>ae(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 ${l}* dirs under the OS temp dir are removed on ephemeral teardown\n`)}}}function Fe(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 Ie(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.idleThresholdMs===void 0?18e5:e.idleThresholdMs,{existsSync:o,mkdirSync:l}=await import(`node:fs`),{basename:u,dirname:f,resolve:p}=await import(`node:path`),{bootServer:m,createEphemeralProjectDir:h,getLogger:g,resolveContentDir:_,resolveLockDir:v,seedEphemeralProjectDir:y,waitForServerLockDrain:x}=await import(`./dist-CdLPigWw.mjs`),S=e.log??g(`start`),C=e.singleFile!==void 0,w=C?s(e.singleFile).canonicalFilePath:void 0,E=w?f(w):void 0,D=w?u(w):void 0,k,A=!1;if(E!==void 0){if(e.projectDir!==void 0){if(k=e.projectDir,!Q(k))throw new Z(k);o(p(k,`.ok`,`config.yml`))||y(k,E)}else k=h(E),A=!0}let j=async()=>{if(!(!A||k===void 0)){if(!Q(k)){S.warn({ephemeralProjectDir:k},`[start] refusing to reap self-provisioned ephemeral dir: no longer resolves to an ok-ephemeral-* temp dir`);return}try{await ae(k,{recursive:!0,force:!0})}catch(e){S.warn({err:e,ephemeralProjectDir:k},`[start] failed to reap self-provisioned ephemeral temp dir`)}}},P=k;if(!C){if(!i&&!d(n))throw new X(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{e.severity===`info`?S.debug({event:e},`[start] reclaim sweep event`):S.warn({event:e},`[start] reclaim sweep reported a problem`)};try{let i=(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-DzDCKebq.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&&S.warn({unhealed:i},`[start] reclaim sweep left entries it could not heal`)}catch(e){S.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-CVRIabb_.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}}let F=E??_(t,n);!C&&!o(F)&&(l(F,{recursive:!0}),S.info({contentDir:F},`Created content directory`));let I=te(),L=c(),R;try{{let e=v(k??n),t=Date.now(),r=await x(e);r!==`no-drain`&&S.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`)}R=await m({config:t,contentDir:F,projectDir:k??n,contentRoot:C?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:le,detectGhAccounts:W,tokenStore:I,embeddingsKeyStore:L,mcpTomlEditor:b(),...C?{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)=>O(e,t),probePiAcpBridge:e=>T(e),ensurePiAcpBridge:(e,t)=>M(e,void 0,void 0,void 0,t),agentIntegrations:(()=>{let e={cwd:k??n,home:re(),env:process.env};return{probe:N(e),execute:Ce(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 Fe(P===void 0?n:$(n,P),{log:S,exit:e.idleExit})},log:S,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{},...e.terminalAuthAvailable===!0?{terminalAuthAvailable:!0}:{}})}catch(e){throw await j(),e}let z=R.destroy,B=A?async()=>{try{await z()}finally{await j()}}:z;return{httpServer:R.httpServer,destroy:B,lockDir:R.lockDir,contentDir:F,port:R.port,ready:R.ready,degraded:R.degraded}}function Le(e,t,n=()=>p({absPath:f(`user`,process.cwd()),sideline:!1,warn:()=>{}}).value){return t===void 0?e:n()}function Re(e){if(e===`browser`||e===`app`)return e;throw new x(`--mode must be 'browser' or 'app'`)}function ze(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function Be(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 Ve(i,o){let s=Le(i,o.singleFile),c=ze(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=Pe(m);let h;try{h=n(process.env)}catch(e){throw e instanceof a&&(console.error(f(e.message)),process.exit(78)),e}for(let e of h.diagnostics)console.warn(p(`[config] ${e.message}`));let g=t(s,h.layer),_=h.overrides.some(e=>e.envVar===`OK_BIND`),v=o.bind!==void 0&&o.bind.length>0?o.bind:void 0,y=process.env.HOST,b=y!==void 0&&y.trim()!==``?y:void 0,x=r(g),S=v??(_||b===void 0?[...x.bind]:[b]);Ae({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=o.externalUrl,E=r(t(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(`
1
+ import{F as e,S as t,X as n,Z as r,hl as i,i as a,sd as o}from"./md-manager-BGnqyqi1-CfJ8BoFr.mjs";import{Pi as s,Si as c,k as l,ms as u,oi as d,rs as f,ts as p,vi as m}from"./dist-TBK3T5VJ.mjs";import{Ct as h,L as g,Tt as _,X as v,b as y,ut as b,wt as x,y as S,z as C}from"./init-M54rry8h.mjs";import{a as w,c as T,d as E,f as D,i as ee,n as O,o as k,p as A,r as j,s as M,t as N,u as P,y as te}from"./registry-probes-DiMSHaP4.mjs";import{n as F}from"./constants-DB1LQ7ZB.mjs";import{execFileSync as I,spawn as L}from"node:child_process";import{basename as R,dirname as z,resolve as B}from"node:path";import{existsSync as V,realpathSync as ne}from"node:fs";import{homedir as re,tmpdir as ie}from"node:os";import{rm as ae}from"node:fs/promises";import{setTimeout as oe}from"node:timers/promises";const se=[`/opt/homebrew/bin/gh`,`/usr/local/bin/gh`,`/opt/local/bin/gh`,`/snap/bin/gh`,`/usr/bin/gh`],ce={encoding:`utf-8`,stdio:[`ignore`,`pipe`,`pipe`],timeout:5e3,windowsHide:!0};function le(e,t={}){let{login:n}=t,r=t._exec??I,i=H(t._fileExists??V),a=e?[`--hostname`,e]:[];if(n){let e=U(r,i,[`auth`,`token`,...a,`--user`,n]);if(e)return{available:!0,token:e,resolvedLogin:n,fallback:!1}}let o=U(r,i,[`auth`,`token`,...a]);return o?n?{available:!0,token:o,fallback:!0}:{available:!0,token:o}:{available:!1}}function H(e){return[`gh`,...se.filter(e)]}function U(e,t,n){for(let r of t)try{let t=e(r,n,ce).toString().trim();if(t.length>0)return t}catch{}}function W(e,t={}){let n=t._exec??I,r=H(t._fileExists??V),i=[`auth`,`status`,...e?[`--hostname`,e]:[]],a=U(n,r,[...i,`--json`,`hosts`]);if(a!==void 0){let t=ue(a,e);if(t)return t}let o=U(n,r,i);if(o!==void 0){let e=he(o);if(e.length>0)return e}}function G(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function ue(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 de=/Logged in to \S+ account (\S+) \(/,fe=/(?:Failed to log in to|Timeout trying to log in to) \S+/,pe=/^\s*-\s*Active account:\s*true\s*$/,me=/\u001b\[[0-9;]*m/g;function he(e){let t=[],n;for(let r of e.split(`
2
+ `)){let e=r.replace(me,``),i=de.exec(e)?.[1];if(i){n={login:i,active:!1},t.push(n);continue}if(fe.test(e)){n=void 0;continue}n&&pe.test(e)&&(n.active=!0)}return t}const ge={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){u(`agent-integrations-apply`).warn({editor:e,path:t,reason:n},`skill write failed`)}function Y(){return{action:`skipped-unsupported`,errorId:`no-writer`}}function _e(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`}}}function ve(e,t,n,r,i){let a=v[e];try{let o=k(a,t,n,r,i);return o.kind===`removed`&&o.trustDetail&&u(`agent-integrations-apply`).warn({editor:e,path:r??a.configPath(t,n),trust:o.trust,trustDetail:o.trustDetail},`MCP config removal retained Pi folder trust`),_e(o.kind)}catch(i){return u(`agent-integrations-apply`).warn({editor:e,path:r??a.configPath(t,n),reason:i instanceof Error?i.message:String(i)},`MCP config removal failed`),K()}}async function ye(e,t,n){if(v[e].scope!==`global`)return q();if(n===`absent`)return ve(e,``,t.home,void 0,t.env);let r=(await y({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 be(e,t,n){let r=v[e].projectConfigPath?.(t.cwd);if(r===void 0)return q();if(n===`absent`)return ve(e,t.cwd,t.home,r,t.env);let i=S(v[e],t.cwd,ge,void 0,r);switch(i.action){case`written`:case`overwritten`:return{action:i.action};case`declined`:return{action:`declined`,errorId:`write-declined`};default:return K()}}function xe(e,t,n){let r=t.home??re();if(n===`absent`){let t=j(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=w(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 Se(e,t,n){if(n===`absent`){let n=g(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=C(v[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 Ce(e){return t=>{if(t.pathId===void 0)return Y();let n=o(t.pathId);if(n===null||n.kind===`central-skill-store`)return Y();switch(n.kind){case`editor-user-config`:return ye(n.editor,e,t.desired);case`editor-project-config`:return be(n.editor,e,t.desired);case`editor-project-skill-root`:return Se(n.editor,e,t.desired);case`editor-user-skill-root`:return xe(n.editor,e,t.desired)}}}function we(e,t){return e.bind?.[0]??t.HOST??`127.0.0.1`}function Te(e){if(e===`server`)return e;throw new x(`--only must be 'server'`)}function Ee(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 De(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 Oe(e){if(e===`off`)return`off`;if(!i.test(e))throw new x(`--idle-shutdown must be 'off' or a duration like 90s, 30m, 2h`);return e}function ke(e){return e===`localhost`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}function Ae(e){return!e.flagBindSet&&!e.okBindSet&&e.hostEnvSet&&e.fileBindCount>1}function je(e){return!e.openBrowser||e.ephemeral||e.only===`server`||!e.servesUi?!1:(e.explicitOn||ke(e.host))&&e.isTTY}function Me(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 Ne(e){return Me(`--external-url`,e)}function Pe(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 ${l}* 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??ie,r=t.realpathFn??ne,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 $(e,t,n=e=>ae(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 ${l}* dirs under the OS temp dir are removed on ephemeral teardown\n`)}}}function Fe(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 Ie(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.idleThresholdMs===void 0?18e5:e.idleThresholdMs,{existsSync:o,mkdirSync:l}=await import(`node:fs`),{basename:u,dirname:f,resolve:p}=await import(`node:path`),{bootServer:m,createEphemeralProjectDir:h,getLogger:g,resolveContentDir:_,resolveLockDir:v,seedEphemeralProjectDir:y,waitForServerLockDrain:x}=await import(`./dist-CdLPigWw.mjs`),S=e.log??g(`start`),C=e.singleFile!==void 0,w=C?s(e.singleFile).canonicalFilePath:void 0,E=w?f(w):void 0,D=w?u(w):void 0,k,A=!1;if(E!==void 0){if(e.projectDir!==void 0){if(k=e.projectDir,!Q(k))throw new Z(k);o(p(k,`.ok`,`config.yml`))||y(k,E)}else k=h(E),A=!0}let j=async()=>{if(!(!A||k===void 0)){if(!Q(k)){S.warn({ephemeralProjectDir:k},`[start] refusing to reap self-provisioned ephemeral dir: no longer resolves to an ok-ephemeral-* temp dir`);return}try{await ae(k,{recursive:!0,force:!0})}catch(e){S.warn({err:e,ephemeralProjectDir:k},`[start] failed to reap self-provisioned ephemeral temp dir`)}}},P=k;if(!C){if(!i&&!d(n))throw new X(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{e.severity===`info`?S.debug({event:e},`[start] reclaim sweep event`):S.warn({event:e},`[start] reclaim sweep reported a problem`)};try{let i=(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-BCWosu__.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&&S.warn({unhealed:i},`[start] reclaim sweep left entries it could not heal`)}catch(e){S.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-D1rIkiZe.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){S.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}}let F=E??_(t,n);!C&&!o(F)&&(l(F,{recursive:!0}),S.info({contentDir:F},`Created content directory`));let I=te(),L=c(),R;try{{let e=v(k??n),t=Date.now(),r=await x(e);r!==`no-drain`&&S.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`)}R=await m({config:t,contentDir:F,projectDir:k??n,contentRoot:C?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:le,detectGhAccounts:W,tokenStore:I,embeddingsKeyStore:L,mcpTomlEditor:b(),...C?{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)=>O(e,t),probePiAcpBridge:e=>T(e),ensurePiAcpBridge:(e,t)=>M(e,void 0,void 0,void 0,t),agentIntegrations:(()=>{let e={cwd:k??n,home:re(),env:process.env};return{probe:N(e),execute:Ce(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 Fe(P===void 0?n:$(n,P),{log:S,exit:e.idleExit})},log:S,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{},...e.terminalAuthAvailable===!0?{terminalAuthAvailable:!0}:{}})}catch(e){throw await j(),e}let z=R.destroy,B=A?async()=>{try{await z()}finally{await j()}}:z;return{httpServer:R.httpServer,destroy:B,lockDir:R.lockDir,contentDir:F,port:R.port,ready:R.ready,degraded:R.degraded}}function Le(e,t,n=()=>p({absPath:f(`user`,process.cwd()),sideline:!1,warn:()=>{}}).value){return t===void 0?e:n()}function Re(e){if(e===`browser`||e===`app`)return e;throw new x(`--mode must be 'browser' or 'app'`)}function ze(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function Be(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 Ve(i,o){let s=Le(i,o.singleFile),c=ze(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=Pe(m);let h;try{h=n(process.env)}catch(e){throw e instanceof a&&(console.error(f(e.message)),process.exit(78)),e}for(let e of h.diagnostics)console.warn(p(`[config] ${e.message}`));let g=t(s,h.layer),_=h.overrides.some(e=>e.envVar===`OK_BIND`),v=o.bind!==void 0&&o.bind.length>0?o.bind:void 0,y=process.env.HOST,b=y!==void 0&&y.trim()!==``?y:void 0,x=r(g),S=v??(_||b===void 0?[...x.bind]:[b]);Ae({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=o.externalUrl,E=r(t(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
3
  `)))}let D=o.port===void 0?void 0:Number(o.port),ee=h.overrides.find(e=>e.envVar===`PORT`)?.value,O=D??ee??s.server?.port,k=De({explicitDir:o.reactShellDistDir,only:o.only,findBundledDir:Ee}),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 Ie({config:s,cwd:m,host:C,port:O,bind:w,...o.serveContentAssets===void 0?{}:{serveContentAssets:o.serveContentAssets},...A?{reactShellDistDir:A}:{},idleThresholdMs:e(o.idleShutdown??E.idleShutdown),serverRuntime:E,...o.singleFile?{singleFile:o.singleFile}:{},...o.projectDir?{projectDir:o.projectDir}:{},...o.terminalAuth===!0?{terminalAuthAvailable:!0}:{}})}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-CdLPigWw.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||e instanceof t.DocumentDurabilityStateError)&&(console.error(f(e.message)),process.exit(1)),We(e,t,m)){let e=t.resolveLockDir(m),n=null;try{n=await He({readServerLock:()=>t.readServerLock(e),now:Date.now,sleep:e=>oe(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]=Ue(n);console.log(u(e));for(let e of t)console.log(d(e));process.exit(0)}}let n=Ge(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]=Be(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 P=`http://${C.includes(`:`)&&!C.startsWith(`[`)?`[${C}]`:C}:${j.port}`,te=C===`0.0.0.0`||C===`::`?`http://0.0.0.0:${j.port}`:void 0,I=P;console.log(l({name:`open-knowledge`,version:F,localUrl:I,networkUrl:te,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let L={"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=L[e]??`${e} (check server logs for details)`;console.warn(` ${p(`⚠`)} ${p(e)}: ${d(t)}`)}console.log()}if(je({openBrowser:o.openBrowser!==!1&&E.openBrowser,explicitOn:o.openBrowser!==!1&&g.server?.openBrowser===!0,host:C,isTTY:process.stdout.isTTY===!0,ephemeral:o.singleFile!==void 0,only:o.only,servesUi:A!==void 0})){let{openBrowser:e}=await import(`./open-browser-N2KLYQEK.mjs`);e(I)}}).catch(e=>{console.error(` ${f(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}async function He(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:m(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 Ue(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 We(e,t,n){let r=t.ServerLockCollisionError;if(r!==void 0&&e instanceof r)return!0;let i=t.ServerAuthorityCollisionError;if(i===void 0||!(e instanceof i))return!1;try{return e.existing.scope.kind===`tree`&&ne.native(n)===e.existing.projectDir}catch{return!1}}function Ge(e,t,n){let r=n.ServerAuthorityCollisionError;if(r!==void 0&&e instanceof r)return e.message;let i=n.ServerAuthorityRegistryError;if(i!==void 0&&e instanceof i)return e.message;let a=n.ServerLockCollisionError;if(a===void 0||!(e instanceof a))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 Ke(e){return new h(`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)`,Te).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)`,Oe).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,Re).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 _(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).hideHelp()).addOption(new _(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).hideHelp()).addOption(new _(`--terminal-auth`,`Tell in-app agents that this server's client can run terminal sign-ins (the desktop app passes it when it has a terminal)`).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).`,Ne).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
4
  `),process.exit(2)),t.projectDir!==void 0&&t.singleFile===void 0&&(process.stderr.write(`error: option '--project-dir' requires '--single-file'
5
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=E(P());if(n.available){D({spawn:L},n);return}console.error(A(n.reason)),process.exit(1)}await Ve(n,t)})}export{Ge as C,W as D,le as E,Ke as S,Fe as T,ze as _,Ue as a,je as b,Q as c,Oe as d,Te as f,Le as g,He as h,Pe as i,We as l,we as m,X as n,Be as o,Ee as p,Ie as r,ke as s,Z as t,Ne as u,De as v,$ as w,Ae as x,Ve as y};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/open-knowledge",
3
- "version": "0.84.0-beta.8",
3
+ "version": "0.84.0-beta.9",
4
4
  "description": "Local-first, agent-friendly Markdown knowledge base with a cross-platform CLI and web editor",
5
5
  "keywords": [
6
6
  "knowledge-base",
@@ -65,10 +65,10 @@
65
65
  "@parcel/watcher": "^2.5.6"
66
66
  },
67
67
  "devDependencies": {
68
- "@inkeep/open-knowledge-app": "0.84.0-beta.8",
69
- "@inkeep/open-knowledge-core": "0.84.0-beta.8",
68
+ "@inkeep/open-knowledge-app": "0.84.0-beta.9",
69
+ "@inkeep/open-knowledge-core": "0.84.0-beta.9",
70
70
  "@inkeep/open-knowledge-native-config": "0.0.0",
71
- "@inkeep/open-knowledge-server": "0.84.0-beta.8",
71
+ "@inkeep/open-knowledge-server": "0.84.0-beta.9",
72
72
  "@types/node": "^24.7.0",
73
73
  "@types/proper-lockfile": "^4.1.4",
74
74
  "@types/yazl": "^3.3.1",
@@ -1 +0,0 @@
1
- import"./md-manager-BGnqyqi1-CfJ8BoFr.mjs";var e=`0.84.0-beta.8`;const t=`config.yml`,n=e;export{n,t};
@@ -1 +0,0 @@
1
- import"./dist-TBK3T5VJ.mjs";import{_ as e}from"./init-BgqVi-9O.mjs";export{e as runInit};
@@ -1 +0,0 @@
1
- import{n as e}from"./loader-B8U9rhyX.mjs";export{e as loadConfig};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./preview-CCxlCT_n.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1 +0,0 @@
1
- import{t as e}from"./index-BUNWe98_.js";export{e as FeedbackForm};
@@ -1 +0,0 @@
1
- import{t as e}from"./ManagedArtifactProperties-DZWmH30D.js";export{e as ManagedArtifactProperties};
@@ -1,3 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o,r as ee,t as s}from"./collapsible-BKbszYZV.js";import{t as c}from"./checkbox-CKD8LETI.js";import{t as l}from"./button-DzgjsZzC.js";import{c as u}from"./schemas-B93JY9Ef.js";import{t as d}from"./createLucideIcon-DdBzwsHe.js";import{t as f}from"./chevron-right-Bofu4lib.js";import{t as p}from"./circle-alert-eBm4JPxY.js";import{t as m}from"./spinner-Bx8xD6f8.js";import{a as h,r as te,t as g}from"./bug-report-send-manager-Btm-R8Ei.js";import{n as _}from"./BugReportHistory-NHfvhaO9.js";import{t as v}from"./triangle-alert-BXrUEeRU.js";import{t as y}from"./badge-DmdA1C7r.js";import{a as b,c as ne,i as re,l as ie,n as ae,o as oe,s as se,t as ce}from"./dialog-BJEjKJjL.js";import{t as le}from"./input-C-Qm8YDT.js";import{r as ue}from"./platform-labels-bKkrtmmV.js";import{n as de,t as fe}from"./contact-email-store-hvqYKCGj.js";import{c as pe,d as x,l as me,n as he,s as S,t as ge,u as C}from"./ImageAttachments-Dovmnniy.js";var _e=d(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),ve=d(`expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}],[`path`,{d:`M3 16v5h5`,key:`1t08am`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 8V3h5`,key:`1ln10m`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),ye=d(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]),be=a(),xe=`unknown`;function w(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return xe;let r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}var T=e(n(),1);function Se(e){let t=e===void 0?de:e;return(0,T.useSyncExternalStore)(t.subscribe,t.getSnapshot,t.getSnapshot)}function Ce(e){return u().safeParse(e).success}var E=t();function we(e,t){let n=e.trim();if(t===void 0)return n===``?void 0:n;let r=t.join(`
2
- `);return n===``?r:`${n}\n\n${r}`}var Te=25;function D(e){return e.replace(/\(([^)]*)\)/,(e,t)=>{let n=t.split(/[/\\]/).pop();return n===void 0||n===``?e:`(${n})`})}function O(e){let t=e.split(`
3
- `).map(e=>D(e.trim())).filter(e=>e!==``);if(t.length===0)return[];let n=t.slice(0,Te),r=t.length-n.length;return[`Component stack:`,...n,...r>0?[`... ${r} more frame(s) omitted`]:[]]}function Ee(e){let t=[`Crash source: ${e.source}`];return e.docName!==void 0&&t.push(`Document: ${e.docName}`),e.errorMessage!==void 0&&t.push(`Error: ${e.errorMessage}`),e.componentStack!==void 0&&t.push(...O(e.componentStack)),t}function De(e){let t=[`Crash source: ${e.kind===`render-process-gone`?`renderer process crash (reason: ${e.context.reason})`:e.kind===`child-process-gone`?`${e.context.processType} process crash (reason: ${e.context.reason})`:e.context.dirtyShutdown?`previous session ended without a clean quit`:`new crash dump found from the previous session`}`,`Crash event: ${e.eventId}`];return e.kind===`boot`&&e.crashedAppVersion!==void 0&&t.push(`Crashed app version: ${e.crashedAppVersion}`),e.kind===`boot`&&e.crashedAt!==void 0&&t.push(`Crashed at: ${e.crashedAt} (${w(e.crashedAt)})`),t}var Oe={step:`compose`,creating:!1,createError:null};function ke(e){return e.summary.files.some(x)}function Ae(e){return e.summary.files.some(C)}async function je(e){let t=[];for(let n of e)S(n.type)&&t.push({contentType:n.type,bytes:new Uint8Array(await n.arrayBuffer())});return t}function k(e){let t=(0,be.c)(87),{open:n,onOpenChange:a,systemWide:u,crashContext:d,crashInvite:h,screenshot:te,pointerMarked:ue,crashDumpAvailable:de,agentChat:x}=e,S=u===void 0?!1:u,C=te===void 0?null:te,_e=ue===void 0?!1:ue,xe=de===void 0?!1:de,{_:w}=i(),Te=(typeof window<`u`?window.okDesktop?.platform:void 0)===`darwin`,[D,O]=(0,T.useState)(Oe),[k,Ne]=(0,T.useState)(``),[A,Pe]=(0,T.useState)(d!==void 0||h!==void 0),j=h===void 0?xe:h.minidumpAvailable===!0,[M,Fe]=(0,T.useState)(h?.minidumpAvailable===!0),[N,Ie]=(0,T.useState)(!0),[P,Le]=(0,T.useState)(!0),F;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(F=[],t[0]=F):F=t[0];let[I,Re]=(0,T.useState)(F),ze=D.step!==`compose`||D.creating,L;t[1]!==I||t[2]!==ze?(L={files:I,onChange:Re,disabled:ze},t[1]=I,t[2]=ze,t[3]=L):L=t[3];let R=he(L),[z,Be]=(0,T.useState)(!1),[B,Ve]=(0,T.useState)(``),[V,H]=(0,T.useState)(null),U=(0,T.useRef)(0),W=(0,T.useId)(),G=(0,T.useId)(),He=(0,T.useId)(),Ue=(0,T.useId)(),We=(0,T.useId)(),Ge=(0,T.useId)(),Ke=(0,T.useId)(),qe=(0,T.useId)(),Je=(0,T.useId)(),Ye=(0,T.useId)(),Xe=(0,T.useId)(),Ze=(0,T.useId)(),Qe=(0,T.useId)(),$e=(0,T.useId)(),K=Se().email,et,q;t[4]!==n||t[5]!==K?(et=()=>{n&&(Be(K!==null),Ve(K??``),H(null))},q=[n,K],t[4]=n,t[5]=K,t[6]=et,t[7]=q):(et=t[6],q=t[7]),(0,T.useEffect)(et,q);let tt;t[8]!==d||t[9]!==h?(tt=d===void 0?h===void 0?void 0:De(h):Ee(d),t[8]=d,t[9]=h,t[10]=tt):tt=t[10];let J=tt,nt;t[11]===a?nt=t[12]:(nt=function(e){e||(U.current+=1,O(Oe)),a(e)},t[11]=a,t[12]=nt);let Y=nt,rt;t[13]!==w||t[14]!==x||t[15]!==R||t[16]!==I||t[17]!==j||t[18]!==A||t[19]!==B||t[20]!==P||t[21]!==M||t[22]!==N||t[23]!==k||t[24]!==J||t[25]!==C||t[26]!==z?(rt=async function(){let e=window.okDesktop?.bugReport;if(!e){O({step:`compose`,creating:!1,createError:w({id:`_0JUKX`})});return}if(z&&!Ce(B.trim())){H(w({id:`fwrPh4`}));return}H(null);let t=U.current+=1;O({step:`compose`,creating:!0,createError:null});let n=await je(I);if(U.current!==t)return;let r=x!==void 0&&P,i=await e.create({level:A?`full`:`standard`,note:we(k,J),...j?{includeCrashDump:M}:{},...C===null?{}:{includeScreenshot:N},...n.length>0?{attachments:n}:{},...r?{agentChatThreadId:x.threadId}:{}});U.current===t&&(i.ok?(R.clearProblem(),O({step:`review`,report:{zipPath:i.zipPath,zipSizeBytes:i.zipSizeBytes,summary:i.summary},conversationMissing:r&&!i.summary.files.some(me)})):O({step:`compose`,creating:!1,createError:i.error}))},t[13]=w,t[14]=x,t[15]=R,t[16]=I,t[17]=j,t[18]=A,t[19]=B,t[20]=P,t[21]=M,t[22]=N,t[23]=k,t[24]=J,t[25]=C,t[26]=z,t[27]=rt):rt=t[27];let it=rt,at;t[28]!==d||t[29]!==h||t[30]!==B||t[31]!==Y||t[32]!==k||t[33]!==J||t[34]!==z?(at=function(e){let t=B.trim();fe(z,t),g.startBugReportSend({kind:`created-report`,report:e,note:we(k,J),includeScreenshot:e.summary.files.includes(pe),includeAttachments:Ae(e),...z&&Ce(t)?{email:t}:{}}),Ne(``),Pe(d!==void 0||h!==void 0),Fe(h?.minidumpAvailable===!0),Ie(!0),Le(!0),Re([]),Y(!1)},t[28]=d,t[29]=h,t[30]=B,t[31]=Y,t[32]=k,t[33]=J,t[34]=z,t[35]=at):at=t[35];let ot=at,st;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(st=function(e){window.okDesktop?.shell.showItemInFolder(e)},t[36]=st):st=t[36];let ct=st,X;t[37]!==w||t[38]!==x||t[39]!==R||t[40]!==Je||t[41]!==qe||t[42]!==d||t[43]!==j||t[44]!==h||t[45]!==A||t[46]!==We||t[47]!==Ue||t[48]!==Ke||t[49]!==Ge||t[50]!==B||t[51]!==V||t[52]!==$e||t[53]!==Qe||t[54]!==it||t[55]!==Y||t[56]!==P||t[57]!==M||t[58]!==N||t[59]!==He||t[60]!==G||t[61]!==k||t[62]!==W||t[63]!==D.createError||t[64]!==D.creating||t[65]!==D.step||t[66]!==_e||t[67]!==C||t[68]!==Xe||t[69]!==Ye||t[70]!==z||t[71]!==Ze||t[72]!==S?(X=D.step===`compose`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(se,{className:`gap-2 pr-6`,children:[(0,E.jsx)(ne,{children:(0,E.jsx)(r,{id:`cd5EXh`})}),h===void 0&&(0,E.jsx)(b,{children:(0,E.jsx)(r,{id:`2H5Zhu`})})]}),(0,E.jsxs)(ae,{className:`flex flex-auto flex-col gap-2 pb-2 [&>*]:shrink-0`,children:[h!==void 0&&(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5 rounded-md border border-chart-3/35 bg-chart-3/10 px-3 py-2.5 text-sm`,children:[(0,E.jsx)(v,{className:`mt-0.5 size-4 shrink-0 text-chart-3`,"aria-hidden":`true`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`p`,{className:`font-medium`,children:(0,E.jsx)(r,{id:`_IGfXZ`})}),(0,E.jsx)(b,{className:`mt-0.5 text-xs`,children:(0,E.jsx)(r,{id:`03wKPg`})})]})]}),D.createError!==null&&(0,E.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-2.5 rounded-md border border-destructive/35 bg-destructive/10 px-3 py-2.5 text-sm`,children:[(0,E.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-destructive`,"aria-hidden":`true`}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`p`,{className:`font-medium`,children:(0,E.jsx)(r,{id:`wVa83H`})}),(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:D.createError}),(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:(0,E.jsx)(r,{id:`5PHgV2`,components:{0:(0,E.jsx)(`code`,{className:`font-mono`})}})})]})]}),d!==void 0&&(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(r,{id:`CJ59QJ`})}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,E.jsxs)(`label`,{htmlFor:W,className:`text-sm font-medium`,children:[h===void 0?(0,E.jsx)(r,{id:`y_K0Dz`}):(0,E.jsx)(r,{id:`60vpJN`}),` `,(0,E.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:(0,E.jsx)(r,{id:`NzluOx`})})]}),(0,E.jsx)(ge,{id:W,value:k,onChange:e=>Ne(e.target.value),placeholder:w(h===void 0?{id:`YLMBSd`}:{id:`T3j-7o`}),rows:2,className:`min-h-20`,intake:R,hint:(0,E.jsx)(r,{id:`XoMG7W`})})]}),C!==null&&(0,E.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-3 gap-y-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2.5 pt-0.5`,children:[(0,E.jsx)(c,{id:Ye,checked:N,onCheckedChange:e=>Ie(e===!0),"aria-describedby":Xe,disabled:D.creating}),(0,E.jsx)(`label`,{htmlFor:Ye,className:`text-sm font-medium`,children:(0,E.jsx)(r,{id:`IxyZXD`})})]}),(0,E.jsxs)(ce,{children:[(0,E.jsx)(ie,{asChild:!0,children:(0,E.jsxs)(l,{variant:`outline`,className:`relative block h-auto w-40 shrink-0 overflow-hidden rounded-md bg-muted/40 p-0`,"aria-label":w({id:`AkJx1j`}),children:[(0,E.jsx)(`img`,{src:C.dataUrl,alt:w({id:`WuntOK`}),className:`h-24 w-full object-contain ${N?``:`opacity-40`}`}),(0,E.jsx)(`span`,{className:`absolute end-1 top-1 flex items-center rounded bg-popover/90 p-1`,children:(0,E.jsx)(ve,{className:`size-3`,"aria-hidden":`true`})})]})}),(0,E.jsxs)(re,{className:`sm:max-w-5xl`,children:[(0,E.jsxs)(se,{className:`pr-6`,children:[(0,E.jsx)(ne,{children:(0,E.jsx)(r,{id:`xvv5gL`})}),(0,E.jsx)(b,{children:(0,E.jsx)(r,{id:`qApCYm`})})]}),(0,E.jsx)(ae,{children:(0,E.jsx)(`img`,{src:C.dataUrl,alt:w({id:`WuntOK`}),className:`max-h-[70dvh] w-full object-contain`})})]})]}),(0,E.jsxs)(`p`,{id:Xe,className:`min-w-40 flex-1 text-xs text-muted-foreground`,children:[_e?(0,E.jsx)(r,{id:`ZBZEkP`}):(0,E.jsx)(r,{id:`nczGih`}),` `,(0,E.jsx)(r,{id:`qApCYm`})]})]}),(0,E.jsxs)(`fieldset`,{className:`grid min-w-0 gap-3 border-t pt-3 sm:grid-cols-[1fr_1.25fr]`,children:[(0,E.jsx)(`legend`,{className:`sr-only`,children:(0,E.jsx)(r,{id:`WJjviG`})}),(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(c,{id:G,checked:!0,disabled:!0,"aria-describedby":He,className:`mt-0.5`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsxs)(`label`,{htmlFor:G,className:`flex flex-wrap items-center gap-2 text-sm font-medium text-foreground`,children:[(0,E.jsx)(r,{id:`FgRAvd`}),(0,E.jsx)(y,{variant:`primary`,className:`text-2xs`,children:(0,E.jsx)(r,{id:`C0hoX6`})})]}),(0,E.jsx)(`p`,{id:He,className:`text-1sm text-muted-foreground`,children:S?(0,E.jsx)(r,{id:`DqyItq`}):(0,E.jsx)(r,{id:`0wkh7o`})})]})]}),(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(c,{id:Ue,checked:A,onCheckedChange:e=>Pe(e===!0),"aria-describedby":We,disabled:D.creating,className:`mt-0.5`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,E.jsx)(`label`,{htmlFor:Ue,className:`text-sm font-medium`,children:(0,E.jsx)(r,{id:`zvjCD4`})}),(0,E.jsx)(y,{variant:`primary`,className:`text-2xs`,children:(0,E.jsx)(r,{id:`WEYdDv`})})]}),(0,E.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,E.jsx)(r,{id:`mx_oWI`})}),(0,E.jsx)(`p`,{id:We,className:`text-1sm text-muted-foreground`,children:(0,E.jsx)(r,{id:`Z5q-I8`})}),(0,E.jsxs)(s,{children:[(0,E.jsx)(ee,{asChild:!0,children:(0,E.jsxs)(l,{variant:`ghost`,size:`sm`,className:`group -ms-2 h-7 justify-start px-2 text-1sm font-normal`,children:[(0,E.jsx)(f,{className:`size-3.5 group-data-[state=open]:rotate-90`,"aria-hidden":`true`}),(0,E.jsx)(r,{id:`0cGsQh`})]})}),(0,E.jsx)(o,{children:(0,E.jsxs)(`p`,{className:`rounded-md bg-muted/50 p-3 text-1sm text-muted-foreground`,children:[(0,E.jsx)(r,{id:`fRVBiq`}),` `,Te&&(0,E.jsx)(r,{id:`7xEWbL`})]})})]})]})]})]}),j&&(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(c,{id:Ge,checked:M,onCheckedChange:e=>Fe(e===!0),"aria-describedby":Ke,disabled:D.creating,className:`mt-0.5`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsx)(`label`,{htmlFor:Ge,className:`text-sm font-medium`,children:(0,E.jsx)(r,{id:`8TvlHF`})}),(0,E.jsx)(`p`,{id:Ke,className:`text-1sm text-muted-foreground`,children:(0,E.jsx)(r,{id:`jnCROW`})})]})]}),x!==void 0&&(0,E.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,E.jsx)(c,{id:qe,checked:P,onCheckedChange:e=>Le(e===!0),"aria-describedby":Je,disabled:D.creating,className:`mt-0.5`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,E.jsx)(`label`,{htmlFor:qe,className:`text-sm font-medium`,children:(0,E.jsx)(r,{id:`U8novP`})}),(0,E.jsx)(`p`,{id:Je,className:`text-1sm text-muted-foreground`,children:(0,E.jsx)(r,{id:`nXK5bR`})})]})]}),(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(r,{id:`ko-CKk`})}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,E.jsx)(c,{id:Ze,checked:z,onCheckedChange:e=>{Be(e===!0),H(null)},disabled:D.creating}),(0,E.jsx)(`label`,{htmlFor:Ze,className:`text-sm`,children:(0,E.jsx)(r,{id:`SF9qpO`})})]}),z&&(0,E.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,E.jsx)(le,{id:Qe,"aria-label":w({id:`DFQ2Sj`}),type:`email`,value:B,onChange:e=>{Ve(e.target.value),H(null)},placeholder:w({id:`JHf6qZ`}),disabled:D.creating,"aria-invalid":V!==null,"aria-describedby":V===null?void 0:$e}),V!==null&&(0,E.jsx)(`p`,{id:$e,className:`text-destructive text-sm`,children:V})]})]}),h===void 0&&d===void 0?(0,E.jsx)(_,{}):null]}),(0,E.jsxs)(oe,{children:[(0,E.jsx)(l,{variant:`ghost`,onClick:()=>Y(!1),children:h===void 0?(0,E.jsx)(r,{id:`dEgA5A`}):(0,E.jsx)(r,{id:`PBxg_E`})}),(0,E.jsxs)(l,{onClick:()=>void it(),disabled:D.creating,children:[D.creating&&(0,E.jsx)(m,{className:`size-4`,"aria-hidden":`true`}),(0,E.jsx)(r,{id:`Si7mIR`})]})]})]}),t[37]=w,t[38]=x,t[39]=R,t[40]=Je,t[41]=qe,t[42]=d,t[43]=j,t[44]=h,t[45]=A,t[46]=We,t[47]=Ue,t[48]=Ke,t[49]=Ge,t[50]=B,t[51]=V,t[52]=$e,t[53]=Qe,t[54]=it,t[55]=Y,t[56]=P,t[57]=M,t[58]=N,t[59]=He,t[60]=G,t[61]=k,t[62]=W,t[63]=D.createError,t[64]=D.creating,t[65]=D.step,t[66]=_e,t[67]=C,t[68]=Xe,t[69]=Ye,t[70]=z,t[71]=Ze,t[72]=S,t[73]=X):X=t[73];let Z;t[74]!==ot||t[75]!==D.conversationMissing||t[76]!==D.report||t[77]!==D.step?(Z=D.step===`review`&&(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(se,{children:[(0,E.jsx)(ne,{children:(0,E.jsx)(r,{id:`2AIVbm`})}),(0,E.jsx)(b,{children:(0,E.jsx)(r,{id:`3l_cXP`})})]}),(0,E.jsxs)(ae,{className:`flex flex-col gap-4`,children:[(0,E.jsx)(Me,{zipPath:D.report.zipPath,zipSizeBytes:D.report.zipSizeBytes,fileCount:D.report.summary.files.length,rawDumpIncluded:ke(D.report),onReveal:ct}),D.conversationMissing?(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,E.jsx)(r,{id:`nRX05G`})}):null,(0,E.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border bg-muted/50 px-3 py-2.5 text-xs text-muted-foreground`,children:[(0,E.jsx)(ye,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,E.jsx)(`span`,{children:(0,E.jsx)(r,{id:`-o5XAG`})})]})]}),(0,E.jsxs)(oe,{className:`sm:justify-between`,children:[(0,E.jsx)(l,{variant:`ghost`,onClick:()=>O(Oe),children:(0,E.jsx)(r,{id:`iH8pgl`})}),(0,E.jsx)(l,{onClick:()=>ot(D.report),children:(0,E.jsx)(r,{id:`O9oQJS`})})]})]}),t[74]=ot,t[75]=D.conversationMissing,t[76]=D.report,t[77]=D.step,t[78]=Z):Z=t[78];let Q;t[79]!==R.onPaste||t[80]!==X||t[81]!==Z?(Q=(0,E.jsxs)(re,{className:`gap-2 sm:max-w-[46.25rem]`,onPaste:R.onPaste,children:[X,Z]}),t[79]=R.onPaste,t[80]=X,t[81]=Z,t[82]=Q):Q=t[82];let $;return t[83]!==Y||t[84]!==n||t[85]!==Q?($=(0,E.jsx)(ce,{open:n,onOpenChange:Y,children:Q}),t[83]=Y,t[84]=n,t[85]=Q,t[86]=$):$=t[86],$}function Me(e){let t=(0,be.c)(23),{zipPath:n,zipSizeBytes:i,fileCount:a,rawDumpIncluded:o,onReveal:ee}=e,s;t[0]===n?s=t[1]:(s=h(n),t[0]=n,t[1]=s);let c=s,u;t[2]===i?u=t[3]:(u=te(i),t[2]=i,t[3]=u);let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,E.jsx)(`div`,{className:`flex items-center justify-center size-8 rounded-md bg-muted`,children:(0,E.jsx)(_e,{className:`size-4 shrink-0 text-muted-foreground`,"aria-hidden":`true`})}),t[4]=f):f=t[4];let p;t[5]===c?p=t[6]:(p=(0,E.jsx)(`p`,{className:`truncate text-1sm`,title:c,children:c}),t[5]=c,t[6]=p);let m;t[7]!==a||t[8]!==o||t[9]!==d?(m=(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o?(0,E.jsx)(r,{id:`sn5BEU`,values:{sizeText:d,fileCount:a}}):(0,E.jsx)(r,{id:`3DJEEt`,values:{sizeText:d,fileCount:a}})}),t[7]=a,t[8]=o,t[9]=d,t[10]=m):m=t[10];let g;t[11]!==p||t[12]!==m?(g=(0,E.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[p,m]}),t[11]=p,t[12]=m,t[13]=g):g=t[13];let _;t[14]!==ee||t[15]!==n?(_=()=>ee(n),t[14]=ee,t[15]=n,t[16]=_):_=t[16];let v;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(v=ue(typeof window<`u`?window.okDesktop?.platform:void 0),t[17]=v):v=t[17];let y;t[18]===_?y=t[19]:(y=(0,E.jsx)(l,{variant:`link`,className:`h-auto shrink-0 p-0 text-xs`,onClick:_,children:v}),t[18]=_,t[19]=y);let b;return t[20]!==g||t[21]!==y?(b=(0,E.jsxs)(`div`,{className:`flex items-center gap-2.5 rounded-md border px-3 py-2.5`,children:[f,g,y]}),t[20]=g,t[21]=y,t[22]=b):b=t[22],b}export{k as default};
@@ -1 +0,0 @@
1
- import"./saved-themes-client-BKjZgSZ2.js";
@@ -1 +0,0 @@
1
- import{n as e}from"./field-controls-zCgHwN0u.js";export{e as SectionSkeleton};