@inkeep/open-knowledge 0.39.0-beta.9 → 0.40.0-beta.1

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 (160) hide show
  1. package/dist/{acp-harness-probe-BrOIuxee.mjs → acp-harness-probe-CI5eMrtp.mjs} +2 -2
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +4 -4
  4. package/dist/assets/skills/write-skill/SKILL.md +1 -1
  5. package/dist/{banner-_FQsQkvC.mjs → banner--DGfdMN8.mjs} +2 -2
  6. package/dist/cli.mjs +62 -62
  7. package/dist/{colors-_gzKDfrv.mjs → colors-BsmVIwfM.mjs} +1 -1
  8. package/dist/colors-MGDi6UGf.mjs +1 -0
  9. package/dist/config-schema.json +81 -3
  10. package/dist/config.project-local.schema.json +50 -3
  11. package/dist/config.project.schema.json +69 -3
  12. package/dist/config.user.schema.json +38 -3
  13. package/dist/constants-CkXW_O1Z.mjs +2 -0
  14. package/dist/dist-bundle-BT5p_5Yl.mjs +1 -0
  15. package/dist/{dist-bundle-vlpIc23T.mjs → dist-bundle-CFfKBclM.mjs} +1 -1
  16. package/dist/fs-traced-CIBSRy3q.mjs +1 -0
  17. package/dist/{fs-traced-vMO6kYgZ.mjs → fs-traced-PoaSX4-V.mjs} +3 -3
  18. package/dist/{git-handle-YzX39hWc.mjs → git-handle-DQgl5oTH.mjs} +2 -2
  19. package/dist/git-handle-Dv50ya_5.mjs +1 -0
  20. package/dist/index.d.mts +25 -1
  21. package/dist/index.mjs +1 -1
  22. package/dist/init-BG8F8jyV.mjs +1 -0
  23. package/dist/{init-CPNddICq.mjs → init-DqAj6DLP.mjs} +9 -9
  24. package/dist/{is-object-Bw0-z8qH.mjs → is-object-ByG7RnjH.mjs} +1 -1
  25. package/dist/{launch-json-removal-BfuiPEr_.mjs → launch-json-removal-DMBq4-k5.mjs} +2 -2
  26. package/dist/loader-48vYo7np.mjs +1 -0
  27. package/dist/{loader-Dof4y0ze.mjs → loader-CuzKavqN.mjs} +2 -2
  28. package/dist/md-manager-BFa4uLFA.mjs +2 -0
  29. package/dist/native/native-config.darwin-arm64.node +0 -0
  30. package/dist/native/native-config.darwin-x64.node +0 -0
  31. package/dist/native/native-config.linux-arm64-gnu.node +0 -0
  32. package/dist/native/native-config.linux-arm64-musl.node +0 -0
  33. package/dist/native/native-config.linux-x64-musl.node +0 -0
  34. package/dist/native/native-config.win32-arm64-msvc.node +0 -0
  35. package/dist/native/native-config.win32-x64-msvc.node +0 -0
  36. package/dist/{open-browser-kdF24mgk.mjs → open-browser-D3OpxES8.mjs} +2 -2
  37. package/dist/parse-worker.mjs +1 -1
  38. package/dist/{preview-BCbVoSQK.mjs → preview-DNAkJMSB.mjs} +2 -2
  39. package/dist/preview-hDB5CK12.mjs +1 -0
  40. package/dist/public/assets/{ActivityModeContent-BQLss-BE.js → ActivityModeContent-dWIhYEu6.js} +1 -1
  41. package/dist/public/assets/{AgentDiffPane-B_TmNOOS.js → AgentDiffPane-ZSMGc24S.js} +1 -1
  42. package/dist/public/assets/{AgentThreadClientBinder-Be-VMGZV.js → AgentThreadClientBinder-CLmx-vqX.js} +1 -1
  43. package/dist/public/assets/{AppMenubar-hPGBtMtR.js → AppMenubar-BuB4TAd6.js} +1 -1
  44. package/dist/public/assets/CodeMirrorPropInput-C9WmN90w.js +3 -0
  45. package/dist/public/assets/{ConsentDialogBody-D9xWEY09.js → ConsentDialogBody-BBzNYhHt.js} +1 -1
  46. package/dist/public/assets/{CopyButton-Cbumgow3.js → CopyButton-Ja2824Ao.js} +1 -1
  47. package/dist/public/assets/{DocumentContext-4RBN9Oik.js → DocumentContext-BcbJIejF.js} +10 -10
  48. package/dist/public/assets/EnableSyncConfirmDialog-DPaSz-wC.js +1 -0
  49. package/dist/public/assets/FeedbackForm-BeMx2Cc0.js +1 -0
  50. package/dist/public/assets/{GraphPanel-CDzcx7vs.js → GraphPanel-BpzaeAQp.js} +2 -2
  51. package/dist/public/assets/{ManagedArtifactProperties-Bd4rE8Ks.js → ManagedArtifactProperties-CQXgVT_Z.js} +1 -1
  52. package/dist/public/assets/{McpConsentDialogBody-OqDOF7x4.js → McpConsentDialogBody-DHTkre7u.js} +1 -1
  53. package/dist/public/assets/{MermaidDocEditor-B6KK6qX2.js → MermaidDocEditor-DL9NPMko.js} +1 -1
  54. package/dist/public/assets/{PropertyPanel-BwdCsrPn.js → PropertyPanel-DEgQa4x9.js} +2 -2
  55. package/dist/public/assets/{ReportBugDialogBody-AEXnxadV.js → ReportBugDialogBody-DrIG1ML_.js} +1 -1
  56. package/dist/public/assets/SettingsDialogBody-BZ10IzbM.js +7 -0
  57. package/dist/public/assets/{ShareBranchSwitchDialog-CzeHnBZ6.js → ShareBranchSwitchDialog-C179lw0C.js} +1 -1
  58. package/dist/public/assets/{ShareReceiveDialog-DGTKtAY6.js → ShareReceiveDialog-TtY0UQrE.js} +1 -1
  59. package/dist/public/assets/{ShareReceiveMissDialog-BS5BCjjQ.js → ShareReceiveMissDialog-op0Pk4ih.js} +1 -1
  60. package/dist/public/assets/{SkillEditorActions-PVnPdxy2.js → SkillEditorActions-DVAUJ782.js} +1 -1
  61. package/dist/public/assets/{SourceEditor-YXhnts5y.js → SourceEditor-Nfwr4rkI.js} +1 -1
  62. package/dist/public/assets/{TerminalPanel-DyJkPAsZ.js → TerminalPanel-DqAeIpPV.js} +1 -1
  63. package/dist/public/assets/{TerminalSessionsHost-CfucJ1z0.js → TerminalSessionsHost-CMZ3pfB8.js} +2 -2
  64. package/dist/public/assets/{TerminalWindowApp-J6-xAbRj.js → TerminalWindowApp-C0nQcTDF.js} +1 -1
  65. package/dist/public/assets/{ThreadView-BvgNNafC.js → ThreadView-Dd8w-hhw.js} +1 -1
  66. package/dist/public/assets/{TimelineDiffPane-B9PP3AzZ.js → TimelineDiffPane-DKx6CcI9.js} +1 -1
  67. package/dist/public/assets/{agent-diff-store-BDu-qYpS.js → agent-diff-store-_LaXNJgH.js} +1 -1
  68. package/dist/public/assets/{agent-visibility-BUmsS0vL.js → agent-visibility-CaL4MDEH.js} +1 -1
  69. package/dist/public/assets/auth-state-cache-9Mxvjb5G.js +11 -0
  70. package/dist/public/assets/{calendar-p-DzPplr.js → calendar-HuZ4s1vW.js} +1 -1
  71. package/dist/public/assets/{checkbox-Cn88M3G6.js → checkbox-DAZcO8UL.js} +1 -1
  72. package/dist/public/assets/client-version-yw5_4u_I.js +1 -0
  73. package/dist/public/assets/{config-provider-BvPGEDTw.js → config-provider-BgOkEHZH.js} +2 -2
  74. package/dist/public/assets/{dist-DRspkp5n.js → dist-Bjs7qRWH.js} +1 -1
  75. package/dist/public/assets/{dist-CDKZLcnD.js → dist-CHLZ8lz0.js} +126 -126
  76. package/dist/public/assets/{doc-hash-r2oc1gt-.js → doc-hash-Bgdowslw.js} +1 -1
  77. package/dist/public/assets/documents-events-HEfBwy2y.js +1 -0
  78. package/dist/public/assets/{dropdown-menu-CcKe8PiU.js → dropdown-menu-DVTufjNA.js} +1 -1
  79. package/dist/public/assets/{file-tree-adapter-DOr3Nip1.js → file-tree-adapter-Bvk6LAfH.js} +1 -1
  80. package/dist/public/assets/index-DsA_F7eu.js +2022 -0
  81. package/dist/public/assets/index-G6x9YQiR.css +1 -0
  82. package/dist/public/assets/{keyboard-shortcuts-maIyJzSw.js → keyboard-shortcuts-DEJA0SzW.js} +1 -1
  83. package/dist/public/assets/lint-config-client-DJccpgCS.js +1 -0
  84. package/dist/public/assets/{navigation-targets-DhXblHdl.js → navigation-targets-CPuDxLos.js} +1 -1
  85. package/dist/public/assets/{open-managed-artifact-tab-DokRsPIe.js → open-managed-artifact-tab-D70MXBHT.js} +1 -1
  86. package/dist/public/assets/pending-receive-nav-store-CMbR1DlR.js +1 -0
  87. package/dist/public/assets/{prop-types-IOhQSrD8.js → prop-types-X3nIYAt7.js} +1 -1
  88. package/dist/public/assets/{receive-store-BwEPjiP1.js → receive-store-CXRtunGe.js} +1 -1
  89. package/dist/public/assets/{selection-context-DOeF93Po.js → selection-context-BiPXU2rp.js} +1 -1
  90. package/dist/public/assets/{skill-actions-D9Vn0ymW.js → skill-actions-8sFn_d3u.js} +1 -1
  91. package/dist/public/assets/{skills-api-CGbwE9vp.js → skills-api-C_fjXVRf.js} +1 -1
  92. package/dist/public/assets/{src-4ThOx6_s.js → src-Bv1hrVBW.js} +1 -1
  93. package/dist/public/assets/{target-navigation-intent-Beex9QTj.js → target-navigation-intent-DW8AJzuM.js} +1 -1
  94. package/dist/public/assets/{telemetry-impl-C3Xj4Jzm.js → telemetry-impl-5fGxwbNg.js} +1 -1
  95. package/dist/public/assets/{telemetry-startup-mmznflLy.js → telemetry-startup-CLLgwJqA.js} +1 -1
  96. package/dist/public/assets/{terminal-launch-events-C2tfnQr1.js → terminal-launch-events-CuvBwfob.js} +1 -1
  97. package/dist/public/assets/{terminal-telemetry-zqEIM46I.js → terminal-telemetry-qJ0O-9wu.js} +1 -1
  98. package/dist/public/assets/typing-burst-detector-CY0OrGne.js +6 -0
  99. package/dist/public/assets/use-activity-panel-DEqogtJb.js +1 -0
  100. package/dist/public/assets/{use-apply-config-color-theme-Ccfxcl-K.js → use-apply-config-color-theme-CbAc42DQ.js} +1 -1
  101. package/dist/public/assets/{use-collab-url-Cf1srbbW.js → use-collab-url-CDJf5CAl.js} +1 -1
  102. package/dist/public/assets/{use-live-xterm-theme-BpGfJKio.js → use-live-xterm-theme-DsNSOoA7.js} +1 -1
  103. package/dist/public/assets/{use-terminal-enabled-BEEp7vb7.js → use-terminal-enabled-CjyUXLzD.js} +1 -1
  104. package/dist/public/assets/{use-timeline-entry-diff-C1lHV9NQ.js → use-timeline-entry-diff-CaKIZSP2.js} +1 -1
  105. package/dist/public/assets/{use-workspace-C1D_I03G.js → use-workspace-CHGWiUmE.js} +1 -1
  106. package/dist/public/assets/{workspace-paths-BKmDPpqj.js → workspace-paths-DgJUp1dw.js} +1 -1
  107. package/dist/public/index.html +48 -48
  108. package/dist/{repair-launch-json-B_QBIfGY.mjs → repair-launch-json-tt6Tjedd.mjs} +2 -2
  109. package/dist/{repair-mcp-configs-DPkRNZjR.mjs → repair-mcp-configs-Bn1d1oSd.mjs} +2 -2
  110. package/dist/{repair-skills-BaZcFu4I.mjs → repair-skills-BVXDXZaA.mjs} +2 -2
  111. package/dist/repair-skills-D7MJ6bSo.mjs +1 -0
  112. package/dist/schemas/v0/config.project-local.schema.json +50 -3
  113. package/dist/schemas/v0/config.project.schema.json +69 -3
  114. package/dist/schemas/v0/config.user.schema.json +38 -3
  115. package/dist/server-lock-Bhmg0tcS.mjs +1 -0
  116. package/dist/{server-lock-BiAmhJ19.mjs → server-lock-DWsOY8Sf.mjs} +2 -2
  117. package/dist/{sleep-DcENuR74.mjs → sleep-CnRgOMGV.mjs} +24 -24
  118. package/dist/{src-DhzHOoTy.mjs → src-DQTDRmqk.mjs} +1 -1
  119. package/dist/src-DVrFd0vk.mjs +3272 -0
  120. package/dist/{src-BTo9m5ju.mjs → src-IQdx1yfl.mjs} +120 -115
  121. package/dist/src-VT3q7v5V.mjs +22 -0
  122. package/dist/start-3HnyNbf6.mjs +1 -0
  123. package/dist/{start-BzSvov1E.mjs → start-BQRik_0l.mjs} +2 -2
  124. package/dist/{write-project-skill-Dt58S1kj.mjs → write-project-skill-SrjlunKm.mjs} +4 -4
  125. package/package.json +5 -5
  126. package/dist/colors-CUOU_72x.mjs +0 -1
  127. package/dist/constants-W5X7lzwf.mjs +0 -2
  128. package/dist/dist-bundle-B-JhpGTG.mjs +0 -1
  129. package/dist/fs-traced-DOXZOlKx.mjs +0 -1
  130. package/dist/git-handle-BGt8xT_1.mjs +0 -1
  131. package/dist/init-CIi-cdDQ.mjs +0 -1
  132. package/dist/loader-BWMy7gMr.mjs +0 -1
  133. package/dist/md-manager-DPNbV4Up.mjs +0 -2
  134. package/dist/preview-DKku4BY2.mjs +0 -1
  135. package/dist/public/assets/CodeMirrorPropInput-Sjp30pzp.js +0 -3
  136. package/dist/public/assets/EnableSyncConfirmDialog-CbuJxerH.js +0 -1
  137. package/dist/public/assets/FeedbackForm-D_mXeHle.js +0 -1
  138. package/dist/public/assets/SettingsDialogBody-CAkmpKWt.js +0 -7
  139. package/dist/public/assets/auth-state-cache-DI5ppoto.js +0 -11
  140. package/dist/public/assets/client-version-CNNfEvD2.js +0 -1
  141. package/dist/public/assets/documents-events-DNDUkpJM.js +0 -1
  142. package/dist/public/assets/index-DLWWMHtL.css +0 -1
  143. package/dist/public/assets/index-Q9MYvDYY.js +0 -1995
  144. package/dist/public/assets/lint-config-client-C7TVN28Z.js +0 -1
  145. package/dist/public/assets/pending-receive-nav-store-DYgvjLiq.js +0 -1
  146. package/dist/public/assets/typing-burst-detector-D8mQRP5S.js +0 -6
  147. package/dist/public/assets/use-activity-panel-CasauzqS.js +0 -1
  148. package/dist/repair-skills-BunyY3Wb.mjs +0 -1
  149. package/dist/server-lock-BwO1WEYX.mjs +0 -1
  150. package/dist/src-YSGKFci8.mjs +0 -3264
  151. package/dist/src-kjR_dI-1.mjs +0 -22
  152. package/dist/start-REG2U44u.mjs +0 -1
  153. /package/dist/public/assets/{RegisteredAgentIcon--E1135hW.js → RegisteredAgentIcon-B57vI5w6.js} +0 -0
  154. /package/dist/public/assets/{arrow-up-right-BKliW282.js → arrow-up-right-Bzc4GmE5.js} +0 -0
  155. /package/dist/public/assets/{check-D3jznJmG.js → check-D_9hlB38.js} +0 -0
  156. /package/dist/public/assets/{chevron-down-0vl-mPeL.js → chevron-down-CQd32BUC.js} +0 -0
  157. /package/dist/public/assets/{chevron-left-fiDaD9J4.js → chevron-left-4ixwi2VD.js} +0 -0
  158. /package/dist/public/assets/{chevron-right-zaL9JagC.js → chevron-right-cXK7rcek.js} +0 -0
  159. /package/dist/public/assets/{copy-DmfcimOx.js → copy-Dwat-rG5.js} +0 -0
  160. /package/dist/public/assets/{eye-CmnH89UE.js → eye-DuFNDQPj.js} +0 -0
