@inkeep/open-knowledge 0.79.12-beta.0 → 0.80.0-beta.0

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.
Files changed (37) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-1BynOMQE.mjs +1 -0
  3. package/dist/{dist-DWl9h_wU.mjs → dist-BUgYLrP6.mjs} +1 -1
  4. package/dist/{dist-DO3sZOeM.mjs → dist-vTnz4KIT.mjs} +1 -1
  5. package/dist/index.mjs +2 -2
  6. package/dist/{init-DAQib1UT.mjs → init-4p_6xlVE.mjs} +2 -2
  7. package/dist/init-UI3gVimw.mjs +1 -0
  8. package/dist/{launch-json-removal-_3eL413R.mjs → launch-json-removal-D4_mMakD.mjs} +1 -1
  9. package/dist/{loader-2X3BKFz-.mjs → loader-Bqc5faf_.mjs} +1 -1
  10. package/dist/loader-pzLCd_sE.mjs +1 -0
  11. package/dist/{open-browser-g2RoUyjF.mjs → open-browser-u9vaqtv4.mjs} +1 -1
  12. package/dist/preview-BksX7uUJ.mjs +1 -0
  13. package/dist/{preview-CaOWk602.mjs → preview-D8BaRZRi.mjs} +1 -1
  14. package/dist/public/assets/FeedbackForm-NhfMDg3J.js +1 -0
  15. package/dist/public/assets/globals-Bx4DAP1K.css +1 -0
  16. package/dist/public/assets/{index-hP3cfLOm.js → index-YfzQEW7I.js} +1 -1
  17. package/dist/public/assets/{uninstall-DXOFNOiB.js → uninstall-DgolbZzq.js} +1 -1
  18. package/dist/public/index.html +3 -3
  19. package/dist/public/uninstall.html +3 -3
  20. package/dist/{registry-probes-Czm5hKFY.mjs → registry-probes-K0NPq33V.mjs} +1 -1
  21. package/dist/{removal-file-path-BXzFteYo.mjs → removal-file-path-D6HveM8Y.mjs} +1 -1
  22. package/dist/{repair-launch-json-BIly8THm.mjs → repair-launch-json-D0dueJqz.mjs} +1 -1
  23. package/dist/{repair-mcp-configs-Y_f0DIWP.mjs → repair-mcp-configs-BNc8ziBC.mjs} +1 -1
  24. package/dist/src-CZ5JQEnS.mjs +1 -0
  25. package/dist/{src-6AjgUq-v.mjs → src-sfg5Bhcb.mjs} +1 -1
  26. package/dist/{start-BfkmfNLZ.mjs → start-UddMPdBY.mjs} +3 -3
  27. package/dist/start-XL61C1sD.mjs +1 -0
  28. package/package.json +5 -5
  29. package/dist/constants-Bpdfy89H.mjs +0 -1
  30. package/dist/init-DQUaeOOp.mjs +0 -1
  31. package/dist/loader-DL3k3t1r.mjs +0 -1
  32. package/dist/preview-Dko76wnK.mjs +0 -1
  33. package/dist/public/assets/FeedbackForm-Bl7bqhzV.js +0 -1
  34. package/dist/public/assets/globals-B0cfn8gI.css +0 -1
  35. package/dist/src-evIjVVF1.mjs +0 -1
  36. package/dist/start-Bdq0NZEv.mjs +0 -1
  37. /package/dist/public/assets/{globals-BBGwsUPI.js → globals-Cn1sYXH0.js} +0 -0
@@ -40,7 +40,7 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
40
40
  `)){let e=t.trim();if(!e.startsWith(AC))continue;let n;try{n=JSON.parse(e.slice(10))}catch{return null}return typeof n!=`object`||!n?null:sme(n)}return null}function MC(e){if(!e)return[];let t=[];for(let n of e.split(`
41
41
  `)){let e=n.trim();if(!e.startsWith(AC))continue;let r;try{r=JSON.parse(e.slice(10))}catch{continue}if(typeof r!=`object`||!r)continue;let i=sme(r);i&&t.push(i)}return t}function ume(e){let t={v:1,id:e.writer_id,name:e.display_name,colorSeed:e.color_seed,docs:e.docs};return e.summaries&&e.summaries.length>0&&(t.summaries=e.summaries),t}function NC(e){let t=MC(e);return t.length>0?t.map(ume):ome(e)}function dme(e){return e.length===0?`wip: auto-save`:e.length===1?`wip: ${e[0]}`:`wip: ${e.length} docs`}function fme(e){return`reconcile: ${e}`}function pme(e,t){return`rollback: ${e} to ${t.slice(0,7)}`}function mme(e,t){return`park: ${e} -> ${t}`}function PC(e,t){return`rename: ${e} -> ${t}`}function hme(e){return`checkpoint: ${e}`}function gme(e,t){return e?`import: from ${e.slice(0,8)}..${t.slice(0,8)}`:`import: initial at ${t.slice(0,8)}`}const _me=RegExp(`[\\r\\n\\v\\f\\u0085\\u2028\\u2029]`,`g`);function vme(e){return e.replace(_me,` `)}function yme(e,t){let n=vme(e);if(t.length===0)return n;if(t.length>=2)return`${n} (${t.length} edits)`;let[r]=t;if(r===void 0)return n;let i=vme(r),a=`${n} — ${i}`;if(a.length<=72)return a;let o=`${n} — `,s=72-o.length-1;return s<=0?a.slice(0,72):`${o}${i.slice(0,s)}…`}function FC(e){return eme.test(e)?e.startsWith(`agent-`)?{id:e,classification:`agent`,isAgent:!0}:e.startsWith(`principal-`)?{id:e,classification:`principal`,isAgent:!1}:e.startsWith(`git-author-`)?{id:e,classification:`classified-git-author`,isAgent:null}:e===`file-system`?{id:e,classification:`classified-file-system`,isAgent:null}:e===`git-upstream`?{id:e,classification:`classified-git-upstream`,isAgent:null}:e===`openknowledge-service`?{id:e,classification:`classified-openknowledge-service`,isAgent:null}:e===`ok-generator`?{id:e,classification:`classified-ok-generator`,isAgent:null}:{id:e,classification:`unknown`,isAgent:null}:{id:e,classification:`unknown`,isAgent:null}}function IC(e){let t=TC(e);if(t.kind!==`linked`)return W(e);try{let n=K(H(t.path,`commondir`),`utf-8`).trim();if(n===``)return W(e);let r=V(W(t.path,n));return W(r,t.projectSubPath)}catch{return W(e)}}const bme=[`Warning: `,`Config warning: `];function xme(e,t){if(t==null||t.source!==`registry`||t.id!==`codex-acp`||typeof e!=`object`||!e)return!1;let n=e;if(n.sessionUpdate!==`agent_message_chunk`||n.messageId!==void 0)return!1;let r=n.content;if(typeof r!=`object`||!r)return!1;let i=r;if(i.type!==`text`||typeof i.text!=`string`)return!1;let a=i.text;return a.endsWith(`
42
42
 
