@inkeep/open-knowledge 0.42.0-beta.4 → 0.42.0-beta.6
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-ChUiXq4Y.mjs → acp-harness-probe-BZ0o8z0h.mjs} +2 -2
- package/dist/assets/skills/discovery/SKILL.md +1 -1
- package/dist/assets/skills/project/SKILL.md +1 -1
- package/dist/assets/skills/write-skill/SKILL.md +1 -1
- package/dist/cli.mjs +50 -50
- package/dist/constants-Co6lMb8A.mjs +2 -0
- package/dist/git-handle-Ceb067pB.mjs +1 -0
- package/dist/{git-handle-BFhoHYr0.mjs → git-handle-CnUwtybc.mjs} +2 -2
- package/dist/index.mjs +1 -1
- package/dist/{init-o3oVQbkm.mjs → init-CIcmWJHm.mjs} +4 -4
- package/dist/init-CSCfjLot.mjs +1 -0
- package/dist/{launch-json-removal-5A8Lrjdh.mjs → launch-json-removal-CMm87muK.mjs} +2 -2
- package/dist/loader-BQ-vpXns.mjs +1 -0
- package/dist/{loader-b0Jnp3-m.mjs → loader-C-Kifx5i.mjs} +2 -2
- package/dist/md-manager-BrzjirTk.mjs +2 -0
- package/dist/{open-browser-Be1y1t9d.mjs → open-browser-Dx055WwC.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/preview-0WFzw7t-.mjs +1 -0
- package/dist/{preview-Zqg7QABJ.mjs → preview-CqGqHfYb.mjs} +2 -2
- package/dist/public/assets/{ActivityModeContent-CnhDNi-c.js → ActivityModeContent-BcKeq4GS.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-BKvov9S5.js → AgentDiffPane-B1lhqYoG.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-MaSL3zla.js → AgentThreadClientBinder-D_mhB_uV.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-ZGACWLSy.js → CodeMirrorPropInput-C-g_G-yI.js} +1 -1
- package/dist/public/assets/{DocumentContext-DDkluS7D.js → DocumentContext-B8Qoku71.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-D0Db8Ydu.js → EditorModeToggle-iEGu97y7.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-B2sHRtLY.js → EnableSyncConfirmDialog-BQeXrhKR.js} +1 -1
- package/dist/public/assets/FeedbackForm-Ktf4zBow.js +1 -0
- package/dist/public/assets/{LintConfigEditor-DKgxJcvl.js → LintConfigEditor-BxLAEyqV.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-9e_jj3hZ.js → ManagedArtifactProperties-DqMRN999.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-BNURUYJE.js → MermaidDocEditor-C4auOYmp.js} +1 -1
- package/dist/public/assets/{PropertyPanel-BMIcO_AS.js → PropertyPanel-CnMICYok.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-ByMe7BRT.js → ReportBugDialogBody-C3LwtOik.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-D7xbhgl6.js → SchemaConfigEditor-ClGpXOLw.js} +1 -1
- package/dist/public/assets/{SettingsDialogBody-Bkz3Bpgp.js → SettingsDialogBody-B3ROt1pc.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-Ls1ECEge.js → ShareReceiveMissDialog-CYziYLGf.js} +1 -1
- package/dist/public/assets/{SourceEditor-DI6JkRTr.js → SourceEditor-CjeWll93.js} +1 -1
- package/dist/public/assets/{TerminalSessionsHost-B2cWbpj-.js → TerminalSessionsHost-C5nl_yCS.js} +2 -2
- package/dist/public/assets/{TerminalWindowApp-2yCXBcQc.js → TerminalWindowApp-CXPQgo_F.js} +1 -1
- package/dist/public/assets/ThreadView-CNhxTZUD.js +6 -0
- package/dist/public/assets/{TimelineDiffPane-B9KqEt7q.js → TimelineDiffPane-0-oB0HJO.js} +1 -1
- package/dist/public/assets/{auth-state-cache-BUVYaS5m.js → auth-state-cache-BUB32hpt.js} +1 -1
- package/dist/public/assets/{client-version-FVbajnsJ.js → client-version-UZOTI_xc.js} +1 -1
- package/dist/public/assets/{config-provider-DIuwNlqX.js → config-provider-psmEp7UZ.js} +1 -1
- package/dist/public/assets/{globals-CXEWtNVL.js → globals-C6WpSvCs.js} +1 -1
- package/dist/public/assets/globals-DF_8aGgC.css +1 -0
- package/dist/public/assets/{index-Bh6-_Nba.js → index-fJdl7nfi.js} +7 -7
- package/dist/public/assets/{pending-receive-nav-store-BuGLGemz.js → pending-receive-nav-store-uQRZ6j0p.js} +1 -1
- package/dist/public/assets/{selection-context-zsjvL-8N.js → selection-context-CwFGy9Md.js} +1 -1
- package/dist/public/assets/{src-D8jPu2QV.js → src-dGfXUun_.js} +1 -1
- package/dist/public/assets/{telemetry-impl-DXiL3sBk.js → telemetry-impl-DgkEb_cY.js} +1 -1
- package/dist/public/assets/{telemetry-startup-Db44p95P.js → telemetry-startup-CQTiYCrs.js} +1 -1
- package/dist/public/assets/thread-client-CXDtD9Ce.js +1 -0
- package/dist/public/assets/{typing-burst-detector-BP7d86JP.js → typing-burst-detector-D7A5ERs3.js} +1 -1
- package/dist/public/assets/{uninstall-DHjtqCbn.js → uninstall-M1UiY2qw.js} +1 -1
- package/dist/public/assets/{use-activity-panel-35_3901z.js → use-activity-panel-gCh9MxRw.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-fhwpyN81.js → use-terminal-enabled-Dxvf3ewA.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CHWJnnz2.js → use-timeline-entry-diff-CShGJR_t.js} +1 -1
- package/dist/public/index.html +14 -14
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-4OYtLMnw.mjs → repair-launch-json-CcmcaUuj.mjs} +2 -2
- package/dist/{repair-mcp-configs-BLJJ9tZq.mjs → repair-mcp-configs-CtpjEM_k.mjs} +2 -2
- package/dist/repair-skills-CWDsNblG.mjs +1 -0
- package/dist/{repair-skills-CBmnNSO7.mjs → repair-skills-wN4Q8hDX.mjs} +2 -2
- package/dist/server-lock-CcpmJhRb.mjs +1 -0
- package/dist/{server-lock-vdpThyb4.mjs → server-lock-TC0vRJO5.mjs} +2 -2
- package/dist/{src-D5V8i8YL.mjs → src-BFng-ST-.mjs} +2 -2
- package/dist/{src-DtcKZLt0.mjs → src-C4HvLmg1.mjs} +84 -84
- package/dist/{src-o9XsfdYT.mjs → src-Cedat7Lt.mjs} +1 -1
- package/dist/src-ZTjj6Vbn.mjs +3267 -0
- package/dist/start-DZWMlGrL.mjs +1 -0
- package/dist/{start-9cYd5WRC.mjs → start-uUA5csNK.mjs} +2 -2
- package/dist/{write-project-skill-B_HecSEZ.mjs → write-project-skill-7eiqv4-L.mjs} +4 -4
- package/package.json +4 -4
- package/dist/constants-Do1hpvs-.mjs +0 -2
- package/dist/git-handle-CRnnMEIm.mjs +0 -1
- package/dist/init-BC0lVj9G.mjs +0 -1
- package/dist/loader-xZjZfXpn.mjs +0 -1
- package/dist/md-manager-CAqfesEA.mjs +0 -2
- package/dist/preview-Bi-j3iwm.mjs +0 -1
- package/dist/public/assets/FeedbackForm-DuEQbMOb.js +0 -1
- package/dist/public/assets/ThreadView-D2BFrI_O.js +0 -6
- package/dist/public/assets/globals-GYHxaktb.css +0 -1
- package/dist/public/assets/thread-client-CurKSSA8.js +0 -1
- package/dist/repair-skills-B1Zc-g_X.mjs +0 -1
- package/dist/server-lock-DKRUWCqU.mjs +0 -1
- package/dist/src-mOlBaMpr.mjs +0 -3267
- package/dist/start-JsQQrTQk.mjs +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./src-
|
|
2
|
-
//# sourceMappingURL=server-lock-
|
|
1
|
+
import"./src-C4HvLmg1.mjs";import{r as e}from"./logger-B7Z8XO-z.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s,readFileSync as c,unlinkSync as l,writeFileSync as u,writeSync as d}from"node:fs";import{homedir as f,hostname as p}from"node:os";import{fileURLToPath as m}from"node:url";import{randomUUID as h}from"node:crypto";function g(e){return new URL(e.url??``,`http://localhost`).searchParams}function _(e){let t=e?.code;return typeof t==`string`?t:void 0}const v=/^[A-Za-z0-9-]{8,64}$/;let y=null;function b(e){return n(e??f(),`.ok`,`machine-id`)}function x(n){if(n===void 0&&y!==null)return y;let r=b(n),i=null;try{let e=c(r,`utf-8`).trim();v.test(e)&&(i=e)}catch{}if(i===null){i=h();try{o(t(r),{recursive:!0}),u(r,`${i}\n`,{encoding:`utf-8`,mode:384})}catch(t){e(`machine-id`).warn({path:r,err:t},`Failed to persist ${r} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${t instanceof Error?t.message:String(t)}`)}}return n===void 0&&(y=i),i}function S(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function C(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function w(){try{let e=r(t(m(import.meta.url)),`..`,`package.json`),n=JSON.parse(c(e,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}const T=w(),E=1,D=e(`process-lock`);var O=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function k(e,t){return r(e,`${t}.lock`)}const A=new Map;function j(e){A.set(e,(A.get(e)??0)+1)}function M(e){let t=A.get(e);return t===void 0||t<=1?(A.delete(e),!0):(A.set(e,t-1),!1)}function N(e){return typeof e.machineId==`string`?e.machineId===x():e.hostname===p()}const P=new Set;let F=!1;function I(e){P.add(e),!F&&(F=!0,process.on(`exit`,()=>{for(let e of P)try{let t=JSON.parse(c(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==x()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==p())continue;l(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(c(e,`utf-8`));return n&&typeof n==`object`&&C(n.pid)?n:(D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null}}function R(e){let{lockName:t,lockDir:n,metadata:r}=e,c=`[${t}-lock]`;o(n,{recursive:!0});let f=k(n,t),m={pid:process.pid,hostname:p(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:x(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??T},h=JSON.stringify(m,null,2);for(let e=0;e<3;e++){if(!a(f))try{let e=s(f,`wx`,384);try{d(e,h)}finally{i(e)}return j(f),I(f),z({lockName:t,lockDir:n,lockPath:f})}catch(e){if(_(e)!==`EEXIST`)throw e}let e=L(f,c);if(e){if(N(e)&&e.pid===process.pid)return u(f,h,{encoding:`utf-8`,mode:384}),j(f),I(f),z({lockName:t,lockDir:n,lockPath:f});if(S(e.pid))throw new O(e,f,t);D.warn({pid:e.pid,host:e.hostname},`${c} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{l(f)}catch{}}throw Error(`${c} Failed to acquire ${f} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>G({lockName:t,lockDir:n}),updatePort:e=>B({lockName:t,lockDir:n,port:e})}}function B(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,o=k(n,t);if(!a(o)){D.warn({lockPath:o},`${i} Lock file missing at ${o} during port update — skipping`);return}let s;try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||!C(e.pid)){D.warn({lockPath:o},`${i} Corrupt lock at ${o} during port update — skipping`);return}s=e}catch{D.warn({lockPath:o},`${i} Unreadable lock at ${o} during port update — skipping`);return}if(s.pid===process.pid&&N(s)){s.port=r;try{u(o,JSON.stringify(s,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function V(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=k(n,t);if((A.get(i)??0)>1)return;let a;try{let e=JSON.parse(c(i,`utf-8`));if(!e||typeof e!=`object`||!C(e.pid)){D.warn({lockPath:i},`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){_(e)!==`ENOENT`&&D.warn({lockPath:i,err:e},`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&N(a)&&a.draining!==!0){a.draining=!0;try{u(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:i,err:e},`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function H(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return null;let i;try{let e=JSON.parse(c(r,`utf-8`));if(!e||typeof e!=`object`||!C(e.pid))return null;i=e}catch{return null}if(!N(i))return null;if(!S(i.pid)){try{l(r)}catch{}return null}return i}function U(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return{status:`absent`};let i;try{i=JSON.parse(c(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o=i;if(!C(o.pid)||typeof o.hostname!=`string`||typeof o.port!=`number`||typeof o.startedAt!=`string`||typeof o.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:o.pid,hostname:o.hostname,port:o.port,startedAt:o.startedAt,worktreeRoot:o.worktreeRoot,machineId:typeof o.machineId==`string`?o.machineId:void 0,draining:o.draining===!0?!0:void 0,protocolVersion:typeof o.protocolVersion==`number`?o.protocolVersion:void 0,runtimeVersion:typeof o.runtimeVersion==`string`?o.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!S(s.pid)){try{l(r)}catch{}return{status:`stale`,lock:s}}return s.protocolVersion===void 0||s.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:s}}async function W(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>H({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function G(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,o=k(n,t);if(M(o)){if(r){V({lockName:t,lockDir:n});return}if(a(o))try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;l(o),P.delete(o)}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to release ${o}: ${e instanceof Error?e.message:String(e)}`)}}}var K=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function q(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new K(e.existing,e.lockPath):e}}function J(e,t){B({lockName:`server`,lockDir:e,port:t})}function Y(e){return H({lockName:`server`,lockDir:e})}function X(e,t){G({lockName:`server`,lockDir:e,...t})}function Z(e){V({lockName:`server`,lockDir:e})}function Q(e,t){return W({lockName:`server`,lockDir:e,...t})}export{g as S,E as _,X as a,x as b,O as c,V as d,H as f,T as g,B as h,Y as i,R as l,G as m,q as n,J as o,U as p,Z as r,Q as s,K as t,k as u,S as v,_ as x,C as y};
|
|
2
|
+
//# sourceMappingURL=server-lock-TC0vRJO5.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
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,Pa as r}from"./src-C4HvLmg1.mjs";import{Ai as i,ct as a,hn as o,lt as s,ot as c,st as l,ui as u,ya as d}from"./src-ZTjj6Vbn.mjs";import{K as f}from"./sleep-B2L0pvp4.mjs";import{O as p,P as m}from"./fs-traced-Cc6WsRtP.mjs";import{b as h,u as g,v as _,y as v}from"./server-lock-TC0vRJO5.mjs";import{t as y}from"./yazl-BafwB467.mjs";import{C as b,d as x,i as ee,v as te,y as S}from"./write-project-skill-7eiqv4-L.mjs";import{c as ne}from"./colors-BsmVIwfM.mjs";import"./acp-harness-probe-BZ0o8z0h.mjs";import{D as re,E as ie,S as C,T as w,_ as ae,b as oe,o as T,v as E}from"./init-CIcmWJHm.mjs";import{n as D}from"./constants-Co6lMb8A.mjs";import{t as O}from"./is-object-ByG7RnjH.mjs";import"./loader-C-Kifx5i.mjs";import"./preview-CqGqHfYb.mjs";import{execSync as se,spawnSync as k}from"node:child_process";import{basename as A,dirname as j,isAbsolute as M,join as N,relative as ce,resolve as P,sep as le}from"node:path";import{cpSync as ue,createWriteStream as de,existsSync as F,lstatSync as fe,mkdirSync as I,mkdtempSync as pe,readFileSync as L,readdirSync as me,readlinkSync as he,rmSync as ge,statSync as _e,writeFileSync as R}from"node:fs";import{arch as ve,freemem as ye,homedir as be,hostname as xe,platform as Se,release as Ce,tmpdir as we,totalmem as Te,type as Ee,uptime as De}from"node:os";import{realpath as z}from"node:fs/promises";import{createHash as B}from"node:crypto";var V=f();const Oe=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function ke(e,t,n=o){if(e!==void 0&&!Oe.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Ae=null;function je(e){Ae=e}function Me(){return Ae??process.cwd()}const Ne=[{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]@`}],Pe=Ne.map(e=>e.name);function H(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 Ne)i.lastIndex=0,i.test(r)&&(t.add(e),n++,i.lastIndex=0,r=r.replace(i,a));return r}).join(`
|
|
3
3
|
`),patterns:[...t],lineCount:n}}function Fe(){return N(be(),`.ok`,`bug-reports`)}function Ie(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Fe(),r=`${t}-bugreport`,i=N(n,`${r}.zip`);for(let e=2;F(i);e+=1)i=N(n,`${r}-${e}.zip`);return i}function Le(e,t){let n=N(e,`.ok`,`config.yml`);if(F(n))try{let e=L(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 F(N(e,`.ok`))?B(`sha256`).update(P(e)).digest(`hex`).slice(0,12):null}function Re(){let e={timestamp:new Date().toISOString(),platform:Se(),osType:Ee(),osRelease:Ce(),hostname:`[redacted]`,uptime:De(),freeMem:ye(),totalMem:Te(),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`,u({encoding:`utf8`})).trim()}catch{}try{let t=N(__dirname,`..`,`..`,`package.json`);F(t)&&(e.okVersion=JSON.parse(L(t,`utf8`)).version)}catch{}return e}function ze(e,t){if(!F(t))return{files:[]};let n=me(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>N(t,e));if(e&&n.length>0){let t=n.filter(t=>{try{return L(t,`utf8`).includes(`"project":"${e}"`)}catch{return!0}});t.length>0&&(n=t)}return{files:n}}function Be(e){let n=N(e,`.ok`,`local`);return F(n)?{files:[`server.lock`,`last-spawn-error.log`,t].map(e=>N(n,e)).filter(e=>F(e))}:{files:[]}}function Ve(e){let t=N(e,`.ok`,`local`,`logs`);return F(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>N(t,e)).filter(e=>F(e))}:{files:[]}}function He(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=H(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 U(e){for(let t of e.files)try{He({zipfile:e.zipfile,name:`${e.prefix}/${A(t)}`,content:L(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 Ue(t){let{redact:n,outputPath:r,logger:i}=t,a=t.userLogsDir??N(be(),`.ok`,`logs`),o=t.projectDir?Le(t.projectDir,i):null;I(j(r),{recursive:!0}),i?.info({projectSlug:o},`gathering diagnostic data`);let s=Re();s.desktop=t.desktop??null;let{files:c}=ze(o,a),{files:l}=t.projectDir?Be(t.projectDir):{files:[]},{files:u}=t.projectDir?Ve(t.projectDir):{files:[]};i?.info({logFileCount:c.length,lockFileCount:l.length,localSinkFileCount:u.length},`files collected`);let d=[],f=[],{ZipFile:p}=await import(`./yazl-vwTkB7U0.mjs`).then(t=>e(t.default,1)),m=new p;U({zipfile:m,files:c,prefix:`logs`,redact:n,bundleFiles:f,redactions:d,logger:i}),U({zipfile:m,files:l,prefix:`lockdir`,redact:n,bundleFiles:f,redactions:d,logger:i}),U({zipfile:m,files:u,prefix:`local-logs`,redact:n,bundleFiles:f,redactions:d,logger:i});for(let e of t.extraFiles??[])try{let t=L(e.sourcePath),n=`extra/${e.zipName??A(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&&He({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: ${Pe.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=de(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 We=e(y(),1),W=e(ne(),1);const Ge=new Set([`doc.name`,`currentDoc`]);function Ke(e){return`doc:${B(`sha256`).update(e).digest(`hex`).slice(0,8)}`}function qe(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 Je(e,t){let n=t.originalToHashed.get(e);if(n!==void 0)return n;let r=Ke(e);return t.originalToHashed.set(e,r),qe(t,e,r),r}function G(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function K(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e,t){if(typeof e==`string`)return G(e,t.contentDir);if(Array.isArray(e))return e.map(e=>q(e,t));if(!K(e))return e;let n=typeof e.key==`string`&&Ge.has(e.key)&&K(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`&&K(a)){let e=Je(n,t);r[i]={...a,stringValue:e}}else Ge.has(i)&&typeof a==`string`?r[i]=Je(a,t):r[i]=q(a,t);return r}function Ye(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 Xe(e,t){let n=L(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
@@ -19,4 +19,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{F as t,I as n,Na as r}from"./src
|
|
|
19
19
|
`).replace(/\n/g,`\r
|
|
20
20
|
`));let u=`${i?``:``}${l}`;return u!==r&&m(e,u,{mode:w(e)}),{kind:`removed`}}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:l(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 W.default.green(e);case`desktop`:return W.default.blue(e);case`foreign`:return W.default.cyan(e);case`ui-orphan`:return W.default.magenta(e);case`stale`:return W.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=W.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??c,n=e.inspect??Z,r=e.log??(e=>console.log(e)),i=e.resolveCommand??a,o=e.resolveUsage??s,l=await t(),u=[];for(let e of l){let t=n(e,`server`),r=n(e,`ui`),a=ln(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:o(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:o(r.lock.pid));a!=null&&u.push(a)}if(e.json){let e=u.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(gn(e.all?u:u.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??_,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=>Z(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=_){let n=await c(),r=null;for(let i of n){let n=Z(i,`server`),a=Z(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 c();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=Z(n,`server`),r=Z(n,`ui`);!$(e,_)&&!$(r,_)||(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(P(Me(),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 z(P(e)),i=await z(P(j(e)))}catch{return{kind:`not-git`}}if(!En(n,i))return{kind:`symlink-escape`};let a=N(n,`.git`),o;try{o=_e(a)}catch{return{kind:`not-git`}}if(o.isDirectory()){let e;try{e=await z(a)}catch{return{kind:`not-git`}}if(!En(e,n))return{kind:`symlink-escape`}}else if(!o.isFile())return{kind:`not-git`};let s=d(n);if(s.kind!==`repository`)return{kind:`not-git`};let c=s.repository.readRemoteUrl(`origin`);if(c.kind===`unreadable`)return{kind:`not-git`};if(c.kind===`absent`)return c.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let l=c.url,u=Ht(l);if(u===null)return{kind:`non-github`};let f=r(u.hostname);if(f===null)return{kind:`non-github`};let p=f===t.host.toLowerCase(),m=u.owner.toLowerCase()===t.owner.toLowerCase(),h=u.name.toLowerCase()===t.repo.toLowerCase();return!p&&m&&h?{kind:`wrong-host`,actualHost:f}:!p||!m||!h?{kind:`wrong-repo`,actualOwner:u.owner,actualRepo:u.name}:{kind:`ok`,gitRemoteUrl:`https://${f}/${u.owner}/${u.name}.git`}}function En(e,t){if(e===t)return!0;let n=ce(t,e);return n.length>0&&!n.startsWith(`..`)&&!M(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=E(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=ee(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{Ie as C,je as D,Me as E,ke as O,Lt as S,H as T,Wt as _,Cn as a,Bt as b,Kt as c,$t as d,Yt as f,Gt as g,Ut as h,bn as i,Jt as l,Qt as m,Tn as n,vn as o,Zt as p,wn as r,nn as s,kn as t,qt as u,Ht as v,Fe as w,It as x,Z as y};
|
|
22
|
-
//# sourceMappingURL=src-
|
|
22
|
+
//# sourceMappingURL=src-BFng-ST-.mjs.map
|