@inkeep/open-knowledge 0.43.0-beta.6 → 0.43.0-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/{acp-harness-probe-lMMnSjqP.mjs → acp-harness-probe-DdhO9SQn.mjs} +2 -2
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/assets/skills/write-skill/SKILL.md +1 -1
  5. package/dist/cli.mjs +7 -7
  6. package/dist/constants-R-RUm7LH.mjs +2 -0
  7. package/dist/{git-handle-B0U6AD0P.mjs → git-handle-BV2RttjK.mjs} +2 -2
  8. package/dist/git-handle-BeQ4qN_k.mjs +1 -0
  9. package/dist/index.mjs +1 -1
  10. package/dist/{init-CirugI37.mjs → init-CSRKqDJN.mjs} +3 -3
  11. package/dist/init-SNyPXFWd.mjs +1 -0
  12. package/dist/{launch-json-removal-BZnOXYQ-.mjs → launch-json-removal-CfcsWacd.mjs} +2 -2
  13. package/dist/{loader-C3d0s2-M.mjs → loader-C7FbZaEP.mjs} +2 -2
  14. package/dist/loader-DaB_SHaP.mjs +1 -0
  15. package/dist/md-manager-msnOgYR9.mjs +2 -0
  16. package/dist/{open-browser-BrU96UMi.mjs → open-browser-DDNybrns.mjs} +2 -2
  17. package/dist/parse-worker.mjs +1 -1
  18. package/dist/{preview-BL2u7TEI.mjs → preview-1A9kSGGE.mjs} +2 -2
  19. package/dist/preview-CuzKQov6.mjs +1 -0
  20. package/dist/public/assets/{ActivityModeContent-CZvf7vaT.js → ActivityModeContent-D3C8O_w3.js} +1 -1
  21. package/dist/public/assets/{AgentDiffPane-srNk6utW.js → AgentDiffPane-BvGju1xE.js} +1 -1
  22. package/dist/public/assets/{AgentThreadClientBinder-B_xu_F7T.js → AgentThreadClientBinder-D4H_PDYc.js} +1 -1
  23. package/dist/public/assets/{CodeMirrorPropInput-BkZa8s6u.js → CodeMirrorPropInput-Bl20D0Uk.js} +1 -1
  24. package/dist/public/assets/{DocumentContext-_HmmdzDY.js → DocumentContext-Cdr74ISn.js} +1 -1
  25. package/dist/public/assets/{EditorModeToggle-CYYxR5D6.js → EditorModeToggle-BY6AO_qz.js} +1 -1
  26. package/dist/public/assets/{EnableSyncConfirmDialog-70LUF0BM.js → EnableSyncConfirmDialog-DJMo-qwB.js} +1 -1
  27. package/dist/public/assets/FeedbackForm-Crm9lLX8.js +1 -0
  28. package/dist/public/assets/{GraphPanel-Cpyav3kr.js → GraphPanel-DIO6yakG.js} +1 -1
  29. package/dist/public/assets/{LintConfigEditor-C235lTrG.js → LintConfigEditor-OxVpPRfH.js} +1 -1
  30. package/dist/public/assets/{ManagedArtifactProperties-xdcG7g6i.js → ManagedArtifactProperties-CLs0zXAe.js} +1 -1
  31. package/dist/public/assets/{McpConsentDialogBody-CBP-q0Ps.js → McpConsentDialogBody-CxXXnPDt.js} +1 -1
  32. package/dist/public/assets/{MermaidDocEditor-CBlxkKRh.js → MermaidDocEditor-DmtJmVIV.js} +1 -1
  33. package/dist/public/assets/{PropertyPanel-CyKA9aT3.js → PropertyPanel-DTkAfxY9.js} +1 -1
  34. package/dist/public/assets/{ReportBugDialogBody-BNPoUjQC.js → ReportBugDialogBody-CJmBcRe1.js} +1 -1
  35. package/dist/public/assets/{SchemaConfigEditor-SNtb0-ip.js → SchemaConfigEditor-DTWsipcT.js} +1 -1
  36. package/dist/public/assets/{SettingsDialogBody-BUm5bI4O.js → SettingsDialogBody--7DDTRea.js} +1 -1
  37. package/dist/public/assets/{ShareBranchSwitchDialog-DAdfkMmL.js → ShareBranchSwitchDialog-CHf9euSj.js} +1 -1
  38. package/dist/public/assets/{ShareReceiveDialog-D6W2uERu.js → ShareReceiveDialog-Bhm4sgyN.js} +1 -1
  39. package/dist/public/assets/{ShareReceiveMissDialog-y0j89UFf.js → ShareReceiveMissDialog-C5vtlW7T.js} +1 -1
  40. package/dist/public/assets/{SkillEditorActions-CEwn16Tc.js → SkillEditorActions-WbSFB2E8.js} +1 -1
  41. package/dist/public/assets/{SourceEditor-gJWLMSB0.js → SourceEditor-Bd7F9NS2.js} +1 -1
  42. package/dist/public/assets/{TerminalPanel-B1gBGZxV.js → TerminalPanel-DP8U0P5Y.js} +1 -1
  43. package/dist/public/assets/{TerminalSessionsHost-DzxIw4MP.js → TerminalSessionsHost-CiWsf0Az.js} +2 -2
  44. package/dist/public/assets/{TerminalWindowApp-BHIljFR0.js → TerminalWindowApp-CV4iSFXK.js} +1 -1
  45. package/dist/public/assets/{ThreadView-B-R_hzDk.js → ThreadView-NVvE5q8i.js} +1 -1
  46. package/dist/public/assets/{TimelineDiffPane-Be0SpZDg.js → TimelineDiffPane-CaXJq5G3.js} +1 -1
  47. package/dist/public/assets/{agent-diff-store-L0QRqFhx.js → agent-diff-store-5rFvn02h.js} +1 -1
  48. package/dist/public/assets/{agent-visibility-CL_tNGWg.js → agent-visibility-Dnk83DYS.js} +1 -1
  49. package/dist/public/assets/{auth-state-cache-l1Vfn_MK.js → auth-state-cache-D7ajc9Qr.js} +1 -1
  50. package/dist/public/assets/client-version-DxYAebBl.js +1 -0
  51. package/dist/public/assets/{config-provider-CwPQy5rX.js → config-provider-CPaxPgT-.js} +1 -1
  52. package/dist/public/assets/{dist-CuWeCBEf.js → dist-Buo04VFd.js} +1 -1
  53. package/dist/public/assets/{doc-hash-BVKebTVG.js → doc-hash-SvezN6Rq.js} +1 -1
  54. package/dist/public/assets/{documents-events-B5wmrm16.js → documents-events-dEUha72t.js} +1 -1
  55. package/dist/public/assets/{file-tree-adapter-yYBioQs5.js → file-tree-adapter-iop4fdHa.js} +1 -1
  56. package/dist/public/assets/{file-tree-utils-DfqWA_5n.js → file-tree-utils-CFhkdQEq.js} +1 -1
  57. package/dist/public/assets/{globals-DwTVKVQU.css → globals-B1VH9dVh.css} +1 -1
  58. package/dist/public/assets/{index-hiHNx_VS.js → index-fFZmLpuY.js} +7 -7
  59. package/dist/public/assets/{lint-config-client-5R8jfpMC.js → lint-config-client-CxiCF4DX.js} +1 -1
  60. package/dist/public/assets/{markdownlint-rule-browser-B10BhLO-.js → markdownlint-rule-browser-C38r_8F1.js} +1 -1
  61. package/dist/public/assets/{navigation-targets-CHJwvlLn.js → navigation-targets-BRUFNxdH.js} +1 -1
  62. package/dist/public/assets/{open-managed-artifact-tab-DU2wriss.js → open-managed-artifact-tab--dyTqqlT.js} +1 -1
  63. package/dist/public/assets/{pending-receive-nav-store-vEz7n7hI.js → pending-receive-nav-store-BglLdOwd.js} +1 -1
  64. package/dist/public/assets/{prop-types-BKQrBeTE.js → prop-types-DOS9ukZA.js} +1 -1
  65. package/dist/public/assets/{receive-store-Cai4Ylv2.js → receive-store-C9LkmGjP.js} +1 -1
  66. package/dist/public/assets/{selection-context-BfNuCyz7.js → selection-context-BlON5dXS.js} +1 -1
  67. package/dist/public/assets/{skill-actions-CqHp5fhi.js → skill-actions-DVtgKFDb.js} +1 -1
  68. package/dist/public/assets/{skills-api-CakWD1yl.js → skills-api-OnwTD-gx.js} +1 -1
  69. package/dist/public/assets/{src-CzOcS7Os.js → src-Bla2VWV9.js} +1 -1
  70. package/dist/public/assets/{tag-pill-input-DrBsmU2V.js → tag-pill-input-C71zF3_V.js} +1 -1
  71. package/dist/public/assets/{target-navigation-intent-BvA7kyRG.js → target-navigation-intent-Ckw_zIOm.js} +1 -1
  72. package/dist/public/assets/{telemetry-impl-Bl_U4MrE.js → telemetry-impl-llHFvtad.js} +1 -1
  73. package/dist/public/assets/{telemetry-startup-DXlGUC0d.js → telemetry-startup-Ce8-_9qU.js} +1 -1
  74. package/dist/public/assets/{terminal-launch-events-C02gKY4p.js → terminal-launch-events-BCvN0vmT.js} +1 -1
  75. package/dist/public/assets/{terminal-telemetry-WPPXmVH6.js → terminal-telemetry-aybtUvXL.js} +1 -1
  76. package/dist/public/assets/{typing-burst-detector-BGhFSaCK.js → typing-burst-detector-B0tlkeuP.js} +1 -1
  77. package/dist/public/assets/{uninstall-CjMD-IxK.js → uninstall-ClvMa9lt.js} +1 -1
  78. package/dist/public/assets/{use-activity-panel-DoDwyzOZ.js → use-activity-panel-BCV49rp2.js} +1 -1
  79. package/dist/public/assets/{use-apply-config-color-theme-0KmFjCFT.js → use-apply-config-color-theme-2eJGLg4E.js} +1 -1
  80. package/dist/public/assets/{use-collab-url-DQjlkOUP.js → use-collab-url-CMrtW1hJ.js} +1 -1
  81. package/dist/public/assets/{use-live-xterm-theme-CM3UGTWm.js → use-live-xterm-theme-XwgkaK_f.js} +1 -1
  82. package/dist/public/assets/{use-settings-route-0Taj5Wwx.js → use-settings-route-7y0-KX-u.js} +1 -1
  83. package/dist/public/assets/{use-terminal-enabled-BTOXFzup.js → use-terminal-enabled-DEK3ggum.js} +1 -1
  84. package/dist/public/assets/{use-timeline-entry-diff-DFXSuMB3.js → use-timeline-entry-diff-DyYICR11.js} +1 -1
  85. package/dist/public/assets/{use-workspace-D2do84a0.js → use-workspace-DzRZ3d5B.js} +1 -1
  86. package/dist/public/assets/{workspace-paths-hoX5L8bW.js → workspace-paths-DgaXFkO5.js} +1 -1
  87. package/dist/public/index.html +37 -37
  88. package/dist/public/uninstall.html +4 -4
  89. package/dist/{repair-launch-json-DR9LNeHq.mjs → repair-launch-json-CoyH_Fg4.mjs} +2 -2
  90. package/dist/{repair-mcp-configs-D-W0Trir.mjs → repair-mcp-configs-C3AcKIaG.mjs} +2 -2
  91. package/dist/repair-skills-BbxNdXSs.mjs +1 -0
  92. package/dist/{repair-skills-D8zfBuEH.mjs → repair-skills-DoTJZ9g0.mjs} +2 -2
  93. package/dist/{server-lock-Dvu9Crm-.mjs → server-lock-C4qH3g-P.mjs} +2 -2
  94. package/dist/server-lock-CACUewto.mjs +1 -0
  95. package/dist/{src-DTzbBBWG.mjs → src-7dzK48Dw.mjs} +2 -2
  96. package/dist/{src-B-HV6HNi.mjs → src-Bl6FSa1U.mjs} +1 -1
  97. package/dist/{src-CMWx7wd8.mjs → src-CepmZgB5.mjs} +4 -4
  98. package/dist/{src-DRjy7jah.mjs → src-D5f9ThMD.mjs} +2 -2
  99. package/dist/start-DnI6DsO5.mjs +1 -0
  100. package/dist/{start-BmMsXVx3.mjs → start-m_7Q1P4t.mjs} +3 -3
  101. package/dist/{write-project-skill--6mgOtCu.mjs → write-project-skill-C7z5m6Zc.mjs} +2 -2
  102. package/package.json +4 -4
  103. package/dist/constants-DI_gr5ih.mjs +0 -2
  104. package/dist/git-handle-CAmPAeqb.mjs +0 -1
  105. package/dist/init-CxiSUQf2.mjs +0 -1
  106. package/dist/loader-BbtvxjVj.mjs +0 -1
  107. package/dist/md-manager-CSd1MWq_.mjs +0 -2
  108. package/dist/preview-CPdu4CHM.mjs +0 -1
  109. package/dist/public/assets/FeedbackForm-Dpnyx8Bz.js +0 -1
  110. package/dist/public/assets/client-version-D6r-zu-F.js +0 -1
  111. package/dist/repair-skills-Z6x_KZdO.mjs +0 -1
  112. package/dist/server-lock-PrjHr5-L.mjs +0 -1
  113. package/dist/start-Ca3be5dp.mjs +0 -1
  114. /package/dist/public/assets/{globals-BrJQliEr.js → globals-CdwCpkXl.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{d as e,l as t,v as n}from"./write-project-skill--6mgOtCu.mjs";import{d as r,v as i}from"./init-CirugI37.mjs";import{t as a}from"./mcp-migrate-event-CWx0WLdE.mjs";import{homedir as o}from"node:os";function s(n){let r=n.logger??u,i=n.home??o(),a=[];if(n.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=e[o],s=c(()=>t.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),t.projectConfigPath){let e=t.projectConfigPath,i=c(()=>e(n.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:t,home:void 0,cwd:n.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(e){let t={scope:e.scope,editorId:e.editorId,configPath:e.configPath},o=r(e.target,e.cwd,e.home,e.configPathOverride);if(o===null)return{...t,outcome:`no-entry`};if(n(o))return{...t,outcome:`canonical`};e.logger(a({scope:e.scope,surface:`cli-repair`,editorId:e.editorId,configPath:e.configPath,priorEntry:o}));let s=i(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let n=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:n}),{...t,outcome:`write-failed`,error:n}}return s.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:s.declineReason}),{...t,outcome:`declined`}):{...t,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
- //# sourceMappingURL=repair-mcp-configs-D-W0Trir.mjs.map
1
+ import{d as e,l as t,v as n}from"./write-project-skill-C7z5m6Zc.mjs";import{d as r,v as i}from"./init-CSRKqDJN.mjs";import{t as a}from"./mcp-migrate-event-CWx0WLdE.mjs";import{homedir as o}from"node:os";function s(n){let r=n.logger??u,i=n.home??o(),a=[];if(n.reclaimDisableEnv===`1`)return r({event:`mcp-config-repair-skipped`,reason:`reclaim-disabled`}),{outcomes:a,repairedCount:0};for(let o of t){let t=e[o],s=c(()=>t.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:t,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),t.projectConfigPath){let e=t.projectConfigPath,i=c(()=>e(n.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:t,home:void 0,cwd:n.projectDir,configPath:i,configPathOverride:i,logger:r}))}}return{outcomes:a,repairedCount:a.filter(e=>e.outcome===`repaired`).length}}function c(e){try{return e()}catch{return null}}function l(e){let t={scope:e.scope,editorId:e.editorId,configPath:e.configPath},o=r(e.target,e.cwd,e.home,e.configPathOverride);if(o===null)return{...t,outcome:`no-entry`};if(n(o))return{...t,outcome:`canonical`};e.logger(a({scope:e.scope,surface:`cli-repair`,editorId:e.editorId,configPath:e.configPath,priorEntry:o}));let s=i(e.target,e.cwd,{mode:`published`,skipAvailabilityCheck:!0},e.home,e.configPathOverride);if(s.action===`failed`){let n=s.error??`unknown write failure`;return e.logger({event:`mcp-config-repair-write-failed`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,error:n}),{...t,outcome:`write-failed`,error:n}}return s.action===`declined`?(e.logger({event:`mcp-config-repair-declined`,scope:e.scope,editorId:e.editorId,configPath:e.configPath,reason:s.declineReason}),{...t,outcome:`declined`}):{...t,outcome:`repaired`}}function u(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{s as repairMcpConfigs};
2
+ //# sourceMappingURL=repair-mcp-configs-C3AcKIaG.mjs.map
@@ -0,0 +1 @@
1
+ import{t as e}from"./repair-skills-DoTJZ9g0.mjs";export{e as repairSkills};
@@ -1,4 +1,4 @@
1
- import{C as e}from"./src-DRjy7jah.mjs";import{ar as t,cr as n,er as r,hr as i,ir as a,mr as o,or as s,tr as c,ur as l}from"./src-CMWx7wd8.mjs";import{C as u,a as d,d as f,f as p,o as m,s as h,t as g}from"./write-project-skill--6mgOtCu.mjs";import{n as _,s as v,t as y}from"./colors-BsmVIwfM.mjs";import{dirname as b,join as x,relative as S,resolve as C}from"node:path";import{existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,rmSync as O,statSync as k,writeFileSync as A}from"node:fs";import{homedir as j}from"node:os";import{createInterface as M}from"node:readline/promises";const N={existsSync:e=>w(e),isDirectory:e=>{try{return k(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>D(e),readFileSync:e=>E(e),writeFileSync:(e,t)=>{A(e,t)},mkdirSync:(e,t)=>{T(e,t)},rmSync:(e,t)=>{O(e,t)}},P={resolveProjectBundledSkillDir:()=>l(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>l(e,{checkDesktop:!1}),readBundledVersion:()=>c(),readRecordedVersion:e=>a(e,`cli-hosts`),writeRecordedVersion:(e,t)=>s(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>n(e),readBundleDecision:(e,t)=>r(e,t),writeBundleDecision:(e,n,r)=>t(e,n,r),removeBundleFromDisk:(e,t)=>h(e,t)};function F(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function I(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(b(t),{recursive:!0}),L(e,t,n)}function L(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=x(e,r),a=x(t,r);n.isDirectory(i)?L(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function R(e,t,n,r,i,a){let o=[],s=x(e,`.agents`,`skills`,t),c=r.existsSync(s),l=!1;try{I(n,s,r),l=!0,o.push({kind:`central`,path:s,outcome:c?`overwritten`:`written`}),i({event:`user-skill-reclaim-central-written`,scope:`user`,path:s,preexisting:c,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`central`,path:s,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-central-failed`,scope:`user`,path:s,error:t})}for(let c of p){let l=x(e,c.hostDir),u=x(l,`skills`,t);if(u===s){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!r.existsSync(l)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-host-absent`});continue}let d=r.existsSync(u);try{I(n,u,r),o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:d?`overwritten`:`written`}),i({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,preexisting:d,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,error:t})}}return{entries:o,centralWritten:l}}function z(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function B(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of p){let o=x(e,t.hostDir,`skills`,`open-knowledge`),s=x(o,`SKILL.md`),c=n.existsSync(s),l=f[t.editorId]?.projectConfigPath?.(e),u=!c&&z(l,n);if(!c&&!u){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{g(o,e),I(i,o,n);let s=c?`reclaimed`:`created`;a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:s}),r({event:c?`project-skill-reclaim-reclaimed`:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function V(t,n,r,a){let s=e=>{n.recordEvent(e).catch(()=>{})},c=()=>new Date().toISOString(),l;try{l=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return a({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let u;try{u=await n.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),u=null}let d=[],f=null;for(let e of i)try{d.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(d.length===0)return a({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let i of d){let s=o[i.id],c=r.existsSync(x(t,`.agents`,`skills`,s)),l=await n.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{n.removeBundleFromDisk(t,i.id),a({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:i.id})}catch(e){a({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:i.id,error:e instanceof Error?e.message:String(e)})}continue}if(l===null&&c)try{await n.writeBundleDecision(t,s,!0)}catch(e){a({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:i.id,error:e instanceof Error?e.message:String(e)})}p.push(i)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>r.existsSync(x(t,`.agents`,`skills`,o[e.id])));if(u!==null&&u===l&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:l}),{outcome:`skipped`,reason:`version-current`};let h=[],g=d.length===i.length,_=!0;for(let{id:e,sourceDir:n}of p){let i=R(t,o[e],n,r,a,l);h.push(...i.entries),i.centralWritten||(_=!1)}let v=h.some(e=>e.kind===`central`&&(e.outcome===`written`||e.outcome===`overwritten`));if(g&&_&&v){let e=null;try{await n.writeRecordedVersion(t,l),a({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:l})}catch(t){e=t instanceof Error?t.message:String(t),a({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:l,error:e})}for(let{id:t}of p)s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?`installed`:`failed`,version:l,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{let e=h.some(e=>e.kind===`host`&&e.outcome===`failed`);s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:l,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:l,entries:h}}async function H(e){let t=e.logger??F,n=e.fs??N,r=e.home??j(),i={...P,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=B(e.projectDir,i,n,t),o=await V(r,i,n,t),s=m(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=d(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 U(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 W(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===`reclaimed`).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;t.push(` Project: ${n} reclaimed, ${r} created, ${i} no-token, ${a} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} 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{C as e}from"./src-D5f9ThMD.mjs";import{ar as t,cr as n,er as r,hr as i,ir as a,mr as o,or as s,tr as c,ur as l}from"./src-CepmZgB5.mjs";import{C as u,a as d,d as f,f as p,o as m,s as h,t as g}from"./write-project-skill-C7z5m6Zc.mjs";import{n as _,s as v,t as y}from"./colors-BsmVIwfM.mjs";import{dirname as b,join as x,relative as S,resolve as C}from"node:path";import{existsSync as w,mkdirSync as T,readFileSync as E,readdirSync as D,rmSync as O,statSync as k,writeFileSync as A}from"node:fs";import{homedir as j}from"node:os";import{createInterface as M}from"node:readline/promises";const N={existsSync:e=>w(e),isDirectory:e=>{try{return k(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>D(e),readFileSync:e=>E(e),writeFileSync:(e,t)=>{A(e,t)},mkdirSync:(e,t)=>{T(e,t)},rmSync:(e,t)=>{O(e,t)}},P={resolveProjectBundledSkillDir:()=>l(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>l(e,{checkDesktop:!1}),readBundledVersion:()=>c(),readRecordedVersion:e=>a(e,`cli-hosts`),writeRecordedVersion:(e,t)=>s(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>n(e),readBundleDecision:(e,t)=>r(e,t),writeBundleDecision:(e,n,r)=>t(e,n,r),removeBundleFromDisk:(e,t)=>h(e,t)};function F(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function I(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(b(t),{recursive:!0}),L(e,t,n)}function L(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=x(e,r),a=x(t,r);n.isDirectory(i)?L(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function R(e,t,n,r,i,a){let o=[],s=x(e,`.agents`,`skills`,t),c=r.existsSync(s),l=!1;try{I(n,s,r),l=!0,o.push({kind:`central`,path:s,outcome:c?`overwritten`:`written`}),i({event:`user-skill-reclaim-central-written`,scope:`user`,path:s,preexisting:c,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`central`,path:s,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-central-failed`,scope:`user`,path:s,error:t})}for(let c of p){let l=x(e,c.hostDir),u=x(l,`skills`,t);if(u===s){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!r.existsSync(l)){o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`skipped-host-absent`});continue}let d=r.existsSync(u);try{I(n,u,r),o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:d?`overwritten`:`written`}),i({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,preexisting:d,version:a})}catch(e){let t=e instanceof Error?e.message:String(e);o.push({kind:`host`,editorId:c.editorId,hostDir:c.hostDir,path:u,outcome:`failed`,error:t}),i({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:c.editorId,hostDir:c.hostDir,path:u,error:t})}}return{entries:o,centralWritten:l}}function z(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function B(e,t,n,r){let i;try{i=t.resolveProjectBundledSkillDir()}catch(e){return r({event:`project-skill-reclaim-bundle-missing`,scope:`project`,error:e instanceof Error?e.message:String(e)}),{outcome:`skipped`,reason:`bundle-missing`}}let a=[];for(let t of p){let o=x(e,t.hostDir,`skills`,`open-knowledge`),s=x(o,`SKILL.md`),c=n.existsSync(s),l=f[t.editorId]?.projectConfigPath?.(e),u=!c&&z(l,n);if(!c&&!u){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`no-token`}),r({event:`project-skill-reclaim-no-token`,scope:`project`,editorId:t.editorId,path:o});continue}try{g(o,e),I(i,o,n);let s=c?`reclaimed`:`created`;a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:s}),r({event:c?`project-skill-reclaim-reclaimed`:`project-skill-reclaim-created`,scope:`project`,editorId:t.editorId,path:o})}catch(e){let n=e instanceof Error?e.message:String(e);a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`failed`,error:n}),r({event:`project-skill-reclaim-failed`,scope:`project`,editorId:t.editorId,path:o,error:n})}}return{outcome:`done`,entries:a}}async function V(t,n,r,a){let s=e=>{n.recordEvent(e).catch(()=>{})},c=()=>new Date().toISOString(),l;try{l=await n.readBundledVersion()}catch(e){let t=e instanceof Error?e.message:String(e);return a({event:`user-skill-reclaim-version-read-failed`,scope:`user`,error:t}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let u;try{u=await n.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),u=null}let d=[],f=null;for(let e of i)try{d.push({id:e,sourceDir:n.resolveUserBundledSkillDir(e)})}catch(e){f=e instanceof Error?e.message:String(e)}if(d.length===0)return a({event:`user-skill-reclaim-bundle-missing`,scope:`user`,error:f??`no user-global bundles`}),s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let i of d){let s=o[i.id],c=r.existsSync(x(t,`.agents`,`skills`,s)),l=await n.readBundleDecision(t,s).catch(()=>null);if(!e(l,{installedOnDisk:c})){if(c)try{n.removeBundleFromDisk(t,i.id),a({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:i.id})}catch(e){a({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:i.id,error:e instanceof Error?e.message:String(e)})}continue}if(l===null&&c)try{await n.writeBundleDecision(t,s,!0)}catch(e){a({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:i.id,error:e instanceof Error?e.message:String(e)})}p.push(i)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>r.existsSync(x(t,`.agents`,`skills`,o[e.id])));if(u!==null&&u===l&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:l}),{outcome:`skipped`,reason:`version-current`};let h=[],g=d.length===i.length,_=!0;for(let{id:e,sourceDir:n}of p){let i=R(t,o[e],n,r,a,l);h.push(...i.entries),i.centralWritten||(_=!1)}let v=h.some(e=>e.kind===`central`&&(e.outcome===`written`||e.outcome===`overwritten`));if(g&&_&&v){let e=null;try{await n.writeRecordedVersion(t,l),a({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:l})}catch(t){e=t instanceof Error?t.message:String(t),a({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:l,error:e})}for(let{id:t}of p)s({ts:c(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?`installed`:`failed`,version:l,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{let e=h.some(e=>e.kind===`host`&&e.outcome===`failed`);s({ts:c(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:l,reason:e?`all-writes-failed`:`no-hosts-installed`})}return{outcome:`done`,version:l,entries:h}}async function H(e){let t=e.logger??F,n=e.fs??N,r=e.home??j(),i={...P,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=B(e.projectDir,i,n,t),o=await V(r,i,n,t),s=m(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=d(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 U(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 W(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===`reclaimed`).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;t.push(` Project: ${n} reclaimed, ${r} created, ${i} no-token, ${a} failed.`)}else t.push(` Project: skipped (${e.project.reason}).`);if(e.user.outcome===`done`){let n=e.user.entries.filter(e=>e.outcome===`written`||e.outcome===`overwritten`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,i=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} skipped, ${i} 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 G(){return new u(`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 H({projectDir:C(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null,confirmLegacyCleanup:t=>K(t,{yes:e.yes===!0})});process.stdout.write(`${W(t)}\n`),process.exitCode=U(t)})}async function K(e,t){let n=j(),r=e=>`~/${S(n,e)}`,i=t.input??process.stdin,a=[``,y(`A previous version of OpenKnowledge installed its skill into agent tools you may never have used.`),_(`(Versions before 0.42 wrote to every host a third-party installer knew about — see issue #820.)`)];if(e.skillDirs.length>0&&a.push(``,`${y(`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(``,`${y(t)} ${e.emptyDirs.length}`,...e.emptyDirs.map(e=>` ${r(e)}`))}if(a.push(``,_(`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(`${v("Not a terminal — skipping cleanup. Re-run with `ok repair-skills --yes` to remove these.")}\n`),!1;let o=M({input:i,output:process.stdout});try{let e=(await o.question(`\n${y(`Remove them?`)} ${_(`[y/N] `)}`)).trim().toLowerCase();return e===`y`||e===`yes`}finally{o.close()}}export{G as n,H as t};
4
- //# sourceMappingURL=repair-skills-D8zfBuEH.mjs.map
4
+ //# sourceMappingURL=repair-skills-DoTJZ9g0.mjs.map
@@ -1,2 +1,2 @@
1
- import"./src-DRjy7jah.mjs";import{r as e}from"./logger-B7Z8XO-z.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s,readFileSync as c,unlinkSync as l,writeFileSync as u,writeSync as d}from"node:fs";import{homedir as f,hostname as p}from"node:os";import{fileURLToPath as m}from"node:url";import{randomUUID as h}from"node:crypto";function g(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function _(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function v(e){return new URL(e.url??``,`http://localhost`).searchParams}function y(e){let t=e?.code;return typeof t==`string`?t:void 0}const b=/^[A-Za-z0-9-]{8,64}$/;let x=null;function S(e){return n(e??f(),`.ok`,`machine-id`)}function C(n){if(n===void 0&&x!==null)return x;let r=S(n),i=null;try{let e=c(r,`utf-8`).trim();b.test(e)&&(i=e)}catch{}if(i===null){i=h();try{o(t(r),{recursive:!0}),u(r,`${i}\n`,{encoding:`utf-8`,mode:384})}catch(t){e(`machine-id`).warn({path:r,err:t},`Failed to persist ${r} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${t instanceof Error?t.message:String(t)}`)}}return n===void 0&&(x=i),i}function w(){try{let e=r(t(m(import.meta.url)),`..`,`package.json`),n=JSON.parse(c(e,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}const T=w(),E=1,D=e(`process-lock`);var O=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function k(e,t){return r(e,`${t}.lock`)}const A=new Map;function j(e){A.set(e,(A.get(e)??0)+1)}function M(e){let t=A.get(e);return t===void 0||t<=1?(A.delete(e),!0):(A.set(e,t-1),!1)}function N(e){return typeof e.machineId==`string`?e.machineId===C():e.hostname===p()}const P=new Set;let F=!1;function I(e){P.add(e),!F&&(F=!0,process.on(`exit`,()=>{for(let e of P)try{let t=JSON.parse(c(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==C()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==p())continue;l(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(c(e,`utf-8`));return n&&typeof n==`object`&&_(n.pid)?n:(D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null}}function R(e){let{lockName:t,lockDir:n,metadata:r}=e,c=`[${t}-lock]`;o(n,{recursive:!0});let f=k(n,t),m={pid:process.pid,hostname:p(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:C(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??T},h=JSON.stringify(m,null,2);for(let e=0;e<3;e++){if(!a(f))try{let e=s(f,`wx`,384);try{d(e,h)}finally{i(e)}return j(f),I(f),z({lockName:t,lockDir:n,lockPath:f})}catch(e){if(y(e)!==`EEXIST`)throw e}let e=L(f,c);if(e){if(N(e)&&e.pid===process.pid)return u(f,h,{encoding:`utf-8`,mode:384}),j(f),I(f),z({lockName:t,lockDir:n,lockPath:f});if(g(e.pid))throw new O(e,f,t);D.warn({pid:e.pid,host:e.hostname},`${c} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{l(f)}catch{}}throw Error(`${c} Failed to acquire ${f} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>G({lockName:t,lockDir:n}),updatePort:e=>B({lockName:t,lockDir:n,port:e})}}function B(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,o=k(n,t);if(!a(o)){D.warn({lockPath:o},`${i} Lock file missing at ${o} during port update — skipping`);return}let s;try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:o},`${i} Corrupt lock at ${o} during port update — skipping`);return}s=e}catch{D.warn({lockPath:o},`${i} Unreadable lock at ${o} during port update — skipping`);return}if(s.pid===process.pid&&N(s)){s.port=r;try{u(o,JSON.stringify(s,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function V(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=k(n,t);if((A.get(i)??0)>1)return;let a;try{let e=JSON.parse(c(i,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:i},`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){y(e)!==`ENOENT`&&D.warn({lockPath:i,err:e},`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&N(a)&&a.draining!==!0){a.draining=!0;try{u(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:i,err:e},`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function H(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return null;let i;try{let e=JSON.parse(c(r,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid))return null;i=e}catch{return null}if(!N(i))return null;if(!g(i.pid)){try{l(r)}catch{}return null}return i}function U(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return{status:`absent`};let i;try{i=JSON.parse(c(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o=i;if(!_(o.pid)||typeof o.hostname!=`string`||typeof o.port!=`number`||typeof o.startedAt!=`string`||typeof o.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:o.pid,hostname:o.hostname,port:o.port,startedAt:o.startedAt,worktreeRoot:o.worktreeRoot,machineId:typeof o.machineId==`string`?o.machineId:void 0,draining:o.draining===!0?!0:void 0,protocolVersion:typeof o.protocolVersion==`number`?o.protocolVersion:void 0,runtimeVersion:typeof o.runtimeVersion==`string`?o.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{l(r)}catch{}return{status:`stale`,lock:s}}return s.protocolVersion===void 0||s.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:s}}async function W(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>H({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function G(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,o=k(n,t);if(M(o)){if(r){V({lockName:t,lockDir:n});return}if(a(o))try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;l(o),P.delete(o)}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to release ${o}: ${e instanceof Error?e.message:String(e)}`)}}}var K=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function q(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new K(e.existing,e.lockPath):e}}function J(e,t){B({lockName:`server`,lockDir:e,port:t})}function Y(e){return H({lockName:`server`,lockDir:e})}function X(e,t){G({lockName:`server`,lockDir:e,...t})}function Z(e){V({lockName:`server`,lockDir:e})}function Q(e,t){return W({lockName:`server`,lockDir:e,...t})}export{_ as S,E as _,X as a,v as b,O as c,V as d,H as f,T as g,B as h,Y as i,R as l,G as m,q as n,J as o,U as p,Z as r,Q as s,K as t,k as u,C as v,g as x,y};
2
- //# sourceMappingURL=server-lock-Dvu9Crm-.mjs.map
1
+ import"./src-D5f9ThMD.mjs";import{r as e}from"./logger-B7Z8XO-z.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s,readFileSync as c,unlinkSync as l,writeFileSync as u,writeSync as d}from"node:fs";import{homedir as f,hostname as p}from"node:os";import{fileURLToPath as m}from"node:url";import{randomUUID as h}from"node:crypto";function g(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function _(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function v(e){return new URL(e.url??``,`http://localhost`).searchParams}function y(e){let t=e?.code;return typeof t==`string`?t:void 0}const b=/^[A-Za-z0-9-]{8,64}$/;let x=null;function S(e){return n(e??f(),`.ok`,`machine-id`)}function C(n){if(n===void 0&&x!==null)return x;let r=S(n),i=null;try{let e=c(r,`utf-8`).trim();b.test(e)&&(i=e)}catch{}if(i===null){i=h();try{o(t(r),{recursive:!0}),u(r,`${i}\n`,{encoding:`utf-8`,mode:384})}catch(t){e(`machine-id`).warn({path:r,err:t},`Failed to persist ${r} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${t instanceof Error?t.message:String(t)}`)}}return n===void 0&&(x=i),i}function w(){try{let e=r(t(m(import.meta.url)),`..`,`package.json`),n=JSON.parse(c(e,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}const T=w(),E=1,D=e(`process-lock`);var O=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`OpenKnowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function k(e,t){return r(e,`${t}.lock`)}const A=new Map;function j(e){A.set(e,(A.get(e)??0)+1)}function M(e){let t=A.get(e);return t===void 0||t<=1?(A.delete(e),!0):(A.set(e,t-1),!1)}function N(e){return typeof e.machineId==`string`?e.machineId===C():e.hostname===p()}const P=new Set;let F=!1;function I(e){P.add(e),!F&&(F=!0,process.on(`exit`,()=>{for(let e of P)try{let t=JSON.parse(c(e,`utf-8`));if(t?.pid!==process.pid||typeof t.machineId==`string`&&t.machineId!==C()||t.machineId===void 0&&typeof t.hostname==`string`&&t.hostname!==p())continue;l(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(c(e,`utf-8`));return n&&typeof n==`object`&&_(n.pid)?n:(D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return D.warn({lockPath:e},`${t} Corrupt lock file at ${e} — replacing`),null}}function R(e){let{lockName:t,lockDir:n,metadata:r}=e,c=`[${t}-lock]`;o(n,{recursive:!0});let f=k(n,t),m={pid:process.pid,hostname:p(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,machineId:C(),...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??T},h=JSON.stringify(m,null,2);for(let e=0;e<3;e++){if(!a(f))try{let e=s(f,`wx`,384);try{d(e,h)}finally{i(e)}return j(f),I(f),z({lockName:t,lockDir:n,lockPath:f})}catch(e){if(y(e)!==`EEXIST`)throw e}let e=L(f,c);if(e){if(N(e)&&e.pid===process.pid)return u(f,h,{encoding:`utf-8`,mode:384}),j(f),I(f),z({lockName:t,lockDir:n,lockPath:f});if(g(e.pid))throw new O(e,f,t);D.warn({pid:e.pid,host:e.hostname},`${c} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{l(f)}catch{}}throw Error(`${c} Failed to acquire ${f} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>G({lockName:t,lockDir:n}),updatePort:e=>B({lockName:t,lockDir:n,port:e})}}function B(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,o=k(n,t);if(!a(o)){D.warn({lockPath:o},`${i} Lock file missing at ${o} during port update — skipping`);return}let s;try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:o},`${i} Corrupt lock at ${o} during port update — skipping`);return}s=e}catch{D.warn({lockPath:o},`${i} Unreadable lock at ${o} during port update — skipping`);return}if(s.pid===process.pid&&N(s)){s.port=r;try{u(o,JSON.stringify(s,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to update port in ${o}: ${e instanceof Error?e.message:String(e)}`)}}}function V(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=k(n,t);if((A.get(i)??0)>1)return;let a;try{let e=JSON.parse(c(i,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:i},`${r} Corrupt lock at ${i} during draining mark — skipping`);return}a=e}catch(e){y(e)!==`ENOENT`&&D.warn({lockPath:i,err:e},`${r} Unreadable lock at ${i} during draining mark — skipping: ${e instanceof Error?e.message:String(e)}`);return}if(a.pid===process.pid&&N(a)&&a.draining!==!0){a.draining=!0;try{u(i,JSON.stringify(a,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:i,err:e},`${r} Failed to mark ${i} draining: ${e instanceof Error?e.message:String(e)}`)}}}function H(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return null;let i;try{let e=JSON.parse(c(r,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid))return null;i=e}catch{return null}if(!N(i))return null;if(!g(i.pid)){try{l(r)}catch{}return null}return i}function U(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!a(r))return{status:`absent`};let i;try{i=JSON.parse(c(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o=i;if(!_(o.pid)||typeof o.hostname!=`string`||typeof o.port!=`number`||typeof o.startedAt!=`string`||typeof o.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:o.pid,hostname:o.hostname,port:o.port,startedAt:o.startedAt,worktreeRoot:o.worktreeRoot,machineId:typeof o.machineId==`string`?o.machineId:void 0,draining:o.draining===!0?!0:void 0,protocolVersion:typeof o.protocolVersion==`number`?o.protocolVersion:void 0,runtimeVersion:typeof o.runtimeVersion==`string`?o.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{l(r)}catch{}return{status:`stale`,lock:s}}return s.protocolVersion===void 0||s.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:s}}async function W(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>H({lockName:t,lockDir:n})),o=e.sleep??(e=>new Promise(t=>setTimeout(t,e))),s=a();if(s===null||s.draining!==!0)return`no-drain`;let c=Date.now()+r;for(;Date.now()<c;){await o(i);let e=a();if(e===null)return`released`;if(e.draining!==!0)return`no-drain`}return`timeout`}function G(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,o=k(n,t);if(M(o)){if(r){V({lockName:t,lockDir:n});return}if(a(o))try{let e=JSON.parse(c(o,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;l(o),P.delete(o)}catch(e){D.warn({lockPath:o,err:e},`${i} Failed to release ${o}: ${e instanceof Error?e.message:String(e)}`)}}}var K=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function q(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new K(e.existing,e.lockPath):e}}function J(e,t){B({lockName:`server`,lockDir:e,port:t})}function Y(e){return H({lockName:`server`,lockDir:e})}function X(e,t){G({lockName:`server`,lockDir:e,...t})}function Z(e){V({lockName:`server`,lockDir:e})}function Q(e,t){return W({lockName:`server`,lockDir:e,...t})}export{_ as S,E as _,X as a,v as b,O as c,V as d,H as f,T as g,B as h,Y as i,R as l,G as m,q as n,J as o,U as p,Z as r,Q as s,K as t,k as u,C as v,g as x,y};
2
+ //# sourceMappingURL=server-lock-C4qH3g-P.mjs.map
@@ -0,0 +1 @@
1
+ import{a as e,o as t,r as n}from"./server-lock-C4qH3g-P.mjs";export{n as markServerLockDraining,e as releaseServerLock,t as updateServerLockPort};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-DTipWd-i.mjs";import{F as t,I as n,vo as r,yo as i,za as a}from"./src-DRjy7jah.mjs";import{Sa as o,Wr as s,at as c,it as l,ot as u,rt as d,ui as f,un as p}from"./src-CMWx7wd8.mjs";import{K as m}from"./sleep-DDnWCWup.mjs";import{O as h,P as g}from"./fs-traced-DDm-belY.mjs";import{S as _,u as v,v as y,x as b}from"./server-lock-Dvu9Crm-.mjs";import{t as x}from"./yazl-BafwB467.mjs";import{C as S,d as C,i as w,v as T,y as ee}from"./write-project-skill--6mgOtCu.mjs";import{c as te}from"./colors-BsmVIwfM.mjs";import"./acp-harness-probe-lMMnSjqP.mjs";import{D as E,E as D,S as ne,T as O,_ as k,b as re,o as ie,v as A}from"./init-CirugI37.mjs";import{n as ae}from"./constants-DI_gr5ih.mjs";import{t as j}from"./is-object-ByG7RnjH.mjs";import"./loader-C3d0s2-M.mjs";import"./preview-BL2u7TEI.mjs";import{execSync as oe,spawnSync as M}from"node:child_process";import{basename as N,dirname as P,isAbsolute as se,join as F,relative as ce,resolve as I,sep as le}from"node:path";import{cpSync as ue,createWriteStream as de,existsSync as L,lstatSync as fe,mkdirSync as R,mkdtempSync as pe,readFileSync as z,readdirSync as me,readlinkSync as he,rmSync as ge,statSync as _e,writeFileSync as B}from"node:fs";import{arch as ve,freemem as ye,homedir as be,hostname as xe,platform as Se,release as Ce,tmpdir as we,totalmem as Te,type as Ee,uptime as De}from"node:os";import{realpath as V}from"node:fs/promises";import{createHash as Oe}from"node:crypto";var H=m();const ke=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Ae(e,t,n=p){if(e!==void 0&&!ke.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let je=null;function Me(e){je=e}function Ne(){return je??process.cwd()}function Pe(){return F(be(),`.ok`,`bug-reports`)}function Fe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Pe(),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 Ie(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`))?Oe(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function Le(){let e={timestamp:new Date().toISOString(),platform:Se(),osType:Ee(),osRelease:Ce(),hostname:`[redacted]`,uptime:De(),freeMem:ye(),totalMem:Te(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=oe(`sw_vers -productVersion 2>/dev/null`,s({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}function Re(e,t){return ze(e,t).files}function ze(e,t){if(!L(t))return{files:[]};let n=me(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(e&&n.length>0){let t=n.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return!0}});t.length>0&&(n=t)}return{files:n}}function Be(e){let n=F(e,`.ok`,`local`);return L(n)?{files:[`server.lock`,`last-spawn-error.log`,t].map(e=>F(n,e)).filter(e=>L(e))}:{files:[]}}function Ve(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 He(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 U(e){for(let t of e.files)try{He({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 Ue(t){let{redact:n,outputPath:i,logger:a}=t,o=t.userLogsDir??F(be(),`.ok`,`logs`),s=t.projectDir?Ie(t.projectDir,a):null;R(P(i),{recursive:!0}),a?.info({projectSlug:s},`gathering diagnostic data`);let c=Le();c.desktop=t.desktop??null;let{files:l}=ze(s,o),{files:u}=t.projectDir?Be(t.projectDir):{files:[]},{files:d}=t.projectDir?Ve(t.projectDir):{files:[]};a?.info({logFileCount:l.length,lockFileCount:u.length,localSinkFileCount:d.length},`files collected`);let f=[],p=[],{ZipFile:m}=await import(`./yazl-vwTkB7U0.mjs`).then(t=>e(t.default,1)),h=new m;U({zipfile:h,files:l,prefix:`logs`,redact:n,bundleFiles:p,redactions:f,logger:a}),U({zipfile:h,files:u,prefix:`lockdir`,redact:n,bundleFiles:p,redactions:f,logger:a}),U({zipfile:h,files:d,prefix:`local-logs`,redact:n,bundleFiles:p,redactions:f,logger:a});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;h.addBuffer(t,n),p.push(n)}catch(t){a?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&He({zipfile:h,name:`note.txt`,content:t.note,redact:n,bundleFiles:p,redactions:f});let g=JSON.stringify(c,null,2);h.addBuffer(Buffer.from(g,`utf8`),`sysinfo.json`),p.push(`sysinfo.json`);let _={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:p,redactions:f,sysinfo:c};h.addBuffer(Buffer.from(JSON.stringify(_,null,2),`utf8`),`MANIFEST.json`);let v=f.reduce((e,t)=>e+t.lineCount,0),y=[`# Bug Report Bundle`,``,`Generated: ${_.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${_.disciplineVersion}`,``,`## Contents`,``,...p.map(e=>`- ${e}`),``,`## Privacy`,``,...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${r.join(`, `)}`,v>0?`${v} line(s) were scrubbed across ${f.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(`
1
+ import{o as e}from"./chunk-DTipWd-i.mjs";import{F as t,I as n,vo as r,yo as i,za as a}from"./src-D5f9ThMD.mjs";import{Sa as o,Wr as s,at as c,it as l,ot as u,rt as d,ui as f,un as p}from"./src-CepmZgB5.mjs";import{K as m}from"./sleep-DDnWCWup.mjs";import{O as h,P as g}from"./fs-traced-DDm-belY.mjs";import{S as _,u as v,v as y,x as b}from"./server-lock-C4qH3g-P.mjs";import{t as x}from"./yazl-BafwB467.mjs";import{C as S,d as C,i as w,v as T,y as ee}from"./write-project-skill-C7z5m6Zc.mjs";import{c as te}from"./colors-BsmVIwfM.mjs";import"./acp-harness-probe-DdhO9SQn.mjs";import{D as E,E as D,S as ne,T as O,_ as k,b as re,o as ie,v as A}from"./init-CSRKqDJN.mjs";import{n as ae}from"./constants-R-RUm7LH.mjs";import{t as j}from"./is-object-ByG7RnjH.mjs";import"./loader-C7FbZaEP.mjs";import"./preview-1A9kSGGE.mjs";import{execSync as oe,spawnSync as M}from"node:child_process";import{basename as N,dirname as P,isAbsolute as se,join as F,relative as ce,resolve as I,sep as le}from"node:path";import{cpSync as ue,createWriteStream as de,existsSync as L,lstatSync as fe,mkdirSync as R,mkdtempSync as pe,readFileSync as z,readdirSync as me,readlinkSync as he,rmSync as ge,statSync as _e,writeFileSync as B}from"node:fs";import{arch as ve,freemem as ye,homedir as be,hostname as xe,platform as Se,release as Ce,tmpdir as we,totalmem as Te,type as Ee,uptime as De}from"node:os";import{realpath as V}from"node:fs/promises";import{createHash as Oe}from"node:crypto";var H=m();const ke=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Ae(e,t,n=p){if(e!==void 0&&!ke.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let je=null;function Me(e){je=e}function Ne(){return je??process.cwd()}function Pe(){return F(be(),`.ok`,`bug-reports`)}function Fe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Pe(),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 Ie(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`))?Oe(`sha256`).update(I(e)).digest(`hex`).slice(0,12):null}function Le(){let e={timestamp:new Date().toISOString(),platform:Se(),osType:Ee(),osRelease:Ce(),hostname:`[redacted]`,uptime:De(),freeMem:ye(),totalMem:Te(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=oe(`sw_vers -productVersion 2>/dev/null`,s({encoding:`utf8`})).trim()}catch{}try{let t=F(__dirname,`..`,`..`,`package.json`);L(t)&&(e.okVersion=JSON.parse(z(t,`utf8`)).version)}catch{}return e}function Re(e,t){return ze(e,t).files}function ze(e,t){if(!L(t))return{files:[]};let n=me(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>F(t,e));if(e&&n.length>0){let t=n.filter(t=>{try{return z(t,`utf8`).includes(`"project":"${e}"`)}catch{return!0}});t.length>0&&(n=t)}return{files:n}}function Be(e){let n=F(e,`.ok`,`local`);return L(n)?{files:[`server.lock`,`last-spawn-error.log`,t].map(e=>F(n,e)).filter(e=>L(e))}:{files:[]}}function Ve(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 He(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 U(e){for(let t of e.files)try{He({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 Ue(t){let{redact:n,outputPath:i,logger:a}=t,o=t.userLogsDir??F(be(),`.ok`,`logs`),s=t.projectDir?Ie(t.projectDir,a):null;R(P(i),{recursive:!0}),a?.info({projectSlug:s},`gathering diagnostic data`);let c=Le();c.desktop=t.desktop??null;let{files:l}=ze(s,o),{files:u}=t.projectDir?Be(t.projectDir):{files:[]},{files:d}=t.projectDir?Ve(t.projectDir):{files:[]};a?.info({logFileCount:l.length,lockFileCount:u.length,localSinkFileCount:d.length},`files collected`);let f=[],p=[],{ZipFile:m}=await import(`./yazl-vwTkB7U0.mjs`).then(t=>e(t.default,1)),h=new m;U({zipfile:h,files:l,prefix:`logs`,redact:n,bundleFiles:p,redactions:f,logger:a}),U({zipfile:h,files:u,prefix:`lockdir`,redact:n,bundleFiles:p,redactions:f,logger:a}),U({zipfile:h,files:d,prefix:`local-logs`,redact:n,bundleFiles:p,redactions:f,logger:a});for(let e of t.extraFiles??[])try{let t=z(e.sourcePath),n=`extra/${e.zipName??N(e.sourcePath)}`;h.addBuffer(t,n),p.push(n)}catch(t){a?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&He({zipfile:h,name:`note.txt`,content:t.note,redact:n,bundleFiles:p,redactions:f});let g=JSON.stringify(c,null,2);h.addBuffer(Buffer.from(g,`utf8`),`sysinfo.json`),p.push(`sysinfo.json`);let _={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:p,redactions:f,sysinfo:c};h.addBuffer(Buffer.from(JSON.stringify(_,null,2),`utf8`),`MANIFEST.json`);let v=f.reduce((e,t)=>e+t.lineCount,0),y=[`# Bug Report Bundle`,``,`Generated: ${_.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${_.disciplineVersion}`,``,`## Contents`,``,...p.map(e=>`- ${e}`),``,`## Privacy`,``,...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${r.join(`, `)}`,v>0?`${v} line(s) were scrubbed across ${f.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
  `);h.addBuffer(Buffer.from(y,`utf8`),`README.md`),h.end();let b=de(i);return h.outputStream.pipe(b),await new Promise((e,t)=>{b.on(`close`,e),b.on(`error`,t)}),a?.info({bundlePath:i,fileCount:p.length,redactionCount:v},`bundle written`),{zipPath:i,summary:{projectSlug:s,files:p,redactions:f,redactedLineCount:v,generatedAt:_.generatedAt}}}var We=e(x(),1),W=e(te(),1);function G(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ge(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e,t){if(typeof e==`string`)return G(e,t.contentDir);if(Array.isArray(e))return e.map(e=>K(e,t));if(!Ge(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=K(i,t);return n}function Ke(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)}}}B(e,r?`${a.join(`
@@ -17,4 +17,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{F as t,I as n,vo as r,yo as i,za
17
17
  `).replace(/\n/g,`\r
18
18
  `));let u=`${i?``:``}${l}`;return u!==r&&g(e,u,{mode:O(e)}),{kind:`removed`}}function ln(e){return e==null?!1:e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function un(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 dn(e,t,n,r,i,a){if(t.status===`missing`||t.status===`corrupt`)return null;let o=t.lock,s=null;if(n.status!==`missing`&&n.status!==`corrupt`){let e=n.lock;s={port:e.port,status:n.status,pid:e.pid,startedAt:e.startedAt,usage:a}}return{directory:o.worktreeRoot,server:{port:o.port,status:t.status,pid:o.pid,startedAt:o.startedAt,usage:i},ui:s,hostname:o.hostname,lockPath:t.lockPath,binary:r==null?null:l(r),command:r,isDesktop:ln(r)}}function fn(e){return e.ui==null?!1:e.ui.status===`alive`||e.ui.status===`foreign-host`}function Q(e){let t=e.server.status;return t===`alive`||t===`foreign-host`?e.isDesktop?`desktop`:t===`alive`?`running`:`foreign`:t===`dead-pid`&&fn(e)?`ui-orphan`:`stale`}const pn=new Set([`running`,`desktop`,`foreign`,`ui-orphan`]);function mn(e){switch(e){case`running`:return W.default.green(e);case`desktop`:return W.default.blue(e);case`foreign`:return W.default.cyan(e);case`ui-orphan`:return W.default.magenta(e);case`stale`:return W.default.yellow(e)}}function hn(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function gn(e){return`${hn(e.server.usage)} | ${hn(e.ui?.usage??null)}`}function _n(e){return`${e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null||e.ui.status===`dead-pid`?`—`:String(e.ui.port)}`}function vn(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>{let t=Q(e),n=t===`ui-orphan`&&e.ui!=null?e.ui.pid:e.server.pid;return[e.directory,_n(e),gn(e),t,String(n),un(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=mn(Q(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=W.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
19
19
  `)}async function yn(e={}){let t=e.discover??d,n=e.inspect??Z,r=e.log??(e=>console.log(e)),i=e.resolveCommand??c,a=e.resolveUsage??u,o=await t(),s=[];for(let e of o){let t=n(e,`server`),r=n(e,`ui`),o=dn(e,t,r,t.status===`missing`||t.status===`corrupt`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`?null:a(t.lock.pid),r.status===`missing`||r.status===`corrupt`?null:a(r.lock.pid));o!=null&&s.push(o)}if(e.json){let e=s.map(e=>({...e,displayStatus:Q(e)}));r(JSON.stringify(e,null,2));return}r(vn(e.all?s:s.filter(e=>pn.has(Q(e)))))}function bn(){return new S(`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 yn({all:t.all===!0||e===`all`,json:t.json===!0})})}function xn(e,t,n={}){let r=n.isAlive??b,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 Sn(e){let t=e.inspect??(t=>Z(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=xn(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 Cn(e,t=b){let n=await d(),r=null;for(let i of n){let n=Z(i,`server`),a=Z(i,`ui`);if($(n,t)&&n.lock.port===e||$(a,t)&&a.lock.port===e)return i;r===null&&($(n,t)&&n.lock.pid===e||$(a,t)&&a.lock.pid===e)&&(r=i)}return r}function wn(e){let t=Sn({lockDir:e});return t.failed.length>0&&(process.exitCode=1),t}function Tn(e){return new S(`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=Sn({lockDir:f(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 yn({});return}if(n===`all`){let e=await d();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e){let e=Z(n,`server`),r=Z(n,`ui`);!$(e,b)&&!$(r,b)||(wn(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 Cn(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}wn(t);return}wn(f(I(Ne(),n)))})}function En(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}async function Dn(e,t){let n,r;try{n=await V(I(e)),r=await V(I(P(e)))}catch{return{kind:`not-git`}}if(!On(n,r))return{kind:`symlink-escape`};let i=F(n,`.git`),s;try{s=_e(i)}catch{return{kind:`not-git`}}if(s.isDirectory()){let e;try{e=await V(i)}catch{return{kind:`not-git`}}if(!On(e,n))return{kind:`symlink-escape`}}else if(!s.isFile())return{kind:`not-git`};let c=o(n);if(c.kind!==`repository`)return{kind:`not-git`};let l=c.repository.readRemoteUrl(`origin`);if(l.kind===`unreadable`)return{kind:`not-git`};if(l.kind===`absent`)return l.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let u=l.url,d=Wt(u);if(d===null)return{kind:`non-github`};let f=a(d.hostname);if(f===null)return{kind:`non-github`};let p=f===t.host.toLowerCase(),m=d.owner.toLowerCase()===t.owner.toLowerCase(),h=d.name.toLowerCase()===t.repo.toLowerCase();return!p&&m&&h?{kind:`wrong-host`,actualHost:f}:!p||!m||!h?{kind:`wrong-repo`,actualOwner:d.owner,actualRepo:d.name}:{kind:`ok`,gitRemoteUrl:`https://${f}/${d.owner}/${d.name}.git`}}function On(e,t){if(e===t)return!0;let n=ce(t,e);return n.length>0&&!n.startsWith(`..`)&&!se(n)}const kn=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=A(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=w(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function An(e,t,n={},r=kn){let i=[];for(let a of t){let t=C[a];for(let a of r)i.push(a.write(t,e,n))}return i}function jn(e,t,n={}){return{integrations:An(e,t,n)}}export{Fe as C,Ae as D,Me as E,zt as S,Ne as T,Kt as _,Tn as a,Ht as b,Jt as c,tn as d,Zt as f,qt as g,Gt as h,Sn as i,Xt as l,en as m,Dn as n,bn as o,$t as p,En as r,an as s,jn as t,Yt as u,Wt as v,Pe as w,Rt as x,Z as y};
20
- //# sourceMappingURL=src-DTzbBBWG.mjs.map
20
+ //# sourceMappingURL=src-7dzK48Dw.mjs.map
@@ -1 +1 @@
1
- import{C as e,Fa as t,Ia as n,Pa as r,Qa as i,So as a,Xa as o,co as s,d as c,l,y as u}from"./src-DRjy7jah.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,At as y,B as b,Bi as x,Bn as S,Br as C,Bt as w,C as T,Ci as E,Cn as D,Cr as O,Ct as k,D as A,Di as j,Dn as M,Dt as N,E as P,Ei as F,En as I,Er as L,Et as R,F as z,Fi as B,Fn as V,Fr as H,Ft as U,G as W,Gi as G,Gn as K,Gr as q,Gt as J,H as Y,Hi as X,Hn as Z,Hr as Q,Ht as $,I as ee,Ii as te,In as ne,Ir as re,It as ie,J as ae,Ji as oe,Jn as se,Jr as ce,Jt as le,K as ue,Ki as de,Kn as fe,Kr as pe,Kt as me,L as he,Li as ge,Ln as _e,Lr as ve,Lt as ye,M as be,Mi as xe,Mn as Se,Mr as Ce,Mt as we,N as Te,Ni as Ee,Nn as De,Nr as Oe,Nt as ke,O as Ae,Oi as je,On as Me,Ot as Ne,P as Pe,Pi as Fe,Pn as Ie,Pr as Le,Pt as Re,Q as ze,Qi as Be,Qn as Ve,Qr as He,Qt as Ue,R as We,Ri as Ge,Rn as Ke,Rr as qe,Rt as Je,S as Ye,Si as Xe,Sn as Ze,Sr as Qe,St as $e,T as et,Ti as tt,Tn as nt,Tr as rt,Tt as it,U as at,Ui as ot,Un as st,Ur as ct,Ut as lt,V as ut,Vi as dt,Vn as ft,Vr as pt,Vt as mt,W as ht,Wi as gt,Wn as _t,Wr as vt,Wt as yt,X as bt,Xi as xt,Xn as St,Xr as Ct,Xt as wt,Y as Tt,Yi as Et,Yn as Dt,Yr as Ot,Yt as kt,Z as At,Zi as jt,Zn as Mt,Zr as Nt,Zt as Pt,_ as Ft,_a as It,_i as Lt,_n as Rt,_r as zt,_t as Bt,a as Vt,aa as Ht,ai as Ut,an as Wt,ar as Gt,at as Kt,b as qt,bi as Jt,bn as Yt,br as Xt,bt as Zt,c as Qt,ca as $t,ci as en,cn as tn,cr as nn,ct as rn,d as an,da as on,di as sn,dn as cn,dr as ln,ea as un,ei as dn,en as fn,er as pn,et as mn,f as hn,fa as gn,fi as _n,fn as vn,fr as yn,g as bn,ga as xn,gi as Sn,gn as Cn,gr as wn,gt as Tn,h as En,ha as Dn,hi as On,hn as kn,hr as An,i as jn,ia as Mn,ii as Nn,in as Pn,ir as Fn,it as In,j as Ln,ji as Rn,jn as zn,jt as Bn,k as Vn,ki as Hn,kn as Un,kt as Wn,l as Gn,la as Kn,li as qn,ln as Jn,lr as Yn,lt as Xn,m as Zn,ma as Qn,mi as $n,mn as er,mr as tr,n as nr,na as rr,ni as ir,nn as ar,nr as or,nt as sr,o as cr,oa as lr,oi as ur,on as dr,or as fr,ot as pr,p as mr,pa as hr,pi as gr,pn as _r,pr as vr,q as yr,qi as br,qn as xr,qr as Sr,qt as Cr,r as wr,ra as Tr,ri as Er,rn as Dr,rr as Or,rt as kr,s as Ar,sa as jr,si as Mr,sn as Nr,sr as Pr,st as Fr,t as Ir,ta as Lr,ti as Rr,tn as zr,tr as Br,tt as Vr,u as Hr,ua as Ur,ui as Wr,un as Gr,ur as Kr,v as qr,va as Jr,vi as Yr,vn as Xr,vr as Zr,vt as Qr,w as $r,wi as ei,wn as ti,wr as ni,wt as ri,x as ii,xi as ai,xn as oi,xr as si,xt as ci,y as li,ya as ui,yi as di,yn as fi,yr as pi,yt as mi,z as hi,zi as gi,zn as _i,zr as vi,zt as yi}from"./src-CMWx7wd8.mjs";import{C as bi,E as xi,T as Si,_ as Ci,b as wi,c as Ti,d as Ei,g as Di,i as Oi,l as ki,m as Ai,n as ji,p as Mi,s as Ni,t as Pi,u as Fi,v as Ii,w as Li,x as Ri,y as zi}from"./fs-traced-DDm-belY.mjs";import{a as Bi,d as Vi,f as Hi,i as Ui,l as Wi,n as Gi,r as Ki,t as qi,u as Ji}from"./logger-B7Z8XO-z.mjs";import{S as Yi,_ as Xi,a as Zi,c as Qi,f as $i,g as ea,h as ta,i as na,l as ra,m as ia,n as aa,o as oa,p as sa,r as ca,s as la,t as ua,u as da,v as fa,x as pa}from"./server-lock-Dvu9Crm-.mjs";export{Ur as AGENT_ID_MAX_LEN,on as AGENT_ID_RE,F as AGENT_WRITE_ORIGIN,It as AcpPermissionStore,Qn as AcpRegistry,E as AcpThreadManager,ai as AgentFocusBroadcaster,Jt as AgentPresenceBroadcaster,j as AgentSessionCapacityError,je as AgentSessionManager,Bt as AutoStartDisabledError,yn as BUNDLE_IDS,vr as BUNDLE_SCOPE,tr as BUNDLE_SKILL_NAME,zn as BacklinkIndex,Ge as CC1Broadcaster,i as CC1_CONTRACT_VERSION,ar as CONFIG_FILENAME,I as CONFLICT_MARKER_RE,re as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ft as ConfigSchema,gt as DEFAULT_CHECKPOINT_RETENTION,He as DEFAULT_EMBEDDINGS_DIMENSIONS,U as DEFAULT_PACK_ID,Y as DocumentDurabilityState,m as EMBEDDINGS_API_KEY_ENV,Dn as FEATURED_AGENT_IDS,G as FILE_SYSTEM_WRITER,v as FILE_WATCHER_ORIGIN,pe as FileEmbeddingsBackend,Pt as GIT_PREFLIGHT_FAIL_SPAN_NAME,de as GIT_UPSTREAM_WRITER,Jr as GitDirAccessError,Ke as GitNotAvailableError,_i as GitTooOldError,Qr as HOCUSPOCUS_AUTH_REJECTION_REASONS,mi as HocuspocusAuthRejection,Zt as HocuspocusAuthTokenSchema,Q as INSTALLED_AGENTS_SCHEMES,o as LINEAGE_EPOCH_KEY,hi as LIVE_DERIVED_INDEX_DEBOUNCE_MS,ie as LOG_MD_TEMPLATE,R as MANAGED_RENAME_ORIGIN,ei as MAX_ACP_THREADS,Hn as MAX_AGENT_SESSIONS,rn as MCP_CONNECTION_ID_HEADER,r as MCP_SERVER_NAME,_ as MIN_EVICTABLE_IDLE_MS,S as MIN_GIT_VERSION,at as MISSING_OK_CONFIG_MESSAGE,ui as MalformedGitPointerError,mn as McpLogger,ht as MissingOkConfigError,xe as OBSERVER_SYNC_ORIGIN,Dr as OK_OKIGNORE_TEMPLATE,t as ORPHAN_MODES,a as PROTOCOL_VERSION,qi as PinoLogger,Qi as ProcessLockCollisionError,Gn as ProjectGitInitError,N as ROLLBACK_ORIGIN,Pn as ROOT_GITIGNORE_TEMPLATE,ea as RUNTIME_VERSION,$n as RemoteConfigError,br as SERVICE_WRITER,Pr as SKILL_INSTALL_EVENTS_FILE_REL,u as SKILL_STATE_TARGETS,ye as STARTER_FOLDERS,Je as STARTER_FOLDER_FRONTMATTER_FILENAME,yi as STARTER_PACKS,w as STARTER_PACK_IDS,mt as STARTER_TEMPLATES,P as STATE_MANIFEST_FILENAME,Xi as STATE_SCHEMA_VERSION,s as SYSTEM_DOC_NAME,Cr as SeedPrerequisiteError,le as SeedRootDirError,ua as ServerLockCollisionError,Ir as SingleFileNotAFileError,nr as SingleFileNotFoundError,wr as SingleFileNotMarkdownError,A as StateManifestError,et as TagIndex,An as USER_GLOBAL_BUNDLE_IDS,De as UiLockCollisionError,Ne as __getShowAllWalkStatsForTesting,Wn as __resetShowAllWalkStatsForTesting,ra as acquireProcessLock,aa as acquireServerLock,Ie as acquireUiLock,Rn as applyAgentMarkdownWrite,ti as applyExternalChange,Re as applySeed,Ae as assertCompatibleStateManifest,ft as assertGitAvailable,vn as assertNeverDiskEvent,Xe as attachAcpThreadSocket,Tn as attachIdleShutdown,qr as bootServer,St as buildAndOpenSkill,Wt as buildConfigYmlContent,Tt as buildExecResult,tt as buildOkMcpStdioCommand,Yn as buildSkillZip,$ as buildStarterFolderFrontmatterYaml,oe as buildWipTree,wn as bundleSkillMdPath,Sr as canonicalProjectKey,_r as classifyEvents,Pi as classifyFsPath,ce as clearAllEmbeddingsKeys,Rr as clearContributors,lt as coercePackId,l as colorFromSeed,Et as commitUpstreamImport,xt as commitWip,jt as commitWipFromTree,Z as compareSemver,pi as composeEffectiveLinterConfig,Xt as composeFrontmatterSchemasConfig,M as containsConflictMarkers,er as contentHash,ir as contributorCount,z as countShadowObjects,ee as countStaleAgentWipRefs,he as countWipRefs,y as createApiExtension,sn as createAssetServeMiddleware,Ce as createContentFilter,Oe as createContentFilterAsync,Ot as createEmbeddingsSecretStore,jn as createEphemeralProjectDir,nt as createExternalChangeHandler,hn as createFileLogger,b as createLiveDerivedIndexExtension,yr as createMcpHttpHandler,ct as createOsProbe,Pe as createPersistenceExtension,T as createServer,be as createServerObserverExtension,B as createStreamingErrorWriter,Gi as createTestLogger,Ct as describeStoredEmbeddingsKey,bn as detectClaudeDesktopPresence,st as detectGit,Vn as detectProjectShape,Mt as detectUserSkillHosts,kr as discoverLockDirs,O as discoverMarkdownlintConfig,Ue as emitPreflightFailureSpan,bt as encodeDocName,At as encodeFolderRoute,ze as encodeSkillRoute,Hr as ensureProjectGit,dr as ensureProjectSkillGitignore,te as errorResponse,kn as evictStaleTrackerEntries,In as extractOkBinaryPath,Se as extractWikiLinksFromMarkdown,_t as fallbackPaths,an as findEnclosingGitRoot,Gr as findEnclosingProjectRoot,ni as findNativeMarkdownlintFile,mr as flushFileLogger,ci as formatAuthRejectionWire,Er as formatContributors,Nn as formatContributorsFrom,we as formatPackRationale,Be as gcCheckpointRefs,Vr as getCurrentMcpLogger,en as getLocalDir,Zn as getLogFilePath,Ki as getLogger,En as getLogsDir,fa as getMachineId,zi as getMeter,Ht as getMetrics,wi as getTracer,lr as handleCollabSocketError,ve as handleSpawnCursor,On as hasForwardingHeaders,We as hasGcLogLatch,c as iconFromClientName,jr as incrementCollabSocketFilteredError,$t as incrementServerObserverFire,Nr as initContent,f as initShadowRepo,Ri as initTelemetry,qt as initToleranceTelemetryWriter,Fr as installPrettyZodErrors,Ui as installTestLoggers,Ve as installUserSkill,gr as isAllowedApiOrigin,Yr as isAllowedWorkspaceHostHeader,gi as isConfigDoc,$e as isHocuspocusAuthRejectionReason,yt as isKnownPackId,x as isLinkIndexExcludedDoc,di as isLoopbackAddress,dt as isManagedArtifactDoc,n as isOrphanMode,Ee as isPairedWriteOrigin,qe as isPathWithinDir,pa as isProcessAlive,cn as isProjectRoot,fe as isProjectSkillManaged,Sn as isRemoteAdmitted,X as isReservedForUserTree,Cn as isSelfWrite,ot as isSystemDoc,ii as isToleranceTelemetryEnabled,Yi as isValidLockPid,Rt as lastKnownHash,un as listRescueCheckpoints,J as listStarterPacks,xn as loadCustomAgents,Te as loadPrincipal,da as lockFilePath,Bi as loggerFactory,Wi as logsCurrentPath,Ji as logsPreviousPath,Nt as makeLazyEmbeddingsKeyStore,ca as markServerLockDraining,W as mountMcpAndApi,ji as normalizeFsPath,zt as originGitHubHost,tn as packageVersionMajorMinor,k as parseAuthRejectionWire,K as parseGitVersion,ri as parseHocuspocusAuthToken,ue as parseKeepaliveConnectionId,Xr as pathToDocName,ke as planSeed,Vt as prepareSingleFileOpen,Kt as processCommand,pr as processUsage,p as readAllTargets,pn as readBundleDecision,rt as readOwnNativeRules,$i as readProcessLock,sa as readProcessLockDetailed,ut as readProjectHeadState,q as readProjectLocalSemanticConfig,na as readServerLock,Br as readServerPackageVersion,or as readSkillInstallStateSnapshot,xr as readSkillManagement,g as readStateManifest,Or as readTargetRecordedAt,Fn as readTargetVersion,V as readUiLock,Me as reconcile,Ut as recordContributor,nn as recordSkillInstallEvent,ae as registerAllTools,fi as registerWrite,ia as releaseProcessLock,Zi as releaseServerLock,ne as releaseUiLock,Yt as removeLastKnownHash,Kn as resetMetrics,e as resolveBundleEnabled,Kr as resolveBundledSkillDir,qn as resolveContentDir,vi as resolveCursorBinaryDefault,C as resolveCursorSpawnInvocation,si as resolveEffectiveLinterConfig,dn as resolveEmbeddingsCredential,Wr as resolveLockDir,Qe as resolveNativeConfigForDoc,L as resolveNativeMarkdownlintConfig,me as resolvePack,Ar as resolvePackageVersion,Lt as resolveRemoteAccess,d as resolveUiInfo,ur as restoreContributors,li as restoreLifecycleFromConflictsJson,Le as rewriteMarkdownLinksForDocumentRename,H as rewriteWikiLinksForDocumentRename,h as runAuthReposSubprocess,fn as runAuthStatusSubprocess,kt as runCloneSubprocess,zr as runDeviceFlowSubprocess,sr as runWithMcpLogger,_n as safeContentPath,Bn as safeSubdir,Lr as safetyCheckpoint,Xn as sanitizeClientName,rr as saveInMemoryCheckpoint,Tr as saveVersion,it as seedBasenameIndex,cr as serializeError,bi as setActiveSpanAttributes,Fe as setupServerObservers,Mn as shadowGit,Li as shutdownTelemetry,se as skillManagementPath,Vi as spansCurrentPath,Hi as spansPreviousPath,pt as spawnDetached,Un as splitMarkdownBlocks,oi as startWatcher,ge as streamingProblemEvent,Mr as swapContributors,Ye as teardownToleranceTelemetryWriter,gn as toBroadcasterKey,Oi as tracedAppendFileSync,Ni as tracedLinkSync,Ti as tracedMkdir,ki as tracedMkdirSync,Fi as tracedRename,Ei as tracedRenameSync,Mi as tracedRmSync,Ai as tracedRmdirSync,Di as tracedUnlinkSync,Ci as tracedWriteFile,Ii as tracedWriteFileSync,$r as trustSystemCertificates,Qt as untrackTrackedProjectSkillProjection,Ze as updateLastKnownHash,ta as updateProcessLockPort,oa as updateServerLockPort,_e as updateUiLockPort,hr as validateAgentId,wt as validateCloneInputs,ln as validateSkillZip,la as waitForServerLockDrain,vt as withHiddenWindowsConsole,Si as withSpan,xi as withSpanSync,Gt as writeBundleDecision,Zr as writeMarkdownlintRule,Jn as writeRootGitignoreForNewRepo,Dt as writeSkillManagement,Ln as writeStateManifest,fr as writeTargetVersion,D as writeTracker};
1
+ import{C as e,Fa as t,Ia as n,Pa as r,Qa as i,So as a,Xa as o,co as s,d as c,l,y as u}from"./src-D5f9ThMD.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,At as y,B as b,Bi as x,Bn as S,Br as C,Bt as w,C as T,Ci as E,Cn as D,Cr as O,Ct as k,D as A,Di as j,Dn as M,Dt as N,E as P,Ei as F,En as I,Er as L,Et as R,F as z,Fi as B,Fn as V,Fr as H,Ft as U,G as W,Gi as G,Gn as K,Gr as q,Gt as J,H as Y,Hi as X,Hn as Z,Hr as Q,Ht as $,I as ee,Ii as te,In as ne,Ir as re,It as ie,J as ae,Ji as oe,Jn as se,Jr as ce,Jt as le,K as ue,Ki as de,Kn as fe,Kr as pe,Kt as me,L as he,Li as ge,Ln as _e,Lr as ve,Lt as ye,M as be,Mi as xe,Mn as Se,Mr as Ce,Mt as we,N as Te,Ni as Ee,Nn as De,Nr as Oe,Nt as ke,O as Ae,Oi as je,On as Me,Ot as Ne,P as Pe,Pi as Fe,Pn as Ie,Pr as Le,Pt as Re,Q as ze,Qi as Be,Qn as Ve,Qr as He,Qt as Ue,R as We,Ri as Ge,Rn as Ke,Rr as qe,Rt as Je,S as Ye,Si as Xe,Sn as Ze,Sr as Qe,St as $e,T as et,Ti as tt,Tn as nt,Tr as rt,Tt as it,U as at,Ui as ot,Un as st,Ur as ct,Ut as lt,V as ut,Vi as dt,Vn as ft,Vr as pt,Vt as mt,W as ht,Wi as gt,Wn as _t,Wr as vt,Wt as yt,X as bt,Xi as xt,Xn as St,Xr as Ct,Xt as wt,Y as Tt,Yi as Et,Yn as Dt,Yr as Ot,Yt as kt,Z as At,Zi as jt,Zn as Mt,Zr as Nt,Zt as Pt,_ as Ft,_a as It,_i as Lt,_n as Rt,_r as zt,_t as Bt,a as Vt,aa as Ht,ai as Ut,an as Wt,ar as Gt,at as Kt,b as qt,bi as Jt,bn as Yt,br as Xt,bt as Zt,c as Qt,ca as $t,ci as en,cn as tn,cr as nn,ct as rn,d as an,da as on,di as sn,dn as cn,dr as ln,ea as un,ei as dn,en as fn,er as pn,et as mn,f as hn,fa as gn,fi as _n,fn as vn,fr as yn,g as bn,ga as xn,gi as Sn,gn as Cn,gr as wn,gt as Tn,h as En,ha as Dn,hi as On,hn as kn,hr as An,i as jn,ia as Mn,ii as Nn,in as Pn,ir as Fn,it as In,j as Ln,ji as Rn,jn as zn,jt as Bn,k as Vn,ki as Hn,kn as Un,kt as Wn,l as Gn,la as Kn,li as qn,ln as Jn,lr as Yn,lt as Xn,m as Zn,ma as Qn,mi as $n,mn as er,mr as tr,n as nr,na as rr,ni as ir,nn as ar,nr as or,nt as sr,o as cr,oa as lr,oi as ur,on as dr,or as fr,ot as pr,p as mr,pa as hr,pi as gr,pn as _r,pr as vr,q as yr,qi as br,qn as xr,qr as Sr,qt as Cr,r as wr,ra as Tr,ri as Er,rn as Dr,rr as Or,rt as kr,s as Ar,sa as jr,si as Mr,sn as Nr,sr as Pr,st as Fr,t as Ir,ta as Lr,ti as Rr,tn as zr,tr as Br,tt as Vr,u as Hr,ua as Ur,ui as Wr,un as Gr,ur as Kr,v as qr,va as Jr,vi as Yr,vn as Xr,vr as Zr,vt as Qr,w as $r,wi as ei,wn as ti,wr as ni,wt as ri,x as ii,xi as ai,xn as oi,xr as si,xt as ci,y as li,ya as ui,yi as di,yn as fi,yr as pi,yt as mi,z as hi,zi as gi,zn as _i,zr as vi,zt as yi}from"./src-CepmZgB5.mjs";import{C as bi,E as xi,T as Si,_ as Ci,b as wi,c as Ti,d as Ei,g as Di,i as Oi,l as ki,m as Ai,n as ji,p as Mi,s as Ni,t as Pi,u as Fi,v as Ii,w as Li,x as Ri,y as zi}from"./fs-traced-DDm-belY.mjs";import{a as Bi,d as Vi,f as Hi,i as Ui,l as Wi,n as Gi,r as Ki,t as qi,u as Ji}from"./logger-B7Z8XO-z.mjs";import{S as Yi,_ as Xi,a as Zi,c as Qi,f as $i,g as ea,h as ta,i as na,l as ra,m as ia,n as aa,o as oa,p as sa,r as ca,s as la,t as ua,u as da,v as fa,x as pa}from"./server-lock-C4qH3g-P.mjs";export{Ur as AGENT_ID_MAX_LEN,on as AGENT_ID_RE,F as AGENT_WRITE_ORIGIN,It as AcpPermissionStore,Qn as AcpRegistry,E as AcpThreadManager,ai as AgentFocusBroadcaster,Jt as AgentPresenceBroadcaster,j as AgentSessionCapacityError,je as AgentSessionManager,Bt as AutoStartDisabledError,yn as BUNDLE_IDS,vr as BUNDLE_SCOPE,tr as BUNDLE_SKILL_NAME,zn as BacklinkIndex,Ge as CC1Broadcaster,i as CC1_CONTRACT_VERSION,ar as CONFIG_FILENAME,I as CONFLICT_MARKER_RE,re as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ft as ConfigSchema,gt as DEFAULT_CHECKPOINT_RETENTION,He as DEFAULT_EMBEDDINGS_DIMENSIONS,U as DEFAULT_PACK_ID,Y as DocumentDurabilityState,m as EMBEDDINGS_API_KEY_ENV,Dn as FEATURED_AGENT_IDS,G as FILE_SYSTEM_WRITER,v as FILE_WATCHER_ORIGIN,pe as FileEmbeddingsBackend,Pt as GIT_PREFLIGHT_FAIL_SPAN_NAME,de as GIT_UPSTREAM_WRITER,Jr as GitDirAccessError,Ke as GitNotAvailableError,_i as GitTooOldError,Qr as HOCUSPOCUS_AUTH_REJECTION_REASONS,mi as HocuspocusAuthRejection,Zt as HocuspocusAuthTokenSchema,Q as INSTALLED_AGENTS_SCHEMES,o as LINEAGE_EPOCH_KEY,hi as LIVE_DERIVED_INDEX_DEBOUNCE_MS,ie as LOG_MD_TEMPLATE,R as MANAGED_RENAME_ORIGIN,ei as MAX_ACP_THREADS,Hn as MAX_AGENT_SESSIONS,rn as MCP_CONNECTION_ID_HEADER,r as MCP_SERVER_NAME,_ as MIN_EVICTABLE_IDLE_MS,S as MIN_GIT_VERSION,at as MISSING_OK_CONFIG_MESSAGE,ui as MalformedGitPointerError,mn as McpLogger,ht as MissingOkConfigError,xe as OBSERVER_SYNC_ORIGIN,Dr as OK_OKIGNORE_TEMPLATE,t as ORPHAN_MODES,a as PROTOCOL_VERSION,qi as PinoLogger,Qi as ProcessLockCollisionError,Gn as ProjectGitInitError,N as ROLLBACK_ORIGIN,Pn as ROOT_GITIGNORE_TEMPLATE,ea as RUNTIME_VERSION,$n as RemoteConfigError,br as SERVICE_WRITER,Pr as SKILL_INSTALL_EVENTS_FILE_REL,u as SKILL_STATE_TARGETS,ye as STARTER_FOLDERS,Je as STARTER_FOLDER_FRONTMATTER_FILENAME,yi as STARTER_PACKS,w as STARTER_PACK_IDS,mt as STARTER_TEMPLATES,P as STATE_MANIFEST_FILENAME,Xi as STATE_SCHEMA_VERSION,s as SYSTEM_DOC_NAME,Cr as SeedPrerequisiteError,le as SeedRootDirError,ua as ServerLockCollisionError,Ir as SingleFileNotAFileError,nr as SingleFileNotFoundError,wr as SingleFileNotMarkdownError,A as StateManifestError,et as TagIndex,An as USER_GLOBAL_BUNDLE_IDS,De as UiLockCollisionError,Ne as __getShowAllWalkStatsForTesting,Wn as __resetShowAllWalkStatsForTesting,ra as acquireProcessLock,aa as acquireServerLock,Ie as acquireUiLock,Rn as applyAgentMarkdownWrite,ti as applyExternalChange,Re as applySeed,Ae as assertCompatibleStateManifest,ft as assertGitAvailable,vn as assertNeverDiskEvent,Xe as attachAcpThreadSocket,Tn as attachIdleShutdown,qr as bootServer,St as buildAndOpenSkill,Wt as buildConfigYmlContent,Tt as buildExecResult,tt as buildOkMcpStdioCommand,Yn as buildSkillZip,$ as buildStarterFolderFrontmatterYaml,oe as buildWipTree,wn as bundleSkillMdPath,Sr as canonicalProjectKey,_r as classifyEvents,Pi as classifyFsPath,ce as clearAllEmbeddingsKeys,Rr as clearContributors,lt as coercePackId,l as colorFromSeed,Et as commitUpstreamImport,xt as commitWip,jt as commitWipFromTree,Z as compareSemver,pi as composeEffectiveLinterConfig,Xt as composeFrontmatterSchemasConfig,M as containsConflictMarkers,er as contentHash,ir as contributorCount,z as countShadowObjects,ee as countStaleAgentWipRefs,he as countWipRefs,y as createApiExtension,sn as createAssetServeMiddleware,Ce as createContentFilter,Oe as createContentFilterAsync,Ot as createEmbeddingsSecretStore,jn as createEphemeralProjectDir,nt as createExternalChangeHandler,hn as createFileLogger,b as createLiveDerivedIndexExtension,yr as createMcpHttpHandler,ct as createOsProbe,Pe as createPersistenceExtension,T as createServer,be as createServerObserverExtension,B as createStreamingErrorWriter,Gi as createTestLogger,Ct as describeStoredEmbeddingsKey,bn as detectClaudeDesktopPresence,st as detectGit,Vn as detectProjectShape,Mt as detectUserSkillHosts,kr as discoverLockDirs,O as discoverMarkdownlintConfig,Ue as emitPreflightFailureSpan,bt as encodeDocName,At as encodeFolderRoute,ze as encodeSkillRoute,Hr as ensureProjectGit,dr as ensureProjectSkillGitignore,te as errorResponse,kn as evictStaleTrackerEntries,In as extractOkBinaryPath,Se as extractWikiLinksFromMarkdown,_t as fallbackPaths,an as findEnclosingGitRoot,Gr as findEnclosingProjectRoot,ni as findNativeMarkdownlintFile,mr as flushFileLogger,ci as formatAuthRejectionWire,Er as formatContributors,Nn as formatContributorsFrom,we as formatPackRationale,Be as gcCheckpointRefs,Vr as getCurrentMcpLogger,en as getLocalDir,Zn as getLogFilePath,Ki as getLogger,En as getLogsDir,fa as getMachineId,zi as getMeter,Ht as getMetrics,wi as getTracer,lr as handleCollabSocketError,ve as handleSpawnCursor,On as hasForwardingHeaders,We as hasGcLogLatch,c as iconFromClientName,jr as incrementCollabSocketFilteredError,$t as incrementServerObserverFire,Nr as initContent,f as initShadowRepo,Ri as initTelemetry,qt as initToleranceTelemetryWriter,Fr as installPrettyZodErrors,Ui as installTestLoggers,Ve as installUserSkill,gr as isAllowedApiOrigin,Yr as isAllowedWorkspaceHostHeader,gi as isConfigDoc,$e as isHocuspocusAuthRejectionReason,yt as isKnownPackId,x as isLinkIndexExcludedDoc,di as isLoopbackAddress,dt as isManagedArtifactDoc,n as isOrphanMode,Ee as isPairedWriteOrigin,qe as isPathWithinDir,pa as isProcessAlive,cn as isProjectRoot,fe as isProjectSkillManaged,Sn as isRemoteAdmitted,X as isReservedForUserTree,Cn as isSelfWrite,ot as isSystemDoc,ii as isToleranceTelemetryEnabled,Yi as isValidLockPid,Rt as lastKnownHash,un as listRescueCheckpoints,J as listStarterPacks,xn as loadCustomAgents,Te as loadPrincipal,da as lockFilePath,Bi as loggerFactory,Wi as logsCurrentPath,Ji as logsPreviousPath,Nt as makeLazyEmbeddingsKeyStore,ca as markServerLockDraining,W as mountMcpAndApi,ji as normalizeFsPath,zt as originGitHubHost,tn as packageVersionMajorMinor,k as parseAuthRejectionWire,K as parseGitVersion,ri as parseHocuspocusAuthToken,ue as parseKeepaliveConnectionId,Xr as pathToDocName,ke as planSeed,Vt as prepareSingleFileOpen,Kt as processCommand,pr as processUsage,p as readAllTargets,pn as readBundleDecision,rt as readOwnNativeRules,$i as readProcessLock,sa as readProcessLockDetailed,ut as readProjectHeadState,q as readProjectLocalSemanticConfig,na as readServerLock,Br as readServerPackageVersion,or as readSkillInstallStateSnapshot,xr as readSkillManagement,g as readStateManifest,Or as readTargetRecordedAt,Fn as readTargetVersion,V as readUiLock,Me as reconcile,Ut as recordContributor,nn as recordSkillInstallEvent,ae as registerAllTools,fi as registerWrite,ia as releaseProcessLock,Zi as releaseServerLock,ne as releaseUiLock,Yt as removeLastKnownHash,Kn as resetMetrics,e as resolveBundleEnabled,Kr as resolveBundledSkillDir,qn as resolveContentDir,vi as resolveCursorBinaryDefault,C as resolveCursorSpawnInvocation,si as resolveEffectiveLinterConfig,dn as resolveEmbeddingsCredential,Wr as resolveLockDir,Qe as resolveNativeConfigForDoc,L as resolveNativeMarkdownlintConfig,me as resolvePack,Ar as resolvePackageVersion,Lt as resolveRemoteAccess,d as resolveUiInfo,ur as restoreContributors,li as restoreLifecycleFromConflictsJson,Le as rewriteMarkdownLinksForDocumentRename,H as rewriteWikiLinksForDocumentRename,h as runAuthReposSubprocess,fn as runAuthStatusSubprocess,kt as runCloneSubprocess,zr as runDeviceFlowSubprocess,sr as runWithMcpLogger,_n as safeContentPath,Bn as safeSubdir,Lr as safetyCheckpoint,Xn as sanitizeClientName,rr as saveInMemoryCheckpoint,Tr as saveVersion,it as seedBasenameIndex,cr as serializeError,bi as setActiveSpanAttributes,Fe as setupServerObservers,Mn as shadowGit,Li as shutdownTelemetry,se as skillManagementPath,Vi as spansCurrentPath,Hi as spansPreviousPath,pt as spawnDetached,Un as splitMarkdownBlocks,oi as startWatcher,ge as streamingProblemEvent,Mr as swapContributors,Ye as teardownToleranceTelemetryWriter,gn as toBroadcasterKey,Oi as tracedAppendFileSync,Ni as tracedLinkSync,Ti as tracedMkdir,ki as tracedMkdirSync,Fi as tracedRename,Ei as tracedRenameSync,Mi as tracedRmSync,Ai as tracedRmdirSync,Di as tracedUnlinkSync,Ci as tracedWriteFile,Ii as tracedWriteFileSync,$r as trustSystemCertificates,Qt as untrackTrackedProjectSkillProjection,Ze as updateLastKnownHash,ta as updateProcessLockPort,oa as updateServerLockPort,_e as updateUiLockPort,hr as validateAgentId,wt as validateCloneInputs,ln as validateSkillZip,la as waitForServerLockDrain,vt as withHiddenWindowsConsole,Si as withSpan,xi as withSpanSync,Gt as writeBundleDecision,Zr as writeMarkdownlintRule,Jn as writeRootGitignoreForNewRepo,Dt as writeSkillManagement,Ln as writeStateManifest,fr as writeTargetVersion,D as writeTracker};