@inkeep/open-knowledge 0.62.0-beta.16 → 0.62.0-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{acp-harness-probe-BdY0YKhn.mjs → acp-harness-probe-oUvOUBDG.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-DeTywrcI.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-Bas2IhAF.mjs → init-Bok8w4bD.mjs} +3 -3
- package/dist/init-BuLvv82B.mjs +1 -0
- package/dist/{launch-json-removal-_ePY6PpX.mjs → launch-json-removal-DJVuHY0O.mjs} +2 -2
- package/dist/loader-BefCXSJw.mjs +1 -0
- package/dist/{loader-D1g_Oe84.mjs → loader-DsUw5zIN.mjs} +2 -2
- package/dist/{open-browser-C8aTFyoc.mjs → open-browser-CQV4BpIk.mjs} +2 -2
- package/dist/{preview-DUPHQHwx.mjs → preview-BHw-SgP2.mjs} +2 -2
- package/dist/preview-D0JcJ_7n.mjs +1 -0
- package/dist/public/assets/FeedbackForm-CJpDBZ7I.js +1 -0
- package/dist/public/assets/SessionsHost-BuxUB0gY.js +2 -0
- package/dist/public/assets/{SkillToolbarControls-CqMcW-Yb.js → SkillToolbarControls-IrJrSqoz.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-DGZ6HanT.js → TerminalWindowApp-CixXB6ef.js} +1 -1
- package/dist/public/assets/{index-L1YUGrkn.js → index-f65PQqkn.js} +5 -5
- package/dist/public/assets/skill-actions-CwMYImH9.js +1 -0
- package/dist/public/index.html +2 -2
- package/dist/{repair-launch-json-CIpfDgE7.mjs → repair-launch-json-Cqrgjn-K.mjs} +2 -2
- package/dist/{repair-mcp-configs-BnJffGe8.mjs → repair-mcp-configs-DeCwNBjA.mjs} +2 -2
- package/dist/{repair-skills-BcmQVWCQ.mjs → repair-skills-B9KF6HMH.mjs} +2 -2
- package/dist/repair-skills-Kd_Yg4iC.mjs +1 -0
- package/dist/{resolve-project-root-B1L9l8eS.mjs → resolve-project-root-C74NWxWO.mjs} +2 -2
- package/dist/{skill-teardown-DHXBmhnd.mjs → skill-teardown-Byb0Eg2k.mjs} +2 -2
- package/dist/src-BZFqCMs1.mjs +1 -0
- package/dist/{src-DuMNgRKU.mjs → src-DHEqjDrK.mjs} +1 -1
- package/dist/{src-HiXYDwFt.mjs → src-DKob1_qE.mjs} +2 -2
- package/dist/{src-o2syKqOu.mjs → src-DzuFrTJZ.mjs} +393 -393
- package/dist/start-BCaGsYo1.mjs +1 -0
- package/dist/{start-BpkCBRLQ.mjs → start-ZJj_kmD3.mjs} +3 -3
- package/package.json +4 -4
- package/dist/constants-DHuVwd3O.mjs +0 -2
- package/dist/init-meqjuSh8.mjs +0 -1
- package/dist/loader-Cns9jTMa.mjs +0 -1
- package/dist/preview-BidJqIVa.mjs +0 -1
- package/dist/public/assets/FeedbackForm-Dh5EwToG.js +0 -1
- package/dist/public/assets/SessionsHost-BBIFzXMA.js +0 -2
- package/dist/public/assets/skill-actions-DonnKP5_.js +0 -1
- package/dist/repair-skills-iLrTlN-L.mjs +0 -1
- package/dist/src-CvFALTzm.mjs +0 -1
- package/dist/start-CJWlFaa6.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{$n as n,B as r,Nn as i,Qn as a,a as o}from"./DocumentContext-BtfwcPLA.js";import{t as s}from"./react-f2sANaYj.js";import{n as c,r as l}from"./dist-Nvb76hAm.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{a as d,r as f}from"./local-menu-action-bus-BuSRFm5g.js";import{t as p}from"./utils-CPqDy6Hr.js";import{S as m,_ as h,a as g,b as _,c as v,h as y,l as b,n as x,o as S,r as C,s as w,t as T,u as E,y as D}from"./SkillInstallMenu-Bq35tbgf.js";import{t as O}from"./button-CA0dewJJ.js";import{i as k,n as A,t as j}from"./tooltip-DPvMEqsq.js";import{a as M,c as N,i as ee,n as P,o as F,r as I,s as te,t as L}from"./dialog-BH80AfFt.js";import{t as R}from"./alert-dialog-C8E8SkhJ.js";import{C as z,M as B,S as V,T as H,_ as U,c as W,d as G,f as K,g as q,h as J,l as Y,n as X,p as ne,r as re,s as ie,u as ae,w as oe}from"./terminal-cli-display-D8nQE2mj.js";import{a as se,d as ce,f as le,i as ue,o as de,p as fe,u as pe}from"./dropdown-menu-DRIarAms.js";import{t as me}from"./label-Bbz2bT-a.js";import{Bn as he,Fo as ge,Hn as _e,Io as ve,Jn as ye,Kn as be,Mt as xe,No as Se,Qt as Ce,Sn as we,Vn as Te,Vo as Ee,Wn as De,Yn as Oe,Zt as ke,ct as Ae,ea as je,fn as Me,lt as Ne,qn as Pe,uo as Fe,xn as Ie,yn as Le,zn as Re}from"./dist-Au27GgPD2.js";import{n as Z}from"./dist-CuH7ikCn.js";import{i as ze}from"./use-settings-route-BLVf3fNR.js";import{t as Be}from"./dist-BIGNzOeF2.js";import{f as Ve,l as He,m as Ue,n as We,p as Ge,r as Ke,u as qe}from"./documents-events-R20cDmIc.js";import{i as Je}from"./use-apply-config-theme-B1eLRQeV.js";import{t as Ye}from"./parse-api-error-DcnXKbfT.js";import{n as Xe,t as Ze}from"./workspace-paths-CD0W1etA.js";import{t as Qe}from"./use-workspace-6-HDvG9b.js";import{t as $e}from"./createLucideIcon-CAkY8Blx.js";import{t as et}from"./arrow-up-right-CXMA4cr5.js";import{t as tt}from"./RegisteredAgentIcon-D_jDwJpu.js";import{n as nt,r as rt}from"./ManagedArtifactProperties-DA5oGdwa.js";import{t as it}from"./folder-open-5aQb9yif.js";import{t as at}from"./use-open-skill-BygGs4PY.js";import{t as ot}from"./list-plus-1_iMFVqs.js";import{t as st}from"./trash-2-BVoWHmfV.js";import{a as ct,c as lt,f as ut}from"./skill-scope-lsPMXpYJ.js";import{t as dt}from"./input-a0WHtxX3.js";import{J as ft,q as pt,x as mt}from"./navigation-targets-DJDMKeRU.js";import{t as ht}from"./badge-D819pOsZ.js";import{F as gt,P as _t,T as vt,a as yt,b as bt,h as xt,n as St,r as Ct,t as wt,u as Tt,w as Et}from"./skills-api-CJg3RYWH.js";import{t as Dt}from"./DiffView-DHe2qKSH.js";import{n as Ot}from"./platform-labels-ePF0gcem.js";var Q=t(),$=e(s(),1),kt=u();function At(e){return{async install(t){let n;try{n=await e.buildAndOpen(t?.force?{force:!0}:void 0)}catch(e){return{ok:!1,reason:`bridge-error`,message:e instanceof Error?e.message:String(e)}}return n.ok?{ok:!0,path:n.path}:{ok:!1,reason:n.reason,message:n.message}}}}function jt(e={}){let t=e.fetch??globalThis.fetch,n=`${e.apiOrigin??``}/api/install-skill`;return{async install(e){let r;try{r=await t(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?.force?{force:!0}:{})})}catch(e){return{ok:!1,reason:`network-error`,message:e instanceof Error?e.message:String(e)}}if(!r.ok){let e=`HTTP ${r.status}`;try{let t=Ye(await r.json());t&&(e=t)}catch{}return{ok:!1,reason:`http-error`,message:e}}let i;try{i=await r.json()}catch(e){return{ok:!1,reason:`parse-error`,message:e instanceof Error?e.message:Be._({id:`1vn0CI`})}}return!i||typeof i.status!=`string`?{ok:!1,reason:`parse-error`,message:Be._({id:`NoY1k4`})}:i.status===`failed`?{ok:!1,reason:`build-failed`,message:i.buildError??Be._({id:`MrUmCD`})}:{ok:!0,path:i.outputPath,handoffWarning:i.handoffError?.message}}}}function Mt(){if(typeof window>`u`)return null;let e=window.okDesktop?.skill;return e?At(e):jt()}var Nt=`ok:skill:cowork:installed`,Pt=`1`,Ft=250,It=`/api/skill/install-state`;function Lt(e){return`${Nt}:v${e}`}var Rt=new Map;async function zt(e={},t={}){let n=t.force?`__force__`:`__default__`,r=Rt.get(n);if(r)return r;let i=Bt(e,t);return Rt.set(n,i),i.finally(()=>{Rt.get(n)===i&&Rt.delete(n)}),i}async function Bt(e,t){let n=e.installer===void 0?Mt():e.installer,r=Vt(e.storage),i=e.fetchSnapshot??Ut,a=e.serverTimeoutMs??Ft,o=null;if(!t.force){try{o=await Wt(i(),a)}catch(e){console.warn(`[cowork-skill] server install-state check failed; falling through:`,e)}if(o){let e=o.targets[`claude-cowork`]??null;if(e&&e.version===o.currentVersion)return{kind:`already-installed`,source:`server`}}}let s=Lt(o?.currentVersion??e.fallbackSkillVersion??Ht());if(!t.force&&r?.getItem(s)===Pt)return{kind:`already-installed`,source:`local`};if(!n)return{kind:`host-unsupported`};let c=await n.install({force:t.force??!1});if(!c.ok)return{kind:`install-failed`,reason:c.reason,message:c.message};try{r?.setItem(s,Pt)}catch(e){console.warn(`[cowork-skill] storage.setItem failed (guard will not persist):`,e)}return{kind:`installed-now`,path:c.path,handoffWarning:c.handoffWarning}}function Vt(e){if(e!==void 0)return e;if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Ht(){return typeof window>`u`?`unknown`:window.okDesktop?.appVersion??`unknown`}async function Ut(){let e;try{e=await fetch(It,{method:`GET`,cache:`no-store`})}catch{return null}if(!e.ok)return null;try{let t=await e.json();return typeof t?.currentVersion==`string`?t:null}catch{return null}}async function Wt(e,t){return Promise.race([e,new Promise(e=>{setTimeout(()=>e(null),t)})])}function Gt(e){return zt({},e)}function Kt(){return zt({},{force:!0})}async function qt(e,t){let n;try{n=await t(`/api/handoff`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)})}catch(e){return{ok:!1,reason:`dispatch-error`,detail:e instanceof Error?e.message:String(e)}}return n.status===200?{ok:!0}:n.status===404?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned 404`}:n.status===422?{ok:!1,reason:`not-installed`,detail:`POST /api/handoff returned ${n.status}`}:{ok:!1,reason:`dispatch-error`,detail:`POST /api/handoff returned ${n.status}`}}async function Jt(e,t={}){let n=t.fetch??globalThis.fetch.bind(globalThis);switch(e.target){case`claude-cowork`:return qt({target:`claude-cowork`,url:Le({mode:`cowork`},e)},n);case`claude-code`:return qt({target:`claude-code`,url:Le({mode:`code`},e)},n);case`codex`:return qt({target:`codex`,url:Ie(e)},n);case`cursor`:return qt({target:`cursor`,url:we(e),workspacePath:e.projectDir},n);case`copilot`:return{ok:!1,reason:`invalid-payload`,detail:`copilot is terminal-only; launch via requestTerminalLaunch`};case`opencode`:return{ok:!1,reason:`invalid-payload`,detail:`opencode is terminal-only; launch via requestTerminalLaunch`};case`pi`:return{ok:!1,reason:`invalid-payload`,detail:`pi is terminal-only; launch via requestTerminalLaunch`};case`antigravity`:return{ok:!1,reason:`invalid-payload`,detail:`antigravity is terminal-only; launch via requestTerminalLaunch`};case`openclaw`:return{ok:!1,reason:`invalid-payload`,detail:`openclaw is terminal-only; launch via requestTerminalLaunch`};case`hermes`:return{ok:!1,reason:`invalid-payload`,detail:`hermes is terminal-only; launch via requestTerminalLaunch`};default:{let t=e.target;return{ok:!1,reason:`invalid-payload`,detail:`unknown target: ${String(t)}`}}}}async function Yt(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var Xt=`open-knowledge:agent-thread-launch`;function Zt(e,t=typeof window>`u`?new EventTarget:window){d({kind:`agent-thread`,...e},t)||t.dispatchEvent(new CustomEvent(Xt,{detail:e}))}function Qt(e,t=typeof window>`u`?new EventTarget:window){let n=t=>{let n=t instanceof CustomEvent?t.detail:void 0;n&&typeof n.agentId==`string`&&e(n)};return t.addEventListener(Xt,n),()=>t.removeEventListener(Xt,n)}function $t(e){if(!e.docName||!e.workspace)return null;let t=Ze(e.docName),{contentDir:n,pathSeparator:r}=e.workspace;return{docContext:{relativePath:t},projectDir:n,docPath:Xe(n,t,r)}}function en(e){return e.workspace?.contentDir?{docContext:null,projectDir:e.workspace.contentDir,docPath:``}:null}function tn(e){return e.workspace?.contentDir?{docContext:null,createDescription:e.description,createScenario:e.scenario,createMentions:e.mentions,projectDir:e.workspace.contentDir,docPath:``}:null}function nn(e){return H(e.installUrl).then(()=>void 0)}function rn(e){return!e.workspace?.contentDir||!e.folderRelativePath?null:{docContext:null,folderRelativePath:e.folderRelativePath,projectDir:e.workspace.contentDir,docPath:``}}function an(e){return!e.workspace?.contentDir||!e.skillName?null:{docContext:null,skill:{name:e.skillName,scope:e.scope},projectDir:e.workspace.contentDir,docPath:``}}function on(e){if(!e.workspace?.contentDir)return null;let{contentDir:t,pathSeparator:n}=e.workspace;if(e.docName){let r=e.docRelativePath??Ze(e.docName),i={scope:`doc`,docRelativePath:r,instruction:e.instruction,mentions:e.mentions};return{docContext:null,compose:e.selection===void 0?i:{...i,selection:e.selection},projectDir:t,docPath:Xe(t,r,n)}}return e.folderRelativePath?{docContext:null,compose:{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}:{docContext:null,compose:{scope:`project`,instruction:e.instruction,mentions:e.mentions},projectDir:t,docPath:``}}function sn(e){return`Opened in ${e}.`}function cn(e,t=1){return t>=3?Be._({id:`bi2C2s`,values:{displayName:e}}):t===2?Be._({id:`1J0c0X`,values:{displayName:e}}):Be._({id:`Xs7IcT`,values:{displayName:e}})}function ln(e){return e>=3?null:e===2?Be._({id:`Xp94R1`}):Be._({id:`6gRgw8`})}function un(e,t,n,r,i){let a=i===void 0?{}:{scope:i};return t.ok?{target:e,host:n,outcome:`ok`,ts:r,...a}:{target:e,host:n,outcome:`error`,ts:r,reason:t.reason,...a}}function dn(e,t,n,r){if(e.scope===`doc`){let i={scope:`doc`,docRelativePath:e.docRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r};return e.selection===void 0?i:{...i,selection:e.selection}}return e.scope===`folder`?{scope:`folder`,folderRelativePath:e.folderRelativePath,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}:{scope:`project`,instruction:e.instruction,mentions:e.mentions,target:t,autoOpen:n,transport:r}}function fn(e,t,n,r){return e.compose?Me(dn(e.compose,t,n,r)):e.selection?be({...e.selection,target:t,transport:r}):e.skill?Pe(e.skill.name,e.skill.scope,n):e.ask?Re(e.ask.relativePath,e.ask.instruction,n,t,r):je(e.docContext===null?e.folderRelativePath?De(e.folderRelativePath,n,e.instruction,r):e.createDescription===void 0?Te(n,e.instruction,r):he(e.createDescription,n,e.createScenario??`new-project`,e.createMentions??[],r):_e(e.docContext.relativePath,n,e.instruction,r))}function pn(e,t){let n=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||n?`${Ae} ${fn(e,ke[t].handoffTarget,!1,`terminal`)}`:ye(e.docContext?.relativePath??null)}function mn(e){let t=typeof e.instruction==`string`&&e.instruction.trim()!==``;return e.compose!==void 0||e.createDescription!==void 0||t?`${Ne} ${fn(e,`claude-code`,!1,`terminal`)}`:Oe(e.docContext?.relativePath??null)}function hn(e){let t=e.docContext?.relativePath;return typeof t!=`string`||t===``?null:t.replace(/\.(md|mdx)$/,``)}function gn(e){let t=[e.compose?.instruction,e.selection?.instruction,e.ask?.instruction,e.createDescription,e.instruction];for(let e of t)if(typeof e==`string`&&e.trim()!==``)return e;return null}function _n(e,t){Zt({agentSource:t?.agent?.source??`registry`,agentId:t?.agent?.id??``,prompt:mn(e),docName:hn(e),titleHint:gn(e)})}async function vn(e,t,n,r=1){if(e===`claude-cowork`&&r===1){let e;try{e=await n.ensureCoworkSkillInstalled()}catch(e){let t=e instanceof Error?e.message:String(e);return n.toast.error(Be._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-error: ${t}`}}if(e.kind===`installed-now`)return n.toast.success(Be._({id:`PezM4_`})),{ok:!0};if(e.kind===`install-failed`){let t=e.message??e.reason;return n.toast.error(Be._({id:`wbpoGe`,values:{message:t}})),{ok:!1,reason:`dispatch-error`,detail:`install-failed: ${t}`}}}let i={target:e,projectDir:t.projectDir,docPath:t.docPath,prompt:fn(t,e,n.autoOpen,`url`)},a=await n.dispatchHandoff(i),o=n.isElectronHost()?`electron`:`web`,s=n.now().toISOString(),c=t.compose,l=un(e,a,o,s,t.selection!=null||c?.scope===`doc`&&c.selection!==void 0?`selection`:void 0);await n.recordHandoff(l);let u=n.getDisplayName(e);if(a.ok)n.toast.success(sn(u));else{let i=ln(r),a=cn(u,r);i===null?n.toast.error(a):n.toast.error(a,{action:{label:i,onClick:()=>{vn(e,t,n,r+1)}}})}return a}function yn(e){return z.find(t=>t.id===e)?.displayName??e}function bn(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function xn(){return{dispatchHandoff:Jt,recordHandoff:Yt,toast:{success:e=>{Z.success(e)},error:(e,t)=>{Z.error(e,t?{action:t.action}:void 0)}},now:()=>new Date,isElectronHost:()=>bn(),getDisplayName:yn,ensureCoworkSkillInstalled:Gt,autoOpen:!0}}function Sn(){let e=(0,kt.c)(2),{merged:t}=Je(),n=t?.appearance?.preview?.autoOpen??!0,r;return e[0]===n?r=e[1]:(r={dispatch:(e,t)=>vn(e,t,{...xn(),autoOpen:n}),reinstallCoworkSkill:Kt},e[0]=n,e[1]=r),r}var Cn=$e(`arrow-left-right`,[[`path`,{d:`M8 3 4 7l4 4`,key:`9rb6wj`}],[`path`,{d:`M4 7h16`,key:`6tx8e3`}],[`path`,{d:`m16 21 4-4-4-4`,key:`siv7j2`}],[`path`,{d:`M20 17H4`,key:`h6l3hr`}]]),wn=$e(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),Tn=$e(`pencil-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]);function En(e){let t=(0,kt.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(c,{id:`CZBqrX`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function Dn(e){let t=(0,kt.c)(2),{displayName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(c,{id:`1vczDE`,values:{displayName:n}}),t[0]=n,t[1]=r),r}function On(e){let t=(0,kt.c)(2),{agentName:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(c,{id:`g4e0hS`,values:{agentName:n}}),t[0]=n,t[1]=r),r}function kn(e){let t=(0,kt.c)(23),{onAddProperty:n,className:r,problemCount:i,problemMessages:a}=e,o=i===void 0?0:i,{_:s}=l(),u=o>0,d;t[0]!==s||t[1]!==u||t[2]!==o?(d=s(u?{id:`3KOHFt`,values:{problemCount:o}}:{id:`81H_23`}),t[0]=s,t[1]=u,t[2]=o,t[3]=d):d=t[3];let f=d,m;t[4]===r?m=t[5]:(m=p(`relative`,r),t[4]=r,t[5]=m);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(ot,{}),t[6]=h):h=t[6];let g;t[7]!==u||t[8]!==o?(g=u?(0,Q.jsx)(ht,{variant:`notification`,"aria-hidden":`true`,"data-testid":`add-properties-problem-badge`,className:`pointer-events-none absolute -top-0.5 -right-0.5 size-3.5 rounded-full p-0 font-sans text-[9px] leading-none tabular-nums`,children:o>9?`9+`:o}):null,t[7]=u,t[8]=o,t[9]=g):g=t[9];let _;t[10]===g?_=t[11]:(_=(0,Q.jsxs)(k,{children:[h,g]}),t[10]=g,t[11]=_);let v;t[12]!==f||t[13]!==n||t[14]!==m||t[15]!==_?(v=(0,Q.jsx)(O,{variant:`ghost`,size:`icon`,"aria-label":f,onClick:n,"data-testid":`add-properties-button`,className:m,asChild:!0,children:_}),t[12]=f,t[13]=n,t[14]=m,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==u||t[18]!==a?(y=(0,Q.jsx)(A,{side:`bottom`,children:u?(0,Q.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:(0,Q.jsx)(c,{id:`AwrGuz`})}),a?.map(An),(0,Q.jsx)(`span`,{className:`pt-0.5 opacity-70`,children:(0,Q.jsx)(c,{id:`yh5-4s`})})]}):(0,Q.jsx)(c,{id:`81H_23`})}),t[17]=u,t[18]=a,t[19]=y):y=t[19];let b;return t[20]!==v||t[21]!==y?(b=(0,Q.jsxs)(j,{children:[v,y]}),t[20]=v,t[21]=y,t[22]=b):b=t[22],b}function An(e,t){return(0,Q.jsx)(`span`,{className:`opacity-90`,children:e},t)}function jn(e){return e?Be._({id:`wTcjov`}):null}function Mn(e){let t=(0,kt.c)(47),{_:n}=l(),a=r(),o=D(),s=B(),u=V();if(a)return null;let{input:d,installStates:p,dispatch:m}=e,h=d===null,g,_,v,y,b,x,S,C,w,T,E;if(t[0]!==n||t[1]!==m||t[2]!==d||t[3]!==h||t[4]!==p||t[5]!==u||t[6]!==s||t[7]!==o){let e=jn(h),r;t[19]!==p||t[20]!==u?(r=e=>J(u,e.id,p[e.id]?.installed),t[19]=p,t[20]=u,t[21]=r):r=t[21];let a=oe.filter(r),l;t[22]===u?l=t[23]:(l=e=>q(u,e.source,e.id,!0,e.supported),t[22]=u,t[23]=l);let f=s.filter(l),D=o?Ce.filter(e=>U(u,e,o.installedClis)):[];v=a.length>0,y=o!==null&&D.length>0,b=f.length>0,_=G,t[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(ne,{children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),(0,Q.jsx)(c,{id:`O7_W_a`})]}),t[24]=E):E=t[24],g=K,x=`max-h-80`,S=b?(0,Q.jsxs)(ie,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(Y,{children:(0,Q.jsx)(c,{id:`RXEbZy`})}),f.map(t=>{let r=t.name;return(0,Q.jsxs)(W,{onSelect:()=>{d!==null&&_n(d,{agent:{source:t.source,id:t.id}})},disabled:h,"data-testid":`empty-space-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(tt,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[25]!==v||t[26]!==y||t[27]!==b?(C=b&&(y||v)?(0,Q.jsx)(ae,{}):null,t[25]=v,t[26]=y,t[27]=b,t[28]=C):C=t[28],w=y?(0,Q.jsxs)(ie,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(Y,{children:(0,Q.jsx)(c,{id:`ALhMYW`})}),D.map(t=>{let{displayName:r}=ke[t];return(0,Q.jsxs)(W,{onSelect:()=>{d!==null&&o.launchInTerminal(d,t)},disabled:h,"data-testid":`empty-space-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(re,{id:X(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,T=v?(0,Q.jsxs)(Q.Fragment,{children:[y?(0,Q.jsx)(ae,{}):null,(0,Q.jsxs)(ie,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(Y,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(c,{id:`BwKH4d`}),(0,Q.jsx)(et,{"aria-hidden":`true`,className:`size-3`})]}),a.map(t=>{let r=!h,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(W,{disabled:!r,onSelect:()=>{if(d){if(p[t.id]?.installed!==!0){nn(t);return}m(t.id,d)}},"data-testid":`empty-space-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(re,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(En,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=m,t[2]=d,t[3]=h,t[4]=p,t[5]=u,t[6]=s,t[7]=o,t[8]=g,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E}else g=t[8],_=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18];let O;t[29]!==v||t[30]!==y||t[31]!==b?(O=b||y||v?(0,Q.jsx)(ae,{}):null,t[29]=v,t[30]=y,t[31]=b,t[32]=O):O=t[32];let k;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(f,{"aria-hidden":`true`}),t[33]=k):k=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsxs)(W,{onSelect:ze,"data-testid":`empty-space-open-in-settings`,children:[k,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(c,{id:`jRAGrQ`})})]}),t[34]=A):A=t[34];let j;t[35]!==g||t[36]!==x||t[37]!==S||t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==O?(j=(0,Q.jsxs)(g,{className:x,children:[S,C,w,T,O,A]}),t[35]=g,t[36]=x,t[37]=S,t[38]=C,t[39]=w,t[40]=T,t[41]=O,t[42]=j):j=t[42];let M;return t[43]!==_||t[44]!==E||t[45]!==j?(M=(0,Q.jsxs)(_,{children:[E,j]}),t[43]=_,t[44]=E,t[45]=j,t[46]=M):M=t[46],M}function Nn(e){return e?Be._({id:`wTcjov`}):null}function Pn(e){let t=(0,kt.c)(48),{_:n}=l(),a=r(),o=D(),s=B(),u=V();if(a)return null;let{input:d,installStates:p,dispatch:m,onBeforeLaunch:h}=e,g=d===null,_,v,y,b,x,S,C,w,T,E,O;if(t[0]!==n||t[1]!==m||t[2]!==d||t[3]!==g||t[4]!==p||t[5]!==h||t[6]!==u||t[7]!==s||t[8]!==o){let e=Nn(g),r;t[20]!==p||t[21]!==u?(r=e=>J(u,e.id,p[e.id]?.installed),t[20]=p,t[21]=u,t[22]=r):r=t[22];let a=oe.filter(r),l;t[23]===u?l=t[24]:(l=e=>q(u,e.source,e.id,!0,e.supported),t[23]=u,t[24]=l);let f=s.filter(l),D=o?Ce.filter(e=>U(u,e,o.installedClis)):[];y=a.length>0,b=o!==null&&D.length>0,x=f.length>0,v=ce,t[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(i,{"aria-hidden":`true`}),(0,Q.jsx)(c,{id:`O7_W_a`})]}),t[25]=O):O=t[25],_=le,S=`max-h-80`,C=x?(0,Q.jsxs)(ue,{"aria-label":n({id:`RXEbZy`}),children:[(0,Q.jsx)(de,{children:(0,Q.jsx)(c,{id:`RXEbZy`})}),f.map(t=>{let r=t.name;return(0,Q.jsxs)(se,{onSelect:()=>{d!==null&&(h?.(),_n(d,{agent:{source:t.source,id:t.id}}))},disabled:g,"data-testid":`file-tree-open-in-thread-${t.id}`,"aria-label":n(e?{id:`7Ag-Xu`,values:{agentName:r,hint:e}}:{id:`g4e0hS`,values:{agentName:r}}),children:[(0,Q.jsx)(tt,{agentId:t.id,iconUrl:t.iconUrl,className:`size-4`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},`${t.source}:${t.id}`)})]}):null,t[26]!==y||t[27]!==b||t[28]!==x?(w=x&&(b||y)?(0,Q.jsx)(pe,{}):null,t[26]=y,t[27]=b,t[28]=x,t[29]=w):w=t[29],T=b?(0,Q.jsxs)(ue,{"aria-label":n({id:`ALhMYW`}),children:[(0,Q.jsx)(de,{children:(0,Q.jsx)(c,{id:`ALhMYW`})}),D.map(t=>{let{displayName:r}=ke[t];return(0,Q.jsxs)(se,{onSelect:()=>{d!==null&&(h?.(),o.launchInTerminal(d,t))},disabled:g,"data-testid":`file-tree-open-in-terminal-${t}`,"aria-label":n(e?{id:`AIn2Yv`,values:{displayName:r,hint:e}}:{id:`QYfQdv`,values:{displayName:r}}),children:[(0,Q.jsx)(re,{id:X(t),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:r}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t)})]}):null,E=y?(0,Q.jsxs)(Q.Fragment,{children:[b?(0,Q.jsx)(pe,{}):null,(0,Q.jsxs)(ue,{"aria-label":n({id:`BwKH4d`}),children:[(0,Q.jsxs)(de,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(c,{id:`BwKH4d`}),(0,Q.jsx)(et,{"aria-hidden":`true`,className:`size-3`})]}),a.map(t=>{let r=!g,{displayName:i}=t,a=n(e?{id:`rl35Vz`,values:{displayName:i,hint:e}}:{id:`wHZ58m`,values:{displayName:i}});return(0,Q.jsxs)(se,{disabled:!r,onSelect:()=>{if(d){if(h?.(),p[t.id]?.installed!==!0){nn(t);return}m(t.id,d)}},"data-testid":`file-tree-open-in-${t.id}`,"aria-label":a,children:[(0,Q.jsx)(re,{id:t.id,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(En,{displayName:i})}),e?(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`ml-2 text-muted-foreground text-xs`,children:e}):null]},t.id)})]})]}):null,t[0]=n,t[1]=m,t[2]=d,t[3]=g,t[4]=p,t[5]=h,t[6]=u,t[7]=s,t[8]=o,t[9]=_,t[10]=v,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=O}else _=t[9],v=t[10],y=t[11],b=t[12],x=t[13],S=t[14],C=t[15],w=t[16],T=t[17],E=t[18],O=t[19];let k;t[30]!==y||t[31]!==b||t[32]!==x?(k=x||b||y?(0,Q.jsx)(pe,{}):null,t[30]=y,t[31]=b,t[32]=x,t[33]=k):k=t[33];let A;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(f,{"aria-hidden":`true`}),t[34]=A):A=t[34];let j;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(se,{onSelect:ze,"data-testid":`file-tree-open-in-settings`,children:[A,(0,Q.jsx)(`span`,{className:`flex-1`,children:(0,Q.jsx)(c,{id:`jRAGrQ`})})]}),t[35]=j):j=t[35];let M;t[36]!==_||t[37]!==S||t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==E||t[42]!==k?(M=(0,Q.jsxs)(_,{className:S,children:[C,w,T,E,k,j]}),t[36]=_,t[37]=S,t[38]=C,t[39]=w,t[40]=T,t[41]=E,t[42]=k,t[43]=M):M=t[43];let N;return t[44]!==v||t[45]!==O||t[46]!==M?(N=(0,Q.jsxs)(v,{children:[O,M]}),t[44]=v,t[45]=O,t[46]=M,t[47]=N):N=t[47],N}var Fn=/^\.[A-Za-z0-9_-]+\/skills\/([^/]+)\/(.+)$/;function In(e){let t=ve(e);if(t)return{scope:`project`,name:t.name,rel:t.rel};let n=Se(e);if(n)return{scope:`global`,name:n.name,rel:n.rel};let r=ge(e);if(r?.kind===`skill`)return{scope:r.scope,name:r.name,rel:r.rel};let i=Fn.exec(e);return i?{scope:`project`,name:i[1],rel:i[2]}:null}function Ln(e,t,n){return e.filter(e=>{let r=mt(e);if(r.kind===`skill-file`)return r.scope===t&&r.name===n;if(r.kind!==`doc`)return!1;let i=In(r.docName);return i?.scope===t&&i.name===n})}function Rn(e,t,n){let r=pt(t,n);return e.filter(e=>{let i=mt(e);return i.kind===`skill-file`?i.scope===t.scope&&i.name===t.name&&i.path===n:i.kind===`doc`&&i.docName===r})}function zn(e,t,n){let r=In(e);if(!r||r.rel===null)return null;let i=t.find(e=>e.scope===r.scope&&e.name===r.name);if(!i||i.managed)return null;let a=`references/${r.rel}${n}`;return pt(i,a)===e?{skill:i,filePath:a}:null}function Bn(e,t,n=(e,t)=>Ve(e,t)||Ge(e,t)){let r=new Map(t.map(e=>[`${e.scope}\u0000${e.name}`,e])),i=[],a=new Set;for(let t of e){let e=In(t);e!==null&&e.rel===null&&a.add(`${e.scope}\u0000${e.name}`)}for(let t of e){let e=In(t);if(!e||r.has(`${e.scope}\u0000${e.name}`))continue;let o=e.scope===`project`?`global`:`project`,s=r.get(`${o}\u0000${e.name}`);e.rel===null&&s!==void 0?i.push({kind:`retarget`,fromDocName:t,toDocName:ft(s)}):n(e.scope,e.name)||(s!==void 0&&!a.has(`${e.scope}\u0000${e.name}`)?(a.add(`${e.scope}\u0000${e.name}`),i.push({kind:`retarget`,fromDocName:t,toDocName:ft(s)})):i.push({kind:`close`,docName:t}))}return i}function Vn(){let e=(0,kt.c)(15),{openTabs:t,closeDocument:n}=o(),r=nt(),i;e[0]===t?i=e[1]:(i=t.some(Un),e[0]=t,e[1]=i);let a=i,s;e[2]===a?s=e[3]:(s={enabled:a},e[2]=a,e[3]=s);let c=gt(s),l=(0,$.useRef)(null),u;e[4]!==n||e[5]!==t||e[6]!==r||e[7]!==c.data||e[8]!==c.status?(u=()=>{if(c.status!==`ready`)return;let e=c.data,i=`${t.join(``)}\u0002${e.map(Hn).sort().join(``)}\u0002${Ue()}`;if(l.current===i)return;l.current=i;let a=Bn(t,e);for(let e of a)e.kind===`retarget`?r(e.fromDocName,e.toDocName):n(e.docName)},e[4]=n,e[5]=t,e[6]=r,e[7]=c.data,e[8]=c.status,e[9]=u):u=e[9];let d;e[10]!==n||e[11]!==t||e[12]!==r||e[13]!==c?(d=[c,t,r,n],e[10]=n,e[11]=t,e[12]=r,e[13]=c,e[14]=d):d=e[14],(0,$.useEffect)(u,d)}function Hn(e){return`${e.scope}\u0000${e.name}`}function Un(e){return In(e)!==null}function Wn(e){let t=(0,kt.c)(19),{skill:n,onOpenChange:r,onDeleted:i}=e,{_:a}=l(),{setSkillsSidebar:s,closeTabs:c,openTabs:u}=o(),[d,f]=(0,$.useState)(!1),p;t[0]!==a||t[1]!==c||t[2]!==i||t[3]!==r||t[4]!==u||t[5]!==s?(p=async function(e){s(!0),f(!0);let t=await St(e.scope,e.name);if(f(!1),!t.ok){let{error:e}=t;Z.error(a({id:`AtBdnD`,values:{error:e}}));return}Z.success(a({id:`h9QFb9`,values:{0:e.name}})),c(Ln(u,e.scope,e.name),{force:!0}),i(),r(!1)},t[0]=a,t[1]=c,t[2]=i,t[3]=r,t[4]=u,t[5]=s,t[6]=p):p=t[6];let m=p,h=n!==null,g;t[7]!==d||t[8]!==r?(g=e=>{!e&&!d&&r(!1)},t[7]=d,t[8]=r,t[9]=g):g=t[9];let _;t[10]!==a||t[11]!==d||t[12]!==m||t[13]!==n?(_=n?(0,Q.jsx)(y,{itemName:a({id:`ExUzM4`,values:{0:n.name}}),isSubmitting:d,onDelete:()=>m(n),customDescription:n.origin?.source&&/\/plugins\/(?:cache|marketplaces)\//.test(n.origin.source)?a({id:`WnsbUT`,values:{0:n.path}}):a({id:`E1Da_b`,values:{0:n.path}})}):null,t[10]=a,t[11]=d,t[12]=m,t[13]=n,t[14]=_):_=t[14];let v;return t[15]!==h||t[16]!==g||t[17]!==_?(v=(0,Q.jsx)(R,{open:h,onOpenChange:g,children:_}),t[15]=h,t[16]=g,t[17]=_,t[18]=v):v=t[18],v}function Gn(e){let t=e.split(`/`);return t.some(e=>e===``||e===`.`||e===`..`)||t.length===0||t.length===1&&t[0].toLowerCase()===`skill.md`?!1:!/\s/.test(e)}function Kn(e){let t=(0,kt.c)(66),{target:n,onOpenChange:r}=e,{_:i}=l(),{openTarget:a}=o(),s=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.prefix??`references/`)},t[0]=n,t[1]=m);let h=n?.skill.scope,g=n?.skill.name,_=n?.prefix,v;if(t[2]!==h||t[3]!==g||t[4]!==_?(v=[h,g,_],t[2]=h,t[3]=g,t[4]=_,t[5]=v):v=t[5],(0,$.useEffect)(m,v),!n)return null;let y,b,x,S;t[6]!==u||t[7]!==f?(S=u.trim(),b=S===``||!Gn(S),y=!b&&!f,x=S.includes(`/`)?S.split(`/`).slice(0,-1).join(`/`):null,t[6]=u,t[7]=f,t[8]=y,t[9]=b,t[10]=x,t[11]=S):(y=t[8],b=t[9],x=t[10],S=t[11]);let C=x,w;t[12]!==i||t[13]!==y||t[14]!==r||t[15]!==a||t[16]!==n||t[17]!==S?(w=async function(){if(!n||!y)return;p(!0);let e=/\.mdx?$/i.test(S),t=await _t({scope:n.skill.scope,name:n.skill.name,path:S,content:e?`# ${S.split(`/`).pop()?.replace(/\.mdx?$/i,``)??``}\n`:``});if(p(!1),!t.ok){Z.error(i({id:`a_2_uB`,values:{0:t.error,trimmed:S}}));return}if(Z.success(i({id:`MXSt4t`,values:{0:t.path}})),e){let e=pt(n.skill,S);a({kind:`doc`,target:e,docName:e})}r(!1)},t[12]=i,t[13]=y,t[14]=r,t[15]=a,t[16]=n,t[17]=S,t[18]=w):w=t[18];let T=w,E;t[19]!==r||t[20]!==f?(E=e=>{!e&&!f&&r(!1)},t[19]=r,t[20]=f,t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(N,{children:(0,Q.jsx)(c,{id:`wQvvZY`})}),t[22]=D):D=t[22];let k;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsxs)(te,{children:[D,(0,Q.jsx)(M,{children:(0,Q.jsx)(c,{id:`lM4c-I`})})]}),t[23]=k):k=t[23];let A;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(c,{id:`I6gXOa`}),t[24]=A):A=t[24];let j;t[25]===s?j=t[26]:(j=(0,Q.jsx)(me,{htmlFor:s,children:A}),t[25]=s,t[26]=j);let P;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>d(e.target.value),t[27]=P):P=t[27];let I=b&&S!==``,R;t[28]===T?R=t[29]:(R=e=>{e.key===`Enter`&&T()},t[28]=T,t[29]=R);let z;t[30]!==s||t[31]!==u||t[32]!==I||t[33]!==R?(z=(0,Q.jsx)(dt,{id:s,value:u,onChange:P,placeholder:`references/notes.md`,"aria-invalid":I,onKeyDown:R}),t[30]=s,t[31]=u,t[32]=I,t[33]=R,t[34]=z):z=t[34];let B;t[35]!==C||t[36]!==b||t[37]!==S?(B=b&&S!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(c,{id:`fVzizW`})}):C?(0,Q.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:(0,Q.jsx)(c,{id:`9lso1Y`,values:{folderPart:C},components:{0:(0,Q.jsx)(`span`,{className:`font-mono text-foreground/80`})}})}):null,t[35]=C,t[36]=b,t[37]=S,t[38]=B):B=t[38];let V;t[39]!==j||t[40]!==z||t[41]!==B?(V=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[j,z,B]}),t[39]=j,t[40]=z,t[41]=B,t[42]=V):V=t[42];let H;t[43]===r?H=t[44]:(H=()=>r(!1),t[43]=r,t[44]=H);let U;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(c,{id:`dEgA5A`}),t[45]=U):U=t[45];let W;t[46]!==f||t[47]!==H?(W=(0,Q.jsx)(O,{variant:`outline`,onClick:H,disabled:f,children:U}),t[46]=f,t[47]=H,t[48]=W):W=t[48];let G;t[49]===T?G=t[50]:(G=()=>void T(),t[49]=T,t[50]=G);let K=!y,q;t[51]===f?q=t[52]:(q=f?(0,Q.jsx)(c,{id:`E9bKSA`}):(0,Q.jsx)(c,{id:`hYgDIe`}),t[51]=f,t[52]=q);let J;t[53]!==G||t[54]!==K||t[55]!==q?(J=(0,Q.jsx)(O,{onClick:G,disabled:K,children:q}),t[53]=G,t[54]=K,t[55]=q,t[56]=J):J=t[56];let Y;t[57]!==W||t[58]!==J?(Y=(0,Q.jsxs)(F,{children:[W,J]}),t[57]=W,t[58]=J,t[59]=Y):Y=t[59];let X;t[60]!==V||t[61]!==Y?(X=(0,Q.jsxs)(ee,{className:`sm:max-w-md`,children:[k,V,Y]}),t[60]=V,t[61]=Y,t[62]=X):X=t[62];let ne;return t[63]!==X||t[64]!==E?(ne=(0,Q.jsx)(L,{open:!0,onOpenChange:E,children:X}),t[63]=X,t[64]=E,t[65]=ne):ne=t[65],ne}function qn(e){let t=(0,kt.c)(18),{target:n,onOpenChange:r}=e,{_:i}=l(),{setSkillsSidebar:a,closeTabs:s,openTabs:c}=o(),[u,d]=(0,$.useState)(!1),f;t[0]!==i||t[1]!==s||t[2]!==r||t[3]!==c||t[4]!==a?(f=async function(e){let{skill:t,filePath:n}=e;a(!0),d(!0);let o=await Ct({scope:t.scope,name:t.name,path:n});if(d(!1),!o.ok){Z.error(i({id:`CBT70t`,values:{0:o.error}}));return}if(!o.existed){Z.error(i({id:`q4efaG`,values:{filePath:n}})),r(!1);return}Z.success(i({id:`gOmloS`,values:{filePath:n}})),s(Rn(c,t,n),{force:!0}),r(!1)},t[0]=i,t[1]=s,t[2]=r,t[3]=c,t[4]=a,t[5]=f):f=t[5];let p=f,m=n!==null,h;t[6]!==u||t[7]!==r?(h=e=>{!e&&!u&&r(!1)},t[6]=u,t[7]=r,t[8]=h):h=t[8];let g;t[9]!==i||t[10]!==u||t[11]!==p||t[12]!==n?(g=n?(0,Q.jsx)(y,{itemName:i({id:`wZPUJx`,values:{0:n.filePath}}),isSubmitting:u,onDelete:()=>p(n),customDescription:i({id:`ppzof_`,values:{0:ct(n.skill.path),1:n.filePath,2:n.skill.name}})}):null,t[9]=i,t[10]=u,t[11]=p,t[12]=n,t[13]=g):g=t[13];let _;return t[14]!==m||t[15]!==h||t[16]!==g?(_=(0,Q.jsx)(R,{open:m,onOpenChange:h,children:g}),t[14]=m,t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function Jn(e){let t=(0,kt.c)(64),{target:n,onOpenChange:r}=e,{_:i}=l(),a=nt(),o=(0,$.useId)(),[s,u]=(0,$.useState)(``),[d,f]=(0,$.useState)(!1),p;t[0]===n?p=t[1]:(p=()=>{n&&u(n.filePath)},t[0]=n,t[1]=p);let m=n?.skill.scope,h=n?.skill.name,g=n?.filePath,_;if(t[2]!==m||t[3]!==h||t[4]!==g?(_=[m,h,g],t[2]=m,t[3]=h,t[4]=g,t[5]=_):_=t[5],(0,$.useEffect)(p,_),!n)return null;let v,y,b;t[6]!==s||t[7]!==n.filePath?(y=s.trim(),b=y===n.filePath,v=y===``||!Gn(y),t[6]=s,t[7]=n.filePath,t[8]=v,t[9]=y,t[10]=b):(v=t[8],y=t[9],b=t[10]);let x=v,S=!x&&!b&&!d,C;t[11]!==i||t[12]!==S||t[13]!==r||t[14]!==a||t[15]!==n||t[16]!==y?(C=async function(){if(!n||!S)return;f(!0);let e=await Et({scope:n.skill.scope,name:n.skill.name,from:n.filePath,to:y});if(f(!1),!e.ok){Z.error(i({id:`11ukmX`,values:{0:e.error}}));return}e.fromDocName!==void 0&&e.toDocName!==void 0&&a(e.fromDocName,e.toDocName),Z.success(i({id:`XszXjc`,values:{0:e.to}})),r(!1)},t[11]=i,t[12]=S,t[13]=r,t[14]=a,t[15]=n,t[16]=y,t[17]=C):C=t[17];let w=C,T;t[18]!==r||t[19]!==d?(T=e=>{!e&&!d&&r(!1)},t[18]=r,t[19]=d,t[20]=T):T=t[20];let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(N,{children:(0,Q.jsx)(c,{id:`yckias`})}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsxs)(te,{children:[E,(0,Q.jsx)(M,{children:(0,Q.jsx)(c,{id:`HzVAoz`})})]}),t[22]=D):D=t[22];let k;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(c,{id:`I6gXOa`}),t[23]=k):k=t[23];let A;t[24]===o?A=t[25]:(A=(0,Q.jsx)(me,{htmlFor:o,children:k}),t[24]=o,t[25]=A);let j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>u(e.target.value),t[26]=j):j=t[26];let P=x&&y!==``,I;t[27]===w?I=t[28]:(I=e=>{e.key===`Enter`&&w()},t[27]=w,t[28]=I);let R;t[29]!==o||t[30]!==s||t[31]!==P||t[32]!==I?(R=(0,Q.jsx)(dt,{id:o,value:s,onChange:j,"aria-invalid":P,onKeyDown:I}),t[29]=o,t[30]=s,t[31]=P,t[32]=I,t[33]=R):R=t[33];let z;t[34]!==x||t[35]!==y?(z=x&&y!==``?(0,Q.jsx)(`p`,{className:`text-destructive text-xs`,children:(0,Q.jsx)(c,{id:`fVzizW`})}):null,t[34]=x,t[35]=y,t[36]=z):z=t[36];let B;t[37]!==A||t[38]!==R||t[39]!==z?(B=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[A,R,z]}),t[37]=A,t[38]=R,t[39]=z,t[40]=B):B=t[40];let V;t[41]===r?V=t[42]:(V=()=>r(!1),t[41]=r,t[42]=V);let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(c,{id:`dEgA5A`}),t[43]=H):H=t[43];let U;t[44]!==d||t[45]!==V?(U=(0,Q.jsx)(O,{variant:`outline`,onClick:V,disabled:d,children:H}),t[44]=d,t[45]=V,t[46]=U):U=t[46];let W;t[47]===w?W=t[48]:(W=()=>void w(),t[47]=w,t[48]=W);let G=!S,K;t[49]===d?K=t[50]:(K=d?(0,Q.jsx)(c,{id:`tHKQ6j`}):(0,Q.jsx)(c,{id:`2wxgft`}),t[49]=d,t[50]=K);let q;t[51]!==W||t[52]!==G||t[53]!==K?(q=(0,Q.jsx)(O,{onClick:W,disabled:G,children:K}),t[51]=W,t[52]=G,t[53]=K,t[54]=q):q=t[54];let J;t[55]!==U||t[56]!==q?(J=(0,Q.jsxs)(F,{children:[U,q]}),t[55]=U,t[56]=q,t[57]=J):J=t[57];let Y;t[58]!==B||t[59]!==J?(Y=(0,Q.jsxs)(ee,{className:`sm:max-w-md`,children:[D,B,J]}),t[58]=B,t[59]=J,t[60]=Y):Y=t[60];let X;return t[61]!==Y||t[62]!==T?(X=(0,Q.jsx)(L,{open:!0,onOpenChange:T,children:Y}),t[61]=Y,t[62]=T,t[63]=X):X=t[63],X}function Yn(e){let t=(0,kt.c)(59),{target:n,onOpenChange:r}=e,{_:i}=l(),a=(0,$.useId)(),[o,s]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(``),[v,y]=(0,$.useState)(!1),b;t[0]===n?b=t[1]:(b=()=>{if(s(null),d(null),p(!1),h(!1),!n)return;let{skill:e,editor:t}=n,r=e.absolutePath?.slice(0,-`/${e.path}`.length)??null;if(r===null){p(!0);return}let i=`${r}/${e.path.replace(/\/SKILL\.mdx?$/i,``)}`,a=`${r}/${lt(t,e.scope)}/${e.name}`,o=new AbortController;for(let[t,n]of[[i,d],[a,s]])Tt({source:t,name:e.name},o.signal).then(e=>{o.signal.aborted||(e.ok?n(e.skillMd):p(!0))}).catch(()=>{o.signal.aborted||p(!0)});return()=>o.abort()},t[0]=n,t[1]=b);let x=n?.skill.scope,S=n?.skill.name,C=n?.editor,w;if(t[2]!==x||t[3]!==S||t[4]!==C?(w=[x,S,C],t[2]=x,t[3]=S,t[4]=C,t[5]=w):w=t[5],(0,$.useEffect)(b,w),!n)return null;let{skill:T,editor:E}=n,D;t[6]!==i||t[7]!==E||t[8]!==r||t[9]!==T.name||t[10]!==T.scope||t[11]!==n||t[12]!==g?(D=async function(e){if(!n)return;y(!0);let t=await vt({scope:T.scope,name:T.name,editor:E,action:e,...e===`rename`?{toName:g.trim()}:{}});if(y(!1),!t.ok){Z.error(i({id:`MIF36T`,values:{0:t.error}}));return}Z.success(i(e===`align`?{id:`QKgePK`,values:{editor:E}}:e===`make-source`?{id:`It9oAP`,values:{editor:E}}:{id:`b2ezG_`,values:{0:g.trim()}})),r(!1)},t[6]=i,t[7]=E,t[8]=r,t[9]=T.name,t[10]=T.scope,t[11]=n,t[12]=g,t[13]=D):D=t[13];let k=D,A,j;t[14]!==T.name||t[15]!==g?(j=g.trim(),A=j===``||!xe.test(j)||j===T.name,t[14]=T.name,t[15]=g,t[16]=A,t[17]=j):(A=t[16],j=t[17]);let I=A,R;t[18]!==v||t[19]!==r?(R=e=>{!e&&!v&&r(!1)},t[18]=v,t[19]=r,t[20]=R):R=t[20];let z;t[21]!==E||t[22]!==T.name?(z=(0,Q.jsx)(N,{children:(0,Q.jsx)(c,{id:`q8aCbb`,values:{0:T.name,editor:E}})}),t[21]=E,t[22]=T.name,t[23]=z):z=t[23];let B;t[24]===E?B=t[25]:(B=(0,Q.jsx)(M,{children:(0,Q.jsx)(c,{id:`QASTNu`,values:{editor:E}})}),t[24]=E,t[25]=B);let V;t[26]!==B||t[27]!==z?(V=(0,Q.jsxs)(te,{children:[z,B]}),t[26]=B,t[27]=z,t[28]=V):V=t[28];let H;t[29]!==u||t[30]!==o||t[31]!==f?(H=u!==null&&o!==null?(0,Q.jsx)(Dt,{oldContent:u,newContent:o,layout:`unified`}):f?(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center px-6 text-center text-muted-foreground text-sm`,children:(0,Q.jsx)(c,{id:`5BlXTD`})}):(0,Q.jsx)(`div`,{className:`flex min-h-56 items-center justify-center text-muted-foreground text-sm`,children:(0,Q.jsx)(c,{id:`1V17kO`})}),t[29]=u,t[30]=o,t[31]=f,t[32]=H):H=t[32];let U;t[33]!==k||t[34]!==E||t[35]!==a||t[36]!==I||t[37]!==m||t[38]!==T.name||t[39]!==g||t[40]!==j?(U=m?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-1.5`,children:[(0,Q.jsx)(me,{htmlFor:a,children:(0,Q.jsx)(c,{id:`pSimwP`,values:{editor:E}})}),(0,Q.jsx)(dt,{id:a,value:g,onChange:e=>_(e.target.value),placeholder:`${T.name}-${E}`,"aria-invalid":I&&j!==``,onKeyDown:e=>{e.key===`Enter`&&!I&&k(`rename`)}})]}):null,t[33]=k,t[34]=E,t[35]=a,t[36]=I,t[37]=m,t[38]=T.name,t[39]=g,t[40]=j,t[41]=U):U=t[41];let W;t[42]!==H||t[43]!==U?(W=(0,Q.jsxs)(P,{className:`min-h-0 flex-1 overflow-auto`,children:[H,U]}),t[42]=H,t[43]=U,t[44]=W):W=t[44];let G;t[45]!==k||t[46]!==v||t[47]!==E||t[48]!==I||t[49]!==m||t[50]!==T.name?(G=(0,Q.jsx)(F,{children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(O,{variant:`outline`,onClick:()=>h(!1),disabled:v,children:(0,Q.jsx)(c,{id:`iH8pgl`})}),(0,Q.jsx)(O,{onClick:()=>void k(`rename`),disabled:v||I,children:(0,Q.jsx)(c,{id:`AT0e50`})})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(O,{variant:`outline`,onClick:()=>{_(`${T.name}-${E}`),h(!0)},disabled:v,children:(0,Q.jsx)(c,{id:`AT0e50`})}),(0,Q.jsx)(O,{variant:`outline`,onClick:()=>void k(`make-source`),disabled:v,children:(0,Q.jsx)(c,{id:`xWomUD`,values:{editor:E}})}),(0,Q.jsx)(O,{onClick:()=>void k(`align`),disabled:v,children:(0,Q.jsx)(c,{id:`PZn2LP`})})]})}),t[45]=k,t[46]=v,t[47]=E,t[48]=I,t[49]=m,t[50]=T.name,t[51]=G):G=t[51];let K;t[52]!==V||t[53]!==W||t[54]!==G?(K=(0,Q.jsxs)(ee,{className:`flex max-h-[85vh] w-full max-w-3xl flex-col`,children:[V,W,G]}),t[52]=V,t[53]=W,t[54]=G,t[55]=K):K=t[55];let q;return t[56]!==K||t[57]!==R?(q=(0,Q.jsx)(L,{open:!0,onOpenChange:R,children:K}),t[56]=K,t[57]=R,t[58]=q):q=t[58],q}function Xn(e){let t=(0,kt.c)(75),{skill:n,existingNames:r,onOpenChange:i,onRenamed:a}=e,o=rt(),s=n!==null,l=(0,$.useId)(),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)(!1),m;t[0]===n?m=t[1]:(m=()=>{n&&d(n.name)},t[0]=n,t[1]=m);let h=n?.scope,g=n?.name,_;if(t[2]!==h||t[3]!==g?(_=[h,g],t[2]=h,t[3]=g,t[4]=_):_=t[4],(0,$.useEffect)(m,_),!n)return null;let v,y,b,x,S,C;if(t[5]!==r||t[6]!==u||t[7]!==n.name){S=u.trim(),C=S===n.name;let e;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\s/,t[14]=e):e=t[14];let i;t[15]===u?i=t[16]:(i=e.test(u),t[15]=u,t[16]=i),v=i,x=S.length>64,y=S===``||!xe.test(S)||x,b=!y&&!C&&r.has(S),t[5]=r,t[6]=u,t[7]=n.name,t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S,t[13]=C}else v=t[8],y=t[9],b=t[10],x=t[11],S=t[12],C=t[13];let w=b,T=!y&&!w&&!C&&!f,E;t[17]!==T||t[18]!==i||t[19]!==a||t[20]!==o||t[21]!==n||t[22]!==S?(E=async function(){if(!n||!T)return;p(!0);let e=await o({scope:n.scope,name:n.name},S);p(!1),e.ok&&(a?.(S),i(!1))},t[17]=T,t[18]=i,t[19]=a,t[20]=o,t[21]=n,t[22]=S,t[23]=E):E=t[23];let D=E,k;t[24]===i?k=t[25]:(k=e=>e?null:i(!1),t[24]=i,t[25]=k);let A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(N,{children:(0,Q.jsx)(c,{id:`dw_3cv`})}),t[26]=A):A=t[26];let j;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsxs)(te,{children:[A,(0,Q.jsx)(M,{children:(0,Q.jsx)(c,{id:`R9IDFz`})})]}),t[27]=j):j=t[27];let P;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(c,{id:`6YtxFj`}),t[28]=P):P=t[28];let I;t[29]===l?I=t[30]:(I=(0,Q.jsx)(me,{htmlFor:l,children:P}),t[29]=l,t[30]=I);let R;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>d(e.target.value),t[31]=R):R=t[31];let z;t[32]===D?z=t[33]:(z=e=>{e.key===`Enter`&&D()},t[32]=D,t[33]=z);let B=y||w,V=y&&S!==``||w?`${l}-error`:void 0,H;t[34]!==l||t[35]!==u||t[36]!==z||t[37]!==B||t[38]!==V?(H=(0,Q.jsx)(dt,{id:l,value:u,onChange:R,onKeyDown:z,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:64,"aria-invalid":B,"aria-describedby":V,className:`font-mono`}),t[34]=l,t[35]=u,t[36]=z,t[37]=B,t[38]=V,t[39]=H):H=t[39];let U;t[40]!==w||t[41]!==v||t[42]!==l||t[43]!==y||t[44]!==x||t[45]!==S?(U=y&&S!==``?(0,Q.jsx)(`p`,{id:`${l}-error`,className:`text-xs text-destructive`,children:v?(0,Q.jsx)(c,{id:`iUwpZI`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}}):x?(0,Q.jsx)(c,{id:`lK9c4T`}):(0,Q.jsx)(c,{id:`A50vr3`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):w?(0,Q.jsx)(`p`,{id:`${l}-error`,className:`text-xs text-destructive`,children:(0,Q.jsx)(c,{id:`YJ1BTp`})}):null,t[40]=w,t[41]=v,t[42]=l,t[43]=y,t[44]=x,t[45]=S,t[46]=U):U=t[46];let W;t[47]!==I||t[48]!==H||t[49]!==U?(W=(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[I,H,U]}),t[47]=I,t[48]=H,t[49]=U,t[50]=W):W=t[50];let G;t[51]===i?G=t[52]:(G=()=>i(!1),t[51]=i,t[52]=G);let K;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(c,{id:`dEgA5A`}),t[53]=K):K=t[53];let q;t[54]!==f||t[55]!==G?(q=(0,Q.jsx)(O,{variant:`outline`,className:`font-mono uppercase`,onClick:G,disabled:f,children:K}),t[54]=f,t[55]=G,t[56]=q):q=t[56];let J;t[57]===D?J=t[58]:(J=()=>void D(),t[57]=D,t[58]=J);let Y=!T,X;t[59]===f?X=t[60]:(X=f?(0,Q.jsx)(c,{id:`tHKQ6j`}):(0,Q.jsx)(c,{id:`2wxgft`}),t[59]=f,t[60]=X);let ne;t[61]!==J||t[62]!==Y||t[63]!==X?(ne=(0,Q.jsx)(O,{onClick:J,disabled:Y,children:X}),t[61]=J,t[62]=Y,t[63]=X,t[64]=ne):ne=t[64];let re;t[65]!==q||t[66]!==ne?(re=(0,Q.jsxs)(F,{children:[q,ne]}),t[65]=q,t[66]=ne,t[67]=re):re=t[67];let ie;t[68]!==W||t[69]!==re?(ie=(0,Q.jsxs)(ee,{children:[j,W,re]}),t[68]=W,t[69]=re,t[70]=ie):ie=t[70];let ae;return t[71]!==s||t[72]!==ie||t[73]!==k?(ae=(0,Q.jsx)(L,{open:s,onOpenChange:k,children:ie}),t[71]=s,t[72]=ie,t[73]=k,t[74]=ae):ae=t[74],ae}function Zn(){let e=(0,kt.c)(7),{_:t}=l(),n=ut(),r=nt(),{setSkillsSidebar:i,openTabs:a}=o(),s=gt(),c;return e[0]!==t||e[1]!==a||e[2]!==r||e[3]!==n||e[4]!==i||e[5]!==s?(c=async(e,o)=>{if(o===e.scope)return!1;Ke(e.scope,e.name),We(e.scope,e.name);let c=await bt({name:e.name,fromScope:e.scope,toScope:o});if(He(e.scope,e.name),!c.ok)return qe(e.scope,e.name),Z.error(t({id:`07eGJB`,values:{0:c.error}})),!1;Z.success(t({id:`yhI6P0`,values:{0:e.name,1:n[o]}}));let l=s.status===`ready`?s.data.find(t=>t.scope===e.scope&&t.name===e.name):void 0,u=a.map($n).filter(t=>{if(t.kind!==`doc`)return!1;let n=In(t.docName);return n?.scope===e.scope&&n.name===e.name}),d=u.find(Qn)??u[0],f=d?.kind===`doc`?d.docName:l?ft(l):e.scope===`global`?Ee(e.scope,e.name):null,p=o===`project`&&c.path!==void 0?`${c.path.replace(/\/+$/,``)}/SKILL`:Ee(o,e.name);try{f!==null&&r(f,p)}catch(e){console.error(`[skill-move-scope] retarget failed after a successful move`,e)}return i(!0),qe(e.scope,e.name),!0},e[0]=t,e[1]=a,e[2]=r,e[3]=n,e[4]=i,e[5]=s,e[6]=c):c=e[6],c}function Qn(e){return e.kind===`doc`&&In(e.docName)?.rel===null}function $n(e){return mt(e)}function er(e){let t=(0,kt.c)(38),{target:n,onOpenChange:r}=e,i=ut(),a=Zn(),[o,s]=(0,$.useState)(!1);if(!n)return null;let{scope:l,name:u,toScope:d}=n,f;t[0]!==o||t[1]!==r?(f=e=>!e&&!o&&r(!1),t[0]=o,t[1]=r,t[2]=f):f=t[2];let p=i[d],m;t[3]===p?m=t[4]:(m=(0,Q.jsx)(N,{children:(0,Q.jsx)(c,{id:`SXEdCq`,values:{0:p}})}),t[3]=p,t[4]=m);let h=i[l],g=i[d],_=i[d],v;t[5]!==u||t[6]!==h||t[7]!==g||t[8]!==_?(v={0:h,1:g,2:_,name:u},t[5]=u,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[10]=y):y=t[10];let b;t[11]===v?b=t[12]:(b=(0,Q.jsx)(M,{children:(0,Q.jsx)(c,{id:`7bIiJ7`,values:v,components:y})}),t[11]=v,t[12]=b);let x;t[13]!==m||t[14]!==b?(x=(0,Q.jsxs)(te,{children:[m,b]}),t[13]=m,t[14]=b,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(c,{id:`dEgA5A`}),t[16]=S):S=t[16];let C;t[17]===o?C=t[18]:(C=(0,Q.jsx)(I,{asChild:!0,children:(0,Q.jsx)(O,{variant:`outline`,disabled:o,children:S})}),t[17]=o,t[18]=C);let w;t[19]!==a||t[20]!==u||t[21]!==r||t[22]!==l||t[23]!==d?(w=async()=>{s(!0),await a({scope:l,name:u},d),s(!1),r(!1)},t[19]=a,t[20]=u,t[21]=r,t[22]=l,t[23]=d,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(c,{id:`QWdKwH`}),t[25]=T):T=t[25];let E;t[26]!==o||t[27]!==w?(E=(0,Q.jsx)(O,{"data-testid":`skill-scope-move-confirm`,disabled:o,onClick:w,children:T}),t[26]=o,t[27]=w,t[28]=E):E=t[28];let D;t[29]!==C||t[30]!==E?(D=(0,Q.jsxs)(F,{children:[C,E]}),t[29]=C,t[30]=E,t[31]=D):D=t[31];let k;t[32]!==x||t[33]!==D?(k=(0,Q.jsxs)(ee,{className:`sm:max-w-md`,children:[x,D]}),t[32]=x,t[33]=D,t[34]=k):k=t[34];let A;return t[35]!==f||t[36]!==k?(A=(0,Q.jsx)(L,{open:!0,onOpenChange:f,children:k}),t[35]=f,t[36]=k,t[37]=A):A=t[37],A}function tr(){let e=(0,kt.c)(50),{_:t}=l(),n=at(),[r,i]=(0,$.useState)(null),[a,o]=(0,$.useState)(null),[s,c]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(null),[g,_]=(0,$.useState)(null),[v,y]=(0,$.useState)(null),b;e[0]===t?b=e[1]:(b=async function(e,n,r){y(e.name),Ke(e.scope,e.name);let i=await xt({scope:e.scope,name:e.name,...n?{targets:[...n]}:{},...r?.linkMode===void 0?{}:{linkMode:r.linkMode}});if(qe(e.scope,e.name),y(null),!i.ok)return Z.error(t({id:`Mj8R8K`,values:{0:i.error}})),i;let a=nr,o=new Set(i.hosts),s=i.hosts.filter(t=>!e.hosts.includes(t)),c=e.hosts.filter(e=>!o.has(e)),l=e=>{let t=i.warningCodes.indexOf(e);return t>=0?i.warnings[t]:void 0},u=l(`no-targets`);if(u)return Z.warning(u),i;if(s.length>0){let e=l(`scripts-present`);e&&Z.warning(e);let t=l(`no-description`);t&&Z.warning(t)}return i.hosts.length===0?Z.success(t({id:`4pDZ2N`,values:{0:e.name}})):s.length>0&&c.length===0?Z.success(t({id:`PPFQ3o`,values:{0:e.name,1:a(s)}})):c.length>0&&s.length===0?Z.success(t({id:`OOIVJo`,values:{0:e.name,1:a(c)}})):s.length>0&&c.length>0?Z.success(t({id:`OxplNM`,values:{0:e.name,1:a(s),2:a(c)}})):Z.success(t({id:`wDgmsr`,values:{0:e.name,1:a(i.hosts)}})),i},e[0]=t,e[1]=b);let x=b,S;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(S=async function(e,t){if(t.length!==0){y(e.name),Ke(e.scope,e.name);for(let{target:n,mode:r}of t){let t=await wt({scope:e.scope,name:e.name,target:n,mode:r});if(!t.ok){Z.error(t.error);break}}qe(e.scope,e.name),y(null)}},e[2]=S):S=e[2];let C=S,w;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(w=async function(e,t){y(e.name),Ke(e.scope,e.name);let n=await t();return qe(e.scope,e.name),y(null),n},e[3]=w):w=e[3];let T=w,E;e[4]!==t||e[5]!==n?(E=async function(e,r){let i=await yt({scope:e.scope,name:e.name,existingNames:r});if(!i.ok){Z.error(t({id:`UPjaXD`,values:{0:e.name,1:i.error}}));return}Z.success(t({id:`0g7rCZ`,values:{0:i.name}})),n(e.scope,i.name)},e[4]=t,e[5]=n,e[6]=E):E=e[6];let D=E,O,k;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>{e||i(null)},k=()=>i(null),e[7]=O,e[8]=k):(O=e[7],k=e[8]);let A;e[9]===r?A=e[10]:(A=(0,Q.jsx)(Wn,{skill:r,onOpenChange:O,onDeleted:k}),e[9]=r,e[10]=A);let j=a?.skill??null,M=a?.existingNames??ir,N,ee;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>{e||o(null)},N=()=>o(null),e[11]=N,e[12]=ee):(N=e[11],ee=e[12]);let P;e[13]!==j||e[14]!==M?(P=(0,Q.jsx)(Xn,{skill:j,existingNames:M,onOpenChange:ee,onRenamed:N}),e[13]=j,e[14]=M,e[15]=P):P=e[15];let F;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>{e||c(null)},e[16]=F):F=e[16];let I;e[17]===s?I=e[18]:(I=(0,Q.jsx)(er,{target:s,onOpenChange:F}),e[17]=s,e[18]=I);let te;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(te=e=>{e||d(null)},e[19]=te):te=e[19];let L;e[20]===u?L=e[21]:(L=(0,Q.jsx)(Jn,{target:u,onOpenChange:te}),e[20]=u,e[21]=L);let R;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{e||p(null)},e[22]=R):R=e[22];let z;e[23]===f?z=e[24]:(z=(0,Q.jsx)(qn,{target:f,onOpenChange:R}),e[23]=f,e[24]=z);let B;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>{e||h(null)},e[25]=B):B=e[25];let V;e[26]===m?V=e[27]:(V=(0,Q.jsx)(Kn,{target:m,onOpenChange:B}),e[26]=m,e[27]=V);let H;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{e||_(null)},e[28]=H):H=e[28];let U;e[29]===g?U=e[30]:(U=(0,Q.jsx)(Yn,{target:g,onOpenChange:H}),e[29]=g,e[30]=U);let W;e[31]!==P||e[32]!==I||e[33]!==L||e[34]!==z||e[35]!==V||e[36]!==U||e[37]!==A?(W=(0,Q.jsxs)(Q.Fragment,{children:[A,P,I,L,z,V,U]}),e[31]=P,e[32]=I,e[33]=L,e[34]=z,e[35]=V,e[36]=U,e[37]=A,e[38]=W):W=e[38];let G=W,K,q,J,Y,X,ne;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(K=(e,t)=>o({skill:e,existingNames:t}),q=(e,t)=>c({scope:e.scope,name:e.name,toScope:t}),J=(e,t)=>d({skill:e,filePath:t}),Y=(e,t)=>p({skill:e,filePath:t}),X=(e,t)=>h(t===void 0?{skill:e}:{skill:e,prefix:t}),ne=(e,t)=>_({skill:e,editor:t}),e[39]=K,e[40]=q,e[41]=J,e[42]=Y,e[43]=X,e[44]=ne):(K=e[39],q=e[40],J=e[41],Y=e[42],X=e[43],ne=e[44]);let re;return e[45]!==G||e[46]!==D||e[47]!==x||e[48]!==v?(re={installingName:v,install:x,convertLocations:C,runLocationWrite:T,duplicate:D,requestDelete:i,requestRename:K,requestScopeMove:q,requestFileRename:J,requestFileDelete:Y,requestFileCreate:X,requestForkResolve:ne,dialogs:G},e[45]=G,e[46]=D,e[47]=x,e[48]=v,e[49]=re):re=e[49],re}function nr(e){return e.map(rr).join(`, `)}function rr(e){return Fe[e]??e}var ir=new Set;function ar(e){let t=(0,kt.c)(7),{absolutePath:n,menuKind:r}=e,i=r===void 0?`dropdown`:r,a=typeof window<`u`?window.okDesktop:void 0;if(!a||!n)return null;let o;t[0]===n?o=t[1]:(o=()=>void a.shell.showItemInFolder(n),t[0]=n,t[1]=o);let s,c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(it,{"aria-hidden":!0}),c=Ot(a.platform),t[2]=s,t[3]=c):(s=t[2],c=t[3]);let l;return t[4]!==i||t[5]!==o?(l=(0,Q.jsxs)(S,{menuKind:i,onSelect:o,children:[s,c]}),t[4]=i,t[5]=o,t[6]=l):l=t[6],l}function or(e){let t=(0,kt.c)(68),{skill:n,filePath:r,actions:i,menuKind:o}=e,s=o===void 0?`dropdown`:o,{_:u}=l(),d;t[0]!==r||t[1]!==n.absolutePath?(d=n.absolutePath?`${ct(n.absolutePath)}/${r}`:void 0,t[0]=r,t[1]=n.absolutePath,t[2]=d):d=t[2];let f=d,p;t[3]===n.path?p=t[4]:(p=ct(n.path),t[3]=n.path,t[4]=p);let m=`${p}/${r}`,_;t[5]===u?_=t[6]:(_=async function(e){try{await h(e),Z.success(u({id:`SXCSQd`}))}catch{Z.error(u({id:`cRHuuI`}))}},t[5]=u,t[6]=_);let y=_,x;t[7]!==i||t[8]!==r||t[9]!==n?(x=()=>i.requestFileRename(n,r),t[7]=i,t[8]=r,t[9]=n,t[10]=x):x=t[10];let C,T;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(Tn,{"aria-hidden":!0}),T=(0,Q.jsx)(c,{id:`2wxgft`}),t[11]=C,t[12]=T):(C=t[11],T=t[12]);let D;t[13]!==s||t[14]!==x?(D=(0,Q.jsxs)(S,{menuKind:s,onSelect:x,children:[C,T]}),t[13]=s,t[14]=x,t[15]=D):D=t[15];let O;t[16]!==f||t[17]!==s?(O=(0,Q.jsx)(ar,{absolutePath:f,menuKind:s}),t[16]=f,t[17]=s,t[18]=O):O=t[18];let k,A;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(a,{"aria-hidden":!0}),A=(0,Q.jsx)(c,{id:`zd00pH`}),t[19]=k,t[20]=A):(k=t[19],A=t[20]);let j;t[21]===s?j=t[22]:(j=(0,Q.jsxs)(E,{menuKind:s,children:[k,A]}),t[21]=s,t[22]=j);let M;t[23]!==f||t[24]!==y||t[25]!==s?(M=f?(0,Q.jsx)(S,{menuKind:s,onSelect:()=>void y(f),children:(0,Q.jsx)(c,{id:`z2funE`})}):null,t[23]=f,t[24]=y,t[25]=s,t[26]=M):M=t[26];let N;t[27]!==y||t[28]!==m?(N=()=>void y(m),t[27]=y,t[28]=m,t[29]=N):N=t[29];let ee;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(c,{id:`xloBjn`}),t[30]=ee):ee=t[30];let P;t[31]!==s||t[32]!==N?(P=(0,Q.jsx)(S,{menuKind:s,onSelect:N,children:ee}),t[31]=s,t[32]=N,t[33]=P):P=t[33];let F;t[34]!==s||t[35]!==M||t[36]!==P?(F=(0,Q.jsxs)(g,{menuKind:s,children:[M,P]}),t[34]=s,t[35]=M,t[36]=P,t[37]=F):F=t[37];let I;t[38]!==s||t[39]!==F?(I=(0,Q.jsx)(b,{menuKind:s,children:F}),t[38]=s,t[39]=F,t[40]=I):I=t[40];let te;t[41]!==s||t[42]!==j||t[43]!==I?(te=(0,Q.jsxs)(v,{menuKind:s,children:[j,I]}),t[41]=s,t[42]=j,t[43]=I,t[44]=te):te=t[44];let L;t[45]!==s||t[46]!==te||t[47]!==D||t[48]!==O?(L=(0,Q.jsxs)(g,{menuKind:s,children:[D,O,te]}),t[45]=s,t[46]=te,t[47]=D,t[48]=O,t[49]=L):L=t[49];let R;t[50]===s?R=t[51]:(R=(0,Q.jsx)(w,{menuKind:s}),t[50]=s,t[51]=R);let z;t[52]!==i||t[53]!==r||t[54]!==n?(z=()=>i.requestFileDelete(n,r),t[52]=i,t[53]=r,t[54]=n,t[55]=z):z=t[55];let B,V;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(st,{"aria-hidden":!0}),V=(0,Q.jsx)(c,{id:`cnGeoo`}),t[56]=B,t[57]=V):(B=t[56],V=t[57]);let H;t[58]!==s||t[59]!==z?(H=(0,Q.jsxs)(S,{menuKind:s,variant:`destructive`,onSelect:z,children:[B,V]}),t[58]=s,t[59]=z,t[60]=H):H=t[60];let U;t[61]!==s||t[62]!==H?(U=(0,Q.jsx)(g,{menuKind:s,children:H}),t[61]=s,t[62]=H,t[63]=U):U=t[63];let W;return t[64]!==L||t[65]!==R||t[66]!==U?(W=(0,Q.jsxs)(Q.Fragment,{children:[L,R,U]}),t[64]=L,t[65]=R,t[66]=U,t[67]=W):W=t[67],W}function sr(e){let t=(0,kt.c)(15),{skill:n,actions:r,existingNames:i,menuKind:a}=e,o=a===void 0?`dropdown`:a,s=Qe(),c=_().states,{dispatch:l}=Sn(),u=typeof window<`u`?window.okDesktop:void 0,d;t[0]!==n.name||t[1]!==n.scope||t[2]!==s?(d=an({skillName:n.name,scope:n.scope,workspace:s}),t[0]=n.name,t[1]=n.scope,t[2]=s,t[3]=d):d=t[3];let f=d,p;t[4]!==l||t[5]!==f||t[6]!==c||t[7]!==o?(p=o===`context`?(0,Q.jsx)(Mn,{input:f,installStates:c,dispatch:l}):(0,Q.jsx)(Pn,{input:f,installStates:c,isElectronHost:u!=null,dispatch:l}),t[4]=l,t[5]=f,t[6]=c,t[7]=o,t[8]=p):p=t[8];let m;return t[9]!==r||t[10]!==i||t[11]!==o||t[12]!==n||t[13]!==p?(m=(0,Q.jsx)(cr,{actions:r,existingNames:i,menuKind:o,skill:n,openWithAi:p}),t[9]=r,t[10]=i,t[11]=o,t[12]=n,t[13]=p,t[14]=m):m=t[14],m}function cr(e){let t=(0,kt.c)(124),{actions:r,existingNames:i,menuKind:o,openWithAi:s,skill:u}=e,{_:d}=l(),f=ut(),p=C(u,r),_=u.absolutePath,y;t[0]===d?y=t[1]:(y=async function(e){try{await h(e),Z.success(d({id:`SXCSQd`}))}catch{Z.error(d({id:`cRHuuI`}))}},t[0]=d,t[1]=y);let D=y,O;t[2]!==_||t[3]!==o?(O=(0,Q.jsx)(ar,{absolutePath:_,menuKind:o}),t[2]=_,t[3]=o,t[4]=O):O=t[4];let k,A;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(a,{"aria-hidden":!0}),A=(0,Q.jsx)(c,{id:`zd00pH`}),t[5]=k,t[6]=A):(k=t[5],A=t[6]);let j;t[7]===o?j=t[8]:(j=(0,Q.jsxs)(E,{menuKind:o,children:[k,A]}),t[7]=o,t[8]=j);let M;t[9]!==_||t[10]!==D||t[11]!==o?(M=_?(0,Q.jsx)(S,{menuKind:o,onSelect:()=>void D(_),children:(0,Q.jsx)(c,{id:`z2funE`})}):null,t[9]=_,t[10]=D,t[11]=o,t[12]=M):M=t[12];let N;t[13]!==D||t[14]!==u.path?(N=()=>void D(u.path),t[13]=D,t[14]=u.path,t[15]=N):N=t[15];let ee;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(c,{id:`xloBjn`}),t[16]=ee):ee=t[16];let P;t[17]!==o||t[18]!==N?(P=(0,Q.jsx)(S,{menuKind:o,onSelect:N,children:ee}),t[17]=o,t[18]=N,t[19]=P):P=t[19];let F;t[20]!==o||t[21]!==M||t[22]!==P?(F=(0,Q.jsxs)(g,{menuKind:o,children:[M,P]}),t[20]=o,t[21]=M,t[22]=P,t[23]=F):F=t[23];let I;t[24]!==o||t[25]!==F?(I=(0,Q.jsx)(b,{menuKind:o,children:F}),t[24]=o,t[25]=F,t[26]=I):I=t[26];let te;t[27]!==o||t[28]!==I||t[29]!==j?(te=(0,Q.jsxs)(v,{menuKind:o,children:[j,I]}),t[27]=o,t[28]=I,t[29]=j,t[30]=te):te=t[30];let L;t[31]!==o||t[32]!==s||t[33]!==te||t[34]!==O?(L=(0,Q.jsxs)(g,{menuKind:o,children:[O,s,te]}),t[31]=o,t[32]=s,t[33]=te,t[34]=O,t[35]=L):L=t[35];let R;t[36]===o?R=t[37]:(R=(0,Q.jsx)(w,{menuKind:o}),t[36]=o,t[37]=R);let z;t[38]!==r||t[39]!==i||t[40]!==u?(z=()=>void r.duplicate(u,i),t[38]=r,t[39]=i,t[40]=u,t[41]=z):z=t[41];let B,V;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(n,{"aria-hidden":!0}),V=(0,Q.jsx)(c,{id:`euc6Ns`}),t[42]=B,t[43]=V):(B=t[42],V=t[43]);let H;t[44]!==o||t[45]!==z?(H=(0,Q.jsxs)(S,{menuKind:o,onSelect:z,children:[B,V]}),t[44]=o,t[45]=z,t[46]=H):H=t[46];let U;t[47]!==r||t[48]!==i||t[49]!==u?(U=()=>r.requestRename(u,i),t[47]=r,t[48]=i,t[49]=u,t[50]=U):U=t[50];let W,G;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(Tn,{"aria-hidden":!0}),G=(0,Q.jsx)(c,{id:`2wxgft`}),t[51]=W,t[52]=G):(W=t[51],G=t[52]);let K;t[53]!==o||t[54]!==U?(K=(0,Q.jsxs)(S,{menuKind:o,onSelect:U,children:[W,G]}),t[53]=o,t[54]=U,t[55]=K):K=t[55];let q;t[56]!==r||t[57]!==u?(q=()=>r.requestFileCreate(u),t[56]=r,t[57]=u,t[58]=q):q=t[58];let J,Y;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(m,{"aria-hidden":!0}),Y=(0,Q.jsx)(c,{id:`HdkSiO`}),t[59]=J,t[60]=Y):(J=t[59],Y=t[60]);let X;t[61]!==o||t[62]!==q?(X=(0,Q.jsxs)(S,{menuKind:o,onSelect:q,children:[J,Y]}),t[61]=o,t[62]=q,t[63]=X):X=t[63];let ne,re;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(wn,{"aria-hidden":!0}),re=(0,Q.jsx)(c,{id:`TKQ7K-`}),t[64]=ne,t[65]=re):(ne=t[64],re=t[65]);let ie;t[66]===o?ie=t[67]:(ie=(0,Q.jsxs)(E,{menuKind:o,children:[ne,re]}),t[66]=o,t[67]=ie);let ae;t[68]!==r||t[69]!==u?(ae=e=>r.requestForkResolve(u,e),t[68]=r,t[69]=u,t[70]=ae):ae=t[70];let oe;t[71]!==p||t[72]!==o||t[73]!==u||t[74]!==ae?(oe=(0,Q.jsx)(x,{toggles:p,skill:u,menuKind:o,onResolveFork:ae}),t[71]=p,t[72]=o,t[73]=u,t[74]=ae,t[75]=oe):oe=t[75];let se;t[76]!==o||t[77]!==oe?(se=(0,Q.jsx)(g,{menuKind:o,children:oe}),t[76]=o,t[77]=oe,t[78]=se):se=t[78];let ce;t[79]!==o||t[80]!==se?(ce=(0,Q.jsx)(b,{menuKind:o,className:T,children:se}),t[79]=o,t[80]=se,t[81]=ce):ce=t[81];let le;t[82]!==o||t[83]!==ie||t[84]!==ce?(le=(0,Q.jsxs)(v,{menuKind:o,children:[ie,ce]}),t[82]=o,t[83]=ie,t[84]=ce,t[85]=le):le=t[85];let ue;t[86]!==r||t[87]!==u?(ue=()=>r.requestScopeMove(u,u.scope===`project`?`global`:`project`),t[86]=r,t[87]=u,t[88]=ue):ue=t[88];let de;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,Q.jsx)(Cn,{"aria-hidden":!0}),t[89]=de):de=t[89];let fe;t[90]!==f.global||t[91]!==f.project||t[92]!==u.scope?(fe=u.scope===`project`?(0,Q.jsx)(c,{id:`bpytj4`,values:{0:f.global}}):(0,Q.jsx)(c,{id:`bpytj4`,values:{0:f.project}}),t[90]=f.global,t[91]=f.project,t[92]=u.scope,t[93]=fe):fe=t[93];let pe;t[94]!==o||t[95]!==ue||t[96]!==fe?(pe=(0,Q.jsxs)(S,{menuKind:o,onSelect:ue,children:[de,fe]}),t[94]=o,t[95]=ue,t[96]=fe,t[97]=pe):pe=t[97];let me;t[98]!==o||t[99]!==H||t[100]!==K||t[101]!==X||t[102]!==le||t[103]!==pe?(me=(0,Q.jsxs)(g,{menuKind:o,children:[H,K,X,le,pe]}),t[98]=o,t[99]=H,t[100]=K,t[101]=X,t[102]=le,t[103]=pe,t[104]=me):me=t[104];let he;t[105]===o?he=t[106]:(he=(0,Q.jsx)(w,{menuKind:o}),t[105]=o,t[106]=he);let ge;t[107]!==r||t[108]!==u?(ge=()=>r.requestDelete(u),t[107]=r,t[108]=u,t[109]=ge):ge=t[109];let _e,ve;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,Q.jsx)(st,{"aria-hidden":!0}),ve=(0,Q.jsx)(c,{id:`cnGeoo`}),t[110]=_e,t[111]=ve):(_e=t[110],ve=t[111]);let ye;t[112]!==o||t[113]!==ge?(ye=(0,Q.jsxs)(S,{menuKind:o,variant:`destructive`,onSelect:ge,children:[_e,ve]}),t[112]=o,t[113]=ge,t[114]=ye):ye=t[114];let be;t[115]!==o||t[116]!==ye?(be=(0,Q.jsx)(g,{menuKind:o,children:ye}),t[115]=o,t[116]=ye,t[117]=be):be=t[117];let xe;return t[118]!==L||t[119]!==R||t[120]!==me||t[121]!==he||t[122]!==be?(xe=(0,Q.jsxs)(Q.Fragment,{children:[L,R,me,he,be]}),t[118]=L,t[119]=R,t[120]=me,t[121]=he,t[122]=be,t[123]=xe):xe=t[123],xe}export{_n as C,Qt as E,nn as S,Zt as T,rn as _,er as a,pn as b,Pn as c,On as d,En as f,tn as g,on as h,tr as i,Mn as l,Cn as m,or as n,zn as o,Dn as p,ar as r,Vn as s,sr as t,kn as u,$t as v,Sn as w,yn as x,en as y};
|
package/dist/public/index.html
CHANGED
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
-->
|
|
95
95
|
<script>(() => { try { const raw = localStorage.getItem('ok-language-v1'); if (!raw) return; const o = JSON.parse(raw); if (typeof o?.locale !== 'string' || !/^[a-zA-Z]{2,8}(-[a-zA-Z0-9]{2,8})*$/.test(o.locale)) return; document.documentElement.lang = o.locale; document.documentElement.dir = o.dir === 'rtl' ? 'rtl' : 'ltr'; } catch {} })();</script>
|
|
96
96
|
<style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
|
|
97
|
-
<script type="module" crossorigin src="./assets/index-
|
|
97
|
+
<script type="module" crossorigin src="./assets/index-f65PQqkn.js"></script>
|
|
98
98
|
<link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
|
|
99
99
|
<link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
|
|
100
100
|
<link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
<link rel="modulepreload" crossorigin href="./assets/use-settings-route-BLVf3fNR.js">
|
|
229
229
|
<link rel="modulepreload" crossorigin href="./assets/platform-labels-ePF0gcem.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/use-workspace-6-HDvG9b.js">
|
|
231
|
-
<link rel="modulepreload" crossorigin href="./assets/skill-actions-
|
|
231
|
+
<link rel="modulepreload" crossorigin href="./assets/skill-actions-CwMYImH9.js">
|
|
232
232
|
<link rel="modulepreload" crossorigin href="./assets/case-sensitive-B9mhUnHr.js">
|
|
233
233
|
<link rel="modulepreload" crossorigin href="./assets/chevron-left-B1wYSm9K.js">
|
|
234
234
|
<link rel="modulepreload" crossorigin href="./assets/lint-plugin-meta-C15NfeTq.js">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./launch-json-removal-
|
|
2
|
-
//# sourceMappingURL=repair-launch-json-
|
|
1
|
+
import{t as e}from"./launch-json-removal-DJVuHY0O.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
|
|
2
|
+
//# sourceMappingURL=repair-launch-json-Cqrgjn-K.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{bs as e}from"./src-tR2kRwXj.mjs";import{a as t,m as n,s as r}from"./resolve-project-root-
|
|
2
|
-
//# sourceMappingURL=repair-mcp-configs-
|
|
1
|
+
import{bs as e}from"./src-tR2kRwXj.mjs";import{a as t,m as n,s as r}from"./resolve-project-root-C74NWxWO.mjs";import{d as i,v as a}from"./init-Bok8w4bD.mjs";import{t as o}from"./mcp-migrate-event-9DFnNzHa.mjs";import{homedir as s}from"node:os";function c(e){let n=e.logger??d,i=e.home??s(),a=[];if(e.reclaimDisableEnv===`1`)return n({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=r[o],s=l(()=>t.configPath(``,i));if(s!==null&&a.push(u({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:n})),t.projectConfigPath){let r=t.projectConfigPath,i=l(()=>r(e.projectDir));i!==null&&a.push(u({scope:`project`,editorId:o,target:t,home:void 0,cwd:e.projectDir,configPath:i,configPathOverride:i,logger:n}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function l(e){try{return e()}catch{return null}}function u(t){let r={scope:t.scope,editorId:t.editorId,configPath:t.configPath},s=i(t.target,t.cwd,t.home,t.configPathOverride);if(s===null)return{...r,outcome:`no-entry`};if(t.editorId===`pi`){if(n(s))return{...r,outcome:`canonical`}}else{let n=e(s);if(n.kind===`recognized`&&n.disposition===`keep`)return{...r,outcome:`canonical`};if(n.kind===`declined`&&t.scope===`project`)return t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:n.reason}),{...r,outcome:`declined`,reason:n.reason}}t.logger(o({scope:t.scope,surface:`cli-repair`,editorId:t.editorId,configPath:t.configPath,priorEntry:s}));let c=a(t.target,t.cwd,{mode:`published`,skipAvailabilityCheck:!0},t.home,t.configPathOverride);if(c.action===`failed`){let e=c.error??`unknown write failure`;return t.logger({event:`mcp-config-repair-write-failed`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,error:e}),{...r,outcome:`write-failed`,error:e}}return c.action===`declined`?(t.logger({event:`mcp-config-repair-declined`,scope:t.scope,editorId:t.editorId,configPath:t.configPath,reason:c.declineReason}),{...r,outcome:`declined`}):{...r,outcome:`repaired`}}function d(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{c as repairMcpConfigs};
|
|
2
|
+
//# sourceMappingURL=repair-mcp-configs-DeCwNBjA.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{q as e,zs as t}from"./src-tR2kRwXj.mjs";import{ar as n,cr as r,gn as i,hr as a,ir as o,lr as s,pr as c,ur as l,xr as u,yr as d}from"./src-o2syKqOu.mjs";import{c as f,n as p,s as m,x as h}from"./resolve-project-root-B1L9l8eS.mjs";import{n as g,s as _,t as v}from"./colors-DSyAT9Cz.mjs";import{n as y,r as b,t as x}from"./skill-teardown-DHXBmhnd.mjs";import{basename as S,dirname as C,join as w,relative as T,resolve as E}from"node:path";import{existsSync as D,mkdirSync as O,readFileSync as k,readdirSync as A,rmSync as j,statSync as M,writeFileSync as N}from"node:fs";import{homedir as P}from"node:os";import{createInterface as F}from"node:readline/promises";const I={existsSync:e=>D(e),isDirectory:e=>{try{return M(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>A(e),readFileSync:e=>k(e),writeFileSync:(e,t)=>{N(e,t)},mkdirSync:(e,t)=>{O(e,t)},rmSync:(e,t)=>{j(e,t)}},L={resolveProjectBundledSkillDir:()=>a(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>a(e,{checkDesktop:!1}),readBundledVersion:()=>n(),readRecordedVersion:e=>r(e,`cli-hosts`),writeRecordedVersion:(e,t)=>l(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>c(e),readBundleDecision:(e,t)=>o(e,t),writeBundleDecision:(e,t,n)=>s(e,t,n),removeBundleFromDisk:(e,t)=>b(e,t)};function R(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function z(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(C(t),{recursive:!0}),B(e,t,n)}function B(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=w(e,r),a=w(t,r);n.isDirectory(i)?B(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function V(e,n,r){return r.existsSync(w(e,`.agents`,`skills`,n))||t.some(t=>r.existsSync(w(e,t.skillsRoot,n)))}function H(e,n,r,i,a,o){let s=[],c=w(e,`.agents`,`skills`,n);if(V(e,n,i)){i.existsSync(c)&&s.push({kind:`central`,path:c,outcome:`skipped-present`});for(let r of t){let t=w(e,r.skillsRoot,n);if(t!==c){if(!i.existsSync(w(e,r.hostDir))){s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-host-absent`});continue}i.existsSync(t)&&s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-present`})}}return{entries:s,anyWritten:!1,anyDestinationSucceeded:!0}}let l=i.existsSync(w(e,`.agents`));if(l&&i.existsSync(c))s.push({kind:`central`,path:c,outcome:`skipped-present`});else if(l)try{z(r,c,i),s.push({kind:`central`,path:c,outcome:`written`}),a({event:`user-skill-reclaim-central-written`,scope:`user`,path:c,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`central`,path:c,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-central-failed`,scope:`user`,path:c,error:t})}for(let l of t){let t=w(e,l.hostDir),u=w(e,l.skillsRoot,n);if(u===c){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!i.existsSync(t)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(i.existsSync(u)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-present`});continue}try{z(r,u,i),s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`written`}),a({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,error:t})}}return{entries:s,anyWritten:s.some(e=>e.outcome===`written`),anyDestinationSucceeded:s.some(e=>e.outcome===`written`||e.outcome===`skipped-present`)}}function U(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function W(e,t,n,r){if(!e||!t)return!1;let a;try{a=e.configPath(n,r)}catch{return!1}let o=e=>w(i(C(e)),S(e));return o(t)===o(a)}function G(e,t,n,r,i){let a;try{a=n.resolveProjectBundledSkillDir()}catch(e){return i({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let o=[];for(let n of f){let s=w(e,n.hostDir,`skills`,`open-knowledge`),c=w(s,`SKILL.md`);if(r.existsSync(c)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`present`});continue}let l=m[n.editorId],u=l?.projectConfigPath?.(e);if(W(l,u,e,t)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`skipped-global-collision`}),i({event:`project-skill-reclaim-skipped-global-collision`,scope:`project`,editorId:n.editorId,path:s});continue}if(!U(u,r)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`no-token`}),i({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:n.editorId,path:s});continue}try{p(s,e),z(a,s,r),o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`created`}),i({event:`project-skill-reclaim-created`,scope:`project`,editorId:n.editorId,path:s})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`failed`,error:t}),i({event:`project-skill-reclaim-failed`,scope:`project`,editorId:n.editorId,path:s,error:t})}}return{outcome:`done`,entries:o}}async function K(t,n,r,i){let a=e=>{n.recordEvent(e).catch(()=>{})},o=()=>new Date().toISOString(),s;try{s=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let c;try{c=await n.readRecordedVersion(t)}catch(e){i({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),c=null}let l=[],f=null;for(let e of u)try{l.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(l.length===0)return i({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),a({ts:o(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let a of l){let o=d[a.id],s=V(t,o,r),c=await n.readBundleDecision(t,o).catch(()=>null);if(!e(c,{installedOnDisk:s})){if(s)try{n.removeBundleFromDisk(t,a.id),i({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:a.id})}catch(e){i({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:a.id,error:e instanceof Error?e.message:String(e)})}continue}if(c===null&&s)try{await n.writeBundleDecision(t,o,!0)}catch(e){i({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:a.id,error:e instanceof Error?e.message:String(e)})}p.push(a)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>V(t,d[e.id],r));if(c!==null&&c===s&&m)return i({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:s}),{outcome:`skipped`,reason:`version-current`};let h=[],g=l.length===u.length,_=[];for(let{id:e,sourceDir:n}of p){let a=H(t,d[e],n,r,i,s);h.push(...a.entries),_.push({id:e,anyWritten:a.anyWritten,landed:a.anyDestinationSucceeded,centralFailed:a.entries.some(e=>e.kind===`central`&&e.outcome===`failed`),hostFailed:a.entries.some(e=>e.kind===`host`&&e.outcome===`failed`)})}let v=_.some(e=>e.centralFailed),y=_.every(e=>e.landed);if(g&&y&&!v){let e=null;try{await n.writeRecordedVersion(t,s),i({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:s})}catch(t){e=t instanceof Error?t.message:String(t),i({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:s,error:e})}for(let{id:t,anyWritten:n}of _)a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?n?`installed`:`skip-current`:`failed`,version:s,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{g||a({ts:o(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:s,reason:`bundle-unresolved`});for(let{id:e,centralFailed:t,hostFailed:n}of _)!t&&!n||a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:e,outcome:`failed`,version:s,reason:n?`all-writes-failed`:`central-write-failed`})}return{outcome:`done`,version:s,entries:h}}async function q(e){let t=e.logger??R,n=e.fs??I,r=e.home??P(),i={...L,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=G(e.projectDir,r,i,n,t),o=await K(r,i,n,t),s=y(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=x(r,s)}catch(e){u=!0,t({event:`legacy-fanout-cleanup-refused`,scope:`user`,error:e instanceof Error?e.message:String(e)})}for(let e of c)t({event:`legacy-fanout-path-removed`,scope:`user`,path:e})}else l=!0,t({event:`legacy-fanout-cleanup-declined`,scope:`user`});return{status:`done`,project:a,user:o,legacySwept:c,legacyCleanupDeclined:l,legacyCleanupFailed:u}}function J(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function Y(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`present`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length,o=e.project.entries.filter(e=>e.outcome===`skipped-global-collision`).length;t.push(` Project: ${n} present, ${r} created, ${i} no-token, ${a} failed.`),o>0&&t.push(` Skipped ${o} host(s) whose project config path is their user-global config (not a project directory).`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-present`).length,i=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,a=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} present, ${i} skipped, ${a} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
|
|
1
|
+
import{q as e,zs as t}from"./src-tR2kRwXj.mjs";import{ar as n,cr as r,gn as i,hr as a,ir as o,lr as s,pr as c,ur as l,xr as u,yr as d}from"./src-DzuFrTJZ.mjs";import{c as f,n as p,s as m,x as h}from"./resolve-project-root-C74NWxWO.mjs";import{n as g,s as _,t as v}from"./colors-DSyAT9Cz.mjs";import{n as y,r as b,t as x}from"./skill-teardown-Byb0Eg2k.mjs";import{basename as S,dirname as C,join as w,relative as T,resolve as E}from"node:path";import{existsSync as D,mkdirSync as O,readFileSync as k,readdirSync as A,rmSync as j,statSync as M,writeFileSync as N}from"node:fs";import{homedir as P}from"node:os";import{createInterface as F}from"node:readline/promises";const I={existsSync:e=>D(e),isDirectory:e=>{try{return M(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>A(e),readFileSync:e=>k(e),writeFileSync:(e,t)=>{N(e,t)},mkdirSync:(e,t)=>{O(e,t)},rmSync:(e,t)=>{j(e,t)}},L={resolveProjectBundledSkillDir:()=>a(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>a(e,{checkDesktop:!1}),readBundledVersion:()=>n(),readRecordedVersion:e=>r(e,`cli-hosts`),writeRecordedVersion:(e,t)=>l(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>c(e),readBundleDecision:(e,t)=>o(e,t),writeBundleDecision:(e,t,n)=>s(e,t,n),removeBundleFromDisk:(e,t)=>b(e,t)};function R(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function z(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(C(t),{recursive:!0}),B(e,t,n)}function B(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=w(e,r),a=w(t,r);n.isDirectory(i)?B(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function V(e,n,r){return r.existsSync(w(e,`.agents`,`skills`,n))||t.some(t=>r.existsSync(w(e,t.skillsRoot,n)))}function H(e,n,r,i,a,o){let s=[],c=w(e,`.agents`,`skills`,n);if(V(e,n,i)){i.existsSync(c)&&s.push({kind:`central`,path:c,outcome:`skipped-present`});for(let r of t){let t=w(e,r.skillsRoot,n);if(t!==c){if(!i.existsSync(w(e,r.hostDir))){s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-host-absent`});continue}i.existsSync(t)&&s.push({kind:`host`,editorId:r.editorId,hostDir:r.hostDir,path:t,outcome:`skipped-present`})}}return{entries:s,anyWritten:!1,anyDestinationSucceeded:!0}}let l=i.existsSync(w(e,`.agents`));if(l&&i.existsSync(c))s.push({kind:`central`,path:c,outcome:`skipped-present`});else if(l)try{z(r,c,i),s.push({kind:`central`,path:c,outcome:`written`}),a({event:`user-skill-reclaim-central-written`,scope:`user`,path:c,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`central`,path:c,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-central-failed`,scope:`user`,path:c,error:t})}for(let l of t){let t=w(e,l.hostDir),u=w(e,l.skillsRoot,n);if(u===c){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!i.existsSync(t)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(i.existsSync(u)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-present`});continue}try{z(r,u,i),s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`written`}),a({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,error:t})}}return{entries:s,anyWritten:s.some(e=>e.outcome===`written`),anyDestinationSucceeded:s.some(e=>e.outcome===`written`||e.outcome===`skipped-present`)}}function U(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function W(e,t,n,r){if(!e||!t)return!1;let a;try{a=e.configPath(n,r)}catch{return!1}let o=e=>w(i(C(e)),S(e));return o(t)===o(a)}function G(e,t,n,r,i){let a;try{a=n.resolveProjectBundledSkillDir()}catch(e){return i({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let o=[];for(let n of f){let s=w(e,n.hostDir,`skills`,`open-knowledge`),c=w(s,`SKILL.md`);if(r.existsSync(c)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`present`});continue}let l=m[n.editorId],u=l?.projectConfigPath?.(e);if(W(l,u,e,t)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`skipped-global-collision`}),i({event:`project-skill-reclaim-skipped-global-collision`,scope:`project`,editorId:n.editorId,path:s});continue}if(!U(u,r)){o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`no-token`}),i({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:n.editorId,path:s});continue}try{p(s,e),z(a,s,r),o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`created`}),i({event:`project-skill-reclaim-created`,scope:`project`,editorId:n.editorId,path:s})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({editorId:n.editorId,hostDir:n.hostDir,path:s,outcome:`failed`,error:t}),i({event:`project-skill-reclaim-failed`,scope:`project`,editorId:n.editorId,path:s,error:t})}}return{outcome:`done`,entries:o}}async function K(t,n,r,i){let a=e=>{n.recordEvent(e).catch(()=>{})},o=()=>new Date().toISOString(),s;try{s=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let c;try{c=await n.readRecordedVersion(t)}catch(e){i({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),c=null}let l=[],f=null;for(let e of u)try{l.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(l.length===0)return i({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),a({ts:o(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let a of l){let o=d[a.id],s=V(t,o,r),c=await n.readBundleDecision(t,o).catch(()=>null);if(!e(c,{installedOnDisk:s})){if(s)try{n.removeBundleFromDisk(t,a.id),i({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:a.id})}catch(e){i({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:a.id,error:e instanceof Error?e.message:String(e)})}continue}if(c===null&&s)try{await n.writeBundleDecision(t,o,!0)}catch(e){i({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:a.id,error:e instanceof Error?e.message:String(e)})}p.push(a)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>V(t,d[e.id],r));if(c!==null&&c===s&&m)return i({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:s}),{outcome:`skipped`,reason:`version-current`};let h=[],g=l.length===u.length,_=[];for(let{id:e,sourceDir:n}of p){let a=H(t,d[e],n,r,i,s);h.push(...a.entries),_.push({id:e,anyWritten:a.anyWritten,landed:a.anyDestinationSucceeded,centralFailed:a.entries.some(e=>e.kind===`central`&&e.outcome===`failed`),hostFailed:a.entries.some(e=>e.kind===`host`&&e.outcome===`failed`)})}let v=_.some(e=>e.centralFailed),y=_.every(e=>e.landed);if(g&&y&&!v){let e=null;try{await n.writeRecordedVersion(t,s),i({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:s})}catch(t){e=t instanceof Error?t.message:String(t),i({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:s,error:e})}for(let{id:t,anyWritten:n}of _)a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?n?`installed`:`skip-current`:`failed`,version:s,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{g||a({ts:o(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:s,reason:`bundle-unresolved`});for(let{id:e,centralFailed:t,hostFailed:n}of _)!t&&!n||a({ts:o(),surface:`cli-start`,target:`cli-hosts`,bundle:e,outcome:`failed`,version:s,reason:n?`all-writes-failed`:`central-write-failed`})}return{outcome:`done`,version:s,entries:h}}async function q(e){let t=e.logger??R,n=e.fs??I,r=e.home??P(),i={...L,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=G(e.projectDir,r,i,n,t),o=await K(r,i,n,t),s=y(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=x(r,s)}catch(e){u=!0,t({event:`legacy-fanout-cleanup-refused`,scope:`user`,error:e instanceof Error?e.message:String(e)})}for(let e of c)t({event:`legacy-fanout-path-removed`,scope:`user`,path:e})}else l=!0,t({event:`legacy-fanout-cleanup-declined`,scope:`user`});return{status:`done`,project:a,user:o,legacySwept:c,legacyCleanupDeclined:l,legacyCleanupFailed:u}}function J(e){return e.status===`skipped`?e.reason===`reclaim-disabled`?0:1:e.project.outcome===`skipped`||e.user.outcome===`skipped`&&e.user.reason!==`version-current`&&e.user.reason!==`all-bundles-declined`||e.project.entries.some(e=>e.outcome===`failed`)||e.user.outcome===`done`&&e.user.entries.some(e=>e.outcome===`failed`)?1:0}function Y(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`present`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length,o=e.project.entries.filter(e=>e.outcome===`skipped-global-collision`).length;t.push(` Project: ${n} present, ${r} created, ${i} no-token, ${a} failed.`),o>0&&t.push(` Skipped ${o} host(s) whose project config path is their user-global config (not a project directory).`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-present`).length,i=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,a=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} present, ${i} skipped, ${a} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
|
|
2
2
|
`)}function X(){return new h(`repair-skills`).description("Refresh bundled SKILL.md files for installed AI editors (project-local + user-global). Runs automatically during `ok start`; this command forces an explicit sweep.").option(`-y, --yes`,`Skip the confirmation prompt for removing directories left by a pre-0.42 install.`).action(async e=>{let t=await q({projectDir:E(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null,confirmLegacyCleanup:t=>Z(t,{yes:e.yes===!0})});process.stdout.write(`${Y(t)}\n`),process.exitCode=J(t)})}async function Z(e,t){let n=P(),r=e=>`~/${T(n,e)}`,i=t.input??process.stdin,a=[``,v(`A previous version of OpenKnowledge installed its skill into agent tools you may never have used.`),g(`(Versions before 0.42 wrote to every host a third-party installer knew about — see issue #820.)`)];if(e.skillDirs.length>0&&a.push(``,`${v(`Remove OpenKnowledge skills:`)} ${e.skillDirs.length}`,...e.skillDirs.map(e=>` ${r(e)}`)),e.emptyDirs.length>0){let t=e.skillDirs.length>0?`Then remove these, which hold nothing else once the above are gone:`:`Remove these empty directories, left behind by that install:`;a.push(``,`${v(t)} ${e.emptyDirs.length}`,...e.emptyDirs.map(e=>` ${r(e)}`))}if(a.push(``,g(`Nothing outside these paths is touched. A directory that still holds anything is kept.`)),process.stdout.write(`${a.join(`
|
|
3
3
|
`)}\n`),t.yes)return!0;if(!i.isTTY)return process.stdout.write(`${_("Not a terminal — skipping cleanup. Re-run with `ok repair-skills --yes` to remove these.")}\n`),!1;let o=F({input:i,output:process.stdout});try{let e=(await o.question(`\n${v(`Remove them?`)} ${g(`[y/N] `)}`)).trim().toLowerCase();return e===`y`||e===`yes`}finally{o.close()}}export{X as n,q as t};
|
|
4
|
-
//# sourceMappingURL=repair-skills-
|
|
4
|
+
//# sourceMappingURL=repair-skills-B9KF6HMH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./repair-skills-B9KF6HMH.mjs";export{e as repairSkills};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{As as r,Ps as i,Rs as a,ks as o,xs as s}from"./src-tR2kRwXj.mjs";import{Ir as c,Pi as l,gn as u,hr as d,kn as f}from"./src-
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{As as r,Ps as i,Rs as a,ks as o,xs as s}from"./src-tR2kRwXj.mjs";import{Ir as c,Pi as l,gn as u,hr as d,kn as f}from"./src-DzuFrTJZ.mjs";import{execFileSync as p}from"node:child_process";import{basename as m,dirname as h,isAbsolute as g,join as _,posix as v,relative as y,resolve as b,sep as x,win32 as S}from"node:path";import{cpSync as ee,existsSync as C,lstatSync as te,mkdirSync as ne,readFileSync as re,realpathSync as w,rmSync as ie,statSync as ae}from"node:fs";import{homedir as T}from"node:os";var E=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),D=n((e=>{let{InvalidArgumentError:t}=E();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),O=n((e=>{let{humanReadableArgName:t}=D();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
2
2
|
`)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
3
3
|
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
4
4
|
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),k=n((e=>{let{InvalidArgumentError:t}=E();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
@@ -53,4 +53,4 @@ foreach ($d in $dirs) {
|
|
|
53
53
|
}
|
|
54
54
|
[Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
|
|
55
55
|
exit 127`,I=`// ok-pi-bridge`,L=`${I}-v1`,be=`ok-pi-managed-extension`;function xe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(L)}return!1}function R(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=b(e);if(m(t)===`cli.mjs`&&m(h(t))===`dist`)return t;let n=t.split(x),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return _(i.length===0?x:i.join(x),`packages`,`cli`,`dist`,`cli.mjs`)}function z(e={}){return e.mode===`dev`?{command:M,args:[R(),`mcp`],env:{...N}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{command:`/bin/sh`,args:[`-l`,`-c`,P]}}function Se(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[M,R(),`mcp`],environment:{...N}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,F]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,P]}}function Ce(e){if(typeof e!=`object`||!e)return!1;let t=e;return B(t,z({mode:`published`,platformName:`darwin`}))||B(t,z({mode:`published`,platformName:`win32`}))}function B(e,t){return Object.keys(e).length===Object.keys(t).length?we(e,t):!1}function we(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function V(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`?e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3]):!1}function Te(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:V(t.args,t.command)}function Ee(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&V(r,n)}function H(e){return e===`win32`?S:v}function De(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=e.env??process.env,i=H(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA||i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME||i.join(n,`.config`)}function Oe(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.claude.json`)}function U(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=e.env??process.env;if(t===`darwin`)return v.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??S.join(n,`AppData`,`Roaming`);return S.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function W(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.cursor`,`mcp.json`)}function ke(e={}){let t=e.platformName??process.platform,n=e.home??T();return(e.env??process.env).CODEX_HOME??H(t).join(n,`.codex`)}function G(e={}){return H(e.platformName??process.platform).join(ke(e),`config.toml`)}function K(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=(e.env??process.env).COPILOT_HOME??H(t).join(n,`.copilot`);return H(t).join(r,`mcp-config.json`)}function Ae(e={}){let t=e.platformName??process.platform,n=e.home??T(),r=e.env??process.env,i=H(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function q(e={}){return H(e.platformName??process.platform).join(Ae(e),`opencode.json`)}function je(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.openclaw`,`openclaw.json`)}function Me(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.hermes`,`config.yaml`)}function J(e={}){let t=e.platformName??process.platform,n=e.home??T();return(e.env??process.env).PI_CODING_AGENT_DIR??H(t).join(n,`.pi`,`agent`)}function Ne(e={}){let t=e.platformName??process.platform,n=e.home??T();return H(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Pe(e,t){let n=H(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function Y(e={}){let t=e.platformName??process.platform,n=Pe(e.home??T(),t);return n.find(e=>C(e))||n.find(e=>C(h(e)))||n[0]}const X={claude:{id:`claude`,label:j.claude,configPath:(e,t)=>Oe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.claude`),projectConfigPath:e=>_(e,`.mcp.json`),projectSkillPath:e=>_(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:j[`claude-desktop`],configPath:(e,t)=>U({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(U({home:t}))},cursor:{id:`cursor`,label:j.cursor,configPath:(e,t)=>W({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(W({home:t})),projectConfigPath:e=>_(e,`.cursor`,`mcp.json`),projectSkillPath:e=>_(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:j.codex,configPath:(e,t)=>G({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(G({home:t})),projectConfigPath:e=>_(e,`.codex`,`config.toml`),projectSkillPath:e=>_(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:j.copilot,configPath:(e,t)=>K({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(K({home:t})),projectSkillPath:e=>_(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:j.opencode,configPath:(e,t)=>q({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>s,buildEntry:(e,t)=>Se(t),scope:`global`,detectPath:(e,t)=>h(q({home:t})),projectConfigPath:e=>_(e,`opencode.json`),projectSkillPath:e=>_(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:j.openclaw,configPath:(e,t)=>je({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:j.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>J({home:t}),projectConfigPath:e=>_(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>_(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:j.antigravity,configPath:(e,t)=>Ne({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:j[`lm-studio`],configPath:(e,t)=>Y({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>h(Y({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:j.hermes,configPath:(e,t)=>Me({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>s,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>_(t??T(),`.hermes`),offerOnlyWhenDetected:!0}};function Fe(e){let t=e.filter(e=>!Object.hasOwn(X,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${A.join(`, `)}`);return e.map(e=>X[e])}function Z(e,t){let n;try{n=te(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);Q(e,t)}function Ie(e,t){Q(e,t)}function Q(e,t){let n;try{n=w(t)}catch{n=b(t)}let r=h(e);for(;r.length>1&&r!==x;){let t;try{t=w(r)}catch(e){if(e.code===`ENOENT`){r=h(r);continue}throw e}let i=y(n,t);if(i===``||!i.startsWith(`..`)&&!g(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Le(e,t,n){try{if(ae(n).size>10485760)return!1}catch{return!1}let r;try{r=re(n,`utf-8`)}catch{return!1}let i=[],a=c(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!$(a))return!1;let o=a[e.topLevelKey];if(!$(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;return $(s)?$(s[e.serverName(t)]):!1}function Re(e,t,n={}){if(!a.includes(e.id))return!0;try{return Le(e,t,e.configPath(t,n.home))}catch{return!1}}function ze(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!Re(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=d(`project`,{checkDesktop:!0}),i=h(r);Z(i,t);let a=C(r)?`overwritten`:`written`;return ie(i,{recursive:!0,force:!0}),ne(h(i),{recursive:!0}),ee(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function Be(e,t){let n=y(u(t),u(e));return n.length>0&&!n.startsWith(`..`)&&!g(n)}const Ve=e=>{try{let t=p(`git`,[`rev-parse`,`--show-toplevel`],l({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function He(e,t={}){let n=t.homeDir??T(),r=t.gitTopLevel??Ve,i=b(e),a;try{a=w(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(f(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=h(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&Be(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}export{_e as C,pe as S,H as _,A as a,J as b,ye as c,be as d,z as f,Ee as g,Ce as h,ze as i,I as l,xe as m,Z as n,j as o,Te as p,Ie as r,X as s,He as t,L as u,De as v,he as x,Fe as y};
|
|
56
|
-
//# sourceMappingURL=resolve-project-root-
|
|
56
|
+
//# sourceMappingURL=resolve-project-root-C74NWxWO.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{zs as e}from"./src-tR2kRwXj.mjs";import{xr as t,yr as n}from"./src-
|
|
2
|
-
//# sourceMappingURL=skill-teardown-
|
|
1
|
+
import{zs as e}from"./src-tR2kRwXj.mjs";import{xr as t,yr as n}from"./src-DzuFrTJZ.mjs";import{dirname as r,isAbsolute as i,join as a,relative as o,resolve as s,sep as c}from"node:path";import{existsSync as l,lstatSync as u,readdirSync as d,rmSync as f,rmdirSync as p}from"node:fs";const m=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],h=[...t.map(e=>n[e]),`open-knowledge`];function g(e){if(!i(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=s(e);if(t===c||r(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function _(e,t){let n=o(e,t);if(n.startsWith(`..`)||i(n))return!1;let r=e;for(let e of n.split(c)){r=a(r,e);try{if(!u(r).isDirectory())return!1}catch{return!1}}return!0}function v(e,t){try{return d(e).every(n=>t.has(a(e,n)))}catch{return!1}}function y(e){let t=g(e),n=[],i=[],o=new Set;for(let e of m){let s=a(t,e.hostDir,`skills`);if(!_(t,s))continue;let u=h.map(e=>a(s,e)).filter(e=>l(e));n.push(...u);for(let e of u)o.add(e);let d=a(t,e.pruneRoot),f=s;for(;v(f,o)&&(i.push(f),o.add(f),f!==d);){let e=r(f);if(e===f||e===t||!e.startsWith(t+c))break;f=e}}return{skillDirs:n,emptyDirs:i}}function b(e){try{if(!u(e).isDirectory())return!1;let t=d(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function x(e){let t=new Set,n=new Set;for(let i of m){let o=a(e,i.hostDir,`skills`);for(let e of h)t.add(a(o,e));let s=a(e,i.pruneRoot),l=o;for(;n.add(l),l!==s;){let t=r(l);if(t===l||t===e||!t.startsWith(e+c))break;l=t}}return{skillDirs:t,emptyDirs:n}}function S(e,t){let n=g(e),r=x(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(_(n,e)&&b(e))try{f(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(_(n,e))try{p(e),a.push(e)}catch{}return a}function C(r){let i=g(r),o=[];for(let r of t){let t=n[r];o.push({path:a(i,`.agents`,`skills`,t),bundleId:r,scope:`central`});for(let n of e)o.push({path:a(i,n.skillsRoot,t),bundleId:r,scope:`host`,hostDir:n.hostDir})}return o}function w(e,t){let n=[];for(let r of C(e))if(r.bundleId===t)try{f(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}export{C as i,y as n,w as r,S as t};
|
|
2
|
+
//# sourceMappingURL=skill-teardown-Byb0Eg2k.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./src-tR2kRwXj.mjs";import"./resolve-project-root-C74NWxWO.mjs";import"./src-DKob1_qE.mjs";import"./acp-harness-probe-oUvOUBDG.mjs";import"./init-Bok8w4bD.mjs";import{n as e}from"./loader-DsUw5zIN.mjs";import"./skill-teardown-Byb0Eg2k.mjs";import"./preview-BHw-SgP2.mjs";import"./mcp-migrate-event-9DFnNzHa.mjs";export{e as loadConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ac as e,Hs as t,Ts as n,U as r,Ws as i,ec as a,q as o,ws as s,x as c,xs as l,y as u}from"./src-tR2kRwXj.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,Ar as y,At as b,B as x,Bi as S,Bn as C,Br as w,Bt as T,C as E,Ca as D,Ci as O,Cn as k,Cr as A,Ct as j,D as M,Da as N,Di as P,Dn as F,Dr as I,Dt as L,E as R,Ea as z,Ei as B,En as V,Er as H,Et as U,F as W,Fi as G,Fn as K,Ft as q,G as J,Gi as Y,Gn as X,Gr as Z,Gt as Q,H as $,Hi as ee,Hn as te,Hr as ne,Ht as re,I as ie,Ii as ae,In as oe,It as se,J as ce,Ji as le,Jn as ue,Jr as de,Jt as fe,K as pe,Ki as me,Kn as he,Kr as ge,Kt as _e,L as ve,Li as ye,Ln as be,Lt as xe,M as Se,Mi as Ce,Mn as we,Mr as Te,Mt as Ee,N as De,Ni as Oe,Nn as ke,Nt as Ae,O as je,Oa as Me,Oi as Ne,On as Pe,Or as Fe,Ot as Ie,P as Le,Pi as Re,Pn as ze,Pt as Be,Q as Ve,Qi as He,Qn as Ue,Qr as We,Qt as Ge,R as Ke,Ri as qe,Rn as Je,Rr as Ye,Rt as Xe,S as Ze,Sa as Qe,Si as $e,Sn as et,Sr as tt,St as nt,T as rt,Ta as it,Ti as at,Tn as ot,Tr as st,Tt as ct,U as lt,Ui as ut,Un as dt,Ur as ft,Ut as pt,V as mt,Vi as ht,Vn as gt,Vr as _t,Vt as vt,W as yt,Wi as bt,Wn as xt,Wr as St,Wt as Ct,X as wt,Xi as Tt,Xn as Et,Xr as Dt,Xt as Ot,Y as kt,Yi as At,Yn as jt,Yr as Mt,Yt as Nt,Z as Pt,Zi as Ft,Zn as It,Zr as Lt,Zt as Rt,_ as zt,_a as Bt,_n as Vt,_r as Ht,a as Ut,aa as Wt,ai as Gt,an as Kt,ar as qt,at as Jt,b as Yt,ba as Xt,bi as Zt,bn as Qt,br as $t,bt as en,c as tn,ca as nn,ci as rn,cn as an,cr as on,ct as sn,d as cn,da as ln,di as un,dn,dr as fn,dt as pn,ea as mn,ei as hn,en as gn,er as _n,et as vn,f as yn,fa as bn,fi as xn,fn as Sn,fr as Cn,g as wn,ga as Tn,gi as En,gn as Dn,gr as On,h as kn,ha as An,hi as jn,hn as Mn,hr as Nn,i as Pn,ia as Fn,ii as In,in as Ln,ir as Rn,it as zn,j as Bn,ji as Vn,jn as Hn,jr as Un,jt as Wn,k as Gn,ki as Kn,kn as qn,kr as Jn,kt as Yn,l as Xn,la as Zn,li as Qn,ln as $n,lr as er,lt as tr,m as nr,ma as rr,mi as ir,mn as ar,mr as or,n as sr,na as cr,ni as lr,nn as ur,nr as dr,nt as fr,o as pr,oa as mr,oi as hr,on as gr,or as _r,ot as vr,p as yr,pa as br,pi as xr,pn as Sr,pr as Cr,q as wr,qi as Tr,qn as Er,qr as Dr,qt as Or,r as kr,ra as Ar,ri as jr,rn as Mr,rr as Nr,rt as Pr,s as Fr,sa as Ir,si as Lr,sn as Rr,sr as zr,st as Br,t as Vr,ta as Hr,ti as Ur,tn as Wr,tr as Gr,tt as Kr,u as qr,ua as Jr,ui as Yr,un as Xr,ur as Zr,ut as Qr,v as $r,va as ei,vi as ti,vn as ni,vr as ri,vt as ii,w as ai,wa as oi,wi as si,wn as ci,wr as li,wt as ui,x as di,xa as fi,xi as pi,xn as mi,xr as hi,xt as gi,y as _i,ya as vi,yi,yn as bi,yr as xi,yt as Si,z as Ci,zi as wi,zn as Ti,zr as Ei,zt as Di}from"./src-o2syKqOu.mjs";import{C as Oi,E as ki,T as Ai,_ as ji,b as Mi,c as Ni,d as Pi,g as Fi,i as Ii,l as Li,m as Ri,n as zi,p as Bi,s as Vi,t as Hi,u as Ui,v as Wi,w as Gi,x as Ki,y as qi}from"./fs-traced-2B_-YK-g.mjs";import{a as Ji,d as Yi,f as Xi,i as Zi,l as Qi,n as $i,r as ea,t as ta,u as na}from"./logger-Dq-cRhcP.mjs";import{C as ra,S as ia,_ as aa,a as oa,b as sa,c as ca,d as la,f as ua,g as da,h as fa,i as pa,l as ma,m as ha,n as ga,o as _a,p as va,r as ya,s as ba,t as xa,u as Sa,x as Ca}from"./server-lock-Dngwkd_U.mjs";export{vi as AGENT_ID_MAX_LEN,Xt as AGENT_ID_RE,G as AGENT_WRITE_ORIGIN,z as AcpPermissionStore,D as AcpRegistry,pi as AcpThreadManager,yi as AgentFocusBroadcaster,ti as AgentPresenceBroadcaster,ae as AgentSessionCapacityError,ye as AgentSessionManager,Si as AutoStartDisabledError,Ht as BUNDLE_IDS,ri as BUNDLE_SCOPE,xi as BUNDLE_SKILL_NAME,Et as BacklinkIndex,Tr as CC1Broadcaster,i as CC1_CONTRACT_VERSION,gr as CONFIG_FILENAME,xt as CONFLICT_MARKER_RE,w as CURSOR_BUNDLE_PATHS_BY_PLATFORM,_i as ConfigSchema,f as DEFAULT_CHECKPOINT_RETENTION,In as DEFAULT_EMBEDDINGS_DIMENSIONS,Di as DEFAULT_PACK_ID,lt as DocumentDurabilityState,Gt as EMBEDDINGS_API_KEY_ENV,Vr as EPHEMERAL_PROJECT_DIR_PREFIX,ni as ExposureConsentError,oi as FEATURED_AGENT_IDS,mn as FILE_SYSTEM_WRITER,ue as FILE_WATCHER_ORIGIN,We as FileEmbeddingsBackend,Wr as GIT_PREFLIGHT_FAIL_SPAN_NAME,Hr as GIT_UPSTREAM_WRITER,N as GitDirAccessError,B as GitNotAvailableError,P as GitTooOldError,en as HOCUSPOCUS_AUTH_REJECTION_REASONS,gi as HocuspocusAuthRejection,nt as HocuspocusAuthTokenSchema,ar as HomeProjectRootError,ge as INSTALLED_AGENTS_SCHEMES,Qr as JSON_SCHEMA_DIALECT_2020_12,t as LINEAGE_EPOCH_KEY,x as LIVE_DERIVED_INDEX_DEBOUNCE_MS,T as LOG_MD_TEMPLATE,Yn as MANAGED_RENAME_ORIGIN,$e as MAX_ACP_THREADS,qe as MAX_AGENT_SESSIONS,si as MCP_CONNECTION_ID_HEADER,l as MCP_SERVER_NAME,wi as MIN_EVICTABLE_IDLE_MS,Ne as MIN_GIT_VERSION,yt as MISSING_OK_CONFIG_MESSAGE,Me as MalformedGitPointerError,fr as McpLogger,J as MissingOkConfigError,ht as OBSERVER_SYNC_ORIGIN,Rr as OK_OKIGNORE_TEMPLATE,$t as ONBOARDING_BUNDLE_IDS,s as ORPHAN_MODES,e as PROTOCOL_VERSION,ta as PinoLogger,ma as ProcessLockCollisionError,cn as ProjectGitInitError,b as ROLLBACK_ORIGIN,an as ROOT_GITIGNORE_TEMPLATE,sa as RUNTIME_VERSION,cr as SERVICE_WRITER,Cn as SKILL_INSTALL_EVENTS_FILE_REL,r as SKILL_STATE_TARGETS,vt as STARTER_FOLDERS,re as STARTER_FOLDER_FRONTMATTER_FILENAME,pt as STARTER_PACKS,Ct as STARTER_PACK_IDS,Q as STARTER_TEMPLATES,M as STATE_MANIFEST_FILENAME,Ca as STATE_SCHEMA_VERSION,a as SYSTEM_DOC_NAME,Rt as SeedPrerequisiteError,Ge as SeedRootDirError,xa as ServerLockCollisionError,sr as SingleFileNotAFileError,kr as SingleFileNotFoundError,Pn as SingleFileNotMarkdownError,je as StateManifestError,jt as TagIndex,hi as USER_GLOBAL_BUNDLE_IDS,Wn as __getShowAllWalkStatsForTesting,Ee as __resetShowAllWalkStatsForTesting,Sa as acquireProcessLock,ga as acquireServerLock,S as applyAgentMarkdownWrite,te as applyExternalChange,Xe as applySeed,Gn as assertCompatibleStateManifest,Kn as assertGitAvailable,v as assertNeverDiskEvent,Mn as assertNotHomeProjectRoot,Zt as attachAcpThreadSocket,ii as attachIdleShutdown,Yt as bootServer,Ue as buildAndOpenSkill,$n as buildConfigYmlContent,Pt as buildExecResult,bi as buildIngressPolicy,O as buildOkMcpStdioCommand,or as buildSkillZip,_e as buildStarterFolderFrontmatterYaml,Ar as buildWipTree,tt as bundleSkillMdPath,m as canonicalProjectKey,Dn as canonicalizeForCompare,Hn as classifyEvents,Hi as classifyFsPath,hn as clearAllEmbeddingsKeys,Lr as clearContributors,Or as coercePackId,u as colorFromSeed,Fn as commitUpstreamImport,Wt as commitWip,mr as commitWipFromTree,_ as compareSemver,st as composeEffectiveLinterConfig,H as composeFrontmatterSchemasConfig,X as containsConflictMarkers,we as contentHash,rn as contributorCount,ie as countShadowObjects,ve as countStaleAgentWipRefs,Ke as countWipRefs,Ae as createApiExtension,Ie as createAssetServeMiddleware,wr as createCollaborationHost,Ye as createContentFilter,Ei as createContentFilterAsync,Ur as createEmbeddingsSecretStore,Ut as createEphemeralProjectDir,dt as createExternalChangeHandler,nr as createFileLogger,mt as createLiveDerivedIndexExtension,kt as createMcpHttpHandler,Dr as createOsProbe,W as createPersistenceExtension,rt as createServer,De as createServerObserverExtension,bt as createStreamingErrorWriter,$i as createTestLogger,lr as describeStoredEmbeddingsKey,$r as detectClaudeDesktopPresence,Vn as detectGit,g as detectProjectShape,p as detectUserSkillHosts,Jt as discoverLockDirs,Jn as discoverMarkdownlintConfig,ur as emitPreflightFailureSpan,Ve as encodeDocName,d as encodeFolderRoute,vn as encodeSkillRoute,yn as ensureProjectGit,Xr as ensureProjectSkillGitignore,Y as errorResponse,ke as evictStaleTrackerEntries,Be as extractHeadings,vr as extractOkBinaryPath,It as extractWikiLinksFromMarkdown,Ce as fallbackPaths,yr as findEnclosingGitRoot,Pe as findEnclosingProjectRoot,y as findNativeMarkdownlintFile,kn as flushFileLogger,j as formatAuthRejectionWire,Qn as formatContributors,Yr as formatContributorsFrom,se as formatPackRationale,Ir as gcCheckpointRefs,Pr as getCurrentMcpLogger,Qt as getIngressContext,ir as getLocalDir,wn as getLogFilePath,ea as getLogger,zt as getLogsDir,aa as getMachineId,qi as getMeter,rr as getMetrics,Mi as getTracer,An as handleCollabSocketError,_t as handleSpawnCursor,mi as hasForwardingHeaders,Ci as hasGcLogLatch,c as iconFromClientName,Tn as incrementCollabSocketFilteredError,Bt as incrementServerObserverFire,dn as initContent,nn as initShadowRepo,Ki as initTelemetry,Ze as initToleranceTelemetryWriter,pn as installJsonSchemaDialect,tr as installPrettyZodErrors,Zi as installTestLoggers,_n as installUserSkill,F as isAllowedApiOrigin,ot as isAllowedWorkspaceHostHeader,le as isConfigDoc,ui as isHocuspocusAuthRejectionReason,Vt as isHomeDir,et as isHostAdmitted,fe as isKnownPackId,At as isLinkIndexExcludedDoc,V as isLoopbackAddress,Tt as isManagedArtifactDoc,k as isOriginAdmitted,n as isOrphanMode,ee as isPairedWriteOrigin,ne as isPathWithinDir,ci as isPeerAdmitted,ia as isProcessAlive,qn as isProjectRoot,Ft as isReservedForUserTree,ze as isSelfWrite,He as isSystemDoc,E as isToleranceTelemetryEnabled,ra as isValidLockPid,K as lastKnownHash,Zn as listRescueCheckpoints,Nt as listStarterPacks,it as loadCustomAgents,Le as loadPrincipal,ya as lockAdvertisesUi,la as lockBaseUrl,ua as lockFilePath,Ji as loggerFactory,Qi as logsCurrentPath,na as logsPreviousPath,jr as makeLazyEmbeddingsKeyStore,pa as markServerLockDraining,pe as mountMcpAndApi,zi as normalizeFsPath,A as originGitHubHost,Sn as packageVersionMajorMinor,ct as parseAuthRejectionWire,Oe as parseGitVersion,U as parseHocuspocusAuthToken,ce as parseKeepaliveConnectionId,oe as pathToDocName,xe as planSeed,pr as prepareSingleFileOpen,Br as processCommand,sn as processUsage,Nr as readAllTargets,Rn as readBundleDecision,Un as readOwnNativeRules,va as readProcessLock,ha as readProcessLockDetailed,$ as readProjectHeadState,Lt as readProjectLocalSemanticConfig,oa as readServerLock,qt as readServerPackageVersion,_r as readSkillInstallStateSnapshot,Bn as readStateManifest,zr as readTargetRecordedAt,on as readTargetVersion,he as reconcile,un as recordContributor,Cr as recordSkillInstallEvent,wt as registerAllTools,be as registerWrite,fa as releaseProcessLock,_a as releaseServerLock,Je as removeLastKnownHash,dr as reportSkillInstall,ei as resetMetrics,Gr as resolveBuiltinSkillHosts,o as resolveBundleEnabled,Nn as resolveBundledSkillDir,jn as resolveContentDir,ft as resolveCursorBinaryDefault,St as resolveCursorSpawnInvocation,I as resolveEffectiveLinterConfig,hr as resolveEmbeddingsCredential,En as resolveLockDir,Fe as resolveNativeConfigForDoc,Te as resolveNativeMarkdownlintConfig,Ot as resolvePack,Xn as resolvePackageVersion,fn as resolveSkillInstallReportSettings,Kr as resolveUiInfo,xn as restoreContributors,di as restoreLifecycleFromConflictsJson,Mt as rewriteMarkdownLinksForDocumentRename,Dt as rewriteWikiLinksForDocumentRename,Mr as runAuthReposSubprocess,Ln as runAuthStatusSubprocess,h as runCloneSubprocess,Kt as runDeviceFlowSubprocess,zn as runWithMcpLogger,de as safeContentPath,q as safeSubdir,Jr as safetyCheckpoint,at as sanitizeClientName,ln as saveInMemoryCheckpoint,bn as saveVersion,L as seedBasenameIndex,Fr as seedEphemeralProjectDir,tn as serializeError,Oi as setActiveSpanAttributes,ut as setupServerObservers,br as shadowGit,Gi as shutdownTelemetry,Yi as spansCurrentPath,Xi as spansPreviousPath,Z as spawnDetached,Er as splitMarkdownBlocks,Ti as startWatcher,me as streamingProblemEvent,xr as swapContributors,ai as teardownToleranceTelemetryWriter,fi as toBroadcasterKey,Ii as tracedAppendFileSync,Vi as tracedLinkSync,Ni as tracedMkdir,Li as tracedMkdirSync,Ui as tracedRename,Pi as tracedRenameSync,Bi as tracedRmSync,Ri as tracedRmdirSync,Fi as tracedUnlinkSync,ji as tracedWriteFile,Wi as tracedWriteFileSync,R as trustSystemCertificates,qr as untrackTrackedProjectSkillProjection,C as updateLastKnownHash,da as updateProcessLockPort,ba as updateServerLockPort,Qe as validateAgentId,gn as validateCloneInputs,On as validateSkillZip,ca as waitForServerLockDrain,Re as withHiddenWindowsConsole,Ai as withSpan,ki as withSpanSync,er as writeBundleDecision,li as writeMarkdownlintRule,Sr as writeRootGitignoreForNewRepo,Se as writeStateManifest,Zr as writeTargetVersion,gt as writeTracker};
|
|
1
|
+
import{Ac as e,Hs as t,Ts as n,U as r,Ws as i,ec as a,q as o,ws as s,x as c,xs as l,y as u}from"./src-tR2kRwXj.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,Ar as y,At as b,B as x,Bi as S,Bn as C,Br as w,Bt as T,C as E,Ca as D,Ci as O,Cn as k,Cr as A,Ct as j,D as M,Da as N,Di as P,Dn as F,Dr as I,Dt as L,E as R,Ea as z,Ei as B,En as V,Er as H,Et as U,F as W,Fi as G,Fn as K,Ft as q,G as J,Gi as Y,Gn as X,Gr as Z,Gt as Q,H as $,Hi as ee,Hn as te,Hr as ne,Ht as re,I as ie,Ii as ae,In as oe,It as se,J as ce,Ji as le,Jn as ue,Jr as de,Jt as fe,K as pe,Ki as me,Kn as he,Kr as ge,Kt as _e,L as ve,Li as ye,Ln as be,Lt as xe,M as Se,Mi as Ce,Mn as we,Mr as Te,Mt as Ee,N as De,Ni as Oe,Nn as ke,Nt as Ae,O as je,Oa as Me,Oi as Ne,On as Pe,Or as Fe,Ot as Ie,P as Le,Pi as Re,Pn as ze,Pt as Be,Q as Ve,Qi as He,Qn as Ue,Qr as We,Qt as Ge,R as Ke,Ri as qe,Rn as Je,Rr as Ye,Rt as Xe,S as Ze,Sa as Qe,Si as $e,Sn as et,Sr as tt,St as nt,T as rt,Ta as it,Ti as at,Tn as ot,Tr as st,Tt as ct,U as lt,Ui as ut,Un as dt,Ur as ft,Ut as pt,V as mt,Vi as ht,Vn as gt,Vr as _t,Vt as vt,W as yt,Wi as bt,Wn as xt,Wr as St,Wt as Ct,X as wt,Xi as Tt,Xn as Et,Xr as Dt,Xt as Ot,Y as kt,Yi as At,Yn as jt,Yr as Mt,Yt as Nt,Z as Pt,Zi as Ft,Zn as It,Zr as Lt,Zt as Rt,_ as zt,_a as Bt,_n as Vt,_r as Ht,a as Ut,aa as Wt,ai as Gt,an as Kt,ar as qt,at as Jt,b as Yt,ba as Xt,bi as Zt,bn as Qt,br as $t,bt as en,c as tn,ca as nn,ci as rn,cn as an,cr as on,ct as sn,d as cn,da as ln,di as un,dn,dr as fn,dt as pn,ea as mn,ei as hn,en as gn,er as _n,et as vn,f as yn,fa as bn,fi as xn,fn as Sn,fr as Cn,g as wn,ga as Tn,gi as En,gn as Dn,gr as On,h as kn,ha as An,hi as jn,hn as Mn,hr as Nn,i as Pn,ia as Fn,ii as In,in as Ln,ir as Rn,it as zn,j as Bn,ji as Vn,jn as Hn,jr as Un,jt as Wn,k as Gn,ki as Kn,kn as qn,kr as Jn,kt as Yn,l as Xn,la as Zn,li as Qn,ln as $n,lr as er,lt as tr,m as nr,ma as rr,mi as ir,mn as ar,mr as or,n as sr,na as cr,ni as lr,nn as ur,nr as dr,nt as fr,o as pr,oa as mr,oi as hr,on as gr,or as _r,ot as vr,p as yr,pa as br,pi as xr,pn as Sr,pr as Cr,q as wr,qi as Tr,qn as Er,qr as Dr,qt as Or,r as kr,ra as Ar,ri as jr,rn as Mr,rr as Nr,rt as Pr,s as Fr,sa as Ir,si as Lr,sn as Rr,sr as zr,st as Br,t as Vr,ta as Hr,ti as Ur,tn as Wr,tr as Gr,tt as Kr,u as qr,ua as Jr,ui as Yr,un as Xr,ur as Zr,ut as Qr,v as $r,va as ei,vi as ti,vn as ni,vr as ri,vt as ii,w as ai,wa as oi,wi as si,wn as ci,wr as li,wt as ui,x as di,xa as fi,xi as pi,xn as mi,xr as hi,xt as gi,y as _i,ya as vi,yi,yn as bi,yr as xi,yt as Si,z as Ci,zi as wi,zn as Ti,zr as Ei,zt as Di}from"./src-DzuFrTJZ.mjs";import{C as Oi,E as ki,T as Ai,_ as ji,b as Mi,c as Ni,d as Pi,g as Fi,i as Ii,l as Li,m as Ri,n as zi,p as Bi,s as Vi,t as Hi,u as Ui,v as Wi,w as Gi,x as Ki,y as qi}from"./fs-traced-2B_-YK-g.mjs";import{a as Ji,d as Yi,f as Xi,i as Zi,l as Qi,n as $i,r as ea,t as ta,u as na}from"./logger-Dq-cRhcP.mjs";import{C as ra,S as ia,_ as aa,a as oa,b as sa,c as ca,d as la,f as ua,g as da,h as fa,i as pa,l as ma,m as ha,n as ga,o as _a,p as va,r as ya,s as ba,t as xa,u as Sa,x as Ca}from"./server-lock-Dngwkd_U.mjs";export{vi as AGENT_ID_MAX_LEN,Xt as AGENT_ID_RE,G as AGENT_WRITE_ORIGIN,z as AcpPermissionStore,D as AcpRegistry,pi as AcpThreadManager,yi as AgentFocusBroadcaster,ti as AgentPresenceBroadcaster,ae as AgentSessionCapacityError,ye as AgentSessionManager,Si as AutoStartDisabledError,Ht as BUNDLE_IDS,ri as BUNDLE_SCOPE,xi as BUNDLE_SKILL_NAME,Et as BacklinkIndex,Tr as CC1Broadcaster,i as CC1_CONTRACT_VERSION,gr as CONFIG_FILENAME,xt as CONFLICT_MARKER_RE,w as CURSOR_BUNDLE_PATHS_BY_PLATFORM,_i as ConfigSchema,f as DEFAULT_CHECKPOINT_RETENTION,In as DEFAULT_EMBEDDINGS_DIMENSIONS,Di as DEFAULT_PACK_ID,lt as DocumentDurabilityState,Gt as EMBEDDINGS_API_KEY_ENV,Vr as EPHEMERAL_PROJECT_DIR_PREFIX,ni as ExposureConsentError,oi as FEATURED_AGENT_IDS,mn as FILE_SYSTEM_WRITER,ue as FILE_WATCHER_ORIGIN,We as FileEmbeddingsBackend,Wr as GIT_PREFLIGHT_FAIL_SPAN_NAME,Hr as GIT_UPSTREAM_WRITER,N as GitDirAccessError,B as GitNotAvailableError,P as GitTooOldError,en as HOCUSPOCUS_AUTH_REJECTION_REASONS,gi as HocuspocusAuthRejection,nt as HocuspocusAuthTokenSchema,ar as HomeProjectRootError,ge as INSTALLED_AGENTS_SCHEMES,Qr as JSON_SCHEMA_DIALECT_2020_12,t as LINEAGE_EPOCH_KEY,x as LIVE_DERIVED_INDEX_DEBOUNCE_MS,T as LOG_MD_TEMPLATE,Yn as MANAGED_RENAME_ORIGIN,$e as MAX_ACP_THREADS,qe as MAX_AGENT_SESSIONS,si as MCP_CONNECTION_ID_HEADER,l as MCP_SERVER_NAME,wi as MIN_EVICTABLE_IDLE_MS,Ne as MIN_GIT_VERSION,yt as MISSING_OK_CONFIG_MESSAGE,Me as MalformedGitPointerError,fr as McpLogger,J as MissingOkConfigError,ht as OBSERVER_SYNC_ORIGIN,Rr as OK_OKIGNORE_TEMPLATE,$t as ONBOARDING_BUNDLE_IDS,s as ORPHAN_MODES,e as PROTOCOL_VERSION,ta as PinoLogger,ma as ProcessLockCollisionError,cn as ProjectGitInitError,b as ROLLBACK_ORIGIN,an as ROOT_GITIGNORE_TEMPLATE,sa as RUNTIME_VERSION,cr as SERVICE_WRITER,Cn as SKILL_INSTALL_EVENTS_FILE_REL,r as SKILL_STATE_TARGETS,vt as STARTER_FOLDERS,re as STARTER_FOLDER_FRONTMATTER_FILENAME,pt as STARTER_PACKS,Ct as STARTER_PACK_IDS,Q as STARTER_TEMPLATES,M as STATE_MANIFEST_FILENAME,Ca as STATE_SCHEMA_VERSION,a as SYSTEM_DOC_NAME,Rt as SeedPrerequisiteError,Ge as SeedRootDirError,xa as ServerLockCollisionError,sr as SingleFileNotAFileError,kr as SingleFileNotFoundError,Pn as SingleFileNotMarkdownError,je as StateManifestError,jt as TagIndex,hi as USER_GLOBAL_BUNDLE_IDS,Wn as __getShowAllWalkStatsForTesting,Ee as __resetShowAllWalkStatsForTesting,Sa as acquireProcessLock,ga as acquireServerLock,S as applyAgentMarkdownWrite,te as applyExternalChange,Xe as applySeed,Gn as assertCompatibleStateManifest,Kn as assertGitAvailable,v as assertNeverDiskEvent,Mn as assertNotHomeProjectRoot,Zt as attachAcpThreadSocket,ii as attachIdleShutdown,Yt as bootServer,Ue as buildAndOpenSkill,$n as buildConfigYmlContent,Pt as buildExecResult,bi as buildIngressPolicy,O as buildOkMcpStdioCommand,or as buildSkillZip,_e as buildStarterFolderFrontmatterYaml,Ar as buildWipTree,tt as bundleSkillMdPath,m as canonicalProjectKey,Dn as canonicalizeForCompare,Hn as classifyEvents,Hi as classifyFsPath,hn as clearAllEmbeddingsKeys,Lr as clearContributors,Or as coercePackId,u as colorFromSeed,Fn as commitUpstreamImport,Wt as commitWip,mr as commitWipFromTree,_ as compareSemver,st as composeEffectiveLinterConfig,H as composeFrontmatterSchemasConfig,X as containsConflictMarkers,we as contentHash,rn as contributorCount,ie as countShadowObjects,ve as countStaleAgentWipRefs,Ke as countWipRefs,Ae as createApiExtension,Ie as createAssetServeMiddleware,wr as createCollaborationHost,Ye as createContentFilter,Ei as createContentFilterAsync,Ur as createEmbeddingsSecretStore,Ut as createEphemeralProjectDir,dt as createExternalChangeHandler,nr as createFileLogger,mt as createLiveDerivedIndexExtension,kt as createMcpHttpHandler,Dr as createOsProbe,W as createPersistenceExtension,rt as createServer,De as createServerObserverExtension,bt as createStreamingErrorWriter,$i as createTestLogger,lr as describeStoredEmbeddingsKey,$r as detectClaudeDesktopPresence,Vn as detectGit,g as detectProjectShape,p as detectUserSkillHosts,Jt as discoverLockDirs,Jn as discoverMarkdownlintConfig,ur as emitPreflightFailureSpan,Ve as encodeDocName,d as encodeFolderRoute,vn as encodeSkillRoute,yn as ensureProjectGit,Xr as ensureProjectSkillGitignore,Y as errorResponse,ke as evictStaleTrackerEntries,Be as extractHeadings,vr as extractOkBinaryPath,It as extractWikiLinksFromMarkdown,Ce as fallbackPaths,yr as findEnclosingGitRoot,Pe as findEnclosingProjectRoot,y as findNativeMarkdownlintFile,kn as flushFileLogger,j as formatAuthRejectionWire,Qn as formatContributors,Yr as formatContributorsFrom,se as formatPackRationale,Ir as gcCheckpointRefs,Pr as getCurrentMcpLogger,Qt as getIngressContext,ir as getLocalDir,wn as getLogFilePath,ea as getLogger,zt as getLogsDir,aa as getMachineId,qi as getMeter,rr as getMetrics,Mi as getTracer,An as handleCollabSocketError,_t as handleSpawnCursor,mi as hasForwardingHeaders,Ci as hasGcLogLatch,c as iconFromClientName,Tn as incrementCollabSocketFilteredError,Bt as incrementServerObserverFire,dn as initContent,nn as initShadowRepo,Ki as initTelemetry,Ze as initToleranceTelemetryWriter,pn as installJsonSchemaDialect,tr as installPrettyZodErrors,Zi as installTestLoggers,_n as installUserSkill,F as isAllowedApiOrigin,ot as isAllowedWorkspaceHostHeader,le as isConfigDoc,ui as isHocuspocusAuthRejectionReason,Vt as isHomeDir,et as isHostAdmitted,fe as isKnownPackId,At as isLinkIndexExcludedDoc,V as isLoopbackAddress,Tt as isManagedArtifactDoc,k as isOriginAdmitted,n as isOrphanMode,ee as isPairedWriteOrigin,ne as isPathWithinDir,ci as isPeerAdmitted,ia as isProcessAlive,qn as isProjectRoot,Ft as isReservedForUserTree,ze as isSelfWrite,He as isSystemDoc,E as isToleranceTelemetryEnabled,ra as isValidLockPid,K as lastKnownHash,Zn as listRescueCheckpoints,Nt as listStarterPacks,it as loadCustomAgents,Le as loadPrincipal,ya as lockAdvertisesUi,la as lockBaseUrl,ua as lockFilePath,Ji as loggerFactory,Qi as logsCurrentPath,na as logsPreviousPath,jr as makeLazyEmbeddingsKeyStore,pa as markServerLockDraining,pe as mountMcpAndApi,zi as normalizeFsPath,A as originGitHubHost,Sn as packageVersionMajorMinor,ct as parseAuthRejectionWire,Oe as parseGitVersion,U as parseHocuspocusAuthToken,ce as parseKeepaliveConnectionId,oe as pathToDocName,xe as planSeed,pr as prepareSingleFileOpen,Br as processCommand,sn as processUsage,Nr as readAllTargets,Rn as readBundleDecision,Un as readOwnNativeRules,va as readProcessLock,ha as readProcessLockDetailed,$ as readProjectHeadState,Lt as readProjectLocalSemanticConfig,oa as readServerLock,qt as readServerPackageVersion,_r as readSkillInstallStateSnapshot,Bn as readStateManifest,zr as readTargetRecordedAt,on as readTargetVersion,he as reconcile,un as recordContributor,Cr as recordSkillInstallEvent,wt as registerAllTools,be as registerWrite,fa as releaseProcessLock,_a as releaseServerLock,Je as removeLastKnownHash,dr as reportSkillInstall,ei as resetMetrics,Gr as resolveBuiltinSkillHosts,o as resolveBundleEnabled,Nn as resolveBundledSkillDir,jn as resolveContentDir,ft as resolveCursorBinaryDefault,St as resolveCursorSpawnInvocation,I as resolveEffectiveLinterConfig,hr as resolveEmbeddingsCredential,En as resolveLockDir,Fe as resolveNativeConfigForDoc,Te as resolveNativeMarkdownlintConfig,Ot as resolvePack,Xn as resolvePackageVersion,fn as resolveSkillInstallReportSettings,Kr as resolveUiInfo,xn as restoreContributors,di as restoreLifecycleFromConflictsJson,Mt as rewriteMarkdownLinksForDocumentRename,Dt as rewriteWikiLinksForDocumentRename,Mr as runAuthReposSubprocess,Ln as runAuthStatusSubprocess,h as runCloneSubprocess,Kt as runDeviceFlowSubprocess,zn as runWithMcpLogger,de as safeContentPath,q as safeSubdir,Jr as safetyCheckpoint,at as sanitizeClientName,ln as saveInMemoryCheckpoint,bn as saveVersion,L as seedBasenameIndex,Fr as seedEphemeralProjectDir,tn as serializeError,Oi as setActiveSpanAttributes,ut as setupServerObservers,br as shadowGit,Gi as shutdownTelemetry,Yi as spansCurrentPath,Xi as spansPreviousPath,Z as spawnDetached,Er as splitMarkdownBlocks,Ti as startWatcher,me as streamingProblemEvent,xr as swapContributors,ai as teardownToleranceTelemetryWriter,fi as toBroadcasterKey,Ii as tracedAppendFileSync,Vi as tracedLinkSync,Ni as tracedMkdir,Li as tracedMkdirSync,Ui as tracedRename,Pi as tracedRenameSync,Bi as tracedRmSync,Ri as tracedRmdirSync,Fi as tracedUnlinkSync,ji as tracedWriteFile,Wi as tracedWriteFileSync,R as trustSystemCertificates,qr as untrackTrackedProjectSkillProjection,C as updateLastKnownHash,da as updateProcessLockPort,ba as updateServerLockPort,Qe as validateAgentId,gn as validateCloneInputs,On as validateSkillZip,ca as waitForServerLockDrain,Re as withHiddenWindowsConsole,Ai as withSpan,ki as withSpanSync,er as writeBundleDecision,li as writeMarkdownlintRule,Sr as writeRootGitignoreForNewRepo,Se as writeStateManifest,Zr as writeTargetVersion,gt as writeTracker};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sleep-DhRrtbfG.mjs";import{Dc as i,Ec as a,Mc as o,bo as s,ct as c,jc as l,lt as u}from"./src-tR2kRwXj.mjs";import{On as ee,Pi as d,at as f,ct as p,gi as m,ot as h,st as te}from"./src-
|
|
1
|
+
import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sleep-DhRrtbfG.mjs";import{Dc as i,Ec as a,Mc as o,bo as s,ct as c,jc as l,lt as u}from"./src-tR2kRwXj.mjs";import{On as ee,Pi as d,at as f,ct as p,gi as m,ot as h,st as te}from"./src-DzuFrTJZ.mjs";import{D as g,F as _,I as v,k as y}from"./fs-traced-2B_-YK-g.mjs";import{C as b,S as x,_ as S,f as C,r as w}from"./server-lock-Dngwkd_U.mjs";import{t as T}from"./yazl-DZr4PyKA.mjs";import{h as E,m as ne,x as re}from"./resolve-project-root-C74NWxWO.mjs";import{c as D}from"./colors-DSyAT9Cz.mjs";import{a as O,i as ie}from"./acp-harness-probe-oUvOUBDG.mjs";import{D as k,E as A,S as ae,T as j,_ as oe,b as se,o as ce}from"./init-Bok8w4bD.mjs";import{n as le}from"./constants-DeTywrcI.mjs";import{t as M}from"./is-object-Bw0-z8qH.mjs";import"./loader-DsUw5zIN.mjs";import"./skill-teardown-Byb0Eg2k.mjs";import"./preview-BHw-SgP2.mjs";import{execSync as ue,spawnSync as de}from"node:child_process";import{basename as N,dirname as P,join as F,relative as fe,resolve as I,sep as pe}from"node:path";import{cpSync as me,createWriteStream as he,existsSync as L,lstatSync as ge,mkdirSync as R,mkdtempSync as _e,readFileSync as z,readdirSync as B,readlinkSync as ve,rmSync as ye,statSync as be,writeFileSync as V}from"node:fs";import{arch as xe,freemem as Se,homedir as H,hostname as Ce,platform as we,release as Te,tmpdir as Ee,totalmem as De,type as Oe,uptime as ke}from"node:os";import"node:fs/promises";import{createHash as Ae}from"node:crypto";var je=n();const Me=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Ne(e,t,n=ee){if(e!==void 0&&!Me.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Pe=null;function Fe(e){Pe=e}function Ie(){return Pe??process.cwd()}function U(){return F(H(),`.ok`,`bug-reports`)}function Le(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=U(),r=`${t}-bugreport`,i=F(n,`${r}.zip`);for(let e=2;L(i);e+=1)i=F(n,`${r}-${e}.zip`);return i}function Re(e,t){let n=F(e,`.ok`,`config.yml`);if(L(n))try{let e=z(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return L(F(e,`.ok`))?Ae(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function ze(){let e={timestamp:new Date().toISOString(),platform:we(),osType:Oe(),osRelease:Te(),hostname:`[redacted]`,uptime:ke(),freeMem:Se(),totalMem:De(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ue(`sw_vers -productVersion 2>/dev/null`,d({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}const Be=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function Ve(e){let t=N(e);return Be.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function He(e,t){return Ke(e,t).files}const Ue=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function We(e,t=O){let n=F(e,`${t}.ShipIt`);return L(n)?Ue.map(e=>F(n,e)).filter(e=>L(e)):[]}function Ge(e){if(!L(e))return[];try{let t=new Map;for(let n of B(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-l.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>F(e,t))}catch{return[]}}function Ke(e,t){if(!L(t))return{files:[],excludedByProjectSlug:0};let n=B(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(Ve),i=[],a=r.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!Ve(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function qe(e){let t=F(e,`.ok`,`local`);return L(t)?{files:[`server.lock`,`last-spawn-error.log`,c].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Je(e){let t=F(e,`.ok`,`local`,`logs`);return L(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>F(t,e)).filter(e=>L(e))}:{files:[]}}function Ye(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=i(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function W(e){for(let t of e.files)try{Ye({zipfile:e.zipfile,name:`${e.prefix}/${N(t)}`,content:z(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Xe(t){let{redact:n,outputPath:r,logger:i}=t,s=t.userLogsDir??F(H(),`.ok`,`logs`),c=t.projectDir?Re(t.projectDir,i):null;R(P(r),{recursive:!0}),i?.info({projectSlug:c},`gathering diagnostic data`);let l=ze();l.desktop=t.desktop??null,l.language=t.language??null;let{files:u,excludedByProjectSlug:ee}=Ke(c,s),{files:d}=t.projectDir?qe(t.projectDir):{files:[]},{files:f}=t.projectDir?Je(t.projectDir):{files:[]},p=t.shipItLogFiles??[];i?.info({logFileCount:u.length,logFilesExcludedByProjectSlug:ee,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length},`files collected`);let m=[],h=[],{ZipFile:te}=await import(`./yazl-jVENrf5i.mjs`).then(t=>e(t.default,1)),g=new te;W({zipfile:g,files:[...u,...p],prefix:`logs`,redact:n,bundleFiles:h,redactions:m,logger:i}),W({zipfile:g,files:d,prefix:`lockdir`,redact:n,bundleFiles:h,redactions:m,logger:i}),W({zipfile:g,files:f,prefix:`local-logs`,redact:n,bundleFiles:h,redactions:m,logger:i}),W({zipfile:g,files:t.bugReportLedgerFiles??[],prefix:o,redact:n,bundleFiles:h,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;g.addBuffer(t,n),h.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Ye({zipfile:g,name:`note.txt`,content:t.note,redact:n,bundleFiles:h,redactions:m});let _=JSON.stringify(l,null,2);g.addBuffer(Buffer.from(_,`utf8`),`sysinfo.json`),h.push(`sysinfo.json`);let v={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:c,files:h,redactions:m,sysinfo:l};g.addBuffer(Buffer.from(JSON.stringify(v,null,2),`utf8`),`MANIFEST.json`);let y=m.reduce((e,t)=>e+t.lineCount,0),b=new Set(p.map(e=>`logs/${N(e)}`)),x=h.filter(e=>b.has(e)),S=new Set((t.bugReportLedgerFiles??[]).map(e=>`${o}/${N(e)}`)),C=h.filter(e=>S.has(e)),w=c?h.filter(e=>e.startsWith(`logs/`)&&!Ve(e)&&!b.has(e)):[],T=[`# Bug Report Bundle`,``,`Generated: ${v.generatedAt}`,`Project: ${c??`(unscoped)`}`,`Discipline version: ${v.disciplineVersion}`,``,`## Contents`,``,...h.map(e=>`- ${e}`),``,`## Privacy`,``,...w.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...w.map(e=>`- ${e}`),``]:[],...x.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...x.map(e=>`- ${e}`),``]:[],...C.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...C.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,y>0?`${y} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
|
|
2
2
|
`);g.addBuffer(Buffer.from(T,`utf8`),`README.md`),g.end();let E=he(r);return g.outputStream.pipe(E),await new Promise((e,t)=>{E.on(`close`,e),E.on(`error`,t)}),i?.info({bundlePath:r,fileCount:h.length,redactionCount:y},`bundle written`),{zipPath:r,summary:{projectSlug:c,files:h,redactions:m,redactedLineCount:y,generatedAt:v.generatedAt}}}var Ze=e(T(),1),G=e(D(),1);function Qe(e){return v({absPath:y(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function $e({home:e=H(),env:n=process.env}={}){let i=Qe(e),{override:a,preferenceList:o}=g(n),{locale:c,source:l}=s({override:a,storedPreference:i,supportedLocales:r,preferenceList:o,autoDetectableLocales:t});return{preference:i,locale:c,source:l,systemLanguages:o}}function et(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function tt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e,t){if(typeof e==`string`)return et(e,t.contentDir);if(Array.isArray(e))return e.map(e=>K(e,t));if(!tt(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=K(i,t);return n}function nt(e,t){let n=z(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
3
3
|
`),i=n.split(`
|
|
4
4
|
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=K(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}V(e,r?`${a.join(`
|
|
@@ -17,4 +17,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,pt as n,q as r}from"./sle
|
|
|
17
17
|
`).replace(/\n/g,`\r
|
|
18
18
|
`));let u=`${i?``:``}${l}`;return u!==r&&_(e,u,{mode:j(e)}),{kind:`removed`}}function gn(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function _n(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return`—`;let r=t-n,i=Math.floor(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function vn(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`)return null;let i=t.lock,a=t.status===`alive`&&w(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:h(n),command:n,isDesktop:gn(n)}}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:`stale`}const yn=new Set([`running`,`desktop`,`foreign`]);function bn(e){switch(e){case`running`:return G.default.green(e);case`desktop`:return G.default.blue(e);case`foreign`:return G.default.cyan(e);case`stale`:return G.default.yellow(e)}}function xn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function Sn(e){return`${xn(e.server.usage)} | ${xn(e.ui?.usage??null)}`}function Cn(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function wn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory,Cn(e),Sn(e),Q(e),String(e.server.pid),_n(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=bn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=G.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
19
19
|
`)}async function Tn(e={}){let t=e.discover??f,n=e.inspect??X,r=e.log??(e=>console.log(e)),i=e.resolveCommand??te,a=e.resolveUsage??p,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=vn(e,t,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(wn(e.all?s:s.filter(e=>yn.has(Q(e)))))}function En(){return new re(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale (dead-pid) entries (foreign-host shows by default)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await Tn({all:t.all===!0||e===`all`,json:t.json===!0})})}function Dn(e,t,n={}){let r=n.isAlive??x,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function On(e){let t=e.inspect??(t=>t===`ui`?Z(e.lockDir):X(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=Dn(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function $(e,t){return e.status===`alive`?!0:e.status===`foreign-host`?t(e.lock.pid):!1}async function kn(e,t=x){let n=await f(),r=null;for(let i of n){let n=X(i,`server`),a=Z(i);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function An(e){let t=On({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function jn(e){return new re(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the current directory. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).action(async t=>{let n=t.length===0?void 0:t.join(` `);if(n===void 0){e();let t=On({lockDir:m(process.cwd()),log:()=>{}});if(t.hadTargets){if(t.stopped.length>0){let e=t.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}t.failed.length>0&&(process.exitCode=1)}else await Tn({});return}if(n===`all`){let e=await f();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=X(n,`server`),r=Z(n);!$(e,x)&&!$(r,x)||(An(n),t++)}t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(n)){let e=Number.parseInt(n,10),t=await kn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}An(t);return}An(m(I(Ie(),n)))})}export{U as _,rn as a,Ne as b,sn as c,Z as d,X as f,Le as g,Xt as h,fn as i,cn as l,Yt as m,jn as n,ln as o,$t as p,En as r,an as s,On as t,nn as u,Ie as v,Fe as y};
|
|
20
|
-
//# sourceMappingURL=src-
|
|
20
|
+
//# sourceMappingURL=src-DKob1_qE.mjs.map
|