@inkeep/open-knowledge 0.58.0-beta.1 → 0.58.0-beta.3

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 (177) hide show
  1. package/dist/{acp-harness-probe-1T3u8lIy.mjs → acp-harness-probe-B8cjyUwS.mjs} +2 -2
  2. package/dist/cli.mjs +22 -22
  3. package/dist/constants-XJleQvys.mjs +2 -0
  4. package/dist/{git-handle-Dk7GEAfH.mjs → git-handle-3stJTucC.mjs} +2 -2
  5. package/dist/git-handle-B0ZVs8y7.mjs +1 -0
  6. package/dist/index.d.mts +2612 -19
  7. package/dist/index.mjs +2 -2
  8. package/dist/init-B7IuLPDf.mjs +1 -0
  9. package/dist/{init-CgzZMWZN.mjs → init-DJX9zKiO.mjs} +5 -5
  10. package/dist/{launch-json-removal-CczI_AQw.mjs → launch-json-removal-BiK2fLSM.mjs} +2 -2
  11. package/dist/loader-BshElnYk.mjs +1 -0
  12. package/dist/{loader-DN88fSLk.mjs → loader-Db-3Tt5G.mjs} +2 -2
  13. package/dist/md-manager-Dz3nKJbO.mjs +2 -0
  14. package/dist/{open-browser-BXT69qcq.mjs → open-browser-BPu-89ta.mjs} +2 -2
  15. package/dist/parse-worker.mjs +1 -1
  16. package/dist/{preview-K8zvEnBc.mjs → preview-CtA0e_2y.mjs} +2 -2
  17. package/dist/preview-DDh7AoJO.mjs +1 -0
  18. package/dist/public/assets/ActivityModeContent-lal4lxDh.js +1 -0
  19. package/dist/public/assets/{AgentDiffPane-CxvPSRp5.js → AgentDiffPane-CuDH0-HN.js} +1 -1
  20. package/dist/public/assets/{AgentIconCluster-CjMEI-L4.js → AgentIconCluster-B26uigRz.js} +1 -1
  21. package/dist/public/assets/{AgentThreadClientBinder-CZt9gzGP.js → AgentThreadClientBinder-M_2EBFIT.js} +1 -1
  22. package/dist/public/assets/{AppMenubar-CiSfRgZz.js → AppMenubar-DNz-YQ-n.js} +1 -1
  23. package/dist/public/assets/{BugReportHistory-DAkLR0uT.js → BugReportHistory-3WmeKMdN.js} +1 -1
  24. package/dist/public/assets/{BugReportHistoryDialog-D3FmiOs-.js → BugReportHistoryDialog-B8G8dpLP.js} +1 -1
  25. package/dist/public/assets/{CodeMirrorPropInput-Bj9gYc9v.js → CodeMirrorPropInput-DN3nqPPS.js} +1 -1
  26. package/dist/public/assets/ConsentDialogBody-DIXTiaxR.js +2 -0
  27. package/dist/public/assets/{DiffView-BbCF3n86.js → DiffView-CjTilKZT.js} +1 -1
  28. package/dist/public/assets/{DocumentContext-CM98n-Wm.js → DocumentContext-CGXxK5Nq.js} +1 -1
  29. package/dist/public/assets/EditorModeToggle-CJjixYVK.js +1 -0
  30. package/dist/public/assets/EnableSyncConfirmDialog-Dh1Rcy3o.js +1 -0
  31. package/dist/public/assets/FeedbackForm-BKBlMB5r.js +1 -0
  32. package/dist/public/assets/{GraphPanel-Dbt6ehOx.js → GraphPanel-BDFyzdEz.js} +1 -1
  33. package/dist/public/assets/ImportSkillDialog-CIyqIGrG.js +1 -0
  34. package/dist/public/assets/{LintConfigEditor-DPAgvzQo.js → LintConfigEditor-Dfep8b0z.js} +1 -1
  35. package/dist/public/assets/ManagedArtifactProperties-Dhv2wo_H.js +1 -0
  36. package/dist/public/assets/ManagedArtifactProperties-UGfdHQU3.js +1 -0
  37. package/dist/public/assets/McpConsentDialogBody-GUHma1LV.js +1 -0
  38. package/dist/public/assets/{MermaidDocEditor-B-SpVE_4.js → MermaidDocEditor-BQi1FFtf.js} +1 -1
  39. package/dist/public/assets/{OpenInAgentMenuItem--c5Kl0UJ.js → OpenInAgentMenuItem-8Fp3GsHg.js} +1 -1
  40. package/dist/public/assets/{PropertyDisplayRow-JWrzMen3.js → PropertyDisplayRow-CgwKdqZo.js} +1 -1
  41. package/dist/public/assets/{ReportBugDialogBody-Bn7KSO7Z.js → ReportBugDialogBody-Ci98J5Bw.js} +1 -1
  42. package/dist/public/assets/SchemaConfigEditor-CT-3C9qT.js +1 -0
  43. package/dist/public/assets/SessionsHost-CBiFo-eV.js +2 -0
  44. package/dist/public/assets/{SettingsDialogBody-f_hQ7VPv.js → SettingsDialogBody-DJqUrkQv.js} +1 -1
  45. package/dist/public/assets/ShareBranchSwitchDialog-CpToxQMt.js +1 -0
  46. package/dist/public/assets/ShareReceiveDialog-LOwGCI-g.js +1 -0
  47. package/dist/public/assets/ShareReceiveMissDialog-FwMBNCVp.js +1 -0
  48. package/dist/public/assets/{SkillCostValue-XTEKNDJI.js → SkillCostValue-D_6C2Gog.js} +1 -1
  49. package/dist/public/assets/{SkillDestinationList-Dw1naFS2.js → SkillDestinationList-DpCf7aFO.js} +1 -1
  50. package/dist/public/assets/{SkillEditBanner-DFhrQ8xp.js → SkillEditBanner-COUIEuU_.js} +1 -1
  51. package/dist/public/assets/{SkillInstallMenu-B2HRT0pR.js → SkillInstallMenu-y2A7W0zZ.js} +1 -1
  52. package/dist/public/assets/{SkillOriginInline-Ba3UO-r0.js → SkillOriginInline-Dy9lf16Q.js} +1 -1
  53. package/dist/public/assets/{SkillToolbarControls-D_gVZcnp.js → SkillToolbarControls-BgGFORSX.js} +1 -1
  54. package/dist/public/assets/SlidesToolbarControls-DNkQ5Ng_.js +1 -0
  55. package/dist/public/assets/{SourceEditor-CZ1cWoNO.js → SourceEditor-XMsqlMIW.js} +1 -1
  56. package/dist/public/assets/{TerminalPanel-D15yQGLN.js → TerminalPanel-Ba-GkOb9.js} +1 -1
  57. package/dist/public/assets/{TerminalWindowApp-DoVS1306.js → TerminalWindowApp-uxpLRZph.js} +1 -1
  58. package/dist/public/assets/{TextDocEditor-gZsWz3eO.js → TextDocEditor-bfklV2Xk.js} +1 -1
  59. package/dist/public/assets/{ThreadView-BQHsrBEu.js → ThreadView-B7DWfAUa.js} +1 -1
  60. package/dist/public/assets/TimelineDiffPane-DO6QATC6.js +2 -0
  61. package/dist/public/assets/{auth-state-cache-BrvpmLJN.js → auth-state-cache-CI9zNqOf.js} +2 -2
  62. package/dist/public/assets/{client-version-vyi1QvTS.js → client-version-DvabycW5.js} +1 -1
  63. package/dist/public/assets/comment-chips-DQFCvweV.js +5 -0
  64. package/dist/public/assets/{config-provider-D1oa8ar_.js → config-provider-DbAEDIve.js} +3 -3
  65. package/dist/public/assets/{dist-BrL2bd3x.js → dist-Dih2A8fV.js} +1 -1
  66. package/dist/public/assets/{doc-paths-CeZpYfYr.js → doc-paths-DqJ_A_s7.js} +1 -1
  67. package/dist/public/assets/{documents-events-C6H3LrA9.js → documents-events-Ck8o2CoI.js} +1 -1
  68. package/dist/public/assets/{file-tree-adapter-DFyrX-92.js → file-tree-adapter-BaDVMyQN.js} +1 -1
  69. package/dist/public/assets/{file-tree-utils-C9zTW2_A.js → file-tree-utils-CEFaTYgx.js} +1 -1
  70. package/dist/public/assets/{folder-config-api-JwI3TW0L.js → folder-config-api-CRLsP3aa.js} +1 -1
  71. package/dist/public/assets/{follow-file-H_OOuojl.js → follow-file-ClytsNBG.js} +1 -1
  72. package/dist/public/assets/i18n-CxvtzbcF.js +1 -0
  73. package/dist/public/assets/{index-BXv4_oa9.js → index-CRykZfHv.js} +107 -107
  74. package/dist/public/assets/{lint-config-client-qKPmO3Qw.js → lint-config-client-Bpxmt15J.js} +1 -1
  75. package/dist/public/assets/markdownlint-rule-browser-B9wBZNA_.js +1 -0
  76. package/dist/public/assets/{mcp-consent-store-Bxq-u2M3.js → mcp-consent-store-lJGGM3y3.js} +1 -1
  77. package/dist/public/assets/{messages-DcmkySre.js → messages-08LuG7Yh.js} +1 -1
  78. package/dist/public/assets/{messages-C_U8ss6i.js → messages-8UNjn-wB.js} +1 -1
  79. package/dist/public/assets/{messages-Ce75_Ji3.js → messages-B1afcVKL.js} +1 -1
  80. package/dist/public/assets/{messages-C-9-pube.js → messages-B3B2uvAz.js} +1 -1
  81. package/dist/public/assets/{messages-BSrj3IKW.js → messages-B43p8sIM.js} +1 -1
  82. package/dist/public/assets/{messages-YKhV6ZL8.js → messages-BcNwTZn1.js} +1 -1
  83. package/dist/public/assets/{messages-D2dSy_ch.js → messages-Bry09IyM.js} +1 -1
  84. package/dist/public/assets/{messages-CyG8vSMs.js → messages-CKKI6mTk.js} +1 -1
  85. package/dist/public/assets/{messages-DavhhPbD.js → messages-CZ_qlZrG.js} +1 -1
  86. package/dist/public/assets/{messages-BsTQ5dHv.js → messages-CiQ4yQEj.js} +1 -1
  87. package/dist/public/assets/{messages-CH0H74g3.js → messages-DmnomFI2.js} +1 -1
  88. package/dist/public/assets/{messages-D7FYHWNu.js → messages-QLY9_S9X.js} +1 -1
  89. package/dist/public/assets/{navigation-targets-Du1yYMa3.js → navigation-targets-942ElqU6.js} +1 -1
  90. package/dist/public/assets/{open-managed-artifact-tab-DA0xFMQL.js → open-managed-artifact-tab-KzE_hPhn.js} +1 -1
  91. package/dist/public/assets/pending-receive-nav-store-CqtV9UvJ.js +1 -0
  92. package/dist/public/assets/{platform-labels-BW7YRK2j.js → platform-labels-C-SqHx4o.js} +1 -1
  93. package/dist/public/assets/{project-paths-xKaVJSAX.js → project-paths-BShAgBI2.js} +1 -1
  94. package/dist/public/assets/{prop-types-LyJPmVUN.js → prop-types-BxTZMSU2.js} +1 -1
  95. package/dist/public/assets/{receive-store-C7uwmgHL.js → receive-store-CcixohWp.js} +1 -1
  96. package/dist/public/assets/{selection-context-BJ7u_a2a.js → selection-context-Cwyx7sxG.js} +1 -1
  97. package/dist/public/assets/skill-actions-aU83p9hy.js +1 -0
  98. package/dist/public/assets/{skill-scope-41fjvVEv.js → skill-scope-BmcRzXKj.js} +1 -1
  99. package/dist/public/assets/{skills-api-BLsd0Xm0.js → skills-api-DYLAW1HV.js} +1 -1
  100. package/dist/public/assets/{src-TKA4AIQa.js → src-tib3hfpE.js} +1 -1
  101. package/dist/public/assets/{tag-pill-input-BBAkEv9f.js → tag-pill-input-BjL8aMcQ.js} +1 -1
  102. package/dist/public/assets/{target-navigation-intent-BxG_VSFm.js → target-navigation-intent-tYLsg509.js} +1 -1
  103. package/dist/public/assets/{terminal-cli-display-B3miHBqb.js → terminal-cli-display-CyCGNg1t.js} +1 -1
  104. package/dist/public/assets/{terminal-launch-events-D3Djrj2P.js → terminal-launch-events-B92DmpSo.js} +1 -1
  105. package/dist/public/assets/{terminal-telemetry-yDrCOyY3.js → terminal-telemetry-CPOwGHJS.js} +1 -1
  106. package/dist/public/assets/thread-client-rJFsjItr.js +1 -0
  107. package/dist/public/assets/{typing-burst-detector-BgFZQX05.js → typing-burst-detector-qsLXHCE-.js} +2 -2
  108. package/dist/public/assets/{uninstall-CFA5w-m5.js → uninstall-C4s7ZVBX.js} +1 -1
  109. package/dist/public/assets/{use-activity-panel-DPJJ75w9.js → use-activity-panel-DNBRkaVR.js} +1 -1
  110. package/dist/public/assets/{use-apply-config-color-theme-Eo0YlkiS.js → use-apply-config-color-theme-DonBpBNY.js} +1 -1
  111. package/dist/public/assets/{use-collab-url-DtfgRTLQ.js → use-collab-url-D_1xfAyN.js} +1 -1
  112. package/dist/public/assets/{use-live-xterm-theme-DSbS2g15.js → use-live-xterm-theme-Bq43Ad6a.js} +1 -1
  113. package/dist/public/assets/use-open-skill-BuExxEMB.js +1 -0
  114. package/dist/public/assets/{use-popular-skills-AdcFV1D_.js → use-popular-skills-PvU2WSqO.js} +1 -1
  115. package/dist/public/assets/{use-settings-route-B2jig6fs.js → use-settings-route-QaV_yXgj.js} +1 -1
  116. package/dist/public/assets/use-skill-origin-BwJcy3-O.js +1 -0
  117. package/dist/public/assets/{use-skills-Ct4t-6Ji.js → use-skills-2obCzXwU.js} +1 -1
  118. package/dist/public/assets/{use-terminal-enabled-DLCLwzPR.js → use-terminal-enabled-CnQiYBXk.js} +1 -1
  119. package/dist/public/assets/{use-timeline-entry-diff-B1RCXahh.js → use-timeline-entry-diff-DcgKaKLk.js} +1 -1
  120. package/dist/public/assets/{use-workspace-DXg_fDor.js → use-workspace-D9PQP2Ka.js} +1 -1
  121. package/dist/public/index.html +54 -54
  122. package/dist/public/uninstall.html +5 -5
  123. package/dist/{repair-launch-json-DjBHp3GO.mjs → repair-launch-json-BupFQtGx.mjs} +2 -2
  124. package/dist/{repair-mcp-configs-Buv3Zrg4.mjs → repair-mcp-configs-BZrsgW9o.mjs} +2 -2
  125. package/dist/repair-skills-BL2fDxUw.mjs +1 -0
  126. package/dist/{repair-skills-DC9YrDGX.mjs → repair-skills-CVxJr9ri.mjs} +2 -2
  127. package/dist/server-lock-Bii6_-R-.mjs +1 -0
  128. package/dist/{server-lock-xhUgHytn.mjs → server-lock-DyY8nPTr.mjs} +2 -2
  129. package/dist/{skill-teardown-DVWO087y.mjs → skill-teardown-DkXFhNS5.mjs} +2 -2
  130. package/dist/src-B4-XXkeg.mjs +1 -0
  131. package/dist/{src-BUjTbFVJ.mjs → src-Bh_IfeSA.mjs} +4 -4
  132. package/dist/{src-DT3BV-Jn.mjs → src-DXUB2UY6.mjs} +1 -1
  133. package/dist/src-ubDzLrbn.mjs +357 -0
  134. package/dist/{src-D5ZZydZi.mjs → src-vUi58oUc.mjs} +339 -339
  135. package/dist/start-CLOeqVCk.mjs +12 -0
  136. package/dist/start-D2rJg_FI.mjs +1 -0
  137. package/dist/{ui-D8O01OgQ.mjs → ui-CSG2PuL4.mjs} +3 -3
  138. package/dist/{write-project-skill-BufydPiH.mjs → write-project-skill-CQEMn_bx.mjs} +3 -3
  139. package/package.json +4 -4
  140. package/dist/constants-D2MyP7i6.mjs +0 -2
  141. package/dist/git-handle-CcWdc2o_.mjs +0 -1
  142. package/dist/init-2Ec6C4Ms.mjs +0 -1
  143. package/dist/loader-_4Bbb19n.mjs +0 -1
  144. package/dist/md-manager-30TBxbTV.mjs +0 -2
  145. package/dist/preview-BGDwyTxq.mjs +0 -1
  146. package/dist/public/assets/ActivityModeContent-Bh8PvwWR.js +0 -1
  147. package/dist/public/assets/ConsentDialogBody-ByUP5rlV.js +0 -2
  148. package/dist/public/assets/EditorModeToggle-BOtGsJ58.js +0 -1
  149. package/dist/public/assets/EnableSyncConfirmDialog-edPIQ6AO.js +0 -1
  150. package/dist/public/assets/FeedbackForm-B44dYSuT.js +0 -1
  151. package/dist/public/assets/ImportSkillDialog-BYZRPrHX.js +0 -1
  152. package/dist/public/assets/ManagedArtifactProperties-D35GmczH.js +0 -1
  153. package/dist/public/assets/ManagedArtifactProperties-N6SxoaQN.js +0 -1
  154. package/dist/public/assets/McpConsentDialogBody-Cdxs_Q-f.js +0 -1
  155. package/dist/public/assets/SchemaConfigEditor-4ELQUjOk.js +0 -1
  156. package/dist/public/assets/SessionsHost-CkCwV0Gg.js +0 -2
  157. package/dist/public/assets/ShareBranchSwitchDialog-BcO94wih.js +0 -1
  158. package/dist/public/assets/ShareReceiveDialog-tG5J08TH.js +0 -1
  159. package/dist/public/assets/ShareReceiveMissDialog-ClfobBlL.js +0 -1
  160. package/dist/public/assets/SlidesToolbarControls-Dtor0bv_.js +0 -1
  161. package/dist/public/assets/TimelineDiffPane-CT-ihYQ6.js +0 -2
  162. package/dist/public/assets/comment-chips-C9lD2NUl.js +0 -5
  163. package/dist/public/assets/i18n-BdQmUBxL.js +0 -1
  164. package/dist/public/assets/markdownlint-rule-browser-BNoonKhJ.js +0 -1
  165. package/dist/public/assets/pending-receive-nav-store-jTqdW3b0.js +0 -1
  166. package/dist/public/assets/skill-actions-CUghpMeW.js +0 -1
  167. package/dist/public/assets/thread-client-d5910s2I.js +0 -1
  168. package/dist/public/assets/use-open-skill-CmlgDEiD.js +0 -1
  169. package/dist/public/assets/use-skill-origin-DXe-gG8s.js +0 -1
  170. package/dist/repair-skills-BmR0xC0t.mjs +0 -1
  171. package/dist/server-lock-D-FV4bZf.mjs +0 -1
  172. package/dist/src-CCW4TQuz.mjs +0 -357
  173. package/dist/src-DhkOVDy0.mjs +0 -1
  174. package/dist/start-DYAQVmBt.mjs +0 -12
  175. package/dist/start-TwFD_icr.mjs +0 -1
  176. /package/dist/public/assets/{dist-CuH7ikCn.js → dist-CMZSEMCN2.js} +0 -0
  177. /package/dist/public/assets/{dist-DUfEoSbR.js → dist-CdT2fVlj.js} +0 -0
