@inkeep/open-knowledge 0.84.0-beta.12 → 0.84.0-beta.13
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 +71 -71
- package/dist/constants-7Qyq_zUm.mjs +1 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.mjs +238 -235
- package/dist/{init-BQde4e6O.mjs → init-0rxCvh5L.mjs} +2 -2
- package/dist/init-CXecl8YV.mjs +1 -0
- package/dist/{launch-json-removal-sNU-sOlT.mjs → launch-json-removal-DcB-Wfiq.mjs} +1 -1
- package/dist/loader-Cao__OIq.mjs +1 -0
- package/dist/{loader-DOgf-WE1.mjs → loader-Cc8WS_Kd.mjs} +1 -1
- package/dist/preview-D3mT4ao_.mjs +1 -0
- package/dist/{preview-Bkx0CUMs.mjs → preview-DCg3Y_RC.mjs} +1 -1
- package/dist/public/assets/{AccountSection-ByL_XlkF.js → AccountSection-B9GFpr4F.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-z3uDOpkw.js → ActivityModeContent-Ctgs6wa7.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-DXL1xTHT.js → AddPropertiesButton-zJXBlIA5.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-DkpeIuOh.js → AgentDiffPane-Djl1ToN8.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-BiYv1xJJ.js → AttachmentsSection-2DavTRS4.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-C0YUeLId.js → CodeMirrorPropInput-CvL4Fw3i.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-MmsSKfbM.js → ContentRulesSection-DI_-zh8B.js} +1 -1
- package/dist/public/assets/{DocumentContext-bcrdnYK4.js → DocumentContext-BTpye0wm.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-Db67SIkR.js → EditorModeToggle-ByL15J-o.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-COqU5v6k.js → ExcalidrawDocEditor-cwGRFFsR.js} +1 -1
- package/dist/public/assets/FeedbackForm-CJG--Io-.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-D9za4SaR.js → ImportSkillDialog-C5Wc3l-X.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-7C-iSaC_.js → LinkPreviewsSection-I7k5npop.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-C1KpH1ic.js → LintConfigEditor-CmVvgecx.js} +1 -1
- package/dist/public/assets/{LintingSection-2dusJQID.js → LintingSection-CrPyWSf6.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-CtspFBi-.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-kbKs1Td7.js → ManagedArtifactProperties-CyEh2d0o.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-7sgUdHOz.js → MermaidDocEditor-BGRvDEPi.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-oqhSkmzV.js → NetworkAccessSection-BWfjDmfO.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-BOOZkIHc.js → PropertyDisplayRow-BKe17Em-.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-DOoEt7mm.js → PublishToGitHubDialog-Dn1_oSW2.js} +1 -1
- package/dist/public/assets/ReportBugDialogBody-DoHfZBJP.js +3 -0
- package/dist/public/assets/{ReportBugMenuTrigger-B4e77tbt.js → ReportBugMenuTrigger-D6HmlS6i.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-G14bNV23.js → SchemaConfigEditor-BRehzWfq.js} +1 -1
- package/dist/public/assets/{SearchSection-4kZVcGbx.js → SearchSection-OsdFyUj1.js} +1 -1
- package/dist/public/assets/{SessionsHost-D5WZxPrP.js → SessionsHost-Dfa3Kxga.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-DL8TvROU.js → SettingsDialogBody-BQilAbHN.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-Dm61IZKn.js → ShareReceiveMissDialog-WLm7H-Qq.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-BUAXX4Gq.js → SkillToolbarControls-DPDzNMVA.js} +1 -1
- package/dist/public/assets/{SourceEditor-NqhLGDCJ.js → SourceEditor-CgnUzAYs.js} +1 -1
- package/dist/public/assets/{SpellingSettings-BNFHXby7.js → SpellingSettings-Ccod57gT.js} +1 -1
- package/dist/public/assets/{SyncSection-al87b-Jp.js → SyncSection-Dmc70btB.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-CXkNifUS.js → SyncStatusBadge-YALZC8ph.js} +1 -1
- package/dist/public/assets/{TerminalSection-BamXWWy6.js → TerminalSection-DyfUJxOe.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-D4beITW6.js → TerminalWindowApp-ZlS6k93B.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Bf1U1qOD.js → TextDocEditor-njGGLt-q.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-CFVzn2Wi.js → ThemePluginSection-DQuitacb.js} +1 -1
- package/dist/public/assets/{ThreadView-D1-E2Z2u.js → ThreadView-BcJ87wpA.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-CxiA8UMU.js → TimelineDiffPane-KVwOFG02.js} +1 -1
- package/dist/public/assets/{comment-chips-DAJdx_uE.js → comment-chips-9Q2hv4Un.js} +1 -1
- package/dist/public/assets/{config-provider-D2NaVbG-.js → config-provider-CNfO-H0J.js} +1 -1
- package/dist/public/assets/config-schema-BJ8D4PAa.js +1 -0
- package/dist/public/assets/{doc-undo-manager-BuaLKDQj.js → doc-undo-manager-BM-wXcNc.js} +1 -1
- package/dist/public/assets/field-controls-BUg68wFl.js +1 -0
- package/dist/public/assets/{field-controls-D8911DiU.js → field-controls-D7Pus9Z9.js} +1 -1
- package/dist/public/assets/{index-BczQVeh8.js → index-Vwqm7UP0.js} +7 -7
- package/dist/public/assets/{lint-config-client-C7n5XYGu.js → lint-config-client-B8HW3I8D.js} +1 -1
- package/dist/public/assets/{lint-plugins-4tHbzv-9.js → lint-plugins-DS-hzw80.js} +1 -1
- package/dist/public/assets/{markdown-lint-CcDaWKx_.js → markdown-lint-CH5x73AS.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-DVtjv5mT.js → markdownlint-rule-browser-feJ8vq-M.js} +1 -1
- package/dist/public/assets/messages-1FbrCYYU.js +1 -0
- package/dist/public/assets/messages-BCW6gNH_.js +1 -0
- package/dist/public/assets/messages-C3so4edu.js +1 -0
- package/dist/public/assets/messages-C7ZxXIR8.js +1 -0
- package/dist/public/assets/messages-CFNq87YD.js +1 -0
- package/dist/public/assets/{messages-eBjRT1jS.js → messages-CPx8MTHw.js} +1 -1
- package/dist/public/assets/messages-Cb0Efw8g.js +1 -0
- package/dist/public/assets/messages-Cdosk3Xf.js +1 -0
- package/dist/public/assets/messages-DAm73tZm.js +1 -0
- package/dist/public/assets/messages-DOqNxlqh.js +1 -0
- package/dist/public/assets/messages-DUki_neg.js +1 -0
- package/dist/public/assets/messages-DuTTY6Gu.js +1 -0
- package/dist/public/assets/messages-vvUSKBXn.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-J84TDxqE.js → pending-receive-nav-store-qv7Cfy9Q.js} +1 -1
- package/dist/public/assets/{progress-BX5pjOIM.js → progress-YIJt8IwS.js} +1 -1
- package/dist/public/assets/{saved-themes-client-DJ2aF7Bi.js → saved-themes-client-CGp8QQYb.js} +1 -1
- package/dist/public/assets/{schema-section-DJrgHqj4.js → schema-section-CNrnBed2.js} +1 -1
- package/dist/public/assets/{selection-context-B0ouWJSZ.js → selection-context-riqxN6LG.js} +1 -1
- package/dist/public/assets/{src-B_uHUKrh.js → src-C2_yxMVl.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-d7EggcXI.js → typing-burst-detector-BydS4hGG.js} +1 -1
- package/dist/public/assets/{uninstall-RX-O6ulT.js → uninstall-CaDWNOzh.js} +1 -1
- package/dist/public/assets/{use-activity-panel-BLaPtrGl.js → use-activity-panel-CP-KbBLe.js} +1 -1
- package/dist/public/assets/{use-apply-config-language-CYUblJO2.js → use-apply-config-language-erUucjt8.js} +2 -2
- package/dist/public/assets/{use-installed-clis-NrJq7Xrn.js → use-installed-clis-98lB00dU.js} +2 -2
- package/dist/public/assets/{use-open-skill-CTSUAEr2.js → use-open-skill-OC__o8wV.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-OuiEEdVx.js → use-terminal-enabled-B4wyLrav.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CnxSGZKl.js → use-timeline-entry-diff-qr50coTA.js} +1 -1
- package/dist/public/index.html +23 -23
- package/dist/public/uninstall.html +3 -3
- package/dist/{registry-probes-BFfz79lC.mjs → registry-probes-dLB-QCwD.mjs} +1 -1
- package/dist/{removal-file-path-mfeFIfBR.mjs → removal-file-path-CP_R44kA.mjs} +1 -1
- package/dist/{repair-launch-json-DhvTyrLz.mjs → repair-launch-json-DAdDamo4.mjs} +1 -1
- package/dist/{repair-mcp-configs-CwXY6Ktb.mjs → repair-mcp-configs-rvj-kL93.mjs} +1 -1
- package/dist/src-BskdlNkv.mjs +14 -0
- package/dist/src-C5jErYFO.mjs +1 -0
- package/dist/{start-zogYNkil.mjs → start-BFNDsvyi.mjs} +2 -2
- package/dist/start-C25e1SRP.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-imD-rL-h.mjs +0 -1
- package/dist/init-CUYZc0CT.mjs +0 -1
- package/dist/loader-4xpxaqDl.mjs +0 -1
- package/dist/preview-CKZycsBm.mjs +0 -1
- package/dist/public/assets/FeedbackForm-BHijwTvL.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-ykwFL7U1.js +0 -1
- package/dist/public/assets/ReportBugDialogBody-DfZsaYOY.js +0 -3
- package/dist/public/assets/config-schema-CRd3qZjo.js +0 -1
- package/dist/public/assets/field-controls-B_FthcUK.js +0 -1
- package/dist/public/assets/messages--wHJCiI1.js +0 -1
- package/dist/public/assets/messages-BRvXxRkc.js +0 -1
- package/dist/public/assets/messages-BaE0QOk7.js +0 -1
- package/dist/public/assets/messages-Bja02MbG.js +0 -1
- package/dist/public/assets/messages-CAgZwRdG.js +0 -1
- package/dist/public/assets/messages-CDiueu9Y.js +0 -1
- package/dist/public/assets/messages-COcNOYE5.js +0 -1
- package/dist/public/assets/messages-CynpCzt4.js +0 -1
- package/dist/public/assets/messages-DNlUaQj-.js +0 -1
- package/dist/public/assets/messages-Dyx0wJjY.js +0 -1
- package/dist/public/assets/messages-EDRWy-De.js +0 -1
- package/dist/public/assets/messages-QOMEPB6y.js +0 -1
- package/dist/src-BMeBtbpm.mjs +0 -11
- package/dist/src-DiThsiBM.mjs +0 -1
- package/dist/start-CttrF1NF.mjs +0 -1
package/dist/src-BMeBtbpm.mjs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{Gc as t,H as n,Kc as r,Ml as i,Nl as a,U as o,Vc as s,Vu as c,W as l,_a as u,cf as d,ga as ee,gf as f,l as p,u as te,vf as m,xf as h}from"./md-manager-BGnqyqi1-BTvqIsKE.mjs";import{At as g,Li as _,Qn as v,Ri as y,Si as b,Ta as x,Tr as S,as as C,bi as w,cr as T,fr as E,is as D,ko as O,m as k,mi as A,rs as ne,si as j,ts as M,ws as N,xi as re}from"./dist-CjYbXRTw.mjs";import{t as P}from"./yazl-BBz29IQN.mjs";import{Ct as F,ot as I,st as ie}from"./init-BQde4e6O.mjs";import{l as ae,w as oe}from"./registry-probes-BFfz79lC.mjs";import{c as se}from"./colors-r_owlCuY.mjs";import{t as ce}from"./is-object-BGze3w87.mjs";import{n as le}from"./constants-imD-rL-h.mjs";import"./loader-DOgf-WE1.mjs";import"./preview-Bkx0CUMs.mjs";import{execSync as ue,spawnSync as de}from"node:child_process";import{basename as L,dirname as R,isAbsolute as fe,join as z,relative as pe,resolve as B,sep as V}from"node:path";import{closeSync as me,cpSync as he,createWriteStream as ge,existsSync as H,lstatSync as _e,mkdirSync as U,mkdtempSync as ve,openSync as ye,readFileSync as W,readSync as be,readdirSync as G,readlinkSync as xe,realpathSync as Se,rmSync as K,rmdirSync as Ce,statSync as we,writeFileSync as q}from"node:fs";import{arch as Te,freemem as Ee,homedir as J,hostname as De,platform as Oe,release as ke,tmpdir as Ae,totalmem as je,type as Me,uptime as Ne}from"node:os";import"node:fs/promises";import{createHash as Pe}from"node:crypto";function Fe(e,t){let n=t.map(e=>[N(e),e]);for(let t of e){let e=N(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function Ie(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=Fe([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=Fe(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function Le(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 Re=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`audit`,`deinit`,`auth`]);function ze(e,t,n=E){if(e!==void 0&&!Re.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Be=null;function Ve(e){Be=e}function He(){return Be??process.cwd()}const Ue=`Open Knowledge`;function We(e={}){let t=e.platformName??process.platform,n=e.productName??f().productName;return I(t).join(ie({...e,platformName:t}),n)}function Ge(e={}){let t=e.platformName??process.platform,n=e.home??J(),r=e.env??process.env,i=I(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`${f().packageName.replaceAll(`/`,``)}-updater`)}function Ke(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 qe(e){let t=z(e,`state.json`);if(!H(t))return[];let n;try{n=JSON.parse(W(t,`utf-8`))}catch{return[]}return Ke(n)??[]}function Je(e){let t=z(e,`state.json`);if(!H(t))return!1;try{return Ke(JSON.parse(W(t,`utf-8`)))!==null}catch{return!1}}const Ye=8192;function Xe(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 Ze(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const Qe=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function $e(e){return e.replace(Qe,`$1"[REDACTED-DEVICE-ID]"`)}function et(e){return $e(Ze(e))}const tt=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function nt(e){if(typeof e!=`string`)return null;let t=tt.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 rt(e){let t=ye(e,`r`);try{let e=Buffer.alloc(Ye),n=0,r=!1;for(;n<Ye;){let i=be(t,e,n,Ye-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{me(t)}}function it(e){try{let t=rt(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:nt(a)}}catch{return{kind:`unreadable`}}}function at(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function ot(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=G(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=z(e,t.name),r;try{r=we(n).mtimeMs}catch{continue}if(r<i)continue;let c=it(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!at(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 Y(){return z(M(),`bug-reports`)}function st(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Y(),r=`${t}-bugreport`,i=z(n,`${r}.zip`);for(let e=2;H(i);e+=1)i=z(n,`${r}-${e}.zip`);return i}function ct(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function lt(e,t){let n=z(e,`.ok`,`config.yml`);if(H(n))try{let e=W(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 H(z(e,`.ok`))?Pe(`sha256`).update(B(e)).digest(`hex`).slice(0,12):null}function ut(){let e={timestamp:new Date().toISOString(),platform:Oe(),osType:Me(),osRelease:ke(),hostname:`[redacted]`,uptime:Ne(),freeMem:Ee(),totalMem:je(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ue(`sw_vers -productVersion 2>/dev/null`,O({encoding:`utf8`})).trim()}catch{}try{let t=z(__dirname,`..`,`..`,`package.json`);H(t)&&(e.okVersion=JSON.parse(W(t,`utf8`)).version)}catch{}return e}const dt=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function ft(e){let t=L(e);return dt.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function pt(e,t){return _t(e,t).files}const mt=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function ht(e,t=ae){let n=z(e,`${t}.ShipIt`);if(!H(n))return[];let r;try{r=G(n)}catch{return[]}return mt.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=>z(n,e.entry)))}function gt(e){if(!H(e))return[];try{let t=new Map;for(let n of G(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=>z(e,t))}catch{return[]}}function _t(e,t){if(!H(t))return{files:[],excludedByProjectSlug:0};let n=G(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>z(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(ft),i=[],a=r.filter(t=>{try{return W(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=>!ft(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function vt(e){let n=z(e,`.ok`,`local`);return H(n)?{files:[`server.lock`,`last-spawn-error.log`,t,s].map(e=>z(n,e)).filter(e=>H(e))}:{files:[]}}function yt(e){let t=z(e,`.ok`,`local`,`logs`);return H(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>z(t,e)).filter(e=>H(e))}:{files:[]}}function bt(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${Pe(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function xt(e){let t=e.revealDocNames?e.content:bt(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 X(e){for(let t of e.files)try{let n=W(t,`utf8`);xt({zipfile:e.zipfile,name:`${e.prefix}/${L(t)}`,content:t.endsWith(`.ips`)?et(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 St(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??z(M(),`logs`),s=t.projectDir?lt(t.projectDir,i):null;U(R(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=ut();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=_t(s,o),{files:d}=t.projectDir?vt(t.projectDir):{files:[]},{files:f}=t.projectDir?yt(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let h=[],g=[],{ZipFile:_}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),v=new _;X({zipfile:v,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i}),X({zipfile:v,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i}),X({zipfile:v,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i}),X({zipfile:v,files:t.bugReportLedgerFiles??[],prefix:te,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i}),X({zipfile:v,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i});for(let e of t.extraFiles??[])try{let t=W(e.sourcePath),n=`extra/${e.zipName??L(e.sourcePath)}`;v.addBuffer(t,n),g.push(n);let r=ct(e,n);r!==null&&h.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&xt({zipfile:v,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:g,redactions:h});let y=new Set(m.map(e=>`diagnostic-reports/${L(e)}`)),b=g.filter(e=>y.has(e)),x=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:Xe(t.diagnosticReports,b.length);v.addBuffer(Buffer.from(`${x}\n`,`utf8`),`state/diagnostic-reports-status.txt`),g.push(`state/diagnostic-reports-status.txt`);let S=JSON.stringify(c,null,2);v.addBuffer(Buffer.from(S,`utf8`),`sysinfo.json`),g.push(`sysinfo.json`);let C={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:g,redactions:h,sysinfo:c};v.addBuffer(Buffer.from(JSON.stringify(C,null,2),`utf8`),`MANIFEST.json`);let w=h.reduce((e,t)=>e+t.lineCount,0),T=new Set(p.map(e=>`logs/${L(e)}`)),E=g.filter(e=>T.has(e)),D=new Set((t.bugReportLedgerFiles??[]).map(e=>`${te}/${L(e)}`)),O=g.filter(e=>D.has(e)),k=s?g.filter(e=>e.startsWith(`logs/`)&&!ft(e)&&!T.has(e)):[],A=b.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.`]:[],ne=A.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...A]:[`Redaction was disabled for this bundle; file contents are unmodified.`],j=[`# Bug Report Bundle`,``,`Generated: ${C.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${C.disciplineVersion}`,``,`## Contents`,``,...g.map(e=>`- ${e}`),``,`## Privacy`,``,...k.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:`,...k.map(e=>`- ${e}`),``]:[],...E.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:`,...E.map(e=>`- ${e}`),``]:[],...b.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:`,...b.map(e=>`- ${e}`),``]:[],...O.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:`,...O.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${ee.join(`, `)}`,w>0?`${w} line(s) were scrubbed across ${h.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...A,``,`This bundle is safe to attach to a GitHub issue.`]:ne].join(`
|
|
2
|
-
`);v.addBuffer(Buffer.from(j,`utf8`),`README.md`),v.end();let N=ge(r);return v.outputStream.pipe(N),await new Promise((e,t)=>{N.on(`close`,e),N.on(`error`,t)}),i?.info({bundlePath:r,fileCount:g.length,redactionCount:w},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:g,redactions:h,redactedLineCount:w,generatedAt:C.generatedAt}}}var Ct=c(),wt=e(P(),1),Z=e(se(),1);function Tt(e){let t=C(`user`,e,e);return ne({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function Et({home:e=J(),env:t=process.env}={}){let n=Tt(e),{override:r,preferenceList:o}=D(t),{locale:s,source:c}=Ie({override:r,storedPreference:n,supportedLocales:a,preferenceList:o,autoDetectableLocales:i});return{preference:n,locale:s,source:c,systemLanguages:o}}function Dt(e){let t=new Set([e]);try{t.add(Se.native(e))}catch{return[e].filter(e=>e.length>0)}return[...t].filter(e=>e.length>0).sort((e,t)=>t.length-e.length)}function Ot(e,t){let n=e;for(let e of t)n.includes(e)&&(n=n.split(e).join(`<CONTENT_DIR>`));return n}function kt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function At(e,t){if(typeof e==`string`)return Ot(e,t.contentDirSpellings);if(Array.isArray(e))return e.map(e=>At(e,t));if(!kt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=At(i,t);return n}function jt(e,t){let n=W(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=At(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
|
|
5
|
-
`)}\n`:a.join(`
|
|
6
|
-
`);q(e,o)}function Mt(e,t){let n=W(e,`utf-8`);if(n.trim().length!==0)try{let r=At(JSON.parse(n),t),i=n.endsWith(`
|
|
7
|
-
`)?`
|
|
8
|
-
`:``;q(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=Ot(n,t.contentDirSpellings);r!==n&&q(e,r)}}function Nt(e,t){let n=W(e,`utf-8`),r=Ot(n,t.contentDirSpellings);r!==n&&q(e,r)}function Pt(e){try{return G(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>z(e,t.name))}catch{return[]}}const Ft=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function It(e){return/\.log\.\d+$/.test(e)}function Lt(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||It(e)}const Rt=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function zt(e){let t={contentDirSpellings:Dt(e.contentDir)};for(let n of Rt)for(let r of Pt(z(e.stagingDir,n)))Lt(r)?jt(r,t):r.endsWith(`.json`)?Mt(r,t):Nt(r,t);for(let n of Pt(z(e.stagingDir,`state`))){let e=L(n);n.endsWith(`.jsonl`)?jt(n,t):Ft.has(e)?Mt(n,t):Nt(n,t)}}const Bt=[`.ok`,`local`,`telemetry`],Vt=[`.ok`,`local`,`logs`],Ht=[`.ok`,`local`,`loss-capture`],Ut=`spans-current.jsonl`,Wt=`spans-prev.jsonl`,Gt=`server-current.jsonl`,Kt=`server-prev.jsonl`,qt=`loss-current.jsonl`,Jt=`loss-prev.jsonl`;function Yt(e){return z(e,...Bt,Ut)}function Xt(e){return z(e,...Bt,Wt)}function Zt(e){return z(e,...Vt,Gt)}function Qt(e){return z(e,...Vt,Kt)}function $t(e){return z(e,...Ht,qt)}function en(e){return z(e,...Ht,Jt)}const tn=1e3;async function nn(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(tn)});return t.ok?await t.text():null}catch{return null}}async function rn(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(tn)});return t.ok?await t.text():null}catch{return null}}async function an(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(tn)});return t.ok?await t.text():null}catch{return null}}function on(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 sn(e){let t=z(e,`.git`,`ok`);if(!H(t))return null;let n=de(`git`,[`-C`,t,`log`,`--oneline`,`-50`],O({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function cn(e){let t=z(e,`.git`,`ok`);if(!H(t))return null;let n=de(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],O({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function ln(){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 un(){return{nodeVersion:process.version,platform:Oe(),arch:Te()}}function dn(){return process.env.OTEL_SDK_DISABLED===`false`}function fn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pn(e){if(!H(e))return{};let t;try{t=(0,Ct.parse)(W(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(!fn(t))return{};let n=t.telemetry;if(!fn(n))return{};let r=n.localSink;return fn(r)?r:{}}function mn(e){return typeof e==`boolean`?e:void 0}function hn(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function gn(e){if(fn(e))return hn(e.maxBytes)}function _n(e){let t=pn(C(`project`,e)),n=pn(C(`project-local`,e));return{enabled:mn(n.enabled)??mn(t.enabled)??!0,spansMaxBytes:gn(n.spans)??gn(t.spans)??52428800,logsMaxBytes:gn(n.logs)??gn(t.logs)??26214400}}function vn(e){return Pe(`sha256`).update(e).digest(`hex`)}function yn(e){let t=W(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const bn=[`"doc.name"`,`"docName"`];function xn(e){let t=W(e,`utf-8`),n=0;for(let e of bn){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Q(e,t){if(!H(e))return!1;try{return U(R(t),{recursive:!0}),e.endsWith(`.ips`)?q(t,et(W(e,`utf-8`))):he(e,t),!0}catch{return!1}}function Sn(e){let t=[],n=e=>{let r=G(e,{withFileTypes:!0});for(let i of r){let r=z(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Cn=new Set([`.jsonl`]);function wn(e){let t=e.lastIndexOf(`.`);return t!==-1&&Cn.has(e.slice(t))}const Tn=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function En(e){if(It(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&Tn.has(e.slice(t))}function Dn(e){let t=[];for(let n of Sn(e)){let r=On(e,n);if(!En(r))continue;let{redacted:i,patterns:a,lineCount:o}=u(W(n,`utf-8`));a.length!==0&&(q(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function On(e,t){return pe(e,t).split(V).join(`/`)}async function kn(e){let n=B(e.contentDir),i=B(e.projectDir??e.contentDir),a=e.deps??{},o=a.fetchAgentPresence??nn,c=a.fetchAgentEffects??rn,l=a.fetchWatcherRecent??an,u=a.readShadowHead??sn,d=a.readCheckpointRefs??cn,ee=a.now??(()=>new Date),f=a.okVersion??(()=>le),p=a.readDesktopEnv??ln,m=a.readLanguage??Et,h=a.readRuntime??un,g=a.isOtlpPushEnabled??dn,_=ve(z(Ae(),`ok-bundle-`));try{U(z(_,`telemetry`),{recursive:!0}),U(z(_,`logs`),{recursive:!0}),U(z(_,`state`),{recursive:!0}),Q(Yt(i),z(_,`telemetry`,Ut)),Q(Xt(i),z(_,`telemetry`,Wt)),Q(Zt(i),z(_,`logs`,Gt)),Q(Qt(i),z(_,`logs`,Kt));for(let t of e.userLogFiles??[])Q(t,z(_,`logs`,L(t)));for(let t of e.userStateFiles??[])Q(t,z(_,te,L(t)));let v=0;for(let t of e.diagnosticReports?.files??[])Q(t,z(_,`diagnostic-reports`,L(t)))&&(v+=1);let y=z(i,`.ok`,`local`),b=z(y,`server.lock`),x=`not-running`,S=`no server.lock`,C=null;if(H(b)){Q(b,z(_,`state`,`server.lock`));try{let e=W(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 o(C);e===null?S=`agent-presence endpoint at :${C} unreachable`:(q(z(_,`state`,`agent-presence.json`),e),x=`running`,S=``);let t=await c(C);t!==null&&q(z(_,`state`,`agent-effects.json`),t);let n=await l(C);if(n!==null){let e=on(n);e!==null&&q(z(_,`state`,`watcher-recent.jsonl`),e)}}let w=u(n);w!==null&&q(z(_,`state`,`shadow-head.txt`),w);let T=d(n);T!==null&&q(z(_,`state`,`checkpoint-refs.txt`),T),Q($t(i),z(_,`state`,qt)),Q(en(i),z(_,`state`,Jt)),Q(z(y,`last-spawn-error.log`),z(_,`state`,`last-spawn-error.log`)),Q(z(y,r),z(_,`state`,r)),Q(z(y,t),z(_,`state`,t)),Q(z(y,s),z(_,`state`,s));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}};q(z(_,`state`,`runtime.json`),`${JSON.stringify(k,null,2)}\n`);let A=x===`running`?`running
|
|
10
|
-
`:`not-running (${S})\n`;q(z(_,`state`,`server-status.txt`),A);let ne=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:Xe(e.diagnosticReports,v);if(q(z(_,`state`,`diagnostic-reports-status.txt`),`${ne}\n`),e.processDir&&H(e.processDir)){let t=z(_,`process`);U(t,{recursive:!0}),he(e.processDir,t,{recursive:!0})}let j=e.redact===!0;j&&zt({stagingDir:_,contentDir:n}),e.note&&q(z(_,`note.txt`),e.note);let M=null;e.scrubSecrets===!0&&(M=Dn(_));for(let t of e.extraFiles??[]){let e=t.zipName??L(t.sourcePath);if(!Q(t.sourcePath,z(_,`extra`,e))){a.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=ct(t,`extra/${e}`);n!==null&&(M??={redactions:[],redactedLineCount:0},M.redactions.push(n),M.redactedLineCount+=n.lineCount)}let N=_n(i),re=Sn(_),P=[],F=0,I=0;for(let e of re){let t=On(_,e),n=we(e).size,r=wn(t)?yn(e):0;P.push({path:t,bytes:n,lines:r}),F+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(I+=xn(e))}let ie={applied:j};M!==null&&(ie.secretScrub=M);let ae={schemaVersion:2,createdAt:ee().toISOString(),ok:{version:f(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:D,language:O},contentDir:{pathSha256:vn(n),absolutePath:j?`<CONTENT_DIR>`:n},telemetry:{localSink:N,otlpPushEnabled:g()},redaction:ie,serverStatus:x,files:P};q(z(_,`manifest.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=Dt(n),se=re.some(e=>{try{let t=W(e,`utf-8`);return oe.some(e=>t.includes(e))}catch{return!1}}),ce={stagedDiagnosticReports:v,totalBytes:F,fileCount:P.length,docNameCount:I,contentDirVisible:se,redacted:j},le=!1;return{stagingDir:_,manifest:ae,summary:ce,cleanup:()=>{le||(le=!0,K(_,{recursive:!0,force:!0}))}}}catch(e){throw K(_,{recursive:!0,force:!0}),e}}async function An(e){let{collected:t,outputPath:n}=e,r=R(n);if(!H(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new wt.ZipFile,a=Sn(t.stagingDir);for(let e of a){let n=On(t.stagingDir,e);i.addFile(e,n)}i.end();let o=ge(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 jn(e,t){let n=z(e,`.ok`,`config.yml`);if(H(n))try{let t=(0,Ct.parse)(W(n,`utf-8`)),r=ce(t)?t.content:void 0,i=ce(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return B(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 B(e)}async function Mn(e,t,n,r,i){let a=lt(t,e.logger),o=await kn({contentDir:jn(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...pt(a,e.userLogsDir??z(M(),`logs`)),...ht(e.cachesDir??z(J(),`Library`,`Caches`))],userStateFiles:gt(e.bugReportsDir??Y()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{U(R(e.outputPath),{recursive:!0}),await An({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 Nn(e){let{projectDir:t}=e,n=e.readDesktopEnv??ln,r=e.readLanguage??Et,i=()=>ot(e.diagnosticReportsDir??z(J(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return Mn(e,t,n,r,i());let{zipPath:a,summary:o}=await St({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:ht(e.cachesDir??z(J(),`Library`,`Caches`)),bugReportLedgerFiles:gt(e.bugReportsDir??Y()),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=b(e,t),i;try{i=W(r,`utf-8`)}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`?{status:`missing`,lockPath:r}:{status:`read-error`,lockPath:r,error:e instanceof Error?e.message:String(e)}}let a;try{a=JSON.parse(i)}catch{return{status:`corrupt`,lockPath:r}}let o=a&&typeof a==`object`?a:{},s=`machineId`in o&&typeof o.machineId==`string`?o.machineId!==(n.machineId??S()):`hostname`in o&&typeof o.hostname==`string`&&o.hostname!==(n.host??De());if(!a||typeof a!=`object`||!A(a.pid))return{status:`corrupt`,lockPath:r,...s?{foreignHost:!0}:{}};let c=a.pid,l=`machineId`in o&&typeof o.machineId==`string`||`hostname`in o&&typeof o.hostname==`string`;return s?{status:`foreign-host`,lockPath:r,lock:a}:(n.isAlive??j)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}function Pn(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 Fn(e){return e.replace(/:\d+$/,``)}function In(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Fn(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Fn(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Fn(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 Ln=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Rn(e){return l(h(),e)}function zn(){return o(h())}function Bn(){let e=h();if(e===`stable`)return Ln;let t=n(e);return RegExp(`^# >>> ${t} >>>\\n[\\s\\S]*?^# <<< ${t} <<<\\n?`,`m`)}const Vn={existsSync:e=>H(e),readFileSync:(e,t)=>W(e,t),lstatSync:e=>_e(e),readlinkSync:e=>xe(e)};function Hn(e,t=Vn){let n=Rn(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 Un(e){let t=e.replace(Bn(),``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function Wn(e,t,n=Vn){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}const Gn=[{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`}],Kn=[...g.map(e=>k[e]),`open-knowledge`];function qn(e){if(!fe(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=B(e);if(t===V||R(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function Jn(e,t){let n=pe(e,t);if(n.startsWith(`..`)||fe(n))return!1;let r=e;for(let e of n.split(V)){r=z(r,e);try{if(!_e(r).isDirectory())return!1}catch{return!1}}return!0}function Yn(e,t){try{return G(e).every(n=>t.has(z(e,n)))}catch{return!1}}function Xn(e){let t=qn(e),n=[],r=[],i=new Set;for(let e of Gn){let a=z(t,e.hostDir,`skills`);if(!Jn(t,a))continue;let o=Kn.map(e=>z(a,e)).filter(e=>H(e));n.push(...o);for(let e of o)i.add(e);let s=z(t,e.pruneRoot),c=a;for(;Yn(c,i)&&(r.push(c),i.add(c),c!==s);){let e=R(c);if(e===c||e===t||!e.startsWith(t+V))break;c=e}}return{skillDirs:n,emptyDirs:r}}function Zn(e){try{if(!_e(e).isDirectory())return!1;let t=G(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function Qn(e){let t=new Set,n=new Set;for(let r of Gn){let i=z(e,r.hostDir,`skills`);for(let e of Kn)t.add(z(i,e));let a=z(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=R(o);if(t===o||t===e||!t.startsWith(e+V))break;o=t}}return{skillDirs:t,emptyDirs:n}}function $n(e,t){let n=qn(e),r=Qn(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(Jn(n,e)&&Zn(e))try{K(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(Jn(n,e))try{Ce(e),a.push(e)}catch{}return a}function er(e){let t=qn(e),n=[];for(let e of g){let r=k[e];n.push({path:z(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of d)n.push({path:z(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function tr(e,t){let n=[];for(let r of er(e))if(r.bundleId===t)try{K(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 nr(e){return e!=null&&e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function rr(e,t=Date.now()){if(e===null)return`—`;let n=Le(e,t);return n===`unknown`?`—`:n}function ir(e){let t=R(e);return L(e)===`local`&&L(t)===`.ok`?R(t):L(e)===`.ok`?t:null}function ar(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`||t.status===`read-error`)return null;if(t.status===`unverified-owner`)return{directory:ir(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`&&w(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:T(n),command:n,isDesktop:nr(n)}}function or(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 sr=new Set([`running`,`desktop`,`foreign`,`unverified`]);function cr(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 lr(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function ur(e){return`${lr(e.server.usage)} | ${lr(e.ui?.usage??null)}`}function dr(e){return`${e.server.port===null?`—`:e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function fr(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??`—`,dr(e),ur(e),or(e),String(e.server.pid),rr(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=cr(or(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 pr(e={}){let t=e.discover??v,n=e.inspect??(e=>$(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??_,a=e.resolveUsage??y,o=await t(),s=[];for(let e of o){let t=n(e),r=ar(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:or(e)}));r(JSON.stringify(e,null,2));return}r(fr(e.all?s:s.filter(e=>sr.has(or(e)))))}function mr(){return new F(`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 pr({all:t.all===!0||e===`all`,json:t.json===!0})})}async function hr(e,t=oe()){let n=$(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=re(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500),redirect:`manual`});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function gr(e,t={}){return{targets:yr(e,t.isAlive??j)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}function _r(e){try{return h()}catch(t){e?.warn({err:t},`stop channel check skipped: ${t instanceof Error?t.message:String(t)}`);return}}async function vr(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??hr,o=e.logger??oe(),s=t(),c=gr(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 l=s.status===`alive`||s.status===`foreign-host`?s.lock.channel:void 0;if(e.force!==!0&&typeof l==`string`&&l.length>0){let t=e.selfChannel??_r(o);if(t!==void 0&&l!==t)return i(`Not stopping: the server at ${e.lockDir} belongs to ${m(l)}. Stop it from that app or its CLI, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,holderChannel:l,selfChannel:t,pids:c.targets.map(e=>e.pid)},`stop declined: server belongs to another channel`),{stopped:[],failed:[],hadTargets:!0,declined:{otherChannel:l}}}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 u=[],d=[];for(let e of c.targets)try{n(e.pid,`SIGTERM`),u.push(e)}catch(t){d.push({target:e,error:t instanceof Error?t.message:String(t)})}return u.length>0&&r(`Stopped: ${u.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:u.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:d.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),d.length>0&&i(`Failed to stop: ${d.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:u,failed:d,hadTargets:!0}}function yr(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}async function br(e,t=j){let n=await v(),r=null;for(let i of n){let n=$(i,`server`);if(yr(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function xr(e,t){let n=await vr({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function Sr(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 Cr(e){let t=await v(),n=0;for(let r of t)r!==e&&yr($(r,`server`),j)&&n++;return n}function wr(e){return new F(`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=x(process.cwd()),n=await vr({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 Cr(t);console.log(Sr(process.cwd(),e,{listingFollows:e>0})),e>0&&await pr({})}return}if(i===`all`){let e=await v();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)yr($(n,`server`),j)&&(await xr(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 br(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await xr(t,r);return}let a=B(He(),i),o=x(a),s=[],c=await vr({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(Sr(a,await Cr(o)))})}export{He as A,ot as C,We as D,Ge as E,ze as M,qe as O,Y as S,Ue as T,$ as _,$n as a,An as b,er as c,Rn as d,zn as f,Pn as g,In as h,mr as i,Ve as j,Je as k,Ln as l,Un as m,vr as n,Xn as o,Hn as p,wr as r,tr as s,hr as t,Wn as u,Nn as v,Xe as w,st as x,kn as y};
|
package/dist/src-DiThsiBM.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./md-manager-BGnqyqi1-BTvqIsKE.mjs";import"./src-BMeBtbpm.mjs";import"./init-BQde4e6O.mjs";import"./registry-probes-BFfz79lC.mjs";import"./start-zogYNkil.mjs";import{n as e}from"./loader-DOgf-WE1.mjs";import"./preview-Bkx0CUMs.mjs";import"./repair-mcp-configs-CwXY6Ktb.mjs";export{e as loadConfig};
|
package/dist/start-CttrF1NF.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,m as t,p as n,r}from"./start-zogYNkil.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
|