43
- `)?bme.some(e=>a.startsWith(e)):!1}function LC(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function RC(e,t){let n=e[t];return typeof n==`string`&&n!==``?n:null}function Sme(e){if(typeof e!=`object`||!e)return null;let t=e,n=RC(t,`tool`)??RC(t,`name`),r=t;if(typeof t.arguments==`object`&&t.arguments!==null)r=t.arguments;else if(typeof t.arguments==`string`)try{let e=JSON.parse(t.arguments);typeof e==`object`&&e&&(r=e)}catch{}return{tool:n,args:r}}const Cme=new Set(ot),wme=/^(?:open[-_ ]?knowledge|ok)(?:[-_][a-z]+)*$/,Tme=/^open[-_ ]?knowledge(?:-dev)?$/,Eme=/^(mcp[^a-z0-9]+)?((?:open[-_ ]?knowledge|ok)(?:-[a-z]+)*)[^a-z0-9]+([a-z_]+)$/;function Dme(e){return e!==null&&Cme.has(e)}function Ome(e,t=`any`){let n=t===`known`?Tme:wme,r=RC(LC(e.rawInput),`server`)?.toLowerCase()??null;if(r!==null&&!n.test(r))return null;let i=Eme.exec((e.title??``).trim().toLowerCase()),a=i?.[1]!==void 0,o=i?.[2]??null,s=i?.[3]??null,c=Sme(e.rawInput);if(t===`known`){if(o===null||!(a?n.test(o):o===`ok`&&r===null)||!Dme(s))return null;let e=c?.tool??null;return e!==null&&e!==s?null:{tool:s,args:c?.args??{}}}let l=[s,c?.tool??null].find(Dme);return l===void 0?null:{tool:l,args:c?.args??{}}}const kme=/^(?:\/bin\/|\/usr\/bin\/|\/usr\/local\/bin\/)?(?:ba|da|z)?sh$/,Ame=/^[\w@%+=:,./-]+$/,jme=/[^ \t\n]/;function Mme(e){let t=LC(e).command,n=Array.isArray(t)?Nme(t):t;return typeof n==`string`&&jme.test(n)?n:null}function Nme(e){if(e.length===0||!e.every(e=>typeof e==`string`))return null;let[t=``,n,r=``]=e;return e.length===3&&kme.test(t)&&(n===`-c`||n===`-lc`)?r:e.map(Pme).join(` `)}function Pme(e){return Ame.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`}var zC=Tee();function Fme(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=Ba({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function Ime(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return zs(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function BC(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n))return;n=Reflect.get(n,e)}return n}function Lme(e){let t=[],n=[[`maxBatchSize`,1,Iee],[`maxBatchChars`,1,Et],[`docTimeoutMs`,1,pre]];for(let[r,i,a]of n){let n=[`search`,`semantic`,r],o=BC(e.rawConfig,n),s=e.config.search.semantic[r];if(o===void 0||o===s)continue;let c=`Expected an integer between ${i} and ${a}; using default ${s}.`,l=Ba({file:e.absPath,source:e.source,doc:e.doc,path:n});t.push({path:n,message:c,...l===void 0?{}:{source:{file:l.file,line:l.line,column:l.column}}})}return t.length>0?[{code:`VALUE_FALLBACK`,issues:t}]:[]}function Rme(e){let t=BC(e.rawConfig,[`git`,`hosts`]);if(t===void 0)return[];let n=Nr.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`git`,`hosts`,...t.path.map(String)],r=Ba({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:`${t.message}; ignoring this git-host declaration.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function zme(e){let t=BC(e.rawConfig,[`autolinks`]);if(t===void 0)return[];let n=Dn.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`autolinks`,...t.path.map(String)],r=Ba({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:t.path.length===0?`${t.message}; ignoring autolinks.`:`${t.message}; ignoring this autolink entry.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function VC(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=Vi.parse({});if(!G(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=K(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,zC.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?Ime(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=Dte({value:c,file:t,source:o,doc:s}),u=l.length>0?yn(c):c,d=[...Rme({rawConfig:u,doc:s,source:o,absPath:t}),...zme({rawConfig:u,doc:s,source:o,absPath:t})];for(let e of d)for(let n of e.issues)i(`[config] ${t} ${n.path.join(`.`)}: ${n.message}`);let f=Vi.safeParse(u);if(!f.success){let e=Fme(f,s,o,t),c=Vi.shape.git.safeParse(BC(u,[`git`])).data??a.git,p=Object.keys(c.hosts).length>0?`Using schema defaults while preserving valid git-host declarations.`:`Using schema defaults.`;i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). ${p}`+(n?``:` Pass-through mode: file left in place.`));let m=n?Ime(t,r,i):void 0,h=[...l,...d,...ti(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]];return{valid:!1,value:{...a,git:c},error:e,diagnostics:h,...m===void 0?{}:{sidelinedTo:m}}}let p=[...l,...d,...Lme({rawConfig:u,config:f.data,doc:s,source:o,absPath:t})];return{valid:!0,value:f.data,source:t,diagnostics:p}}const HC=`.tmp.`,Bme=[8,4,4,4,12];function Vme(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const Hme=Bme.map(e=>`[0-9a-f]`.repeat(e)).join(`-`),Ume=Bme.map(e=>`[0-9a-f]{${e}}`).join(`-`),Wme=`*${HC}${Hme}`;RegExp(`${Vme(HC)}${Ume}$`);function UC(e){return`${e}${HC}${lc()}`}const Gme=3e4,Kme={writeFile:(e,t,n)=>oc(e,t,n),rename:(e,t)=>ic(e,t)};async function qme(e){try{let t=V(e),n=`${ps(e)}${HC}`,r=Date.now()-Gme,i=await nc(t);await Promise.all(i.map(async e=>{if(!e.startsWith(n))return;let i=H(t,e);try{(await ac(i)).mtimeMs<r&&await lae(i)}catch{}}))}catch{}}function Jme(e){try{let t=V(e),n=`${ps(e)}${HC}`,r=Date.now()-Gme;for(let e of Ls(t)){if(!e.startsWith(n))continue;let i=H(t,e);try{Hs(i).mtimeMs<r&&Us(i)}catch{}}}catch{}}async function WC(e,t,n={}){n.sweepStaleTmps!==!1&&await qme(e);let r=n.fs??Kme,i=UC(e);try{await r.writeFile(i,t,{encoding:`utf-8`,mode:n.mode??420}),await r.rename(i,e)}catch(e){try{Us(i)}catch{}throw e}}function Yme(e,t,n={}){Jme(e);let r=UC(e);try{Ws(r,t,{encoding:`utf-8`,mode:n.mode??420}),zs(r,e)}catch(e){try{Us(r)}catch{}throw e}}var GC=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function KC(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ps(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Hs(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{Us(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new GC(e,r);await S(i);continue}try{return await t()}finally{try{Ds(s)}catch{}try{Us(e)}catch{}}}}function Xme(e){let t=Date.now()+e;for(;Date.now()<t;);}function Zme(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=Ps(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Hs(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{Us(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new GC(e,r);Xme(i);continue}try{return t()}finally{try{Ds(s)}catch{}try{Us(e)}catch{}}}}const Qme=`config.yml`;function $me(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${yne}/${e===`user`?`config.user.schema.json`:e===`project-local`?`config.project-local.schema.json`:`config.project.schema.json`}`}function ehe(e){return`# yaml-language-server: $schema=${$me(e)}\n`}function qC(e,t,n){if(e===`user`){let e=n??qs();return W(e,`.ok`,`global.yml`)}let r=gs(t)?t:W(t);return e===`project-local`?W(r,`.ok`,Aa,Qme):W(r,`.ok`,Qme)}function JC(e){return{ok:!1,error:e}}function the(e){return{ok:!0,...e}}async function YC(e){return Zt(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await nhe(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function nhe(e){let{cwd:t,scope:n,patch:r,homedirOverride:i}=e,a=qC(n,t,i),o=vt(r,n);if(o!==null)return JC(o);let s=Be(r);if(s!==null)return JC(s);try{await ec(V(a),{recursive:!0})}catch(e){return JC({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${a}: ${e instanceof Error?e.message:String(e)}`})}try{return await KC(`${a}.lock`,()=>rhe(e,a))}catch(e){if(e instanceof GC)return JC({code:`WRITE_ERROR`,detail:e.message});throw e}}async function rhe(e,t){let{patch:n,scope:r,firstWriteHeader:i}=e,a=``,o=!1;if(G(t)){o=!0;try{a=K(t,`utf-8`)}catch(e){return JC({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let s=(0,zC.parseDocument)(a);if(s.errors.length>0)return JC({code:`YAML_PARSE`,detail:s.errors.map(e=>e.message).join(`; `)});if(s.contents===null)s.contents=s.createNode({});else if(!(0,zC.isMap)(s.contents))return JC({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,zC.isSeq)(s.contents)?`sequence`:`scalar`}`});let c=ine(s,n),l=s.toJSON(),u=sr(`config.validate`,{"config.scope":r,"config.validation.layer":`L2`},e=>{let t=Vi.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)ma(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return JC({code:`SCHEMA_INVALID`,issues:u.error.issues.map(eee)});let d=s.toString();if(!o){let e=i===void 0?ehe(r):i??``;e.length>0&&(d=`${e.endsWith(`
43
+ `)?bme.some(e=>a.startsWith(e)):!1}function LC(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function RC(e,t){let n=e[t];return typeof n==`string`&&n!==``?n:null}function Sme(e){if(typeof e!=`object`||!e)return null;let t=e,n=RC(t,`tool`)??RC(t,`name`),r=t;if(typeof t.arguments==`object`&&t.arguments!==null)r=t.arguments;else if(typeof t.arguments==`string`)try{let e=JSON.parse(t.arguments);typeof e==`object`&&e&&(r=e)}catch{}return{tool:n,args:r}}const Cme=new Set(ot),wme=/^(?:open[-_ ]?knowledge|ok)(?:[-_][a-z]+)*$/,Tme=/^open[-_ ]?knowledge(?:-dev)?$/,Eme=/^(mcp[^a-z0-9]+)?((?:open[-_ ]?knowledge|ok)(?:-[a-z]+)*)[^a-z0-9]+([a-z_]+)$/;function Dme(e){return e!==null&&Cme.has(e)}function Ome(e,t=`any`){let n=t===`known`?Tme:wme,r=RC(LC(e.rawInput),`server`)?.toLowerCase()??null;if(r!==null&&!n.test(r))return null;let i=Eme.exec((e.title??``).trim().toLowerCase()),a=i?.[1]!==void 0,o=i?.[2]??null,s=i?.[3]??null,c=Sme(e.rawInput);if(t===`known`){if(o===null||!(a?n.test(o):o===`ok`&&r===null)||!Dme(s))return null;let e=c?.tool??null;return e!==null&&e!==s?null:{tool:s,args:c?.args??{}}}let l=[s,c?.tool??null].find(Dme);return l===void 0?null:{tool:l,args:c?.args??{}}}const kme=/^(?:\/bin\/|\/usr\/bin\/|\/usr\/local\/bin\/)?(?:ba|da|z)?sh$/,Ame=/^[\w@%+=:,./-]+$/,jme=/[^ \t\n]/;function Mme(e){let t=LC(e).command,n=Array.isArray(t)?Nme(t):t;return typeof n==`string`&&jme.test(n)?n:null}function Nme(e){if(e.length===0||!e.every(e=>typeof e==`string`))return null;let[t=``,n,r=``]=e;return e.length===3&&kme.test(t)&&(n===`-c`||n===`-lc`)?r:e.map(Pme).join(` `)}function Pme(e){return Ame.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`}var zC=Tee();function Fme(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=Ba({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function Ime(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return zs(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function BC(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n))return;n=Reflect.get(n,e)}return n}function Lme(e){let t=[],n=[[`maxBatchSize`,1,Iee],[`maxBatchChars`,1,Et],[`docTimeoutMs`,1,pre]];for(let[r,i,a]of n){let n=[`search`,`semantic`,r],o=BC(e.rawConfig,n),s=e.config.search.semantic[r];if(o===void 0||o===s)continue;let c=`Expected an integer between ${i} and ${a}; using default ${s}.`,l=Ba({file:e.absPath,source:e.source,doc:e.doc,path:n});t.push({path:n,message:c,...l===void 0?{}:{source:{file:l.file,line:l.line,column:l.column}}})}return t.length>0?[{code:`VALUE_FALLBACK`,issues:t}]:[]}function Rme(e){let t=BC(e.rawConfig,[`git`,`hosts`]);if(t===void 0)return[];let n=Nr.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`git`,`hosts`,...t.path.map(String)],r=Ba({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:`${t.message}; ignoring this git-host declaration.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function zme(e){let t=BC(e.rawConfig,[`autolinks`]);if(t===void 0)return[];let n=Dn.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`autolinks`,...t.path.map(String)],r=Ba({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:t.path.length===0?`${t.message}; ignoring autolinks.`:`${t.message}; ignoring this autolink entry.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function VC(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=Vi.parse({});if(!G(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=K(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,zC.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?Ime(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=Dte({value:c,file:t,source:o,doc:s}),u=l.length>0?yn(c):c,d=[...Rme({rawConfig:u,doc:s,source:o,absPath:t}),...zme({rawConfig:u,doc:s,source:o,absPath:t})];for(let e of d)for(let n of e.issues)i(`[config] ${t} ${n.path.join(`.`)}: ${n.message}`);let f=Vi.safeParse(u);if(!f.success){let e=Fme(f,s,o,t),c=Vi.shape.git.safeParse(BC(u,[`git`])).data??a.git,p=Object.keys(c.hosts).length>0?`Using schema defaults while preserving valid git-host declarations.`:`Using schema defaults.`;i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). ${p}`+(n?``:` Pass-through mode: file left in place.`));let m=n?Ime(t,r,i):void 0,h=[...l,...d,...ti(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]];return{valid:!1,value:{...a,git:c},error:e,diagnostics:h,...m===void 0?{}:{sidelinedTo:m}}}let p=[...l,...d,...Lme({rawConfig:u,config:f.data,doc:s,source:o,absPath:t})];return{valid:!0,value:f.data,source:t,diagnostics:p}}const HC=`.tmp.`,Bme=[8,4,4,4,12];function Vme(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const Hme=Bme.map(e=>`[0-9a-f]`.repeat(e)).join(`-`),Ume=Bme.map(e=>`[0-9a-f]{${e}}`).join(`-`),Wme=`*${HC}${Hme}`;RegExp(`${Vme(HC)}${Ume}$`);function UC(e){return`${e}${HC}${lc()}`}const Gme=3e4,Kme={writeFile:(e,t,n)=>oc(e,t,n),rename:(e,t)=>ic(e,t)};async function qme(e){try{let t=V(e),n=`${ps(e)}${HC}`,r=Date.now()-Gme,i=await nc(t);await Promise.all(i.map(async e=>{if(!e.startsWith(n))return;let i=H(t,e);try{(await ac(i)).mtimeMs<r&&await lae(i)}catch{}}))}catch{}}function Jme(e){try{let t=V(e),n=`${ps(e)}${HC}`,r=Date.now()-Gme;for(let e of Ls(t)){if(!e.startsWith(n))continue;let i=H(t,e);try{Hs(i).mtimeMs<r&&Us(i)}catch{}}}catch{}}async function WC(e,t,n={}){n.sweepStaleTmps!==!1&&await qme(e);let r=n.fs??Kme,i=UC(e);try{await r.writeFile(i,t,{encoding:`utf-8`,mode:n.mode??420}),await r.rename(i,e)}catch(e){try{Us(i)}catch{}throw e}}function Yme(e,t,n={}){Jme(e);let r=UC(e);try{Ws(r,t,{encoding:`utf-8`,mode:n.mode??420}),zs(r,e)}catch(e){try{Us(r)}catch{}throw e}}var GC=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function KC(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new GC(e,r);s=!1;let c;try{c=Ps(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Hs(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{Us(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new GC(e,r);await S(i);continue}try{return await t()}finally{try{Ds(c)}catch{}try{Us(e)}catch{}}}}function Xme(e){let t=Date.now()+e;for(;Date.now()<t;);}function Zme(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new GC(e,r);s=!1;let c;try{c=Ps(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=Hs(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{Us(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new GC(e,r);Xme(i);continue}try{return t()}finally{try{Ds(c)}catch{}try{Us(e)}catch{}}}}const Qme=`config.yml`;function $me(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${yne}/${e===`user`?`config.user.schema.json`:e===`project-local`?`config.project-local.schema.json`:`config.project.schema.json`}`}function ehe(e){return`# yaml-language-server: $schema=${$me(e)}\n`}function qC(e,t,n){if(e===`user`){let e=n??qs();return W(e,`.ok`,`global.yml`)}let r=gs(t)?t:W(t);return e===`project-local`?W(r,`.ok`,Aa,Qme):W(r,`.ok`,Qme)}function JC(e){return{ok:!1,error:e}}function the(e){return{ok:!0,...e}}async function YC(e){return Zt(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await nhe(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function nhe(e){let{cwd:t,scope:n,patch:r,homedirOverride:i}=e,a=qC(n,t,i),o=vt(r,n);if(o!==null)return JC(o);let s=Be(r);if(s!==null)return JC(s);try{await ec(V(a),{recursive:!0})}catch(e){return JC({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${a}: ${e instanceof Error?e.message:String(e)}`})}try{return await KC(`${a}.lock`,()=>rhe(e,a))}catch(e){if(e instanceof GC)return JC({code:`WRITE_ERROR`,detail:e.message});throw e}}async function rhe(e,t){let{patch:n,scope:r,firstWriteHeader:i}=e,a=``,o=!1;if(G(t)){o=!0;try{a=K(t,`utf-8`)}catch(e){return JC({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let s=(0,zC.parseDocument)(a);if(s.errors.length>0)return JC({code:`YAML_PARSE`,detail:s.errors.map(e=>e.message).join(`; `)});if(s.contents===null)s.contents=s.createNode({});else if(!(0,zC.isMap)(s.contents))return JC({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,zC.isSeq)(s.contents)?`sequence`:`scalar`}`});let c=ine(s,n),l=s.toJSON(),u=sr(`config.validate`,{"config.scope":r,"config.validation.layer":`L2`},e=>{let t=Vi.safeParse(l);if(e.setAttribute(`config.outcome`,t.success?`success`:`rejected`),!t.success)for(let e of t.error.issues)ma(`config.validation.issue`,{"issue.path":e.path.map(e=>String(e)).join(`.`),"issue.message":e.message});return t});if(!u.success)return JC({code:`SCHEMA_INVALID`,issues:u.error.issues.map(eee)});let d=s.toString();if(!o){let e=i===void 0?ehe(r):i??``;e.length>0&&(d=`${e.endsWith(`
44
44
  `)?e:`${e}\n`}${d}`)}try{await ec(V(t),{recursive:!0})}catch(e){return JC({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${t}: ${e instanceof Error?e.message:String(e)}`})}try{await WC(t,d)}catch(e){return JC({code:`WRITE_ERROR`,detail:`Could not write ${t}: ${e instanceof Error?e.message:String(e)}`})}return the({effective:u.data,appliedPaths:c,path:t,created:!o})}const ihe=[`user`,`project`,`project-local`];function ahe(e){let t=[];for(let n of ihe){let r=qC(n,e.cwd,e.homedirOverride),i=VC({absPath:r,sideline:!1,...e.warn?{warn:e.warn}:{}});for(let e of i.diagnostics)t.push(ohe(e,n,r))}return{diagnostics:t}}function ohe(e,t,n){switch(e.code){case`VALUE_FALLBACK`:return{code:`VALUE_FALLBACK`,scope:t,file:n,issues:e.issues.map(e=>({path:e.path,message:e.message,...e.source?{line:e.source.line,column:e.source.column}:{}}))};case`REMOVED_KEY`:return{code:`REMOVED_KEY`,scope:t,file:n,path:e.path,redirect:e.redirect};case`YAML_PARSE`:return{code:`YAML_PARSE`,scope:t,file:n};case`SCHEMA_INVALID`:return{code:`SCHEMA_INVALID`,scope:t,file:n};case`UNREADABLE`:return{code:`UNREADABLE`,scope:t,file:n}}}const she=[`LC_ALL`,`LC_MESSAGES`,`LANG`];function che(e){let t=e.trim().split(`@`)[0].split(`.`)[0];return t===``||t===`C`||t===`POSIX`?null:ci(t.replaceAll(`_`,`-`))}function lhe(e){for(let t of she){let n=e[t]?.trim();if(n!==void 0&&n!==``)return che(n)}return null}function uhe(e){let t=e.OK_LANG?.trim();if(t!==void 0&&t!==``)return ci(t)??void 0}function dhe(e=process.env){let t=uhe(e),n=lhe(e);if(n===null)return{override:t,preferenceList:[]};let r=[],i=e.LANGUAGE;if(i!==void 0)for(let e of i.split(`:`)){let t=che(e);t!==null&&r.push(t)}return{override:t,preferenceList:[...r,n]}}function fhe(e,t){let n;try{n=Hs(e).size}catch{n=void 0}let r=Ps(e,ln(n),384);try{Zie(r,384)}catch{}try{Gs(r,Bte(new Date,t))}catch{}return r}const XC={initialize:`initialize`,authenticate:`authenticate`,providers_list:`providers/list`,providers_set:`providers/set`,providers_disable:`providers/disable`,session_new:`session/new`,session_load:`session/load`,session_set_mode:`session/set_mode`,session_set_config_option:`session/set_config_option`,session_prompt:`session/prompt`,session_cancel:`session/cancel`,mcp_message:`mcp/message`,session_list:`session/list`,session_delete:`session/delete`,session_fork:`session/fork`,session_resume:`session/resume`,session_close:`session/close`,logout:`logout`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,nes_accept:`nes/accept`,nes_reject:`nes/reject`,nes_close:`nes/close`,document_did_open:`document/didOpen`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_save:`document/didSave`,document_did_focus:`document/didFocus`},ZC={session_request_permission:`session/request_permission`,session_update:`session/update`,fs_write_text_file:`fs/write_text_file`,fs_read_text_file:`fs/read_text_file`,terminal_create:`terminal/create`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`,terminal_kill:`terminal/kill`,mcp_connect:`mcp/connect`,mcp_message:`mcp/message`,mcp_disconnect:`mcp/disconnect`,elicitation_create:`elicitation/create`,elicitation_complete:`elicitation/complete`},phe={cancel_request:`$/cancel_request`},mhe=Symbol(`skippedItem`);function J(e,t){return e.catch(t)}function QC(e,t){let n=e.catch(t);return F().transform((e,t)=>e===void 0?(t.addIssue({code:`custom`,message:`Required value is missing`}),Ka):n.parse(e))}function hhe(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];return typeof n==`string`?n:void 0}function $C(e,t,n){return e.superRefine((e,r)=>{let i=hhe(e,t);i!==void 0&&n.includes(i)&&r.addIssue({code:`custom`,path:[t],message:`${t} ${JSON.stringify(i)} is reserved by a known variant, but the value does not match that variant's schema`})})}function ew(e,t,n){return F().transform((r,i)=>{let a=e.safeParse(r);if(!a.success){for(let e of a.error.issues)i.addIssue({...e,input:r});return Ka}let o=a.data,s=hhe(r,t);if(s!==void 0&&!n.includes(s)){let e=r;for(let[t,n]of Object.entries(e))t!==`__proto__`&&(Object.hasOwn(o,t)||(o[t]=n))}return o})}function tw(e){return R(e.catch(mhe)).transform(e=>e.filter(e=>e!==mhe))}const nw=Ra([Xi(),B()]).nullable(),rw=B(),ghe=L({sessionId:rw,path:B(),content:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),_he=L({sessionId:rw,path:B(),line:J(Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),limit:J(Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),iw=B(),vhe=Ra([I(`read`),I(`edit`),I(`delete`),I(`move`),I(`search`),I(`execute`),I(`think`),I(`fetch`),I(`switch_mode`),I(`other`)]),yhe=Ra([I(`pending`),I(`in_progress`),I(`completed`),I(`failed`)]),bhe=Ra([I(`assistant`),I(`user`)]),aw=L({audience:J(tw(bhe).nullish(),()=>void 0),lastModified:J(B().nullish(),()=>void 0),priority:J(Xi().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),xhe=L({annotations:J(aw.nullish(),()=>void 0),text:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),She=L({annotations:J(aw.nullish(),()=>void 0),data:B(),mimeType:B(),uri:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Che=L({annotations:J(aw.nullish(),()=>void 0),data:B(),mimeType:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),whe=L({annotations:J(aw.nullish(),()=>void 0),description:J(B().nullish(),()=>void 0),mimeType:J(B().nullish(),()=>void 0),name:B(),size:J(Xi().nullish(),()=>void 0),title:J(B().nullish(),()=>void 0),uri:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),The=L({mimeType:J(B().nullish(),()=>void 0),text:B(),uri:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Ehe=L({blob:B(),mimeType:J(B().nullish(),()=>void 0),uri:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Dhe=Ra([The,Ehe]),Ohe=L({annotations:J(aw.nullish(),()=>void 0),resource:Dhe,_meta:J(z(B(),F()).nullish(),()=>void 0)}),ow=Ra([xhe.and(L({type:I(`text`)})),She.and(L({type:I(`image`)})),Che.and(L({type:I(`audio`)})),whe.and(L({type:I(`resource_link`)})),Ohe.and(L({type:I(`resource`)}))]),khe=L({content:ow,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Ahe=L({path:B(),oldText:J(B().nullish(),()=>void 0),newText:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),sw=B(),jhe=L({terminalId:sw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Mhe=Ra([khe.and(L({type:I(`content`)})),Ahe.and(L({type:I(`diff`)})),jhe.and(L({type:I(`terminal`)}))]),Nhe=L({path:B(),line:J(Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Phe=L({toolCallId:iw,kind:J(vhe.nullish(),()=>void 0),status:J(yhe.nullish(),()=>void 0),title:J(B().nullish(),()=>void 0),content:J(tw(Mhe).nullish(),()=>void 0),locations:J(tw(Nhe).nullish(),()=>void 0),rawInput:J(F().optional(),()=>void 0),rawOutput:J(F().optional(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Fhe=B(),Ihe=Ra([I(`allow_once`),I(`allow_always`),I(`reject_once`),I(`reject_always`)]),Lhe=L({optionId:Fhe,name:B(),kind:Ihe,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Rhe=L({sessionId:rw,toolCall:Phe,options:R(Lhe),_meta:J(z(B(),F()).nullish(),()=>void 0)}),zhe=L({name:B(),value:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Bhe=L({sessionId:rw,command:B(),args:J(tw(B()).optional(),()=>[]),env:J(tw(zhe).optional(),()=>[]),cwd:J(B().nullish(),()=>void 0),outputByteLimit:J(Xi().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Vhe=L({sessionId:rw,terminalId:sw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Hhe=L({sessionId:rw,terminalId:sw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Uhe=L({sessionId:rw,terminalId:sw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Whe=L({sessionId:rw,terminalId:sw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),cw=L({sessionId:rw,toolCallId:J(iw.nullish(),()=>void 0)}),lw=L({requestId:nw}),Ghe=I(`object`),Khe=Ra([I(`email`),I(`uri`),I(`date`),I(`date-time`)]),qhe=L({const:B(),title:B(),description:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Jhe=L({title:J(B().nullish(),()=>void 0),description:J(B().nullish(),()=>void 0),minLength:Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),maxLength:Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),pattern:B().nullish(),format:Khe.nullish(),default:J(B().nullish(),()=>void 0),enum:R(B()).nullish(),oneOf:R(qhe).nullish(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Yhe=L({title:J(B().nullish(),()=>void 0),description:J(B().nullish(),()=>void 0),minimum:Xi().nullish(),maximum:Xi().nullish(),default:J(Xi().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Xhe=L({title:J(B().nullish(),()=>void 0),description:J(B().nullish(),()=>void 0),minimum:Xi().nullish(),maximum:Xi().nullish(),default:J(Xi().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Zhe=L({title:J(B().nullish(),()=>void 0),description:J(B().nullish(),()=>void 0),default:J(ya().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Qhe=L({enum:R(B()),_meta:J(z(B(),F()).nullish(),()=>void 0)}),$he=L({anyOf:R(qhe),_meta:J(z(B(),F()).nullish(),()=>void 0)}),ege=ew(Ra([Qhe.and(L({type:I(`string`)})),$C(L({type:B()}),`type`,[`string`]),$he]),`type`,[`string`]),tge=L({title:J(B().nullish(),()=>void 0),description:J(B().nullish(),()=>void 0),minItems:Xi().nullish(),maxItems:Xi().nullish(),items:ege,default:J(tw(B()).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),nge=ew(Ra([Jhe.and(L({type:I(`string`)})),Yhe.and(L({type:I(`number`)})),Xhe.and(L({type:I(`integer`)})),Zhe.and(L({type:I(`boolean`)})),tge.and(L({type:I(`array`)})),$C(L({type:B()}),`type`,[`array`,`boolean`,`integer`,`number`,`string`])]),`type`,[`array`,`boolean`,`integer`,`number`,`string`]),rge=L({type:J(Ghe.optional().default(`object`),()=>`object`),title:J(B().nullish(),()=>void 0),properties:z(B(),nge).optional().default({}),required:R(B()).nullish(),description:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),ige=_i(Ra([cw,lw]),L({requestedSchema:rge})),age=B(),oge=_i(Ra([cw,lw]),L({elicitationId:age,url:ce()})),sge=ew(_i(Ra([ige.and(L({mode:I(`form`)})),oge.and(L({mode:I(`url`)})),$C(_i(Ra([cw,lw]),L({mode:B()})),`mode`,[`form`,`url`])]),L({message:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)})),`mode`,[`form`,`url`]),cge=B(),lge=L({serverId:cge,_meta:J(z(B(),F()).nullish(),()=>void 0)}),uw=B(),uge=L({connectionId:uw,method:B(),params:z(B(),F()).nullish(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),dge=L({connectionId:uw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),fge=F();L({id:nw,method:B(),params:Ra([ghe,_he,Rhe,Bhe,Vhe,Hhe,Uhe,Whe,sge,lge,uge,dge,fge]).nullish()});const pge=Ea().gte(0).lte(65535),mge=L({image:J(ya().optional().default(!1),()=>!1),audio:J(ya().optional().default(!1),()=>!1),embeddedContext:J(ya().optional().default(!1),()=>!1),_meta:J(z(B(),F()).nullish(),()=>void 0)}),hge=L({http:J(ya().optional().default(!1),()=>!1),sse:J(ya().optional().default(!1),()=>!1),acp:J(ya().optional().default(!1),()=>!1),_meta:J(z(B(),F()).nullish(),()=>void 0)}),gge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),_ge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),vge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),yge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),bge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),xge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),Sge=L({list:J(gge.nullish(),()=>void 0),delete:J(_ge.nullish(),()=>void 0),additionalDirectories:J(vge.nullish(),()=>void 0),fork:J(yge.nullish(),()=>void 0),resume:J(bge.nullish(),()=>void 0),close:J(xge.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Cge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),wge=L({logout:J(Cge.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Tge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),Ege=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),Dge=Ra([I(`full`),I(`incremental`)]),Oge=L({syncKind:Dge,_meta:J(z(B(),F()).nullish(),()=>void 0)}),kge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),Age=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),jge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),Mge=L({didOpen:J(Ege.nullish(),()=>void 0),didChange:J(Oge.nullish(),()=>void 0),didClose:J(kge.nullish(),()=>void 0),didSave:J(Age.nullish(),()=>void 0),didFocus:J(jge.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Nge=L({document:J(Mge.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Pge=L({maxCount:J(Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Fge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),Ige=L({maxCount:J(Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Lge=L({maxCount:J(Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Rge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),zge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),Bge=L({recentFiles:J(Pge.nullish(),()=>void 0),relatedSnippets:J(Fge.nullish(),()=>void 0),editHistory:J(Ige.nullish(),()=>void 0),userActions:J(Lge.nullish(),()=>void 0),openFiles:J(Rge.nullish(),()=>void 0),diagnostics:J(zge.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Vge=L({events:J(Nge.nullish(),()=>void 0),context:J(Bge.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Hge=Ra([I(`utf-16`),I(`utf-32`),I(`utf-8`)]),Uge=L({loadSession:J(ya().optional().default(!1),()=>!1),promptCapabilities:J(mge.optional().default({image:!1,audio:!1,embeddedContext:!1}),()=>({image:!1,audio:!1,embeddedContext:!1})),mcpCapabilities:J(hge.optional().default({http:!1,sse:!1,acp:!1}),()=>({http:!1,sse:!1,acp:!1})),sessionCapabilities:J(Sge.optional().default({}),()=>({})),auth:J(wge.optional().default({}),()=>({})),providers:J(Tge.nullish(),()=>void 0),nes:J(Vge.nullish(),()=>void 0),positionEncoding:J(Hge.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),dw=B(),Wge=L({name:B(),label:J(B().nullish(),()=>void 0),secret:J(ya().optional().default(!0),()=>!0),optional:J(ya().optional().default(!1),()=>!1),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Gge=L({id:dw,name:B(),description:J(B().nullish(),()=>void 0),vars:QC(tw(Wge),()=>[]),link:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Kge=L({id:dw,name:B(),description:J(B().nullish(),()=>void 0),args:J(tw(B()).optional(),()=>[]),env:J(z(B(),B()).optional(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),qge=L({id:dw,name:B(),description:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Jge=Ra([Gge.and(L({type:I(`env_var`)})),Kge.and(L({type:I(`terminal`)})),qge]),Yge=L({name:B(),title:J(B().nullish(),()=>void 0),version:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Xge=L({protocolVersion:pge,agentCapabilities:J(Uge.optional().default({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}}),()=>({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}})),authMethods:J(tw(Jge).optional().default([]),()=>[]),agentInfo:J(Yge.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Zge=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),fw=B(),pw=Ra([I(`anthropic`),I(`openai`),I(`azure`),I(`vertex`),I(`bedrock`),B()]),Qge=L({apiType:pw,baseUrl:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),$ge=L({providerId:fw,supported:QC(tw(pw),()=>[]),required:ya(),current:Qge.nullish(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),e_e=L({providers:R($ge),_meta:J(z(B(),F()).nullish(),()=>void 0)}),t_e=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),n_e=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),r_e=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),mw=B(),i_e=L({id:mw,name:B(),description:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),hw=L({currentModeId:mw,availableModes:QC(tw(i_e),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),a_e=B(),o_e=Ra([I(`mode`),I(`model`),I(`model_config`),I(`thought_level`),B()]),gw=B(),s_e=L({value:gw,name:B(),description:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),c_e=B(),l_e=L({group:c_e,name:B(),options:QC(tw(s_e),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),u_e=Ra([R(s_e),R(l_e)]),d_e=L({currentValue:gw,options:u_e}),f_e=L({currentValue:ya()}),_w=_i(Ra([d_e.and(L({type:I(`select`)})),f_e.and(L({type:I(`boolean`)}))]),L({id:a_e,name:B(),description:J(B().nullish(),()=>void 0),category:J(o_e.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)})),p_e=L({sessionId:rw,modes:J(hw.nullish(),()=>void 0),configOptions:J(tw(_w).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),m_e=L({modes:J(hw.nullish(),()=>void 0),configOptions:J(tw(_w).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),h_e=L({sessionId:rw,cwd:B(),additionalDirectories:J(tw(B()).optional(),()=>[]),title:J(B().nullish(),()=>void 0),updatedAt:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),g_e=L({sessions:QC(tw(h_e),()=>[]),nextCursor:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),__e=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),v_e=L({sessionId:rw,modes:J(hw.nullish(),()=>void 0),configOptions:J(tw(_w).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),y_e=L({modes:J(hw.nullish(),()=>void 0),configOptions:J(tw(_w).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),b_e=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),x_e=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),S_e=L({configOptions:QC(tw(_w),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),C_e=Ra([I(`end_turn`),I(`max_tokens`),I(`max_turn_requests`),I(`refusal`),I(`cancelled`)]),w_e=L({totalTokens:Xi(),inputTokens:Xi(),outputTokens:Xi(),thoughtTokens:J(Xi().nullish(),()=>void 0),cachedReadTokens:J(Xi().nullish(),()=>void 0),cachedWriteTokens:J(Xi().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),T_e=L({stopReason:C_e,usage:J(w_e.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),E_e=L({sessionId:rw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),vw=B(),yw=L({line:Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),character:Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),_meta:J(z(B(),F()).nullish(),()=>void 0)}),bw=L({start:yw,end:yw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),D_e=L({range:bw,newText:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),O_e=L({id:vw,uri:B(),edits:R(D_e),cursorPosition:J(yw.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),k_e=L({id:vw,uri:B(),position:yw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),A_e=L({id:vw,uri:B(),position:yw,newName:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),j_e=L({id:vw,uri:B(),search:B(),replace:B(),isRegex:ya().nullish(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),M_e=Ra([O_e.and(L({kind:I(`edit`)})),k_e.and(L({kind:I(`jump`)})),A_e.and(L({kind:I(`rename`)})),j_e.and(L({kind:I(`searchAndReplace`)}))]),N_e=L({suggestions:R(M_e),_meta:J(z(B(),F()).nullish(),()=>void 0)}),P_e=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),F_e=F(),I_e=F(),L_e=Ra([I(-32700),I(-32600),I(-32601),I(-32602),I(-32603),I(-32800),I(-32e3),I(-32002),Ea().min(-2147483648,{error:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{error:`Invalid value: Expected int32 to be <= 2147483647`})]),R_e=L({code:L_e,message:B(),data:J(F().optional(),()=>void 0)});Ra([L({id:nw,result:Ra([Xge,Zge,e_e,t_e,n_e,r_e,p_e,m_e,g_e,__e,v_e,y_e,b_e,x_e,S_e,T_e,E_e,N_e,P_e,F_e,I_e])}),L({id:nw,error:R_e})]);const z_e=B(),xw=L({content:ow,messageId:J(z_e.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),B_e=L({toolCallId:iw,title:B(),kind:J(vhe.optional(),()=>void 0),status:J(yhe.optional(),()=>void 0),content:J(tw(Mhe).optional(),()=>[]),locations:J(tw(Nhe).optional(),()=>[]),rawInput:J(F().optional(),()=>void 0),rawOutput:J(F().optional(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),V_e=Ra([I(`high`),I(`medium`),I(`low`)]),H_e=Ra([I(`pending`),I(`in_progress`),I(`completed`)]),U_e=L({content:B(),priority:V_e,status:H_e,_meta:J(z(B(),F()).nullish(),()=>void 0)}),W_e=L({entries:QC(tw(U_e),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Sw=B(),G_e=L({planId:Sw,entries:QC(tw(U_e),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),K_e=L({planId:Sw,uri:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),q_e=L({planId:Sw,content:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),J_e=Ra([G_e.and(L({type:I(`items`)})),K_e.and(L({type:I(`file`)})),q_e.and(L({type:I(`markdown`)}))]),Y_e=L({plan:J_e,_meta:J(z(B(),F()).nullish(),()=>void 0)}),X_e=L({planId:Sw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Z_e=L({hint:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Q_e=L({name:B(),description:B(),input:J(Z_e.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),$_e=L({availableCommands:QC(tw(Q_e),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),eve=L({currentModeId:mw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),tve=L({configOptions:QC(tw(_w),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),nve=L({title:J(B().nullish(),()=>void 0),updatedAt:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),rve=L({amount:Xi(),currency:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),ive=L({used:Xi(),size:Xi(),cost:J(rve.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),ave=Ra([xw.and(L({sessionUpdate:I(`user_message_chunk`)})),xw.and(L({sessionUpdate:I(`agent_message_chunk`)})),xw.and(L({sessionUpdate:I(`agent_thought_chunk`)})),B_e.and(L({sessionUpdate:I(`tool_call`)})),Phe.and(L({sessionUpdate:I(`tool_call_update`)})),W_e.and(L({sessionUpdate:I(`plan`)})),Y_e.and(L({sessionUpdate:I(`plan_update`)})),X_e.and(L({sessionUpdate:I(`plan_removed`)})),$_e.and(L({sessionUpdate:I(`available_commands_update`)})),eve.and(L({sessionUpdate:I(`current_mode_update`)})),tve.and(L({sessionUpdate:I(`config_option_update`)})),nve.and(L({sessionUpdate:I(`session_info_update`)})),ive.and(L({sessionUpdate:I(`usage_update`)}))]),Cw=L({sessionId:rw,update:ave,_meta:J(z(B(),F()).nullish(),()=>void 0)}),ove=L({elicitationId:age,_meta:J(z(B(),F()).nullish(),()=>void 0)}),sve=L({connectionId:uw,method:B(),params:J(z(B(),F()).nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),cve=F();L({method:B(),params:Ra([Cw,ove,sve,cve]).nullish()});const lve=L({readTextFile:J(ya().optional().default(!1),()=>!1),writeTextFile:J(ya().optional().default(!1),()=>!1),_meta:J(z(B(),F()).nullish(),()=>void 0)}),uve=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),dve=L({boolean:J(uve.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),fve=L({configOptions:J(dve.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),pve=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),mve=L({terminal:J(ya().optional().default(!1),()=>!1),_meta:J(z(B(),F()).nullish(),()=>void 0)}),hve=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),gve=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),_ve=L({form:J(hve.nullish(),()=>void 0),url:J(gve.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),vve=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),yve=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),bve=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),xve=L({jump:J(vve.nullish(),()=>void 0),rename:J(yve.nullish(),()=>void 0),searchAndReplace:J(bve.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Sve=L({fs:J(lve.optional().default({readTextFile:!1,writeTextFile:!1}),()=>({readTextFile:!1,writeTextFile:!1})),terminal:J(ya().optional().default(!1),()=>!1),session:J(fve.nullish(),()=>void 0),plan:J(pve.nullish(),()=>void 0),auth:J(mve.optional().default({terminal:!1}),()=>({terminal:!1})),elicitation:J(_ve.nullish(),()=>void 0),nes:J(xve.nullish(),()=>void 0),positionEncodings:J(tw(Hge).optional(),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Cve=L({protocolVersion:pge,clientCapabilities:J(Sve.optional().default({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}}),()=>({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}})),clientInfo:J(Yge.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),wve=L({methodId:dw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Tve=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),Eve=L({providerId:fw,apiType:pw,baseUrl:B(),headers:z(B(),B()).optional(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Dve=L({providerId:fw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Ove=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),kve=L({name:B(),value:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Ave=L({name:B(),url:B(),headers:R(kve),_meta:J(z(B(),F()).nullish(),()=>void 0)}),jve=L({name:B(),url:B(),headers:R(kve),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Mve=L({name:B(),serverId:cge,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Nve=L({name:B(),command:B(),args:R(B()),env:R(zhe),_meta:J(z(B(),F()).nullish(),()=>void 0)}),ww=Ra([Ave.and(L({type:I(`http`)})),jve.and(L({type:I(`sse`)})),Mve.and(L({type:I(`acp`)})),Nve]),Pve=L({cwd:B(),additionalDirectories:J(tw(B()).optional(),()=>[]),mcpServers:QC(tw(ww),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Fve=L({mcpServers:QC(tw(ww),()=>[]),cwd:B(),additionalDirectories:J(tw(B()).optional(),()=>[]),sessionId:rw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Ive=L({cwd:B().nullish(),cursor:B().nullish(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Lve=L({sessionId:rw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Rve=L({sessionId:rw,cwd:B(),additionalDirectories:J(tw(B()).optional(),()=>[]),mcpServers:J(tw(ww).optional(),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),zve=L({sessionId:rw,cwd:B(),additionalDirectories:J(tw(B()).optional(),()=>[]),mcpServers:J(tw(ww).optional(),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Bve=L({sessionId:rw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Vve=L({sessionId:rw,modeId:mw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Hve=_i(Ra([L({value:ya(),type:I(`boolean`)}),L({value:gw})]),L({sessionId:rw,configId:a_e,_meta:J(z(B(),F()).nullish(),()=>void 0)})),Uve=L({sessionId:rw,prompt:R(ow),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Wve=L({uri:B(),name:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Gve=L({name:B(),owner:B(),remoteUrl:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Kve=L({workspaceUri:J(B().nullish(),()=>void 0),workspaceFolders:R(Wve).nullish(),repository:J(Gve.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),qve=Ra([I(`automatic`),I(`diagnostic`),I(`manual`)]),Jve=L({uri:B(),languageId:B(),text:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Yve=L({startLine:Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),endLine:Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),text:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Xve=L({uri:B(),excerpts:R(Yve),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Zve=L({uri:B(),diff:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Qve=L({action:B(),uri:B(),position:yw,timestampMs:Xi(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),$ve=L({uri:B(),languageId:B(),visibleRange:J(bw.nullish(),()=>void 0),lastFocusedMs:J(Xi().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),eye=Ra([I(`error`),I(`warning`),I(`information`),I(`hint`)]),tye=L({uri:B(),range:bw,severity:eye,message:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),nye=L({recentFiles:R(Jve).nullish(),relatedSnippets:R(Xve).nullish(),editHistory:R(Zve).nullish(),userActions:R(Qve).nullish(),openFiles:R($ve).nullish(),diagnostics:R(tye).nullish(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),rye=L({sessionId:rw,uri:B(),version:Xi(),position:yw,selection:bw.nullish(),triggerKind:qve,context:nye.nullish(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),iye=L({sessionId:rw,_meta:J(z(B(),F()).nullish(),()=>void 0)});L({id:nw,method:B(),params:Ra([Cve,wve,Tve,Eve,Dve,Ove,Pve,Fve,Ive,Lve,Rve,zve,Bve,Vve,Hve,Uve,Kve,rye,iye,uge,fge]).nullish()});const aye=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),oye=L({content:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),sye=L({optionId:Fhe,_meta:J(z(B(),F()).nullish(),()=>void 0)}),cye=Ra([L({outcome:I(`cancelled`)}),sye.and(L({outcome:I(`selected`)}))]),lye=L({outcome:cye,_meta:J(z(B(),F()).nullish(),()=>void 0)}),uye=L({terminalId:sw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),dye=L({exitCode:J(Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),fye=L({output:B(),truncated:ya(),exitStatus:J(dye.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),pye=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),mye=L({exitCode:J(Ea().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:J(B().nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)}),hye=L({_meta:J(z(B(),F()).nullish(),()=>void 0)}),gye=Ra([B(),Xi(),Xi(),ya(),R(B())]),_ye=L({content:z(B(),gye).nullish()}),vye=ew(_i(Ra([_ye.and(L({action:I(`accept`)})),L({action:I(`decline`)}),L({action:I(`cancel`)}),$C(L({action:B()}),`action`,[`accept`,`cancel`,`decline`])]),L({_meta:J(z(B(),F()).nullish(),()=>void 0)})),`action`,[`accept`,`cancel`,`decline`]),yye=L({connectionId:uw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),bye=L({_meta:J(z(B(),F()).nullish(),()=>void 0)});Ra([L({id:nw,result:Ra([aye,oye,lye,uye,fye,pye,mye,hye,vye,yye,bye,I_e,F_e])}),L({id:nw,error:R_e})]);const xye=L({sessionId:rw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Sye=L({sessionId:rw,uri:B(),languageId:B(),version:Xi(),text:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Cye=L({range:bw.nullish(),text:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),wye=L({sessionId:rw,uri:B(),version:Xi(),contentChanges:QC(tw(Cye),()=>[]),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Tye=L({sessionId:rw,uri:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Eye=L({sessionId:rw,uri:B(),_meta:J(z(B(),F()).nullish(),()=>void 0)}),Dye=L({sessionId:rw,uri:B(),version:Xi(),position:yw,visibleRange:bw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),Oye=L({sessionId:rw,id:vw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),kye=Ra([I(`rejected`),I(`ignored`),I(`replaced`),I(`cancelled`)]),Aye=L({sessionId:rw,id:vw,reason:J(kye.nullish(),()=>void 0),_meta:J(z(B(),F()).nullish(),()=>void 0)});L({method:B(),params:Ra([xye,Sye,wye,Tye,Eye,Dye,Oye,Aye,sve,cve]).nullish()}),L({requestId:nw,_meta:J(z(B(),F()).nullish(),()=>void 0)}),ige.and(L({mode:I(`form`)})).and(L({message:B()})),oge.and(L({mode:I(`url`)})).and(L({message:B()})),Ra([cw,lw]).and(L({message:B()})),Jhe.and(L({type:I(`string`)})),Yhe.and(L({type:I(`number`)})),Xhe.and(L({type:I(`integer`)})),Zhe.and(L({type:I(`boolean`)})),tge.and(L({type:I(`array`)})),Qhe.and(L({type:I(`string`)})),_ye.and(L({action:I(`accept`)})),L({action:I(`decline`)}),L({action:I(`cancel`)});const jye=`$/cancel_request`;function Tw(e){return typeof e==`object`&&!!e}function Mye(e){return e===null||typeof e==`string`||typeof e==`number`&&Number.isFinite(e)}function Nye(e){if(!(!Tw(e)||!Mye(e.requestId)))return e.requestId}const Ew={yes(){return{handled:!0}},no(e,t=!1){return{handled:!1,message:e,retry:t}}};function Dw(e){let t=Promise.reject(e);return t.catch(()=>{}),t}function Pye(e){if(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)return e.message}function Fye(e){return typeof e==`object`&&!!e&&`name`in e&&e.name===`ZodError`&&`issues`in e&&Array.isArray(e.issues)&&`format`in e&&typeof e.format==`function`}function Iye(e){if(e instanceof kw)return e.toResult();if(Fye(e))return kw.invalidParams(e.format()).toResult();let t=Pye(e);try{return kw.internalError(t?JSON.parse(t):{}).toResult()}catch{return kw.internalError({details:t}).toResult()}}function Lye(e){return e instanceof kw&&e.code===-32800?e:kw.requestCancelled(e)}function Rye(e,t){let n=zye(e,t);return n?n.toResult():Iye(e)}function zye(e,t){if(!(!t.aborted||!Bye(e)))return Lye(t.reason)}function Bye(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.name===`AbortError`||t.code===`ABORT_ERR`}var Vye=class{id;sendResult;signal;finishRequest;didRespond=!1;constructor(e,t,n=new AbortController().signal,r){this.id=e,this.sendResult=t,this.signal=n,this.finishRequest=r}get responded(){return this.didRespond}respond(e){return this.respondWithResult({result:e??null})}respondWithError(e){let t=e instanceof kw?e.toErrorResponse():e;return this.respondWithResult({error:t})}respondWithResult(e){return this.didRespond?Dw(Error(`JSON-RPC request already responded`)):(this.didRespond=!0,this.sendResult(e).finally(()=>{this.finishRequest?.()}))}},Ow=class{disposeHandler;active=!0;constructor(e){this.disposeHandler=e}dispose(){this.active&&(this.active=!1,this.disposeHandler())}[Symbol.dispose](){this.dispose()}runIndefinitely(){return this}},Hye=class{connection;constructor(e){this.connection=e}sendRequest(e,t,n,r){return this.connection.sendRequest(e,t,n,r)}sendNotification(e,t){return this.connection.sendNotification(e,t)}sendCancelRequest(e){return this.connection.sendCancelRequest(e)}addDynamicHandler(e){return this.connection.addDynamicHandler(e)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}},Uye=class{pendingResponses=new Map;incomingRequests=new Map;nextRequestId=0;staticHandlers=[];dynamicHandlers=new Set;stream;writeQueue=Promise.resolve();abortController=new AbortController;closedPromise;retryQueue=[];context=new Hye(this);receiveReader;constructor(e,t,n,r){if(typeof e==`function`){let i=e,a=t,o=n;this.initialize(o,[...r?.handlers??[],this.legacyHandler(i,a)]);return}let i=e,a=t,o=n;this.initialize(i,[...o?.handlers??[],...a])}static builder(){return new Wye}runUntil(e){let t=!1,n=Promise.resolve().then(()=>e(this.context)).finally(()=>{t=!0}),r=this.closed.then(()=>{if(t)return new Promise(()=>{});throw this.closedReason()});return Promise.race([n,r]).finally(()=>{t=!0,this.close()})}addDynamicHandler(e){if(this.dynamicHandlers.add(e),this.retryQueue.length>0)for(let e of this.retryQueue.splice(0))this.processIncomingMessage(e).catch(e=>this.close(e));return new Ow(()=>{this.dynamicHandlers.delete(e)})}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}getContext(){return this.context}sendRequest(e,t,n,r={}){if(this.abortController.signal.aborted)return Dw(this.closedReason());let i=this.nextRequestId++,a=()=>{},o=new Promise((e,t)=>{let o={resolve:r=>{try{e(n?n(r):r)}catch(e){t(e)}},reject:t};a=()=>{o.cancellationSent||(o.cancellationSent=!0,o.cleanup?.(),this.sendCancelRequest(i).catch(()=>{}))},r.cancellationSignal?.addEventListener(`abort`,a,{once:!0}),o.cleanup=()=>{r.cancellationSignal?.removeEventListener(`abort`,a)},this.pendingResponses.set(i,o)});return o.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:i,method:e,params:t}).catch(()=>{}),r.cancellationSignal?.aborted&&a(),o}sendCancelRequest(e){return this.sendNotification(jye,{requestId:e})}sendNotification(e,t){return this.abortController.signal.aborted?Dw(this.closedReason()):this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);this.abortController.abort(t);for(let e of this.pendingResponses.values())e.cleanup?.(),e.reject(t);this.pendingResponses.clear();for(let e of this.incomingRequests.values())e.abort(t);this.incomingRequests.clear(),this.receiveReader?.cancel(t).catch(()=>{})}initialize(e,t){this.stream=e,this.staticHandlers=t,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}legacyHandler(e,t){return{handleMessage:async(n,r)=>{if(n.kind===`request`){let t=await e(n.method,n.params,r);await n.responder.respond(t)}else await t(n.method,n.params,r);return Ew.yes()}}}async receive(){let e;try{let e=this.stream.readable.getReader();this.receiveReader=e;try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(this.abortController.signal.aborted||n)break;t&&this.receiveMessage(t)}}finally{this.receiveReader===e&&(this.receiveReader=void 0),e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}receiveMessage(e){if(!this.abortController.signal.aborted){if(!Tw(e)){console.error(`Invalid message`,{message:e});return}`method`in e?(`id`in e||this.handleProtocolNotification(e),this.processIncomingMessage(this.toIncomingMessage(e)).catch(e=>this.close(e))):`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}}async processIncomingMessage(e){if(this.abortController.signal.aborted)return;let t=e,n=!1;try{for(let e of[...this.staticHandlers,...this.dynamicHandlers.values()]){if(this.abortController.signal.aborted)return;let r=await e.handleMessage(t,this.context)??{handled:!0};if(r.handled)return;t=r.message??t,n||=!!r.retry}n?this.retryQueue.push(t):t.kind===`request`&&await t.responder.respondWithError(kw.methodNotFound(t.method))}catch(n){if(this.abortController.signal.aborted)return;if(t.kind===`request`&&!t.responder.responded)await t.responder.respondWithResult(Rye(n,t.responder.signal));else{let t=Iye(n);`error`in t&&console.error(`Error handling notification`,e.raw,t.error)}}}toIncomingMessage(e){if(`id`in e){let t=new AbortController;return this.incomingRequests.set(e.id,t),{kind:`request`,method:e.method,params:e.params,raw:e,signal:t.signal,responder:new Vye(e.id,t=>this.sendMessage({jsonrpc:`2.0`,id:e.id,...t}),t.signal,()=>{this.incomingRequests.get(e.id)===t&&this.incomingRequests.delete(e.id)})}}return{kind:`notification`,method:e.method,params:e.params,raw:e}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(this.pendingResponses.delete(e.id),t.cleanup?.(),`result`in e)t.resolve(e.result);else if(`error`in e&&Tw(e.error)){let{code:n,message:r,data:i}=e.error;t.reject(new kw(n,r,i))}else t.reject(kw.invalidRequest(e))}else console.error(`Got response to unknown request`,e.id)}handleProtocolNotification(e){if(e.method!==jye)return;let t=Nye(e.params);if(t===void 0)return;let n=this.incomingRequests.get(t);!n||n.signal.aborted||n.abort(kw.requestCancelled({requestId:t}))}closedReason(){return this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.abortController.signal.aborted?Dw(this.closedReason()):(this.writeQueue=this.writeQueue.then(async()=>{if(this.abortController.signal.aborted)throw this.closedReason();let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{throw this.close(e),e}),this.writeQueue)}},Wye=class{handlers=[];connectionName;name(e){return this.connectionName=e,this}withHandler(e){return this.handlers.push(e),this}onReceiveMessage(e){return this.withHandler({handleMessage:async(t,n)=>await e(t,n)??Ew.no(t),describe:()=>this.connectionName??`onReceiveMessage`})}onReceiveRequest(e,t,n){return this.withHandler({handleMessage:async(r,i)=>r.kind!==`request`||r.method!==e?Ew.no(r):await n(t(r.params),r.responder,i)??Ew.yes(),describe:()=>`${this.connectionName??`request`}:${e}`})}onReceiveNotification(e,t,n){return this.withHandler({handleMessage:async(r,i)=>r.kind!==`notification`||r.method!==e?Ew.no(r):await n(t(r.params),i)??Ew.yes(),describe:()=>`${this.connectionName??`notification`}:${e}`})}connect(e,t){return new Uye(e,this.handlers,t)}connectWith(e,t,n){return this.connect(e,n).runUntil(t)}},kw=class e extends Error{code;data;constructor(e,t,n){super(t),this.code=e,this.name=`RequestError`,this.data=n}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static requestCancelled(t,n){return new e(-32800,`Request cancelled${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}},Gye=class{#e=[];push(e){let t=[],n=0,r=e.indexOf(10,n);for(;r!==-1;)t.push(this.#t(e.subarray(n,r))),n=r+1,r=e.indexOf(10,n);return n<e.byteLength&&this.#e.push(n===0?e:new Uint8Array(e.subarray(n))),t}flush(){if(this.#e.length!==0)return this.#t(new Uint8Array)}#t(e){if(this.#e.length===0)return e;let t=e.byteLength;for(let e of this.#e)t+=e.byteLength;let n=new Uint8Array(t),r=0;for(let e of this.#e)n.set(e,r),r+=e.byteLength;return n.set(e,r),this.#e=[],n}};function Kye(e,t){let n=new TextEncoder,r=new TextDecoder,i=!1,a;return{readable:new ReadableStream({async start(e){let n=new Gye,o=t=>{let n=r.decode(t).trim();if(n)try{let t=JSON.parse(n);Tw(t)?e.enqueue(t):console.warn(`Skipping JSON line that is not an object:`,n)}catch(e){console.error(`Failed to parse JSON message:`,n,e)}},s=t.getReader();a=s;try{for(;;){let{value:e,done:t}=await s.read();if(i)return;if(t)break;if(e){for(let t of n.push(e))if(o(t),i)return}}if(i)return;let e=n.flush();e&&o(e)}catch(t){if(i)return;e.error(t);return}finally{a===s&&(a=void 0),s.releaseLock()}i||e.close()},cancel(e){return i=!0,a?.cancel(e)}}),writable:new WritableStream({async write(t){let r=JSON.stringify(t)+`
45
45
  `,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}function Aw(e){return e??{}}function qye(e){return typeof e==`object`&&!!e&&`readable`in e&&`writable`in e}function Jye(){let e=new TransformStream,t=new TransformStream;return[{readable:t.readable,writable:e.writable},{readable:e.readable,writable:t.writable}]}const jw={agent:{initialize:XC.initialize,authenticate:XC.authenticate,logout:XC.logout,providers:{list:XC.providers_list,set:XC.providers_set,disable:XC.providers_disable},session:{new:XC.session_new,load:XC.session_load,list:XC.session_list,delete:XC.session_delete,fork:XC.session_fork,resume:XC.session_resume,close:XC.session_close,setMode:XC.session_set_mode,setConfigOption:XC.session_set_config_option,prompt:XC.session_prompt,cancel:XC.session_cancel},nes:{start:XC.nes_start,suggest:XC.nes_suggest,accept:XC.nes_accept,reject:XC.nes_reject,close:XC.nes_close},document:{didOpen:XC.document_did_open,didChange:XC.document_did_change,didClose:XC.document_did_close,didSave:XC.document_did_save,didFocus:XC.document_did_focus}},client:{session:{requestPermission:ZC.session_request_permission,update:ZC.session_update},fs:{writeTextFile:ZC.fs_write_text_file,readTextFile:ZC.fs_read_text_file},terminal:{create:ZC.terminal_create,output:ZC.terminal_output,release:ZC.terminal_release,waitForExit:ZC.terminal_wait_for_exit,kill:ZC.terminal_kill},elicitation:{create:ZC.elicitation_create,complete:ZC.elicitation_complete}},protocol:{cancelRequest:phe.cancel_request}},Yye=Symbol(`startActiveSession`);var Xye=class{cx;currentRequestId;constructor(e,t){this.cx=e,this.currentRequestId=t}get requestId(){return this.currentRequestId}get connectionContext(){return this.cx}sendRequest(e,t,n,r){return this.cx.sendRequest(e,t,n,r)}sendNotification(e,t){return this.cx.sendNotification(e,t)}addDynamicHandler(e){return this.cx.addDynamicHandler(e)}},Zye=class e extends Xye{constructor(e,t){super(e,t)}static create(t,n){return new e(t,n)}request(e,t,n){let r=hbe[e];return this.sendRequest(e,t,r?.mapResponse,n)}notify(e,t){return this.sendNotification(e,t)}},Mw=class e extends Xye{constructor(e,t){super(e,t)}static create(t,n){return new e(t,n)}[Yye](e,t){return this.sendRequest(XC.session_new,e,e=>this.attachSession(e),t)}buildSession(e){return typeof e==`string`?abe.create(this,{cwd:e,mcpServers:[]}):abe.create(this,e)}attachSession(e){let t=new rbe,n=this.connectionContext.signal,r=()=>{t.fail(n.reason??Error(`ACP connection closed`))};n.aborted?r():n.addEventListener(`abort`,r);let i=xbe(this.connectionContext).attach(e,t),a=new Ow(()=>{n.removeEventListener(`abort`,r)});return obe.create(this,e,t,[i,a])}request(e,t,n){let r=mbe[e];return this.sendRequest(e,t,r?.mapResponse,n)}notify(e,t){return this.sendNotification(e,t)}},Qye=class{connection;constructor(e){this.connection=e}get signal(){return this.connection.signal}get closed(){return this.connection.closed}close(e){this.connection.close(e)}},$ye=class extends Qye{connectHandlers;client;didStartConnectHandlers=!1;constructor(e,t=[]){super(e),this.connectHandlers=t,this.client=Zye.create(e.getContext())}startConnectHandlers(){this.didStartConnectHandlers||(this.didStartConnectHandlers=!0,Iw(this,this.connectHandlers))}},ebe=class extends Qye{connectHandlers;agent;didStartConnectHandlers=!1;constructor(e,t=[]){super(e),this.connectHandlers=t,this.agent=Mw.create(e.getContext())}startConnectHandlers(){this.didStartConnectHandlers||(this.didStartConnectHandlers=!0,Iw(this,this.connectHandlers))}};function tbe(e,t=[]){return new $ye(e,t)}function nbe(e,t=[]){return new ebe(e,t)}var rbe=class{values=[];waiters=[];failed=!1;failure;enqueue(e){if(this.failed)return;let t=this.waiters.shift();t?t.resolve(e):this.values.push({kind:`value`,value:e})}reject(e){if(!this.failed){if(this.waiters.length>0){for(let t of this.waiters.splice(0))t.reject(e);return}this.values.push({kind:`error`,error:e})}}clearErrors(){this.values=this.values.filter(e=>e.kind===`value`)}fail(e){if(!this.failed){this.failed=!0,this.failure=e;for(let t of this.waiters.splice(0))t.reject(e)}}next(){if(this.values.length>0){let e=this.values.shift();return e.kind===`error`?Promise.reject(e.error):Promise.resolve(e.value)}return this.failed?Promise.reject(this.failure):new Promise((e,t)=>{this.waiters.push({resolve:e,reject:t})})}};function ibe(e){return{...e,additionalDirectories:e.additionalDirectories?[...e.additionalDirectories]:void 0,mcpServers:[...e.mcpServers]}}var abe=class e{cx;request;constructor(e,t){this.cx=e,this.request=ibe(t)}static create(t,n){return new e(t,n)}toRequest(){return ibe(this.request)}withAdditionalDirectories(e){return this.request={...this.request,additionalDirectories:[...e]},this}withMcpServer(e){return this.request={...this.request,mcpServers:[...this.request.mcpServers,e]},this}async start(e){return this.cx[Yye](this.toRequest(),e)}async withSession(e){let t=await this.start();try{return await e(t)}finally{t.dispose()}}},obe=class e{cx;sessionResponse;updates;registrations;constructor(e,t,n,r){this.cx=e,this.sessionResponse=t,this.updates=n,this.registrations=r}static create(t,n,r,i){return new e(t,n,r,i)}get sessionId(){return this.sessionResponse.sessionId}get modes(){return this.sessionResponse.modes}get meta(){return this.sessionResponse._meta}get newSessionResponse(){return this.sessionResponse}prompt(e,t){this.updates.clearErrors();let n=this.cx.request(XC.session_prompt,{sessionId:this.sessionId,prompt:this.promptBlocks(e)},t);return n.then(e=>{this.updates.enqueue({kind:`stop`,response:e,stopReason:e.stopReason})},e=>{this.updates.reject(e)}),n}nextUpdate(){return this.updates.next()}async readText(){let e=``;for(;;){let t=await this.nextUpdate();if(t.kind===`stop`)return e;let{update:n}=t;n.sessionUpdate===`agent_message_chunk`&&n.content.type===`text`&&(e+=n.content.text)}}dispose(){for(let e of this.registrations.splice(0))e.dispose();this.updates.fail(Error(`Active session disposed`))}[Symbol.dispose](){this.dispose()}promptBlocks(e){return typeof e==`string`?[{type:`text`,text:e}]:Array.isArray(e)?e:[e]}};function sbe(e,t){return e?typeof e==`function`?e(t):e.parse(t):t}function Nw(e,t,n){return{method:e,params:t,mapResponse:n}}function Pw(e,t){return{method:e,params:t}}function cbe(e,t,n,r){e.onReceiveRequest(t.method,e=>sbe(t.params,e),async(e,i,a)=>{let o=await r(n(e,a,i.signal,i.id));await i.respond(t.mapResponse?t.mapResponse(o):o)})}function lbe(e,t,n,r){e.onReceiveNotification(t.method,e=>sbe(t.params,e),(e,t)=>r(n(e,t,t.signal)))}function Fw(e){let t={};for(let n of Object.values(e))t[n.method]=n;return t}const ube={initialize:Nw(XC.initialize,Cve),newSession:Nw(XC.session_new,Pve),loadSession:Nw(XC.session_load,Fve,Aw),unstable_forkSession:Nw(XC.session_fork,Rve),listSessions:Nw(XC.session_list,Ive),deleteSession:Nw(XC.session_delete,Lve,Aw),resumeSession:Nw(XC.session_resume,zve),closeSession:Nw(XC.session_close,Bve,Aw),setSessionMode:Nw(XC.session_set_mode,Vve,Aw),setSessionConfigOption:Nw(XC.session_set_config_option,Hve),authenticate:Nw(XC.authenticate,wve,Aw),unstable_listProviders:Nw(XC.providers_list,Tve),unstable_setProvider:Nw(XC.providers_set,Eve,Aw),unstable_disableProvider:Nw(XC.providers_disable,Dve,Aw),logout:Nw(XC.logout,Ove,Aw),prompt:Nw(XC.session_prompt,Uve),unstable_startNes:Nw(XC.nes_start,Kve),unstable_suggestNes:Nw(XC.nes_suggest,rye),unstable_closeNes:Nw(XC.nes_close,iye,Aw)},dbe={cancel:Pw(XC.session_cancel,xye),unstable_didOpenDocument:Pw(XC.document_did_open,Sye),unstable_didChangeDocument:Pw(XC.document_did_change,wye),unstable_didCloseDocument:Pw(XC.document_did_close,Tye),unstable_didSaveDocument:Pw(XC.document_did_save,Eye),unstable_didFocusDocument:Pw(XC.document_did_focus,Dye),unstable_acceptNes:Pw(XC.nes_accept,Oye),unstable_rejectNes:Pw(XC.nes_reject,Aye)},fbe={requestPermission:Nw(ZC.session_request_permission,Rhe),writeTextFile:Nw(ZC.fs_write_text_file,ghe,Aw),readTextFile:Nw(ZC.fs_read_text_file,_he),createTerminal:Nw(ZC.terminal_create,Bhe),terminalOutput:Nw(ZC.terminal_output,Vhe),releaseTerminal:Nw(ZC.terminal_release,Hhe,Aw),waitForTerminalExit:Nw(ZC.terminal_wait_for_exit,Uhe),killTerminal:Nw(ZC.terminal_kill,Whe,Aw),unstable_createElicitation:Nw(ZC.elicitation_create,sge)},pbe={sessionUpdate:Pw(ZC.session_update,Cw),unstable_completeElicitation:Pw(ZC.elicitation_complete,ove)},mbe=Fw(ube);Fw(dbe);const hbe=Fw(fbe),gbe=Fw(pbe);function _be(e,t,n,r){return{params:e,requestId:r,signal:n,agent:t}}function vbe(e,t,n){return{params:e,signal:n,agent:t}}var ybe=class{activeSessions=new Map;handleMessage(e){if(e.kind!==`notification`||e.method!==ZC.session_update)return Ew.no(e);let t=Cw.parse(e.params),n={kind:`session_update`,notification:t,update:t.update},r=this.activeSessions.get(t.sessionId);if(r&&r.size>0)for(let e of r)e.enqueue(n);return Ew.no(e)}attach(e,t){let n=this.activeSessions.get(e.sessionId)??new Set;return n.add(t),this.activeSessions.set(e.sessionId,n),new Ow(()=>{n.delete(t),n.size===0&&this.activeSessions.delete(e.sessionId)})}};const bbe=new WeakMap;function xbe(e){let t=bbe.get(e);return t||(t=new ybe,bbe.set(e,t)),t}function Iw(e,t){for(let n of t){let t;try{t=n(e)}catch(t){throw e.close(t),t}Promise.resolve(t).catch(t=>{e.close(t)})}}const Sbe=Symbol(`appBuilder`),Cbe=Symbol(`runAgentConnectHandlers`),Lw=Symbol(`runClientConnectHandlers`);function wbe(e){return new Tbe(e)}var Tbe=class{builder=Uye.builder();connectHandlers=[];constructor(e={}){e.name&&this.builder.name(e.name),this.builder.withHandler({handleMessage:(e,t)=>xbe(t).handleMessage(e),describe:()=>`client-session-update-router`})}[Sbe](){return this.builder}[Lw](e){Iw(e,this.connectHandlers)}connect(e){return this.connectConnection(e).connection}connectWith(e,t){let{rawConnection:n,connection:r}=this.connectConnection(e);return n.runUntil(()=>t(r.agent))}onConnect(e){return this.connectHandlers.push(e),this}onRequest(e,t,n){if(n)return this.request({method:e,params:t},n);let r=hbe[e];if(!r)throw Error(`Unknown ACP request method '${e}'. Pass a params parser for custom methods.`);return this.request(r,t)}onNotification(e,t,n){if(n)return this.notification({method:e,params:t},n);let r=gbe[e];if(!r)throw Error(`Unknown ACP notification method '${e}'. Pass a params parser for custom methods.`);return this.notification(r,t)}request(e,t){return cbe(this.builder,e,(e,t,n,r)=>_be(e,Mw.create(t,r),n,r),t),this}notification(e,t){return lbe(this.builder,e,(e,t,n)=>vbe(e,Mw.create(t),n),t),this}connectConnection(e){if(qye(e)){let t=this.openStreamConnection(e);return this[Lw](t.connection),t}let[t,n]=Jye(),r=e[Sbe]().connect(n),i=tbe(r),a=this.openStreamConnection(t);a.rawConnection.closed.then(()=>i.close()),r.closed.then(()=>a.connection.close());try{e[Cbe](i),this[Lw](a.connection)}catch(e){throw i.close(e),a.connection.close(e),e}return a}openStreamConnection(e){let t=this.builder.connect(e);return{rawConnection:t,connection:nbe(t,this.connectHandlers)}}};XC.initialize,XC.authenticate,XC.providers_list,XC.providers_set,XC.providers_disable,XC.session_new,XC.session_load,XC.session_set_mode,XC.session_set_config_option,XC.session_prompt,XC.session_list,XC.session_delete,XC.session_fork,XC.session_resume,XC.session_close,XC.logout,XC.nes_start,XC.nes_suggest,XC.nes_close,XC.session_cancel,XC.nes_accept,XC.nes_reject,XC.document_did_open,XC.document_did_change,XC.document_did_close,XC.document_did_save,XC.document_did_focus,ZC.session_request_permission,ZC.fs_write_text_file,ZC.fs_read_text_file,ZC.terminal_create,ZC.terminal_output,ZC.terminal_release,ZC.terminal_wait_for_exit,ZC.terminal_kill,ZC.elicitation_create,ZC.session_update,ZC.elicitation_complete;function Ebe(e){return e.split(`
46
46
  `).slice(-10).join(`
@@ -1 +1 @@
1
- import{Bd as e,Cn as t,Fs as n,Go as r,Ia as i,No as a,Vt as o,Xn as s,cu as c,ql as l,vn as u}from"./md-manager-BGnqyqi1-Dk1RYEeF.mjs";import{$ as d,$a as f,$i as p,$n as m,$o as h,$r as g,$t as _,A as v,Aa as y,Ai as b,An as x,Ar as S,At as C,B as w,Ba as T,Bi as E,Bn as D,Br as O,Bt as k,C as A,Ca as j,Ci as M,Cn as N,Cr as P,Ct as F,D as I,Da as L,Di as R,Dn as z,Dr as B,Dt as V,E as H,Ea as U,Ei as W,En as G,Er as K,Et as q,F as J,Fa as Y,Fi as X,Fn as Z,Fr as Q,Ft as $,G as ee,Ga as te,Gi as ne,Gn as re,Gr as ie,Gt as ae,H as oe,Ha as se,Hi as ce,Hn as le,Hr as ue,Ht as de,I as fe,Ia as pe,Ii as me,In as he,Ir as ge,It as _e,J as ve,Ja as ye,Ji as be,Jn as xe,Jo as Se,Jr as Ce,Jt as we,K as Te,Ka as Ee,Ki as De,Kn as Oe,Kr as ke,Kt as Ae,L as je,La as Me,Li as Ne,Ln as Pe,Lr as Fe,Lt as Ie,M as Le,Ma as Re,Mi as ze,Mn as Be,Mr as Ve,Mt as He,N as Ue,Na as We,Ni as Ge,Nn as Ke,Nr as qe,Nt as Je,O as Ye,Oa as Xe,Oi as Ze,On as Qe,Or as $e,Ot as et,P as tt,Pa as nt,Pi as rt,Pn as it,Pr as at,Pt as ot,Q as st,Qa as ct,Qi as lt,Qn as ut,Qo as dt,Qr as ft,Qt as pt,R as mt,Ra as ht,Ri as gt,Rn as _t,Rr as vt,Rt as yt,S as bt,Sa as xt,Si as St,Sn as Ct,So as wt,Sr as Tt,St as Et,T as Dt,Ta as Ot,Ti as kt,Tn as At,Tr as jt,Tt as Mt,U as Nt,Ua as Pt,Ui as Ft,Un as It,Ur as Lt,Ut as Rt,V as zt,Va as Bt,Vi as Vt,Vn as Ht,Vr as Ut,Vt as Wt,W as Gt,Wa as Kt,Wi as qt,Wn as Jt,Wr as Yt,Wt as Xt,X as Zt,Xa as Qt,Xi as $t,Xn as en,Xr as tn,Xt as nn,Y as rn,Ya as an,Yi as on,Yn as sn,Yr as cn,Yt as ln,Z as un,Za as dn,Zi as fn,Zn as pn,Zr as mn,Zt as hn,_ as gn,_a as _n,_i as vn,_n as yn,_o as bn,_r as xn,_t as Sn,a as Cn,aa as wn,ai as Tn,an as En,ao as Dn,ar as On,as as kn,at as An,b as jn,ba as Mn,bi as Nn,bn as Pn,bo as Fn,br as In,bt as Ln,c as Rn,ca as zn,ci as Bn,cn as Vn,co as Hn,cr as Un,ct as Wn,d as Gn,da as Kn,di as qn,dn as Jn,do as Yn,dr as Xn,dt as Zn,ea as Qn,ei as $n,en as er,eo as tr,er as nr,es as rr,et as ir,f as ar,fa as or,fi as sr,fn as cr,fo as lr,fr as ur,ft as dr,g as fr,ga as pr,gi as mr,gn as hr,go as gr,gr as _r,gt as vr,h as yr,ha as br,hi as xr,hn as Sr,ho as Cr,hr as wr,ht as Tr,i as Er,ia as Dr,ii as Or,in as kr,io as Ar,ir as jr,is as Mr,it as Nr,j as Pr,ja as Fr,ji as Ir,jn as Lr,jr as Rr,jt as zr,k as Br,ka as Vr,ki as Hr,kn as Ur,kr as Wr,kt as Gr,l as Kr,la as qr,li as Jr,ln as Yr,lo as Xr,lr as Zr,lt as Qr,m as $r,ma as ei,mi as ti,mn as ni,mo as ri,mr as ii,mt as ai,n as oi,na as si,ni as ci,nn as li,no as ui,nr as di,ns as fi,nt as pi,o as mi,oa as hi,oi as gi,on as _i,oo as vi,or as yi,os as bi,ot as xi,p as Si,pa as Ci,pi as wi,pn as Ti,po as Ei,pr as Di,pt as Oi,q as ki,qa as Ai,qi as ji,qn as Mi,qo as Ni,qr as Pi,qt as Fi,r as Ii,ra as Li,ri as Ri,rn as zi,ro as Bi,rr as Vi,rs as Hi,rt as Ui,s as Wi,sa as Gi,si as Ki,sn as qi,so as Ji,sr as Yi,st as Xi,t as Zi,ta as Qi,ti as $i,tn as ea,to as ta,tr as na,ts as ra,tt as ia,u as aa,ua as oa,ui as sa,un as ca,uo as la,ur as ua,ut as da,v as fa,va as pa,vi as ma,vn as ha,vo as ga,vr as _a,vt as va,w as ya,wa as ba,wi as xa,wn as Sa,wr as Ca,wt as wa,x as Ta,xa as Ea,xi as Da,xn as Oa,xo as ka,xr as Aa,xt as ja,y as Ma,ya as Na,yi as Pa,yn as Fa,yo as Ia,yr as La,yt as Ra,z as za,za as Ba,zi as Va,zn as Ha,zr as Ua,zt as Wa}from"./dist-DWl9h_wU.mjs";export{Zi as AGENT_ID_MAX_LEN,oi as AGENT_ID_RE,Ii as AGENT_WRITE_ORIGIN,Er as AcpPermissionStore,Cn as AcpRegistry,mi as AcpThreadManager,Wi as AgentFocusBroadcaster,Rn as AgentPresenceBroadcaster,Kr as AgentSessionCapacityError,aa as AgentSessionManager,Gn as AutoStartDisabledError,ar as BUNDLE_IDS,Si as BUNDLE_SCOPE,$r as BUNDLE_SKILL_NAME,yr as BacklinkIndex,fr as CC1Broadcaster,l as CC1_CONTRACT_VERSION,gn as CONCURRENT_REPLACE_WINDOW_MS,fa as CONFIG_FILENAME,Ma as CONFLICT_MARKER_RE,jn as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ta as ConfigSchema,bt as ConflictAuthority,A as DEFAULT_CHECKPOINT_RETENTION,ya as DEFAULT_EMBEDDINGS_DIMENSIONS,Dt as DEFAULT_PACK_ID,H as DocumentDurabilityState,I as DocumentDurabilityStateError,Ye as EMBEDDINGS_API_KEY_ENV,Br as EPHEMERAL_PROJECT_DIR_PREFIX,v as ExposureConsentError,Pr as FEATURED_AGENT_IDS,Le as FILE_SYSTEM_WRITER,Ue as FILE_WATCHER_ORIGIN,tt as FileEmbeddingsBackend,J as GIT_PREFLIGHT_FAIL_SPAN_NAME,fe as GIT_UPSTREAM_WRITER,Ni as GitDirAccessError,je as GitNotAvailableError,mt as GitTooOldError,za as HOCUSPOCUS_AUTH_REJECTION_REASONS,w as HocuspocusAuthRejection,zt as HocuspocusAuthTokenSchema,oe as HomeProjectRootError,Nt as INSTALLED_AGENTS_SCHEMES,Gt as JSON_SCHEMA_DIALECT_2020_12,o as LINEAGE_EPOCH_KEY,ee as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Te as MANAGED_RENAME_ORIGIN,ki as MAX_ACP_THREADS,ve as MAX_AGENT_SESSIONS,rn as MCP_CONNECTION_ID_HEADER,e as MCP_SERVER_NAME,Zt as MIN_EVICTABLE_IDLE_MS,un as MIN_GIT_VERSION,st as MISSING_OK_CONFIG_MESSAGE,Se as MalformedGitPointerError,d as McpLogger,ir as MissingOkConfigError,ia as OBSERVER_SYNC_ORIGIN,pi as OK_OKIGNORE_TEMPLATE,Ui as ONBOARDING_BUNDLE_IDS,u as ORPHAN_MODES,t as PROTOCOL_VERSION,dt as PinoLogger,Nr as ProcessLockCollisionError,An as ProjectGitInitError,xi as ROLLBACK_ORIGIN,Xi as ROOT_GITIGNORE_TEMPLATE,Wn as RUNTIME_VERSION,Qr as SERVICE_WRITER,da as SKILL_INSTALL_EVENTS_FILE_REL,s as SKILL_STATE_TARGETS,Zn as STARTER_FOLDER_FRONTMATTER_FILENAME,dr as STARTER_PACKS,Oi as STARTER_PACK_IDS,ai as STATE_MANIFEST_FILENAME,Tr as STATE_SCHEMA_VERSION,c as SYSTEM_DOC_NAME,vr as SeedPrerequisiteError,Sn as SeedRootDirError,va as ServerLockCollisionError,Ra as SingleFileNotAFileError,Ln as SingleFileNotFoundError,ja as SingleFileNotMarkdownError,Et as SingleFileProjectOverrideError,F as StateManifestError,wa as TagIndex,Mt as USER_GLOBAL_BUNDLE_IDS,q as __getShowAllWalkStatsForTesting,V as __resetShowAllWalkStatsForTesting,et as acpThreadStoreRoots,Gr as acpThreadsDir,C as acquireProcessLock,zr as acquireServerLock,He as applyAgentMarkdownWrite,Je as applyExternalChange,ot as applySeed,$ as assertCompatibleStateManifest,_e as assertGitAvailable,Ie as assertNeverDiskEvent,yt as assertNotHomeProjectRoot,Wa as attachAcpThreadSocket,k as attachCollabClientCounter,Wt as attachIdleShutdown,de as bindConflictAuthority,Rt as bootServer,Xt as buildAndOpenSkill,ae as buildConfigYmlContent,Ae as buildExecResult,Fi as buildIngressPolicy,we as buildOkMcpStdioCommand,ln as buildSkillZip,nn as buildStarterFolderFrontmatterYaml,hn as buildWipTree,pt as bundleSkillMdPath,_ as canonicalProjectKey,er as canonicalizeForCompare,ea as classifyEvents,li as classifyFsPath,zi as clearAllEmbeddingsKeys,kr as coercePackId,En as collectServerHostSnapshot,i as colorFromSeed,_i as commitUpstreamImport,qi as commitWip,Vn as commitWipFromTree,Yr as compareSemver,ca as composeEffectiveLinterConfig,Jn as composeFrontmatterSchemasConfig,cr as containsConflictMarkers,Ti as contentHash,ni as contributorCount,Sr as countShadowObjects,hr as countStaleAgentWipRefs,yn as countWipRefs,ha as createApiExtension,Fa as createAssetServeMiddleware,Pn as createCollaborationHost,Oa as createContentFilter,Ct as createContentFilterAsync,N as createEmbeddingsSecretStore,Sa as createEphemeralProjectDir,At as createExternalChangeHandler,G as createFileLogger,z as createLiveDerivedIndexExtension,Qe as createMcpHttpHandler,Ur as createOsProbe,x as createPersistenceExtension,Lr as createProbeFailureReporter,Be as createServer,Ke as createServerObserverExtension,it as createServerProbeResolver,Z as createStreamingErrorWriter,h as createTestLogger,he as describeStoredEmbeddingsKey,Pe as detectClaudeDesktopPresence,_t as detectGit,Ha as detectProjectShape,D as detectUserSkillHosts,Ht as discoverLockDirs,le as discoverMarkdownlintConfig,It as emitPreflightFailureSpan,Jt as encodeDocName,re as encodeFolderRoute,Oe as encodeSkillRoute,Mi as ensureProjectGit,xe as errorResponse,sn as evictStaleTrackerEntries,en as extractHeadings,pn as extractOkBinaryPath,ut as extractWikiLinksFromMarkdown,m as fallbackPaths,nr as findEnclosingGitRoot,na as findEnclosingProjectRoot,di as findNativeMarkdownlintFile,Vi as flushFileLogger,jr as formatAuditBrokenLinkSuppressionLine,On as formatAuthRejectionWire,yi as formatContributorsFrom,Yi as formatPackRationale,Un as gcCheckpointRefs,Zr as getCurrentMcpLogger,ua as getIngressContext,Xn as getLocalDir,ur as getLogFilePath,rr as getLogger,Di as getLogsDir,ii as getMachineId,wr as getMeter,_r as getMetrics,xn as getTracer,_a as handleCollabSocketError,La as handleSpawnCursor,In as hasForwardingHeaders,Aa as hasGcLogLatch,a as iconFromClientName,Tt as incrementCollabSocketFilteredError,P as incrementServerObserverFire,Ca as initContent,jt as initShadowRepo,K as initTelemetry,B as initToleranceTelemetryWriter,$e as installJsonSchemaDialect,Wr as installPrettyZodErrors,ra as installTestLoggers,S as installUserSkill,Rr as isAllowedApiOrigin,Ve as isAllowedWorkspaceHostHeader,qe as isConfigDoc,at as isDefunctProcess,Q as isDocInConflict,ge as isHocuspocusAuthRejectionReason,Fe as isHomeDir,vt as isHostAdmitted,Ua as isKnownPackId,O as isLinkIndexExcludedDoc,Ut as isLockProcessRunning,ue as isLoopbackAddress,Lt as isManagedArtifactDoc,Yt as isMintedThreadId,ie as isOriginAdmitted,r as isOrphanMode,ke as isPairedWriteOrigin,Pi as isPathWithinDir,Ce as isPeerAdmitted,cn as isProcessAlive,tn as isProjectRoot,mn as isReservedForUserTree,ft as isSelfWrite,g as isSystemDoc,$n as isToleranceTelemetryEnabled,$i as isValidLockPid,ci as lastKnownHash,Ri as listRescueCheckpoints,Or as listStarterPacks,Tn as loadCustomAgents,gi as loadPrincipal,Ki as lockAdvertisesUi,Bn as lockBaseUrl,Jr as lockFilePath,fi as loggerFactory,sa as loginShapedUserinfoUser,Hi as logsCurrentPath,Mr as logsPreviousPath,qn as makeLazyEmbeddingsKeyStore,sr as markServerLockDraining,wi as mountMcpAndApi,ti as normalizeFsPath,xr as observeReadiness,mr as packageVersionMajorMinor,vn as parseAuthRejectionWire,ma as parseGitVersion,Pa as parseHocuspocusAuthToken,Nn as parseKeepaliveConnectionId,Da as pathToDocName,St as planSeed,M as prepareSingleFileOpen,xa as processCommand,kt as processUsage,W as readAgentBrowserTools,R as readAllTargets,Ze as readBundleDecision,Hr as readDeclaredGitHubHosts,b as readOriginGitHubRepo,Ir as readOwnNativeRules,ze as readProcessLock,Ge as readProcessLockDetailed,rt as readProcessState,X as readProjectHeadState,me as readProjectLocalSemanticConfig,Ne as readServerLock,gt as readServerPackageVersion,Va as readSkillInstallStateSnapshot,E as readStateManifest,Vt as readTargetRecordedAt,ce as readTargetVersion,Ft as reconcile,qt as recordContributor,ne as recordSkillInstallEvent,De as redactShareSubprocessStderr,ji as registerAllTools,be as registerWrite,on as releaseProcessLock,$t as releaseServerLock,fn as removeLastKnownHash,lt as removeProjectSkillGitignoreBlock,p as reportSkillInstall,Qn as resetMetrics,Qi as resolveBuiltinSkillHosts,n as resolveBundleEnabled,si as resolveBundledSkillDir,Li as resolveContentDir,Dr as resolveCursorBinaryDefault,wn as resolveCursorSpawnInvocation,hi as resolveEffectiveLinterConfig,Gi as resolveEmbeddingsCredential,zn as resolveGitHubAccountFromUrl,qr as resolveGitHubAuthHost,oa as resolveLockDir,Kn as resolveNativeConfigForDoc,or as resolveNativeMarkdownlintConfig,Ci as resolvePack,ei as resolvePackageVersion,br as resolveSkillInstallReportSettings,pr as resolveUiInfo,_n as restoreContributors,pa as rewriteMarkdownLinksForDocumentRename,Na as rewriteWikiLinksForDocumentRename,Mn as runAuthReposSubprocess,Ea as runAuthStatusSubprocess,xt as runCloneSubprocess,j as runDeviceFlowSubprocess,ba as runWithMcpLogger,Ot as safeContentPath,U as safeSubdir,L as safetyCheckpoint,Xe as sameGitHubLogin,Vr as sanitizeClientName,y as saveInMemoryCheckpoint,Fr as saveVersion,Re as scanLockProcesses,We as seedBasenameIndex,nt as seedEphemeralProjectDir,Y as serializeError,pe as setActiveSpanAttributes,Me as setupServerObservers,ht as shadowGit,Ba as shutdownTelemetry,kn as spansCurrentPath,bi as spansPreviousPath,T as spawnDetached,Bt as splitMarkdownBlocks,se as startWatcher,Pt as strategiesFor,Kt as streamedChunkOf,te as streamingProblemEvent,Ee as swapContributors,Ai as teardownToleranceTelemetryWriter,ye as toBroadcasterKey,an as tracedAppendFileSync,Qt as tracedLinkSync,dn as tracedMkdir,ct as tracedMkdirSync,f as tracedRename,tr as tracedRenameSync,ta as tracedRmSync,ui as tracedRmdirSync,Bi as tracedUnlinkSync,Ar as tracedWriteFile,Dn as tracedWriteFileSync,vi as trustSystemCertificates,Ji as updateLastKnownHash,Hn as updateProcessLockPort,Xr as updateServerLockPort,la as validateAgentId,Yn as validateCloneInputs,lr as validateSkillZip,Ei as waitForServerLockDrain,ri as withHiddenWindowsConsole,Cr as withSpan,gr as withSpanSync,bn as writeBundleDecision,ga as writeMarkdownlintRule,Ia as writeRootGitignoreForNewRepo,Fn as writeStateManifest,ka as writeTargetVersion,wt as writeTracker};
1
+ import{Bd as e,Cn as t,Fs as n,Go as r,Ia as i,No as a,Vt as o,Xn as s,cu as c,ql as l,vn as u}from"./md-manager-BGnqyqi1-Dk1RYEeF.mjs";import{$ as d,$a as f,$i as p,$n as m,$o as h,$r as g,$t as _,A as v,Aa as y,Ai as b,An as x,Ar as S,At as C,B as w,Ba as T,Bi as E,Bn as D,Br as O,Bt as k,C as A,Ca as j,Ci as M,Cn as N,Cr as P,Ct as F,D as I,Da as L,Di as R,Dn as z,Dr as B,Dt as V,E as H,Ea as U,Ei as W,En as G,Er as K,Et as q,F as J,Fa as Y,Fi as X,Fn as Z,Fr as Q,Ft as $,G as ee,Ga as te,Gi as ne,Gn as re,Gr as ie,Gt as ae,H as oe,Ha as se,Hi as ce,Hn as le,Hr as ue,Ht as de,I as fe,Ia as pe,Ii as me,In as he,Ir as ge,It as _e,J as ve,Ja as ye,Ji as be,Jn as xe,Jo as Se,Jr as Ce,Jt as we,K as Te,Ka as Ee,Ki as De,Kn as Oe,Kr as ke,Kt as Ae,L as je,La as Me,Li as Ne,Ln as Pe,Lr as Fe,Lt as Ie,M as Le,Ma as Re,Mi as ze,Mn as Be,Mr as Ve,Mt as He,N as Ue,Na as We,Ni as Ge,Nn as Ke,Nr as qe,Nt as Je,O as Ye,Oa as Xe,Oi as Ze,On as Qe,Or as $e,Ot as et,P as tt,Pa as nt,Pi as rt,Pn as it,Pr as at,Pt as ot,Q as st,Qa as ct,Qi as lt,Qn as ut,Qo as dt,Qr as ft,Qt as pt,R as mt,Ra as ht,Ri as gt,Rn as _t,Rr as vt,Rt as yt,S as bt,Sa as xt,Si as St,Sn as Ct,So as wt,Sr as Tt,St as Et,T as Dt,Ta as Ot,Ti as kt,Tn as At,Tr as jt,Tt as Mt,U as Nt,Ua as Pt,Ui as Ft,Un as It,Ur as Lt,Ut as Rt,V as zt,Va as Bt,Vi as Vt,Vn as Ht,Vr as Ut,Vt as Wt,W as Gt,Wa as Kt,Wi as qt,Wn as Jt,Wr as Yt,Wt as Xt,X as Zt,Xa as Qt,Xi as $t,Xn as en,Xr as tn,Xt as nn,Y as rn,Ya as an,Yi as on,Yn as sn,Yr as cn,Yt as ln,Z as un,Za as dn,Zi as fn,Zn as pn,Zr as mn,Zt as hn,_ as gn,_a as _n,_i as vn,_n as yn,_o as bn,_r as xn,_t as Sn,a as Cn,aa as wn,ai as Tn,an as En,ao as Dn,ar as On,as as kn,at as An,b as jn,ba as Mn,bi as Nn,bn as Pn,bo as Fn,br as In,bt as Ln,c as Rn,ca as zn,ci as Bn,cn as Vn,co as Hn,cr as Un,ct as Wn,d as Gn,da as Kn,di as qn,dn as Jn,do as Yn,dr as Xn,dt as Zn,ea as Qn,ei as $n,en as er,eo as tr,er as nr,es as rr,et as ir,f as ar,fa as or,fi as sr,fn as cr,fo as lr,fr as ur,ft as dr,g as fr,ga as pr,gi as mr,gn as hr,go as gr,gr as _r,gt as vr,h as yr,ha as br,hi as xr,hn as Sr,ho as Cr,hr as wr,ht as Tr,i as Er,ia as Dr,ii as Or,in as kr,io as Ar,ir as jr,is as Mr,it as Nr,j as Pr,ja as Fr,ji as Ir,jn as Lr,jr as Rr,jt as zr,k as Br,ka as Vr,ki as Hr,kn as Ur,kr as Wr,kt as Gr,l as Kr,la as qr,li as Jr,ln as Yr,lo as Xr,lr as Zr,lt as Qr,m as $r,ma as ei,mi as ti,mn as ni,mo as ri,mr as ii,mt as ai,n as oi,na as si,ni as ci,nn as li,no as ui,nr as di,ns as fi,nt as pi,o as mi,oa as hi,oi as gi,on as _i,oo as vi,or as yi,os as bi,ot as xi,p as Si,pa as Ci,pi as wi,pn as Ti,po as Ei,pr as Di,pt as Oi,q as ki,qa as Ai,qi as ji,qn as Mi,qo as Ni,qr as Pi,qt as Fi,r as Ii,ra as Li,ri as Ri,rn as zi,ro as Bi,rr as Vi,rs as Hi,rt as Ui,s as Wi,sa as Gi,si as Ki,sn as qi,so as Ji,sr as Yi,st as Xi,t as Zi,ta as Qi,ti as $i,tn as ea,to as ta,tr as na,ts as ra,tt as ia,u as aa,ua as oa,ui as sa,un as ca,uo as la,ur as ua,ut as da,v as fa,va as pa,vi as ma,vn as ha,vo as ga,vr as _a,vt as va,w as ya,wa as ba,wi as xa,wn as Sa,wr as Ca,wt as wa,x as Ta,xa as Ea,xi as Da,xn as Oa,xo as ka,xr as Aa,xt as ja,y as Ma,ya as Na,yi as Pa,yn as Fa,yo as Ia,yr as La,yt as Ra,z as za,za as Ba,zi as Va,zn as Ha,zr as Ua,zt as Wa}from"./dist-BUgYLrP6.mjs";export{Zi as AGENT_ID_MAX_LEN,oi as AGENT_ID_RE,Ii as AGENT_WRITE_ORIGIN,Er as AcpPermissionStore,Cn as AcpRegistry,mi as AcpThreadManager,Wi as AgentFocusBroadcaster,Rn as AgentPresenceBroadcaster,Kr as AgentSessionCapacityError,aa as AgentSessionManager,Gn as AutoStartDisabledError,ar as BUNDLE_IDS,Si as BUNDLE_SCOPE,$r as BUNDLE_SKILL_NAME,yr as BacklinkIndex,fr as CC1Broadcaster,l as CC1_CONTRACT_VERSION,gn as CONCURRENT_REPLACE_WINDOW_MS,fa as CONFIG_FILENAME,Ma as CONFLICT_MARKER_RE,jn as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ta as ConfigSchema,bt as ConflictAuthority,A as DEFAULT_CHECKPOINT_RETENTION,ya as DEFAULT_EMBEDDINGS_DIMENSIONS,Dt as DEFAULT_PACK_ID,H as DocumentDurabilityState,I as DocumentDurabilityStateError,Ye as EMBEDDINGS_API_KEY_ENV,Br as EPHEMERAL_PROJECT_DIR_PREFIX,v as ExposureConsentError,Pr as FEATURED_AGENT_IDS,Le as FILE_SYSTEM_WRITER,Ue as FILE_WATCHER_ORIGIN,tt as FileEmbeddingsBackend,J as GIT_PREFLIGHT_FAIL_SPAN_NAME,fe as GIT_UPSTREAM_WRITER,Ni as GitDirAccessError,je as GitNotAvailableError,mt as GitTooOldError,za as HOCUSPOCUS_AUTH_REJECTION_REASONS,w as HocuspocusAuthRejection,zt as HocuspocusAuthTokenSchema,oe as HomeProjectRootError,Nt as INSTALLED_AGENTS_SCHEMES,Gt as JSON_SCHEMA_DIALECT_2020_12,o as LINEAGE_EPOCH_KEY,ee as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Te as MANAGED_RENAME_ORIGIN,ki as MAX_ACP_THREADS,ve as MAX_AGENT_SESSIONS,rn as MCP_CONNECTION_ID_HEADER,e as MCP_SERVER_NAME,Zt as MIN_EVICTABLE_IDLE_MS,un as MIN_GIT_VERSION,st as MISSING_OK_CONFIG_MESSAGE,Se as MalformedGitPointerError,d as McpLogger,ir as MissingOkConfigError,ia as OBSERVER_SYNC_ORIGIN,pi as OK_OKIGNORE_TEMPLATE,Ui as ONBOARDING_BUNDLE_IDS,u as ORPHAN_MODES,t as PROTOCOL_VERSION,dt as PinoLogger,Nr as ProcessLockCollisionError,An as ProjectGitInitError,xi as ROLLBACK_ORIGIN,Xi as ROOT_GITIGNORE_TEMPLATE,Wn as RUNTIME_VERSION,Qr as SERVICE_WRITER,da as SKILL_INSTALL_EVENTS_FILE_REL,s as SKILL_STATE_TARGETS,Zn as STARTER_FOLDER_FRONTMATTER_FILENAME,dr as STARTER_PACKS,Oi as STARTER_PACK_IDS,ai as STATE_MANIFEST_FILENAME,Tr as STATE_SCHEMA_VERSION,c as SYSTEM_DOC_NAME,vr as SeedPrerequisiteError,Sn as SeedRootDirError,va as ServerLockCollisionError,Ra as SingleFileNotAFileError,Ln as SingleFileNotFoundError,ja as SingleFileNotMarkdownError,Et as SingleFileProjectOverrideError,F as StateManifestError,wa as TagIndex,Mt as USER_GLOBAL_BUNDLE_IDS,q as __getShowAllWalkStatsForTesting,V as __resetShowAllWalkStatsForTesting,et as acpThreadStoreRoots,Gr as acpThreadsDir,C as acquireProcessLock,zr as acquireServerLock,He as applyAgentMarkdownWrite,Je as applyExternalChange,ot as applySeed,$ as assertCompatibleStateManifest,_e as assertGitAvailable,Ie as assertNeverDiskEvent,yt as assertNotHomeProjectRoot,Wa as attachAcpThreadSocket,k as attachCollabClientCounter,Wt as attachIdleShutdown,de as bindConflictAuthority,Rt as bootServer,Xt as buildAndOpenSkill,ae as buildConfigYmlContent,Ae as buildExecResult,Fi as buildIngressPolicy,we as buildOkMcpStdioCommand,ln as buildSkillZip,nn as buildStarterFolderFrontmatterYaml,hn as buildWipTree,pt as bundleSkillMdPath,_ as canonicalProjectKey,er as canonicalizeForCompare,ea as classifyEvents,li as classifyFsPath,zi as clearAllEmbeddingsKeys,kr as coercePackId,En as collectServerHostSnapshot,i as colorFromSeed,_i as commitUpstreamImport,qi as commitWip,Vn as commitWipFromTree,Yr as compareSemver,ca as composeEffectiveLinterConfig,Jn as composeFrontmatterSchemasConfig,cr as containsConflictMarkers,Ti as contentHash,ni as contributorCount,Sr as countShadowObjects,hr as countStaleAgentWipRefs,yn as countWipRefs,ha as createApiExtension,Fa as createAssetServeMiddleware,Pn as createCollaborationHost,Oa as createContentFilter,Ct as createContentFilterAsync,N as createEmbeddingsSecretStore,Sa as createEphemeralProjectDir,At as createExternalChangeHandler,G as createFileLogger,z as createLiveDerivedIndexExtension,Qe as createMcpHttpHandler,Ur as createOsProbe,x as createPersistenceExtension,Lr as createProbeFailureReporter,Be as createServer,Ke as createServerObserverExtension,it as createServerProbeResolver,Z as createStreamingErrorWriter,h as createTestLogger,he as describeStoredEmbeddingsKey,Pe as detectClaudeDesktopPresence,_t as detectGit,Ha as detectProjectShape,D as detectUserSkillHosts,Ht as discoverLockDirs,le as discoverMarkdownlintConfig,It as emitPreflightFailureSpan,Jt as encodeDocName,re as encodeFolderRoute,Oe as encodeSkillRoute,Mi as ensureProjectGit,xe as errorResponse,sn as evictStaleTrackerEntries,en as extractHeadings,pn as extractOkBinaryPath,ut as extractWikiLinksFromMarkdown,m as fallbackPaths,nr as findEnclosingGitRoot,na as findEnclosingProjectRoot,di as findNativeMarkdownlintFile,Vi as flushFileLogger,jr as formatAuditBrokenLinkSuppressionLine,On as formatAuthRejectionWire,yi as formatContributorsFrom,Yi as formatPackRationale,Un as gcCheckpointRefs,Zr as getCurrentMcpLogger,ua as getIngressContext,Xn as getLocalDir,ur as getLogFilePath,rr as getLogger,Di as getLogsDir,ii as getMachineId,wr as getMeter,_r as getMetrics,xn as getTracer,_a as handleCollabSocketError,La as handleSpawnCursor,In as hasForwardingHeaders,Aa as hasGcLogLatch,a as iconFromClientName,Tt as incrementCollabSocketFilteredError,P as incrementServerObserverFire,Ca as initContent,jt as initShadowRepo,K as initTelemetry,B as initToleranceTelemetryWriter,$e as installJsonSchemaDialect,Wr as installPrettyZodErrors,ra as installTestLoggers,S as installUserSkill,Rr as isAllowedApiOrigin,Ve as isAllowedWorkspaceHostHeader,qe as isConfigDoc,at as isDefunctProcess,Q as isDocInConflict,ge as isHocuspocusAuthRejectionReason,Fe as isHomeDir,vt as isHostAdmitted,Ua as isKnownPackId,O as isLinkIndexExcludedDoc,Ut as isLockProcessRunning,ue as isLoopbackAddress,Lt as isManagedArtifactDoc,Yt as isMintedThreadId,ie as isOriginAdmitted,r as isOrphanMode,ke as isPairedWriteOrigin,Pi as isPathWithinDir,Ce as isPeerAdmitted,cn as isProcessAlive,tn as isProjectRoot,mn as isReservedForUserTree,ft as isSelfWrite,g as isSystemDoc,$n as isToleranceTelemetryEnabled,$i as isValidLockPid,ci as lastKnownHash,Ri as listRescueCheckpoints,Or as listStarterPacks,Tn as loadCustomAgents,gi as loadPrincipal,Ki as lockAdvertisesUi,Bn as lockBaseUrl,Jr as lockFilePath,fi as loggerFactory,sa as loginShapedUserinfoUser,Hi as logsCurrentPath,Mr as logsPreviousPath,qn as makeLazyEmbeddingsKeyStore,sr as markServerLockDraining,wi as mountMcpAndApi,ti as normalizeFsPath,xr as observeReadiness,mr as packageVersionMajorMinor,vn as parseAuthRejectionWire,ma as parseGitVersion,Pa as parseHocuspocusAuthToken,Nn as parseKeepaliveConnectionId,Da as pathToDocName,St as planSeed,M as prepareSingleFileOpen,xa as processCommand,kt as processUsage,W as readAgentBrowserTools,R as readAllTargets,Ze as readBundleDecision,Hr as readDeclaredGitHubHosts,b as readOriginGitHubRepo,Ir as readOwnNativeRules,ze as readProcessLock,Ge as readProcessLockDetailed,rt as readProcessState,X as readProjectHeadState,me as readProjectLocalSemanticConfig,Ne as readServerLock,gt as readServerPackageVersion,Va as readSkillInstallStateSnapshot,E as readStateManifest,Vt as readTargetRecordedAt,ce as readTargetVersion,Ft as reconcile,qt as recordContributor,ne as recordSkillInstallEvent,De as redactShareSubprocessStderr,ji as registerAllTools,be as registerWrite,on as releaseProcessLock,$t as releaseServerLock,fn as removeLastKnownHash,lt as removeProjectSkillGitignoreBlock,p as reportSkillInstall,Qn as resetMetrics,Qi as resolveBuiltinSkillHosts,n as resolveBundleEnabled,si as resolveBundledSkillDir,Li as resolveContentDir,Dr as resolveCursorBinaryDefault,wn as resolveCursorSpawnInvocation,hi as resolveEffectiveLinterConfig,Gi as resolveEmbeddingsCredential,zn as resolveGitHubAccountFromUrl,qr as resolveGitHubAuthHost,oa as resolveLockDir,Kn as resolveNativeConfigForDoc,or as resolveNativeMarkdownlintConfig,Ci as resolvePack,ei as resolvePackageVersion,br as resolveSkillInstallReportSettings,pr as resolveUiInfo,_n as restoreContributors,pa as rewriteMarkdownLinksForDocumentRename,Na as rewriteWikiLinksForDocumentRename,Mn as runAuthReposSubprocess,Ea as runAuthStatusSubprocess,xt as runCloneSubprocess,j as runDeviceFlowSubprocess,ba as runWithMcpLogger,Ot as safeContentPath,U as safeSubdir,L as safetyCheckpoint,Xe as sameGitHubLogin,Vr as sanitizeClientName,y as saveInMemoryCheckpoint,Fr as saveVersion,Re as scanLockProcesses,We as seedBasenameIndex,nt as seedEphemeralProjectDir,Y as serializeError,pe as setActiveSpanAttributes,Me as setupServerObservers,ht as shadowGit,Ba as shutdownTelemetry,kn as spansCurrentPath,bi as spansPreviousPath,T as spawnDetached,Bt as splitMarkdownBlocks,se as startWatcher,Pt as strategiesFor,Kt as streamedChunkOf,te as streamingProblemEvent,Ee as swapContributors,Ai as teardownToleranceTelemetryWriter,ye as toBroadcasterKey,an as tracedAppendFileSync,Qt as tracedLinkSync,dn as tracedMkdir,ct as tracedMkdirSync,f as tracedRename,tr as tracedRenameSync,ta as tracedRmSync,ui as tracedRmdirSync,Bi as tracedUnlinkSync,Ar as tracedWriteFile,Dn as tracedWriteFileSync,vi as trustSystemCertificates,Ji as updateLastKnownHash,Hn as updateProcessLockPort,Xr as updateServerLockPort,la as validateAgentId,Yn as validateCloneInputs,lr as validateSkillZip,Ei as waitForServerLockDrain,ri as withHiddenWindowsConsole,Cr as withSpan,gr as withSpanSync,bn as writeBundleDecision,ga as writeMarkdownlintRule,Ia as writeRootGitignoreForNewRepo,Fn as writeStateManifest,ka as writeTargetVersion,wt as writeTracker};
package/dist/index.mjs CHANGED
@@ -185,7 +185,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
185
185
  `)].join(`
186
186
  `);case`REMOVED_KEY`:{let t=e.path.join(`.`),n=[`${e.source?`Removed key at ${e.source.file}:${e.source.line}:${e.source.column}`:`Removed key in configuration`}: ${t}`,e.redirect];if(e.source?.snippet&&e.source.snippet.length>0)for(let t of e.source.snippet.split(`
187
187
  `))n.push(` ${t}`);return n.join(`
188
- `)}case`NOT_SYNCED`:return`Settings are still loading. Try again in a moment.`;case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}const Uc="Run `ok config migrate` to strip the obsolete key automatically, or remove it by hand.",Wc=[{path:[`content`,`include`],redirect:[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,Uc].join(` `)},{path:[`content`,`exclude`],redirect:[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,Uc].join(` `)},{path:[`folders`],redirect:[`folders is no longer a top-level config field.`,"A folder's own frontmatter (open-shape, like a doc's) lives in nested `<folder>/.ok/frontmatter.yml`; new-doc starting properties come from templates in `<folder>/.ok/templates/`.","Edit via the folder overview in the editor sidebar, or `edit({ folder: { path, frontmatter } })` via the MCP.",Uc].join(` `)},{path:[`appearance`,`editorModeDefault`],redirect:[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,Uc].join(` `)},{path:[`upload`,`maxBytes`],redirect:[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,Uc].join(` `)},{path:[`github`,`oauthAppClientId`],redirect:[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,Uc].join(` `)},{path:[`server`,`host`],redirect:[`Use server.bind in .ok/config.yml instead — a list of bind addresses, e.g. [127.0.0.1]; a non-loopback bind additionally requires server.allowExternal.`,`The --bind CLI flag and HOST environment variable also remain available.`,Uc].join(` `)},{path:[`remote`,`url`],redirect:[`remote.url has been removed. Use server.externalUrl in .ok/config.yml instead (the public origin your tunnel serves).`,Uc].join(` `)},{path:[`remote`,`port`],redirect:[`remote.port has been removed. Use server.port in .ok/config.yml instead.`,Uc].join(` `)},{path:[`server`,`publicUrl`],redirect:[`server.publicUrl has been removed. Use server.externalUrl in .ok/config.yml instead (the same key under its current name).`,Uc].join(` `)},{path:[`server`,`openOnAgentEdit`],redirect:[`This behavior was removed; the value is hardcoded.`,Uc].join(` `)},{path:[`mcp`,`autoStart`],redirect:[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,Uc].join(` `)},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],redirect:[`This value is hardcoded in @inkeep/open-knowledge-core.`,Uc].join(` `)},{path:[`mcp`,`tools`,`grep`,`maxResults`],redirect:[`This value is hardcoded in @inkeep/open-knowledge-core.`,Uc].join(` `)},{path:[`mcp`,`tools`,`search`,`maxResults`],redirect:[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,Uc].join(` `)},{path:[`preview`,`baseUrl`],redirect:["preview URLs now resolve only to the running server — start one with `ok start`.",Uc].join(` `)},{path:[`preview`,`scriptSrc`],redirect:[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,Uc].join(` `)},{path:[`appearance`,`sidebar`,`showAllFiles`],redirect:[`appearance.sidebar.showAllFiles has been removed.`,`The sidebar lists every file on disk by default; dot-prefixed entries are gated by appearance.sidebar.showHiddenFiles, and appearance.sidebar.showOnlyMarkdownFiles scopes the tree down to markdown documents as a per-machine view preference.`,Uc].join(` `)}];function Gc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kc(e,t){let n=e;for(let e=0;e<t.length-1;e++){if(!Gc(n))return!1;n=n[t[e]]}return Gc(n)?t[t.length-1]in n:!1}function qc(e){let{value:t,file:n,source:r,doc:i}=e;if(!Gc(t))return[];let a=[];for(let e of Wc){if(!Kc(t,e.path))continue;let o;i!=null&&r!=null&&n!=null&&(o=Tc({file:n,source:r,doc:i,path:e.path})),a.push({code:`REMOVED_KEY`,path:e.path,redirect:e.redirect,...o===void 0?{}:{source:o}})}return a}function Jc(e,t){let[n,...r]=t;if(n===void 0)return e;let i={...e};if(r.length===0)return delete i[n],i;let a=i[n];return Gc(a)&&(i[n]=Jc(a,r)),i}function Yc(e){if(!Gc(e))return e;let t=e;for(let e of Wc)Kc(t,e.path)&&(t=Jc(t,e.path));return t}const Xc=`acp-launch-failures.log`,Zc=`last-server-exit.json`,Qc=`last-server-crash.json`;function $c(e){try{let t=Intl.getCanonicalLocales(e)[0];return t===void 0?null:t}catch{return null}}function el(e){try{let t=Intl.getCanonicalLocales(e)[0];if(t===void 0)return null;let n=new Intl.Locale(t).maximize();return!n.language||!n.script?null:`${n.language}-${n.script}`}catch{return null}}function tl(e){return new Promise(t=>{setTimeout(t,e)})}const nl=`local`,rl=[`principal.json`,`state.json`,`server.lock`,`ui.lock`,`sync-state.json`,`conflicts.json`,`last-spawn-error.log`],il=[nl,`worktrees`],al=[...il,`cache`,`tmp`],ol=new Set(il),sl=al.filter(e=>!ol.has(e));function cl(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=Tc({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function ll(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return D(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function ul(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n))return;n=Reflect.get(n,e)}return n}function dl(e){let t=[],n=[[`maxBatchSize`,1,uc],[`maxBatchChars`,1,dc],[`docTimeoutMs`,1,fc]];for(let[r,i,a]of n){let n=[`search`,`semantic`,r],o=ul(e.rawConfig,n),s=e.config.search.semantic[r];if(o===void 0||o===s)continue;let c=`Expected an integer between ${i} and ${a}; using default ${s}.`,l=Tc({file:e.absPath,source:e.source,doc:e.doc,path:n});t.push({path:n,message:c,...l===void 0?{}:{source:{file:l.file,line:l.line,column:l.column}}})}return t.length>0?[{code:`VALUE_FALLBACK`,issues:t}]:[]}function fl(e){let t=ul(e.rawConfig,[`git`,`hosts`]);if(t===void 0)return[];let n=Hre.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`git`,`hosts`,...t.path.map(String)],r=Tc({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:`${t.message}; ignoring this git-host declaration.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function pl(e){let t=ul(e.rawConfig,[`autolinks`]);if(t===void 0)return[];let n=bie.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`autolinks`,...t.path.map(String)],r=Tc({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:t.path.length===0?`${t.message}; ignoring autolinks.`:`${t.message}; ignoring this autolink entry.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function ml(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=vc.parse({});if(!g(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=S(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,hs.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?ll(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=qc({value:c,file:t,source:o,doc:s}),u=l.length>0?Yc(c):c,d=[...fl({rawConfig:u,doc:s,source:o,absPath:t}),...pl({rawConfig:u,doc:s,source:o,absPath:t})];for(let e of d)for(let n of e.issues)i(`[config] ${t} ${n.path.join(`.`)}: ${n.message}`);let f=vc.safeParse(u);if(!f.success){let e=cl(f,s,o,t),c=vc.shape.git.safeParse(ul(u,[`git`])).data??a.git,p=Object.keys(c.hosts).length>0?`Using schema defaults while preserving valid git-host declarations.`:`Using schema defaults.`;i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). ${p}`+(n?``:` Pass-through mode: file left in place.`));let m=n?ll(t,r,i):void 0,h=[...l,...d,...zc(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]];return{valid:!1,value:{...a,git:c},error:e,diagnostics:h,...m===void 0?{}:{sidelinedTo:m}}}let p=[...l,...d,...dl({rawConfig:u,config:f.data,doc:s,source:o,absPath:t})];return{valid:!0,value:f.data,source:t,diagnostics:p}}const hl=`.tmp.`,gl=[8,4,4,4,12];function _l(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const vl=gl.map(e=>`[0-9a-f]`.repeat(e)).join(`-`),yl=gl.map(e=>`[0-9a-f]{${e}}`).join(`-`),bl=`*${hl}${vl}`;RegExp(`${_l(hl)}${yl}$`);function xl(e){return`${e}${hl}${Oe()}`}function Sl(e){try{let t=M(e),n=`${me(e)}${hl}`,r=Date.now()-3e4;for(let e of w(t)){if(!e.startsWith(n))continue;let i=N(t,e);try{te(i).mtimeMs<r&&ne(i)}catch{}}}catch{}}function Cl(e,t,n={}){Sl(e);let r=xl(e);try{re(r,t,{encoding:`utf-8`,mode:n.mode??420}),D(r,e)}catch(e){try{ne(r)}catch{}throw e}}var wl=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function Tl(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=te(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{ne(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new wl(e,r);await tl(i);continue}try{return await t()}finally{try{f(s)}catch{}try{ne(e)}catch{}}}}function El(e){let t=Date.now()+e;for(;Date.now()<t;);}function Dl(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=te(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{ne(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new wl(e,r);El(i);continue}try{return t()}finally{try{f(s)}catch{}try{ne(e)}catch{}}}}const Ol=`config.yml`;function kl(e,t,n){if(e===`user`){let e=n??k();return be(e,`.ok`,`global.yml`)}let r=ge(t)?t:be(t);return e===`project-local`?be(r,`.ok`,nl,Ol):be(r,`.ok`,Ol)}const Al=[`LC_ALL`,`LC_MESSAGES`,`LANG`];function jl(e){let t=e.trim().split(`@`)[0].split(`.`)[0];return t===``||t===`C`||t===`POSIX`?null:$c(t.replaceAll(`_`,`-`))}function Ml(e){for(let t of Al){let n=e[t]?.trim();if(n!==void 0&&n!==``)return jl(n)}return null}function Nl(e){let t=e.OK_LANG?.trim();if(t!==void 0&&t!==``)return $c(t)??void 0}function Pl(e=process.env){let t=Nl(e),n=Ml(e);if(n===null)return{override:t,preferenceList:[]};let r=[],i=e.LANGUAGE;if(i!==void 0)for(let e of i.split(`:`)){let t=jl(e);t!==null&&r.push(t)}return{override:t,preferenceList:[...r,n]}}const Fl=`open-knowledge`;function Il(e){try{e()}catch{}}var Ll=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(Fl,e).getPassword()}catch(t){return Il(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return Il(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return Il(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(Fl,e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(Fl,e).deletePassword()}catch{}}},Rl=class{backend=`file`;authFile;constructor(e){this.authFile=e??N(k(),`.ok`,`auth.yml`)}read(){if(!g(this.authFile))return{};try{let e=S(this.authFile,`utf-8`);return(0,hs.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=M(this.authFile);g(t)||v(t,{recursive:!0,mode:448}),Cl(this.authFile,(0,hs.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},zl=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ~/.ok/auth.yml to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function Bl(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(Fl,`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
188
+ `)}case`NOT_SYNCED`:return`Settings are still loading. Try again in a moment.`;case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}const Uc="Run `ok config migrate` to strip the obsolete key automatically, or remove it by hand.",Wc=[{path:[`content`,`include`],redirect:[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,Uc].join(` `)},{path:[`content`,`exclude`],redirect:[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,Uc].join(` `)},{path:[`folders`],redirect:[`folders is no longer a top-level config field.`,"A folder's own frontmatter (open-shape, like a doc's) lives in nested `<folder>/.ok/frontmatter.yml`; new-doc starting properties come from templates in `<folder>/.ok/templates/`.","Edit via the folder overview in the editor sidebar, or `edit({ folder: { path, frontmatter } })` via the MCP.",Uc].join(` `)},{path:[`appearance`,`editorModeDefault`],redirect:[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,Uc].join(` `)},{path:[`upload`,`maxBytes`],redirect:[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,Uc].join(` `)},{path:[`github`,`oauthAppClientId`],redirect:[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,Uc].join(` `)},{path:[`server`,`host`],redirect:[`Use server.bind in .ok/config.yml instead — a list of bind addresses, e.g. [127.0.0.1]; a non-loopback bind additionally requires server.allowExternal.`,`The --bind CLI flag and HOST environment variable also remain available.`,Uc].join(` `)},{path:[`remote`,`url`],redirect:[`remote.url has been removed. Use server.externalUrl in .ok/config.yml instead (the public origin your tunnel serves).`,Uc].join(` `)},{path:[`remote`,`port`],redirect:[`remote.port has been removed. Use server.port in .ok/config.yml instead.`,Uc].join(` `)},{path:[`server`,`publicUrl`],redirect:[`server.publicUrl has been removed. Use server.externalUrl in .ok/config.yml instead (the same key under its current name).`,Uc].join(` `)},{path:[`server`,`openOnAgentEdit`],redirect:[`This behavior was removed; the value is hardcoded.`,Uc].join(` `)},{path:[`mcp`,`autoStart`],redirect:[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,Uc].join(` `)},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],redirect:[`This value is hardcoded in @inkeep/open-knowledge-core.`,Uc].join(` `)},{path:[`mcp`,`tools`,`grep`,`maxResults`],redirect:[`This value is hardcoded in @inkeep/open-knowledge-core.`,Uc].join(` `)},{path:[`mcp`,`tools`,`search`,`maxResults`],redirect:[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,Uc].join(` `)},{path:[`preview`,`baseUrl`],redirect:["preview URLs now resolve only to the running server — start one with `ok start`.",Uc].join(` `)},{path:[`preview`,`scriptSrc`],redirect:[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,Uc].join(` `)},{path:[`appearance`,`sidebar`,`showAllFiles`],redirect:[`appearance.sidebar.showAllFiles has been removed.`,`The sidebar lists every file on disk by default; dot-prefixed entries are gated by appearance.sidebar.showHiddenFiles, and appearance.sidebar.showOnlyMarkdownFiles scopes the tree down to markdown documents as a per-machine view preference.`,Uc].join(` `)}];function Gc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Kc(e,t){let n=e;for(let e=0;e<t.length-1;e++){if(!Gc(n))return!1;n=n[t[e]]}return Gc(n)?t[t.length-1]in n:!1}function qc(e){let{value:t,file:n,source:r,doc:i}=e;if(!Gc(t))return[];let a=[];for(let e of Wc){if(!Kc(t,e.path))continue;let o;i!=null&&r!=null&&n!=null&&(o=Tc({file:n,source:r,doc:i,path:e.path})),a.push({code:`REMOVED_KEY`,path:e.path,redirect:e.redirect,...o===void 0?{}:{source:o}})}return a}function Jc(e,t){let[n,...r]=t;if(n===void 0)return e;let i={...e};if(r.length===0)return delete i[n],i;let a=i[n];return Gc(a)&&(i[n]=Jc(a,r)),i}function Yc(e){if(!Gc(e))return e;let t=e;for(let e of Wc)Kc(t,e.path)&&(t=Jc(t,e.path));return t}const Xc=`acp-launch-failures.log`,Zc=`last-server-exit.json`,Qc=`last-server-crash.json`;function $c(e){try{let t=Intl.getCanonicalLocales(e)[0];return t===void 0?null:t}catch{return null}}function el(e){try{let t=Intl.getCanonicalLocales(e)[0];if(t===void 0)return null;let n=new Intl.Locale(t).maximize();return!n.language||!n.script?null:`${n.language}-${n.script}`}catch{return null}}function tl(e){return new Promise(t=>{setTimeout(t,e)})}const nl=`local`,rl=[`principal.json`,`state.json`,`server.lock`,`ui.lock`,`sync-state.json`,`conflicts.json`,`last-spawn-error.log`],il=[nl,`worktrees`],al=[...il,`cache`,`tmp`],ol=new Set(il),sl=al.filter(e=>!ol.has(e));function cl(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=Tc({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function ll(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return D(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function ul(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||Array.isArray(n))return;n=Reflect.get(n,e)}return n}function dl(e){let t=[],n=[[`maxBatchSize`,1,uc],[`maxBatchChars`,1,dc],[`docTimeoutMs`,1,fc]];for(let[r,i,a]of n){let n=[`search`,`semantic`,r],o=ul(e.rawConfig,n),s=e.config.search.semantic[r];if(o===void 0||o===s)continue;let c=`Expected an integer between ${i} and ${a}; using default ${s}.`,l=Tc({file:e.absPath,source:e.source,doc:e.doc,path:n});t.push({path:n,message:c,...l===void 0?{}:{source:{file:l.file,line:l.line,column:l.column}}})}return t.length>0?[{code:`VALUE_FALLBACK`,issues:t}]:[]}function fl(e){let t=ul(e.rawConfig,[`git`,`hosts`]);if(t===void 0)return[];let n=Hre.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`git`,`hosts`,...t.path.map(String)],r=Tc({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:`${t.message}; ignoring this git-host declaration.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function pl(e){let t=ul(e.rawConfig,[`autolinks`]);if(t===void 0)return[];let n=bie.safeParse(t);return n.success?[]:[{code:`VALUE_FALLBACK`,issues:n.error.issues.map(t=>{let n=[`autolinks`,...t.path.map(String)],r=Tc({file:e.absPath,source:e.source,doc:e.doc,path:n});return{path:n,message:t.path.length===0?`${t.message}; ignoring autolinks.`:`${t.message}; ignoring this autolink entry.`,...r===void 0?{}:{source:{file:r.file,line:r.line,column:r.column}}}})}]}function ml(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=vc.parse({});if(!g(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=S(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,hs.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?ll(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=qc({value:c,file:t,source:o,doc:s}),u=l.length>0?Yc(c):c,d=[...fl({rawConfig:u,doc:s,source:o,absPath:t}),...pl({rawConfig:u,doc:s,source:o,absPath:t})];for(let e of d)for(let n of e.issues)i(`[config] ${t} ${n.path.join(`.`)}: ${n.message}`);let f=vc.safeParse(u);if(!f.success){let e=cl(f,s,o,t),c=vc.shape.git.safeParse(ul(u,[`git`])).data??a.git,p=Object.keys(c.hosts).length>0?`Using schema defaults while preserving valid git-host declarations.`:`Using schema defaults.`;i(`[config] ${t} fails schema validation (${f.error.issues.length} issue(s)). ${p}`+(n?``:` Pass-through mode: file left in place.`));let m=n?ll(t,r,i):void 0,h=[...l,...d,...zc(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]];return{valid:!1,value:{...a,git:c},error:e,diagnostics:h,...m===void 0?{}:{sidelinedTo:m}}}let p=[...l,...d,...dl({rawConfig:u,config:f.data,doc:s,source:o,absPath:t})];return{valid:!0,value:f.data,source:t,diagnostics:p}}const hl=`.tmp.`,gl=[8,4,4,4,12];function _l(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const vl=gl.map(e=>`[0-9a-f]`.repeat(e)).join(`-`),yl=gl.map(e=>`[0-9a-f]{${e}}`).join(`-`),bl=`*${hl}${vl}`;RegExp(`${_l(hl)}${yl}$`);function xl(e){return`${e}${hl}${Oe()}`}function Sl(e){try{let t=M(e),n=`${me(e)}${hl}`,r=Date.now()-3e4;for(let e of w(t)){if(!e.startsWith(n))continue;let i=N(t,e);try{te(i).mtimeMs<r&&ne(i)}catch{}}}catch{}}function Cl(e,t,n={}){Sl(e);let r=xl(e);try{re(r,t,{encoding:`utf-8`,mode:n.mode??420}),D(r,e)}catch(e){try{ne(r)}catch{}throw e}}var wl=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};async function Tl(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new wl(e,r);s=!1;let c;try{c=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=te(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{ne(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new wl(e,r);await tl(i);continue}try{return await t()}finally{try{f(c)}catch{}try{ne(e)}catch{}}}}function El(e){let t=Date.now()+e;for(;Date.now()<t;);}function Dl(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r,s=!0;for(;;){if(!s&&Date.now()>=o)throw new wl(e,r);s=!1;let c;try{c=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=te(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{ne(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new wl(e,r);El(i);continue}try{return t()}finally{try{f(c)}catch{}try{ne(e)}catch{}}}}const Ol=`config.yml`;function kl(e,t,n){if(e===`user`){let e=n??k();return be(e,`.ok`,`global.yml`)}let r=ge(t)?t:be(t);return e===`project-local`?be(r,`.ok`,nl,Ol):be(r,`.ok`,Ol)}const Al=[`LC_ALL`,`LC_MESSAGES`,`LANG`];function jl(e){let t=e.trim().split(`@`)[0].split(`.`)[0];return t===``||t===`C`||t===`POSIX`?null:$c(t.replaceAll(`_`,`-`))}function Ml(e){for(let t of Al){let n=e[t]?.trim();if(n!==void 0&&n!==``)return jl(n)}return null}function Nl(e){let t=e.OK_LANG?.trim();if(t!==void 0&&t!==``)return $c(t)??void 0}function Pl(e=process.env){let t=Nl(e),n=Ml(e);if(n===null)return{override:t,preferenceList:[]};let r=[],i=e.LANGUAGE;if(i!==void 0)for(let e of i.split(`:`)){let t=jl(e);t!==null&&r.push(t)}return{override:t,preferenceList:[...r,n]}}const Fl=`open-knowledge`;function Il(e){try{e()}catch{}}var Ll=class{backend=`keyring`;onKeychainRead;constructor(e){this.onKeychainRead=e}async get(e){let{Entry:t}=await import(`@napi-rs/keyring`),n;try{n=new t(Fl,e).getPassword()}catch(t){return Il(()=>this.onKeychainRead?.({kind:`read-error`,host:e,error:t instanceof Error?t.name:`unknown`})),null}if(n==null)return Il(()=>this.onKeychainRead?.({kind:`absent`,host:e})),null;try{return JSON.parse(n)}catch{return Il(()=>this.onKeychainRead?.({kind:`corrupt-entry`,host:e,error:`corrupt-entry`})),null}}async set(e,t,n,r){let{Entry:i}=await import(`@napi-rs/keyring`),a=new i(Fl,e),o={login:t,token:n,...r};a.setPassword(JSON.stringify(o))}async clear(e){let{Entry:t}=await import(`@napi-rs/keyring`);try{new t(Fl,e).deletePassword()}catch{}}},Rl=class{backend=`file`;authFile;constructor(e){this.authFile=e??N(k(),`.ok`,`auth.yml`)}read(){if(!g(this.authFile))return{};try{let e=S(this.authFile,`utf-8`);return(0,hs.parse)(e)??{}}catch(e){let t=e instanceof Error?e.message:`unknown error`;return process.stderr.write(`[auth] Failed to parse ${this.authFile}: ${t}. Starting with empty credentials.\n`),{}}}write(e){let t=M(this.authFile);g(t)||v(t,{recursive:!0,mode:448}),Cl(this.authFile,(0,hs.stringify)(e),{mode:384})}async get(e){return this.read()[e]??null}async set(e,t,n,r){let i=this.read();i[e]={login:t,token:n,...r},this.write(i)}async clear(e){let t=this.read();delete t[e],this.write(t)}},zl=class{backend=`keyring`;keychain;file;constructor(e,t){this.keychain=e,this.file=t}async get(e){let t=await this.keychain.get(e);if(t!=null)return t;let n=await this.file.get(e);if(n==null)return null;try{await this.keychain.set(e,n.login,n.token,{gitProtocol:n.gitProtocol,name:n.name,email:n.email}),await this.file.clear(e),process.stderr.write(`[auth] migrated ${e} credential from ~/.ok/auth.yml to the OS keychain\n`)}catch{}return n}set(e,t,n,r){return this.keychain.set(e,t,n,r)}async clear(e){await this.keychain.clear(e),await this.file.get(e)!=null&&await this.file.clear(e)}};async function Bl(e,t){try{let{Entry:n}=await import(`@napi-rs/keyring`);return new n(Fl,`__probe__`),process.stderr.write(`[auth] token storage: OS keychain
189
189
  `),Il(()=>t?.onBackendSelected?.({backend:`keyring`})),new zl(new Ll(t?.onKeychainRead),new Rl(e))}catch(n){let r=n instanceof Error?`${n.name}: ${n.message}`:String(n);return process.stderr.write(`[auth] token storage: file (~/.ok/auth.yml) — OS keychain unavailable: ${r}\n`),Il(()=>t?.onBackendSelected?.({backend:`file`,reason:r})),new Rl(e)}}function Vl(e){let t=null;return function(){if(t)return t;let n=2e3;return t=(async()=>{let t=null,r=new Promise(r=>{t=setTimeout(()=>{process.stderr.write(`[auth] token storage: keyring init exceeded ${n}ms; falling back to file (~/.ok/auth.yml)\n`),r(new Rl(e))},n)});try{return await Promise.race([Bl(e),r])}catch{return new Rl(e)}finally{t!==null&&clearTimeout(t)}})(),t}}function Hl(e){let t=Vl(e);return{async get(e){let n=await(await t()).get(e);return n===null?null:{token:n.token,login:n.login}}}}const Ul=[`claude`,`claude-desktop`,`cursor`,`codex`,`copilot`,`opencode`,`openclaw`,`pi`,`antigravity`,`lm-studio`,`hermes`],Wl={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`,copilot:`GitHub Copilot`,opencode:`OpenCode`,openclaw:`OpenClaw`,pi:`Pi`,antigravity:`Antigravity`,"lm-studio":`LM Studio`,hermes:`Hermes`},Gl={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.github/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/skills`,antigravity:null,"lm-studio":null,hermes:null},Kl={claude:`.claude/skills`,"claude-desktop":null,cursor:`.cursor/skills`,codex:`.codex/skills`,copilot:`.copilot/skills`,opencode:`.opencode/skills`,openclaw:null,pi:`.pi/agent/skills`,antigravity:`.gemini/skills`,"lm-studio":`.lmstudio/skills`,hermes:null},ql=[{editorId:`lm-studio`,dotDir:`.lmstudio`,scope:`project`},{editorId:`openclaw`,dotDir:`.openclaw`,scope:`global`}],Jl=Ul.filter(e=>Gl[e]!==null),Yl=Ul.filter(e=>Kl[e]!==null),Xl=`open-knowledge`;Ul.flatMap(e=>{let t=Gl[e];return t===null?[]:[`${t}/${Xl}/`]});const Zl=Jl.filter(e=>e!==`pi`&&e!==`copilot`).map(e=>({hostDir:(Gl[e]??``).split(`/`)[0],editorId:e})),Ql=Ul.flatMap(e=>{let t=Kl[e];if(t===null)return[];let n=t.split(`/`)[0];return n===void 0?[]:[{hostDir:n,skillsRoot:t,editorId:e}]}),$l={claude:`claude-code`,"claude-desktop":`claude-code`,cursor:`cursor`,codex:`codex`,copilot:`github-copilot-cli`,opencode:`opencode`,openclaw:`openclaw`,pi:`pi`,antigravity:`antigravity`,"lm-studio":`lm-studio`,hermes:`hermes`},eu={claude:`.mcp.json`,"claude-desktop":null,cursor:`.cursor/mcp.json`,codex:`.codex/config.toml`,copilot:null,opencode:`opencode.json`,openclaw:null,pi:`.pi/extensions/open-knowledge.ts`,antigravity:null,"lm-studio":null,hermes:null},tu=[`copilot`],nu=`open-knowledge`,ru=[`exec`,`search`,`history`,`links`,`skills`,`config`,`palette`,`preview_url`,`share_link`,`lint`,`audit`,`write`,`edit`,`delete`,`move`,`install`,`import`,`checkpoint`,`restore_version`,`conflicts`,`resolve_conflict`];function iu(e){return`'${e.replace(/'/g,`'\\''`)}'`}const au=[`delete`,`move`,`share_link`,`install`,`import`];au.map(e=>`mcp__${nu}__${e}`),`${iu(`mcp_servers.${nu}.default_tools_approval_mode="approve"`)}`;const ou=[`claude`,`codex`,`opencode`,`cursor`,`copilot`,`pi`,`antigravity`,`openclaw`,`hermes`],su=[`config-entry`,`managed-file`,`skill-bundle-copy`,`central-store-copy`,`session-injection`],cu=U(su);su.filter(e=>e!==`session-injection`),V([U([`satisfied`,`present-consent-unknown`,`absent`,`foreign`,`foreign-replaceable`,`drifted`,`excluded`,`structural-na`,`undetected`,`unprobeable`,`unprobed`]),F()]);const lu=[`reclaim-permissive`,`pre-approval-exact`,`injection-functional`],uu=U(lu),du=U([`none`,`approve-once`,`enable-manually`,`trust-gated`]),fu=[`enable-manually`],pu=[`written`,`overwritten`,`skipped-unsupported`,`skipped-prerequisite`,`declined`,`failed`,`removed`,`excluded`,`unchanged`,`handed-off`,`skipped-foreign`,`skipped-missing`,`no-op`];U(pu),U([`info`,`warning`,`error`]);const mu=U([`required`,`recommended`]),hu=U([...Ul,`gemini`]),gu=U([`acp`,`terminal`,`external`]),_u=U([...ou,`gemini`]),vu=U([`claude-cowork`,`claude-code`,`codex`,`cursor`,`copilot`,`opencode`,`pi`,`antigravity`,`openclaw`,`hermes`]),yu=U([`mcp`,`skill`]),bu=[`project`,`user`,`session`],xu=U(bu),Su=F().regex(/^[a-z0-9-]+\/[a-z0-9-]+\/[a-z0-9-]+\/[a-z0-9-]+$/).transform(e=>e),Cu=F().min(1).transform(e=>e),wu=F().min(1).transform(e=>e);function Tu(e){return`${e.agent}/${e.piece}/${e.scope}/${e.kind}`}function Eu(e){return e}function Du(e){return e}const Ou=[`editor-user-config`,`editor-project-config`,`editor-project-skill-root`,`editor-user-skill-root`],ku=Eu(`central-skill-store`);function Au(e,t){return Eu(`${e}:${t}`)}function ju(e){if(e===ku)return{kind:`central-skill-store`};let t=e.indexOf(`:`);if(t===-1)return null;let n=e.slice(0,t),r=e.slice(t+1);return!Ou.includes(n)||!Ul.includes(r)?null:{kind:n,editor:r}}const Mu=e=>e===void 0?[]:Array.isArray(e)?[...e]:[e];function Nu(e){let{sharedWith:t,prerequisites:n,consentClass:r,installability:i,preferred:a,troubleshooting:o,...s}=e;return{...s,troubleshooting:Mu(o),id:Tu({agent:e.agent,piece:e.piece,scope:e.scope,kind:e.kind}),sharedWith:t??[],prerequisites:n??[],consentClass:r??`none`,installability:i??`installable`,preferred:a??!1}}function Pu(e){let{offerOnlyWhenDetected:t,offersConnectionRow:n,detectionSources:r,modes:i,...a}=e,o={};for(let[e,t]of Object.entries(i))o[e]={requirements:t.requirements,caveats:t.caveats??[]};return{...a,offerOnlyWhenDetected:t??!1,offersConnectionRow:n??!1,detectionSources:r??[],modes:o}}const Fu=(e,t,n,r)=>Tu({agent:e,piece:t,scope:n,kind:r}),Iu=e=>({piece:`mcp`,level:`required`,satisfiedByAny:e}),Lu=e=>({piece:`skill`,level:`recommended`,satisfiedByAny:e}),Ru=(...e)=>({mode:`probeable`,strictness:e}),zu=(e,t)=>({mode:`unprobeable`,reason:e,...t===void 0?{}:{note:t}}),Bu=(e,t)=>({id:Du(e),...t===void 0?{}:{params:t}}),Vu=(e,t)=>{let n=fu.find(t=>t===e);return n===void 0?void 0:Bu(`followup.${n}`,{agent:t})},Hu=(e,t)=>({kind:`source-read`,ref:e,...t===void 0?{}:{note:t}}),Uu=(e,t)=>t===void 0?{confidence:`verified`,evidence:e}:{confidence:`verified`,evidence:e,verifiedAgainst:t},Wu=(e,t)=>({confidence:`contested`,evidence:e,verifiedAgainst:t});function Gu(e){return{acpAgentId:e.acpAgentId,featuredOrder:e.featuredOrder,harnessCli:e.harnessCli,harnessReadsEditorConfig:e.readsEditorConfig,harnessReadsEditorConfigAttestation:e.readsEditorConfigAttestation,verifiedPosture:e.verifiedPosture}}function Ku(e){let{appBrandName:t,tagline:n,...r}=e;return{...r,...t===void 0?{}:{appBrandName:t},...n===void 0?{}:{tagline:n}}}const qu=(e,t)=>({kind:`observation`,ref:e,note:t}),Ju={observedAt:`2026-07-02`},Yu={cliEditors:`packages/cli/src/commands/editors.ts`,coreEditors:`packages/core/src/constants/editors.ts`,acpRegistry:`packages/server/src/acp/registry.ts`,threadManager:`packages/server/src/acp/thread-manager.ts`,writeProjectSkill:`packages/cli/src/integrations/write-project-skill.ts`,repairSkills:`packages/cli/src/commands/repair-skills.ts`,skillInstall:`packages/server/src/skill-install.ts`,presenceProbes:`packages/desktop/src/main/integrations-settings.ts`};function Xu(e){return Nu({agent:e.agent,piece:`mcp`,scope:`user`,kind:`config-entry`,pathId:Au(`editor-user-config`,e.agent),probe:Ru(...e.strictness),attestation:e.attestation,audience:`this-user`,installability:e.installability,notInstallableReason:e.notInstallableReason,guidance:Bu(`guidance.mcp.user-config`,{agent:e.agent}),troubleshooting:e.troubleshooting})}function Zu(e){return Nu({agent:e.agent,piece:`mcp`,scope:`project`,kind:`config-entry`,pathId:Au(`editor-project-config`,e.fileOwner??e.agent),sharedWith:e.sharedWith,consentClass:e.consentClass,probe:Ru(...e.strictness),attestation:e.attestation,audience:`this-project`,guidance:Bu(`guidance.mcp.project-config`,{agent:e.agent}),followup:Vu(e.consentClass,e.agent),troubleshooting:e.troubleshooting})}function Qu(e){return Nu({agent:e.agent,piece:`skill`,scope:`project`,kind:`skill-bundle-copy`,pathId:Au(`editor-project-skill-root`,e.agent),prerequisites:e.prerequisites,probe:Ru(`reclaim-permissive`),attestation:e.attestation,audience:`this-project`,guidance:Bu(`guidance.skill.project`,{agent:e.agent}),troubleshooting:e.troubleshooting})}function $u(e){return Nu({agent:e.agent,piece:`skill`,scope:`user`,kind:`skill-bundle-copy`,pathId:Au(`editor-user-skill-root`,e.agent),probe:Ru(`reclaim-permissive`),attestation:e.attestation,audience:`this-user`,guidance:Bu(`guidance.skill.user`,{agent:e.agent})})}function ed(e){return Nu({agent:e,piece:`mcp`,scope:`session`,kind:`session-injection`,probe:zu(`session-scoped`),attestation:Uu([Hu(Yu.threadManager,`the session MCP config the thread manager builds per thread`)]),audience:`this-project`,installability:`not-installable`,notInstallableReason:`session-scoped`,guidance:Bu(`guidance.mcp.session-injection`,{agent:e})})}const td={claude:Pu({id:`claude`,setupDocSlug:$l.claude,offersConnectionRow:!0,detectionSources:[`cli-on-path:claude`,`scheme-handler:claude-code`],satisfiers:[Xu({agent:`claude`,strictness:[`reclaim-permissive`,`pre-approval-exact`,`injection-functional`],attestation:Uu([Hu(Yu.cliEditors,`user-global MCP config target`)])}),Zu({agent:`claude`,sharedWith:[`copilot`],consentClass:`approve-once`,strictness:[`reclaim-permissive`,`pre-approval-exact`,`injection-functional`],attestation:Uu([Hu(Yu.cliEditors),Hu(Yu.coreEditors)]),troubleshooting:Bu(`troubleshooting.claude.project-entry-not-approved`,{agent:`claude`})}),Qu({agent:`claude`,prerequisites:[Fu(`claude`,`mcp`,`project`,`config-entry`)],attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.repairSkills)])}),$u({agent:`claude`,attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.skillInstall)])}),ed(`claude`)],modes:{external:{requirements:[Iu([Fu(`claude`,`mcp`,`user`,`config-entry`),Fu(`claude`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`claude`,`skill`,`project`,`skill-bundle-copy`),Fu(`claude`,`skill`,`user`,`skill-bundle-copy`)])]},terminal:{requirements:[Iu([Fu(`claude`,`mcp`,`user`,`config-entry`),Fu(`claude`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`claude`,`skill`,`project`,`skill-bundle-copy`),Fu(`claude`,`skill`,`user`,`skill-bundle-copy`)])]},acp:{requirements:[Iu([Fu(`claude`,`mcp`,`session`,`session-injection`),Fu(`claude`,`mcp`,`user`,`config-entry`),Fu(`claude`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`claude`,`skill`,`project`,`skill-bundle-copy`),Fu(`claude`,`skill`,`user`,`skill-bundle-copy`)])]}},acp:Gu({acpAgentId:`claude-acp`,featuredOrder:0,harnessCli:`claude`,readsEditorConfig:`claude`,readsEditorConfigAttestation:Uu([Hu(Yu.threadManager,`the injection-skip probe reads the managed entry for this editor`),qu(`claude-acp adapter`,`The adapter runs Claude Code, which loads the MCP entry OK writes for the Claude editor on its own, so injecting a same-name duplicate would be redundant.`)],Ju),verifiedPosture:`asks`}),external:Ku({targetId:`claude-code`,knownOrder:1,visible:!0,displayName:`Claude`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Agentic coding in Claude Desktop's Code tab.`})}),"claude-desktop":Pu({id:`claude-desktop`,setupDocSlug:$l[`claude-desktop`],offersConnectionRow:!1,detectionSources:[`scheme-handler:claude-code`],satisfiers:[Xu({agent:`claude-desktop`,strictness:[`reclaim-permissive`],attestation:Uu([Hu(Yu.cliEditors,`user-global config target; its path resolution throws on Linux`)]),troubleshooting:Bu(`troubleshooting.claude-desktop.per-tool-approval`,{agent:`claude-desktop`})})],modes:{external:{requirements:[Iu([Fu(`claude-desktop`,`mcp`,`user`,`config-entry`)]),Lu([])]}},external:Ku({targetId:`claude-cowork`,knownOrder:0,visible:!1,displayName:`Claude Cowork`,appBrandName:`Claude Desktop`,schemes:[`claude:`],installUrl:`https://claude.com/download`,tagline:`Conversational pairing in Claude Desktop's Cowork tab.`})}),cursor:Pu({id:`cursor`,setupDocSlug:$l.cursor,offersConnectionRow:!0,detectionSources:[`cli-on-path:cursor`,`scheme-handler:cursor`],satisfiers:[Xu({agent:`cursor`,strictness:[`reclaim-permissive`],attestation:Uu([Hu(Yu.cliEditors)])}),Zu({agent:`cursor`,consentClass:`enable-manually`,strictness:[`reclaim-permissive`],attestation:Uu([Hu(Yu.cliEditors),Hu(Yu.coreEditors),{kind:`observation`,ref:`cursor-3.19.19-project-server-default-off`,note:`project .cursor/mcp.json server listed Disabled under Customize → MCPs with no prompt; enabled via the per-source toggle in its Configure dialog; with a same-named user-level entry present, the user entry connected and the disabled project entry did not shadow it`}],{version:`3.19.19`,observedAt:`2026-09-09`}),troubleshooting:Bu(`troubleshooting.cursor.project-entry-not-loaded`,{agent:`cursor`})}),Qu({agent:`cursor`,prerequisites:[Fu(`cursor`,`mcp`,`project`,`config-entry`)],attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.repairSkills)])}),$u({agent:`cursor`,attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.skillInstall)])}),ed(`cursor`)],modes:{external:{requirements:[Iu([Fu(`cursor`,`mcp`,`user`,`config-entry`),Fu(`cursor`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`cursor`,`skill`,`project`,`skill-bundle-copy`),Fu(`cursor`,`skill`,`user`,`skill-bundle-copy`)])]},terminal:{requirements:[Iu([Fu(`cursor`,`mcp`,`user`,`config-entry`),Fu(`cursor`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`cursor`,`skill`,`project`,`skill-bundle-copy`),Fu(`cursor`,`skill`,`user`,`skill-bundle-copy`)])]},acp:{requirements:[Iu([Fu(`cursor`,`mcp`,`session`,`session-injection`)]),Lu([Fu(`cursor`,`skill`,`project`,`skill-bundle-copy`),Fu(`cursor`,`skill`,`user`,`skill-bundle-copy`)])]}},acp:Gu({acpAgentId:`cursor`,featuredOrder:3,harnessCli:`cursor`,readsEditorConfig:null,readsEditorConfigAttestation:Uu([qu(`cursor-agent mcp list`,`Reports a config-declared entry that has not been approved as "not loaded (needs approval)", so a present entry says nothing about whether the agent will have the tools.`),Hu(Yu.threadManager,`the one agent the skip probe never stands down for`)],{observedAt:`2026-08-20`}),verifiedPosture:`self-managed`}),external:Ku({targetId:`cursor`,knownOrder:3,visible:!0,displayName:`Cursor`,schemes:[`cursor:`],installUrl:`https://cursor.com/`,tagline:`AI-first VS Code fork with multi-file edits.`})}),codex:Pu({id:`codex`,setupDocSlug:$l.codex,offersConnectionRow:!0,detectionSources:[`cli-on-path:codex`,`scheme-handler:codex`],satisfiers:[Xu({agent:`codex`,strictness:[`reclaim-permissive`,`injection-functional`],attestation:Uu([Hu(Yu.cliEditors,`TOML user-global config target`)])}),Zu({agent:`codex`,consentClass:`trust-gated`,strictness:[`reclaim-permissive`,`injection-functional`],attestation:Wu([Hu(Yu.cliEditors,`project config path added by analogy with the other editors`),{kind:`upstream-issue`,ref:`openai/codex#13025`,note:`open, reproduced on builds newer than the one OK checked`},{kind:`upstream-issue`,ref:`openai/codex#36960`,note:`requires an explicit trust decision in rust-v0.147.0, reverting #36935's automatic trust from the same release; builds from 0.113 asked but did not reliably persist the answer (#14547); codex exec never asks`},{kind:`vendor-doc`,ref:`OpenAI Codex: Advanced configuration`,note:`project-scoped config loads only for a trusted project`},{kind:`observation`,ref:`codex-desktop-project-config-load`,note:`single non-repro on 26.623.81905; the CLI honors it only for a trusted project`}],{version:`26.707.72221`,observedAt:`2026-07-15`}),troubleshooting:[Bu(`troubleshooting.codex.desktop-project-config`,{agent:`codex`,honoredByDesktop:!1}),Bu(`troubleshooting.codex.folder-trust`,{agent:`codex`})]}),Qu({agent:`codex`,prerequisites:[Fu(`codex`,`mcp`,`project`,`config-entry`)],attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.repairSkills)]),troubleshooting:Bu(`troubleshooting.codex.folder-trust`,{agent:`codex`})}),$u({agent:`codex`,attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.skillInstall)])}),ed(`codex`)],modes:{external:{requirements:[Iu([Fu(`codex`,`mcp`,`user`,`config-entry`),Fu(`codex`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`codex`,`skill`,`project`,`skill-bundle-copy`),Fu(`codex`,`skill`,`user`,`skill-bundle-copy`)])]},terminal:{requirements:[Iu([Fu(`codex`,`mcp`,`user`,`config-entry`),Fu(`codex`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`codex`,`skill`,`project`,`skill-bundle-copy`),Fu(`codex`,`skill`,`user`,`skill-bundle-copy`)])]},acp:{requirements:[Iu([Fu(`codex`,`mcp`,`session`,`session-injection`),Fu(`codex`,`mcp`,`user`,`config-entry`),Fu(`codex`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`codex`,`skill`,`project`,`skill-bundle-copy`),Fu(`codex`,`skill`,`user`,`skill-bundle-copy`)])]}},acp:Gu({acpAgentId:`codex-acp`,featuredOrder:1,harnessCli:`codex`,readsEditorConfig:`codex`,readsEditorConfigAttestation:Uu([Hu(Yu.cliEditors,`the managed MCP entry OK writes into the Codex TOML config`),qu(`codex-acp adapter`,`The adapter runs the Codex CLI, which loads the MCP servers declared in its own config, so the managed entry is already in the session.`)],Ju),verifiedPosture:`self-managed`}),external:Ku({targetId:`codex`,knownOrder:2,visible:!0,displayName:`ChatGPT`,appBrandName:`ChatGPT Desktop`,schemes:[`codex:`],installUrl:`https://developers.openai.com/codex/app`,tagline:`OpenAI's ChatGPT desktop app, home of the Codex agent.`})}),copilot:Pu({id:`copilot`,setupDocSlug:$l.copilot,offersConnectionRow:!0,detectionSources:[`cli-on-path:copilot`],satisfiers:[Xu({agent:`copilot`,strictness:[`reclaim-permissive`],attestation:Uu([Hu(Yu.cliEditors)])}),Zu({agent:`copilot`,fileOwner:`claude`,sharedWith:[`claude`],consentClass:`trust-gated`,strictness:[`reclaim-permissive`],attestation:Uu([{kind:`vendor-doc`,ref:`GitHub Copilot CLI — MCP configuration`,note:"reads workspace `.mcp.json` or `.github/mcp.json`"},{kind:`vendor-doc`,ref:`GitHub Docs: Adding MCP servers for Copilot CLI`,note:`project-level servers load only after folder-trust confirmation; skipped silently in untrusted folders; under copilot -p they load only in an already-trusted folder unless GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP=true`},Hu(Yu.coreEditors,`OK deliberately writes no second copy for copilot`)],{version:`copilot CLI 1.0.80`,observedAt:`2026-08-20`}),troubleshooting:Bu(`troubleshooting.copilot.shared-workspace-config`,{agent:`copilot`,sourceAgent:`claude`})}),Qu({agent:`copilot`,prerequisites:[Fu(`copilot`,`mcp`,`project`,`config-entry`),Fu(`copilot`,`mcp`,`user`,`config-entry`)],attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.writeProjectSkill)])}),$u({agent:`copilot`,attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.skillInstall)])}),ed(`copilot`)],modes:{external:{requirements:[Iu([Fu(`copilot`,`mcp`,`user`,`config-entry`),Fu(`copilot`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`copilot`,`skill`,`project`,`skill-bundle-copy`),Fu(`copilot`,`skill`,`user`,`skill-bundle-copy`)])]},terminal:{requirements:[Iu([Fu(`copilot`,`mcp`,`user`,`config-entry`),Fu(`copilot`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`copilot`,`skill`,`project`,`skill-bundle-copy`),Fu(`copilot`,`skill`,`user`,`skill-bundle-copy`)])]},acp:{requirements:[Iu([Fu(`copilot`,`mcp`,`session`,`session-injection`)]),Lu([Fu(`copilot`,`skill`,`project`,`skill-bundle-copy`),Fu(`copilot`,`skill`,`user`,`skill-bundle-copy`)])]}},acp:Gu({acpAgentId:`github-copilot-cli`,featuredOrder:4,harnessCli:null,readsEditorConfig:null,readsEditorConfigAttestation:{confidence:`assumed`,evidence:[qu(`copilot CLI 1.0.80`,"The CLI does read a workspace `.mcp.json`, but nobody has observed the ACP adapter loading the managed entry inside a session. Claiming it would stand our injection down on an unverified read and risk a thread with no OK tools, so the claim stays unmade and OK keeps injecting.")],verifiedAgainst:{version:`1.0.80`,observedAt:`2026-08-20`}},verifiedPosture:null}),external:Ku({targetId:`copilot`,knownOrder:4,visible:!1,displayName:`GitHub Copilot`,schemes:[],installUrl:`https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-getting-started`,tagline:`GitHub's terminal-native coding agent.`})}),opencode:Pu({id:`opencode`,setupDocSlug:$l.opencode,offersConnectionRow:!0,detectionSources:[`cli-on-path:opencode`],satisfiers:[Xu({agent:`opencode`,strictness:[`reclaim-permissive`,`injection-functional`],attestation:Uu([Hu(Yu.cliEditors,`XDG config dir; the win32 location is by analogy and unverified`)])}),Zu({agent:`opencode`,consentClass:`none`,strictness:[`reclaim-permissive`,`injection-functional`],attestation:Uu([Hu(Yu.cliEditors,`the one project config that is not under a dotdir`)])}),Qu({agent:`opencode`,prerequisites:[Fu(`opencode`,`mcp`,`project`,`config-entry`)],attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.repairSkills)])}),$u({agent:`opencode`,attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.skillInstall)])}),ed(`opencode`)],modes:{external:{requirements:[Iu([Fu(`opencode`,`mcp`,`user`,`config-entry`),Fu(`opencode`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`opencode`,`skill`,`project`,`skill-bundle-copy`),Fu(`opencode`,`skill`,`user`,`skill-bundle-copy`)])]},terminal:{requirements:[Iu([Fu(`opencode`,`mcp`,`user`,`config-entry`),Fu(`opencode`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`opencode`,`skill`,`project`,`skill-bundle-copy`),Fu(`opencode`,`skill`,`user`,`skill-bundle-copy`)])]},acp:{requirements:[Iu([Fu(`opencode`,`mcp`,`session`,`session-injection`),Fu(`opencode`,`mcp`,`user`,`config-entry`),Fu(`opencode`,`mcp`,`project`,`config-entry`)]),Lu([Fu(`opencode`,`skill`,`project`,`skill-bundle-copy`),Fu(`opencode`,`skill`,`user`,`skill-bundle-copy`)])]}},acp:Gu({acpAgentId:`opencode`,featuredOrder:5,harnessCli:`opencode`,readsEditorConfig:`opencode`,readsEditorConfigAttestation:Uu([Hu(Yu.cliEditors,`the managed MCP entry OK writes into the opencode config`),qu(`opencode-acp adapter`,`The adapter runs opencode, which loads its own configured MCP servers, so the managed entry is already in the session.`)],Ju),verifiedPosture:null}),external:Ku({targetId:`opencode`,knownOrder:5,visible:!1,displayName:`OpenCode`,schemes:[],installUrl:`https://opencode.ai`,tagline:`Open-source terminal coding agent; bring any local model.`})}),openclaw:Pu({id:`openclaw`,setupDocSlug:$l.openclaw,offersConnectionRow:!0,offerOnlyWhenDetected:!0,detectionSources:[`cli-on-path:openclaw`],satisfiers:[Xu({agent:`openclaw`,strictness:[`reclaim-permissive`],attestation:Uu([Hu(Yu.cliEditors,"the one two-level server map, nested under `mcp.servers`")])}),Nu({agent:`openclaw`,piece:`skill`,scope:`user`,kind:`central-store-copy`,pathId:ku,probe:Ru(`reclaim-permissive`),attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.skillInstall,`the hub is written only when it already exists`)]),audience:`this-user`,guidance:Bu(`guidance.skill.central-store`,{agent:`openclaw`}),troubleshooting:Bu(`troubleshooting.openclaw.central-store-missing`,{agent:`openclaw`})})],modes:{external:{requirements:[Iu([Fu(`openclaw`,`mcp`,`user`,`config-entry`)]),Lu([Fu(`openclaw`,`skill`,`user`,`central-store-copy`)])]},terminal:{requirements:[Iu([Fu(`openclaw`,`mcp`,`user`,`config-entry`)]),Lu([Fu(`openclaw`,`skill`,`user`,`central-store-copy`)])]}},external:Ku({targetId:`openclaw`,knownOrder:8,visible:!1,displayName:`OpenClaw`,schemes:[],installUrl:`https://openclaw.ai`,tagline:`Open-source agent gateway; runs agents against your MCP servers.`})}),pi:Pu({id:`pi`,setupDocSlug:$l.pi,offersConnectionRow:!0,detectionSources:[`cli-on-path:pi`],satisfiers:[Nu({agent:`pi`,piece:`mcp`,scope:`project`,kind:`managed-file`,pathId:Au(`editor-project-config`,`pi`),probe:Ru(`reclaim-permissive`,`injection-functional`),attestation:Uu([Hu(Yu.cliEditors,`OK owns the whole file; currency is a first-line sentinel`),Hu(Yu.acpRegistry,`the thread provisions this file instead of injecting`)]),audience:`this-project`,guidance:Bu(`guidance.mcp.managed-file`,{agent:`pi`}),troubleshooting:Bu(`troubleshooting.pi.folder-trust`,{agent:`pi`})}),Qu({agent:`pi`,prerequisites:[Fu(`pi`,`mcp`,`project`,`managed-file`)],attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.writeProjectSkill)]),troubleshooting:Bu(`troubleshooting.pi.folder-trust`,{agent:`pi`})}),$u({agent:`pi`,attestation:Uu([Hu(Yu.coreEditors,`the agent home nests one level below the dotdir`),Hu(Yu.skillInstall)])})],modes:{external:{requirements:[Iu([Fu(`pi`,`mcp`,`project`,`managed-file`)]),Lu([Fu(`pi`,`skill`,`project`,`skill-bundle-copy`),Fu(`pi`,`skill`,`user`,`skill-bundle-copy`)])]},terminal:{requirements:[Iu([Fu(`pi`,`mcp`,`project`,`managed-file`)]),Lu([Fu(`pi`,`skill`,`project`,`skill-bundle-copy`),Fu(`pi`,`skill`,`user`,`skill-bundle-copy`)])]},acp:{requirements:[Iu([Fu(`pi`,`mcp`,`project`,`managed-file`)]),Lu([Fu(`pi`,`skill`,`project`,`skill-bundle-copy`),Fu(`pi`,`skill`,`user`,`skill-bundle-copy`)])]}},acp:Gu({acpAgentId:`pi-acp`,featuredOrder:null,harnessCli:`pi`,readsEditorConfig:`pi`,readsEditorConfigAttestation:Uu([qu(`pi-acp@0.0.33`,"Pi has no MCP client at all: it accepts `mcpServers` at session/new, stores them write-only and never connects. Its wiring is a managed extension FILE in the project, which OK provisions instead of injecting — the same mapping, a different shape."),Hu(Yu.threadManager,`the bridge route that provisions the extension instead of injecting`)],{version:`0.0.33`,observedAt:`2026-08-20`}),verifiedPosture:`autonomous`}),external:Ku({targetId:`pi`,knownOrder:6,visible:!1,displayName:`Pi`,schemes:[],installUrl:`https://pi.dev`,tagline:`Minimal open-source terminal coding agent, extensible in TypeScript.`})}),antigravity:Pu({id:`antigravity`,setupDocSlug:$l.antigravity,offersConnectionRow:!0,offerOnlyWhenDetected:!0,detectionSources:[`cli-on-path:antigravity`],satisfiers:[Xu({agent:`antigravity`,strictness:[`reclaim-permissive`],attestation:Uu([Hu(Yu.cliEditors,`one user-global file shared by the IDE, the app and the CLI; per project you can only filter it`)])}),$u({agent:`antigravity`,attestation:Uu([Hu(Yu.coreEditors),Hu(Yu.skillInstall)])})],modes:{external:{requirements:[Iu([Fu(`antigravity`,`mcp`,`user`,`config-entry`)]),Lu([Fu(`antigravity`,`skill`,`user`,`skill-bundle-copy`)])]},terminal:{requirements:[Iu([Fu(`antigravity`,`mcp`,`user`,`config-entry`)]),Lu([Fu(`antigravity`,`skill`,`user`,`skill-bundle-copy`)])]}},external:Ku({targetId:`antigravity`,knownOrder:7,visible:!1,displayName:`Antigravity`,schemes:[],installUrl:`https://antigravity.google`,tagline:"Google's agentic IDE + `agy` terminal agent."})}),"lm-studio":Pu({id:`lm-studio`,setupDocSlug:$l[`lm-studio`],offersConnectionRow:!0,offerOnlyWhenDetected:!0,detectionSources:[],satisfiers:[Xu({agent:`lm-studio`,strictness:[`reclaim-permissive`],installability:`not-installable`,notInstallableReason:`no-non-interactive-verb`,attestation:Uu([Hu(Yu.cliEditors,`two candidate locations, resolved against what already exists`),{kind:`upstream-issue`,ref:`lmstudio-ai/lmstudio-bug-tracker#1371`,note:`documented config path differs from the one the app reads on macOS`},Hu(Yu.presenceProbes,`deliberately absent from the presence probes`)]),troubleshooting:Bu(`troubleshooting.lm-studio.config-path-mismatch`,{agent:`lm-studio`})})],modes:{external:{requirements:[Iu([Fu(`lm-studio`,`mcp`,`user`,`config-entry`)]),Lu([])]}}}),hermes:Pu({id:`hermes`,setupDocSlug:$l.hermes,offersConnectionRow:!0,offerOnlyWhenDetected:!0,detectionSources:[`cli-on-path:hermes`],satisfiers:[Xu({agent:`hermes`,strictness:[`reclaim-permissive`],attestation:Uu([Hu(Yu.cliEditors,`the one YAML target; the whole config is a single user-global file`)])})],modes:{external:{requirements:[Iu([Fu(`hermes`,`mcp`,`user`,`config-entry`)]),Lu([])]},terminal:{requirements:[Iu([Fu(`hermes`,`mcp`,`user`,`config-entry`)]),Lu([])]}},external:Ku({targetId:`hermes`,knownOrder:9,visible:!1,displayName:`Hermes`,schemes:[],installUrl:`https://hermes-agent.nousresearch.com`,tagline:`Nous Research's terminal coding agent.`})}),gemini:Pu({id:`gemini`,setupDocSlug:null,detectionSources:[`harness-bin:gemini`],satisfiers:[ed(`gemini`)],modes:{acp:{requirements:[Iu([Fu(`gemini`,`mcp`,`session`,`session-injection`)]),Lu([])]}},acp:Gu({acpAgentId:`gemini`,featuredOrder:2,harnessCli:`gemini`,readsEditorConfig:null,readsEditorConfigAttestation:Uu([Hu(Yu.coreEditors,`gemini reaches OK as an ACP agent only; it has no editor config target`)],Ju),verifiedPosture:null})})},nd=Object.values(td).flatMap(e=>e.satisfiers);new Map(nd.map(e=>[e.id,e]));const rd=Object.values(td).flatMap(e=>e.acp===void 0?[]:[{record:e,acp:e.acp}]).sort((e,t)=>e.acp.acpAgentId.localeCompare(t.acp.acpAgentId));rd.filter(({acp:e})=>e.featuredOrder!==null).sort((e,t)=>(e.acp.featuredOrder??0)-(t.acp.featuredOrder??0)).map(({acp:e})=>e.acpAgentId),Object.fromEntries(rd.flatMap(({acp:e})=>e.harnessCli===null?[]:[[e.acpAgentId,e.harnessCli]])),Object.fromEntries(rd.flatMap(({acp:e})=>e.harnessReadsEditorConfig===null?[]:[[e.acpAgentId,e.harnessReadsEditorConfig]])),Object.fromEntries(rd.flatMap(({acp:e})=>e.verifiedPosture===null?[]:[[e.acpAgentId,e.verifiedPosture]]));const id=Object.values(td).flatMap(e=>e.external===void 0?[]:[e.external]).sort((e,t)=>e.knownOrder-t.knownOrder),Cie=id.map(({targetId:e,displayName:t,appBrandName:n,schemes:r,installUrl:i,tagline:a})=>({id:e,displayName:t,...n===void 0?{}:{appBrandName:n},schemes:r,installUrl:i,...a===void 0?{}:{tagline:a}})),wie=new Set(id.filter(e=>e.visible).map(e=>e.targetId));Cie.filter(e=>wie.has(e.id)),Ul.filter(e=>td[e].offersConnectionRow),new Map(Object.values(td).flatMap(e=>e.external===void 0?[]:[[e.external.targetId,e.id]])),new Map(Object.values(td).flatMap(e=>e.modes.terminal===void 0?[]:[[e.id,e.id]])),Object.fromEntries(Object.values(td).flatMap(e=>{let t=e.satisfiers.find(e=>e.piece===`mcp`&&e.scope===`project`&&e.consentClass!==`none`)?.consentClass;return t===void 0?[]:[[e.id,t]]}));const ad=[`text`,`number`,`boolean`,`date`,`list`,`object`];U(ad);const Tie=V([F(),I(),L()]),od=la(()=>V([Tie.transform(e=>String(e)),H(F(),sd),z(od)])),sd=la(()=>V([F(),I(),L(),z(od),H(F(),sd)]));function cd(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(cd(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:cd(r);return t}return e}fa(cd,H(F(),sd)),H(F(),V([sd,Si()]));const ld=/^---[ \t]*\r?\n([\s\S]*?\r?\n)?---[ \t]*(\r?\n|$)/;function Eie(e){let t=e.match(ld);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function Die(e){if(e===``)return``;let t=e.match(ld);return t?(t[1]??``).replace(/\r?\n$/,``):e}const Oie=Object.freeze([`__config__/project`,`__local__/project`,`__user__/config.yml`,`__config__/okignore`]),ud=[`project`,`global`];function kie(e){return e.startsWith(`__skill__/`)||e.startsWith(`__template__/`)||e.startsWith(`__extskill__/`)}const dd=`.agents/skills`,fd={"open-knowledge-pack-plain-notes":`note-taking`,"open-knowledge-pack-worldbuilding":`worldbuilding`,"open-knowledge-pack-writing-pipeline":`writing-workflow`,"open-knowledge-pack-codebase-wiki":`codebase-wiki`,"open-knowledge-pack-knowledge-base":`knowledge-base`,"open-knowledge-pack-software-lifecycle":`software-lifecycle`,"open-knowledge-pack-entity-vault":`personal-crm`,"open-knowledge-pack-okf":`okf-knowledge-base`,"open-knowledge-pack-software-lifecycle-frame-a-proposal":`frame-a-proposal`,"open-knowledge-pack-software-lifecycle-record-a-decision":`record-a-decision`,"open-knowledge-pack-software-lifecycle-write-a-spec":`write-a-spec`,"open-knowledge-pack-software-lifecycle-review-a-design":`review-a-design`,"open-knowledge-pack-software-lifecycle-write-a-postmortem":`write-a-postmortem`,"open-knowledge-pack-knowledge-base-research":`research-with-sources`,"open-knowledge-pack-knowledge-base-consolidate":`consolidate-notes`},Aie=ki({name:F(),description:F(),files:ki({skillMd:F(),scripts:z(F()),references:z(F())})}),jie=ki({pluginProvider:F().optional(),plugin:F().optional(),marketplace:F().optional(),repositoryUrl:F().optional(),version:F().optional(),gitCommitSha:F().optional(),scope:F().optional(),projectPath:F().optional()}),Mie=ki({commands:L(),hooks:L(),mcp:L()}),Nie=ki({...Aie.shape,sourceHarness:F(),sourceHarnesses:z(F()),home:F(),provenance:jie,inert:Mie,outsideProject:L().optional()}),Pie=ki({schema:W(1),name:F(),version:F(),description:F().optional(),author:ki({name:F()}).optional(),skills:z(F()),hostCompatibility:z(F()).optional(),capabilities:ki({scripts:F(),network:F(),inert:z(F())}).optional(),provenance:ki({source:F(),ref:F(),contentHash:F()}).optional()});B({skills:z(Nie),packs:z(Pie)}).loose(),B({results:z(B({id:F().min(1),name:F().min(1),source:F().min(1),description:F(),installs:I().int().nonnegative().nullable(),publisher:F().nullable()}).loose()),backend:U([`skills.sh`,`github-fallback`]),degraded:L()}).loose(),B({title:F(),description:F(),image:F().nullable(),skillsUrl:F().nullable(),sourceKind:U([`github`,`site`]),sourceUrl:F()}).loose(),B({skills:z(B({name:F(),description:F().nullable()}).loose())}).loose(),B({kind:U([`local`,`import`,`none`]),scope:U(ud).optional(),name:F().optional(),dir:F().optional(),source:F().optional(),ref:F().optional(),via:U([`source`,`publisher`]).optional()}).loose();const Fie=B({relPath:F(),content:F().nullable()}).loose(),Iie=B({provider:F(),plugin:F(),version:F().optional(),marketplace:F().optional(),repositoryUrl:F().optional()}).loose(),Lie=B({provider:F(),plugin:F(),version:F().optional(),description:F().optional(),repositoryUrl:F().optional(),bundledSkills:z(F()),capabilities:B({commands:L(),hooks:L(),mcp:L(),agents:L()}),setupSupported:L()}).loose();B({name:F(),description:F().nullable(),skillMd:F(),files:z(Fie),plugin:Iie.optional(),pluginBundle:Lie.optional()}).loose();const pd={stable:{appId:`com.inkeep.open-knowledge`,productName:`OpenKnowledge`,packageName:`@inkeep/open-knowledge-desktop`,linuxExecutableName:`openknowledge`,linuxPackageNames:{deb:`openknowledge`,rpm:`OpenKnowledge`}},beta:{appId:`com.inkeep.open-knowledge.beta`,productName:`OpenKnowledge Beta`,packageName:`openknowledge-beta-desktop`,linuxExecutableName:`openknowledge-beta`,linuxPackageNames:{deb:`openknowledge-beta-desktop`,rpm:`openknowledge-beta-desktop`}}};pd.stable.productName;function md(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?gd(e.position):`start`in e||`end`in e?gd(e):`line`in e||`column`in e?hd(e):``}function hd(e){return _d(e&&e.line)+`:`+_d(e&&e.column)}function gd(e){return hd(e&&e.start)+`-`+hd(e&&e.end)}function _d(e){return e&&typeof e==`number`?e:1}var vd=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=md(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};vd.prototype.file=``,vd.prototype.name=``,vd.prototype.reason=``,vd.prototype.message=``,vd.prototype.stack=``,vd.prototype.column=void 0,vd.prototype.line=void 0,vd.prototype.ancestors=void 0,vd.prototype.cause=void 0,vd.prototype.fatal=void 0,vd.prototype.place=void 0,vd.prototype.ruleId=void 0,vd.prototype.source=void 0;var yd=e(i(((e,t)=>{var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1,i=1,a=0;n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+this.Diff_Timeout*1e3);var o=i;if(e==null||t==null)throw Error(`Null input. (diff_main)`);if(e==t)return e?[new n.Diff(a,e)]:[];r===void 0&&(r=!0);var s=r,c=this.diff_commonPrefix(e,t),l=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=this.diff_commonSuffix(e,t);var u=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var d=this.diff_compute_(e,t,s,o);return l&&d.unshift(new n.Diff(a,l)),u&&d.push(new n.Diff(a,u)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,o,s){var c;if(!e)return[new n.Diff(i,t)];if(!t)return[new n.Diff(r,e)];var l=e.length>t.length?e:t,u=e.length>t.length?t:e,d=l.indexOf(u);if(d!=-1)return c=[new n.Diff(i,l.substring(0,d)),new n.Diff(a,u),new n.Diff(i,l.substring(d+u.length))],e.length>t.length&&(c[0][0]=c[2][0]=r),c;if(u.length==1)return[new n.Diff(r,e),new n.Diff(i,t)];var f=this.diff_halfMatch_(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=this.diff_main(p,h,o,s),y=this.diff_main(m,g,o,s);return v.concat([new n.Diff(a,_)],y)}return o&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,s):this.diff_bisect_(e,t,s)},n.prototype.diff_lineMode_=function(e,t,o){var s=this.diff_linesToChars_(e,t);e=s.chars1,t=s.chars2;var c=s.lineArray,l=this.diff_main(e,t,!1,o);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new n.Diff(a,``));for(var u=0,d=0,f=0,p=``,m=``;u<l.length;){switch(l[u][0]){case i:f++,m+=l[u][1];break;case r:d++,p+=l[u][1];break;case a:if(d>=1&&f>=1){l.splice(u-d-f,d+f),u=u-d-f;for(var h=this.diff_main(p,m,!1,o),g=h.length-1;g>=0;g--)l.splice(u,0,h[g]);u+=h.length}f=0,d=0,p=``,m=``}u++}return l.pop(),l},n.prototype.diff_bisect_=function(e,t,a){for(var o=e.length,s=t.length,c=Math.ceil((o+s)/2),l=c,u=2*c,d=Array(u),f=Array(u),p=0;p<u;p++)d[p]=-1,f[p]=-1;d[l+1]=0,f[l+1]=0;for(var m=o-s,h=m%2!=0,g=0,_=0,v=0,y=0,b=0;b<c&&!(new Date().getTime()>a);b++){for(var x=-b+g;x<=b-_;x+=2){for(var S=l+x,C=x==-b||x!=b&&d[S-1]<d[S+1]?d[S+1]:d[S-1]+1,w=C-x;C<o&&w<s&&e.charAt(C)==t.charAt(w);)C++,w++;if(d[S]=C,C>o)_+=2;else if(w>s)g+=2;else if(h){var T=l+m-x;if(T>=0&&T<u&&f[T]!=-1){var E=o-f[T];if(C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}for(var D=-b+v;D<=b-y;D+=2){for(var T=l+D,E=D==-b||D!=b&&f[T-1]<f[T+1]?f[T+1]:f[T-1]+1,O=E-D;E<o&&O<s&&e.charAt(o-E-1)==t.charAt(s-O-1);)E++,O++;if(f[T]=E,E>o)y+=2;else if(O>s)v+=2;else if(!h){var S=l+m-D;if(S>=0&&S<u&&d[S]!=-1){var C=d[S],w=l+C-S;if(E=o-E,C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}}return[new n.Diff(r,e),new n.Diff(i,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]=``;function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){o=e.indexOf(`
190
190
  `,i),o==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},n.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},n.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}},n.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var i=this;function a(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),a=-1,o=``,s,c,l,u;(a=t.indexOf(r,a+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(a)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,a));o.length<f+d&&(o=t.substring(a-f,a)+t.substring(a,a+d),s=e.substring(0,n-f),c=e.substring(n+d),l=t.substring(0,a-f),u=t.substring(a+d))}return o.length*2>=e.length?[s,c,l,u,o]:null}var o=a(n,r,Math.ceil(n.length/4)),s=a(n,r,Math.ceil(n.length/2)),c;if(!o&&!s)return null;c=s?o&&o[4].length>s[4].length?o:s:o;var l,u,d,f;e.length>t.length?(l=c[0],u=c[1],d=c[2],f=c[3]):(d=c[0],f=c[1],l=c[2],u=c[3]);var p=c[4];return[l,u,d,f,p]},n.prototype.diff_cleanupSemantic=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=0,d=0,f=0,p=0;l<e.length;)e[l][0]==a?(o[s++]=l,u=f,d=p,f=0,p=0,c=e[l][1]):(e[l][0]==i?f+=e[l][1].length:p+=e[l][1].length,c&&c.length<=Math.max(u,d)&&c.length<=Math.max(f,p)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,s--,l=s>0?o[s-1]:-1,u=0,d=0,f=0,p=0,c=null,t=!0)),l++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l<e.length;){if(e[l-1][0]==r&&e[l][0]==i){var m=e[l-1][1],h=e[l][1],g=this.diff_commonOverlap_(m,h),_=this.diff_commonOverlap_(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(l,0,new n.Diff(a,h.substring(0,g))),e[l-1][1]=m.substring(0,m.length-g),e[l+1][1]=h.substring(g),l++):(_>=m.length/2||_>=h.length/2)&&(e.splice(l,0,new n.Diff(a,m.substring(0,_))),e[l-1][0]=i,e[l-1][1]=h.substring(0,h.length-_),e[l+1][0]=r,e[l+1][1]=m.substring(_),l++),l++}l++}},n.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var r=e.charAt(e.length-1),i=t.charAt(0),a=r.match(n.nonAlphaNumericRegex_),o=i.match(n.nonAlphaNumericRegex_),s=a&&r.match(n.whitespaceRegex_),c=o&&i.match(n.whitespaceRegex_),l=s&&r.match(n.linebreakRegex_),u=c&&i.match(n.linebreakRegex_),d=l&&e.match(n.blanklineEndRegex_),f=u&&t.match(n.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==a&&e[r+1][0]==a){var i=e[r-1][1],o=e[r][1],s=e[r+1][1],c=this.diff_commonSuffix(i,o);if(c){var l=o.substring(o.length-c);i=i.substring(0,i.length-c),o=l+o.substring(0,o.length-c),s=l+s}for(var u=i,d=o,f=s,p=t(i,o)+t(o,s);o.charAt(0)===s.charAt(0);){i+=o.charAt(0),o=o.substring(1)+s.charAt(0),s=s.substring(1);var m=t(i,o)+t(o,s);m>=p&&(p=m,u=i,d=o,f=s)}e[r-1][1]!=u&&(u?e[r-1][1]=u:(e.splice(r-1,1),r--),e[r][1]=d,f?e[r+1][1]=f:(e.splice(r+1,1),r--))}r++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=!1,d=!1,f=!1,p=!1;l<e.length;)e[l][0]==a?(e[l][1].length<this.Diff_EditCost&&(f||p)?(o[s++]=l,u=f,d=p,c=e[l][1]):(s=0,c=null),f=p=!1):(e[l][0]==r?p=!0:f=!0,c&&(u&&d&&f&&p||c.length<this.Diff_EditCost/2&&u+d+f+p==3)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,c=null,u&&d?(f=p=!0,s=0):(s--,l=s>0?o[s-1]:-1,f=p=!1),t=!0)),l++;t&&this.diff_cleanupMerge(e)},n.prototype.diff_cleanupMerge=function(e){e.push(new n.Diff(a,``));for(var t=0,o=0,s=0,c=``,l=``,u;t<e.length;)switch(e[t][0]){case i:s++,l+=e[t][1],t++;break;case r:o++,c+=e[t][1],t++;break;case a:o+s>1?(o!==0&&s!==0&&(u=this.diff_commonPrefix(l,c),u!==0&&(t-o-s>0&&e[t-o-s-1][0]==a?e[t-o-s-1][1]+=l.substring(0,u):(e.splice(0,0,new n.Diff(a,l.substring(0,u))),t++),l=l.substring(u),c=c.substring(u)),u=this.diff_commonSuffix(l,c),u!==0&&(e[t][1]=l.substring(l.length-u)+e[t][1],l=l.substring(0,l.length-u),c=c.substring(0,c.length-u))),t-=o+s,e.splice(t,o+s),c.length&&(e.splice(t,0,new n.Diff(r,c)),t++),l.length&&(e.splice(t,0,new n.Diff(i,l)),t++),t++):t!==0&&e[t-1][0]==a?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,s=0,o=0,c=``,l=``}e[e.length-1][1]===``&&e.pop();var d=!1;for(t=1;t<e.length-1;)e[t-1][0]==a&&e[t+1][0]==a&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),d=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),d=!0)),t++;d&&this.diff_cleanupMerge(e)},n.prototype.diff_xIndex=function(e,t){var n=0,a=0,o=0,s=0,c;for(c=0;c<e.length&&(e[c][0]!==i&&(n+=e[c][1].length),e[c][0]!==r&&(a+=e[c][1].length),!(n>t));c++)o=n,s=a;return e.length!=c&&e[c][0]===r?s:s+(t-o)},n.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,o=/</g,s=/>/g,c=/\n/g,l=0;l<e.length;l++){var u=e[l][0],d=e[l][1].replace(n,`&amp;`).replace(o,`&lt;`).replace(s,`&gt;`).replace(c,`&para;<br>`);switch(u){case i:t[l]=`<ins style="background:#e6ffe6;">`+d+`</ins>`;break;case r:t[l]=`<del style="background:#ffe6e6;">`+d+`</del>`;break;case a:t[l]=`<span>`+d+`</span>`}}return t.join(``)},n.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==i&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==r&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_levenshtein=function(e){for(var t=0,n=0,o=0,s=0;s<e.length;s++){var c=e[s][0],l=e[s][1];switch(c){case i:n+=l.length;break;case r:o+=l.length;break;case a:t+=Math.max(n,o),n=0,o=0}}return t+=Math.max(n,o),t},n.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case i:t[n]=`+`+encodeURI(e[n][1]);break;case r:t[n]=`-`+e[n][1].length;break;case a:t[n]=`=`+e[n][1].length}return t.join(` `).replace(/%20/g,` `)},n.prototype.diff_fromDelta=function(e,t){for(var o=[],s=0,c=0,l=t.split(/\t/g),u=0;u<l.length;u++){var d=l[u].substring(1);switch(l[u].charAt(0)){case`+`:try{o[s++]=new n.Diff(i,decodeURI(d))}catch{throw Error(`Illegal escape in diff_fromDelta: `+d)}break;case`-`:case`=`:var f=parseInt(d,10);if(isNaN(f)||f<0)throw Error(`Invalid number in diff_fromDelta: `+d);var p=e.substring(c,c+=f);l[u].charAt(0)==`=`?o[s++]=new n.Diff(a,p):o[s++]=new n.Diff(r,p);break;default:if(l[u])throw Error(`Invalid diff operation in diff_fromDelta: `+l[u])}}if(c!=e.length)throw Error(`Delta length (`+c+`) does not equal source text length (`+e.length+`).`);return o},n.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},n.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),s=e.lastIndexOf(t,n+t.length),s!=-1&&(o=Math.min(a(0,s),o)));var c=1<<t.length-1;s=-1;for(var l,u,d=t.length+e.length,f,p=0;p<t.length;p++){for(l=0,u=d;l<u;)a(p,n+u)<=o?l=u:d=u,u=Math.floor((d-l)/2+l);d=u;var m=Math.max(1,n-u+1),h=Math.min(n+u,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(p===0?g[_]=(g[_+1]<<1|1)&v:g[_]=(g[_+1]<<1|1)&v|(f[_+1]|f[_])<<1|1|f[_+1],g[_]&c){var y=a(p,_-1);if(y<=o){if(o=y,s=_-1,s>n)m=Math.max(1,2*n-s);else break}}}if(a(p+1,n)>o)break;f=g}return s},n.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},n.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=t.substring(e.start2,e.start2+e.length1),i=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=t.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var o=t.substring(e.start2-i,e.start2);o&&e.diffs.unshift(new n.Diff(a,o));var s=t.substring(e.start2+e.length1,e.start2+e.length1+i);s&&e.diffs.push(new n.Diff(a,s)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+s.length,e.length2+=o.length+s.length}},n.prototype.patch_make=function(e,t,o){var s,c;if(typeof e==`string`&&typeof t==`string`&&o===void 0)s=e,c=this.diff_main(s,t,!0),c.length>2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(e&&typeof e==`object`&&t===void 0&&o===void 0)c=e,s=this.diff_text1(c);else if(typeof e==`string`&&t&&typeof t==`object`&&o===void 0)s=e,c=t;else if(typeof e==`string`&&typeof t==`string`&&o&&typeof o==`object`)s=e,c=o;else throw Error(`Unknown call format to patch_make.`);if(c.length===0)return[];for(var l=[],u=new n.patch_obj,d=0,f=0,p=0,m=s,h=s,g=0;g<c.length;g++){var _=c[g][0],v=c[g][1];switch(!d&&_!==a&&(u.start1=f,u.start2=p),_){case i:u.diffs[d++]=c[g],u.length2+=v.length,h=h.substring(0,p)+v+h.substring(p);break;case r:u.length1+=v.length,u.diffs[d++]=c[g],h=h.substring(0,p)+h.substring(p+v.length);break;case a:v.length<=2*this.Patch_Margin&&d&&c.length!=g+1?(u.diffs[d++]=c[g],u.length1+=v.length,u.length2+=v.length):v.length>=2*this.Patch_Margin&&d&&(this.patch_addContext_(u,m),l.push(u),u=new n.patch_obj,d=0,m=h,f=p)}_!==i&&(f+=v.length),_!==r&&(p+=v.length)}return d&&(this.patch_addContext_(u,m),l.push(u)),l},n.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r],a=new n.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new n.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,t[r]=a}return t},n.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var o=0,s=[],c=0;c<e.length;c++){var l=e[c].start2+o,u=this.diff_text1(e[c].diffs),d,f=-1;if(u.length>this.Match_MaxBits?(d=this.match_main(t,u.substring(0,this.Match_MaxBits),l),d!=-1&&(f=this.match_main(t,u.substring(u.length-this.Match_MaxBits),l+u.length-this.Match_MaxBits),(f==-1||d>=f)&&(d=-1))):d=this.match_main(t,u,l),d==-1)s[c]=!1,o-=e[c].length2-e[c].length1;else{s[c]=!0,o=d-l;var p=f==-1?t.substring(d,d+u.length):t.substring(d,f+this.Match_MaxBits);if(u==p)t=t.substring(0,d)+this.diff_text2(e[c].diffs)+t.substring(d+u.length);else{var m=this.diff_main(u,p,!1);if(u.length>this.Match_MaxBits&&this.diff_levenshtein(m)/u.length>this.Patch_DeleteThreshold)s[c]=!1;else{this.diff_cleanupSemanticLossless(m);for(var h=0,g,_=0;_<e[c].diffs.length;_++){var v=e[c].diffs[_];v[0]!==a&&(g=this.diff_xIndex(m,h)),v[0]===i?t=t.substring(0,d+g)+v[1]+t.substring(d+g):v[0]===r&&(t=t.substring(0,d+g)+t.substring(d+this.diff_xIndex(m,h+v[1].length))),v[0]!==r&&(h+=v[1].length)}}}}}return t=t.substring(n.length,t.length-n.length),[t,s]},n.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r=``,i=1;i<=t;i++)r+=String.fromCharCode(i);for(var i=0;i<e.length;i++)e[i].start1+=t,e[i].start2+=t;var o=e[0],s=o.diffs;if(s.length==0||s[0][0]!=a)s.unshift(new n.Diff(a,r)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>s[0][1].length){var c=t-s[0][1].length;s[0][1]=r.substring(s[0][1].length)+s[0][1],o.start1-=c,o.start2-=c,o.length1+=c,o.length2+=c}if(o=e[e.length-1],s=o.diffs,s.length==0||s[s.length-1][0]!=a)s.push(new n.Diff(a,r)),o.length1+=t,o.length2+=t;else if(t>s[s.length-1][1].length){var c=t-s[s.length-1][1].length;s[s.length-1][1]+=r.substring(0,c),o.length1+=c,o.length2+=c}return r},n.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,o=0;o<e.length;o++)if(!(e[o].length1<=t)){var s=e[o];e.splice(o--,1);for(var c=s.start1,l=s.start2,u=``;s.diffs.length!==0;){var d=new n.patch_obj,f=!0;for(d.start1=c-u.length,d.start2=l-u.length,u!==``&&(d.length1=d.length2=u.length,d.diffs.push(new n.Diff(a,u)));s.diffs.length!==0&&d.length1<t-this.Patch_Margin;){var p=s.diffs[0][0],m=s.diffs[0][1];p===i?(d.length2+=m.length,l+=m.length,d.diffs.push(s.diffs.shift()),f=!1):p===r&&d.diffs.length==1&&d.diffs[0][0]==a&&m.length>2*t?(d.length1+=m.length,c+=m.length,f=!1,d.diffs.push(new n.Diff(p,m)),s.diffs.shift()):(m=m.substring(0,t-d.length1-this.Patch_Margin),d.length1+=m.length,c+=m.length,p===a?(d.length2+=m.length,l+=m.length):f=!1,d.diffs.push(new n.Diff(p,m)),m==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(m.length))}u=this.diff_text2(d.diffs),u=u.substring(u.length-this.Patch_Margin);var h=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);h!==``&&(d.length1+=h.length,d.length2+=h.length,d.diffs.length!==0&&d.diffs[d.diffs.length-1][0]===a?d.diffs[d.diffs.length-1][1]+=h:d.diffs.push(new n.Diff(a,h))),f||e.splice(++o,0,d)}}},n.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},n.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var o=e.split(`
191
191
  `),s=0,c=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<o.length;){var l=o[s].match(c);if(!l)throw Error(`Invalid patch string: `+o[s]);var u=new n.patch_obj;for(t.push(u),u.start1=parseInt(l[1],10),l[2]===``?(u.start1--,u.length1=1):l[2]==`0`?u.length1=0:(u.start1--,u.length1=parseInt(l[2],10)),u.start2=parseInt(l[3],10),l[4]===``?(u.start2--,u.length2=1):l[4]==`0`?u.length2=0:(u.start2--,u.length2=parseInt(l[4],10)),s++;s<o.length;){var d=o[s].charAt(0);try{var f=decodeURI(o[s].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+f)}if(d==`-`)u.diffs.push(new n.Diff(r,f));else if(d==`+`)u.diffs.push(new n.Diff(i,f));else if(d==` `)u.diffs.push(new n.Diff(a,f));else if(d==`@`)break;else if(d!==``)throw Error(`Invalid patch mode "`+d+`" in: `+f);s++}}return t},n.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},n.patch_obj.prototype.toString=function(){for(var e=this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1,t=this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2,n=[`@@ -`+e+` +`+t+` @@
@@ -1539,6 +1539,6 @@ GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){funct
1539
1539
  `);re(e,o)}function j9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=k9(JSON.parse(n),t),i=n.endsWith(`
1540
1540
  `)?`
1541
1541
  `:``;re(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=O9(n,t.contentDir);r!==n&&re(e,r)}}function M9(e,t){let n=S(e,`utf-8`),r=O9(n,t.contentDir);r!==n&&re(e,r)}function N9(e){try{return w(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const zje=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function P9(e){return/\.log\.\d+$/.test(e)}function Bje(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||P9(e)}const Vje=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Hje(e){let t={contentDir:e.contentDir};for(let n of Vje)for(let r of N9(N(e.stagingDir,n)))Bje(r)?A9(r,t):r.endsWith(`.json`)?j9(r,t):M9(r,t);for(let n of N9(N(e.stagingDir,`state`))){let e=me(n);n.endsWith(`.jsonl`)?A9(n,t):zje.has(e)?j9(n,t):M9(n,t)}}const F9=[`.ok`,`local`,`telemetry`],I9=[`.ok`,`local`,`logs`],L9=[`.ok`,`local`,`loss-capture`],R9=`spans-current.jsonl`,z9=`spans-prev.jsonl`,B9=`server-current.jsonl`,V9=`server-prev.jsonl`,H9=`loss-current.jsonl`,U9=`loss-prev.jsonl`;function Uje(e){return N(e,...F9,R9)}function Wje(e){return N(e,...F9,z9)}function Gje(e){return N(e,...I9,B9)}function Kje(e){return N(e,...I9,V9)}function qje(e){return N(e,...L9,H9)}function Jje(e){return N(e,...L9,U9)}const W9=1e3;async function Yje(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function Xje(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function Zje(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}function Qje(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(`
1542
- `)}\n`:null}catch{return null}}function $je(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],L6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function eMe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],L6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){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 tMe(){return{nodeVersion:process.version,platform:le(),arch:ae()}}function nMe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,hs.parse)(S(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(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function rMe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return rMe(e.maxBytes)}function iMe(e){let t=q9(kl(`project`,e)),n=q9(kl(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function aMe(e){return De(`sha256`).update(e).digest(`hex`)}function oMe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const sMe=[`"doc.name"`,`"docName"`];function cMe(e){let t=S(e,`utf-8`),n=0;for(let e of sMe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function X9(e,t){if(!g(e))return!1;try{return v(M(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,S7(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Z9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const lMe=new Set([`.jsonl`]);function uMe(e){let t=e.lastIndexOf(`.`);return t!==-1&&lMe.has(e.slice(t))}const Q9=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function dMe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&Q9.has(e.slice(t))}function fMe(e){let t=[];for(let n of Z9(e)){let r=$9(e,n);if(!dMe(r))continue;let{redacted:i,patterns:a,lineCount:o}=aV(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return ye(e,t).split(xe).join(`/`)}async function pMe(e){let t=be(e.contentDir),n=be(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Yje,a=r.fetchAgentEffects??Xje,o=r.fetchWatcherRecent??Zje,s=r.readShadowHead??$je,c=r.readCheckpointRefs??eMe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.79.12-beta.0`),d=r.readDesktopEnv??G9,f=r.readLanguage??D9,p=r.readRuntime??tMe,h=r.isOtlpPushEnabled??nMe,_=y(N(A(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),X9(Uje(n),N(_,`telemetry`,R9)),X9(Wje(n),N(_,`telemetry`,z9)),X9(Gje(n),N(_,`logs`,B9)),X9(Kje(n),N(_,`logs`,V9));for(let t of e.userLogFiles??[])X9(t,N(_,`logs`,me(t)));for(let t of e.userStateFiles??[])X9(t,N(_,OR,me(t)));let y=0;for(let t of e.diagnosticReports?.files??[])X9(t,N(_,`diagnostic-reports`,me(t)))&&(y+=1);let b=N(n,`.ok`,`local`),x=N(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){X9(x,N(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(N(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(N(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=Qje(n);e!==null&&re(N(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(N(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(N(_,`state`,`checkpoint-refs.txt`),D),X9(qje(n),N(_,`state`,H9)),X9(Jje(n),N(_,`state`,U9)),X9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),X9(N(b,Zc),N(_,`state`,Zc)),X9(N(b,Qc),N(_,`state`,Qc)),X9(N(b,Xc),N(_,`state`,Xc));let ee=p(),ne=d(),ie=f(),ae={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=C===`running`?`running
1542
+ `)}\n`:null}catch{return null}}function $je(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],L6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function eMe(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],L6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){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 tMe(){return{nodeVersion:process.version,platform:le(),arch:ae()}}function nMe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,hs.parse)(S(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(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function rMe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return rMe(e.maxBytes)}function iMe(e){let t=q9(kl(`project`,e)),n=q9(kl(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function aMe(e){return De(`sha256`).update(e).digest(`hex`)}function oMe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const sMe=[`"doc.name"`,`"docName"`];function cMe(e){let t=S(e,`utf-8`),n=0;for(let e of sMe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function X9(e,t){if(!g(e))return!1;try{return v(M(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,S7(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Z9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const lMe=new Set([`.jsonl`]);function uMe(e){let t=e.lastIndexOf(`.`);return t!==-1&&lMe.has(e.slice(t))}const Q9=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function dMe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&Q9.has(e.slice(t))}function fMe(e){let t=[];for(let n of Z9(e)){let r=$9(e,n);if(!dMe(r))continue;let{redacted:i,patterns:a,lineCount:o}=aV(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return ye(e,t).split(xe).join(`/`)}async function pMe(e){let t=be(e.contentDir),n=be(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Yje,a=r.fetchAgentEffects??Xje,o=r.fetchWatcherRecent??Zje,s=r.readShadowHead??$je,c=r.readCheckpointRefs??eMe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.80.0-beta.0`),d=r.readDesktopEnv??G9,f=r.readLanguage??D9,p=r.readRuntime??tMe,h=r.isOtlpPushEnabled??nMe,_=y(N(A(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),X9(Uje(n),N(_,`telemetry`,R9)),X9(Wje(n),N(_,`telemetry`,z9)),X9(Gje(n),N(_,`logs`,B9)),X9(Kje(n),N(_,`logs`,V9));for(let t of e.userLogFiles??[])X9(t,N(_,`logs`,me(t)));for(let t of e.userStateFiles??[])X9(t,N(_,OR,me(t)));let y=0;for(let t of e.diagnosticReports?.files??[])X9(t,N(_,`diagnostic-reports`,me(t)))&&(y+=1);let b=N(n,`.ok`,`local`),x=N(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){X9(x,N(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(N(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(N(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=Qje(n);e!==null&&re(N(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(N(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(N(_,`state`,`checkpoint-refs.txt`),D),X9(qje(n),N(_,`state`,H9)),X9(Jje(n),N(_,`state`,U9)),X9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),X9(N(b,Zc),N(_,`state`,Zc)),X9(N(b,Qc),N(_,`state`,Qc)),X9(N(b,Xc),N(_,`state`,Xc));let ee=p(),ne=d(),ie=f(),ae={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=C===`running`?`running
1543
1543
  `:`not-running (${w})\n`;re(N(_,`state`,`server-status.txt`),oe);let se=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:x7(e.diagnosticReports,y);if(re(N(_,`state`,`diagnostic-reports-status.txt`),`${se}\n`),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let k=e.redact===!0;k&&Hje({stagingDir:_,contentDir:t}),e.note&&re(N(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=fMe(_));for(let t of e.extraFiles??[]){let e=t.zipName??me(t.sourcePath);if(!X9(t.sourcePath,N(_,`extra`,e))){r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=w7(t,`extra/${e}`);n!==null&&(ce??={redactions:[],redactedLineCount:0},ce.redactions.push(n),ce.redactedLineCount+=n.lineCount)}let le=iMe(n),ue=Z9(_),A=[],j=0,de=0;for(let e of ue){let t=$9(_,e),n=te(e).size,r=uMe(t)?oMe(e):0;A.push({path:t,bytes:n,lines:r}),j+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=cMe(e))}let fe={applied:k};ce!==null&&(fe.secretScrub=ce);let pe={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie},contentDir:{pathSha256:aMe(t),absolutePath:k?`<CONTENT_DIR>`:t},telemetry:{localSink:le,otlpPushEnabled:h()},redaction:fe,serverStatus:C,files:A};re(N(_,`manifest.json`),`${JSON.stringify(pe,null,2)}\n`);let M=ue.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),he={stagedDiagnosticReports:y,totalBytes:j,fileCount:A.length,docNameCount:de,contentDirVisible:M,redacted:k},ge=!1;return{stagingDir:_,manifest:pe,summary:he,cleanup:()=>{ge||(ge=!0,O(_,{recursive:!0,force:!0}))}}}catch(e){throw O(_,{recursive:!0,force:!0}),e}}async function mMe(e){let{collected:t,outputPath:n}=e,r=M(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new pwe.ZipFile,a=Z9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(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 hMe(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,hs.parse)(S(n,`utf-8`)),r=W8(t)?t.content:void 0,i=W8(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return be(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 be(e)}async function gMe(e,t,n,r,i){let a=T7(t,e.logger),o=await pMe({contentDir:hMe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...DAe(a,e.userLogsDir??N(k(),`.ok`,`logs`)),...D7(e.cachesDir??N(k(),`Library`,`Caches`))],userStateFiles:O7(e.bugReportsDir??C7()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(M(e.outputPath),{recursive:!0}),await mMe({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 _Me(e){let{projectDir:t}=e,n=e.readDesktopEnv??G9,r=e.readLanguage??D9,i=()=>SAe(e.diagnosticReportsDir??N(k(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return gMe(e,t,n,r,i());let{zipPath:a,summary:o}=await MAe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:D7(e.cachesDir??N(k(),`Library`,`Caches`)),bugReportLedgerFiles:O7(e.bugReportsDir??C7()),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}}}export{Z8 as ALL_EDITOR_IDS,Q8 as EDITOR_LABELS,O5 as EDITOR_TARGETS,HOe as HOSTS_WITH_USER_SKILL_DIR,cAe as LAUNCH_CONFIG_NAME,xje as PATH_SHIM_BEGIN,Cje as PATH_SHIM_BLOCK_RE,Sje as PATH_SHIM_END,F5 as ProjectPathSafetyError,Bke as addOkPathsToGitExclude,I5 as assertProjectPathSafe,u5 as buildManagedServerEntry,dje as buildMcpConfigDeclineEvent,fje as buildMcpConfigMigrateEvent,v7 as classifyExistingMcpEntry,_Me as collectReportBundle,Oje as createCliProbeResolver,Bl as createTokenStore,wAe as defaultBugReportZipPath,We as detectGh,qe as detectGhAccounts,fAe as detectInstalledEditors,y5 as droppedManagedKeys,lke as editorConfigPathDisplay,cke as editorEntryLocator,eje as ensurePiBridge,X5 as formatTrackedRemediation,Uke as getExcludedOkPaths,J5 as getInstalledSkillProjectionPaths,VOe as getNativeTomlMcpEditor,q5 as getOkArtifactPaths,c5 as isEntryUpToDate,d5 as isOwnManagedEntry,vje as loadConfig,Hl as makeLazyProbeTokenStore,C7 as okBugReportsDir,y9 as parseGitHubBlobUrl,yje as parseGitHubShareUrl,b9 as parseGitHubTreeUrl,v9 as parseGitUrl,wje as pathInstallMarkerPath,wke as previewContent,pAe as probeOwnManagedEditorMcpEntry,QAe as probePiBridgeState,Y5 as probeTrackedOkPaths,g7 as readExistingMcpEntry,Hke as readSharingMode,aV as redactContent,Vke as removeOkPathsFromGitExclude,sje as removeOwnMcpEntry,Ike as removeProjectSkill,Aje as removeUserGlobalSkillBundle,Ije as removeUserSkill,Ake as resolveProjectRoot,hje as runStop,m9 as truncatePriorEntry,T9 as userGlobalSkillBundleTargets,Fje as userSkillPresentAnywhere,bje as validateLocalFolderForShare,h7 as writeEditorMcpConfig,Nje as writeProjectAiIntegrations,H5 as writeProjectSkill,dAe as writeUserMcpConfigs,Pje as writeUserSkill};
1544
1544
  //# sourceMappingURL=index.mjs.map