@inkeep/open-knowledge 0.71.2-beta.1 → 0.71.2
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/cli.mjs +54 -54
- package/dist/constants-BirNT126.mjs +1 -0
- package/dist/{dist-B4TxkELG.mjs → dist-Bxzi66b7.mjs} +1 -1
- package/dist/dist-D1HfouVm.mjs +2097 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +7 -7
- package/dist/init-Bt-Gd0Of.mjs +1 -0
- package/dist/{init-Ex7PlJbP.mjs → init-D_gjDHTf.mjs} +7 -7
- package/dist/{launch-json-removal-Dgdu9kcP.mjs → launch-json-removal-IMDkZJTs.mjs} +1 -1
- package/dist/loader-CdcKuBwQ.mjs +1 -0
- package/dist/{loader-Da_kR2vs.mjs → loader-bj3vZ227.mjs} +1 -1
- package/dist/{md-manager-BGnqyqi1-BKxqDqfk.mjs → md-manager-BGnqyqi1-C0-0a_4T.mjs} +92 -92
- package/dist/{open-browser-DqgRF6In.mjs → open-browser-D9Sv9-6K.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-CEgkalQZ.mjs +1 -0
- package/dist/{preview-BOTcB8PJ.mjs → preview-DdwEHHFb.mjs} +1 -1
- package/dist/public/assets/{ActivityModeContent-BbKjbMiA.js → ActivityModeContent-B_Re3sCO.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-DhB8fBpO.js → AddPropertiesButton-DBIbNQMb.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-BjhQ5oT2.js → AgentDiffPane-CnwENM87.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-DJMpl51W.js → CodeMirrorPropInput-D-iWWvft.js} +1 -1
- package/dist/public/assets/{DocumentContext-BdT4QvCj.js → DocumentContext-qHxlPFgu.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-SZE7OX5H.js → EditorModeToggle-CL0A-pdT.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-DZwVI77M.js → EnableSyncConfirmDialog-D0sbHn3C.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-BD82jzXA.js → ExcalidrawDocEditor-4A61s0Od.js} +1 -1
- package/dist/public/assets/FeedbackForm-41B5VbyM.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-CC7FYOAx.js → ImportSkillDialog-CUgeolEZ.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-B7lZsXeL.js → LintConfigEditor-BkHxS4Z2.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-DS1dvCFC.js → ManagedArtifactProperties-B8izvHBO.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-C0k10C6t.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-Bt0B02Vg.js → MermaidDocEditor-DCaIz0MV.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-DT9DybGq.js → PropertyDisplayRow-DONEJphz.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DKOJ8BWG.js → SchemaConfigEditor-C6TJAzlP.js} +1 -1
- package/dist/public/assets/{SessionsHost-DdgAh7KC.js → SessionsHost-mxsP8VBT.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-CHW54FiV.js → SettingsDialogBody-CBr9NTCP.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-CYTNwQ0R.js → ShareReceiveMissDialog-B3EB6YQR.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-Dt9XoTzF.js → SkillInstallMenu-Ya-6FZjF.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-becH_mip.js → SkillToolbarControls-BvrdkOsH.js} +1 -1
- package/dist/public/assets/{SourceEditor-BwY6mSBP.js → SourceEditor-XVY6g4ls.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-BehY2GEl.js → TerminalWindowApp-Xgzsyfd2.js} +1 -1
- package/dist/public/assets/{TextDocEditor-CYxCP2r5.js → TextDocEditor-BplISC3q.js} +1 -1
- package/dist/public/assets/{ThreadView-h4TWd7hW.js → ThreadView-C3tePmSt.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-DcOGwDoz.js → TimelineDiffPane-BUxav6uZ.js} +1 -1
- package/dist/public/assets/{agent-diff-store-Bz1uC7Vg.js → agent-diff-store-CEBg54c-.js} +1 -1
- package/dist/public/assets/{auth-state-cache-DDsVxErS.js → auth-state-cache-CBNus4S0.js} +1 -1
- package/dist/public/assets/{client-version-BrzB3ZFz.js → client-version-D207g_G2.js} +1 -1
- package/dist/public/assets/{comment-chips-CwAPmedw.js → comment-chips-DToBb3F4.js} +1 -1
- package/dist/public/assets/{config-provider-CAlJf_RJ.js → config-provider-DFYIVc9V.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-DibYDt_n.js → doc-undo-manager-p-u-ggv3.js} +1 -1
- package/dist/public/assets/{index-CvLeHMQf.js → index-CS26J6l3.js} +8 -8
- package/dist/public/assets/{pending-receive-nav-store-B0WaT5YS.js → pending-receive-nav-store-Cr1LCQbQ.js} +1 -1
- package/dist/public/assets/{progress-BGIMEH8l.js → progress-BTAR0ta6.js} +1 -1
- package/dist/public/assets/{selection-context-CWFsKNpl.js → selection-context-BYpSRLhW.js} +1 -1
- package/dist/public/assets/{src-CqpVBr8K.js → src-CBDDC_H3.js} +1 -1
- package/dist/public/assets/{telemetry-impl-k9dxXFAA.js → telemetry-impl-8uUEBUc7.js} +1 -1
- package/dist/public/assets/{telemetry-startup-XR9DKXgQ.js → telemetry-startup-BW_bNXmx.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DvNzlvB9.js → typing-burst-detector-DdbPTV6s.js} +1 -1
- package/dist/public/assets/{use-activity-panel-BEYTKIoo.js → use-activity-panel-Bj2Xj0ox.js} +1 -1
- package/dist/public/assets/{use-open-skill-Q8DHnwW6.js → use-open-skill-B_ahDNz1.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-BdQOqH8G.js → use-terminal-enabled-DYI9ZQgY.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CPG3aGDO.js → use-timeline-entry-diff-D8pEgQ0K.js} +1 -1
- package/dist/public/index.html +19 -19
- package/dist/{registry-probes-CKT5zpL7.mjs → registry-probes-CSYVvHU1.mjs} +2 -2
- package/dist/{removal-file-path-xOV2YbGI.mjs → removal-file-path-9sxva5U4.mjs} +1 -1
- package/dist/{repair-launch-json-DCb8j4os.mjs → repair-launch-json-tEgdkgQB.mjs} +1 -1
- package/dist/{repair-mcp-configs-Cvxc0PSE.mjs → repair-mcp-configs-DYgybbpP.mjs} +1 -1
- package/dist/src-DNTPYKMh.mjs +1 -0
- package/dist/src-VCAYQpty.mjs +11 -0
- package/dist/{start-C9MnFVTQ.mjs → start-BK63C5S4.mjs} +3 -3
- package/dist/start-xHCpCQLR.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-CN-OP4lK.mjs +0 -1
- package/dist/dist-CjH-Sf5k.mjs +0 -2096
- package/dist/init-DkoBLsnN.mjs +0 -1
- package/dist/loader-Ciy1lUFM.mjs +0 -1
- package/dist/preview-A8NnvAZh.mjs +0 -1
- package/dist/public/assets/FeedbackForm-BbB3RMo3.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-DcW-auIg.js +0 -1
- package/dist/src--hXB6oPw.mjs +0 -11
- package/dist/src-CemYwu_V.mjs +0 -1
- package/dist/start-B-ZEfbkW.mjs +0 -1
package/dist/init-DkoBLsnN.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./dist-CjH-Sf5k.mjs";import{_ as e}from"./init-Ex7PlJbP.mjs";export{e as runInit};
|
package/dist/loader-Ciy1lUFM.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-Da_kR2vs.mjs";export{e as loadConfig};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-BOTcB8PJ.mjs";export{t as formatPreviewBlock,e as previewContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./index-CvLeHMQf.js";export{e as FeedbackForm};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./ManagedArtifactProperties-DS1dvCFC.js";export{e as ManagedArtifactProperties};
|
package/dist/src--hXB6oPw.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{An as t,Ws as n,_s as r,cd as i,eu as a,fo as o,gc as s,jn as c,mc as l,os as u,pc as d,zn as ee}from"./md-manager-BGnqyqi1-BKxqDqfk.mjs";import{$r as f,Co as p,Ct as m,Fn as h,Gn as g,Gr as _,Qa as v,Qr as y,To as b,Xi as x,Yn as S,Zr as C,cr as w,gi as T,hi as E,m as D,wo as O,zr as k}from"./dist-CjH-Sf5k.mjs";import{t as A}from"./yazl-BBz29IQN.mjs";import{at as j,ot as M,vt as N}from"./init-Ex7PlJbP.mjs";import{b as P,l as te}from"./registry-probes-CKT5zpL7.mjs";import{c as ne}from"./colors-r_owlCuY.mjs";import{t as re}from"./is-object-BGze3w87.mjs";import{n as ie}from"./constants-CN-OP4lK.mjs";import"./loader-Da_kR2vs.mjs";import"./preview-BOTcB8PJ.mjs";import{execSync as ae,spawnSync as oe}from"node:child_process";import{basename as F,dirname as I,isAbsolute as se,join as L,relative as R,resolve as z,sep as B}from"node:path";import{closeSync as ce,cpSync as le,createWriteStream as ue,existsSync as V,lstatSync as de,mkdirSync as H,mkdtempSync as fe,openSync as pe,readFileSync as U,readSync as me,readdirSync as W,rmSync as G,rmdirSync as he,statSync as ge,writeFileSync as K}from"node:fs";import{arch as _e,freemem as ve,homedir as q,hostname as ye,platform as be,release as xe,tmpdir as Se,totalmem as Ce,type as we,uptime as Te}from"node:os";import"node:fs/promises";import{createHash as Ee}from"node:crypto";const De=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Oe(e,t,n=S){if(e!==void 0&&!De.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let ke=null;function Ae(e){ke=e}function je(){return ke??process.cwd()}const Me=`Open Knowledge`;function Ne(e={}){let t=e.platformName??process.platform,n=e.productName??`OpenKnowledge`;return j(t).join(M({...e,platformName:t}),n)}function Pe(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=j(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`@inkeepopen-knowledge-desktop-updater`)}function Fe(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 Ie(e){let t=L(e,`state.json`);if(!V(t))return[];let n;try{n=JSON.parse(U(t,`utf-8`))}catch{return[]}return Fe(n)??[]}function Le(e){let t=L(e,`state.json`);if(!V(t))return!1;try{return Fe(JSON.parse(U(t,`utf-8`)))!==null}catch{return!1}}const Re=8192;function ze(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function Be(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const Ve=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function He(e){return e.replace(Ve,`$1"[REDACTED-DEVICE-ID]"`)}function Ue(e){return He(Be(e))}const We=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function Ge(e){if(typeof e!=`string`)return null;let t=We.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 Ke(e){let t=pe(e,`r`);try{let e=Buffer.alloc(Re),n=0,r=!1;for(;n<Re;){let i=me(t,e,n,Re-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{ce(t)}}function qe(e){try{let t=Ke(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:Ge(a)}}catch{return{kind:`unreadable`}}}function Je(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function Ye(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=W(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=L(e,t.name),r;try{r=ge(n).mtimeMs}catch{continue}if(r<i)continue;let c=qe(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!Je(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}function J(){return L(q(),`.ok`,`bug-reports`)}function Xe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=J(),r=`${t}-bugreport`,i=L(n,`${r}.zip`);for(let e=2;V(i);e+=1)i=L(n,`${r}-${e}.zip`);return i}function Ze(e,t){let n=L(e,`.ok`,`config.yml`);if(V(n))try{let e=U(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return V(L(e,`.ok`))?Ee(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function Qe(){let e={timestamp:new Date().toISOString(),platform:be(),osType:we(),osRelease:xe(),hostname:`[redacted]`,uptime:Te(),freeMem:ve(),totalMem:Ce(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ae(`sw_vers -productVersion 2>/dev/null`,v({encoding:`utf8`})).trim()}catch{}try{let t=L(__dirname,`..`,`..`,`package.json`);V(t)&&(e.okVersion=JSON.parse(U(t,`utf8`)).version)}catch{}return e}const $e=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function et(e){let t=F(e);return $e.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function tt(e,t){return at(e,t).files}const nt=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function rt(e,t=te){let n=L(e,`${t}.ShipIt`);if(!V(n))return[];let r;try{r=W(n)}catch{return[]}return nt.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>L(n,e.entry)))}function it(e){if(!V(e))return[];try{let n=new Map;for(let r of W(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=r.endsWith(`.sent.yaml`)?r.slice(0,-t.length):r.slice(0,-5),i=n.get(e);i===void 0?n.set(e,[r]):i.push(r)}return[...n.values()].slice(-25).flat().map(t=>L(e,t))}catch{return[]}}function at(e,t){if(!V(t))return{files:[],excludedByProjectSlug:0};let n=W(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>L(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(et),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=>!et(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function ot(e){let t=L(e,`.ok`,`local`);return V(t)?{files:[`server.lock`,`last-spawn-error.log`,d].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function st(e){let t=L(e,`.ok`,`local`,`logs`);return V(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>L(t,e)).filter(e=>V(e))}:{files:[]}}function ct(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Ee(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function lt(e){let t=e.revealDocNames?e.content:ct(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=u(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function Y(e){for(let t of e.files)try{let n=U(t,`utf8`);lt({zipfile:e.zipfile,name:`${e.prefix}/${F(t)}`,content:t.endsWith(`.ips`)?Ue(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 ut(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??L(q(),`.ok`,`logs`),s=t.projectDir?Ze(t.projectDir,i):null;H(I(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let l=Qe();l.desktop=t.desktop??null,l.language=t.language??null;let{files:u,excludedByProjectSlug:d}=at(s,o),{files:f}=t.projectDir?ot(t.projectDir):{files:[]},{files:p}=t.projectDir?st(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;Y({zipfile:y,files:[...u,...m],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),Y({zipfile:y,files:f,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),Y({zipfile:y,files:p,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),Y({zipfile:y,files:t.bugReportLedgerFiles??[],prefix:c,redact:n,revealDocNames:a,bundleFiles:_,redactions:g,logger:i}),Y({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=U(e.sourcePath),n=`extra/${e.zipName??F(e.sourcePath)}`;y.addBuffer(t,n),_.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&<({zipfile:y,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:_,redactions:g});let b=new Set(h.map(e=>`diagnostic-reports/${F(e)}`)),x=_.filter(e=>b.has(e)),S=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:ze(t.diagnosticReports,x.length);y.addBuffer(Buffer.from(`${S}\n`,`utf8`),`state/diagnostic-reports-status.txt`),_.push(`state/diagnostic-reports-status.txt`);let C=JSON.stringify(l,null,2);y.addBuffer(Buffer.from(C,`utf8`),`sysinfo.json`),_.push(`sysinfo.json`);let w={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:_,redactions:g,sysinfo:l};y.addBuffer(Buffer.from(JSON.stringify(w,null,2),`utf8`),`MANIFEST.json`);let T=g.reduce((e,t)=>e+t.lineCount,0),E=new Set(m.map(e=>`logs/${F(e)}`)),D=_.filter(e=>E.has(e)),O=new Set((t.bugReportLedgerFiles??[]).map(e=>`${c}/${F(e)}`)),k=_.filter(e=>O.has(e)),A=s?_.filter(e=>e.startsWith(`logs/`)&&!et(e)&&!E.has(e)):[],j=x.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],M=j.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...j]:[`Redaction was disabled for this bundle; file contents are unmodified.`],N=[`# Bug Report Bundle`,``,`Generated: ${w.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${w.disciplineVersion}`,``,`## Contents`,``,..._.map(e=>`- ${e}`),``,`## Privacy`,``,...A.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...A.map(e=>`- ${e}`),``]:[],...D.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...D.map(e=>`- ${e}`),``]:[],...x.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...x.map(e=>`- ${e}`),``]:[],...k.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...k.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${ee.join(`, `)}`,T>0?`${T} line(s) were scrubbed across ${g.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...j,``,`This bundle is safe to attach to a GitHub issue.`]:M].join(`
|
|
2
|
-
`);y.addBuffer(Buffer.from(N,`utf8`),`README.md`),y.end();let P=ue(r);return y.outputStream.pipe(P),await new Promise((e,t)=>{P.on(`close`,e),P.on(`error`,t)}),i?.info({bundlePath:r,fileCount:_.length,redactionCount:T},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:_,redactions:g,redactedLineCount:T,generatedAt:w.generatedAt}}}var dt=a(),ft=e(A(),1),X=e(ne(),1);function pt(e){let t=b(`user`,e,e);return p({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function mt({home:e=q(),env:t=process.env}={}){let i=pt(e),{override:a,preferenceList:o}=O(t),{locale:c,source:l}=r({override:a,storedPreference:i,supportedLocales:s,preferenceList:o,autoDetectableLocales:n});return{preference:i,locale:c,source:l,systemLanguages:o}}function ht(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function gt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Z(e,t){if(typeof e==`string`)return ht(e,t.contentDir);if(Array.isArray(e))return e.map(e=>Z(e,t));if(!gt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=Z(i,t);return n}function _t(e,t){let n=U(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
3
|
-
`),i=n.split(`
|
|
4
|
-
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(e!==i.length-1||n!==``){if(n.length===0){a.push(``);continue}try{let e=Z(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
|
|
5
|
-
`)}\n`:a.join(`
|
|
6
|
-
`);K(e,o)}function vt(e,t){let n=U(e,`utf-8`);if(n.trim().length!==0)try{let r=Z(JSON.parse(n),t),i=n.endsWith(`
|
|
7
|
-
`)?`
|
|
8
|
-
`:``;K(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=ht(n,t.contentDir);r!==n&&K(e,r)}}function yt(e,t){let n=U(e,`utf-8`),r=ht(n,t.contentDir);r!==n&&K(e,r)}function bt(e){try{return W(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>L(e,t.name))}catch{return[]}}const xt=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function St(e){return/\.log\.\d+$/.test(e)}function Ct(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||St(e)}const wt=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Tt(e){let t={contentDir:e.contentDir};for(let n of wt)for(let r of bt(L(e.stagingDir,n)))Ct(r)?_t(r,t):r.endsWith(`.json`)?vt(r,t):yt(r,t);for(let n of bt(L(e.stagingDir,`state`))){let e=F(n);n.endsWith(`.jsonl`)?_t(n,t):xt.has(e)?vt(n,t):yt(n,t)}}const Et=[`.ok`,`local`,`telemetry`],Dt=[`.ok`,`local`,`logs`],Ot=[`.ok`,`local`,`loss-capture`],kt=`spans-current.jsonl`,At=`spans-prev.jsonl`,jt=`server-current.jsonl`,Mt=`server-prev.jsonl`,Nt=`loss-current.jsonl`,Pt=`loss-prev.jsonl`;function Ft(e){return L(e,...Et,kt)}function It(e){return L(e,...Et,At)}function Lt(e){return L(e,...Dt,jt)}function Rt(e){return L(e,...Dt,Mt)}function zt(e){return L(e,...Ot,Nt)}function Bt(e){return L(e,...Ot,Pt)}const Vt=1e3;async function Ht(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(Vt)});return t.ok?await t.text():null}catch{return null}}async function Ut(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(Vt)});return t.ok?await t.text():null}catch{return null}}async function Wt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(Vt)});return t.ok?await t.text():null}catch{return null}}function Gt(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 Kt(e){let t=L(e,`.git`,`ok`);if(!V(t))return null;let n=oe(`git`,[`-C`,t,`log`,`--oneline`,`-50`],v({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function qt(e){let t=L(e,`.git`,`ok`);if(!V(t))return null;let n=oe(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],v({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Jt(){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 Yt(){return{nodeVersion:process.version,platform:be(),arch:_e()}}function Xt(){return process.env.OTEL_SDK_DISABLED===`false`}function Zt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qt(e){if(!V(e))return{};let t;try{t=(0,dt.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(!Zt(t))return{};let n=t.telemetry;if(!Zt(n))return{};let r=n.localSink;return Zt(r)?r:{}}function $t(e){return typeof e==`boolean`?e:void 0}function en(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function tn(e){if(Zt(e))return en(e.maxBytes)}function nn(e){let t=Qt(b(`project`,e)),n=Qt(b(`project-local`,e));return{enabled:$t(n.enabled)??$t(t.enabled)??!0,spansMaxBytes:tn(n.spans)??tn(t.spans)??52428800,logsMaxBytes:tn(n.logs)??tn(t.logs)??26214400}}function rn(e){return Ee(`sha256`).update(e).digest(`hex`)}function an(e){let t=U(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const on=[`"doc.name"`,`"docName"`];function sn(e){let t=U(e,`utf-8`),n=0;for(let e of on){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Q(e,t){if(!V(e))return!1;try{return H(I(t),{recursive:!0}),e.endsWith(`.ips`)?K(t,Ue(U(e,`utf-8`))):le(e,t),!0}catch{return!1}}function cn(e){let t=[],n=e=>{let r=W(e,{withFileTypes:!0});for(let i of r){let r=L(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const ln=new Set([`.jsonl`]);function un(e){let t=e.lastIndexOf(`.`);return t!==-1&&ln.has(e.slice(t))}const dn=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function fn(e){if(St(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&dn.has(e.slice(t))}function pn(e){let t=[];for(let n of cn(e)){let r=mn(e,n);if(!fn(r))continue;let{redacted:i,patterns:a,lineCount:o}=u(U(n,`utf-8`));a.length!==0&&(K(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function mn(e,t){return R(e,t).split(B).join(`/`)}async function hn(e){let t=z(e.contentDir),n=z(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Ht,a=r.fetchAgentEffects??Ut,o=r.fetchWatcherRecent??Wt,s=r.readShadowHead??Kt,u=r.readCheckpointRefs??qt,ee=r.now??(()=>new Date),f=r.okVersion??(()=>ie),p=r.readDesktopEnv??Jt,m=r.readLanguage??mt,h=r.readRuntime??Yt,g=r.isOtlpPushEnabled??Xt,_=fe(L(Se(),`ok-bundle-`));try{H(L(_,`telemetry`),{recursive:!0}),H(L(_,`logs`),{recursive:!0}),H(L(_,`state`),{recursive:!0}),Q(Ft(n),L(_,`telemetry`,kt)),Q(It(n),L(_,`telemetry`,At)),Q(Lt(n),L(_,`logs`,jt)),Q(Rt(n),L(_,`logs`,Mt));for(let t of e.userLogFiles??[])Q(t,L(_,`logs`,F(t)));for(let t of e.userStateFiles??[])Q(t,L(_,c,F(t)));let v=0;for(let t of e.diagnosticReports?.files??[])Q(t,L(_,`diagnostic-reports`,F(t)))&&(v+=1);let y=L(n,`.ok`,`local`),b=L(y,`server.lock`),x=`not-running`,S=`no server.lock`,C=null;if(V(b)){Q(b,L(_,`state`,`server.lock`));try{let e=U(b,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?C=t.port:S=`lock present but no port`}catch{S=`lock present but unparseable`}}if(C!==null){let e=await i(C);e===null?S=`agent-presence endpoint at :${C} unreachable`:(K(L(_,`state`,`agent-presence.json`),e),x=`running`,S=``);let t=await a(C);t!==null&&K(L(_,`state`,`agent-effects.json`),t);let n=await o(C);if(n!==null){let e=Gt(n);e!==null&&K(L(_,`state`,`watcher-recent.jsonl`),e)}}let w=s(t);w!==null&&K(L(_,`state`,`shadow-head.txt`),w);let T=u(t);T!==null&&K(L(_,`state`,`checkpoint-refs.txt`),T),Q(zt(n),L(_,`state`,Nt)),Q(Bt(n),L(_,`state`,Pt)),Q(L(y,`last-spawn-error.log`),L(_,`state`,`last-spawn-error.log`)),Q(L(y,l),L(_,`state`,l)),Q(L(y,d),L(_,`state`,d));let E=h(),D=p(),O=m(),k={ok:{version:f(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:D,language:O}};K(L(_,`state`,`runtime.json`),`${JSON.stringify(k,null,2)}\n`);let A=x===`running`?`running
|
|
10
|
-
`:`not-running (${S})\n`;K(L(_,`state`,`server-status.txt`),A);let j=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:ze(e.diagnosticReports,v);if(K(L(_,`state`,`diagnostic-reports-status.txt`),`${j}\n`),e.processDir&&V(e.processDir)){let t=L(_,`process`);H(t,{recursive:!0}),le(e.processDir,t,{recursive:!0})}let M=e.redact===!0;M&&Tt({stagingDir:_,contentDir:t}),e.note&&K(L(_,`note.txt`),e.note);let N=null;e.scrubSecrets===!0&&(N=pn(_));for(let t of e.extraFiles??[])Q(t.sourcePath,L(_,`extra`,t.zipName??F(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let P=nn(n),te=cn(_),ne=[],re=0,ie=0;for(let e of te){let t=mn(_,e),n=ge(e).size,r=un(t)?an(e):0;ne.push({path:t,bytes:n,lines:r}),re+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(ie+=sn(e))}let ae={applied:M};N!==null&&(ae.secretScrub=N);let oe={schemaVersion:2,createdAt:ee().toISOString(),ok:{version:f(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:D,language:O},contentDir:{pathSha256:rn(t),absolutePath:M?`<CONTENT_DIR>`:t},telemetry:{localSink:P,otlpPushEnabled:g()},redaction:ae,serverStatus:x,files:ne};K(L(_,`manifest.json`),`${JSON.stringify(oe,null,2)}\n`);let I=te.some(e=>{try{return U(e,`utf-8`).includes(t)}catch{return!1}}),se={stagedDiagnosticReports:v,totalBytes:re,fileCount:ne.length,docNameCount:ie,contentDirVisible:I,redacted:M},R=!1;return{stagingDir:_,manifest:oe,summary:se,cleanup:()=>{R||(R=!0,G(_,{recursive:!0,force:!0}))}}}catch(e){throw G(_,{recursive:!0,force:!0}),e}}async function gn(e){let{collected:t,outputPath:n}=e,r=I(n);if(!V(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new ft.ZipFile,a=cn(t.stagingDir);for(let e of a){let n=mn(t.stagingDir,e);i.addFile(e,n)}i.end();let o=ue(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function _n(e,t){let n=L(e,`.ok`,`config.yml`);if(V(n))try{let t=(0,dt.parse)(U(n,`utf-8`)),r=re(t)?t.content:void 0,i=re(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return z(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return z(e)}async function vn(e,t,n,r,i){let a=Ze(t,e.logger),o=await hn({contentDir:_n(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...tt(a,e.userLogsDir??L(q(),`.ok`,`logs`)),...rt(e.cachesDir??L(q(),`Library`,`Caches`))],userStateFiles:it(e.bugReportsDir??J()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{H(I(e.outputPath),{recursive:!0}),await gn({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 yn(e){let{projectDir:t}=e,n=e.readDesktopEnv??Jt,r=e.readLanguage??mt,i=()=>Ye(e.diagnosticReportsDir??L(q(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return vn(e,t,n,r,i());let{zipPath:a,summary:o}=await ut({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:rt(e.cachesDir??L(q(),`Library`,`Caches`)),bugReportLedgerFiles:it(e.bugReportsDir??J()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}function $(e,t,n={}){let r=f(e,t);if(!V(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(U(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!_(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??k)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??w())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ye();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function bn(e){return e.replace(/:\d+$/,``)}function xn(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:bn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:bn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:bn(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 Sn=[{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`}],Cn=[...m.map(e=>D[e]),`open-knowledge`];function wn(e){if(!se(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=z(e);if(t===B||I(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function Tn(e,t){let n=R(e,t);if(n.startsWith(`..`)||se(n))return!1;let r=e;for(let e of n.split(B)){r=L(r,e);try{if(!de(r).isDirectory())return!1}catch{return!1}}return!0}function En(e,t){try{return W(e).every(n=>t.has(L(e,n)))}catch{return!1}}function Dn(e){let t=wn(e),n=[],r=[],i=new Set;for(let e of Sn){let a=L(t,e.hostDir,`skills`);if(!Tn(t,a))continue;let o=Cn.map(e=>L(a,e)).filter(e=>V(e));n.push(...o);for(let e of o)i.add(e);let s=L(t,e.pruneRoot),c=a;for(;En(c,i)&&(r.push(c),i.add(c),c!==s);){let e=I(c);if(e===c||e===t||!e.startsWith(t+B))break;c=e}}return{skillDirs:n,emptyDirs:r}}function On(e){try{if(!de(e).isDirectory())return!1;let t=W(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function kn(e){let t=new Set,n=new Set;for(let r of Sn){let i=L(e,r.hostDir,`skills`);for(let e of Cn)t.add(L(i,e));let a=L(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=I(o);if(t===o||t===e||!t.startsWith(e+B))break;o=t}}return{skillDirs:t,emptyDirs:n}}function An(e,t){let n=wn(e),r=kn(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(Tn(n,e)&&On(e))try{G(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(Tn(n,e))try{he(e),a.push(e)}catch{}return a}function jn(e){let t=wn(e),n=[];for(let e of m){let r=D[e];n.push({path:L(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let a of i)n.push({path:L(t,a.skillsRoot,r),bundleId:e,scope:`host`,hostDir:a.hostDir})}return n}function Mn(e,t){let n=[];for(let r of jn(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 Nn(e){return e!=null&&e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function Pn(e,t=Date.now()){let n=o(e,t);return n===`unknown`?`—`:n}function Fn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`)return null;let i=t.lock,a=t.status===`alive`&&C(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:g(n),command:n,isDesktop:Nn(n)}}function In(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:`stale`}const Ln=new Set([`running`,`desktop`,`foreign`]);function Rn(e){switch(e){case`running`:return X.default.green(e);case`desktop`:return X.default.blue(e);case`foreign`:return X.default.cyan(e);case`stale`:return X.default.yellow(e)}}function zn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Bn(e){return`${zn(e.server.usage)} | ${zn(e.ui?.usage??null)}`}function Vn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function Hn(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,Vn(e),Bn(e),In(e),String(e.server.pid),Pn(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=Rn(In(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 Un(e={}){let t=e.discover??h,n=e.inspect??(e=>$(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??E,a=e.resolveUsage??T,o=await t(),s=[];for(let e of o){let t=n(e),r=Fn(e,t,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:In(e)}));r(JSON.stringify(e,null,2));return}r(Hn(e.all?s:s.filter(e=>Ln.has(In(e)))))}function Wn(){return new N(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await Un({all:t.all===!0||e===`all`,json:t.json===!0})})}async function Gn(e,t=P()){let n=$(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=y(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500)});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function Kn(e,t={}){return{targets:Jn(e,t.isAlive??k)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}async function qn(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??Gn,o=e.logger??P(),s=Kn(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 Jn(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}async function Yn(e,t=k){let n=await h(),r=null;for(let i of n){let n=$(i,`server`);if(Jn(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function Xn(e,t){let n=await qn({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function Zn(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 Qn(e){let t=await h(),n=0;for(let r of t)r!==e&&Jn($(r,`server`),k)&&n++;return n}function $n(e){return new N(`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 qn({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 Qn(t);console.log(Zn(process.cwd(),e,{listingFollows:e>0})),e>0&&await Un({})}return}if(i===`all`){let e=await h();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)Jn($(n,`server`),k)&&(await Xn(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 Yn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await Xn(t,r);return}let a=z(je(),i),o=x(a),s=[],c=await qn({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(Zn(a,await Qn(o)))})}export{je as C,Le as S,Oe as T,ze as _,An as a,Ne as b,jn as c,yn as d,hn as f,Ye as g,J as h,Wn as i,xn as l,Xe as m,qn as n,Dn as o,gn as p,$n as r,Mn as s,Gn as t,$ as u,Me as v,Ae as w,Ie as x,Pe as y};
|
package/dist/src-CemYwu_V.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./md-manager-BGnqyqi1-BKxqDqfk.mjs";import"./init-Ex7PlJbP.mjs";import"./registry-probes-CKT5zpL7.mjs";import"./src--hXB6oPw.mjs";import"./start-C9MnFVTQ.mjs";import{n as e}from"./loader-Da_kR2vs.mjs";import"./preview-BOTcB8PJ.mjs";import"./cli.mjs";import"./repair-mcp-configs-Cvxc0PSE.mjs";export{e as loadConfig};
|
package/dist/start-B-ZEfbkW.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,m as t,p as n,r}from"./start-C9MnFVTQ.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
|