@inkeep/open-knowledge 0.83.0 → 0.83.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.
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/assets/skills/project/references/linking.md +1 -1
- package/dist/cli.mjs +6 -6
- package/dist/constants-BYOV-C2G.mjs +1 -0
- package/dist/dist-BHg9XI3A.mjs +2198 -0
- package/dist/{dist-DuSuuwp2.mjs → dist-ByQ8IZXo.mjs} +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +152 -152
- package/dist/{init-0oLlE1YP.mjs → init-BCovADrd.mjs} +2 -2
- package/dist/init-CXmnCQgu.mjs +1 -0
- package/dist/{launch-json-removal-COnVteTA.mjs → launch-json-removal-B9t9Mq8v.mjs} +1 -1
- package/dist/{loader-1manjX2x.mjs → loader-BbuaTl8Z.mjs} +1 -1
- package/dist/loader-DaIoHbyS.mjs +1 -0
- package/dist/{md-manager-BGnqyqi1-IqwoPmS1.mjs → md-manager-BGnqyqi1-DsBy1Dky.mjs} +1 -1
- package/dist/native/native-config.win32-arm64-msvc.node +0 -0
- package/dist/native/native-config.win32-x64-msvc.node +0 -0
- package/dist/{open-browser-jE55xNly.mjs → open-browser-CJogphTe.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-C5jJBQtN.mjs → preview-BGuq_NIN.mjs} +1 -1
- package/dist/preview-DNxSFxNa.mjs +1 -0
- package/dist/public/assets/{AccountSection-DTTPxtuy.js → AccountSection-BpY8fXau.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-CQzz888N.js → ActivityModeContent-B7SYD_oX.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-sAtpD3bF.js → AddPropertiesButton-VyqVtzIN.js} +2 -2
- package/dist/public/assets/{AgentConnectionsSection-CmOmHMSc.js → AgentConnectionsSection-CJhM0Oqw.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-C5rwquce.js → AgentDiffPane-DAIaj_6D.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-CwdNONkc.js → AttachmentsSection-DL8roP-O.js} +1 -1
- package/dist/public/assets/{AuthModal-D1eciNeA.js → AuthModal-DcixDUcD.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-DNYs7K0K.js → CodeMirrorPropInput-BWNyI9V2.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-DuNQpths.js → ContentRulesSection-h6pHMqD1.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-DnPwZD0g.js → DiffViewBoundary-B5VRWFoq.js} +1 -1
- package/dist/public/assets/{DocumentContext-CDwWviYm.js → DocumentContext-DxDNsrxc.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-W5mm426e.js → EditorModeToggle-rSAArExF.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-CW1j5GUX.js → ExcalidrawDocEditor-DiIxuNaj.js} +1 -1
- package/dist/public/assets/FeedbackForm-n4cK_QGh.js +1 -0
- package/dist/public/assets/{GraphPanel-CpJ-EZeA.js → GraphPanel-ZgCaGJ14.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-DkTuvulO.js → ImportSkillDialog-lPX3LQOm.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-BxmWF9rJ.js → LinkPreviewsSection-mmAXSLtK.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-zLsWA0AF.js → LintConfigEditor-BbhL2owO.js} +1 -1
- package/dist/public/assets/LintingSection-CSM0_1QE.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-ColnuPUV.js → ManagedArtifactProperties-YaOwWUAx.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-uoCdZH2I.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-BwSa_Kj7.js → MermaidDocEditor-BQetPb3J.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-DS-N7ydZ.js → NetworkAccessSection-CJ0RJ37j.js} +1 -1
- package/dist/public/assets/{ProjectTemplatesSection-BgjUl8Rv.js → ProjectTemplatesSection-Cf5bgyHk.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-DmCbpgtw.js → PropertyDisplayRow-BxgncotE.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-BjbUw2by.js → PublishToGitHubDialog-BjLmDxVs.js} +1 -1
- package/dist/public/assets/{RegisteredAgentIcon-DHzxArZN.js → RegisteredAgentIcon-jysj1Acv.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-Ds-Wwcpz.js → SchemaConfigEditor-CL13boF8.js} +1 -1
- package/dist/public/assets/{SearchSection-DWQPLLZH.js → SearchSection-D6cO9U0B.js} +1 -1
- package/dist/public/assets/{SessionsHost-Dy_wH2Wz.js → SessionsHost-BH4nUjR2.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-CEe2nLHS.js → SettingsDialogBody-DOlLSJng.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-CSwgOlOM.js → ShareReceiveMissDialog-C4IgyZWj.js} +1 -1
- package/dist/public/assets/{SkillCostValue-DC_VaXgy.js → SkillCostValue-Bgy3wkjV.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-DeoTv3wY.js → SkillForkDialog-CwCSC6Z0.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-1E0cH5_q.js → SkillInstallMenu-BIs2wAUZ.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-CLKoMHNo.js → SkillOriginInline-Dr1zcAGa.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DNsDkeEV.js → SkillToolbarControls-CnDExhdQ.js} +1 -1
- package/dist/public/assets/{SkillsManagerSection-DKedsWHo.js → SkillsManagerSection-CiaThXM_.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-BSKDSVIG.js → SlidesToolbarControls-BpGxFSJu.js} +1 -1
- package/dist/public/assets/{SourceEditor-BlbcJdBG.js → SourceEditor-3U1rZw1J.js} +1 -1
- package/dist/public/assets/{SpellingSettings-CSLMKByF.js → SpellingSettings-BAFQbL_s.js} +1 -1
- package/dist/public/assets/{SyncSection-B-0xnMkA.js → SyncSection-Ciu87ehb.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-CH-ZxZGx.js → SyncStatusBadge-CJXgXQeb.js} +1 -1
- package/dist/public/assets/{TemplateRow-B2jVmQlY.js → TemplateRow-Bj4hpJ-E.js} +1 -1
- package/dist/public/assets/{TerminalLaunchContext-BReEuF5W.js → TerminalLaunchContext-kR8NUVFa.js} +1 -1
- package/dist/public/assets/{TerminalPanel-DQg3L4EK.js → TerminalPanel-CBpH9VnO.js} +1 -1
- package/dist/public/assets/{TerminalSection-CW6bVoDJ.js → TerminalSection-BIeBUi3Y.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-Cgr90cUf.js → TerminalWindowApp-D75W_nOD.js} +1 -1
- package/dist/public/assets/{TextDocEditor-YUi-Iplf.js → TextDocEditor-Dir-jZtA.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-Q9Vltk4w.js → ThemePluginSection-CovSRzUr.js} +1 -1
- package/dist/public/assets/{ThreadView-5gjgK_DM.js → ThreadView-B5ZZtVV4.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-KqkBWswY.js → TimelineDiffPane-QDBoFYDb.js} +1 -1
- package/dist/public/assets/{agent-connections-D-XX-7tC.js → agent-connections-BmjcmCOh.js} +1 -1
- package/dist/public/assets/{agent-registry-CC-eSzdu.js → agent-registry--47SG0kt.js} +1 -1
- package/dist/public/assets/{bridge-1xVdv27q.js → bridge-njD5PB6P.js} +1 -1
- package/dist/public/assets/{card-CUu_Dbtf.js → card-BsBNZHzU.js} +1 -1
- package/dist/public/assets/{catalog-DQ0C9DYn.js → catalog-DtlAjcAT.js} +1 -1
- package/dist/public/assets/{client-version-Dhdam9yn.js → client-version-C-aFlRsC.js} +1 -1
- package/dist/public/assets/{comment-chips-CXPOi5DO.js → comment-chips-C9FVyemH.js} +1 -1
- package/dist/public/assets/{config-provider-CA1b0otM.js → config-provider-ang-QnXf.js} +1 -1
- package/dist/public/assets/config-schema-CcRHTCTU.js +1 -0
- package/dist/public/assets/{css-color-to-hex-Ds26W_X-.js → css-color-to-hex-vFOfC-Pa.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-KJDEezHH.js → doc-undo-manager-D4kt3rYd.js} +1 -1
- package/dist/public/assets/field-controls-DF8qjTLS.js +1 -0
- package/dist/public/assets/{field-controls-Bm8W4dMo.js → field-controls-DdO1Jfbb.js} +1 -1
- package/dist/public/assets/{frontmatter-tags-BIkfDL6K.js → frontmatter-tags-B-pVcI4P.js} +1 -1
- package/dist/public/assets/index-BCiCqT8R.js +2205 -0
- package/dist/public/assets/{lint-config-client-Dk5JUh5o.js → lint-config-client-D0TnXak8.js} +1 -1
- package/dist/public/assets/{lint-plugins-D0OR2gqs.js → lint-plugins-CT78JavG.js} +1 -1
- package/dist/public/assets/{markdown-lint-BuIftP9_.js → markdown-lint-BKCKKMvW.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-C_XoUwYX.js → markdownlint-rule-browser-CLiJDsUJ.js} +1 -1
- package/dist/public/assets/messages-B3fCTSsU.js +1 -0
- package/dist/public/assets/messages-B4LuE4Uj.js +1 -0
- package/dist/public/assets/messages-BE2Gn3RX.js +1 -0
- package/dist/public/assets/messages-BI2FOXv1.js +1 -0
- package/dist/public/assets/messages-BW-Cdt9C.js +1 -0
- package/dist/public/assets/messages-BvhAxQrI.js +1 -0
- package/dist/public/assets/messages-CTIWBL1W.js +1 -0
- package/dist/public/assets/messages-CWGa07Dg.js +1 -0
- package/dist/public/assets/messages-DWxo7VDJ.js +1 -0
- package/dist/public/assets/messages-Df0SITTo.js +1 -0
- package/dist/public/assets/messages-HU4oqbuE.js +1 -0
- package/dist/public/assets/messages-b7a1Syss.js +1 -0
- package/dist/public/assets/messages-viWmNfI1.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-Cl__M2P3.js → pending-receive-nav-store-DVgbBI_j.js} +1 -1
- package/dist/public/assets/{preferred-session-events-78C4kXpL.js → preferred-session-events-Ayg96deM.js} +1 -1
- package/dist/public/assets/{progress-CxYYQVJg.js → progress-DK60f0xv.js} +1 -1
- package/dist/public/assets/{saved-themes-client-B-8W7FeI.js → saved-themes-client-DQgpb_Nl.js} +1 -1
- package/dist/public/assets/{schema-section-BsG4UYYw.js → schema-section-DShGMOyT.js} +1 -1
- package/dist/public/assets/{schemas-api-KjBzkxAy.js → schemas-api-C4CP1G39.js} +1 -1
- package/dist/public/assets/{selection-context-zIbsZWBB.js → selection-context-ClNQPaFJ.js} +1 -1
- package/dist/public/assets/{skills-api-DfXaxEkX.js → skills-api-BUVVp6gv.js} +1 -1
- package/dist/public/assets/{src-CmVf3jdp.js → src-HUmS96mW.js} +1 -1
- package/dist/public/assets/storage-scope-DRWogX35.js +1 -0
- package/dist/public/assets/{tag-pill-input-D_82NbMi.js → tag-pill-input-BoyxN9pC.js} +1 -1
- package/dist/public/assets/{telemetry-impl-BOm8dXoA.js → telemetry-impl-DChsPrpQ.js} +1 -1
- package/dist/public/assets/{telemetry-startup-B9kArDNb.js → telemetry-startup-B9nVffXq.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-BBXwmVEO.js → terminal-launch-events-Cy8GAcTt.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-B5w8ea1t.js → typing-burst-detector-BeLp1KqP.js} +1 -1
- package/dist/public/assets/{uninstall-CJslSGim.js → uninstall-CHUB11SP.js} +1 -1
- package/dist/public/assets/{use-activity-panel-njYj0Tyg.js → use-activity-panel-DZWu1j8R.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-DyzsFMYv.js → use-apply-config-color-theme-lLFWDFMc.js} +1 -1
- package/dist/public/assets/{use-apply-config-language-CJ2P6ZVJ.js → use-apply-config-language-cr1JKqWJ.js} +2 -2
- package/dist/public/assets/{use-conflicts-B9eHyj9o.js → use-conflicts-B0yvUiLf.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-D9OrOkx3.js → use-live-xterm-theme-BIzA-mu0.js} +1 -1
- package/dist/public/assets/{use-open-skill-BJ1g1TS4.js → use-open-skill-DpJ_35HO.js} +1 -1
- package/dist/public/assets/{use-semantic-search-status-BGdqXgED.js → use-semantic-search-status-CGPJyDjj.js} +1 -1
- package/dist/public/assets/{use-skill-origin-BqSrJPU6.js → use-skill-origin-Cv_S5gSq.js} +1 -1
- package/dist/public/assets/{use-skill-targets-oy2zvORL.js → use-skill-targets-D-Tfz8TQ.js} +1 -1
- package/dist/public/assets/{use-skills-CV4zn3OT.js → use-skills-CRuEYkjM.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-oZoJIl77.js → use-terminal-enabled-VopbK1KQ.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CRdNlwgo.js → use-timeline-entry-diff-DPE4FYBg.js} +1 -1
- package/dist/public/assets/{use-workspace-Co3BqTgM.js → use-workspace-Bf2VHQrp.js} +1 -1
- package/dist/public/index.html +48 -48
- package/dist/public/uninstall.html +3 -3
- package/dist/{registry-probes-TTIv_jQo.mjs → registry-probes-Bm4pqoc3.mjs} +1 -1
- package/dist/{removal-file-path-BgjM5SuP.mjs → removal-file-path-CA1EsHkE.mjs} +1 -1
- package/dist/{repair-launch-json-DX0T39ky.mjs → repair-launch-json-CrXvLHAP.mjs} +1 -1
- package/dist/{repair-mcp-configs-CSuOjpAP.mjs → repair-mcp-configs-DSzqhiSN.mjs} +1 -1
- package/dist/src-CnLRA8A1.mjs +1 -0
- package/dist/src-DbgqTa1M.mjs +11 -0
- package/dist/{start-DmACO7Nh.mjs → start-BJjgwTqm.mjs} +3 -3
- package/dist/start-DmTUxqZp.mjs +1 -0
- package/package.json +5 -5
- package/dist/constants-BrjqlEsS.mjs +0 -1
- package/dist/dist-BrWQNlOF.mjs +0 -2198
- package/dist/init-Caw9z0RZ.mjs +0 -1
- package/dist/loader-OSwfQPyG.mjs +0 -1
- package/dist/preview-P8UzNPlh.mjs +0 -1
- package/dist/public/assets/FeedbackForm-DXTFUuAS.js +0 -1
- package/dist/public/assets/LintingSection-BZWdGarX.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-C5jRvpCl.js +0 -1
- package/dist/public/assets/config-schema-CxzfSS_F.js +0 -1
- package/dist/public/assets/field-controls-mmRmxoOm.js +0 -1
- package/dist/public/assets/index-CggMAzzQ.js +0 -2205
- package/dist/public/assets/messages-BN4BZRJF.js +0 -1
- package/dist/public/assets/messages-BwUT5OR_.js +0 -1
- package/dist/public/assets/messages-BwfMRpDZ.js +0 -1
- package/dist/public/assets/messages-C-u__l_6.js +0 -1
- package/dist/public/assets/messages-CP3ZhE7d.js +0 -1
- package/dist/public/assets/messages-CWh_KhcE.js +0 -1
- package/dist/public/assets/messages-CqZP9U4h.js +0 -1
- package/dist/public/assets/messages-D8MF6gQm.js +0 -1
- package/dist/public/assets/messages-DXuxFgle.js +0 -1
- package/dist/public/assets/messages-Dh4iAG8x.js +0 -1
- package/dist/public/assets/messages-Dwjpql-D.js +0 -1
- package/dist/public/assets/messages-VQrT5xuZ.js +0 -1
- package/dist/public/assets/messages-cWliijXA.js +0 -1
- package/dist/public/assets/storage-scope-BVU9p11A.js +0 -1
- package/dist/src-Ap_2wxuM.mjs +0 -11
- package/dist/src-DuIWze9R.mjs +0 -1
- package/dist/start-vg8tMVqI.mjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./bridge-1xVdv27q.js";function t(e,t){return t===null?e:`${e}:${n(t)}`}function n(t){return e(t)}export{t as n,n as t};
|
package/dist/src-Ap_2wxuM.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{Ac as t,B as n,H as r,Nc as i,Pc as a,V as o,Yd as s,aa as c,af as l,bl as u,cf as d,ku as f,l as p,oa as m,rf as h,u as ee,xl as g}from"./md-manager-BGnqyqi1-IqwoPmS1.mjs";import{$o as _,Dt as v,Mi as y,Ni as b,Qo as x,Sr as S,Xo as C,Yn as w,_i as T,ar as E,ba as D,es as O,gi as k,hi as A,li as j,lr as M,m as N,ri as P,wo as F,ys as I}from"./dist-BrWQNlOF.mjs";import{t as L}from"./yazl-BBz29IQN.mjs";import{Ct as te,ot as ne,st as re}from"./init-0oLlE1YP.mjs";import{l as ie,x as ae}from"./registry-probes-TTIv_jQo.mjs";import{c as oe}from"./colors-r_owlCuY.mjs";import{t as se}from"./is-object-BGze3w87.mjs";import{n as ce}from"./constants-BrjqlEsS.mjs";import"./loader-1manjX2x.mjs";import"./preview-C5jJBQtN.mjs";import{execSync as le,spawnSync as ue}from"node:child_process";import{basename as R,dirname as z,isAbsolute as de,join as B,relative as fe,resolve as V,sep as H}from"node:path";import{closeSync as pe,cpSync as me,createWriteStream as he,existsSync as U,lstatSync as ge,mkdirSync as W,mkdtempSync as _e,openSync as ve,readFileSync as G,readSync as ye,readdirSync as K,readlinkSync as be,rmSync as q,rmdirSync as xe,statSync as Se,writeFileSync as J}from"node:fs";import{arch as Ce,freemem as we,homedir as Y,hostname as Te,platform as Ee,release as De,tmpdir as Oe,totalmem as ke,type as Ae,uptime as je}from"node:os";import"node:fs/promises";import{createHash as Me}from"node:crypto";function Ne(e,t){let n=t.map(e=>[I(e),e]);for(let t of e){let e=I(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function Pe(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=Ne([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=Ne(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function Fe(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`unknown`;let r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}const Ie=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`audit`,`deinit`,`auth`]);function Le(e,t,n=M){if(e!==void 0&&!Ie.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Re=null;function ze(e){Re=e}function Be(){return Re??process.cwd()}const Ve=`Open Knowledge`;function He(e={}){let t=e.platformName??process.platform,n=e.productName??h().productName;return ne(t).join(re({...e,platformName:t}),n)}function Ue(e={}){let t=e.platformName??process.platform,n=e.home??Y(),r=e.env??process.env,i=ne(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`${h().packageName.replaceAll(`/`,``)}-updater`)}function We(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 Ge(e){let t=B(e,`state.json`);if(!U(t))return[];let n;try{n=JSON.parse(G(t,`utf-8`))}catch{return[]}return We(n)??[]}function Ke(e){let t=B(e,`state.json`);if(!U(t))return!1;try{return We(JSON.parse(G(t,`utf-8`)))!==null}catch{return!1}}const qe=8192;function Je(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 Ye(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const Xe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function Ze(e){return e.replace(Xe,`$1"[REDACTED-DEVICE-ID]"`)}function Qe(e){return Ze(Ye(e))}const $e=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function et(e){if(typeof e!=`string`)return null;let t=$e.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 tt(e){let t=ve(e,`r`);try{let e=Buffer.alloc(qe),n=0,r=!1;for(;n<qe;){let i=ye(t,e,n,qe-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{pe(t)}}function nt(e){try{let t=tt(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:et(a)}}catch{return{kind:`unreadable`}}}function rt(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function it(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=K(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=B(e,t.name),r;try{r=Se(n).mtimeMs}catch{continue}if(r<i)continue;let c=nt(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!rt(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 at(){return B(C(),`bug-reports`)}function ot(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=at(),r=`${t}-bugreport`,i=B(n,`${r}.zip`);for(let e=2;U(i);e+=1)i=B(n,`${r}-${e}.zip`);return i}function st(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function ct(e,t){let n=B(e,`.ok`,`config.yml`);if(U(n))try{let e=G(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 U(B(e,`.ok`))?Me(`sha256`).update(V(e)).digest(`hex`).slice(0,12):null}function lt(){let e={timestamp:new Date().toISOString(),platform:Ee(),osType:Ae(),osRelease:De(),hostname:`[redacted]`,uptime:je(),freeMem:we(),totalMem:ke(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=le(`sw_vers -productVersion 2>/dev/null`,F({encoding:`utf8`})).trim()}catch{}try{let t=B(__dirname,`..`,`..`,`package.json`);U(t)&&(e.okVersion=JSON.parse(G(t,`utf8`)).version)}catch{}return e}const ut=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function dt(e){let t=R(e);return ut.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function ft(e,t){return gt(e,t).files}const pt=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function mt(e,t=ie){let n=B(e,`${t}.ShipIt`);if(!U(n))return[];let r;try{r=K(n)}catch{return[]}return pt.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=>B(n,e.entry)))}function ht(e){if(!U(e))return[];try{let t=new Map;for(let n of K(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-p.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>B(e,t))}catch{return[]}}function gt(e,t){if(!U(t))return{files:[],excludedByProjectSlug:0};let n=K(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>B(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(dt),i=[],a=r.filter(t=>{try{return G(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=>!dt(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function _t(e){let n=B(e,`.ok`,`local`);return U(n)?{files:[`server.lock`,`last-spawn-error.log`,i,t].map(e=>B(n,e)).filter(e=>U(e))}:{files:[]}}function vt(e){let t=B(e,`.ok`,`local`,`logs`);return U(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>B(t,e)).filter(e=>U(e))}:{files:[]}}function yt(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#${Me(`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 bt(e){let t=e.revealDocNames?e.content:yt(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=m(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 X(e){for(let t of e.files)try{let n=G(t,`utf8`);bt({zipfile:e.zipfile,name:`${e.prefix}/${R(t)}`,content:t.endsWith(`.ips`)?Qe(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function xt(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??B(C(),`logs`),s=t.projectDir?ct(t.projectDir,i):null;W(z(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let l=lt();l.desktop=t.desktop??null,l.language=t.language??null;let{files:u,excludedByProjectSlug:d}=gt(s,o),{files:f}=t.projectDir?_t(t.projectDir):{files:[]},{files:p}=t.projectDir?vt(t.projectDir):{files:[]},m=t.shipItLogFiles??[],h=t.diagnosticReports?.files??[];i?.info({logFileCount:u.length,logFilesExcludedByProjectSlug:d,lockFileCount:f.length,localSinkFileCount:p.length,shipItLogFileCount:m.length,diagnosticReportCount:h.length},`files collected`);let g=[],_=[],{ZipFile:v}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),y=new v;X({zipfile:y,files:[...u,...m],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),X({zipfile:y,files:f,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),X({zipfile:y,files:p,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),X({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:ee,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),X({zipfile:y,files:h,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i});for(let e of t.extraFiles??[])try{let t=G(e.sourcePath),n=`extra/${e.zipName??R(e.sourcePath)}`;y.addBuffer(t,n),_.push(n);let r=st(e,n);r!==null&&g.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&bt({zipfile:y,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:_,redactions:g});let b=new Set(h.map(e=>`diagnostic-reports/${R(e)}`)),x=_.filter(e=>b.has(e)),S=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Je(t.diagnosticReports,x.length);y.addBuffer(Buffer.from(`${S}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`);let w=JSON.stringify(l,null,2);y.addBuffer(Buffer.from(w,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let T={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:_,redactions:g,sysinfo:l};y.addBuffer(Buffer.from(JSON.stringify(T,null,2),`utf8`),`MANIFEST.json`);let E=g.reduce((e,t)=>e+t.lineCount,0),D=new Set(m.map(e=>`logs/${R(e)}`)),O=_.filter(e=>D.has(e)),k=new Set((t.bugReportLedgerFiles??[]).map(e=>`${ee}/${R(e)}`)),A=_.filter(e=>k.has(e)),j=s?_.filter(e=>e.startsWith(`logs/`)&&!dt(e)&&!D.has(e)):[],M=x.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],N=M.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...M]:[`Redaction was disabled for this bundle; file contents are unmodified.`],P=[`# Bug Report Bundle`,``,`Generated: ${T.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${T.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...j.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:`,...j.map(e=>`- ${e}`),``]:[],...O.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:`,...O.map(e=>`- ${e}`),``]:[],...x.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...x.map(e=>`- ${e}`),``]:[],...A.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:`,...A.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${c.join(`, `)}`,E>0?`${E} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...M,``,`This bundle is safe to attach to a GitHub issue.`]:N].join(`
|
|
2
|
-
`);y.addBuffer(Buffer.from(P,`utf8`),`README.md`),y.end();let F=he(r);return y.outputStream.pipe(F),await new Promise((e,t)=>{F.on(`close`,e),F.on(`error`,t)}),i?.info({bundlePath:r,fileCount:_.length,redactionCount:E},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:_,redactions:g,redactedLineCount:E,generatedAt:T.generatedAt}}}var St=f(),Ct=e(L(),1),Z=e(oe(),1);function wt(e){let t=O(`user`,e,e);return x({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function Tt({home:e=Y(),env:t=process.env}={}){let n=wt(e),{override:r,preferenceList:i}=_(t),{locale:a,source:o}=Pe({override:r,storedPreference:n,supportedLocales:g,preferenceList:i,autoDetectableLocales:u});return{preference:n,locale:a,source:o,systemLanguages:i}}function Et(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Dt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ot(e,t){if(typeof e==`string`)return Et(e,t.contentDir);if(Array.isArray(e))return e.map(e=>Ot(e,t));if(!Dt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Ot(i,t);return n}function kt(e,t){let n=G(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=Ot(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
|
|
5
|
-
`)}\n`:a.join(`
|
|
6
|
-
`);J(e,o)}function At(e,t){let n=G(e,`utf-8`);if(n.trim().length!==0)try{let r=Ot(JSON.parse(n),t),i=n.endsWith(`
|
|
7
|
-
`)?`
|
|
8
|
-
`:``;J(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=Et(n,t.contentDir);r!==n&&J(e,r)}}function jt(e,t){let n=G(e,`utf-8`),r=Et(n,t.contentDir);r!==n&&J(e,r)}function Mt(e){try{return K(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>B(e,t.name))}catch{return[]}}const Nt=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function Pt(e){return/\.log\.\d+$/.test(e)}function Ft(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||Pt(e)}const It=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Lt(e){let t={contentDir:e.contentDir};for(let n of It)for(let r of Mt(B(e.stagingDir,n)))Ft(r)?kt(r,t):r.endsWith(`.json`)?At(r,t):jt(r,t);for(let n of Mt(B(e.stagingDir,`state`))){let e=R(n);n.endsWith(`.jsonl`)?kt(n,t):Nt.has(e)?At(n,t):jt(n,t)}}const Rt=[`.ok`,`local`,`telemetry`],zt=[`.ok`,`local`,`logs`],Bt=[`.ok`,`local`,`loss-capture`],Vt=`spans-current.jsonl`,Ht=`spans-prev.jsonl`,Ut=`server-current.jsonl`,Wt=`server-prev.jsonl`,Gt=`loss-current.jsonl`,Kt=`loss-prev.jsonl`;function qt(e){return B(e,...Rt,Vt)}function Jt(e){return B(e,...Rt,Ht)}function Yt(e){return B(e,...zt,Ut)}function Xt(e){return B(e,...zt,Wt)}function Zt(e){return B(e,...Bt,Gt)}function Qt(e){return B(e,...Bt,Kt)}const $t=1e3;async function en(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout($t)});return t.ok?await t.text():null}catch{return null}}async function tn(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout($t)});return t.ok?await t.text():null}catch{return null}}async function nn(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout($t)});return t.ok?await t.text():null}catch{return null}}function rn(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 an(e){let t=B(e,`.git`,`ok`);if(!U(t))return null;let n=ue(`git`,[`-C`,t,`log`,`--oneline`,`-50`],F({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function on(e){let t=B(e,`.git`,`ok`);if(!U(t))return null;let n=ue(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],F({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function sn(){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 cn(){return{nodeVersion:process.version,platform:Ee(),arch:Ce()}}function ln(){return process.env.OTEL_SDK_DISABLED===`false`}function un(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function dn(e){if(!U(e))return{};let t;try{t=(0,St.parse)(G(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(!un(t))return{};let n=t.telemetry;if(!un(n))return{};let r=n.localSink;return un(r)?r:{}}function fn(e){return typeof e==`boolean`?e:void 0}function pn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function mn(e){if(un(e))return pn(e.maxBytes)}function hn(e){let t=dn(O(`project`,e)),n=dn(O(`project-local`,e));return{enabled:fn(n.enabled)??fn(t.enabled)??!0,spansMaxBytes:mn(n.spans)??mn(t.spans)??52428800,logsMaxBytes:mn(n.logs)??mn(t.logs)??26214400}}function gn(e){return Me(`sha256`).update(e).digest(`hex`)}function _n(e){let t=G(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const vn=[`"doc.name"`,`"docName"`];function yn(e){let t=G(e,`utf-8`),n=0;for(let e of vn){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Q(e,t){if(!U(e))return!1;try{return W(z(t),{recursive:!0}),e.endsWith(`.ips`)?J(t,Qe(G(e,`utf-8`))):me(e,t),!0}catch{return!1}}function bn(e){let t=[],n=e=>{let r=K(e,{withFileTypes:!0});for(let i of r){let r=B(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const xn=new Set([`.jsonl`]);function Sn(e){let t=e.lastIndexOf(`.`);return t!==-1&&xn.has(e.slice(t))}const Cn=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function wn(e){if(Pt(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&Cn.has(e.slice(t))}function Tn(e){let t=[];for(let n of bn(e)){let r=En(e,n);if(!wn(r))continue;let{redacted:i,patterns:a,lineCount:o}=m(G(n,`utf-8`));a.length!==0&&(J(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function En(e,t){return fe(e,t).split(H).join(`/`)}async function Dn(e){let n=V(e.contentDir),r=V(e.projectDir??e.contentDir),o=e.deps??{},s=o.fetchAgentPresence??en,c=o.fetchAgentEffects??tn,l=o.fetchWatcherRecent??nn,u=o.readShadowHead??an,d=o.readCheckpointRefs??on,f=o.now??(()=>new Date),p=o.okVersion??(()=>ce),m=o.readDesktopEnv??sn,h=o.readLanguage??Tt,g=o.readRuntime??cn,_=o.isOtlpPushEnabled??ln,v=_e(B(Oe(),`ok-bundle-`));try{W(B(v,`telemetry`),{recursive:!0}),W(B(v,`logs`),{recursive:!0}),W(B(v,`state`),{recursive:!0}),Q(qt(r),B(v,`telemetry`,Vt)),Q(Jt(r),B(v,`telemetry`,Ht)),Q(Yt(r),B(v,`logs`,Ut)),Q(Xt(r),B(v,`logs`,Wt));for(let t of e.userLogFiles??[])Q(t,B(v,`logs`,R(t)));for(let t of e.userStateFiles??[])Q(t,B(v,ee,R(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Q(t,B(v,`diagnostic-reports`,R(t)))&&(y+=1);let b=B(r,`.ok`,`local`),x=B(b,`server.lock`),S=`not-running`,C=`no server.lock`,w=null;if(U(x)){Q(x,B(v,`state`,`server.lock`));try{let e=G(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?w=t.port:C=`lock present but no port`}catch{C=`lock present but unparseable`}}if(w!==null){let e=await s(w);e===null?C=`agent-presence endpoint at :${w} unreachable`:(J(B(v,`state`,`agent-presence.json`),e),S=`running`,C=``);let t=await c(w);t!==null&&J(B(v,`state`,`agent-effects.json`),t);let n=await l(w);if(n!==null){let e=rn(n);e!==null&&J(B(v,`state`,`watcher-recent.jsonl`),e)}}let T=u(n);T!==null&&J(B(v,`state`,`shadow-head.txt`),T);let E=d(n);E!==null&&J(B(v,`state`,`checkpoint-refs.txt`),E),Q(Zt(r),B(v,`state`,Gt)),Q(Qt(r),B(v,`state`,Kt)),Q(B(b,`last-spawn-error.log`),B(v,`state`,`last-spawn-error.log`)),Q(B(b,a),B(v,`state`,a)),Q(B(b,i),B(v,`state`,i)),Q(B(b,t),B(v,`state`,t));let D=g(),O=m(),k=h(),A={ok:{version:p(),nodeVersion:D.nodeVersion,platform:D.platform,arch:D.arch},host:{desktop:O,language:k}};J(B(v,`state`,`runtime.json`),`${JSON.stringify(A,null,2)}\n`);let j=S===`running`?`running
|
|
10
|
-
`:`not-running (${C})\n`;J(B(v,`state`,`server-status.txt`),j);let M=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:Je(e.diagnosticReports,y);if(J(B(v,`state`,`diagnostic-reports-status.txt`),`${M}\n`),e.processDir&&U(e.processDir)){let t=B(v,`process`);W(t,{recursive:!0}),me(e.processDir,t,{recursive:!0})}let N=e.redact===!0;N&&Lt({stagingDir:v,contentDir:n}),e.note&&J(B(v,`note.txt`),e.note);let P=null;e.scrubSecrets===!0&&(P=Tn(v));for(let t of e.extraFiles??[]){let e=t.zipName??R(t.sourcePath);if(!Q(t.sourcePath,B(v,`extra`,e))){o.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=st(t,`extra/${e}`);n!==null&&(P??={redactions:[],redactedLineCount:0},P.redactions.push(n),P.redactedLineCount+=n.lineCount)}let F=hn(r),I=bn(v),L=[],te=0,ne=0;for(let e of I){let t=En(v,e),n=Se(e).size,r=Sn(t)?_n(e):0;L.push({path:t,bytes:n,lines:r}),te+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(ne+=yn(e))}let re={applied:N};P!==null&&(re.secretScrub=P);let ie={schemaVersion:2,createdAt:f().toISOString(),ok:{version:p(),nodeVersion:D.nodeVersion,platform:D.platform,arch:D.arch},host:{desktop:O,language:k},contentDir:{pathSha256:gn(n),absolutePath:N?`<CONTENT_DIR>`:n},telemetry:{localSink:F,otlpPushEnabled:_()},redaction:re,serverStatus:S,files:L};J(B(v,`manifest.json`),`${JSON.stringify(ie,null,2)}\n`);let ae=I.some(e=>{try{return G(e,`utf-8`).includes(n)}catch{return!1}}),oe={stagedDiagnosticReports:y,totalBytes:te,fileCount:L.length,docNameCount:ne,contentDirVisible:ae,redacted:N},se=!1;return{stagingDir:v,manifest:ie,summary:oe,cleanup:()=>{se||(se=!0,q(v,{recursive:!0,force:!0}))}}}catch(e){throw q(v,{recursive:!0,force:!0}),e}}async function On(e){let{collected:t,outputPath:n}=e,r=z(n);if(!U(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new Ct.ZipFile,a=bn(t.stagingDir);for(let e of a){let n=En(t.stagingDir,e);i.addFile(e,n)}i.end();let o=he(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 kn(e,t){let n=B(e,`.ok`,`config.yml`);if(U(n))try{let t=(0,St.parse)(G(n,`utf-8`)),r=se(t)?t.content:void 0,i=se(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return V(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 V(e)}async function An(e,t,n,r,i){let a=ct(t,e.logger),o=await Dn({contentDir:kn(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...ft(a,e.userLogsDir??B(C(),`logs`)),...mt(e.cachesDir??B(Y(),`Library`,`Caches`))],userStateFiles:ht(e.bugReportsDir??at()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{W(z(e.outputPath),{recursive:!0}),await On({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 jn(e){let{projectDir:t}=e,n=e.readDesktopEnv??sn,r=e.readLanguage??Tt,i=()=>it(e.diagnosticReportsDir??B(Y(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return An(e,t,n,r,i());let{zipPath:a,summary:o}=await xt({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:mt(e.cachesDir??B(Y(),`Library`,`Caches`)),bugReportLedgerFiles:ht(e.bugReportsDir??at()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}function $(e,t,n={}){let r=T(e,t),i;try{i=G(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??Te());if(!a||typeof a!=`object`||!j(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??P)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}function Mn(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 Nn(e){return e.replace(/:\d+$/,``)}function Pn(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Nn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Nn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Nn(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 Fn=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function In(e){return r(d(),e)}function Ln(){return o(d())}function Rn(){let e=d();if(e===`stable`)return Fn;let t=n(e);return RegExp(`^# >>> ${t} >>>\\n[\\s\\S]*?^# <<< ${t} <<<\\n?`,`m`)}const zn={existsSync:e=>U(e),readFileSync:(e,t)=>G(e,t),lstatSync:e=>ge(e),readlinkSync:e=>be(e)};function Bn(e,t=zn){let n=In(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 Vn(e){let t=e.replace(Rn(),``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function Hn(e,t,n=zn){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}const Un=[{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`}],Wn=[...v.map(e=>N[e]),`open-knowledge`];function Gn(e){if(!de(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=V(e);if(t===H||z(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function Kn(e,t){let n=fe(e,t);if(n.startsWith(`..`)||de(n))return!1;let r=e;for(let e of n.split(H)){r=B(r,e);try{if(!ge(r).isDirectory())return!1}catch{return!1}}return!0}function qn(e,t){try{return K(e).every(n=>t.has(B(e,n)))}catch{return!1}}function Jn(e){let t=Gn(e),n=[],r=[],i=new Set;for(let e of Un){let a=B(t,e.hostDir,`skills`);if(!Kn(t,a))continue;let o=Wn.map(e=>B(a,e)).filter(e=>U(e));n.push(...o);for(let e of o)i.add(e);let s=B(t,e.pruneRoot),c=a;for(;qn(c,i)&&(r.push(c),i.add(c),c!==s);){let e=z(c);if(e===c||e===t||!e.startsWith(t+H))break;c=e}}return{skillDirs:n,emptyDirs:r}}function Yn(e){try{if(!ge(e).isDirectory())return!1;let t=K(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function Xn(e){let t=new Set,n=new Set;for(let r of Un){let i=B(e,r.hostDir,`skills`);for(let e of Wn)t.add(B(i,e));let a=B(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=z(o);if(t===o||t===e||!t.startsWith(e+H))break;o=t}}return{skillDirs:t,emptyDirs:n}}function Zn(e,t){let n=Gn(e),r=Xn(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(Kn(n,e)&&Yn(e))try{q(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(Kn(n,e))try{xe(e),a.push(e)}catch{}return a}function Qn(e){let t=Gn(e),n=[];for(let e of v){let r=N[e];n.push({path:B(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of s)n.push({path:B(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function $n(e,t){let n=[];for(let r of Qn(e))if(r.bundleId===t)try{q(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 er(e){return e!=null&&e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function tr(e,t=Date.now()){if(e===null)return`—`;let n=Fe(e,t);return n===`unknown`?`—`:n}function nr(e){let t=z(e);return R(e)===`local`&&R(t)===`.ok`?z(t):R(e)===`.ok`?t:null}function rr(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`||t.status===`read-error`)return null;if(t.status===`unverified-owner`)return{directory:nr(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`&&A(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:E(n),command:n,isDesktop:er(n)}}function ir(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 ar=new Set([`running`,`desktop`,`foreign`,`unverified`]);function or(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`unverified`:case`stale`:return Z.default.yellow(e)}}function sr(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function cr(e){return`${sr(e.server.usage)} | ${sr(e.ui?.usage??null)}`}function lr(e){return`${e.server.port===null?`—`:e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function ur(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??`—`,lr(e),cr(e),ir(e),String(e.server.pid),tr(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=or(ir(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(`
|
|
11
|
-
`)}async function dr(e={}){let t=e.discover??w,n=e.inspect??(e=>$(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??y,a=e.resolveUsage??b,o=await t(),s=[];for(let e of o){let t=n(e),r=rr(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:ir(e)}));r(JSON.stringify(e,null,2));return}r(ur(e.all?s:s.filter(e=>ar.has(ir(e)))))}function fr(){return new te(`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 dr({all:t.all===!0||e===`all`,json:t.json===!0})})}async function pr(e,t=ae()){let n=$(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=k(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 mr(e,t={}){return{targets:_r(e,t.isAlive??P)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}function hr(e){try{return d()}catch(t){e?.warn({err:t},`stop channel check skipped: ${t instanceof Error?t.message:String(t)}`);return}}async function gr(e){let t=e.inspect??(()=>$(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??pr,o=e.logger??ae(),s=t(),c=mr(s,{isAlive:e.isAlive});if(c.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};let u=s.status===`alive`||s.status===`foreign-host`?s.lock.channel:void 0;if(e.force!==!0&&typeof u==`string`&&u.length>0){let t=e.selfChannel??hr(o);if(t!==void 0&&u!==t)return i(`Not stopping: the server at ${e.lockDir} belongs to ${l(u)}. Stop it from that app or its CLI, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,holderChannel:u,selfChannel:t,pids:c.targets.map(e=>e.pid)},`stop declined: server belongs to another channel`),{stopped:[],failed:[],hadTargets:!0,declined:{otherChannel:u}}}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:c.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let d=[],f=[];for(let e of c.targets)try{n(e.pid,`SIGTERM`),d.push(e)}catch(t){f.push({target:e,error:t instanceof Error?t.message:String(t)})}return d.length>0&&r(`Stopped: ${d.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:d.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:f.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),f.length>0&&i(`Failed to stop: ${f.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:d,failed:f,hadTargets:!0}}function _r(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}async function vr(e,t=P){let n=await w(),r=null;for(let i of n){let n=$(i,`server`);if(_r(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function yr(e,t){let n=await gr({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function br(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 xr(e){let t=await w(),n=0;for(let r of t)r!==e&&_r($(r,`server`),P)&&n++;return n}function Sr(e){return new te(`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 the server belongs to another OpenKnowledge app (Stable or Beta) or editor windows or agents are still connected to it`).action(async(t,n)=>{let r=n.force===!0,i=t.length===0?void 0:t.join(` `);if(i===void 0){e();let t=D(process.cwd()),n=await gr({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 xr(t);console.log(br(process.cwd(),e,{listingFollows:e>0})),e>0&&await dr({})}return}if(i===`all`){let e=await w();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)_r($(n,`server`),P)&&(await yr(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 vr(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await yr(t,r);return}let a=V(Be(),i),o=D(a),s=[],c=await gr({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(br(a,await xr(o)))})}export{Be as A,it as C,He as D,Ue as E,Le as M,Ge as O,at as S,Ve as T,$ as _,Zn as a,On as b,Qn as c,In as d,Ln as f,Mn as g,Pn as h,fr as i,ze as j,Ke as k,Fn as l,Vn as m,gr as n,Jn as o,Bn as p,Sr as r,$n as s,pr as t,Hn as u,jn as v,Je as w,ot as x,Dn as y};
|
package/dist/src-DuIWze9R.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./md-manager-BGnqyqi1-IqwoPmS1.mjs";import"./src-Ap_2wxuM.mjs";import"./init-0oLlE1YP.mjs";import"./registry-probes-TTIv_jQo.mjs";import"./start-DmACO7Nh.mjs";import{n as e}from"./loader-1manjX2x.mjs";import"./preview-C5jJBQtN.mjs";import"./repair-mcp-configs-CSuOjpAP.mjs";export{e as loadConfig};
|
package/dist/start-vg8tMVqI.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,m as t,p as n,r}from"./start-DmACO7Nh.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
|