@@ -94,7 +94,7 @@
94
94
  -->
95
95
  <script>(() => { try { const raw = localStorage.getItem('ok-language-v1'); if (!raw) return; const o = JSON.parse(raw); if (typeof o?.locale !== 'string' || !/^[a-zA-Z]{2,8}(-[a-zA-Z0-9]{2,8})*$/.test(o.locale)) return; document.documentElement.lang = o.locale; document.documentElement.dir = o.dir === 'rtl' ? 'rtl' : 'ltr'; } catch {} })();</script>
96
96
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
97
- <script type="module" crossorigin src="./assets/index-BXv4_oa9.js"></script>
97
+ <script type="module" crossorigin src="./assets/index-CRykZfHv.js"></script>
98
98
  <link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
99
99
  <link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
100
100
  <link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
@@ -109,7 +109,7 @@
109
109
  <link rel="modulepreload" crossorigin href="./assets/dist-CcroL21Y.js">
110
110
  <link rel="modulepreload" crossorigin href="./assets/dist-DXX8qeXB.js">
111
111
  <link rel="modulepreload" crossorigin href="./assets/dist-C6Ya3WKC.js">
112
- <link rel="modulepreload" crossorigin href="./assets/dist-DUfEoSbR.js">
112
+ <link rel="modulepreload" crossorigin href="./assets/dist-CdT2fVlj.js">
113
113
  <link rel="modulepreload" crossorigin href="./assets/jsx-runtime-BUgB2tll.js">
114
114
  <link rel="modulepreload" crossorigin href="./assets/dist-Nvb76hAm.js">
115
115
  <link rel="modulepreload" crossorigin href="./assets/dist-mv8e6dBX.js">
@@ -120,7 +120,7 @@
120
120
  <link rel="modulepreload" crossorigin href="./assets/dist-BUJTePn0.js">
121
121
  <link rel="modulepreload" crossorigin href="./assets/dist-H0a1Kjgj.js">
122
122
  <link rel="modulepreload" crossorigin href="./assets/dist-PQ5KMVDh.js">
123
- <link rel="modulepreload" crossorigin href="./assets/DiffView-BbCF3n86.js">
123
+ <link rel="modulepreload" crossorigin href="./assets/DiffView-CjTilKZT.js">
124
124
  <link rel="modulepreload" crossorigin href="./assets/sortable.esm-CDKWbJHf.js">
125
125
  <link rel="modulepreload" crossorigin href="./assets/floating-ui.dom-Dk5WJYh0.js">
126
126
  <link rel="modulepreload" crossorigin href="./assets/trace-api-18gcBe0u.js">
@@ -128,13 +128,13 @@
128
128
  <link rel="modulepreload" crossorigin href="./assets/lib-B5SpBbcO.js">
129
129
  <link rel="modulepreload" crossorigin href="./assets/lib-C0Wr4O8I.js">
130
130
  <link rel="modulepreload" crossorigin href="./assets/markdownit-C1Squg6O.js">
131
- <link rel="modulepreload" crossorigin href="./assets/dist-BrL2bd3x.js">
132
- <link rel="modulepreload" crossorigin href="./assets/dist-CuH7ikCn.js">
133
- <link rel="modulepreload" crossorigin href="./assets/client-version-vyi1QvTS.js">
134
- <link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-Eo0YlkiS.js">
135
- <link rel="modulepreload" crossorigin href="./assets/messages-D7FYHWNu.js">
136
- <link rel="modulepreload" crossorigin href="./assets/i18n-BdQmUBxL.js">
137
- <link rel="modulepreload" crossorigin href="./assets/config-provider-D1oa8ar_.js">
131
+ <link rel="modulepreload" crossorigin href="./assets/dist-Dih2A8fV.js">
132
+ <link rel="modulepreload" crossorigin href="./assets/dist-CMZSEMCN2.js">
133
+ <link rel="modulepreload" crossorigin href="./assets/client-version-DvabycW5.js">
134
+ <link rel="modulepreload" crossorigin href="./assets/use-apply-config-color-theme-DonBpBNY.js">
135
+ <link rel="modulepreload" crossorigin href="./assets/messages-QLY9_S9X.js">
136
+ <link rel="modulepreload" crossorigin href="./assets/i18n-CxvtzbcF.js">
137
+ <link rel="modulepreload" crossorigin href="./assets/config-provider-DbAEDIve.js">
138
138
  <link rel="modulepreload" crossorigin href="./assets/dist-DsLZcVyZ.js">
139
139
  <link rel="modulepreload" crossorigin href="./assets/dist-DJUH3LhV.js">
140
140
  <link rel="modulepreload" crossorigin href="./assets/dist-CSCWMTfQ.js">
@@ -152,7 +152,7 @@
152
152
  <link rel="modulepreload" crossorigin href="./assets/dist-Be8lWZxP2.js">
153
153
  <link rel="modulepreload" crossorigin href="./assets/chevron-right-DqiGllBX.js">
154
154
  <link rel="modulepreload" crossorigin href="./assets/badge-BG5JKjNK.js">
155
- <link rel="modulepreload" crossorigin href="./assets/terminal-cli-display-B3miHBqb.js">
155
+ <link rel="modulepreload" crossorigin href="./assets/terminal-cli-display-CyCGNg1t.js">
156
156
  <link rel="modulepreload" crossorigin href="./assets/x-TZrEJhql.js">
157
157
  <link rel="modulepreload" crossorigin href="./assets/dialog-nnyEatfT.js">
158
158
  <link rel="modulepreload" crossorigin href="./assets/dropdown-menu-BSBcsSE_.js">
@@ -161,15 +161,15 @@
161
161
  <link rel="modulepreload" crossorigin href="./assets/sparkles-Dtcaakl0.js">
162
162
  <link rel="modulepreload" crossorigin href="./assets/cursor-C0OPTch1.js">
163
163
  <link rel="modulepreload" crossorigin href="./assets/copilot-DvJIKE2u.js">
164
- <link rel="modulepreload" crossorigin href="./assets/OpenInAgentMenuItem--c5Kl0UJ.js">
164
+ <link rel="modulepreload" crossorigin href="./assets/OpenInAgentMenuItem-8Fp3GsHg.js">
165
165
  <link rel="modulepreload" crossorigin href="./assets/mascot-outline-CtS592mc.js">
166
- <link rel="modulepreload" crossorigin href="./assets/AgentIconCluster-CjMEI-L4.js">
167
- <link rel="modulepreload" crossorigin href="./assets/documents-events-C6H3LrA9.js">
166
+ <link rel="modulepreload" crossorigin href="./assets/AgentIconCluster-B26uigRz.js">
167
+ <link rel="modulepreload" crossorigin href="./assets/documents-events-Ck8o2CoI.js">
168
168
  <link rel="modulepreload" crossorigin href="./assets/parse-api-error-DsopQ8yv.js">
169
- <link rel="modulepreload" crossorigin href="./assets/use-skills-Ct4t-6Ji.js">
170
- <link rel="modulepreload" crossorigin href="./assets/skill-scope-41fjvVEv.js">
171
- <link rel="modulepreload" crossorigin href="./assets/skills-api-BLsd0Xm0.js">
172
- <link rel="modulepreload" crossorigin href="./assets/SkillInstallMenu-B2HRT0pR.js">
169
+ <link rel="modulepreload" crossorigin href="./assets/use-skills-2obCzXwU.js">
170
+ <link rel="modulepreload" crossorigin href="./assets/skill-scope-BmcRzXKj.js">
171
+ <link rel="modulepreload" crossorigin href="./assets/skills-api-DYLAW1HV.js">
172
+ <link rel="modulepreload" crossorigin href="./assets/SkillInstallMenu-y2A7W0zZ.js">
173
173
  <link rel="modulepreload" crossorigin href="./assets/minus-D3ML2bZy.js">
