@inkeep/open-knowledge 0.82.0-beta.1 → 0.82.0-beta.3

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 (171) hide show
  1. package/dist/cli.mjs +70 -70
  2. package/dist/constants-BZCC7yS1.mjs +1 -0
  3. package/dist/{dist-cOlZ_g1o.mjs → dist-DttP19KX.mjs} +1 -1
  4. package/dist/dist-TAcrANM7.mjs +2132 -0
  5. package/dist/index.d.mts +1 -0
  6. package/dist/index.mjs +1 -1
  7. package/dist/init-D6Fi9suH.mjs +1 -0
  8. package/dist/{init-CVfek4Xt.mjs → init-DQVtFZSr.mjs} +40 -40
  9. package/dist/{launch-json-removal-DzjTVIT1.mjs → launch-json-removal-C5wtVwU_.mjs} +1 -1
  10. package/dist/loader-DeHi6YRp.mjs +1 -0
  11. package/dist/{loader-ByDVGbdV.mjs → loader-XJNah9bm.mjs} +1 -1
  12. package/dist/{md-manager-BGnqyqi1-_aOifsph.mjs → md-manager-BGnqyqi1-D77IwxHB.mjs} +149 -149
  13. package/dist/{open-browser-b5cByL_R.mjs → open-browser-CJaJbExe.mjs} +1 -1
  14. package/dist/parse-worker.mjs +1 -1
  15. package/dist/{preview-3y4CIIEA.mjs → preview-DFRLvckr.mjs} +1 -1
  16. package/dist/preview-y_qYI633.mjs +1 -0
  17. package/dist/public/assets/{ActivityModeContent-DOBqIwf0.js → ActivityModeContent-BqpVsK8l.js} +1 -1
  18. package/dist/public/assets/AddPropertiesButton-CAW5QCX8.js +2 -0
  19. package/dist/public/assets/{AgentDiffPane-Ceq-piD9.js → AgentDiffPane-Bg5A5RO2.js} +1 -1
  20. package/dist/public/assets/{AgentThreadClientBinder-ZCMADC7K.js → AgentThreadClientBinder-18BD6ihn.js} +1 -1
  21. package/dist/public/assets/{BugReportHistory-DF4MWYfb.js → BugReportHistory-C2kxTgHh.js} +1 -1
  22. package/dist/public/assets/{BugReportHistoryDialog-gCloscKr.js → BugReportHistoryDialog-DgtiL-NP.js} +1 -1
  23. package/dist/public/assets/{CodeMirrorPropInput-RvC4BT2l.js → CodeMirrorPropInput-lnPRDMaW.js} +1 -1
  24. package/dist/public/assets/{ConsentDialogBody-B4dRFslY.js → ConsentDialogBody-CD7KM28d.js} +1 -1
  25. package/dist/public/assets/{DeleteConfirmationDialog-j-IypjMj.js → DeleteConfirmationDialog-C1zIx9Bd.js} +1 -1
  26. package/dist/public/assets/{DiffViewBoundary-DmVyFPz3.js → DiffViewBoundary-DGNf5H84.js} +1 -1
  27. package/dist/public/assets/DocumentContext-CiI7-kAU.js +39 -0
  28. package/dist/public/assets/{EditorModeToggle-D1zbbbUU.js → EditorModeToggle-BJidPutF.js} +1 -1
  29. package/dist/public/assets/{ExcalidrawDocEditor-p90ZtQss.js → ExcalidrawDocEditor-BL56x7EQ.js} +1 -1
  30. package/dist/public/assets/FeedbackForm-DQYT8_7L.js +1 -0
  31. package/dist/public/assets/{GraphPanel-BDvjXMEQ.js → GraphPanel-nDzxbZwr.js} +2 -2
  32. package/dist/public/assets/{ImageAttachments-D6OJOCsx.js → ImageAttachments-Dob2zdX6.js} +1 -1
  33. package/dist/public/assets/{ImportSkillDialog-DnXLCmk-.js → ImportSkillDialog-UbeDdBTn.js} +1 -1
  34. package/dist/public/assets/{LintConfigEditor-D3GZN4CJ.js → LintConfigEditor-BY8qPMlW.js} +1 -1
  35. package/dist/public/assets/{ManagedArtifactProperties-QQH4W32k.js → ManagedArtifactProperties-B4Mp4oZQ.js} +1 -1
  36. package/dist/public/assets/ManagedArtifactProperties-s6BAlOXR.js +1 -0
  37. package/dist/public/assets/{MermaidDocEditor-DE3gnbEe.js → MermaidDocEditor-DJeha_H0.js} +1 -1
  38. package/dist/public/assets/{OpenInAgentMenuItem-BTXZ6GJd.js → OpenInAgentMenuItem-BMo7aLCS.js} +1 -1
  39. package/dist/public/assets/{PropertyDisplayRow-BwMaI7pA.js → PropertyDisplayRow-D9_d1KsK.js} +1 -1
  40. package/dist/public/assets/{RegisteredAgentIcon-DYSDhnfL.js → RegisteredAgentIcon-DbL9sShX.js} +1 -1
  41. package/dist/public/assets/{ReportBugDialogBody-D641oLxH.js → ReportBugDialogBody-DEETk9Jo.js} +1 -1
  42. package/dist/public/assets/{ReportBugMenuTrigger-BLGrQGJZ.js → ReportBugMenuTrigger-B1WREGjA.js} +1 -1
  43. package/dist/public/assets/{SchemaConfigEditor-DUZ90woT.js → SchemaConfigEditor-DAagpi8v.js} +1 -1
  44. package/dist/public/assets/{SessionsHost-CPH8N8Br.js → SessionsHost-mg9fx7DH.js} +2 -2
  45. package/dist/public/assets/SettingsDialogBody-DwNVEA39.js +12 -0
  46. package/dist/public/assets/{ShareBranchSwitchDialog-BaiZgNy4.js → ShareBranchSwitchDialog-DpxzT0qX.js} +1 -1
  47. package/dist/public/assets/{ShareReceiveDialog-Bsy3uU-q.js → ShareReceiveDialog-BKgD7Duc.js} +1 -1
  48. package/dist/public/assets/{ShareReceiveMissDialog-DC-xSpjj.js → ShareReceiveMissDialog-DShK8007.js} +1 -1
  49. package/dist/public/assets/{SkillCostValue-DQ8Tx_1m.js → SkillCostValue-CmCcSYjJ.js} +1 -1
  50. package/dist/public/assets/{SkillEditBanner-CFIWznnO.js → SkillEditBanner-DFdS9BhL.js} +1 -1
  51. package/dist/public/assets/{SkillForkDialog-C_-Mxjb0.js → SkillForkDialog-D5Aha7ke.js} +1 -1
  52. package/dist/public/assets/{SkillInstallMenu-BLPC0Old.js → SkillInstallMenu-8-VCWJg_.js} +2 -2
  53. package/dist/public/assets/{SkillOriginInline-CZCok01y.js → SkillOriginInline-DPQ0UfdG.js} +1 -1
  54. package/dist/public/assets/{SkillToolbarControls-Cqu0fYJP.js → SkillToolbarControls-Ca_jnifx.js} +1 -1
  55. package/dist/public/assets/{SlidesToolbarControls-CyQHjFAZ.js → SlidesToolbarControls-8Tu4pV-S.js} +1 -1
  56. package/dist/public/assets/{SourceEditor-D5OkY_xm.js → SourceEditor-CyVTEVVa.js} +1 -1
  57. package/dist/public/assets/{SyncStatusBadge-DBk1kDiF.js → SyncStatusBadge-CRsuOziY.js} +1 -1
  58. package/dist/public/assets/TerminalPanel-Db-Lo-iL.js +146 -0
  59. package/dist/public/assets/{TerminalWindowApp-C1YMxQ1R.js → TerminalWindowApp-Dv3QBZej.js} +1 -1
  60. package/dist/public/assets/{TextDocEditor-C15pHEq1.js → TextDocEditor-CLZRQrgg.js} +1 -1
  61. package/dist/public/assets/{ThreadView-D5CiRUdY.js → ThreadView-DGLAO83T.js} +6 -6
  62. package/dist/public/assets/{TimelineDiffPane-CZXCnzXZ.js → TimelineDiffPane-ErzMzIn_.js} +1 -1
  63. package/dist/public/assets/agent-connections-iuaYc-Gk.js +1 -0
  64. package/dist/public/assets/{auth-state-cache-Cx3RJPjN.js → auth-state-cache-Bz3EsxBR.js} +4 -4
  65. package/dist/public/assets/{bug-report-send-manager-vRHbDgcD.js → bug-report-send-manager-0DIkaLj0.js} +1 -1
  66. package/dist/public/assets/client-version-DJFCNOKL.js +1 -0
  67. package/dist/public/assets/{comment-chips-BusFArVG.js → comment-chips-u8dnjbXP.js} +1 -1
  68. package/dist/public/assets/{config-provider-DzMmXnPV.js → config-provider-krmD4VSt.js} +1 -1
  69. package/dist/public/assets/{css-color-to-hex-CvWv027U.js → css-color-to-hex-oO6GoCcb.js} +1 -1
  70. package/dist/public/assets/{diagnostic-breadcrumb-WWSlN_l6.js → diagnostic-breadcrumb-DK-Cqae0.js} +1 -1
  71. package/dist/public/assets/{dist-BQnk7HYC.js → dist-CUgbgEDy.js} +199 -199
  72. package/dist/public/assets/{doc-paths-zlKNK6ew.js → doc-paths-DaHerw67.js} +1 -1
  73. package/dist/public/assets/{doc-undo-manager-DKHy0q7O.js → doc-undo-manager-Dgsedc5E.js} +1 -1
  74. package/dist/public/assets/{documents-events-BkJZtY8-.js → documents-events-AGLgPGQa.js} +1 -1
  75. package/dist/public/assets/{file-tree-adapter-Bd2ICSy3.js → file-tree-adapter--GNP_kR2.js} +1 -1
  76. package/dist/public/assets/{file-tree-utils-BknD8oVN.js → file-tree-utils-lPpxK5Yq.js} +1 -1
  77. package/dist/public/assets/{folder-config-api-B069M2f5.js → folder-config-api-DDOXhGdo.js} +1 -1
  78. package/dist/public/assets/{index-BxhXolZV.js → index-7RGg47Tt.js} +15 -15
  79. package/dist/public/assets/{lint-config-client-CxrUSFhk.js → lint-config-client-B_xNfTBy.js} +1 -1
  80. package/dist/public/assets/{markdownlint-rule-browser-DLJGhZu8.js → markdownlint-rule-browser-DzjG_qoM.js} +1 -1
  81. package/dist/public/assets/messages-AFVdD964.js +1 -0
  82. package/dist/public/assets/messages-BCP_tUaH.js +1 -0
  83. package/dist/public/assets/messages-BcWRA-nI.js +1 -0
  84. package/dist/public/assets/messages-C0Gd4qNa.js +1 -0
  85. package/dist/public/assets/messages-C2ZTIk86.js +1 -0
  86. package/dist/public/assets/messages-CbN1r9yA.js +1 -0
  87. package/dist/public/assets/messages-DCLxtq5E.js +1 -0
  88. package/dist/public/assets/messages-DM9zlCjV.js +1 -0
  89. package/dist/public/assets/messages-OBzrmAFm.js +1 -0
  90. package/dist/public/assets/messages-fT_Mlcyb.js +1 -0
  91. package/dist/public/assets/messages-hoIRV_jf.js +1 -0
  92. package/dist/public/assets/messages-l5K8pww3.js +1 -0
  93. package/dist/public/assets/{messages-MxgwZHHO.js → messages-s1kQ0F_h.js} +1 -1
  94. package/dist/public/assets/{navigation-targets-JXxslLnB.js → navigation-targets-DV1dMVAb.js} +1 -1
  95. package/dist/public/assets/{page-list-cache-BjuTcwZG.js → page-list-cache-BaKlIcC-.js} +1 -1
  96. package/dist/public/assets/{pending-receive-nav-store-5ADsSQFT.js → pending-receive-nav-store-DPCjeW6k.js} +1 -1
  97. package/dist/public/assets/{preferred-session-events-Dn2B8C6Q.js → preferred-session-events-CeCXvWmc.js} +1 -1
  98. package/dist/public/assets/{progress-CqnKfHt4.js → progress-Ft463XK1.js} +1 -1
  99. package/dist/public/assets/{project-paths-B4WlvnNK.js → project-paths-Cs2SPmYR.js} +1 -1
  100. package/dist/public/assets/{prop-types-DTpxi1kh.js → prop-types-Dv_cZRA5.js} +1 -1
  101. package/dist/public/assets/{receive-store-CnxXP7Rx.js → receive-store-CvglCO2B.js} +1 -1
  102. package/dist/public/assets/{selection-context-MTxDLVBI.js → selection-context-Bk3yAvWZ.js} +1 -1
  103. package/dist/public/assets/{sign-in-terminal-events-BinEsAuS.js → sign-in-terminal-events-BigKQgqQ.js} +1 -1
  104. package/dist/public/assets/{skill-scope-DPIrVPTZ.js → skill-scope-BGcfBWlz.js} +1 -1
  105. package/dist/public/assets/{skills-api-Crupv6z4.js → skills-api-mYKB0zDh.js} +1 -1
  106. package/dist/public/assets/{src-Daqel6mE.js → src-XXqnTiU6.js} +1 -1
  107. package/dist/public/assets/{startup-marks-DKfzso0C.js → startup-marks-yQqTMBm5.js} +1 -1
  108. package/dist/public/assets/{tag-pill-input-CLaEMXUD.js → tag-pill-input-BQLv6DZ1.js} +1 -1
  109. package/dist/public/assets/{target-navigation-intent-zOwhEhjl.js → target-navigation-intent-BIFEl4OT.js} +1 -1
  110. package/dist/public/assets/{telemetry-impl-BRRd-RcW.js → telemetry-impl-C6m58fJK.js} +1 -1
  111. package/dist/public/assets/{telemetry-startup-BsjwiWJ3.js → telemetry-startup-DyEWsvUO.js} +1 -1
  112. package/dist/public/assets/{terminal-command-events-CSovYcNv.js → terminal-command-events-CoTkNESn.js} +1 -1
  113. package/dist/public/assets/{terminal-launch-events-HpRiFG59.js → terminal-launch-events-BBjjknBw.js} +1 -1
  114. package/dist/public/assets/{terminal-telemetry-DcIn01ci.js → terminal-telemetry-CGR3Wr8L.js} +1 -1
  115. package/dist/public/assets/{thread-client-HIe8sJZj.js → thread-client-V2_Sw10t.js} +1 -1
  116. package/dist/public/assets/{typing-burst-detector-CL5KDRYw.js → typing-burst-detector-BuHBn_6z.js} +4 -4
  117. package/dist/public/assets/{uninstall-Bt6xtxOO.js → uninstall-D_93vcTI.js} +1 -1
  118. package/dist/public/assets/{use-activity-panel-DzLRq9cH.js → use-activity-panel-DwWmPc8H.js} +1 -1
  119. package/dist/public/assets/{use-apply-config-language-C2bT8JQh.js → use-apply-config-language-COH3Pg2u.js} +2 -2
  120. package/dist/public/assets/{use-collab-url-Xg2vl_9f.js → use-collab-url-D3j3svaH.js} +1 -1
  121. package/dist/public/assets/{use-conflicts-q41ecWBs.js → use-conflicts-8sSRJ_Uy.js} +1 -1
  122. package/dist/public/assets/{use-git-sync-status-DjWrCson.js → use-git-sync-status-CBlTkWfK.js} +1 -1
  123. package/dist/public/assets/{use-installed-clis-BXQp0M3M.js → use-installed-clis-ClKL7RtP.js} +2 -2
  124. package/dist/public/assets/{use-live-xterm-theme-DJANnc0z.js → use-live-xterm-theme-bJiLIpxd.js} +1 -1
  125. package/dist/public/assets/{use-open-skill-Cgm4eiK3.js → use-open-skill-H_tjyNt-.js} +1 -1
  126. package/dist/public/assets/{use-settings-route-9O_1v-q-.js → use-settings-route-DL25HSeL.js} +1 -1
  127. package/dist/public/assets/use-skill-origin-Cts8svd2.js +1 -0
  128. package/dist/public/assets/{use-skills-B6Tde6G8.js → use-skills-DXlhkRBq.js} +1 -1
  129. package/dist/public/assets/{use-terminal-enabled-Dni3d_Dz.js → use-terminal-enabled-BXYM2yvn.js} +1 -1
  130. package/dist/public/assets/{use-timeline-entry-diff-Dfl9IJd1.js → use-timeline-entry-diff-8pKiL5Sa.js} +4 -4
  131. package/dist/public/assets/{use-workspace-CgZbdppm.js → use-workspace-DtyUPSZ4.js} +1 -1
  132. package/dist/public/index.html +60 -60
  133. package/dist/public/uninstall.html +4 -4
  134. package/dist/{registry-probes-Doa3GZq4.mjs → registry-probes-C8t0beB6.mjs} +3 -3
  135. package/dist/{removal-file-path-DlmtFn4q.mjs → removal-file-path-vGqtuN6p.mjs} +1 -1
  136. package/dist/{repair-launch-json-DjcDeSd5.mjs → repair-launch-json-C2M3QJCU.mjs} +1 -1
  137. package/dist/{repair-mcp-configs-Y_MP_1hu.mjs → repair-mcp-configs-DV7hcTRV.mjs} +1 -1
  138. package/dist/src-B4ZXvtQf.mjs +1 -0
  139. package/dist/src-D1k-b-_e.mjs +11 -0
  140. package/dist/start-C-MwllNx.mjs +1 -0
  141. package/dist/{start-C_5DC0R4.mjs → start-t8aEZijL.mjs} +3 -3
  142. package/package.json +4 -4
  143. package/dist/constants-Bz8XhLZu.mjs +0 -1
  144. package/dist/dist-3oA3zia0.mjs +0 -2132
  145. package/dist/init-C0y8oLMc.mjs +0 -1
  146. package/dist/loader-CZTg7pAU.mjs +0 -1
  147. package/dist/preview-BcUEAfkt.mjs +0 -1
  148. package/dist/public/assets/AddPropertiesButton-COghB4MS.js +0 -2
  149. package/dist/public/assets/DocumentContext-6Zo4cIac.js +0 -39
  150. package/dist/public/assets/FeedbackForm-YDv9UZil.js +0 -1
  151. package/dist/public/assets/ManagedArtifactProperties-DvmXJjMG.js +0 -1
  152. package/dist/public/assets/SettingsDialogBody-ZL-pCLjb.js +0 -12
  153. package/dist/public/assets/TerminalPanel-K8uVwNPo.js +0 -146
  154. package/dist/public/assets/agent-connections-Depa-j7X.js +0 -1
  155. package/dist/public/assets/client-version-C-A1i4im.js +0 -1
  156. package/dist/public/assets/messages-BDBAYcgi.js +0 -1
  157. package/dist/public/assets/messages-BPFEmUzm.js +0 -1
  158. package/dist/public/assets/messages-BnoKbdCv.js +0 -1
  159. package/dist/public/assets/messages-BpzBwGc9.js +0 -1
  160. package/dist/public/assets/messages-CEXxcyXU.js +0 -1
  161. package/dist/public/assets/messages-CnkR6nWa.js +0 -1
  162. package/dist/public/assets/messages-DPwRbG3V.js +0 -1
  163. package/dist/public/assets/messages-DSoseGQu.js +0 -1
  164. package/dist/public/assets/messages-DT_Xdx7c.js +0 -1
  165. package/dist/public/assets/messages-DiO77Vvy.js +0 -1
  166. package/dist/public/assets/messages-F6QG5tea.js +0 -1
  167. package/dist/public/assets/messages-jkXzQxuD.js +0 -1
  168. package/dist/public/assets/use-skill-origin-CmJxQKvj.js +0 -1
  169. package/dist/src-C234Uv27.mjs +0 -11
  170. package/dist/src-qb-EbuAU.mjs +0 -1
  171. package/dist/start-CqP2kaZm.mjs +0 -1
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./react-f2sANaYj.js";import{r as n}from"./dist-Nvb76hAm.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{Sc as i}from"./dist-BQnk7HYC.js";import{n as a}from"./dist-CJhtNlOm2.js";import{C as o,O as s}from"./skills-api-Crupv6z4.js";import{t as c}from"./use-skills-B6Tde6G8.js";var l=r(),u=e(t(),1);function d(e,t,n){let r=(0,l.c)(13),[i,a]=(0,u.useState)(!1),[s,c]=(0,u.useState)(!1),[d,p]=(0,u.useState)(0),m;r[0]!==n||r[1]!==t||r[2]!==e?(m=()=>{if(!n){a(!1);return}let r=!1;return o({scope:e,name:t,dryRun:!0}).then(e=>{r||(a(e.ok&&e.updated===!0),c(e.ok&&e.gitTracked===!0))}),()=>{r=!0}},r[0]=n,r[1]=t,r[2]=e,r[3]=m):m=r[3];let h;r[4]!==n||r[5]!==t||r[6]!==d||r[7]!==e?(h=[e,t,n,d],r[4]=n,r[5]=t,r[6]=d,r[7]=e,r[8]=h):h=r[8],(0,u.useEffect)(m,h);let g;r[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>p(f),r[9]=g):g=r[9];let _;return r[10]!==i||r[11]!==s?(_={available:i,gitTracked:s,recheck:g},r[10]=i,r[11]=s,r[12]=_):_=r[12],_}function f(e){return e+1}function p(e,t){return e.publisher?i(e.source,e.skill??t)?.skillsUrl??null:null}function m(e){let t=e.trim();if(/^https?:\/\//i.test(t))return t.includes(`github.com`)?t.replace(/\.git$/,``):null;if(/^(?:\.|\/|~|file:|git@)/.test(t))return null;let n=/^([\w.-]+)\/([\w.-]+?)(?:\.git)?(?:\/.*)?$/.exec(t);return n?`https://github.com/${n[1]}/${n[2]}`:null}function h(e,t){return p(e,t)??e.marketplaceUrl??m(e.source)}var g=new Set;function _(e){if(!e)return!1;if(e.autoUpdate!==void 0)return e.autoUpdate;let t=e.source.trim();return t.startsWith(`/`)||t.startsWith(`.`)||t.startsWith(`~`)||t.startsWith(`file://`)||/^[A-Za-z]:[\\/]/.test(t)||t.startsWith(`\\\\`)}function v(e){let t=(0,l.c)(33),{scope:r,name:i}=e,{_:f}=n(),p=c(),m=p.status===`ready`?p.data.find(e=>e.scope===r&&e.name===i):void 0,v=m?.origin??null,y=v?/^adopt:(.+)$/.exec(v.source):null,b=y?y[1].charAt(0).toUpperCase()+y[1].slice(1):null,x=!!v&&!b,{available:S,gitTracked:C,recheck:w}=d(r,i,x),[T,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(!1),k=_(v),A=m?.modified??!1,j;t[0]!==f||t[1]!==i||t[2]!==w||t[3]!==r?(j=async function(){E(!0);let e=await o({scope:r,name:i});if(E(!1),!e.ok){a.error(f({id:`AYoYhU`,values:{0:e.error}}));return}e.updated?a.success(f({id:`YS9mSt`,values:{0:e.source,name:i}})):a.success(f({id:`ah_ekO`,values:{name:i}}));for(let t of e.warnings)a.warning(t);w()},t[0]=f,t[1]=i,t[2]=w,t[3]=r,t[4]=j):j=t[4];let M=j;(0,u.useEffect)(()=>{if(!S||!k||A||T||C)return;let e=`${r}:${i}`;g.has(e)||(g.add(e),M())});let N;t[5]!==f||t[6]!==i||t[7]!==r?(N=async function(){let e=await o({scope:r,name:i,dryRun:!0});return e.ok?!e.updated||e.upstreamBody===void 0?(a.success(f({id:`ah_ekO`,values:{name:i}})),null):{localBody:e.localBody??``,upstreamBody:e.upstreamBody}:(a.error(f({id:`AYoYhU`,values:{0:e.error}})),null)},t[5]=f,t[6]=i,t[7]=r,t[8]=N):N=t[8];let P=N,F;t[9]!==f||t[10]!==i?(F=async function(){O(!0);let e=await s({name:i});if(O(!1),!e.ok){a.error(f({id:`RO9IbI`,values:{0:e.error}}));return}a.success(f({id:`BhLPRk`,values:{name:i}}));for(let t of e.warnings)a.warning(t)},t[9]=f,t[10]=i,t[11]=F):F=t[11];let I=F,L=v?/\/plugins\/cache\/[^/]+\/([^/]+)\//.exec(v.source)??/\/plugins\/marketplaces\/([^/]+)\//.exec(v.source):null,R=v?b?f({id:`e6dMJT`,values:{harnessLabel:b}}):L?f({id:`xBFg6z`,values:{0:L[1]}}):v.source:null,z=v?new Date(v.importedAt):null,B=z&&!Number.isNaN(z.getTime())?z.toLocaleDateString(void 0,{year:`numeric`,month:`short`,day:`numeric`}):v?.importedAt??null,V=v?h(v,i):null,H=B?f({id:`9J8xNg`,values:{importedLabel:B}}):null,U;t[12]!==f||t[13]!==i||t[14]!==r?(U=async e=>{let t=await o({scope:r,name:i,setAutoUpdate:e});if(!t.ok){a.error(f({id:`fMsFdZ`,values:{0:t.error}}));return}a.success(f(e?{id:`UNwKSz`,values:{name:i}}:{id:`HAvHev`,values:{name:i}}))},t[12]=f,t[13]=i,t[14]=r,t[15]=U):U=t[15];let W=m?.revertable??!1,G;return t[16]!==k||t[17]!==x||t[18]!==R||t[19]!==C||t[20]!==A||t[21]!==v||t[22]!==P||t[23]!==M||t[24]!==T||t[25]!==I||t[26]!==D||t[27]!==V||t[28]!==H||t[29]!==U||t[30]!==W||t[31]!==S?(G={origin:v,github:V,displaySource:R,importedTitle:H,canReimport:x,updateAvailable:S,modified:A,autoUpdate:k,gitTracked:C,setAutoUpdate:U,revertable:W,reimport:M,reimporting:T,previewUpdate:P,revert:I,reverting:D},t[16]=k,t[17]=x,t[18]=R,t[19]=C,t[20]=A,t[21]=v,t[22]=P,t[23]=M,t[24]=T,t[25]=I,t[26]=D,t[27]=V,t[28]=H,t[29]=U,t[30]=W,t[31]=S,t[32]=G):G=t[32],G}export{v as t};
@@ -1,11 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{Ac as t,Af as n,Ds as r,Ef as i,Es as a,Fn as o,Ks as s,Ls as c,Oc as l,Pn as ee,Ts as te,Un as ne,al as u,ed as d,jo as f,nl as p,rl as m,vf as h}from"./md-manager-BGnqyqi1-_aOifsph.mjs";import{Ai as g,Dt as _,Xo as v,Yo as y,Zo as b,_a as x,br as S,hi as C,ji as w,m as T,mi as re,pi as E,qn as D,qo as O,rr as k,si as A,sr as j,ti as M,xo as N}from"./dist-3oA3zia0.mjs";import{t as ie}from"./yazl-BBz29IQN.mjs";import{Ct as P,ot as ae,st as oe}from"./init-CVfek4Xt.mjs";import{l as se,x as ce}from"./registry-probes-Doa3GZq4.mjs";import{c as le}from"./colors-r_owlCuY.mjs";import{t as F}from"./is-object-BGze3w87.mjs";import{n as ue}from"./constants-Bz8XhLZu.mjs";import"./loader-ByDVGbdV.mjs";import"./preview-3y4CIIEA.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,rmSync as G,rmdirSync as Ce,statSync as we,writeFileSync as K}from"node:fs";import{arch as Te,freemem as Ee,homedir as q,hostname as De,platform as Oe,release as ke,tmpdir as Ae,totalmem as je,type as Me,uptime as Ne}from"node:os";import"node:fs/promises";import{createHash as Pe}from"node:crypto";const Fe=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`audit`,`deinit`,`auth`]);function Ie(e,t,n=j){if(e!==void 0&&!Fe.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Le=null;function Re(e){Le=e}function ze(){return Le??process.cwd()}const Be=`Open Knowledge`;function Ve(e={}){let t=e.platformName??process.platform,n=e.productName??i().productName;return ae(t).join(oe({...e,platformName:t}),n)}function He(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,a=ae(t),o;return o=t===`win32`?r.LOCALAPPDATA||a.join(n,`AppData`,`Local`):t===`darwin`?a.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||a.join(n,`.cache`),a.join(o,`${i().packageName.replaceAll(`/`,``)}-updater`)}function Ue(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 We(e){let t=R(e,`state.json`);if(!V(t))return[];let n;try{n=JSON.parse(U(t,`utf-8`))}catch{return[]}return Ue(n)??[]}function Ge(e){let t=R(e,`state.json`);if(!V(t))return!1;try{return Ue(JSON.parse(U(t,`utf-8`)))!==null}catch{return!1}}const Ke=8192;function qe(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 Je(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const Ye=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function Xe(e){return e.replace(Ye,`$1"[REDACTED-DEVICE-ID]"`)}function Ze(e){return Xe(Je(e))}const Qe=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function $e(e){if(typeof e!=`string`)return null;let t=Qe.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 et(e){let t=be(e,`r`);try{let e=Buffer.alloc(Ke),n=0,r=!1;for(;n<Ke;){let i=xe(t,e,n,Ke-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 tt(e){try{let t=et(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:$e(a)}}catch{return{kind:`unreadable`}}}function nt(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function rt(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=we(n).mtimeMs}catch{continue}if(r<i)continue;let c=tt(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!nt(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(O(),`bug-reports`)}function it(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 at(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function ot(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`))?Pe(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function st(){let e={timestamp:new Date().toISOString(),platform:Oe(),osType:Me(),osRelease:ke(),hostname:`[redacted]`,uptime:Ne(),freeMem:Ee(),totalMem:je(),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`,N({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 ct=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function lt(e){let t=I(e);return ct.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function ut(e,t){return mt(e,t).files}const dt=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function ft(e,t=se){let n=R(e,`${t}.ShipIt`);if(!V(n))return[];let r;try{r=W(n)}catch{return[]}return dt.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 pt(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,-ee.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 mt(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(lt),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=>!lt(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function ht(e){let t=R(e,`.ok`,`local`);return V(t)?{files:[`server.lock`,`last-spawn-error.log`,p,l].map(e=>R(t,e)).filter(e=>V(e))}:{files:[]}}function gt(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 _t(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#${Pe(`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 vt(e){let t=e.revealDocNames?e.content:_t(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=c(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`);vt({zipfile:e.zipfile,name:`${e.prefix}/${I(t)}`,content:t.endsWith(`.ips`)?Ze(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 yt(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,s=t.userLogsDir??R(O(),`logs`),c=t.projectDir?ot(t.projectDir,i):null;H(L(r),{recursive:!0}),i?.info({projectSlug:c},`gathering diagnostic data`);let l=st();l.desktop=t.desktop??null,l.language=t.language??null;let{files:ee,excludedByProjectSlug:te}=mt(c,s),{files:u}=t.projectDir?ht(t.projectDir):{files:[]},{files:d}=t.projectDir?gt(t.projectDir):{files:[]},f=t.shipItLogFiles??[],p=t.diagnosticReports?.files??[];i?.info({logFileCount:ee.length,logFilesExcludedByProjectSlug:te,lockFileCount:u.length,localSinkFileCount:d.length,shipItLogFileCount:f.length,diagnosticReportCount:p.length},`files collected`);let m=[],h=[],{ZipFile:g}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),_=new g;Y({zipfile:_,files:[...ee,...f],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i}),Y({zipfile:_,files:u,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i}),Y({zipfile:_,files:d,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i}),Y({zipfile:_,files:t.bugReportLedgerFiles??[],prefix:o,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i}),Y({zipfile:_,files:p,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:h,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=U(e.sourcePath),n=`extra/${e.zipName??I(e.sourcePath)}`;_.addBuffer(t,n),h.push(n);let r=at(e,n);r!==null&&m.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&vt({zipfile:_,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:h,redactions:m});let v=new Set(p.map(e=>`diagnostic-reports/${I(e)}`)),y=h.filter(e=>v.has(e)),b=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:qe(t.diagnosticReports,y.length);_.addBuffer(Buffer.from(`${b}\n`,`utf8`),`state/diagnostic-reports-status.txt`),h.push(`state/diagnostic-reports-status.txt`);let x=JSON.stringify(l,null,2);_.addBuffer(Buffer.from(x,`utf8`),`sysinfo.json`),h.push(`sysinfo.json`);let S={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:c,files:h,redactions:m,sysinfo:l};_.addBuffer(Buffer.from(JSON.stringify(S,null,2),`utf8`),`MANIFEST.json`);let C=m.reduce((e,t)=>e+t.lineCount,0),w=new Set(f.map(e=>`logs/${I(e)}`)),T=h.filter(e=>w.has(e)),re=new Set((t.bugReportLedgerFiles??[]).map(e=>`${o}/${I(e)}`)),E=h.filter(e=>re.has(e)),D=c?h.filter(e=>e.startsWith(`logs/`)&&!lt(e)&&!w.has(e)):[],k=y.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.`]:[],A=k.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...k]:[`Redaction was disabled for this bundle; file contents are unmodified.`],j=[`# Bug Report Bundle`,``,`Generated: ${S.generatedAt}`,`Project: ${c??`(unscoped)`}`,`Discipline version: ${S.disciplineVersion}`,``,`## Contents`,``,...h.map(e=>`- ${e}`),``,`## Privacy`,``,...D.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:`,...D.map(e=>`- ${e}`),``]:[],...T.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:`,...T.map(e=>`- ${e}`),``]:[],...y.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:`,...y.map(e=>`- ${e}`),``]:[],...E.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:`,...E.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${ne.join(`, `)}`,C>0?`${C} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...k,``,`This bundle is safe to attach to a GitHub issue.`]:A].join(`
2
- `);_.addBuffer(Buffer.from(j,`utf8`),`README.md`),_.end();let M=_e(r);return _.outputStream.pipe(M),await new Promise((e,t)=>{M.on(`close`,e),M.on(`error`,t)}),i?.info({bundlePath:r,fileCount:h.length,redactionCount:C},`bundle written`),{zipPath:r,summary:{projectSlug:c,files:h,redactions:m,redactedLineCount:C,generatedAt:S.generatedAt}}}var bt=d(),xt=e(ie(),1),X=e(le(),1);function St(e){let t=b(`user`,e,e);return y({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function Ct({home:e=q(),env:n=process.env}={}){let r=St(e),{override:i,preferenceList:a}=v(n),{locale:o,source:c}=s({override:i,storedPreference:r,supportedLocales:u,preferenceList:a,autoDetectableLocales:t});return{preference:r,locale:o,source:c,systemLanguages:a}}function wt(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Tt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Et(e,t){if(typeof e==`string`)return wt(e,t.contentDir);if(Array.isArray(e))return e.map(e=>Et(e,t));if(!Tt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Et(i,t);return n}function Dt(e,t){let n=U(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
3
- `),i=n.split(`
4
- `),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(e!==i.length-1||n!==``){if(n.length===0){a.push(``);continue}try{let e=Et(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
5
- `)}\n`:a.join(`
6
- `);K(e,o)}function Ot(e,t){let n=U(e,`utf-8`);if(n.trim().length!==0)try{let r=Et(JSON.parse(n),t),i=n.endsWith(`
7
- `)?`
8
- `:``;K(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=wt(n,t.contentDir);r!==n&&K(e,r)}}function kt(e,t){let n=U(e,`utf-8`),r=wt(n,t.contentDir);r!==n&&K(e,r)}function At(e){try{return W(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>R(e,t.name))}catch{return[]}}const jt=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function Mt(e){return/\.log\.\d+$/.test(e)}function Nt(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||Mt(e)}const Pt=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Ft(e){let t={contentDir:e.contentDir};for(let n of Pt)for(let r of At(R(e.stagingDir,n)))Nt(r)?Dt(r,t):r.endsWith(`.json`)?Ot(r,t):kt(r,t);for(let n of At(R(e.stagingDir,`state`))){let e=I(n);n.endsWith(`.jsonl`)?Dt(n,t):jt.has(e)?Ot(n,t):kt(n,t)}}const It=[`.ok`,`local`,`telemetry`],Lt=[`.ok`,`local`,`logs`],Rt=[`.ok`,`local`,`loss-capture`],zt=`spans-current.jsonl`,Bt=`spans-prev.jsonl`,Vt=`server-current.jsonl`,Ht=`server-prev.jsonl`,Ut=`loss-current.jsonl`,Wt=`loss-prev.jsonl`;function Gt(e){return R(e,...It,zt)}function Kt(e){return R(e,...It,Bt)}function qt(e){return R(e,...Lt,Vt)}function Jt(e){return R(e,...Lt,Ht)}function Yt(e){return R(e,...Rt,Ut)}function Xt(e){return R(e,...Rt,Wt)}const Zt=1e3;async function Qt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(Zt)});return t.ok?await t.text():null}catch{return null}}async function $t(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(Zt)});return t.ok?await t.text():null}catch{return null}}async function en(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(Zt)});return t.ok?await t.text():null}catch{return null}}function tn(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
9
- `)}\n`:null}catch{return null}}function nn(e){let t=R(e,`.git`,`ok`);if(!V(t))return null;let n=fe(`git`,[`-C`,t,`log`,`--oneline`,`-50`],N({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function rn(e){let t=R(e,`.git`,`ok`);if(!V(t))return null;let n=fe(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],N({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function an(){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 on(){return{nodeVersion:process.version,platform:Oe(),arch:Te()}}function sn(){return process.env.OTEL_SDK_DISABLED===`false`}function cn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ln(e){if(!V(e))return{};let t;try{t=(0,bt.parse)(U(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!cn(t))return{};let n=t.telemetry;if(!cn(n))return{};let r=n.localSink;return cn(r)?r:{}}function un(e){return typeof e==`boolean`?e:void 0}function dn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function fn(e){if(cn(e))return dn(e.maxBytes)}function pn(e){let t=ln(b(`project`,e)),n=ln(b(`project-local`,e));return{enabled:un(n.enabled)??un(t.enabled)??!0,spansMaxBytes:fn(n.spans)??fn(t.spans)??52428800,logsMaxBytes:fn(n.logs)??fn(t.logs)??26214400}}function mn(e){return Pe(`sha256`).update(e).digest(`hex`)}function hn(e){let t=U(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const gn=[`"doc.name"`,`"docName"`];function _n(e){let t=U(e,`utf-8`),n=0;for(let e of gn){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z(e,t){if(!V(e))return!1;try{return H(L(t),{recursive:!0}),e.endsWith(`.ips`)?K(t,Ze(U(e,`utf-8`))):ge(e,t),!0}catch{return!1}}function vn(e){let t=[],n=e=>{let r=W(e,{withFileTypes:!0});for(let i of r){let r=R(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const yn=new Set([`.jsonl`]);function bn(e){let t=e.lastIndexOf(`.`);return t!==-1&&yn.has(e.slice(t))}const xn=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function Sn(e){if(Mt(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&xn.has(e.slice(t))}function Cn(e){let t=[];for(let n of vn(e)){let r=wn(e,n);if(!Sn(r))continue;let{redacted:i,patterns:a,lineCount:o}=c(U(n,`utf-8`));a.length!==0&&(K(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function wn(e,t){return me(e,t).split(B).join(`/`)}async function Tn(e){let t=z(e.contentDir),n=z(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Qt,a=r.fetchAgentEffects??$t,s=r.fetchWatcherRecent??en,c=r.readShadowHead??nn,ee=r.readCheckpointRefs??rn,te=r.now??(()=>new Date),ne=r.okVersion??(()=>ue),u=r.readDesktopEnv??an,d=r.readLanguage??Ct,f=r.readRuntime??on,h=r.isOtlpPushEnabled??sn,g=ye(R(Ae(),`ok-bundle-`));try{H(R(g,`telemetry`),{recursive:!0}),H(R(g,`logs`),{recursive:!0}),H(R(g,`state`),{recursive:!0}),Z(Gt(n),R(g,`telemetry`,zt)),Z(Kt(n),R(g,`telemetry`,Bt)),Z(qt(n),R(g,`logs`,Vt)),Z(Jt(n),R(g,`logs`,Ht));for(let t of e.userLogFiles??[])Z(t,R(g,`logs`,I(t)));for(let t of e.userStateFiles??[])Z(t,R(g,o,I(t)));let _=0;for(let t of e.diagnosticReports?.files??[])Z(t,R(g,`diagnostic-reports`,I(t)))&&(_+=1);let v=R(n,`.ok`,`local`),y=R(v,`server.lock`),b=`not-running`,x=`no server.lock`,S=null;if(V(y)){Z(y,R(g,`state`,`server.lock`));try{let e=U(y,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?S=t.port:x=`lock present but no port`}catch{x=`lock present but unparseable`}}if(S!==null){let e=await i(S);e===null?x=`agent-presence endpoint at :${S} unreachable`:(K(R(g,`state`,`agent-presence.json`),e),b=`running`,x=``);let t=await a(S);t!==null&&K(R(g,`state`,`agent-effects.json`),t);let n=await s(S);if(n!==null){let e=tn(n);e!==null&&K(R(g,`state`,`watcher-recent.jsonl`),e)}}let C=c(t);C!==null&&K(R(g,`state`,`shadow-head.txt`),C);let w=ee(t);w!==null&&K(R(g,`state`,`checkpoint-refs.txt`),w),Z(Yt(n),R(g,`state`,Ut)),Z(Xt(n),R(g,`state`,Wt)),Z(R(v,`last-spawn-error.log`),R(g,`state`,`last-spawn-error.log`)),Z(R(v,m),R(g,`state`,m)),Z(R(v,p),R(g,`state`,p)),Z(R(v,l),R(g,`state`,l));let T=f(),re=u(),E=d(),D={ok:{version:ne(),nodeVersion:T.nodeVersion,platform:T.platform,arch:T.arch},host:{desktop:re,language:E}};K(R(g,`state`,`runtime.json`),`${JSON.stringify(D,null,2)}\n`);let O=b===`running`?`running
10
- `:`not-running (${x})\n`;K(R(g,`state`,`server-status.txt`),O);let k=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:qe(e.diagnosticReports,_);if(K(R(g,`state`,`diagnostic-reports-status.txt`),`${k}\n`),e.processDir&&V(e.processDir)){let t=R(g,`process`);H(t,{recursive:!0}),ge(e.processDir,t,{recursive:!0})}let A=e.redact===!0;A&&Ft({stagingDir:g,contentDir:t}),e.note&&K(R(g,`note.txt`),e.note);let j=null;e.scrubSecrets===!0&&(j=Cn(g));for(let t of e.extraFiles??[]){let e=t.zipName??I(t.sourcePath);if(!Z(t.sourcePath,R(g,`extra`,e))){r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=at(t,`extra/${e}`);n!==null&&(j??={redactions:[],redactedLineCount:0},j.redactions.push(n),j.redactedLineCount+=n.lineCount)}let M=pn(n),N=vn(g),ie=[],P=0,ae=0;for(let e of N){let t=wn(g,e),n=we(e).size,r=bn(t)?hn(e):0;ie.push({path:t,bytes:n,lines:r}),P+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(ae+=_n(e))}let oe={applied:A};j!==null&&(oe.secretScrub=j);let se={schemaVersion:2,createdAt:te().toISOString(),ok:{version:ne(),nodeVersion:T.nodeVersion,platform:T.platform,arch:T.arch},host:{desktop:re,language:E},contentDir:{pathSha256:mn(t),absolutePath:A?`<CONTENT_DIR>`:t},telemetry:{localSink:M,otlpPushEnabled:h()},redaction:oe,serverStatus:b,files:ie};K(R(g,`manifest.json`),`${JSON.stringify(se,null,2)}\n`);let ce=N.some(e=>{try{return U(e,`utf-8`).includes(t)}catch{return!1}}),le={stagedDiagnosticReports:_,totalBytes:P,fileCount:ie.length,docNameCount:ae,contentDirVisible:ce,redacted:A},F=!1;return{stagingDir:g,manifest:se,summary:le,cleanup:()=>{F||(F=!0,G(g,{recursive:!0,force:!0}))}}}catch(e){throw G(g,{recursive:!0,force:!0}),e}}async function En(e){let{collected:t,outputPath:n}=e,r=L(n);if(!V(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new xt.ZipFile,a=vn(t.stagingDir);for(let e of a){let n=wn(t.stagingDir,e);i.addFile(e,n)}i.end();let o=_e(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 Dn(e,t){let n=R(e,`.ok`,`config.yml`);if(V(n))try{let t=(0,bt.parse)(U(n,`utf-8`)),r=F(t)?t.content:void 0,i=F(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return z(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return z(e)}async function On(e,t,n,r,i){let a=ot(t,e.logger),o=await Tn({contentDir:Dn(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...ut(a,e.userLogsDir??R(O(),`logs`)),...ft(e.cachesDir??R(q(),`Library`,`Caches`))],userStateFiles:pt(e.bugReportsDir??J()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{H(L(e.outputPath),{recursive:!0}),await En({collected:o,outputPath:e.outputPath});let t=o.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:a,files:o.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:o.manifest.createdAt}}}finally{o.cleanup()}}async function kn(e){let{projectDir:t}=e,n=e.readDesktopEnv??an,r=e.readLanguage??Ct,i=()=>rt(e.diagnosticReportsDir??R(q(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return On(e,t,n,r,i());let{zipPath:a,summary:o}=await yt({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:ft(e.cachesDir??R(q(),`Library`,`Caches`)),bugReportLedgerFiles:pt(e.bugReportsDir??J()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}function Q(e,t,n={}){let r=C(e,t),i;try{i=U(r,`utf-8`)}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`?{status:`missing`,lockPath:r}:{status:`read-error`,lockPath:r,error:e instanceof Error?e.message:String(e)}}let a;try{a=JSON.parse(i)}catch{return{status:`corrupt`,lockPath:r}}let o=a&&typeof a==`object`?a:{},s=`machineId`in o&&typeof o.machineId==`string`?o.machineId!==(n.machineId??S()):`hostname`in o&&typeof o.hostname==`string`&&o.hostname!==(n.host??De());if(!a||typeof a!=`object`||!A(a.pid))return{status:`corrupt`,lockPath:r,...s?{foreignHost:!0}:{}};let c=a.pid,l=`machineId`in o&&typeof o.machineId==`string`||`hostname`in o&&typeof o.hostname==`string`;return s?{status:`foreign-host`,lockPath:r,lock:a}:(n.isAlive??M)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}function An(e){return e.status===`unverified-owner`?`Cannot verify shutdown: the server lock at ${e.lockPath} does not record its owning machine, and its recorded process ${e.pid} is still running on this machine. Check whether process ${e.pid} is an OpenKnowledge server. If it is, stop it and retry. Do not remove the lock file while that process is running.`:`Cannot verify shutdown: the server lock at ${e.lockPath} belongs to another machine. Stop OpenKnowledge on the owning machine. Confirm that no OpenKnowledge server is using this directory on the owning machine or any other machine sharing it. Only then remove the stale lock file at ${e.lockPath} and retry cleanup.`}function jn(e){return e.replace(/:\d+$/,``)}function Mn(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:jn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:jn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:jn(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}const Nn=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Pn(e){return r(n(),e)}function Fn(){return a(n())}function In(){let e=n();if(e===`stable`)return Nn;let t=te(e);return RegExp(`^# >>> ${t} >>>\\n[\\s\\S]*?^# <<< ${t} <<<\\n?`,`m`)}const Ln={existsSync:e=>V(e),readFileSync:(e,t)=>U(e,t),lstatSync:e=>ve(e),readlinkSync:e=>Se(e)};function Rn(e,t=Ln){let n=Pn(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 zn(e){let t=e.replace(In(),``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function Bn(e,t,n=Ln){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}const Vn=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],Hn=[..._.map(e=>T[e]),`open-knowledge`];function Un(e){if(!pe(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=z(e);if(t===B||L(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function Wn(e,t){let n=me(e,t);if(n.startsWith(`..`)||pe(n))return!1;let r=e;for(let e of n.split(B)){r=R(r,e);try{if(!ve(r).isDirectory())return!1}catch{return!1}}return!0}function Gn(e,t){try{return W(e).every(n=>t.has(R(e,n)))}catch{return!1}}function Kn(e){let t=Un(e),n=[],r=[],i=new Set;for(let e of Vn){let a=R(t,e.hostDir,`skills`);if(!Wn(t,a))continue;let o=Hn.map(e=>R(a,e)).filter(e=>V(e));n.push(...o);for(let e of o)i.add(e);let s=R(t,e.pruneRoot),c=a;for(;Gn(c,i)&&(r.push(c),i.add(c),c!==s);){let e=L(c);if(e===c||e===t||!e.startsWith(t+B))break;c=e}}return{skillDirs:n,emptyDirs:r}}function qn(e){try{if(!ve(e).isDirectory())return!1;let t=W(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function Jn(e){let t=new Set,n=new Set;for(let r of Vn){let i=R(e,r.hostDir,`skills`);for(let e of Hn)t.add(R(i,e));let a=R(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=L(o);if(t===o||t===e||!t.startsWith(e+B))break;o=t}}return{skillDirs:t,emptyDirs:n}}function Yn(e,t){let n=Un(e),r=Jn(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(Wn(n,e)&&qn(e))try{G(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(Wn(n,e))try{Ce(e),a.push(e)}catch{}return a}function Xn(e){let t=Un(e),n=[];for(let e of _){let r=T[e];n.push({path:R(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of h)n.push({path:R(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function Zn(e,t){let n=[];for(let r of Xn(e))if(r.bundleId===t)try{G(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}function Qn(e){return e!=null&&e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function $n(e,t=Date.now()){if(e===null)return`—`;let n=f(e,t);return n===`unknown`?`—`:n}function er(e){let t=L(e);return I(e)===`local`&&I(t)===`.ok`?L(t):I(e)===`.ok`?t:null}function tr(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`||t.status===`read-error`)return null;if(t.status===`unverified-owner`)return{directory:er(e),server:{port:null,status:t.status,pid:t.pid,startedAt:null,usage:null},ui:null,hostname:null,lockPath:t.lockPath,binary:null,command:null,isDesktop:!1};let i=t.lock,a=t.status===`alive`&&E(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:k(n),command:n,isDesktop:Qn(n)}}function nr(e){let t=e.server.status;switch(t){case`unverified-owner`:return`unverified`;case`alive`:return e.isDesktop?`desktop`:`running`;case`foreign-host`:return e.isDesktop?`desktop`:`foreign`;case`dead-pid`:return`stale`;default:return t}}const rr=new Set([`running`,`desktop`,`foreign`,`unverified`]);function ir(e){switch(e){case`running`:return X.default.green(e);case`desktop`:return X.default.blue(e);case`foreign`:return X.default.cyan(e);case`unverified`:case`stale`:return X.default.yellow(e)}}function ar(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function or(e){return`${ar(e.server.usage)} | ${ar(e.ui?.usage??null)}`}function sr(e){return`${e.server.port===null?`—`:e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function cr(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory??`—`,sr(e),or(e),nr(e),String(e.server.pid),$n(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=ir(nr(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=X.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
11
- `)}async function lr(e={}){let t=e.discover??D,n=e.inspect??(e=>Q(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??g,a=e.resolveUsage??w,o=await t(),s=[];for(let e of o){let t=n(e),r=tr(e,t,t.status===`missing`||t.status===`corrupt`||t.status===`read-error`||t.status===`unverified-owner`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`||t.status===`read-error`||t.status===`unverified-owner`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:nr(e)}));r(JSON.stringify(e,null,2));return}r(cr(e.all?s:s.filter(e=>rr.has(nr(e)))))}function ur(){return new P(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale entries (foreign and unverified entries already show)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await lr({all:t.all===!0||e===`all`,json:t.json===!0})})}async function dr(e,t=ce()){let n=Q(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=re(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500),redirect:`manual`});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function fr(e,t={}){return{targets:$(e,t.isAlive??M)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function pr(e){let t=e.inspect??(()=>Q(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??dr,o=e.logger??ce(),s=fr(t(),{isAlive:e.isAlive});if(s.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:s.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let c=[],l=[];for(let e of s.targets)try{n(e.pid,`SIGTERM`),c.push(e)}catch(t){l.push({target:e,error:t instanceof Error?t.message:String(t)})}return c.length>0&&r(`Stopped: ${c.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:c.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:l.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),l.length>0&&i(`Failed to stop: ${l.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:c,failed:l,hadTargets:!0}}function $(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}async function mr(e,t=M){let n=await D(),r=null;for(let i of n){let n=Q(i,`server`);if($(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function hr(e,t){let n=await pr({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function gr(e,t,n={}){return t===0?`Nothing was running for ${e}, and no other open-knowledge servers are running.`:`Nothing was running for ${e}. ${t} other open-knowledge server${t===1?` is`:`s are`} running${n.listingFollows===!0?``:" — run `ok ps` to list them"}.`}async function _r(e){let t=await D(),n=0;for(let r of t)r!==e&&$(Q(r,`server`),M)&&n++;return n}function vr(e){return new P(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the enclosing project — run it from anywhere inside the project. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).option(`--force`,`Stop even when editor windows or agents are still connected to the server`).action(async(t,n)=>{let r=n.force===!0,i=t.length===0?void 0:t.join(` `);if(i===void 0){e();let t=x(process.cwd()),n=await pr({lockDir:t,force:r,log:()=>{}});if(n.hadTargets){if(n.stopped.length>0){let e=n.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1)}else{let e=await _r(t);console.log(gr(process.cwd(),e,{listingFollows:e>0})),e>0&&await lr({})}return}if(i===`all`){let e=await D();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)$(Q(n,`server`),M)&&(await hr(n,r),t++);t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(i)){let e=Number.parseInt(i,10),t=await mr(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await hr(t,r);return}let a=z(ze(),i),o=x(a),s=[],c=await pr({lockDir:o,force:r,log:e=>s.push(e)});if((c.failed.length>0||c.declined!==void 0)&&(process.exitCode=1),c.hadTargets)for(let e of s)console.log(e);else console.log(gr(a,await _r(o)))})}export{ze as A,rt as C,Ve as D,He as E,Ie as M,We as O,J as S,Be as T,Q as _,Yn as a,En as b,Xn as c,Pn as d,Fn as f,An as g,Mn as h,ur as i,Re as j,Ge as k,Nn as l,zn as m,pr as n,Kn as o,Rn as p,vr as r,Zn as s,dr as t,Bn as u,kn as v,qe as w,it as x,Tn as y};
@@ -1 +0,0 @@
1
- import"./md-manager-BGnqyqi1-_aOifsph.mjs";import"./init-CVfek4Xt.mjs";import"./registry-probes-Doa3GZq4.mjs";import"./src-C234Uv27.mjs";import"./start-C_5DC0R4.mjs";import{n as e}from"./loader-ByDVGbdV.mjs";import"./preview-3y4CIIEA.mjs";import"./repair-mcp-configs-Y_MP_1hu.mjs";export{e as loadConfig};
@@ -1 +0,0 @@
1
- import{S as e,m as t,p as n,r}from"./start-C_5DC0R4.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};