@@ -1,22 +0,0 @@
1
- import{o as e}from"./chunk-DTipWd-i.mjs";import{F as t,I as n,fa as r}from"./src-BTo9m5ju.mjs";import{Ei as i,ci as a,ct as o,ha as s,hn as c,lt as l,ot as u,st as d}from"./src-YSGKFci8.mjs";import{U as f}from"./sleep-DcENuR74.mjs";import{O as p,P as m}from"./fs-traced-vMO6kYgZ.mjs";import{b as h,u as g,v as _,y as v}from"./server-lock-BiAmhJ19.mjs";import{t as y}from"./yazl-BafwB467.mjs";import{_ as b,g as x,i as S,l as C,x as w}from"./write-project-skill-Dt58S1kj.mjs";import"./acp-harness-probe-BrOIuxee.mjs";import{D as T,E,S as ee,T as D,_ as O,b as te,o as ne,v as k}from"./init-CPNddICq.mjs";import{n as A}from"./constants-W5X7lzwf.mjs";import{t as j}from"./is-object-Bw0-z8qH.mjs";import"./loader-Dof4y0ze.mjs";import{c as re}from"./colors-_gzKDfrv.mjs";import"./preview-BCbVoSQK.mjs";import{execSync as M,spawnSync as N}from"node:child_process";import{basename as P,dirname as F,isAbsolute as ie,join as I,relative as ae,resolve as L,sep as oe}from"node:path";import{cpSync as se,createWriteStream as ce,existsSync as R,lstatSync as le,mkdirSync as z,mkdtempSync as ue,readFileSync as B,readdirSync as V,readlinkSync as de,rmSync as H,statSync as fe,writeFileSync as U}from"node:fs";import{arch as pe,freemem as me,homedir as he,hostname as ge,platform as _e,release as ve,tmpdir as ye,totalmem as be,type as xe,uptime as Se}from"node:os";import{realpath as W}from"node:fs/promises";import{createHash as G}from"node:crypto";const Ce=[{name:`macos-home-path`,regex:/\/Users\/[^/]+\//g,replacement:`~/`},{name:`linux-home-path`,regex:/\/home\/[^/]+\//g,replacement:`~/`},{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)\S+/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@]+:[^/\s:@]+@/g,replacement:`://[REDACTED]@`}],we=Ce.map(e=>e.name);function Te(e){let t=new Set,n=0;return{redacted:e.split(`
2
- `).map(e=>{let r=e;for(let{name:e,regex:i,replacement:a}of Ce)i.lastIndex=0,i.test(r)&&(t.add(e),n++,i.lastIndex=0,r=r.replace(i,a));return r}).join(`
3
- `),patterns:[...t],lineCount:n}}function Ee(){return I(he(),`.ok`,`bug-reports`)}function De(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`);return I(Ee(),`${t}-bugreport.zip`)}function Oe(e,t){let n=I(e,`.ok`,`config.yml`);if(R(n))try{let e=B(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 R(I(e,`.ok`))?G(`sha256`).update(L(e)).digest(`hex`).slice(0,12):null}function ke(){let e={timestamp:new Date().toISOString(),platform:_e(),osType:xe(),osRelease:ve(),hostname:`[redacted]`,uptime:Se(),freeMem:me(),totalMem:be(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=M(`sw_vers -productVersion 2>/dev/null`,a({encoding:`utf8`})).trim()}catch{}try{let t=I(__dirname,`..`,`..`,`package.json`);R(t)&&(e.okVersion=JSON.parse(B(t,`utf8`)).version)}catch{}return e}function Ae(e,t){if(!R(t))return{files:[]};let n=V(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>I(t,e));if(e&&n.length>0){let t=n.filter(t=>{try{return B(t,`utf8`).includes(`"project":"${e}"`)}catch{return!0}});t.length>0&&(n=t)}return{files:n}}function je(e){let n=I(e,`.ok`,`local`);return R(n)?{files:[`server.lock`,`last-spawn-error.log`,t].map(e=>I(n,e)).filter(e=>R(e))}:{files:[]}}function Me(e){let t=I(e,`.ok`,`local`,`logs`);return R(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>I(t,e)).filter(e=>R(e))}:{files:[]}}function Ne(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=Te(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function Pe(e){for(let t of e.files)try{Ne({zipfile:e.zipfile,name:`${e.prefix}/${P(t)}`,content:B(t,`utf8`),redact:e.redact,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 Fe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.userLogsDir??I(he(),`.ok`,`logs`),o=t.projectDir?Oe(t.projectDir,i):null;z(F(r),{recursive:!0}),i?.info({projectSlug:o},`gathering diagnostic data`);let s=ke();s.desktop=t.desktop??null;let{files:c}=Ae(o,a),{files:l}=t.projectDir?je(t.projectDir):{files:[]},{files:u}=t.projectDir?Me(t.projectDir):{files:[]};i?.info({logFileCount:c.length,lockFileCount:l.length,localSinkFileCount:u.length},`files collected`);let d=[],f=[],{ZipFile:p}=await import(`./yazl-vwTkB7U0.mjs`).then(t=>e(t.default,1)),m=new p;Pe({zipfile:m,files:c,prefix:`logs`,redact:n,bundleFiles:f,redactions:d,logger:i}),Pe({zipfile:m,files:l,prefix:`lockdir`,redact:n,bundleFiles:f,redactions:d,logger:i}),Pe({zipfile:m,files:u,prefix:`local-logs`,redact:n,bundleFiles:f,redactions:d,logger:i});for(let e of t.extraFiles??[])try{let t=B(e.sourcePath),n=`extra/${e.zipName??P(e.sourcePath)}`;m.addBuffer(t,n),f.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Ne({zipfile:m,name:`note.txt`,content:t.note,redact:n,bundleFiles:f,redactions:d});let h=JSON.stringify(s,null,2);m.addBuffer(Buffer.from(h,`utf8`),`sysinfo.json`),f.push(`sysinfo.json`);let g={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:o,files:f,redactions:d,sysinfo:s};m.addBuffer(Buffer.from(JSON.stringify(g,null,2),`utf8`),`MANIFEST.json`);let _=d.reduce((e,t)=>e+t.lineCount,0),v=[`# Bug Report Bundle`,``,`Generated: ${g.generatedAt}`,`Project: ${o??`(unscoped)`}`,`Discipline version: ${g.disciplineVersion}`,``,`## Contents`,``,...f.map(e=>`- ${e}`),``,`## Privacy`,``,...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${we.join(`, `)}`,_>0?`${_} line(s) were scrubbed across ${d.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
4
- `);m.addBuffer(Buffer.from(v,`utf8`),`README.md`),m.end();let y=ce(r);return m.outputStream.pipe(y),await new Promise((e,t)=>{y.on(`close`,e),y.on(`error`,t)}),i?.info({bundlePath:r,fileCount:f.length,redactionCount:_},`bundle written`),{zipPath:r,summary:{projectSlug:o,files:f,redactions:d,redactedLineCount:_,generatedAt:g.generatedAt}}}var Ie=f(),Le=e(y(),1);const Re=new Set([`doc.name`,`currentDoc`]);function ze(e){return`doc:${G(`sha256`).update(e).digest(`hex`).slice(0,8)}`}function Be(e,t,n){let r=e.docNameMap[n];if(r===void 0){e.docNameMap[n]=t;return}if(r===t)return;let i=e.docNameCollisions[n];i?i.includes(t)||i.push(t):e.docNameCollisions[n]=[t]}function Ve(e,t){let n=t.originalToHashed.get(e);if(n!==void 0)return n;let r=ze(e);return t.originalToHashed.set(e,r),Be(t,e,r),r}function He(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ue(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e,t){if(typeof e==`string`)return He(e,t.contentDir);if(Array.isArray(e))return e.map(e=>K(e,t));if(!Ue(e))return e;let n=typeof e.key==`string`&&Re.has(e.key)&&Ue(e.value)&&typeof e.value.stringValue==`string`?e.value.stringValue:null,r={};for(let[i,a]of Object.entries(e))if(n!==null&&i===`value`&&Ue(a)){let e=Ve(n,t);r[i]={...a,stringValue:e}}else Re.has(i)&&typeof a==`string`?r[i]=Ve(a,t):r[i]=K(a,t);return r}function We(e,t){if(t.originalToHashed.size===0)return e;let n=Array.from(t.originalToHashed.entries()).sort(([e],[t])=>t.length-e.length),r=e;for(let[e,t]of n)e.length!==0&&r.includes(e)&&(r=r.split(e).join(t));return r}function Ge(e,t){let n=B(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
5
- `),i=n.split(`
6
- `),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=K(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}U(e,r?`${a.join(`
7
- `)}\n`:a.join(`
8
- `))}function Ke(e,t){let n=B(e,`utf-8`);if(n.trim().length!==0)try{let r=K(JSON.parse(n),t),i=n.endsWith(`
9
- `)?`
10
- `:``;U(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=We(He(n,t.contentDir),t);r!==n&&U(e,r)}}function qe(e,t){let n=B(e,`utf-8`),r=He(n,t.contentDir);r!==n&&U(e,r)}function Je(e){try{return V(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>I(e,t.name))}catch{return[]}}const Ye=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function Xe(e){let t={contentDir:e.contentDir,docNameMap:{},originalToHashed:new Map,docNameCollisions:{}};for(let n of[`telemetry`,`logs`,`process`])for(let r of Je(I(e.stagingDir,n)))r.endsWith(`.jsonl`)?Ge(r,t):r.endsWith(`.json`)?Ke(r,t):qe(r,t);for(let n of Je(I(e.stagingDir,`state`))){let e=P(n);n.endsWith(`.jsonl`)?Ge(n,t):Ye.has(e)?Ke(n,t):qe(n,t)}return{docNameMap:t.docNameMap,docNameCollisions:t.docNameCollisions}}const Ze=[`.ok`,`local`,`telemetry`],Qe=[`.ok`,`local`,`logs`],$e=`spans-current.jsonl`,et=`spans-prev.jsonl`,tt=`server-current.jsonl`,nt=`server-prev.jsonl`;function rt(e){return I(e,...Ze,$e)}function it(e){return I(e,...Ze,et)}function at(e){return I(e,...Qe,tt)}function ot(e){return I(e,...Qe,nt)}const st=1e3;async function ct(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(st)});return t.ok?await t.text():null}catch{return null}}async function lt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(st)});return t.ok?await t.text():null}catch{return null}}async function ut(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(st)});return t.ok?await t.text():null}catch{return null}}function dt(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
11
- `)}\n`:null}catch{return null}}function ft(e){let t=I(e,`.git`,`ok`);if(!R(t))return null;let n=N(`git`,[`-C`,t,`log`,`--oneline`,`-50`],a({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function pt(e){let t=I(e,`.git`,`ok`);if(!R(t))return null;let n=N(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],a({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function mt(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function ht(){return{nodeVersion:process.version,platform:_e(),arch:pe()}}function gt(){return process.env.OTEL_SDK_DISABLED===`false`}function q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function _t(e){if(!R(e))return{};let t;try{t=(0,Ie.parse)(B(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q(t))return{};let n=t.telemetry;if(!q(n))return{};let r=n.localSink;return q(r)?r:{}}function vt(e){return typeof e==`boolean`?e:void 0}function yt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function J(e){if(q(e))return yt(e.maxBytes)}function bt(e){let t=_t(p(`project`,e)),n=_t(p(`project-local`,e));return{enabled:vt(n.enabled)??vt(t.enabled)??!0,spansMaxBytes:J(n.spans)??J(t.spans)??52428800,logsMaxBytes:J(n.logs)??J(t.logs)??26214400}}function xt(e){return G(`sha256`).update(e).digest(`hex`)}function St(e){let t=B(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Ct(e){let t=B(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function Y(e,t){return R(e)?(z(F(t),{recursive:!0}),se(e,t),!0):!1}function wt(e){let t=[],n=e=>{let r=V(e,{withFileTypes:!0});for(let i of r){let r=I(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Tt=new Set([`.jsonl`]);function Et(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Tt.has(e.slice(t))}const Dt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Ot(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Dt.has(e.slice(t))}function kt(e){let t=[];for(let n of wt(e)){let r=At(e,n);if(!Ot(r))continue;let{redacted:i,patterns:a,lineCount:o}=Te(B(n,`utf-8`));a.length!==0&&(U(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function At(e,t){return ae(e,t).split(oe).join(`/`)}async function jt(e){let r=L(e.contentDir),i=L(e.projectDir??e.contentDir),a=e.deps??{},o=a.fetchAgentPresence??ct,s=a.fetchAgentEffects??lt,c=a.fetchWatcherRecent??ut,l=a.readShadowHead??ft,u=a.readCheckpointRefs??pt,d=a.now??(()=>new Date),f=a.okVersion??(()=>A),p=a.readDesktopEnv??mt,m=a.readRuntime??ht,h=a.isOtlpPushEnabled??gt,g=ue(I(ye(),`ok-bundle-`));try{z(I(g,`telemetry`),{recursive:!0}),z(I(g,`logs`),{recursive:!0}),z(I(g,`state`),{recursive:!0}),Y(rt(i),I(g,`telemetry`,$e)),Y(it(i),I(g,`telemetry`,et)),Y(at(i),I(g,`logs`,tt)),Y(ot(i),I(g,`logs`,nt));let _=I(i,`.ok`,`local`),v=I(_,`server.lock`),y=`not-running`,b=`no server.lock`,x=null;if(R(v)){Y(v,I(g,`state`,`server.lock`));try{let e=B(v,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?x=t.port:b=`lock present but no port`}catch{b=`lock present but unparseable`}}if(x!==null){let e=await o(x);e===null?b=`agent-presence endpoint at :${x} unreachable`:(U(I(g,`state`,`agent-presence.json`),e),y=`running`,b=``);let t=await s(x);t!==null&&U(I(g,`state`,`agent-effects.json`),t);let n=await c(x);if(n!==null){let e=dt(n);e!==null&&U(I(g,`state`,`watcher-recent.jsonl`),e)}}let S=l(r);S!==null&&U(I(g,`state`,`shadow-head.txt`),S);let C=u(r);C!==null&&U(I(g,`state`,`checkpoint-refs.txt`),C),Y(I(_,`last-spawn-error.log`),I(g,`state`,`last-spawn-error.log`)),Y(I(_,n),I(g,`state`,n)),Y(I(_,t),I(g,`state`,t));let w=m(),T=p(),E={ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T}};U(I(g,`state`,`runtime.json`),`${JSON.stringify(E,null,2)}\n`);let ee=y===`running`?`running
12
- `:`not-running (${b})\n`;if(U(I(g,`state`,`server-status.txt`),ee),e.processDir&&R(e.processDir)){let t=I(g,`process`);z(t,{recursive:!0}),se(e.processDir,t,{recursive:!0})}let D=null;e.redact===!0&&(D=Xe({stagingDir:g,contentDir:r})),e.note&&U(I(g,`note.txt`),e.note);let O=null;e.scrubSecrets===!0&&(O=kt(g));for(let t of e.extraFiles??[])Y(t.sourcePath,I(g,`extra`,t.zipName??P(t.sourcePath)))||a.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let te=bt(i),ne=wt(g),k=[],A=0,j=0;for(let e of ne){let t=At(g,e),n=fe(e).size,r=Et(t)?St(e):0;k.push({path:t,bytes:n,lines:r}),A+=n,t.startsWith(`telemetry/`)&&Et(t)&&(j+=Ct(e))}let re=D===null?{applied:!1,docNameMapSidecar:null}:Object.keys(D.docNameCollisions).length>0?{applied:!0,docNameMapSidecar:null,docNameCollisions:D.docNameCollisions}:{applied:!0,docNameMapSidecar:null};O!==null&&(re.secretScrub=O);let M={schemaVersion:1,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:T},contentDir:{pathSha256:xt(r),absolutePath:D===null?r:`<CONTENT_DIR>`},telemetry:{localSink:te,otlpPushEnabled:h()},redaction:re,serverStatus:y,files:k};U(I(g,`manifest.json`),`${JSON.stringify(M,null,2)}\n`);let N=ne.some(e=>{try{return B(e,`utf-8`).includes(r)}catch{return!1}}),F={totalBytes:A,fileCount:k.length,docNameCount:j,contentDirVisible:N,redacted:D!==null},ie=!1;return{stagingDir:g,manifest:M,summary:F,redactionMapPayload:D===null?null:{docNameMap:D.docNameMap,docNameCollisions:D.docNameCollisions},cleanup:()=>{ie||(ie=!0,H(g,{recursive:!0,force:!0}))}}}catch(e){throw H(g,{recursive:!0,force:!0}),e}}async function Mt(e){let{collected:t,outputPath:n}=e,r=F(n);if(!R(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);if(t.redactionMapPayload!==null){let e=`${P(n,`.zip`)}.docnames.json`,r={...t.manifest,redaction:{...t.manifest.redaction,applied:!0,docNameMapSidecar:e}};U(I(t.stagingDir,`manifest.json`),`${JSON.stringify(r,null,2)}\n`)}let i=new Le.ZipFile,a=wt(t.stagingDir);for(let e of a){let n=At(t.stagingDir,e);i.addFile(e,n)}i.end(),t.redactionMapPayload!==null&&U(I(r,`${P(n,`.zip`)}.docnames.json`),`${JSON.stringify({docNameMap:t.redactionMapPayload.docNameMap,docNameCollisions:t.redactionMapPayload.docNameCollisions},null,2)}\n`,{mode:384});let o=ce(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function Nt(e,t){let n=I(e,`.ok`,`config.yml`);if(R(n))try{let t=(0,Ie.parse)(B(n,`utf-8`)),r=j(t)?t.content:void 0,i=j(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return L(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return L(e)}async function Pt(e,t,n){let r=await jt({contentDir:Nt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,deps:{readDesktopEnv:n,logger:e.logger}});try{z(F(e.outputPath),{recursive:!0}),await Mt({collected:r,outputPath:e.outputPath});let n=r.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:Oe(t,e.logger),files:r.manifest.files.map(e=>e.path),redactions:n?.redactions??[],redactedLineCount:n?.redactedLineCount??0,generatedAt:r.manifest.createdAt}}}finally{r.cleanup()}}async function Ft(e){let{projectDir:t}=e,n=e.readDesktopEnv??mt;if(e.level===`full`&&t!==void 0)return Pt(e,t,n);let{zipPath:r,summary:i}=await Fe({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n()});return{zipPath:r,summary:{level:e.level,systemWide:t===void 0,projectSlug:i.projectSlug,files:i.files,redactions:i.redactions,redactedLineCount:i.redactedLineCount,generatedAt:i.generatedAt}}}function X(e,t,n={}){let r=g(e,t);if(!R(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(B(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!v(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??_)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??h())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ge();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function It(e){return e.replace(/:\d+$/,``)}function Lt(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:It(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:It(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:It(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function Rt(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=r(t.hostname);if(n===null)return null;let i=t.pathname.split(`/`).filter(e=>e.length>0);if(i.length<5||i[2]!==`blob`)return null;let a,o,s,c;try{a=decodeURIComponent(i[0]),o=decodeURIComponent(i[1]),s=decodeURIComponent(i[3]),c=i.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.length===0||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function zt(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=r(t.hostname);if(n===null)return null;let i=t.pathname.split(`/`);if(i.length<5||i[0]!==``||i[3]!==`tree`)return null;let a=i.slice(5);a.length===1&&a[0]===``&&a.pop();let o,s,c,l;try{o=decodeURIComponent(i[1]),s=decodeURIComponent(i[2]),c=decodeURIComponent(i[4]),l=a.map(e=>decodeURIComponent(e))}catch{return null}return!o||!s||!c||l.some(e=>e.length===0)?null:{host:n,owner:o,repo:s,branch:c,path:l.join(`/`)}}function Bt(e){let t=Rt(e);if(t)return{kind:`doc`,...t};let n=zt(e);return n?{kind:`folder`,...n}:null}var Z=e(re(),1);const Vt=`# >>> open-knowledge cli >>>`,Ht=`# <<< open-knowledge cli <<<`,Ut=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Wt(e){return I(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const Gt={existsSync:e=>R(e),readFileSync:(e,t)=>B(e,t),lstatSync:e=>le(e),readlinkSync:e=>de(e)};function Kt(e,t=Gt){let n=Wt(e);if(!t.existsSync(n))return null;try{let e=JSON.parse(t.readFileSync(n,`utf8`));return e?.version===1?e:null}catch{return null}}function qt(e){let t=e.replace(Ut,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function Jt(e,t,n=Gt){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function Yt(e){return x(e)||b(e)||ee(e)}const Xt=10*1024*1024;function Zt(e,t,n,r){let i=ne(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!Yt(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);return e.format===`file`?(H(a,{force:!0}),{kind:`removed`}):e.format===`toml`?en(a,o):e.format===`yaml`?$t(a,e.topLevelKey,o):Qt(a,e.topLevelKey,e.serverMapSubKey,o)}function Qt(e,t,n,r){let i;try{i=B(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>Xt)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=T(i,O(t,n,r));return o?(m(e,a,{mode:D(e)}),{kind:`removed`}):{kind:`not-present`}}function $t(e,t,n){let r;try{r=B(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>Xt)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,Ie.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=E(a);a.trim()===``||a.endsWith(`
13
- `)?c.endsWith(`
14
- `)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
15
- `).replace(/\n/g,`\r
16
- `));let u=`${i?``:``}${c}`;return u!==r&&m(e,u,{mode:D(e)}),{kind:`removed`}}function en(e,t){let n=te();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=B(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=E(a),s=a.trim()===``||a.endsWith(`
17
- `),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
18
- `)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
19
- `).replace(/\n/g,`\r
20
- `));let u=`${i?``:``}${l}`;return u!==r&&m(e,u,{mode:D(e)}),{kind:`removed`}}const tn=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function nn(e,t,n=c){if(e!==void 0&&!tn.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let rn=null;function an(e){rn=e}function on(){return rn??process.cwd()}function sn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function cn(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function ln(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:d(r),command:r,isDesktop:sn(r)}}function un(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&un(e)?`ui-orphan`:`stale`}const dn=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function fn(e){switch(e){case`running`:return Z.default.green(e);case`desktop`:return Z.default.blue(e);case`foreign`:return Z.default.cyan(e);case`ui-orphan`:return Z.default.magenta(e);case`stale`:return Z.default.yellow(e)}}function pn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function mn(e){return`${pn(e.server.usage)} | ${pn(e.ui?.usage??null)}`}function hn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function gn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=Q(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,hn(e),mn(e),t,String(n),cn(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=fn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=Z.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
21
- `)}async function _n(e={}){let t=e.discover??u,n=e.inspect??X,r=e.log??(e=>console.log(e)),i=e.resolveCommand??o,a=e.resolveUsage??l,s=await t(),c=[];for(let e of s){let t=n(e,`server`),r=n(e,`ui`),o=ln(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&c.push(o)}if(e.json){let e=c.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(gn(e.all?c:c.filter(e=>dn.has(Q(e)))))}function vn(){return new w(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await _n({all:t.all===!0||e===`all`,json:t.json===!0})})}function yn(e,t,n={}){let r=n.isAlive??_,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function bn(e){let t=e.inspect??(t=>X(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=yn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function xn(e,t=_){let n=await u(),r=null;for(let i of n){let n=X(i,`server`),a=X(i,`ui`);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function Sn(e){let t=bn({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function Cn(e){return new w(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=bn({lockDir:i(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await _n({});return}if(n===`all`){let e=await u();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=X(n,`server`),r=X(n,`ui`);!$(e,_)&&!$(r,_)||(Sn(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await xn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}Sn(t);return}Sn(i(L(on(),n)))})}function wn(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}async function Tn(e,t){let n,i;try{n=await W(L(e)),i=await W(L(F(e)))}catch{return{kind:`not-git`}}if(!En(n,i))return{kind:`symlink-escape`};let a=I(n,`.git`),o;try{o=fe(a)}catch{return{kind:`not-git`}}if(o.isDirectory()){let e;try{e=await W(a)}catch{return{kind:`not-git`}}if(!En(e,n))return{kind:`symlink-escape`}}else if(!o.isFile())return{kind:`not-git`};let c=s(n);if(c.kind!==`repository`)return{kind:`not-git`};let l=c.repository.readRemoteUrl(`origin`);if(l.kind===`unreadable`)return{kind:`not-git`};if(l.kind===`absent`)return l.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let u=l.url,d=Lt(u);if(d===null)return{kind:`non-github`};let f=r(d.hostname);if(f===null)return{kind:`non-github`};let p=f===t.host.toLowerCase(),m=d.owner.toLowerCase()===t.owner.toLowerCase(),h=d.name.toLowerCase()===t.repo.toLowerCase();return!p&&m&&h?{kind:`wrong-host`,actualHost:f}:!p||!m||!h?{kind:`wrong-repo`,actualOwner:d.owner,actualRepo:d.name}:{kind:`ok`,gitRemoteUrl:`https://${f}/${d.owner}/${d.name}.git`}}function En(e,t){if(e===t)return!0;let n=ae(t,e);return n.length>0&&!n.startsWith(`..`)&&!ie(n)}const Dn=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=k(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=S(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function On(e,t,n={},r=Dn){let i=[];for(let a of t){let t=C[a];for(let a of r)i.push(a.write(t,e,n))}return i}function kn(e,t,n={}){return{integrations:On(e,t,n)}}export{Ft as C,Te as D,De as E,X as S,Mt as T,qt as _,Cn as a,zt as b,an as c,Vt as d,Ut as f,Kt as g,Wt as h,bn as i,nn as l,Jt as m,Tn as n,vn as o,Ht as p,wn as r,on as s,kn as t,Zt as u,Rt as v,jt as w,Lt as x,Bt as y};
22
- //# sourceMappingURL=src-kjR_dI-1.mjs.map
@@ -1 +0,0 @@
1
- import{_ as e,f as t,r as n}from"./start-BzSvov1E.mjs";export{n as bootStartServer,t as resolveHost,e as startCommand};