174
174
  <link rel="modulepreload" crossorigin href="./assets/checkbox-DBNdWraq.js">
175
175
  <link rel="modulepreload" crossorigin href="./assets/collapsible-COrqeoHr.js">
@@ -186,49 +186,49 @@
186
186
  <link rel="modulepreload" crossorigin href="./assets/switch-DUVQoPKU.js">
187
187
  <link rel="modulepreload" crossorigin href="./assets/folder-open-Bfm34rs_.js">
188
188
  <link rel="modulepreload" crossorigin href="./assets/trash-2-WO7AZxJK.js">
189
- <link rel="modulepreload" crossorigin href="./assets/file-tree-utils-C9zTW2_A.js">
190
- <link rel="modulepreload" crossorigin href="./assets/doc-paths-CeZpYfYr.js">
191
- <link rel="modulepreload" crossorigin href="./assets/navigation-targets-Du1yYMa3.js">
189
+ <link rel="modulepreload" crossorigin href="./assets/file-tree-utils-CEFaTYgx.js">
190
+ <link rel="modulepreload" crossorigin href="./assets/doc-paths-DqJ_A_s7.js">
191
+ <link rel="modulepreload" crossorigin href="./assets/navigation-targets-942ElqU6.js">
192
192
  <link rel="modulepreload" crossorigin href="./assets/asset-dispatch-CdZ_--jl.js">
193
193
  <link rel="modulepreload" crossorigin href="./assets/external-link-B4qPZwve.js">
194
194
  <link rel="modulepreload" crossorigin href="./assets/documents-fetch-Bw4lKnRN.js">
195
- <link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-Bj9gYc9v.js">
195
+ <link rel="modulepreload" crossorigin href="./assets/CodeMirrorPropInput-DN3nqPPS.js">
196
196
  <link rel="modulepreload" crossorigin href="./assets/git-branch-B39aVIqr.js">
197
197
  <link rel="modulepreload" crossorigin href="./assets/triangle-alert-BggXGlON.js">
198
198
  <link rel="modulepreload" crossorigin href="./assets/Mermaid-DnS07V7q.js">
199
199
  <link rel="modulepreload" crossorigin href="./assets/CopyButton-Y3fFETes.js">
200
200
  <link rel="modulepreload" crossorigin href="./assets/startup-marks-C-jXs38n.js">
201
- <link rel="modulepreload" crossorigin href="./assets/prop-types-LyJPmVUN.js">
201
+ <link rel="modulepreload" crossorigin href="./assets/prop-types-BxTZMSU2.js">
202
202
  <link rel="modulepreload" crossorigin href="./assets/eye-CJwghMeG.js">
203
203
  <link rel="modulepreload" crossorigin href="./assets/hash-tW-4HCbb.js">
204
204
  <link rel="modulepreload" crossorigin href="./assets/info-Bl3lijUw.js">
205
205
  <link rel="modulepreload" crossorigin href="./assets/paperclip-Bws3FN-W.js">
206
206
  <link rel="modulepreload" crossorigin href="./assets/file-tree-rename-validation-B1y2EY3V.js">
207
207
  <link rel="modulepreload" crossorigin href="./assets/input-ugdhJ7_C.js">
208
- <link rel="modulepreload" crossorigin href="./assets/use-collab-url-DtfgRTLQ.js">
209
- <link rel="modulepreload" crossorigin href="./assets/DocumentContext-CM98n-Wm.js">
208
+ <link rel="modulepreload" crossorigin href="./assets/use-collab-url-D_1xfAyN.js">
209
+ <link rel="modulepreload" crossorigin href="./assets/DocumentContext-CGXxK5Nq.js">
210
210
  <link rel="modulepreload" crossorigin href="./assets/workspace-paths-cI9sw7pJ.js">
211
- <link rel="modulepreload" crossorigin href="./assets/follow-file-H_OOuojl.js">
211
+ <link rel="modulepreload" crossorigin href="./assets/follow-file-ClytsNBG.js">
212
212
  <link rel="modulepreload" crossorigin href="./assets/format-Emq-O2KE.js">
213
213
  <link rel="modulepreload" crossorigin href="./assets/braces-B_NsFC8x.js">
214
- <link rel="modulepreload" crossorigin href="./assets/PropertyDisplayRow-JWrzMen3.js">
215
- <link rel="modulepreload" crossorigin href="./assets/folder-config-api-JwI3TW0L.js">
216
- <link rel="modulepreload" crossorigin href="./assets/comment-chips-C9lD2NUl.js">
217
- <link rel="modulepreload" crossorigin href="./assets/SkillCostValue-XTEKNDJI.js">
214
+ <link rel="modulepreload" crossorigin href="./assets/PropertyDisplayRow-CgwKdqZo.js">
215
+ <link rel="modulepreload" crossorigin href="./assets/folder-config-api-CRLsP3aa.js">
216
+ <link rel="modulepreload" crossorigin href="./assets/comment-chips-DQFCvweV.js">
217
+ <link rel="modulepreload" crossorigin href="./assets/SkillCostValue-D_6C2Gog.js">
218
218
  <link rel="modulepreload" crossorigin href="./assets/textarea-DUUB26q7.js">
219
- <link rel="modulepreload" crossorigin href="./assets/selection-context-BJ7u_a2a.js">
220
- <link rel="modulepreload" crossorigin href="./assets/lint-config-client-qKPmO3Qw.js">
221
- <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-N6SxoaQN.js">
222
- <link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-edPIQ6AO.js">
219
+ <link rel="modulepreload" crossorigin href="./assets/selection-context-Cwyx7sxG.js">
220
+ <link rel="modulepreload" crossorigin href="./assets/lint-config-client-Bpxmt15J.js">
221
+ <link rel="modulepreload" crossorigin href="./assets/ManagedArtifactProperties-Dhv2wo_H.js">
222
+ <link rel="modulepreload" crossorigin href="./assets/EnableSyncConfirmDialog-Dh1Rcy3o.js">
223
223
  <link rel="modulepreload" crossorigin href="./assets/arrow-up-right-B6g1TsCZ.js">
224
224
  <link rel="modulepreload" crossorigin href="./assets/RegisteredAgentIcon-1Im2_iCi.js">
225
225
  <link rel="modulepreload" crossorigin href="./assets/list-plus-BWxtMT1R.js">
226
- <link rel="modulepreload" crossorigin href="./assets/use-open-skill-CmlgDEiD.js">
227
- <link rel="modulepreload" crossorigin href="./assets/use-settings-route-B2jig6fs.js">
228
- <link rel="modulepreload" crossorigin href="./assets/platform-labels-BW7YRK2j.js">
226
+ <link rel="modulepreload" crossorigin href="./assets/use-open-skill-BuExxEMB.js">
227
+ <link rel="modulepreload" crossorigin href="./assets/use-settings-route-QaV_yXgj.js">
228
+ <link rel="modulepreload" crossorigin href="./assets/platform-labels-C-SqHx4o.js">
229
229
  <link rel="modulepreload" crossorigin href="./assets/clipboard-adapter-CFR1gCwy.js">
230
- <link rel="modulepreload" crossorigin href="./assets/use-workspace-DXg_fDor.js">
231
- <link rel="modulepreload" crossorigin href="./assets/skill-actions-CUghpMeW.js">
230
+ <link rel="modulepreload" crossorigin href="./assets/use-workspace-D9PQP2Ka.js">
231
+ <link rel="modulepreload" crossorigin href="./assets/skill-actions-aU83p9hy.js">
232
232
  <link rel="modulepreload" crossorigin href="./assets/case-sensitive-C4czbdYN.js">
233
233
  <link rel="modulepreload" crossorigin href="./assets/chevron-left-D8l17VJB.js">
234
234
  <link rel="modulepreload" crossorigin href="./assets/lint-plugin-meta-CH3fh32I.js">
@@ -236,40 +236,40 @@
236
236
  <link rel="modulepreload" crossorigin href="./assets/wrench-qT-7Zadz.js">
237
237
  <link rel="modulepreload" crossorigin href="./assets/panel-CRIdNIdp.js">
238
238
  <link rel="modulepreload" crossorigin href="./assets/skeleton-K2ZdFNLJ.js">
239
- <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-BgFZQX05.js">
239
+ <link rel="modulepreload" crossorigin href="./assets/typing-burst-detector-qsLXHCE-.js">
240
240
  <link rel="modulepreload" crossorigin href="./assets/download-DKhK0dw_.js">
241
241
  <link rel="modulepreload" crossorigin href="./assets/field-Bw53G3ah.js">
242
- <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-BrvpmLJN.js">
242
+ <link rel="modulepreload" crossorigin href="./assets/auth-state-cache-CI9zNqOf.js">
243
243
  <link rel="modulepreload" crossorigin href="./assets/miss-dialog-store-Bg_8lUxq.js">
244
- <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-jTqdW3b0.js">
245
- <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-BxG_VSFm.js">
244
+ <link rel="modulepreload" crossorigin href="./assets/pending-receive-nav-store-CqtV9UvJ.js">
245
+ <link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-tYLsg509.js">
246
246
  <link rel="modulepreload" crossorigin href="./assets/history-D7rmYI6s.js">
247
- <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-DA0xFMQL.js">
248
- <link rel="modulepreload" crossorigin href="./assets/use-popular-skills-AdcFV1D_.js">
247
+ <link rel="modulepreload" crossorigin href="./assets/open-managed-artifact-tab-KzE_hPhn.js">
248
+ <link rel="modulepreload" crossorigin href="./assets/use-popular-skills-PvU2WSqO.js">
249
249
  <link rel="modulepreload" crossorigin href="./assets/panel-right-open-BzQvZ086.js">
250
- <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-D3Djrj2P.js">
250
+ <link rel="modulepreload" crossorigin href="./assets/terminal-launch-events-B92DmpSo.js">
251
251
  <link rel="modulepreload" crossorigin href="./assets/square-pen-Bybtom5U.js">
252
252
  <link rel="modulepreload" crossorigin href="./assets/undo-2-B1iI1RfY.js">
253
253
  <link rel="modulepreload" crossorigin href="./assets/form-QX1Bh2Dl.js">
254
254
  <link rel="modulepreload" crossorigin href="./assets/text-viewer-languages-BS5OVIGh.js">
255
- <link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-BOtGsJ58.js">
255
+ <link rel="modulepreload" crossorigin href="./assets/EditorModeToggle-CJjixYVK.js">
256
256
  <link rel="modulepreload" crossorigin href="./assets/ConfigSharingInfoTooltip-7wXHTzhm.js">
257
- <link rel="modulepreload" crossorigin href="./assets/project-paths-xKaVJSAX.js">
257
+ <link rel="modulepreload" crossorigin href="./assets/project-paths-BShAgBI2.js">
258
258
  <link rel="modulepreload" crossorigin href="./assets/SkillModeBanner-Bi6kEaMZ.js">
259
259
  <link rel="modulepreload" crossorigin href="./assets/app-menubar-gate-zKiZq6xA.js">
260
- <link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-DFyrX-92.js">
260
+ <link rel="modulepreload" crossorigin href="./assets/file-tree-adapter-BaDVMyQN.js">
261
261
  <link rel="modulepreload" crossorigin href="./assets/terminal-command-events-BfmJTjba.js">
262
262
  <link rel="modulepreload" crossorigin href="./assets/agent-diff-store-CKEwkZK6.js">
263
- <link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-DSbS2g15.js">
263
+ <link rel="modulepreload" crossorigin href="./assets/use-live-xterm-theme-Bq43Ad6a.js">
264
264
  <link rel="modulepreload" crossorigin href="./assets/input-group-Bn5HsYyf.js">
265
265
  <link rel="modulepreload" crossorigin href="./assets/use-installed-clis-Dcwl9RUZ.js">
266
- <link rel="modulepreload" crossorigin href="./assets/use-skill-origin-DXe-gG8s.js">
267
- <link rel="modulepreload" crossorigin href="./assets/terminal-telemetry-yDrCOyY3.js">
266
+ <link rel="modulepreload" crossorigin href="./assets/use-skill-origin-BwJcy3-O.js">
267
+ <link rel="modulepreload" crossorigin href="./assets/terminal-telemetry-CPOwGHJS.js">
268
268
  <link rel="modulepreload" crossorigin href="./assets/agent-presence-DVnQm9a4.js">
269
269
  <link rel="modulepreload" crossorigin href="./assets/auth-prompt-store-BVCOOr4Z.js">
270
- <link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-Bxq-u2M3.js">
270
+ <link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-lJGGM3y3.js">
271
271
  <link rel="modulepreload" crossorigin href="./assets/overlay-layers-Bj-TVfKw.js">
272
- <link rel="modulepreload" crossorigin href="./assets/receive-store-C7uwmgHL.js">
272
+ <link rel="modulepreload" crossorigin href="./assets/receive-store-CcixohWp.js">
273
273
  <link rel="modulepreload" crossorigin href="./assets/timeline-diff-store-yWTwVhRT.js">
274
274
  <link rel="stylesheet" crossorigin href="./assets/globals-CyRfFhRe.css">
275
275
  <link rel="stylesheet" crossorigin href="./assets/DocumentContext-B0sQn39F.css">
@@ -32,7 +32,7 @@
32
32
  script above.
33
33
  -->
