@inkeep/open-knowledge 0.36.0-beta.16 → 0.36.0-beta.18
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/{acp-harness-probe-DzzmnVA9.mjs → acp-harness-probe-DtDd2u6r.mjs} +2 -2
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/cli.mjs +14 -14
- package/dist/constants-q91ejZ7-.mjs +2 -0
- package/dist/git-handle-CLfKANP-.mjs +1 -0
- package/dist/{git-handle-YAE9YR9Q.mjs → git-handle-DJkXvQyT.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/init-BLU-WorV.mjs +1 -0
- package/dist/{init-Du1ej_je.mjs → init-COsFMQjY.mjs} +4 -4
- package/dist/{launch-json-removal-Co2Hh8Vw.mjs → launch-json-removal-BROlk022.mjs} +2 -2
- package/dist/loader-BJ9NUALr.mjs +1 -0
- package/dist/{loader-BahUa-3b.mjs → loader-RxK4JpJU.mjs} +2 -2
- package/dist/{open-browser-DCvMiuE2.mjs → open-browser-D5VB75t8.mjs} +2 -2
- package/dist/{preview-BYw1WeBG.mjs → preview-CeY3lUbe.mjs} +2 -2
- package/dist/preview-fkAWAOui.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-qrbfN_hT.js → ActivityModeContent-7Ju1D07l.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-Cvfawhbk.js → AgentDiffPane-Cub6qbMY.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-bJx9SPAk.js → AgentThreadClientBinder-DxlNn6Mx.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-FVyKUYn4.js → CodeMirrorPropInput-CJY8KWEi.js} +1 -1
- package/dist/public/assets/{DocumentContext-CqohW6HK.js → DocumentContext-D3kF9wYA.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-CcgSvQ6A.js → EnableSyncConfirmDialog-idXXn7xs.js} +1 -1
- package/dist/public/assets/{FeedbackForm-DBvah19I.js → FeedbackForm-27jX0dcM.js} +1 -1
- package/dist/public/assets/{GraphPanel-Mjv-X5q3.js → GraphPanel-BRaW5AJ8.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-Bo2SKCvD.js → ManagedArtifactProperties-BanX7mdQ.js} +1 -1
- package/dist/public/assets/{McpConsentDialogBody-CHwk8X9A.js → McpConsentDialogBody-BniZeIL7.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-Lc_wkeTk.js → MermaidDocEditor-F8DqjnE9.js} +1 -1
- package/dist/public/assets/{PropertyPanel-CWk7Owsh.js → PropertyPanel-OEo2jkx9.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-CK-DnyaL.js → ReportBugDialogBody-BVYXAdHq.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-ze-PiYXj.js → SettingsDialogBody-DpIAa7tb.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-DpaA3c73.js → ShareBranchSwitchDialog-C1OUzjdZ.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-YFTm0V7j.js → ShareReceiveDialog-CzPBYHjM.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-BKohygIN.js → ShareReceiveMissDialog-jeMWaW7-.js} +1 -1
- package/dist/public/assets/{SkillEditorActions-NFgoTzth.js → SkillEditorActions-DOGSkeW2.js} +1 -1
- package/dist/public/assets/{SourceEditor-SkmtOPTX.js → SourceEditor-0PsKl2po.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Cnb9VX0H.js → TerminalPanel-BOvBHivU.js} +1 -1
- package/dist/public/assets/{TerminalSessionsHost-CvmeW7ge.js → TerminalSessionsHost-D3GT5F61.js} +2 -2
- package/dist/public/assets/{TerminalWindowApp-ffE-YlAF.js → TerminalWindowApp-DumSTDXA.js} +1 -1
- package/dist/public/assets/{ThreadView-CPK3cy1g.js → ThreadView-BHMbeBxX.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-C0-96_f4.js → TimelineDiffPane-BdGwBcWi.js} +1 -1
- package/dist/public/assets/{agent-diff-store-FqhWnB1D.js → agent-diff-store-ioTKnrp1.js} +1 -1
- package/dist/public/assets/{agent-visibility-DBtc7Shk.js → agent-visibility-DUG3FocN.js} +1 -1
- package/dist/public/assets/{auth-state-cache-B1bVTqEC.js → auth-state-cache-D3_VBPHk.js} +1 -1
- package/dist/public/assets/{client-version-CQymDMCB.js → client-version-CTfq7LXl.js} +1 -1
- package/dist/public/assets/{config-provider-DI7r73Nd.js → config-provider-B-7_o96p.js} +1 -1
- package/dist/public/assets/{dist-BkWgKwL8.js → dist-Bk124lrj.js} +127 -127
- package/dist/public/assets/{dist-DxFAhXtF.js → dist-Zzd2nZxv.js} +1 -1
- package/dist/public/assets/{doc-hash-C2yzLzvC.js → doc-hash-_aupPB7B.js} +1 -1
- package/dist/public/assets/{documents-events-DFEJCEAH.js → documents-events-D-zJruLR.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-DsS-GlIJ.js → file-tree-adapter-DcNETY_g.js} +1 -1
- package/dist/public/assets/{index-DfsjrLRd.js → index-CFRDunzS.js} +8 -8
- package/dist/public/assets/{keyboard-shortcuts-BGMZ9cie.js → keyboard-shortcuts-DxVjq-52.js} +1 -1
- package/dist/public/assets/{lint-config-client-CZn0-gAF.js → lint-config-client-BWBjtL6r.js} +1 -1
- package/dist/public/assets/{navigation-targets-Cpyiq5H8.js → navigation-targets-DhBfisfD.js} +1 -1
- package/dist/public/assets/{open-managed-artifact-tab-CQh16KDe.js → open-managed-artifact-tab-n1dyNhLH.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-DqtCdodL.js → pending-receive-nav-store-DMPvyqg1.js} +1 -1
- package/dist/public/assets/{prop-types-RdE5afNb.js → prop-types-75t_SaGz.js} +1 -1
- package/dist/public/assets/{receive-store-Ee26DxGG.js → receive-store-Birqy1T9.js} +1 -1
- package/dist/public/assets/{selection-context-CMx7CxBa.js → selection-context-BtAV4KL_.js} +1 -1
- package/dist/public/assets/{skill-actions-CQXOnr4t.js → skill-actions-BcObxQjV.js} +1 -1
- package/dist/public/assets/{skills-api-C96PbajH.js → skills-api-PvJ_IOtz.js} +1 -1
- package/dist/public/assets/{src-Cagh2-BH.js → src-CTFg8_9J.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-DzipyQZ8.js → target-navigation-intent-BeK3bA-h.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-Bl2a7__w.js → terminal-launch-events-DhHDzRBy.js} +1 -1
- package/dist/public/assets/{terminal-telemetry-CVI6nvoX.js → terminal-telemetry-BK9o_BV3.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-BrJ0HHfX.js → typing-burst-detector-CXmCEdH9.js} +1 -1
- package/dist/public/assets/{use-activity-panel-D9QIVAJd.js → use-activity-panel-ylq6PWCA.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-C5vmf6FI.js → use-apply-config-color-theme-CT1gUeuw.js} +1 -1
- package/dist/public/assets/{use-collab-url-Cxq57E64.js → use-collab-url-DO9Z6k14.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-BPIU0Cdf.js → use-live-xterm-theme-D-qXKY6i.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-ZRX9c0vL.js → use-terminal-enabled-BQn-DIW1.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-oV4K3ZWd.js → use-timeline-entry-diff-DJJrq2j4.js} +1 -1
- package/dist/public/assets/{use-workspace-DARs7MLm.js → use-workspace-BRK6bndk.js} +1 -1
- package/dist/public/assets/{workspace-paths-CVu5q0EP.js → workspace-paths-BaMTcn1O.js} +1 -1
- package/dist/public/assets/{zod-D8hNdqFI.js → zod-dP0-6rtx.js} +1 -1
- package/dist/public/index.html +35 -35
- package/dist/{repair-launch-json-BTMqUbuK.mjs → repair-launch-json-O2wT2hWm.mjs} +2 -2
- package/dist/{repair-mcp-configs-DDFw8jyo.mjs → repair-mcp-configs-BAPHGYKS.mjs} +2 -2
- package/dist/repair-skills-CLnEB5DY.mjs +1 -0
- package/dist/{repair-skills-Ds2IYnpp.mjs → repair-skills-CNHotj-z.mjs} +2 -2
- package/dist/server-lock-BECLNx_T.mjs +1 -0
- package/dist/server-lock-CZUtoKxB.mjs +2 -0
- package/dist/src-BG_IUe5R.mjs +3262 -0
- package/dist/{src-DgWjvSDo.mjs → src-DEZ0AEqj.mjs} +4 -4
- package/dist/{src-Cus5RnL8.mjs → src-DTPLCYnP.mjs} +77 -77
- package/dist/{src-BI0dWmz0.mjs → src-VjJUBnUL.mjs} +1 -1
- package/dist/start-BR23L7tq.mjs +1 -0
- package/dist/start-COR_P6jO.mjs +3 -0
- package/dist/{write-project-skill-Ct6JxGJ6.mjs → write-project-skill-thWIVGxh.mjs} +4 -4
- package/package.json +5 -5
- package/dist/constants-DMEiZNZI.mjs +0 -2
- package/dist/git-handle-ip9_uwkn.mjs +0 -1
- package/dist/init-DC_diOY8.mjs +0 -1
- package/dist/loader-iNgaaI6Q.mjs +0 -1
- package/dist/preview-Cg9TMkgu.mjs +0 -1
- package/dist/repair-skills-CuU6zHmH.mjs +0 -1
- package/dist/server-lock-0xVm4FnC.mjs +0 -2
- package/dist/server-lock-CTzXqyfA.mjs +0 -1
- package/dist/src-CZe5oBcp.mjs +0 -3262
- package/dist/start-DKzs2lPa.mjs +0 -3
- package/dist/start-DsChVTte.mjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DTipWd-i.mjs";import{F as t,I as n,
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{F as t,I as n,la as r}from"./src-DTPLCYnP.mjs";import{Er as i,Nr as a,it as o,ma as s,nt as c,rn as l,rt as u,tt as d}from"./src-BG_IUe5R.mjs";import{U as f}from"./sleep-DcENuR74.mjs";import{O as p,P as m}from"./fs-traced-BISd_YTv.mjs";import{S as h,u as g,v as _,x as v}from"./server-lock-CZUtoKxB.mjs";import{t as y}from"./yazl-DZr4PyKA.mjs";import{C as b,d as x,i as S,v as ee,y as C}from"./write-project-skill-thWIVGxh.mjs";import"./acp-harness-probe-DtDd2u6r.mjs";import{E as te,S as ne,T as re,_ as w,b as T,o as ie,v as ae,w as E}from"./init-COsFMQjY.mjs";import{n as oe}from"./constants-q91ejZ7-.mjs";import{t as D}from"./is-object-DKopTkoU.mjs";import"./loader-RxK4JpJU.mjs";import{c as O}from"./colors-BslXS0bZ.mjs";import"./preview-CeY3lUbe.mjs";import{execSync as se,spawnSync as ce}from"node:child_process";import{basename as k,dirname as A,isAbsolute as j,join as M,relative as le,resolve as N,sep as ue}from"node:path";import{cpSync as de,createWriteStream as fe,existsSync as P,lstatSync as pe,mkdirSync as F,mkdtempSync as me,readFileSync as I,readdirSync as he,readlinkSync as ge,rmSync as _e,statSync as ve,writeFileSync as L}from"node:fs";import{arch as ye,freemem as be,homedir as xe,hostname as Se,platform as Ce,release as we,tmpdir as Te,totalmem as Ee,type as De,uptime as Oe}from"node:os";import{realpath as R}from"node:fs/promises";import{createHash as z}from"node:crypto";const ke=[{name:`macos-home-path`,regex:/\/Users\/[^/]+\//g,replacement:`~/`},{name:`linux-home-path`,regex:/\/home\/[^/]+\//g,replacement:`~/`},{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)\S+/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@]+:[^/\s:@]+@/g,replacement:`://[REDACTED]@`}],Ae=ke.map(e=>e.name);function B(e){let t=new Set,n=0;return{redacted:e.split(`
|
|
2
2
|
`).map(e=>{let r=e;for(let{name:e,regex:i,replacement:a}of ke)i.lastIndex=0,i.test(r)&&(t.add(e),n++,i.lastIndex=0,r=r.replace(i,a));return r}).join(`
|
|
3
|
-
`),patterns:[...t],lineCount:n}}function je(){return M(xe(),`.ok`,`bug-reports`)}function Me(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`);return M(je(),`${t}-bugreport.zip`)}function Ne(e,t){let n=M(e,`.ok`,`config.yml`);if(P(n))try{let e=I(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e
|
|
3
|
+
`),patterns:[...t],lineCount:n}}function je(){return M(xe(),`.ok`,`bug-reports`)}function Me(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`);return M(je(),`${t}-bugreport.zip`)}function Ne(e,t){let n=M(e,`.ok`,`config.yml`);if(P(n))try{let e=I(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 P(M(e,`.ok`))?z(`sha256`).update(N(e)).digest(`hex`).slice(0,12):null}function Pe(){let e={timestamp:new Date().toISOString(),platform:Ce(),osType:De(),osRelease:we(),hostname:`[redacted]`,uptime:Oe(),freeMem:be(),totalMem:Ee(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=se(`sw_vers -productVersion 2>/dev/null`,a({encoding:`utf8`})).trim()}catch{}try{let t=M(__dirname,`..`,`..`,`package.json`);P(t)&&(e.okVersion=JSON.parse(I(t,`utf8`)).version)}catch{}return e}function Fe(e,t){if(!P(t))return{files:[]};let n=he(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>M(t,e));if(e&&n.length>0){let t=n.filter(t=>{try{return I(t,`utf8`).includes(`"project":"${e}"`)}catch{return!0}});t.length>0&&(n=t)}return{files:n}}function Ie(e){let n=M(e,`.ok`,`local`);return P(n)?{files:[`server.lock`,`last-spawn-error.log`,t].map(e=>M(n,e)).filter(e=>P(e))}:{files:[]}}function Le(e){let t=M(e,`.ok`,`local`,`logs`);return P(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>M(t,e)).filter(e=>P(e))}:{files:[]}}function Re(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=B(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function V(e){for(let t of e.files)try{Re({zipfile:e.zipfile,name:`${e.prefix}/${k(t)}`,content:I(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function ze(t){let{redact:n,outputPath:r,logger:i}=t,a=t.userLogsDir??M(xe(),`.ok`,`logs`),o=t.projectDir?Ne(t.projectDir,i):null;F(A(r),{recursive:!0}),i?.info({projectSlug:o},`gathering diagnostic data`);let s=Pe();s.desktop=t.desktop??null;let{files:c}=Fe(o,a),{files:l}=t.projectDir?Ie(t.projectDir):{files:[]},{files:u}=t.projectDir?Le(t.projectDir):{files:[]};i?.info({logFileCount:c.length,lockFileCount:l.length,localSinkFileCount:u.length},`files collected`);let d=[],f=[],{ZipFile:p}=await import(`./yazl-jVENrf5i.mjs`).then(t=>e(t.default,1)),m=new p;V({zipfile:m,files:c,prefix:`logs`,redact:n,bundleFiles:f,redactions:d,logger:i}),V({zipfile:m,files:l,prefix:`lockdir`,redact:n,bundleFiles:f,redactions:d,logger:i}),V({zipfile:m,files:u,prefix:`local-logs`,redact:n,bundleFiles:f,redactions:d,logger:i});for(let e of t.extraFiles??[])try{let t=I(e.sourcePath),n=`extra/${e.zipName??k(e.sourcePath)}`;m.addBuffer(t,n),f.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Re({zipfile:m,name:`note.txt`,content:t.note,redact:n,bundleFiles:f,redactions:d});let h=JSON.stringify(s,null,2);m.addBuffer(Buffer.from(h,`utf8`),`sysinfo.json`),f.push(`sysinfo.json`);let g={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:o,files:f,redactions:d,sysinfo:s};m.addBuffer(Buffer.from(JSON.stringify(g,null,2),`utf8`),`MANIFEST.json`);let _=d.reduce((e,t)=>e+t.lineCount,0),v=[`# Bug Report Bundle`,``,`Generated: ${g.generatedAt}`,`Project: ${o??`(unscoped)`}`,`Discipline version: ${g.disciplineVersion}`,``,`## Contents`,``,...f.map(e=>`- ${e}`),``,`## Privacy`,``,...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${Ae.join(`, `)}`,_>0?`${_} line(s) were scrubbed across ${d.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
|
|
4
4
|
`);m.addBuffer(Buffer.from(v,`utf8`),`README.md`),m.end();let y=fe(r);return m.outputStream.pipe(y),await new Promise((e,t)=>{y.on(`close`,e),y.on(`error`,t)}),i?.info({bundlePath:r,fileCount:f.length,redactionCount:_},`bundle written`),{zipPath:r,summary:{projectSlug:o,files:f,redactions:d,redactedLineCount:_,generatedAt:g.generatedAt}}}var H=f(),Be=e(y(),1);const Ve=new Set([`doc.name`,`currentDoc`]);function He(e){return`doc:${z(`sha256`).update(e).digest(`hex`).slice(0,8)}`}function Ue(e,t,n){let r=e.docNameMap[n];if(r===void 0){e.docNameMap[n]=t;return}if(r===t)return;let i=e.docNameCollisions[n];i?i.includes(t)||i.push(t):e.docNameCollisions[n]=[t]}function We(e,t){let n=t.originalToHashed.get(e);if(n!==void 0)return n;let r=He(e);return t.originalToHashed.set(e,r),Ue(t,e,r),r}function U(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function W(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G(e,t){if(typeof e==`string`)return U(e,t.contentDir);if(Array.isArray(e))return e.map(e=>G(e,t));if(!W(e))return e;let n=typeof e.key==`string`&&Ve.has(e.key)&&W(e.value)&&typeof e.value.stringValue==`string`?e.value.stringValue:null,r={};for(let[i,a]of Object.entries(e))if(n!==null&&i===`value`&&W(a)){let e=We(n,t);r[i]={...a,stringValue:e}}else Ve.has(i)&&typeof a==`string`?r[i]=We(a,t):r[i]=G(a,t);return r}function Ge(e,t){if(t.originalToHashed.size===0)return e;let n=Array.from(t.originalToHashed.entries()).sort(([e],[t])=>t.length-e.length),r=e;for(let[e,t]of n)e.length!==0&&r.includes(e)&&(r=r.split(e).join(t));return r}function Ke(e,t){let n=I(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
5
5
|
`),i=n.split(`
|
|
6
6
|
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=G(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}L(e,r?`${a.join(`
|
|
@@ -9,7 +9,7 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{F as t,I as n,sa as r}from"./src
|
|
|
9
9
|
`)?`
|
|
10
10
|
`:``;L(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=Ge(U(n,t.contentDir),t);r!==n&&L(e,r)}}function Je(e,t){let n=I(e,`utf-8`),r=U(n,t.contentDir);r!==n&&L(e,r)}function Ye(e){try{return he(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>M(e,t.name))}catch{return[]}}const Xe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function Ze(e){let t={contentDir:e.contentDir,docNameMap:{},originalToHashed:new Map,docNameCollisions:{}};for(let n of[`telemetry`,`logs`,`process`])for(let r of Ye(M(e.stagingDir,n)))r.endsWith(`.jsonl`)?Ke(r,t):r.endsWith(`.json`)?qe(r,t):Je(r,t);for(let n of Ye(M(e.stagingDir,`state`))){let e=k(n);n.endsWith(`.jsonl`)?Ke(n,t):Xe.has(e)?qe(n,t):Je(n,t)}return{docNameMap:t.docNameMap,docNameCollisions:t.docNameCollisions}}const Qe=[`.ok`,`local`,`telemetry`],$e=[`.ok`,`local`,`logs`],et=`spans-current.jsonl`,tt=`spans-prev.jsonl`,nt=`server-current.jsonl`,rt=`server-prev.jsonl`;function it(e){return M(e,...Qe,et)}function at(e){return M(e,...Qe,tt)}function ot(e){return M(e,...$e,nt)}function st(e){return M(e,...$e,rt)}const ct=1e3;async function lt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(ct)});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(ct)});return t.ok?await t.text():null}catch{return null}}async function dt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(ct)});return t.ok?await t.text():null}catch{return null}}function ft(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
|
|
11
11
|
`)}\n`:null}catch{return null}}function pt(e){let t=M(e,`.git`,`ok`);if(!P(t))return null;let n=ce(`git`,[`-C`,t,`log`,`--oneline`,`-50`],a({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function mt(e){let t=M(e,`.git`,`ok`);if(!P(t))return null;let n=ce(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],a({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function ht(){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 gt(){return{nodeVersion:process.version,platform:Ce(),arch:ye()}}function _t(){return process.env.OTEL_SDK_DISABLED===`false`}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function vt(e){if(!P(e))return{};let t;try{t=(0,H.parse)(I(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(!K(t))return{};let n=t.telemetry;if(!K(n))return{};let r=n.localSink;return K(r)?r:{}}function yt(e){return typeof e==`boolean`?e:void 0}function bt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function q(e){if(K(e))return bt(e.maxBytes)}function xt(e){let t=vt(p(`project`,e)),n=vt(p(`project-local`,e));return{enabled:yt(n.enabled)??yt(t.enabled)??!0,spansMaxBytes:q(n.spans)??q(t.spans)??52428800,logsMaxBytes:q(n.logs)??q(t.logs)??26214400}}function St(e){return z(`sha256`).update(e).digest(`hex`)}function Ct(e){let t=I(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function wt(e){let t=I(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function J(e,t){return P(e)?(F(A(t),{recursive:!0}),de(e,t),!0):!1}function Y(e){let t=[],n=e=>{let r=he(e,{withFileTypes:!0});for(let i of r){let r=M(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Tt=new Set([`.jsonl`]);function Et(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Tt.has(e.slice(t))}const Dt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Ot(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Dt.has(e.slice(t))}function kt(e){let t=[];for(let n of Y(e)){let r=At(e,n);if(!Ot(r))continue;let{redacted:i,patterns:a,lineCount:o}=B(I(n,`utf-8`));a.length!==0&&(L(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function At(e,t){return le(e,t).split(ue).join(`/`)}async function jt(e){let r=N(e.contentDir),i=N(e.projectDir??e.contentDir),a=e.deps??{},o=a.fetchAgentPresence??lt,s=a.fetchAgentEffects??ut,c=a.fetchWatcherRecent??dt,l=a.readShadowHead??pt,u=a.readCheckpointRefs??mt,d=a.now??(()=>new Date),f=a.okVersion??(()=>oe),p=a.readDesktopEnv??ht,m=a.readRuntime??gt,h=a.isOtlpPushEnabled??_t,g=me(M(Te(),`ok-bundle-`));try{F(M(g,`telemetry`),{recursive:!0}),F(M(g,`logs`),{recursive:!0}),F(M(g,`state`),{recursive:!0}),J(it(i),M(g,`telemetry`,et)),J(at(i),M(g,`telemetry`,tt)),J(ot(i),M(g,`logs`,nt)),J(st(i),M(g,`logs`,rt));let _=M(i,`.ok`,`local`),v=M(_,`server.lock`),y=`not-running`,b=`no server.lock`,x=null;if(P(v)){J(v,M(g,`state`,`server.lock`));try{let e=I(v,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?x=t.port:b=`lock present but no port`}catch{b=`lock present but unparseable`}}if(x!==null){let e=await o(x);e===null?b=`agent-presence endpoint at :${x} unreachable`:(L(M(g,`state`,`agent-presence.json`),e),y=`running`,b=``);let t=await s(x);t!==null&&L(M(g,`state`,`agent-effects.json`),t);let n=await c(x);if(n!==null){let e=ft(n);e!==null&&L(M(g,`state`,`watcher-recent.jsonl`),e)}}let S=l(r);S!==null&&L(M(g,`state`,`shadow-head.txt`),S);let ee=u(r);ee!==null&&L(M(g,`state`,`checkpoint-refs.txt`),ee),J(M(_,`last-spawn-error.log`),M(g,`state`,`last-spawn-error.log`)),J(M(_,n),M(g,`state`,n)),J(M(_,t),M(g,`state`,t));let C=m(),te=p(),ne={ok:{version:f(),nodeVersion:C.nodeVersion,platform:C.platform,arch:C.arch},host:{desktop:te}};L(M(g,`state`,`runtime.json`),`${JSON.stringify(ne,null,2)}\n`);let re=y===`running`?`running
|
|
12
|
-
`:`not-running (${b})\n`;if(L(M(g,`state`,`server-status.txt`),re),e.processDir&&P(e.processDir)){let t=M(g,`process`);F(t,{recursive:!0}),de(e.processDir,t,{recursive:!0})}let w=null;e.redact===!0&&(w=Ze({stagingDir:g,contentDir:r})),e.note&&L(M(g,`note.txt`),e.note);let T=null;e.scrubSecrets===!0&&(T=kt(g));for(let t of e.extraFiles??[])J(t.sourcePath,M(g,`extra`,t.zipName??k(t.sourcePath)))||a.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let ie=xt(i),ae=Y(g),E=[],oe=0,D=0;for(let e of ae){let t=At(g,e),n=ve(e).size,r=Et(t)?Ct(e):0;E.push({path:t,bytes:n,lines:r}),oe+=n,t.startsWith(`telemetry/`)&&Et(t)&&(D+=wt(e))}let O=w===null?{applied:!1,docNameMapSidecar:null}:Object.keys(w.docNameCollisions).length>0?{applied:!0,docNameMapSidecar:null,docNameCollisions:w.docNameCollisions}:{applied:!0,docNameMapSidecar:null};T!==null&&(O.secretScrub=T);let se={schemaVersion:1,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:C.nodeVersion,platform:C.platform,arch:C.arch},host:{desktop:te},contentDir:{pathSha256:St(r),absolutePath:w===null?r:`<CONTENT_DIR>`},telemetry:{localSink:ie,otlpPushEnabled:h()},redaction:O,serverStatus:y,files:E};L(M(g,`manifest.json`),`${JSON.stringify(se,null,2)}\n`);let ce=ae.some(e=>{try{return I(e,`utf-8`).includes(r)}catch{return!1}}),A={totalBytes:oe,fileCount:E.length,docNameCount:D,contentDirVisible:ce,redacted:w!==null},j=!1;return{stagingDir:g,manifest:se,summary:A,redactionMapPayload:w===null?null:{docNameMap:w.docNameMap,docNameCollisions:w.docNameCollisions},cleanup:()=>{j||(j=!0,_e(g,{recursive:!0,force:!0}))}}}catch(e){throw _e(g,{recursive:!0,force:!0}),e}}async function Mt(e){let{collected:t,outputPath:n}=e,r=A(n);if(!P(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);if(t.redactionMapPayload!==null){let e=`${k(n,`.zip`)}.docnames.json`,r={...t.manifest,redaction:{...t.manifest.redaction,applied:!0,docNameMapSidecar:e}};L(M(t.stagingDir,`manifest.json`),`${JSON.stringify(r,null,2)}\n`)}let i=new Be.ZipFile,a=Y(t.stagingDir);for(let e of a){let n=At(t.stagingDir,e);i.addFile(e,n)}i.end(),t.redactionMapPayload!==null&&L(M(r,`${k(n,`.zip`)}.docnames.json`),`${JSON.stringify({docNameMap:t.redactionMapPayload.docNameMap,docNameCollisions:t.redactionMapPayload.docNameCollisions},null,2)}\n`,{mode:384});let o=fe(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function Nt(e,t){let n=M(e,`.ok`,`config.yml`);if(P(n))try{let t=(0,H.parse)(I(n,`utf-8`)),r=D(t)?t.content:void 0,i=D(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return N(e,i)}catch(e){t?.warn({configPath:n,err:e
|
|
12
|
+
`:`not-running (${b})\n`;if(L(M(g,`state`,`server-status.txt`),re),e.processDir&&P(e.processDir)){let t=M(g,`process`);F(t,{recursive:!0}),de(e.processDir,t,{recursive:!0})}let w=null;e.redact===!0&&(w=Ze({stagingDir:g,contentDir:r})),e.note&&L(M(g,`note.txt`),e.note);let T=null;e.scrubSecrets===!0&&(T=kt(g));for(let t of e.extraFiles??[])J(t.sourcePath,M(g,`extra`,t.zipName??k(t.sourcePath)))||a.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let ie=xt(i),ae=Y(g),E=[],oe=0,D=0;for(let e of ae){let t=At(g,e),n=ve(e).size,r=Et(t)?Ct(e):0;E.push({path:t,bytes:n,lines:r}),oe+=n,t.startsWith(`telemetry/`)&&Et(t)&&(D+=wt(e))}let O=w===null?{applied:!1,docNameMapSidecar:null}:Object.keys(w.docNameCollisions).length>0?{applied:!0,docNameMapSidecar:null,docNameCollisions:w.docNameCollisions}:{applied:!0,docNameMapSidecar:null};T!==null&&(O.secretScrub=T);let se={schemaVersion:1,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:C.nodeVersion,platform:C.platform,arch:C.arch},host:{desktop:te},contentDir:{pathSha256:St(r),absolutePath:w===null?r:`<CONTENT_DIR>`},telemetry:{localSink:ie,otlpPushEnabled:h()},redaction:O,serverStatus:y,files:E};L(M(g,`manifest.json`),`${JSON.stringify(se,null,2)}\n`);let ce=ae.some(e=>{try{return I(e,`utf-8`).includes(r)}catch{return!1}}),A={totalBytes:oe,fileCount:E.length,docNameCount:D,contentDirVisible:ce,redacted:w!==null},j=!1;return{stagingDir:g,manifest:se,summary:A,redactionMapPayload:w===null?null:{docNameMap:w.docNameMap,docNameCollisions:w.docNameCollisions},cleanup:()=>{j||(j=!0,_e(g,{recursive:!0,force:!0}))}}}catch(e){throw _e(g,{recursive:!0,force:!0}),e}}async function Mt(e){let{collected:t,outputPath:n}=e,r=A(n);if(!P(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);if(t.redactionMapPayload!==null){let e=`${k(n,`.zip`)}.docnames.json`,r={...t.manifest,redaction:{...t.manifest.redaction,applied:!0,docNameMapSidecar:e}};L(M(t.stagingDir,`manifest.json`),`${JSON.stringify(r,null,2)}\n`)}let i=new Be.ZipFile,a=Y(t.stagingDir);for(let e of a){let n=At(t.stagingDir,e);i.addFile(e,n)}i.end(),t.redactionMapPayload!==null&&L(M(r,`${k(n,`.zip`)}.docnames.json`),`${JSON.stringify({docNameMap:t.redactionMapPayload.docNameMap,docNameCollisions:t.redactionMapPayload.docNameCollisions},null,2)}\n`,{mode:384});let o=fe(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function Nt(e,t){let n=M(e,`.ok`,`config.yml`);if(P(n))try{let t=(0,H.parse)(I(n,`utf-8`)),r=D(t)?t.content:void 0,i=D(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return N(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 N(e)}async function Pt(e,t,n){let r=await jt({contentDir:Nt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,deps:{readDesktopEnv:n,logger:e.logger}});try{F(A(e.outputPath),{recursive:!0}),await Mt({collected:r,outputPath:e.outputPath});let n=r.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:Ne(t,e.logger),files:r.manifest.files.map(e=>e.path),redactions:n?.redactions??[],redactedLineCount:n?.redactedLineCount??0,generatedAt:r.manifest.createdAt}}}finally{r.cleanup()}}async function Ft(e){let{projectDir:t}=e,n=e.readDesktopEnv??ht;if(e.level===`full`&&t!==void 0)return Pt(e,t,n);let{zipPath:r,summary:i}=await ze({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n()});return{zipPath:r,summary:{level:e.level,systemWide:t===void 0,projectSlug:i.projectSlug,files:i.files,redactions:i.redactions,redactedLineCount:i.redactedLineCount,generatedAt:i.generatedAt}}}function X(e,t,n={}){let r=g(e,t);if(!P(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(I(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!h(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??v)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??_())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??Se();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function It(e){return e.replace(/:\d+$/,``)}function Lt(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:It(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:It(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:It(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function Rt(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=r(t.hostname);if(n===null)return null;let i=t.pathname.split(`/`).filter(e=>e.length>0);if(i.length<5||i[2]!==`blob`)return null;let a,o,s,c;try{a=decodeURIComponent(i[0]),o=decodeURIComponent(i[1]),s=decodeURIComponent(i[3]),c=i.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.length===0||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function zt(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=r(t.hostname);if(n===null)return null;let i=t.pathname.split(`/`);if(i.length<5||i[0]!==``||i[3]!==`tree`)return null;let a=i.slice(5);a.length===1&&a[0]===``&&a.pop();let o,s,c,l;try{o=decodeURIComponent(i[1]),s=decodeURIComponent(i[2]),c=decodeURIComponent(i[4]),l=a.map(e=>decodeURIComponent(e))}catch{return null}return!o||!s||!c||l.some(e=>e.length===0)?null:{host:n,owner:o,repo:s,branch:c,path:l.join(`/`)}}function Bt(e){let t=Rt(e);if(t)return{kind:`doc`,...t};let n=zt(e);return n?{kind:`folder`,...n}:null}var Z=e(O(),1);const Vt=`# >>> open-knowledge cli >>>`,Ht=`# <<< open-knowledge cli <<<`,Ut=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Wt(e){return M(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const Gt={existsSync:e=>P(e),readFileSync:(e,t)=>I(e,t),lstatSync:e=>pe(e),readlinkSync:e=>ge(e)};function Kt(e,t=Gt){let n=Wt(e);if(!t.existsSync(n))return null;try{let e=JSON.parse(t.readFileSync(n,`utf8`));return e?.version===1?e:null}catch{return null}}function qt(e){let t=e.replace(Ut,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function Jt(e,t,n=Gt){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function Yt(e){return ee(e)||C(e)||ne(e)}const Xt=10*1024*1024;function Zt(e,t,n,r){let i=ie(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!Yt(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);return e.format===`file`?(_e(a,{force:!0}),{kind:`removed`}):e.format===`toml`?en(a,o):e.format===`yaml`?$t(a,e.topLevelKey,o):Qt(a,e.topLevelKey,e.serverMapSubKey,o)}function Qt(e,t,n,r){let i;try{i=I(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>Xt)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=te(i,w(t,n,r));return o?(m(e,a,{mode:E(e)}),{kind:`removed`}):{kind:`not-present`}}function $t(e,t,n){let r;try{r=I(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>Xt)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,H.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=re(a);a.trim()===``||a.endsWith(`
|
|
13
13
|
`)?c.endsWith(`
|
|
14
14
|
`)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
|
|
15
15
|
`).replace(/\n/g,`\r
|
|
@@ -19,4 +19,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{F as t,I as n,sa as r}from"./src
|
|
|
19
19
|
`).replace(/\n/g,`\r
|
|
20
20
|
`));let u=`${i?``:``}${l}`;return u!==r&&m(e,u,{mode:E(e)}),{kind:`removed`}}const tn=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function nn(e,t,n=l){if(e!==void 0&&!tn.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let rn=null;function an(e){rn=e}function on(){return rn??process.cwd()}function sn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function cn(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function ln(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:c(r),command:r,isDesktop:sn(r)}}function un(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&un(e)?`ui-orphan`:`stale`}const dn=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function fn(e){switch(e){case`running`:return Z.default.green(e);case`desktop`:return Z.default.blue(e);case`foreign`:return Z.default.cyan(e);case`ui-orphan`:return Z.default.magenta(e);case`stale`:return Z.default.yellow(e)}}function pn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function mn(e){return`${pn(e.server.usage)} | ${pn(e.ui?.usage??null)}`}function hn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function gn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=Q(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,hn(e),mn(e),t,String(n),cn(e.server.startedAt),e.binary??`—`]}),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=fn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=Z.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
21
21
|
`)}async function _n(e={}){let t=e.discover??d,n=e.inspect??X,r=e.log??(e=>console.log(e)),i=e.resolveCommand??u,a=e.resolveUsage??o,s=await t(),c=[];for(let e of s){let t=n(e,`server`),r=n(e,`ui`),o=ln(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&c.push(o)}if(e.json){let e=c.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(gn(e.all?c:c.filter(e=>dn.has(Q(e)))))}function vn(){return new b(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await _n({all:t.all===!0||e===`all`,json:t.json===!0})})}function yn(e,t,n={}){let r=n.isAlive??v,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function bn(e){let t=e.inspect??(t=>X(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=yn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function xn(e,t=v){let n=await d(),r=null;for(let i of n){let n=X(i,`server`),a=X(i,`ui`);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function Sn(e){let t=bn({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function Cn(e){return new b(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=bn({lockDir:i(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await _n({});return}if(n===`all`){let e=await d();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=X(n,`server`),r=X(n,`ui`);!$(e,v)&&!$(r,v)||(Sn(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await xn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}Sn(t);return}Sn(i(N(on(),n)))})}function wn(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}async function Tn(e,t){let n,i;try{n=await R(N(e)),i=await R(N(A(e)))}catch{return{kind:`not-git`}}if(!En(n,i))return{kind:`symlink-escape`};let a=M(n,`.git`),o;try{o=ve(a)}catch{return{kind:`not-git`}}if(o.isDirectory()){let e;try{e=await R(a)}catch{return{kind:`not-git`}}if(!En(e,n))return{kind:`symlink-escape`}}else if(!o.isFile())return{kind:`not-git`};let c=s(n);if(c.kind!==`repository`)return{kind:`not-git`};let l=c.repository.readRemoteUrl(`origin`);if(l.kind===`unreadable`)return{kind:`not-git`};if(l.kind===`absent`)return l.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let u=l.url,d=Lt(u);if(d===null)return{kind:`non-github`};let f=r(d.hostname);if(f===null)return{kind:`non-github`};let p=f===t.host.toLowerCase(),m=d.owner.toLowerCase()===t.owner.toLowerCase(),h=d.name.toLowerCase()===t.repo.toLowerCase();return!p&&m&&h?{kind:`wrong-host`,actualHost:f}:!p||!m||!h?{kind:`wrong-repo`,actualOwner:d.owner,actualRepo:d.name}:{kind:`ok`,gitRemoteUrl:`https://${f}/${d.owner}/${d.name}.git`}}function En(e,t){if(e===t)return!0;let n=le(t,e);return n.length>0&&!n.startsWith(`..`)&&!j(n)}const Dn=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=ae(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=S(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function On(e,t,n={},r=Dn){let i=[];for(let a of t){let t=x[a];for(let a of r)i.push(a.write(t,e,n))}return i}function kn(e,t,n={}){return{integrations:On(e,t,n)}}export{Ft as C,B as D,Me as E,X as S,Mt as T,qt as _,Cn as a,zt as b,an as c,Vt as d,Ut as f,Kt as g,Wt as h,bn as i,nn as l,Jt as m,Tn as n,vn as o,Ht as p,wn as r,on as s,kn as t,Zt as u,Rt as v,jt as w,Lt as x,Bt as y};
|
|
22
|
-
//# sourceMappingURL=src-
|
|
22
|
+
//# sourceMappingURL=src-DEZ0AEqj.mjs.map
|