34
34
  <style>html { background-color: #fafafa } html.dark { background-color: #171717 }</style>
35
- <script type="module" crossorigin src="./assets/uninstall-CFA5w-m5.js"></script>
35
+ <script type="module" crossorigin src="./assets/uninstall-C4s7ZVBX.js"></script>
36
36
  <link rel="modulepreload" crossorigin href="./assets/chunk-CYidjpOJ.js">
37
37
  <link rel="modulepreload" crossorigin href="./assets/react-f2sANaYj.js">
38
38
  <link rel="modulepreload" crossorigin href="./assets/react-dom-DPxgxlDT.js">
@@ -44,8 +44,8 @@
44
44
  <link rel="modulepreload" crossorigin href="./assets/lib-C0Wr4O8I.js">
45
45
  <link rel="modulepreload" crossorigin href="./assets/markdownit-C1Squg6O.js">
46
46
  <link rel="modulepreload" crossorigin href="./assets/w3c-keyname-Bw5giFqP.js">
47
- <link rel="modulepreload" crossorigin href="./assets/dist-BrL2bd3x.js">
48
- <link rel="modulepreload" crossorigin href="./assets/dist-DUfEoSbR.js">
47
+ <link rel="modulepreload" crossorigin href="./assets/dist-Dih2A8fV.js">
48
+ <link rel="modulepreload" crossorigin href="./assets/dist-CdT2fVlj.js">
49
49
  <link rel="modulepreload" crossorigin href="./assets/jsx-runtime-BUgB2tll.js">
50
50
  <link rel="modulepreload" crossorigin href="./assets/dist-Nvb76hAm.js">
51
51
  <link rel="modulepreload" crossorigin href="./assets/dist-mv8e6dBX.js">
@@ -68,8 +68,8 @@
68
68
  <link rel="modulepreload" crossorigin href="./assets/badge-BG5JKjNK.js">
69
69
  <link rel="modulepreload" crossorigin href="./assets/input-ugdhJ7_C.js">
70
70
  <link rel="modulepreload" crossorigin href="./assets/textarea-DUUB26q7.js">
71
- <link rel="modulepreload" crossorigin href="./assets/messages-D7FYHWNu.js">
72
- <link rel="modulepreload" crossorigin href="./assets/i18n-BdQmUBxL.js">
71
+ <link rel="modulepreload" crossorigin href="./assets/messages-QLY9_S9X.js">
72
+ <link rel="modulepreload" crossorigin href="./assets/i18n-CxvtzbcF.js">
73
73
  <link rel="stylesheet" crossorigin href="./assets/globals-CyRfFhRe.css">
74
74
  </head>
75
75
 
@@ -1,2 +1,2 @@
1
- import{t as e}from"./launch-json-removal-CczI_AQw.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
- //# sourceMappingURL=repair-launch-json-DjBHp3GO.mjs.map
1
+ import{t as e}from"./launch-json-removal-BiK2fLSM.mjs";import{join as t}from"node:path";function n(n){let i=n.logger??r,a=t(n.projectDir,`.claude`,`launch.json`);if(n.reclaimDisableEnv===`1`)return i({event:`launch-json-repair-skipped`,reason:`reclaim-disabled`}),{outcome:{configPath:a,outcome:`skipped-reclaim-disabled`},repairedCount:0};let o;try{o=e(n.projectDir)}catch(e){let t=e instanceof Error?e.message:String(e);return i({event:`launch-json-repair-write-failed`,configPath:a}),{outcome:{configPath:a,outcome:`write-failed`,error:t},repairedCount:0}}let s=o.kind===`removed`||o.kind===`removed-file`;return s&&i({event:`launch-json-repair-removed`,configPath:a}),{outcome:{configPath:a,outcome:o.kind},repairedCount:+!!s}}function r(e){process.stderr.write(`${JSON.stringify(e)}\n`)}export{n as repairLaunchJson};
2
+ //# sourceMappingURL=repair-launch-json-BupFQtGx.mjs.map
@@ -1,2 +1,2 @@
1
- import{i as e,o as t,p as n}from"./write-project-skill-BufydPiH.mjs";import{d as r,v as i}from"./init-CgzZMWZN.mjs";import{t as a}from"./mcp-migrate-event-B1gJf6bG.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 e){let e=t[o],s=c(()=>e.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:e,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),e.projectConfigPath){let t=e.projectConfigPath,i=c(()=>t(n.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:e,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-Buv3Zrg4.mjs.map
1
+ import{i as e,o as t,p as n}from"./write-project-skill-CQEMn_bx.mjs";import{d as r,v as i}from"./init-DJX9zKiO.mjs";import{t as a}from"./mcp-migrate-event-B1gJf6bG.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 e){let e=t[o],s=c(()=>e.configPath(``,i));if(s!==null&&a.push(l({scope:`user`,editorId:o,target:e,home:i,cwd:``,configPath:s,configPathOverride:void 0,logger:r})),e.projectConfigPath){let t=e.projectConfigPath,i=c(()=>t(n.projectDir));i!==null&&a.push(l({scope:`project`,editorId:o,target:e,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-BZrsgW9o.mjs.map
@@ -0,0 +1 @@
1
+ import{t as e}from"./repair-skills-CVxJr9ri.mjs";export{e as repairSkills};
@@ -1,4 +1,4 @@
1
- import{W as e,ks as t}from"./src-CCW4TQuz.mjs";import{Tr as n,br as r,hr as i,lr as a,mr as o,pr as s,ur as c,vr as l,wr as u}from"./src-D5ZZydZi.mjs";import{o as d,s as f,t as p,v as m}from"./write-project-skill-BufydPiH.mjs";import{n as h,s as g,t as _}from"./colors-BsmVIwfM.mjs";import{n as v,r as y,t as b}from"./skill-teardown-DVWO087y.mjs";import{dirname as x,join as S,relative as C,resolve as w}from"node:path";import{existsSync as T,mkdirSync as E,readFileSync as D,readdirSync as O,rmSync as k,statSync as A,writeFileSync as j}from"node:fs";import{homedir as M}from"node:os";import{createInterface as N}from"node:readline/promises";const P={existsSync:e=>T(e),isDirectory:e=>{try{return A(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>O(e),readFileSync:e=>D(e),writeFileSync:(e,t)=>{j(e,t)},mkdirSync:(e,t)=>{E(e,t)},rmSync:(e,t)=>{k(e,t)}},F={resolveProjectBundledSkillDir:()=>r(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>r(e,{checkDesktop:!1}),readBundledVersion:()=>c(),readRecordedVersion:e=>s(e,`cli-hosts`),writeRecordedVersion:(e,t)=>i(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>l(e),readBundleDecision:(e,t)=>a(e,t),writeBundleDecision:(e,t,n)=>o(e,t,n),removeBundleFromDisk:(e,t)=>y(e,t)};function I(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function L(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(x(t),{recursive:!0}),R(e,t,n)}function R(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=S(e,r),a=S(t,r);n.isDirectory(i)?R(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function z(e,n,r){return r.existsSync(S(e,`.agents`,`skills`,n))||t.some(t=>r.existsSync(S(e,t.skillsRoot,n)))}function B(e,n,r,i,a,o){let s=[],c=S(e,`.agents`,`skills`,n),l=i.existsSync(S(e,`.agents`));if(l&&i.existsSync(c))s.push({kind:`central`,path:c,outcome:`skipped-present`});else if(l)try{L(r,c,i),s.push({kind:`central`,path:c,outcome:`written`}),a({event:`user-skill-reclaim-central-written`,scope:`user`,path:c,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`central`,path:c,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-central-failed`,scope:`user`,path:c,error:t})}for(let l of t){let t=S(e,l.hostDir),u=S(e,l.skillsRoot,n);if(u===c){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!i.existsSync(t)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(i.existsSync(u)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-present`});continue}try{L(r,u,i),s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`written`}),a({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,error:t})}}return{entries:s,anyWritten:s.some(e=>e.outcome===`written`),anyDestinationSucceeded:s.some(e=>e.outcome===`written`||e.outcome===`skipped-present`)}}function V(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function H(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 f){let o=S(e,t.hostDir,`skills`,`open-knowledge`),s=S(o,`SKILL.md`);if(n.existsSync(s)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`present`});continue}let c=d[t.editorId]?.projectConfigPath?.(e);if(!V(c,n)){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{p(o,e),L(i,o,n),a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`created`}),r({event:`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 U(t,r,i,a){let o=e=>{r.recordEvent(e).catch(()=>{})},s=()=>new Date().toISOString(),c;try{c=await r.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}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let l;try{l=await r.readRecordedVersion(t)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),l=null}let d=[],f=null;for(let e of n)try{d.push({id:e,sourceDir:r.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`}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let n of d){let o=u[n.id],s=z(t,o,i),c=await r.readBundleDecision(t,o).catch(()=>null);if(!e(c,{installedOnDisk:s})){if(s)try{r.removeBundleFromDisk(t,n.id),a({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:n.id})}catch(e){a({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:n.id,error:e instanceof Error?e.message:String(e)})}continue}if(c===null&&s)try{await r.writeBundleDecision(t,o,!0)}catch(e){a({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:n.id,error:e instanceof Error?e.message:String(e)})}p.push(n)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(e=>z(t,u[e.id],i));if(l!==null&&l===c&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:c}),{outcome:`skipped`,reason:`version-current`};let h=[],g=d.length===n.length,_=[];for(let{id:e,sourceDir:n}of p){let r=B(t,u[e],n,i,a,c);h.push(...r.entries),_.push({id:e,anyWritten:r.anyWritten,landed:r.anyDestinationSucceeded,centralFailed:r.entries.some(e=>e.kind===`central`&&e.outcome===`failed`),hostFailed:r.entries.some(e=>e.kind===`host`&&e.outcome===`failed`)})}let v=_.some(e=>e.centralFailed),y=_.every(e=>e.landed);if(g&&y&&!v){let e=null;try{await r.writeRecordedVersion(t,c),a({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:c})}catch(t){e=t instanceof Error?t.message:String(t),a({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:c,error:e})}for(let{id:t,anyWritten:n}of _)o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:t,outcome:e===null?n?`installed`:`skip-current`:`failed`,version:c,...e===null?{}:{reason:`state-write-failed:${e}`}})}else{g||o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:c,reason:`bundle-unresolved`});for(let{id:e,centralFailed:t,hostFailed:n}of _)!t&&!n||o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:e,outcome:`failed`,version:c,reason:n?`all-writes-failed`:`central-write-failed`})}return{outcome:`done`,version:c,entries:h}}async function W(e){let t=e.logger??I,n=e.fs??P,r=e.home??M(),i={...F,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=H(e.projectDir,i,n,t),o=await U(r,i,n,t),s=v(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=b(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 G(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 K(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`present`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} present, ${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`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-present`).length,i=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,a=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} present, ${i} skipped, ${a} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
1
+ import{As as e,W as t}from"./src-ubDzLrbn.mjs";import{Tr as n,br as r,hr as i,lr as a,mr as o,pr as s,ur as c,vr as l,wr as u}from"./src-vUi58oUc.mjs";import{o as d,s as f,t as p,v as m}from"./write-project-skill-CQEMn_bx.mjs";import{n as h,s as g,t as _}from"./colors-BsmVIwfM.mjs";import{n as v,r as y,t as b}from"./skill-teardown-DkXFhNS5.mjs";import{dirname as x,join as S,relative as C,resolve as w}from"node:path";import{existsSync as T,mkdirSync as E,readFileSync as D,readdirSync as O,rmSync as k,statSync as A,writeFileSync as j}from"node:fs";import{homedir as M}from"node:os";import{createInterface as N}from"node:readline/promises";const P={existsSync:e=>T(e),isDirectory:e=>{try{return A(e).isDirectory()}catch(e){if(e.code===`ENOENT`)return!1;throw e}},readdirSync:e=>O(e),readFileSync:e=>D(e),writeFileSync:(e,t)=>{j(e,t)},mkdirSync:(e,t)=>{E(e,t)},rmSync:(e,t)=>{k(e,t)}},F={resolveProjectBundledSkillDir:()=>r(`project`,{checkDesktop:!1}),resolveUserBundledSkillDir:e=>r(e,{checkDesktop:!1}),readBundledVersion:()=>c(),readRecordedVersion:e=>s(e,`cli-hosts`),writeRecordedVersion:(e,t)=>i(e,`cli-hosts`,t,`cli-start`),recordEvent:e=>l(e),readBundleDecision:(e,t)=>a(e,t),writeBundleDecision:(e,t,n)=>o(e,t,n),removeBundleFromDisk:(e,t)=>y(e,t)};function I(e){process.stderr.write(`${JSON.stringify(e)}\n`)}function L(e,t,n){n.rmSync(t,{recursive:!0,force:!0}),n.mkdirSync(x(t),{recursive:!0}),R(e,t,n)}function R(e,t,n){n.mkdirSync(t,{recursive:!0});for(let r of n.readdirSync(e)){let i=S(e,r),a=S(t,r);n.isDirectory(i)?R(i,a,n):n.writeFileSync(a,n.readFileSync(i))}}function z(t,n,r){return r.existsSync(S(t,`.agents`,`skills`,n))||e.some(e=>r.existsSync(S(t,e.skillsRoot,n)))}function B(t,n,r,i,a,o){let s=[],c=S(t,`.agents`,`skills`,n),l=i.existsSync(S(t,`.agents`));if(l&&i.existsSync(c))s.push({kind:`central`,path:c,outcome:`skipped-present`});else if(l)try{L(r,c,i),s.push({kind:`central`,path:c,outcome:`written`}),a({event:`user-skill-reclaim-central-written`,scope:`user`,path:c,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`central`,path:c,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-central-failed`,scope:`user`,path:c,error:t})}for(let l of e){let e=S(t,l.hostDir),u=S(t,l.skillsRoot,n);if(u===c){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-collapsed-with-central`});continue}if(!i.existsSync(e)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-host-absent`});continue}if(i.existsSync(u)){s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`skipped-present`});continue}try{L(r,u,i),s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`written`}),a({event:`user-skill-reclaim-host-written`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,preexisting:!1,version:o})}catch(e){let t=e instanceof Error?e.message:String(e);s.push({kind:`host`,editorId:l.editorId,hostDir:l.hostDir,path:u,outcome:`failed`,error:t}),a({event:`user-skill-reclaim-host-failed`,scope:`user`,editorId:l.editorId,hostDir:l.hostDir,path:u,error:t})}}return{entries:s,anyWritten:s.some(e=>e.outcome===`written`),anyDestinationSucceeded:s.some(e=>e.outcome===`written`||e.outcome===`skipped-present`)}}function V(e,t){if(!e)return!1;try{return t.existsSync(e)?t.readFileSync(e).toString(`utf8`).includes(`# ok-mcp-`):!1}catch{return!1}}function H(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 f){let o=S(e,t.hostDir,`skills`,`open-knowledge`),s=S(o,`SKILL.md`);if(n.existsSync(s)){a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`present`});continue}let c=d[t.editorId]?.projectConfigPath?.(e);if(!V(c,n)){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{p(o,e),L(i,o,n),a.push({editorId:t.editorId,hostDir:t.hostDir,path:o,outcome:`created`}),r({event:`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 U(e,r,i,a){let o=e=>{r.recordEvent(e).catch(()=>{})},s=()=>new Date().toISOString(),c;try{c=await r.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}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:`discovery`,outcome:`failed`,reason:`version-read-failed:${t}`}),{outcome:`skipped`,reason:`version-read-failed`}}let l;try{l=await r.readRecordedVersion(e)}catch(e){a({event:`user-skill-reclaim-version-read-error`,scope:`user`,error:e instanceof Error?e.message:String(e)}),l=null}let d=[],f=null;for(let e of n)try{d.push({id:e,sourceDir:r.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`}),o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,reason:`bundle-missing:${f}`}),{outcome:`skipped`,reason:`bundle-missing`};let p=[];for(let n of d){let o=u[n.id],s=z(e,o,i),c=await r.readBundleDecision(e,o).catch(()=>null);if(!t(c,{installedOnDisk:s})){if(s)try{r.removeBundleFromDisk(e,n.id),a({event:`user-skill-reclaim-bundle-declined-removed`,scope:`user`,bundle:n.id})}catch(e){a({event:`user-skill-reclaim-bundle-remove-failed`,scope:`user`,bundle:n.id,error:e instanceof Error?e.message:String(e)})}continue}if(c===null&&s)try{await r.writeBundleDecision(e,o,!0)}catch(e){a({event:`user-skill-reclaim-grandfather-write-failed`,scope:`user`,bundle:n.id,error:e instanceof Error?e.message:String(e)})}p.push(n)}if(p.length===0)return{outcome:`skipped`,reason:`all-bundles-declined`};let m=p.every(t=>z(e,u[t.id],i));if(l!==null&&l===c&&m)return a({event:`user-skill-reclaim-skipped-version-current`,scope:`user`,version:c}),{outcome:`skipped`,reason:`version-current`};let h=[],g=d.length===n.length,_=[];for(let{id:t,sourceDir:n}of p){let r=B(e,u[t],n,i,a,c);h.push(...r.entries),_.push({id:t,anyWritten:r.anyWritten,landed:r.anyDestinationSucceeded,centralFailed:r.entries.some(e=>e.kind===`central`&&e.outcome===`failed`),hostFailed:r.entries.some(e=>e.kind===`host`&&e.outcome===`failed`)})}let v=_.some(e=>e.centralFailed),y=_.every(e=>e.landed);if(g&&y&&!v){let t=null;try{await r.writeRecordedVersion(e,c),a({event:`user-skill-reclaim-version-recorded`,scope:`user`,version:c})}catch(e){t=e instanceof Error?e.message:String(e),a({event:`user-skill-reclaim-version-record-failed`,scope:`user`,version:c,error:t})}for(let{id:e,anyWritten:n}of _)o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:e,outcome:t===null?n?`installed`:`skip-current`:`failed`,version:c,...t===null?{}:{reason:`state-write-failed:${t}`}})}else{g||o({ts:s(),surface:`cli-start`,target:`cli-hosts`,outcome:`failed`,version:c,reason:`bundle-unresolved`});for(let{id:e,centralFailed:t,hostFailed:n}of _)!t&&!n||o({ts:s(),surface:`cli-start`,target:`cli-hosts`,bundle:e,outcome:`failed`,version:c,reason:n?`all-writes-failed`:`central-write-failed`})}return{outcome:`done`,version:c,entries:h}}async function W(e){let t=e.logger??I,n=e.fs??P,r=e.home??M(),i={...F,...e.deps};if(e.reclaimDisableEnv===`1`)return t({event:`skill-repair-skipped`,reason:`reclaim-disabled`}),{status:`skipped`,reason:`reclaim-disabled`};let a=H(e.projectDir,i,n,t),o=await U(r,i,n,t),s=v(r),c=[],l=!1,u=!1;if(s.skillDirs.length>0||s.emptyDirs.length>0)if(e.confirmLegacyCleanup&&await e.confirmLegacyCleanup(s)){try{c=b(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 G(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 K(e){if(e.status===`skipped`)return`Skipped: ${e.reason}`;let t=[`Skill reclaim complete.`];if(e.project.outcome===`done`){let n=e.project.entries.filter(e=>e.outcome===`present`).length,r=e.project.entries.filter(e=>e.outcome===`created`).length,i=e.project.entries.filter(e=>e.outcome===`no-token`).length,a=e.project.entries.filter(e=>e.outcome===`failed`).length;t.push(` Project: ${n} present, ${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`).length,r=e.user.entries.filter(e=>e.outcome===`skipped-present`).length,i=e.user.entries.filter(e=>e.outcome===`skipped-host-absent`||e.outcome===`skipped-collapsed-with-central`).length,a=e.user.entries.filter(e=>e.outcome===`failed`).length;t.push(` User (${e.user.version}): ${n} written, ${r} present, ${i} skipped, ${a} failed.`)}else t.push(` User: skipped (${e.user.reason}).`);return e.legacySwept.length>0?t.push(` Cleanup: removed ${e.legacySwept.length} path(s) from a pre-0.42 install.`):e.legacyCleanupFailed?t.push(` Cleanup: failed — see logs; pre-0.42 directories left in place.`):e.legacyCleanupDeclined&&t.push(` Cleanup: declined — pre-0.42 directories left in place.`),t.join(`
2
2
  `)}function q(){return new m(`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 W({projectDir:w(process.cwd()),reclaimDisableEnv:process.env.OK_RECLAIM_DISABLE??null,confirmLegacyCleanup:t=>J(t,{yes:e.yes===!0})});process.stdout.write(`${K(t)}\n`),process.exitCode=G(t)})}async function J(e,t){let n=M(),r=e=>`~/${C(n,e)}`,i=t.input??process.stdin,a=[``,_(`A previous version of OpenKnowledge installed its skill into agent tools you may never have used.`),h(`(Versions before 0.42 wrote to every host a third-party installer knew about — see issue #820.)`)];if(e.skillDirs.length>0&&a.push(``,`${_(`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(``,`${_(t)} ${e.emptyDirs.length}`,...e.emptyDirs.map(e=>` ${r(e)}`))}if(a.push(``,h(`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(`${g("Not a terminal — skipping cleanup. Re-run with `ok repair-skills --yes` to remove these.")}\n`),!1;let o=N({input:i,output:process.stdout});try{let e=(await o.question(`\n${_(`Remove them?`)} ${h(`[y/N] `)}`)).trim().toLowerCase();return e===`y`||e===`yes`}finally{o.close()}}export{q as n,W as t};
4
- //# sourceMappingURL=repair-skills-DC9YrDGX.mjs.map
4
+ //# sourceMappingURL=repair-skills-CVxJr9ri.mjs.map
@@ -0,0 +1 @@
1
+ import{a as e,o as t,r as n}from"./server-lock-DyY8nPTr.mjs";export{n as markServerLockDraining,e as releaseServerLock,t as updateServerLockPort};
@@ -1,2 +1,2 @@
1
- import"./src-CCW4TQuz.mjs";import{r as e}from"./logger-DFxEUjvj.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{fileURLToPath as i}from"node:url";import{closeSync as a,existsSync as o,mkdirSync as s,openSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d,writeSync as f}from"node:fs";import{homedir as p,hostname as m}from"node:os";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??p(),`.ok`,`machine-id`)}function C(n){if(n===void 0&&x!==null)return x;let r=S(n),i=null;try{let e=l(r,`utf-8`).trim();b.test(e)&&(i=e)}catch{}if(i===null){i=h();try{s(t(r),{recursive:!0}),d(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(i(import.meta.url)),`..`,`package.json`),n=JSON.parse(l(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 at ${e.url??`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===m()}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(l(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!==m())continue;u(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(l(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,i=`[${t}-lock]`;s(n,{recursive:!0});let l=k(n,t),p={pid:process.pid,hostname:m(),port:r.port,...r.url!==void 0&&{url:r.url},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(p,null,2);for(let e=0;e<3;e++){if(!o(l))try{let e=c(l,`wx`,384);try{f(e,h)}finally{a(e)}return j(l),I(l),z({lockName:t,lockDir:n,lockPath:l})}catch(e){if(y(e)!==`EEXIST`)throw e}let e=L(l,i);if(e){if(N(e)&&e.pid===process.pid)return d(l,h,{encoding:`utf-8`,mode:384}),j(l),I(l),z({lockName:t,lockDir:n,lockPath:l});if(g(e.pid))throw new O(e,l,t);D.warn({pid:e.pid,host:e.hostname},`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{u(l)}catch{}}throw Error(`${i} Failed to acquire ${l} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>q({lockName:t,lockDir:n}),updatePort:(e,r)=>H({lockName:t,lockDir:n,port:e,url:r})}}function B(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`)return null;let n=t.hostname;return n===`localhost`||n===`[::1]`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)?t.origin:null}function V(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=B(e.url);if(t!==null)return t}if(e.port>0){let n=t?.fallbackHost??`localhost`;return`http://${n===`0.0.0.0`||n===`::`?`localhost`:n.includes(`:`)&&!n.startsWith(`[`)?`[${n}]`:n}:${e.port}`}return null}function H(e){let{lockName:t,lockDir:n,port:r,url:i}=e,a=`[${t}-lock]`,s=k(n,t);if(!o(s)){D.warn({lockPath:s},`${a} Lock file missing at ${s} during port update — skipping`);return}let c;try{let e=JSON.parse(l(s,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:s},`${a} Corrupt lock at ${s} during port update — skipping`);return}c=e}catch{D.warn({lockPath:s},`${a} Unreadable lock at ${s} during port update — skipping`);return}if(c.pid===process.pid&&N(c)){c.port=r,i===void 0?delete c.url:c.url=i;try{d(s,JSON.stringify(c,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:s,err:e},`${a} Failed to update port in ${s}: ${e instanceof Error?e.message:String(e)}`)}}}function U(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(l(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{d(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 W(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!o(r))return null;let i;try{let e=JSON.parse(l(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{u(r)}catch{}return null}return i}function G(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!o(r))return{status:`absent`};let i;try{i=JSON.parse(l(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 a=i;if(!_(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:a.pid,hostname:a.hostname,port:a.port,url:typeof a.url==`string`?a.url:void 0,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,machineId:typeof a.machineId==`string`?a.machineId:void 0,draining:a.draining===!0?!0:void 0,capabilities:Array.isArray(a.capabilities)&&a.capabilities.every(e=>typeof e==`string`)?a.capabilities:void 0,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{u(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 K(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>W({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 q(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,a=k(n,t);if(M(a)){if(r){U({lockName:t,lockDir:n});return}if(o(a))try{let e=JSON.parse(l(a,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;u(a),P.delete(a)}catch(e){D.warn({lockPath:a,err:e},`${i} Failed to release ${a}: ${e instanceof Error?e.message:String(e)}`)}}}var J=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function Y(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new J(e.existing,e.lockPath):e}}function X(e,t,n){H({lockName:`server`,lockDir:e,port:t,url:n})}function Z(e){return W({lockName:`server`,lockDir:e})}function Q(e,t){q({lockName:`server`,lockDir:e,...t})}function $(e){U({lockName:`server`,lockDir:e})}function ee(e,t){return K({lockName:`server`,lockDir:e,...t})}export{_ as C,g as S,T as _,Q as a,y as b,O as c,k as d,U as f,H as g,q as h,Z as i,R as l,G as m,Y as n,X as o,W as p,$ as r,ee as s,J as t,V as u,E as v,v as x,C as y};
2
- //# sourceMappingURL=server-lock-xhUgHytn.mjs.map
1
+ import"./src-ubDzLrbn.mjs";import{r as e}from"./logger-DFxEUjvj.mjs";import{dirname as t,join as n,resolve as r}from"node:path";import{fileURLToPath as i}from"node:url";import{closeSync as a,existsSync as o,mkdirSync as s,openSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d,writeSync as f}from"node:fs";import{homedir as p,hostname as m}from"node:os";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??p(),`.ok`,`machine-id`)}function C(n){if(n===void 0&&x!==null)return x;let r=S(n),i=null;try{let e=l(r,`utf-8`).trim();b.test(e)&&(i=e)}catch{}if(i===null){i=h();try{s(t(r),{recursive:!0}),d(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(i(import.meta.url)),`..`,`package.json`),n=JSON.parse(l(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 at ${e.url??`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===m()}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(l(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!==m())continue;u(e)}catch{}}))}function L(e,t){try{let n=JSON.parse(l(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,i=`[${t}-lock]`;s(n,{recursive:!0});let l=k(n,t),p={pid:process.pid,hostname:m(),port:r.port,...r.url!==void 0&&{url:r.url},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(p,null,2);for(let e=0;e<3;e++){if(!o(l))try{let e=c(l,`wx`,384);try{f(e,h)}finally{a(e)}return j(l),I(l),z({lockName:t,lockDir:n,lockPath:l})}catch(e){if(y(e)!==`EEXIST`)throw e}let e=L(l,i);if(e){if(N(e)&&e.pid===process.pid)return d(l,h,{encoding:`utf-8`,mode:384}),j(l),I(l),z({lockName:t,lockDir:n,lockPath:l});if(g(e.pid))throw new O(e,l,t);D.warn({pid:e.pid,host:e.hostname},`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{u(l)}catch{}}throw Error(`${i} Failed to acquire ${l} after 3 attempts (concurrent acquire contention).`)}function z(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>q({lockName:t,lockDir:n}),updatePort:(e,r)=>H({lockName:t,lockDir:n,port:e,url:r})}}function B(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`)return null;let n=t.hostname;return n===`localhost`||n===`[::1]`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n)?t.origin:null}function V(e,t){if(typeof e.url==`string`&&e.url.length>0){let t=B(e.url);if(t!==null)return t}if(e.port>0){let n=t?.fallbackHost??`localhost`;return`http://${n===`0.0.0.0`||n===`::`?`localhost`:n.includes(`:`)&&!n.startsWith(`[`)?`[${n}]`:n}:${e.port}`}return null}function H(e){let{lockName:t,lockDir:n,port:r,url:i}=e,a=`[${t}-lock]`,s=k(n,t);if(!o(s)){D.warn({lockPath:s},`${a} Lock file missing at ${s} during port update — skipping`);return}let c;try{let e=JSON.parse(l(s,`utf-8`));if(!e||typeof e!=`object`||!_(e.pid)){D.warn({lockPath:s},`${a} Corrupt lock at ${s} during port update — skipping`);return}c=e}catch{D.warn({lockPath:s},`${a} Unreadable lock at ${s} during port update — skipping`);return}if(c.pid===process.pid&&N(c)){c.port=r,i===void 0?delete c.url:c.url=i;try{d(s,JSON.stringify(c,null,2),{encoding:`utf-8`,mode:384})}catch(e){D.warn({lockPath:s,err:e},`${a} Failed to update port in ${s}: ${e instanceof Error?e.message:String(e)}`)}}}function U(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(l(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{d(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 W(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!o(r))return null;let i;try{let e=JSON.parse(l(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{u(r)}catch{}return null}return i}function G(e){let{lockName:t,lockDir:n}=e,r=k(n,t);if(!o(r))return{status:`absent`};let i;try{i=JSON.parse(l(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 a=i;if(!_(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let s={pid:a.pid,hostname:a.hostname,port:a.port,url:typeof a.url==`string`?a.url:void 0,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,machineId:typeof a.machineId==`string`?a.machineId:void 0,draining:a.draining===!0?!0:void 0,capabilities:Array.isArray(a.capabilities)&&a.capabilities.every(e=>typeof e==`string`)?a.capabilities:void 0,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(!N(s))return{status:`stale`,lock:s};if(!g(s.pid)){try{u(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 K(e){let{lockName:t,lockDir:n}=e,r=e.timeoutMs??1e4,i=e.pollIntervalMs??100,a=e.readLock??(()=>W({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 q(e){let{lockName:t,lockDir:n,deferUnlinkToExit:r=!1}=e,i=`[${t}-lock]`,a=k(n,t);if(M(a)){if(r){U({lockName:t,lockDir:n});return}if(o(a))try{let e=JSON.parse(l(a,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||!N(e))return;u(a),P.delete(a)}catch(e){D.warn({lockPath:a,err:e},`${i} Failed to release ${a}: ${e instanceof Error?e.message:String(e)}`)}}}var J=class extends O{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function Y(e,t){try{return R({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof O&&e.lockName===`server`?new J(e.existing,e.lockPath):e}}function X(e,t,n){H({lockName:`server`,lockDir:e,port:t,url:n})}function Z(e){return W({lockName:`server`,lockDir:e})}function Q(e,t){q({lockName:`server`,lockDir:e,...t})}function $(e){U({lockName:`server`,lockDir:e})}function ee(e,t){return K({lockName:`server`,lockDir:e,...t})}export{_ as C,g as S,T as _,Q as a,y as b,O as c,k as d,U as f,H as g,q as h,Z as i,R as l,G as m,Y as n,X as o,W as p,$ as r,ee as s,J as t,V as u,E as v,v as x,C as y};
2
+ //# sourceMappingURL=server-lock-DyY8nPTr.mjs.map
@@ -1,2 +1,2 @@
1
- import{ks as e}from"./src-CCW4TQuz.mjs";import{Tr as t,wr as n}from"./src-D5ZZydZi.mjs";import{dirname as r,isAbsolute as i,join as a,relative as o,resolve as s,sep as c}from"node:path";import{existsSync as l,lstatSync as u,readdirSync as d,rmSync as f,rmdirSync as p}from"node:fs";const m=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],h=[...t.map(e=>n[e]),`open-knowledge`];function g(e){if(!i(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=s(e);if(t===c||r(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function _(e,t){let n=o(e,t);if(n.startsWith(`..`)||i(n))return!1;let r=e;for(let e of n.split(c)){r=a(r,e);try{if(!u(r).isDirectory())return!1}catch{return!1}}return!0}function v(e,t){try{return d(e).every(n=>t.has(a(e,n)))}catch{return!1}}function y(e){let t=g(e),n=[],i=[],o=new Set;for(let e of m){let s=a(t,e.hostDir,`skills`);if(!_(t,s))continue;let u=h.map(e=>a(s,e)).filter(e=>l(e));n.push(...u);for(let e of u)o.add(e);let d=a(t,e.pruneRoot),f=s;for(;v(f,o)&&(i.push(f),o.add(f),f!==d);){let e=r(f);if(e===f||e===t||!e.startsWith(t+c))break;f=e}}return{skillDirs:n,emptyDirs:i}}function b(e){try{if(!u(e).isDirectory())return!1;let t=d(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function x(e){let t=new Set,n=new Set;for(let i of m){let o=a(e,i.hostDir,`skills`);for(let e of h)t.add(a(o,e));let s=a(e,i.pruneRoot),l=o;for(;n.add(l),l!==s;){let t=r(l);if(t===l||t===e||!t.startsWith(e+c))break;l=t}}return{skillDirs:t,emptyDirs:n}}function S(e,t){let n=g(e),r=x(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(_(n,e)&&b(e))try{f(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(_(n,e))try{p(e),a.push(e)}catch{}return a}function C(r){let i=g(r),o=[];for(let r of t){let t=n[r];o.push({path:a(i,`.agents`,`skills`,t),bundleId:r,scope:`central`});for(let n of e)o.push({path:a(i,n.skillsRoot,t),bundleId:r,scope:`host`,hostDir:n.hostDir})}return o}function w(e,t){let n=[];for(let r of C(e))if(r.bundleId===t)try{f(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}export{C as i,y as n,w as r,S as t};
2
- //# sourceMappingURL=skill-teardown-DVWO087y.mjs.map
1
+ import{As as e}from"./src-ubDzLrbn.mjs";import{Tr as t,wr as n}from"./src-vUi58oUc.mjs";import{dirname as r,isAbsolute as i,join as a,relative as o,resolve as s,sep as c}from"node:path";import{existsSync as l,lstatSync as u,readdirSync as d,rmSync as f,rmdirSync as p}from"node:fs";const m=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],h=[...t.map(e=>n[e]),`open-knowledge`];function g(e){if(!i(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=s(e);if(t===c||r(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function _(e,t){let n=o(e,t);if(n.startsWith(`..`)||i(n))return!1;let r=e;for(let e of n.split(c)){r=a(r,e);try{if(!u(r).isDirectory())return!1}catch{return!1}}return!0}function v(e,t){try{return d(e).every(n=>t.has(a(e,n)))}catch{return!1}}function y(e){let t=g(e),n=[],i=[],o=new Set;for(let e of m){let s=a(t,e.hostDir,`skills`);if(!_(t,s))continue;let u=h.map(e=>a(s,e)).filter(e=>l(e));n.push(...u);for(let e of u)o.add(e);let d=a(t,e.pruneRoot),f=s;for(;v(f,o)&&(i.push(f),o.add(f),f!==d);){let e=r(f);if(e===f||e===t||!e.startsWith(t+c))break;f=e}}return{skillDirs:n,emptyDirs:i}}function b(e){try{if(!u(e).isDirectory())return!1;let t=d(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function x(e){let t=new Set,n=new Set;for(let i of m){let o=a(e,i.hostDir,`skills`);for(let e of h)t.add(a(o,e));let s=a(e,i.pruneRoot),l=o;for(;n.add(l),l!==s;){let t=r(l);if(t===l||t===e||!t.startsWith(e+c))break;l=t}}return{skillDirs:t,emptyDirs:n}}function S(e,t){let n=g(e),r=x(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(_(n,e)&&b(e))try{f(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(_(n,e))try{p(e),a.push(e)}catch{}return a}function C(r){let i=g(r),o=[];for(let r of t){let t=n[r];o.push({path:a(i,`.agents`,`skills`,t),bundleId:r,scope:`central`});for(let n of e)o.push({path:a(i,n.skillsRoot,t),bundleId:r,scope:`host`,hostDir:n.hostDir})}return o}function w(e,t){let n=[];for(let r of C(e))if(r.bundleId===t)try{f(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}export{C as i,y as n,w as r,S as t};
2
+ //# sourceMappingURL=skill-teardown-DkXFhNS5.mjs.map
@@ -0,0 +1 @@
1
+ import"./src-ubDzLrbn.mjs";import"./write-project-skill-CQEMn_bx.mjs";import"./src-Bh_IfeSA.mjs";import"./acp-harness-probe-B8cjyUwS.mjs";import"./init-DJX9zKiO.mjs";import{n as e}from"./loader-Db-3Tt5G.mjs";import"./skill-teardown-DkXFhNS5.mjs";import"./preview-CtA0e_2y.mjs";import"./mcp-migrate-event-B1gJf6bG.mjs";export{e as loadConfig};
@@ -1,12 +1,12 @@
1
- import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,ft as n,q as r}from"./sleep-D_nNc7T_.mjs";import{_c as i,gc as a,mo as o,nt as s,rt as c}from"./src-CCW4TQuz.mjs";import{Nn as l,Qr as u,at as d,it as f,ot as p,rt as m,xi as h}from"./src-D5ZZydZi.mjs";import{D as ee,F as g,I as _,k as v}from"./fs-traced-xJfl5Rxd.mjs";import{C as y,S as b,d as x,y as S}from"./server-lock-xhUgHytn.mjs";import{t as C}from"./yazl-DZr4PyKA.mjs";import{m as w,p as te,v as T}from"./write-project-skill-BufydPiH.mjs";import{c as ne}from"./colors-BsmVIwfM.mjs";import{n as re}from"./acp-harness-probe-1T3u8lIy.mjs";import{E,T as D,_ as ie,o as O,w as k,x as ae,y as oe}from"./init-CgzZMWZN.mjs";import{n as se}from"./constants-D2MyP7i6.mjs";import{t as A}from"./is-object-ByG7RnjH.mjs";import"./loader-DN88fSLk.mjs";import"./skill-teardown-DVWO087y.mjs";import"./preview-K8zvEnBc.mjs";import{execSync as ce,spawnSync as j}from"node:child_process";import{basename as M,dirname as N,join as P,relative as le,resolve as F,sep as ue}from"node:path";import{cpSync as de,createWriteStream as fe,existsSync as I,lstatSync as pe,mkdirSync as L,mkdtempSync as me,readFileSync as R,readdirSync as z,readlinkSync as he,rmSync as B,statSync as ge,writeFileSync as V}from"node:fs";import{arch as _e,freemem as ve,homedir as H,hostname as ye,platform as be,release as xe,tmpdir as Se,totalmem as Ce,type as we,uptime as Te}from"node:os";import"node:fs/promises";import{createHash as Ee}from"node:crypto";var U=n();const De=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Oe(e,t,n=l){if(e!==void 0&&!De.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let ke=null;function Ae(e){ke=e}function je(){return ke??process.cwd()}function Me(){return P(H(),`.ok`,`bug-reports`)}function Ne(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Me(),r=`${t}-bugreport`,i=P(n,`${r}.zip`);for(let e=2;I(i);e+=1)i=P(n,`${r}-${e}.zip`);return i}function Pe(e,t){let n=P(e,`.ok`,`config.yml`);if(I(n))try{let e=R(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 I(P(e,`.ok`))?Ee(`sha256`).update(F(e)).digest(`hex`).slice(0,12):null}function Fe(){let e={timestamp:new Date().toISOString(),platform:be(),osType:we(),osRelease:xe(),hostname:`[redacted]`,uptime:Te(),freeMem:ve(),totalMem:Ce(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ce(`sw_vers -productVersion 2>/dev/null`,u({encoding:`utf8`})).trim()}catch{}try{let t=P(__dirname,`..`,`..`,`package.json`);I(t)&&(e.okVersion=JSON.parse(R(t,`utf8`)).version)}catch{}return e}const Ie=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function W(e){let t=M(e);return Ie.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Le(e,t){return Be(e,t).files}const Re=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function ze(e,t=re){let n=P(e,`${t}.ShipIt`);return I(n)?Re.map(e=>P(n,e)).filter(e=>I(e)):[]}function Be(e,t){if(!I(t))return{files:[],excludedByProjectSlug:0};let n=z(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>P(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(W),i=[],a=r.filter(t=>{try{return R(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!W(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Ve(e){let t=P(e,`.ok`,`local`);return I(t)?{files:[`server.lock`,`last-spawn-error.log`,s].map(e=>P(t,e)).filter(e=>I(e))}:{files:[]}}function He(e){let t=P(e,`.ok`,`local`,`logs`);return I(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>P(t,e)).filter(e=>I(e))}:{files:[]}}function Ue(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 G(e){for(let t of e.files)try{Ue({zipfile:e.zipfile,name:`${e.prefix}/${M(t)}`,content:R(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 We(t){let{redact:n,outputPath:r,logger:i}=t,o=t.userLogsDir??P(H(),`.ok`,`logs`),s=t.projectDir?Pe(t.projectDir,i):null;L(N(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=Fe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=Be(s,o),{files:d}=t.projectDir?Ve(t.projectDir):{files:[]},{files:f}=t.projectDir?He(t.projectDir):{files:[]},p=t.shipItLogFiles??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length},`files collected`);let m=[],h=[],{ZipFile:ee}=await import(`./yazl-jVENrf5i.mjs`).then(t=>e(t.default,1)),g=new ee;G({zipfile:g,files:[...l,...p],prefix:`logs`,redact:n,bundleFiles:h,redactions:m,logger:i}),G({zipfile:g,files:d,prefix:`lockdir`,redact:n,bundleFiles:h,redactions:m,logger:i}),G({zipfile:g,files:f,prefix:`local-logs`,redact:n,bundleFiles:h,redactions:m,logger:i});for(let e of t.extraFiles??[])try{let t=R(e.sourcePath),n=`extra/${e.zipName??M(e.sourcePath)}`;g.addBuffer(t,n),h.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Ue({zipfile:g,name:`note.txt`,content:t.note,redact:n,bundleFiles:h,redactions:m});let _=JSON.stringify(c,null,2);g.addBuffer(Buffer.from(_,`utf8`),`sysinfo.json`),h.push(`sysinfo.json`);let v={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:h,redactions:m,sysinfo:c};g.addBuffer(Buffer.from(JSON.stringify(v,null,2),`utf8`),`MANIFEST.json`);let y=m.reduce((e,t)=>e+t.lineCount,0),b=new Set(p.map(e=>`logs/${M(e)}`)),x=h.filter(e=>b.has(e)),S=s?h.filter(e=>e.startsWith(`logs/`)&&!W(e)&&!b.has(e)):[],C=[`# Bug Report Bundle`,``,`Generated: ${v.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${v.disciplineVersion}`,``,`## Contents`,``,...h.map(e=>`- ${e}`),``,`## Privacy`,``,...S.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...S.map(e=>`- ${e}`),``]:[],...x.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...x.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${a.join(`, `)}`,y>0?`${y} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
2
- `);g.addBuffer(Buffer.from(C,`utf8`),`README.md`),g.end();let w=fe(r);return g.outputStream.pipe(w),await new Promise((e,t)=>{w.on(`close`,e),w.on(`error`,t)}),i?.info({bundlePath:r,fileCount:h.length,redactionCount:y},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:h,redactions:m,redactedLineCount:y,generatedAt:v.generatedAt}}}var Ge=e(C(),1),K=e(ne(),1);function Ke(e){return _({absPath:v(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function qe({home:e=H(),env:n=process.env}={}){let i=Ke(e),{override:a,preferenceList:s}=ee(n),{locale:c,source:l}=o({override:a,storedPreference:i,supportedLocales:r,preferenceList:s,autoDetectableLocales:t});return{preference:i,locale:c,source:l,systemLanguages:s}}function Je(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e,t){if(typeof e==`string`)return Je(e,t.contentDir);if(Array.isArray(e))return e.map(e=>q(e,t));if(!Ye(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=q(i,t);return n}function Xe(e,t){let n=R(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
1
+ import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,ft as n,q as r}from"./sleep-D_nNc7T_.mjs";import{_c as i,ho as a,it as o,rt as s,vc as c}from"./src-ubDzLrbn.mjs";import{Nn as l,Qr as u,at as d,it as f,ot as p,rt as m,xi as h}from"./src-vUi58oUc.mjs";import{D as ee,F as g,I as _,k as v}from"./fs-traced-xJfl5Rxd.mjs";import{C as y,S as b,d as x,y as S}from"./server-lock-DyY8nPTr.mjs";import{t as C}from"./yazl-DZr4PyKA.mjs";import{m as w,p as te,v as T}from"./write-project-skill-CQEMn_bx.mjs";import{c as ne}from"./colors-BsmVIwfM.mjs";import{n as re}from"./acp-harness-probe-B8cjyUwS.mjs";import{E,T as D,_ as ie,o as O,w as k,x as ae,y as oe}from"./init-DJX9zKiO.mjs";import{n as se}from"./constants-XJleQvys.mjs";import{t as A}from"./is-object-ByG7RnjH.mjs";import"./loader-Db-3Tt5G.mjs";import"./skill-teardown-DkXFhNS5.mjs";import"./preview-CtA0e_2y.mjs";import{execSync as ce,spawnSync as j}from"node:child_process";import{basename as M,dirname as N,join as P,relative as le,resolve as F,sep as ue}from"node:path";import{cpSync as de,createWriteStream as fe,existsSync as I,lstatSync as pe,mkdirSync as L,mkdtempSync as me,readFileSync as R,readdirSync as z,readlinkSync as he,rmSync as B,statSync as ge,writeFileSync as V}from"node:fs";import{arch as _e,freemem as ve,homedir as H,hostname as ye,platform as be,release as xe,tmpdir as Se,totalmem as Ce,type as we,uptime as Te}from"node:os";import"node:fs/promises";import{createHash as Ee}from"node:crypto";var U=n();const De=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`deinit`,`auth`]);function Oe(e,t,n=l){if(e!==void 0&&!De.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let ke=null;function Ae(e){ke=e}function je(){return ke??process.cwd()}function Me(){return P(H(),`.ok`,`bug-reports`)}function Ne(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Me(),r=`${t}-bugreport`,i=P(n,`${r}.zip`);for(let e=2;I(i);e+=1)i=P(n,`${r}-${e}.zip`);return i}function Pe(e,t){let n=P(e,`.ok`,`config.yml`);if(I(n))try{let e=R(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 I(P(e,`.ok`))?Ee(`sha256`).update(F(e)).digest(`hex`).slice(0,12):null}function Fe(){let e={timestamp:new Date().toISOString(),platform:be(),osType:we(),osRelease:xe(),hostname:`[redacted]`,uptime:Te(),freeMem:ve(),totalMem:Ce(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=ce(`sw_vers -productVersion 2>/dev/null`,u({encoding:`utf8`})).trim()}catch{}try{let t=P(__dirname,`..`,`..`,`package.json`);I(t)&&(e.okVersion=JSON.parse(R(t,`utf8`)).version)}catch{}return e}const Ie=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function W(e){let t=M(e);return Ie.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Le(e,t){return Be(e,t).files}const Re=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function ze(e,t=re){let n=P(e,`${t}.ShipIt`);return I(n)?Re.map(e=>P(n,e)).filter(e=>I(e)):[]}function Be(e,t){if(!I(t))return{files:[],excludedByProjectSlug:0};let n=z(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>P(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(W),i=[],a=r.filter(t=>{try{return R(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!W(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Ve(e){let t=P(e,`.ok`,`local`);return I(t)?{files:[`server.lock`,`last-spawn-error.log`,s].map(e=>P(t,e)).filter(e=>I(e))}:{files:[]}}function He(e){let t=P(e,`.ok`,`local`,`logs`);return I(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>P(t,e)).filter(e=>I(e))}:{files:[]}}function Ue(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=c(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 G(e){for(let t of e.files)try{Ue({zipfile:e.zipfile,name:`${e.prefix}/${M(t)}`,content:R(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 We(t){let{redact:n,outputPath:r,logger:a}=t,o=t.userLogsDir??P(H(),`.ok`,`logs`),s=t.projectDir?Pe(t.projectDir,a):null;L(N(r),{recursive:!0}),a?.info({projectSlug:s},`gathering diagnostic data`);let c=Fe();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=Be(s,o),{files:d}=t.projectDir?Ve(t.projectDir):{files:[]},{files:f}=t.projectDir?He(t.projectDir):{files:[]},p=t.shipItLogFiles??[];a?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length},`files collected`);let m=[],h=[],{ZipFile:ee}=await import(`./yazl-jVENrf5i.mjs`).then(t=>e(t.default,1)),g=new ee;G({zipfile:g,files:[...l,...p],prefix:`logs`,redact:n,bundleFiles:h,redactions:m,logger:a}),G({zipfile:g,files:d,prefix:`lockdir`,redact:n,bundleFiles:h,redactions:m,logger:a}),G({zipfile:g,files:f,prefix:`local-logs`,redact:n,bundleFiles:h,redactions:m,logger:a});for(let e of t.extraFiles??[])try{let t=R(e.sourcePath),n=`extra/${e.zipName??M(e.sourcePath)}`;g.addBuffer(t,n),h.push(n)}catch(t){a?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&Ue({zipfile:g,name:`note.txt`,content:t.note,redact:n,bundleFiles:h,redactions:m});let _=JSON.stringify(c,null,2);g.addBuffer(Buffer.from(_,`utf8`),`sysinfo.json`),h.push(`sysinfo.json`);let v={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:h,redactions:m,sysinfo:c};g.addBuffer(Buffer.from(JSON.stringify(v,null,2),`utf8`),`MANIFEST.json`);let y=m.reduce((e,t)=>e+t.lineCount,0),b=new Set(p.map(e=>`logs/${M(e)}`)),x=h.filter(e=>b.has(e)),S=s?h.filter(e=>e.startsWith(`logs/`)&&!W(e)&&!b.has(e)):[],C=[`# Bug Report Bundle`,``,`Generated: ${v.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${v.disciplineVersion}`,``,`## Contents`,``,...h.map(e=>`- ${e}`),``,`## Privacy`,``,...S.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...S.map(e=>`- ${e}`),``]:[],...x.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...x.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${i.join(`, `)}`,y>0?`${y} line(s) were scrubbed across ${m.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
2
+ `);g.addBuffer(Buffer.from(C,`utf8`),`README.md`),g.end();let w=fe(r);return g.outputStream.pipe(w),await new Promise((e,t)=>{w.on(`close`,e),w.on(`error`,t)}),a?.info({bundlePath:r,fileCount:h.length,redactionCount:y},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:h,redactions:m,redactedLineCount:y,generatedAt:v.generatedAt}}}var Ge=e(C(),1),K=e(ne(),1);function Ke(e){return _({absPath:v(`user`,e,e),sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function qe({home:e=H(),env:n=process.env}={}){let i=Ke(e),{override:o,preferenceList:s}=ee(n),{locale:c,source:l}=a({override:o,storedPreference:i,supportedLocales:r,preferenceList:s,autoDetectableLocales:t});return{preference:i,locale:c,source:l,systemLanguages:s}}function Je(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function Ye(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q(e,t){if(typeof e==`string`)return Je(e,t.contentDir);if(Array.isArray(e))return e.map(e=>q(e,t));if(!Ye(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=q(i,t);return n}function Xe(e,t){let n=R(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=q(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}V(e,r?`${a.join(`
5
5
  `)}\n`:a.join(`
6
6
  `))}function Ze(e,t){let n=R(e,`utf-8`);if(n.trim().length!==0)try{let r=q(JSON.parse(n),t),i=n.endsWith(`
7
7
  `)?`
8
8
  `:``;V(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=Je(n,t.contentDir);r!==n&&V(e,r)}}function Qe(e,t){let n=R(e,`utf-8`),r=Je(n,t.contentDir);r!==n&&V(e,r)}function $e(e){try{return z(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>P(e,t.name))}catch{return[]}}const et=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function tt(e){return/\.log\.\d+$/.test(e)}function nt(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||tt(e)}function rt(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of $e(P(e.stagingDir,n)))nt(r)?Xe(r,t):r.endsWith(`.json`)?Ze(r,t):Qe(r,t);for(let n of $e(P(e.stagingDir,`state`))){let e=M(n);n.endsWith(`.jsonl`)?Xe(n,t):et.has(e)?Ze(n,t):Qe(n,t)}}const it=[`.ok`,`local`,`telemetry`],at=[`.ok`,`local`,`logs`],ot=[`.ok`,`local`,`loss-capture`],st=`spans-current.jsonl`,ct=`spans-prev.jsonl`,lt=`server-current.jsonl`,ut=`server-prev.jsonl`,dt=`loss-current.jsonl`,ft=`loss-prev.jsonl`;function pt(e){return P(e,...it,st)}function mt(e){return P(e,...it,ct)}function ht(e){return P(e,...at,lt)}function gt(e){return P(e,...at,ut)}function _t(e){return P(e,...ot,dt)}function vt(e){return P(e,...ot,ft)}const yt=1e3;async function bt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(yt)});return t.ok?await t.text():null}catch{return null}}async function xt(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(yt)});return t.ok?await t.text():null}catch{return null}}async function St(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(yt)});return t.ok?await t.text():null}catch{return null}}function Ct(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
9
- `)}\n`:null}catch{return null}}function wt(e){let t=P(e,`.git`,`ok`);if(!I(t))return null;let n=j(`git`,[`-C`,t,`log`,`--oneline`,`-50`],u({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Tt(e){let t=P(e,`.git`,`ok`);if(!I(t))return null;let n=j(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],u({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Et(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function Dt(){return{nodeVersion:process.version,platform:be(),arch:_e()}}function Ot(){return process.env.OTEL_SDK_DISABLED===`false`}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function kt(e){if(!I(e))return{};let t;try{t=(0,U.parse)(R(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!J(t))return{};let n=t.telemetry;if(!J(n))return{};let r=n.localSink;return J(r)?r:{}}function At(e){return typeof e==`boolean`?e:void 0}function jt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y(e){if(J(e))return jt(e.maxBytes)}function Mt(e){let t=kt(v(`project`,e)),n=kt(v(`project-local`,e));return{enabled:At(n.enabled)??At(t.enabled)??!0,spansMaxBytes:Y(n.spans)??Y(t.spans)??52428800,logsMaxBytes:Y(n.logs)??Y(t.logs)??26214400}}function Nt(e){return Ee(`sha256`).update(e).digest(`hex`)}function Pt(e){let t=R(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Ft(e){let t=R(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function X(e,t){if(!I(e))return!1;try{return L(N(t),{recursive:!0}),de(e,t),!0}catch{return!1}}function It(e){let t=[],n=e=>{let r=z(e,{withFileTypes:!0});for(let i of r){let r=P(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Lt=new Set([`.jsonl`]);function Rt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Lt.has(e.slice(t))}const zt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Bt(e){if(tt(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:zt.has(e.slice(t))}function Vt(e){let t=[];for(let n of It(e)){let r=Ht(e,n);if(!Bt(r))continue;let{redacted:a,patterns:o,lineCount:s}=i(R(n,`utf-8`));o.length!==0&&(V(n,a),t.push({file:r,lineCount:s,patterns:o}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function Ht(e,t){return le(e,t).split(ue).join(`/`)}async function Ut(e){let t=F(e.contentDir),n=F(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??bt,a=r.fetchAgentEffects??xt,o=r.fetchWatcherRecent??St,l=r.readShadowHead??wt,u=r.readCheckpointRefs??Tt,d=r.now??(()=>new Date),f=r.okVersion??(()=>se),p=r.readDesktopEnv??Et,m=r.readLanguage??qe,h=r.readRuntime??Dt,ee=r.isOtlpPushEnabled??Ot,g=me(P(Se(),`ok-bundle-`));try{L(P(g,`telemetry`),{recursive:!0}),L(P(g,`logs`),{recursive:!0}),L(P(g,`state`),{recursive:!0}),X(pt(n),P(g,`telemetry`,st)),X(mt(n),P(g,`telemetry`,ct)),X(ht(n),P(g,`logs`,lt)),X(gt(n),P(g,`logs`,ut));for(let t of e.userLogFiles??[])X(t,P(g,`logs`,M(t)));let _=P(n,`.ok`,`local`),v=P(_,`server.lock`),y=`not-running`,b=`no server.lock`,x=null;if(I(v)){X(v,P(g,`state`,`server.lock`));try{let e=R(v,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?x=t.port:b=`lock present but no port`}catch{b=`lock present but unparseable`}}if(x!==null){let e=await i(x);e===null?b=`agent-presence endpoint at :${x} unreachable`:(V(P(g,`state`,`agent-presence.json`),e),y=`running`,b=``);let t=await a(x);t!==null&&V(P(g,`state`,`agent-effects.json`),t);let n=await o(x);if(n!==null){let e=Ct(n);e!==null&&V(P(g,`state`,`watcher-recent.jsonl`),e)}}let S=l(t);S!==null&&V(P(g,`state`,`shadow-head.txt`),S);let C=u(t);C!==null&&V(P(g,`state`,`checkpoint-refs.txt`),C),X(_t(n),P(g,`state`,dt)),X(vt(n),P(g,`state`,ft)),X(P(_,`last-spawn-error.log`),P(g,`state`,`last-spawn-error.log`)),X(P(_,c),P(g,`state`,c)),X(P(_,s),P(g,`state`,s));let w=h(),te=p(),T=m(),ne={ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:te,language:T}};V(P(g,`state`,`runtime.json`),`${JSON.stringify(ne,null,2)}\n`);let re=y===`running`?`running
9
+ `)}\n`:null}catch{return null}}function wt(e){let t=P(e,`.git`,`ok`);if(!I(t))return null;let n=j(`git`,[`-C`,t,`log`,`--oneline`,`-50`],u({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Tt(e){let t=P(e,`.git`,`ok`);if(!I(t))return null;let n=j(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],u({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Et(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function Dt(){return{nodeVersion:process.version,platform:be(),arch:_e()}}function Ot(){return process.env.OTEL_SDK_DISABLED===`false`}function J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function kt(e){if(!I(e))return{};let t;try{t=(0,U.parse)(R(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!J(t))return{};let n=t.telemetry;if(!J(n))return{};let r=n.localSink;return J(r)?r:{}}function At(e){return typeof e==`boolean`?e:void 0}function jt(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y(e){if(J(e))return jt(e.maxBytes)}function Mt(e){let t=kt(v(`project`,e)),n=kt(v(`project-local`,e));return{enabled:At(n.enabled)??At(t.enabled)??!0,spansMaxBytes:Y(n.spans)??Y(t.spans)??52428800,logsMaxBytes:Y(n.logs)??Y(t.logs)??26214400}}function Nt(e){return Ee(`sha256`).update(e).digest(`hex`)}function Pt(e){let t=R(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function Ft(e){let t=R(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function X(e,t){if(!I(e))return!1;try{return L(N(t),{recursive:!0}),de(e,t),!0}catch{return!1}}function It(e){let t=[],n=e=>{let r=z(e,{withFileTypes:!0});for(let i of r){let r=P(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const Lt=new Set([`.jsonl`]);function Rt(e){let t=e.lastIndexOf(`.`);return t===-1?!1:Lt.has(e.slice(t))}const zt=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function Bt(e){if(tt(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:zt.has(e.slice(t))}function Vt(e){let t=[];for(let n of It(e)){let r=Ht(e,n);if(!Bt(r))continue;let{redacted:i,patterns:a,lineCount:o}=c(R(n,`utf-8`));a.length!==0&&(V(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function Ht(e,t){return le(e,t).split(ue).join(`/`)}async function Ut(e){let t=F(e.contentDir),n=F(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??bt,a=r.fetchAgentEffects??xt,c=r.fetchWatcherRecent??St,l=r.readShadowHead??wt,u=r.readCheckpointRefs??Tt,d=r.now??(()=>new Date),f=r.okVersion??(()=>se),p=r.readDesktopEnv??Et,m=r.readLanguage??qe,h=r.readRuntime??Dt,ee=r.isOtlpPushEnabled??Ot,g=me(P(Se(),`ok-bundle-`));try{L(P(g,`telemetry`),{recursive:!0}),L(P(g,`logs`),{recursive:!0}),L(P(g,`state`),{recursive:!0}),X(pt(n),P(g,`telemetry`,st)),X(mt(n),P(g,`telemetry`,ct)),X(ht(n),P(g,`logs`,lt)),X(gt(n),P(g,`logs`,ut));for(let t of e.userLogFiles??[])X(t,P(g,`logs`,M(t)));let _=P(n,`.ok`,`local`),v=P(_,`server.lock`),y=`not-running`,b=`no server.lock`,x=null;if(I(v)){X(v,P(g,`state`,`server.lock`));try{let e=R(v,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?x=t.port:b=`lock present but no port`}catch{b=`lock present but unparseable`}}if(x!==null){let e=await i(x);e===null?b=`agent-presence endpoint at :${x} unreachable`:(V(P(g,`state`,`agent-presence.json`),e),y=`running`,b=``);let t=await a(x);t!==null&&V(P(g,`state`,`agent-effects.json`),t);let n=await c(x);if(n!==null){let e=Ct(n);e!==null&&V(P(g,`state`,`watcher-recent.jsonl`),e)}}let S=l(t);S!==null&&V(P(g,`state`,`shadow-head.txt`),S);let C=u(t);C!==null&&V(P(g,`state`,`checkpoint-refs.txt`),C),X(_t(n),P(g,`state`,dt)),X(vt(n),P(g,`state`,ft)),X(P(_,`last-spawn-error.log`),P(g,`state`,`last-spawn-error.log`)),X(P(_,o),P(g,`state`,o)),X(P(_,s),P(g,`state`,s));let w=h(),te=p(),T=m(),ne={ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:te,language:T}};V(P(g,`state`,`runtime.json`),`${JSON.stringify(ne,null,2)}\n`);let re=y===`running`?`running
10
10
  `:`not-running (${b})\n`;if(V(P(g,`state`,`server-status.txt`),re),e.processDir&&I(e.processDir)){let t=P(g,`process`);L(t,{recursive:!0}),de(e.processDir,t,{recursive:!0})}let E=e.redact===!0;E&&rt({stagingDir:g,contentDir:t}),e.note&&V(P(g,`note.txt`),e.note);let D=null;e.scrubSecrets===!0&&(D=Vt(g));for(let t of e.extraFiles??[])X(t.sourcePath,P(g,`extra`,t.zipName??M(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let ie=Mt(n),O=It(g),k=[],ae=0,oe=0;for(let e of O){let t=Ht(g,e),n=ge(e).size,r=Rt(t)?Pt(e):0;k.push({path:t,bytes:n,lines:r}),ae+=n,t.startsWith(`telemetry/`)&&Rt(t)&&(oe+=Ft(e))}let se={applied:E};D!==null&&(se.secretScrub=D);let A={schemaVersion:2,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:w.nodeVersion,platform:w.platform,arch:w.arch},host:{desktop:te,language:T},contentDir:{pathSha256:Nt(t),absolutePath:E?`<CONTENT_DIR>`:t},telemetry:{localSink:ie,otlpPushEnabled:ee()},redaction:se,serverStatus:y,files:k};V(P(g,`manifest.json`),`${JSON.stringify(A,null,2)}\n`);let ce=O.some(e=>{try{return R(e,`utf-8`).includes(t)}catch{return!1}}),j={totalBytes:ae,fileCount:k.length,docNameCount:oe,contentDirVisible:ce,redacted:E},N=!1;return{stagingDir:g,manifest:A,summary:j,cleanup:()=>{N||(N=!0,B(g,{recursive:!0,force:!0}))}}}catch(e){throw B(g,{recursive:!0,force:!0}),e}}async function Wt(e){let{collected:t,outputPath:n}=e,r=N(n);if(!I(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new Ge.ZipFile,a=It(t.stagingDir);for(let e of a){let n=Ht(t.stagingDir,e);i.addFile(e,n)}i.end();let o=fe(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function Gt(e,t){let n=P(e,`.ok`,`config.yml`);if(I(n))try{let t=(0,U.parse)(R(n,`utf-8`)),r=A(t)?t.content:void 0,i=A(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return F(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return F(e)}async function Kt(e,t,n,r){let i=Pe(t,e.logger),a=await Ut({contentDir:Gt(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...Le(i,e.userLogsDir??P(H(),`.ok`,`logs`)),...ze(e.cachesDir??P(H(),`Library`,`Caches`))],deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{L(N(e.outputPath),{recursive:!0}),await Wt({collected:a,outputPath:e.outputPath});let t=a.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:i,files:a.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:a.manifest.createdAt}}}finally{a.cleanup()}}async function qt(e){let{projectDir:t}=e,n=e.readDesktopEnv??Et,r=e.readLanguage??qe;if(e.level===`full`&&t!==void 0)return Kt(e,t,n,r);let{zipPath:i,summary:a}=await We({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:ze(e.cachesDir??P(H(),`Library`,`Caches`)),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:i,summary:{level:e.level,systemWide:t===void 0,projectSlug:a.projectSlug,files:a.files,redactions:a.redactions,redactedLineCount:a.redactedLineCount,generatedAt:a.generatedAt}}}function Z(e,t,n={}){let r=x(e,t);if(!I(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(R(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!y(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??b)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??S())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ye();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function Jt(e){return e.replace(/:\d+$/,``)}function Yt(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Jt(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Jt(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Jt(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}const Xt=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Zt(e){return P(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}const Qt={existsSync:e=>I(e),readFileSync:(e,t)=>R(e,t),lstatSync:e=>pe(e),readlinkSync:e=>he(e)};function $t(e,t=Qt){let n=Zt(e);if(!t.existsSync(n))return null;try{let e=JSON.parse(t.readFileSync(n,`utf8`));return e?.version===1?e:null}catch{return null}}function en(e){let t=e.replace(Xt,``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function tn(e,t,n=Qt){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}function nn(e){return te(e)||w(e)||ae(e)}const rn=10*1024*1024;function an(e,t,n,r){let i=O(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!nn(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);return e.format===`file`?(B(a,{force:!0}),{kind:`removed`}):e.format===`toml`?cn(a,o):e.format===`yaml`?sn(a,e.topLevelKey,o):on(a,e.topLevelKey,e.serverMapSubKey,o)}function on(e,t,n,r){let i;try{i=R(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=E(i,ie(t,n,r));return o?(g(e,a,{mode:k(e)}),{kind:`removed`}):{kind:`not-present`}}function sn(e,t,n){let r;try{r=R(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>rn)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,U.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=D(a);a.trim()===``||a.endsWith(`
11
11
  `)?c.endsWith(`
12
12
  `)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
@@ -17,4 +17,4 @@ import{o as e}from"./chunk-DTipWd-i.mjs";import{K as t,ft as n,q as r}from"./sle
17
17
  `).replace(/\n/g,`\r
18
18
  `));let u=`${i?``:``}${l}`;return u!==r&&g(e,u,{mode:k(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:f(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 K.default.green(e);case`desktop`:return K.default.blue(e);case`foreign`:return K.default.cyan(e);case`ui-orphan`:return K.default.magenta(e);case`stale`:return K.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=K.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??m,n=e.inspect??Z,r=e.log??(e=>console.log(e)),i=e.resolveCommand??d,a=e.resolveUsage??p,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 T(`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 m(),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 T(`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:h(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 m();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(h(F(je(),n)))})}export{je as _,Xt as a,$t as c,Z as d,qt as f,Me as g,Ne as h,an as i,en as l,Wt as m,Tn as n,tn as o,Ut as p,bn as r,Zt as s,Sn as t,Yt as u,Ae as v,Oe as y};
20
- //# sourceMappingURL=src-BUjTbFVJ.mjs.map
20
+ //# sourceMappingURL=src-Bh_IfeSA.mjs.map