@inkeep/open-knowledge 0.58.0-beta.8 → 0.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/dist/{acp-harness-probe-dZsvbgrC.mjs → acp-harness-probe-EY118B13.mjs} +2 -2
  2. package/dist/cli.mjs +23 -23
  3. package/dist/config-schema.json +1 -1
  4. package/dist/config.project.schema.json +1 -1
  5. package/dist/constants-CGYatEBL.mjs +2 -0
  6. package/dist/fs-traced-BEuPZxxL.mjs +1 -0
  7. package/dist/{fs-traced-oq2wG9J_.mjs → fs-traced-xJfl5Rxd.mjs} +2 -2
  8. package/dist/git-handle-CcWdc2o_.mjs +1 -0
  9. package/dist/{git-handle-2o4Vxedu.mjs → git-handle-Dk7GEAfH.mjs} +2 -2
  10. package/dist/index.d.mts +2 -2600
  11. package/dist/index.mjs +3 -3
  12. package/dist/init-BglLqrOW.mjs +1 -0
  13. package/dist/{init-DasMrTCg.mjs → init-CjDJqCL6.mjs} +5 -5
  14. package/dist/{launch-json-removal-BCc3Wt5o.mjs → launch-json-removal-DBGHaxha.mjs} +2 -2
  15. package/dist/{loader-CFnKYZR2.mjs → loader-B7lXyJFO.mjs} +2 -2
  16. package/dist/loader-xqwijD2m.mjs +1 -0
  17. package/dist/md-manager-30TBxbTV.mjs +2 -0
  18. package/dist/{open-browser-CMs-r6aL.mjs → open-browser-BXT69qcq.mjs} +2 -2
  19. package/dist/parse-worker.mjs +1 -1
  20. package/dist/preview-BqXocFFE.mjs +1 -0
  21. package/dist/{preview-Dv9l315C.mjs → preview-EGTe7kIb.mjs} +2 -2
  22. package/dist/public/assets/ActivityModeContent-Bh8PvwWR.js +1 -0
  23. package/dist/public/assets/{AgentDiffPane-BuZT0CFj.js → AgentDiffPane-CxvPSRp5.js} +1 -1
  24. package/dist/public/assets/{AgentIconCluster-D_inolLQ.js → AgentIconCluster-CjMEI-L4.js} +1 -1
  25. package/dist/public/assets/{AgentThreadClientBinder-Db3J-HNk.js → AgentThreadClientBinder-CZt9gzGP.js} +1 -1
  26. package/dist/public/assets/{AppMenubar-DNz-YQ-n.js → AppMenubar-CiSfRgZz.js} +1 -1
  27. package/dist/public/assets/{BugReportHistory-3WmeKMdN.js → BugReportHistory-DAkLR0uT.js} +1 -1
  28. package/dist/public/assets/{BugReportHistoryDialog-B8G8dpLP.js → BugReportHistoryDialog-D3FmiOs-.js} +1 -1
  29. package/dist/public/assets/{CodeMirrorPropInput-B3PfIk_d.js → CodeMirrorPropInput-Bj9gYc9v.js} +1 -1
  30. package/dist/public/assets/ConsentDialogBody-ByUP5rlV.js +2 -0
  31. package/dist/public/assets/{DiffView-CjTilKZT.js → DiffView-BbCF3n86.js} +1 -1
  32. package/dist/public/assets/DocumentContext-CM98n-Wm.js +38 -0
  33. package/dist/public/assets/EditorModeToggle-BOtGsJ58.js +1 -0
  34. package/dist/public/assets/EnableSyncConfirmDialog-edPIQ6AO.js +1 -0
  35. package/dist/public/assets/FeedbackForm-B44dYSuT.js +1 -0
  36. package/dist/public/assets/{GraphPanel-CEcqZRWw.js → GraphPanel-Dbt6ehOx.js} +1 -1
  37. package/dist/public/assets/ImportSkillDialog-BYZRPrHX.js +1 -0
  38. package/dist/public/assets/{LintConfigEditor-Bcr2QKP1.js → LintConfigEditor-DPAgvzQo.js} +1 -1
  39. package/dist/public/assets/ManagedArtifactProperties-D35GmczH.js +1 -0
  40. package/dist/public/assets/ManagedArtifactProperties-N6SxoaQN.js +1 -0
  41. package/dist/public/assets/McpConsentDialogBody-Cdxs_Q-f.js +1 -0
  42. package/dist/public/assets/{MermaidDocEditor-Co4QYa48.js → MermaidDocEditor-B-SpVE_4.js} +1 -1
  43. package/dist/public/assets/{OpenInAgentMenuItem-C_aRPIjj.js → OpenInAgentMenuItem--c5Kl0UJ.js} +1 -1
  44. package/dist/public/assets/{PropertyDisplayRow-CrYGlgp7.js → PropertyDisplayRow-JWrzMen3.js} +1 -1
  45. package/dist/public/assets/{ReportBugDialogBody-CN1i_Y7g.js → ReportBugDialogBody-Bn7KSO7Z.js} +1 -1
  46. package/dist/public/assets/SchemaConfigEditor-4ELQUjOk.js +1 -0
  47. package/dist/public/assets/SessionsHost-CkCwV0Gg.js +2 -0
  48. package/dist/public/assets/SettingsDialogBody-f_hQ7VPv.js +13 -0
  49. package/dist/public/assets/ShareBranchSwitchDialog-BcO94wih.js +1 -0
  50. package/dist/public/assets/ShareReceiveDialog-tG5J08TH.js +1 -0
  51. package/dist/public/assets/ShareReceiveMissDialog-ClfobBlL.js +1 -0
  52. package/dist/public/assets/{SkillCostValue-C0tQ5Ey6.js → SkillCostValue-XTEKNDJI.js} +1 -1
  53. package/dist/public/assets/{SkillDestinationList-DYjzv8JN.js → SkillDestinationList-Dw1naFS2.js} +1 -1
  54. package/dist/public/assets/{SkillEditBanner-DUbh82i0.js → SkillEditBanner-DFhrQ8xp.js} +1 -1
  55. package/dist/public/assets/{SkillInstallMenu-aKaOX_rG.js → SkillInstallMenu-B2HRT0pR.js} +1 -1
  56. package/dist/public/assets/{SkillOriginInline-Dcw5U9Gu.js → SkillOriginInline-Ba3UO-r0.js} +1 -1
  57. package/dist/public/assets/{SkillToolbarControls-CZNGVa1t.js → SkillToolbarControls-D_gVZcnp.js} +1 -1
  58. package/dist/public/assets/SlidesToolbarControls-Dtor0bv_.js +1 -0
  59. package/dist/public/assets/{SourceEditor-DrIQgn17.js → SourceEditor-CZ1cWoNO.js} +1 -1
  60. package/dist/public/assets/{TerminalPanel-C61cGKq0.js → TerminalPanel-D15yQGLN.js} +3 -3
  61. package/dist/public/assets/{TerminalWindowApp-Zyc8LXKG.js → TerminalWindowApp-DoVS1306.js} +1 -1
  62. package/dist/public/assets/{TextDocEditor-Dhfis_S6.js → TextDocEditor-gZsWz3eO.js} +1 -1
  63. package/dist/public/assets/{ThreadView-BZYcGOYJ.js → ThreadView-BQHsrBEu.js} +1 -1
  64. package/dist/public/assets/TimelineDiffPane-CT-ihYQ6.js +2 -0
  65. package/dist/public/assets/{auth-state-cache-CWPxRafc.js → auth-state-cache-BrvpmLJN.js} +4 -4
  66. package/dist/public/assets/{client-version-BsMRrwFS.js → client-version-vyi1QvTS.js} +1 -1
  67. package/dist/public/assets/comment-chips-C9lD2NUl.js +5 -0
  68. package/dist/public/assets/{config-provider-DkOV03RH.js → config-provider-D1oa8ar_.js} +3 -3
  69. package/dist/public/assets/{dist-CP7w45uR.js → dist-BrL2bd3x.js} +2 -2
  70. package/dist/public/assets/{doc-paths-CX0c2GkE.js → doc-paths-CeZpYfYr.js} +1 -1
  71. package/dist/public/assets/{documents-events-DGovPb4Q.js → documents-events-C6H3LrA9.js} +1 -1
  72. package/dist/public/assets/{file-tree-adapter-CNrTrjb9.js → file-tree-adapter-DFyrX-92.js} +1 -1
  73. package/dist/public/assets/{file-tree-utils-Ceep4GK6.js → file-tree-utils-C9zTW2_A.js} +1 -1
  74. package/dist/public/assets/{folder-config-api-BavUQIxi.js → folder-config-api-JwI3TW0L.js} +1 -1
  75. package/dist/public/assets/{follow-file-BDoShwy7.js → follow-file-H_OOuojl.js} +1 -1
  76. package/dist/public/assets/globals-CyRfFhRe.css +1 -0
  77. package/dist/public/assets/i18n-BdQmUBxL.js +1 -0
  78. package/dist/public/assets/index-BXv4_oa9.js +2095 -0
  79. package/dist/public/assets/{lint-config-client-BXCLXBm0.js → lint-config-client-qKPmO3Qw.js} +1 -1
  80. package/dist/public/assets/markdownlint-rule-browser-BNoonKhJ.js +1 -0
  81. package/dist/public/assets/{mcp-consent-store-lJGGM3y3.js → mcp-consent-store-Bxq-u2M3.js} +1 -1
  82. package/dist/public/assets/messages-BSrj3IKW.js +1 -0
  83. package/dist/public/assets/messages-BsTQ5dHv.js +1 -0
  84. package/dist/public/assets/messages-C-9-pube.js +1 -0
  85. package/dist/public/assets/messages-CH0H74g3.js +1 -0
  86. package/dist/public/assets/messages-C_U8ss6i.js +1 -0
  87. package/dist/public/assets/messages-Ce75_Ji3.js +1 -0
  88. package/dist/public/assets/messages-CyG8vSMs.js +1 -0
  89. package/dist/public/assets/messages-D2dSy_ch.js +1 -0
  90. package/dist/public/assets/messages-D7FYHWNu.js +1 -0
  91. package/dist/public/assets/messages-DavhhPbD.js +1 -0
  92. package/dist/public/assets/messages-DcmkySre.js +1 -0
  93. package/dist/public/assets/messages-YKhV6ZL8.js +1 -0
  94. package/dist/public/assets/{navigation-targets-B9ZSMArq.js → navigation-targets-Du1yYMa3.js} +1 -1
  95. package/dist/public/assets/{open-managed-artifact-tab-FyNAk92K.js → open-managed-artifact-tab-DA0xFMQL.js} +1 -1
  96. package/dist/public/assets/pending-receive-nav-store-jTqdW3b0.js +1 -0
  97. package/dist/public/assets/{platform-labels-C-SqHx4o.js → platform-labels-BW7YRK2j.js} +1 -1
  98. package/dist/public/assets/{project-paths-BShAgBI2.js → project-paths-xKaVJSAX.js} +1 -1
  99. package/dist/public/assets/{prop-types-BWoV6rdx.js → prop-types-LyJPmVUN.js} +1 -1
  100. package/dist/public/assets/{receive-store-sP45Lmaj.js → receive-store-C7uwmgHL.js} +1 -1
  101. package/dist/public/assets/{selection-context-jZhBCQUz.js → selection-context-BJ7u_a2a.js} +1 -1
  102. package/dist/public/assets/skill-actions-CUghpMeW.js +1 -0
  103. package/dist/public/assets/{skill-scope-C3ZLyDFU.js → skill-scope-41fjvVEv.js} +1 -1
  104. package/dist/public/assets/{skills-api-DkJBCb26.js → skills-api-BLsd0Xm0.js} +1 -1
  105. package/dist/public/assets/{src-DXY6B71v.js → src-TKA4AIQa.js} +1 -1
  106. package/dist/public/assets/{tag-pill-input-obzr2Bmc.js → tag-pill-input-BBAkEv9f.js} +1 -1
  107. package/dist/public/assets/{target-navigation-intent-IjRnfQQ9.js → target-navigation-intent-BxG_VSFm.js} +1 -1
  108. package/dist/public/assets/{terminal-cli-display-fzswbBoR.js → terminal-cli-display-B3miHBqb.js} +1 -1
  109. package/dist/public/assets/{terminal-launch-events-BZw6Kevo.js → terminal-launch-events-D3Djrj2P.js} +1 -1
  110. package/dist/public/assets/{terminal-telemetry-BTfW00Ir.js → terminal-telemetry-yDrCOyY3.js} +1 -1
  111. package/dist/public/assets/thread-client-d5910s2I.js +1 -0
  112. package/dist/public/assets/{typing-burst-detector-adEL1lyg.js → typing-burst-detector-BgFZQX05.js} +2 -2
  113. package/dist/public/assets/{uninstall-DJb5IlCU.js → uninstall-CFA5w-m5.js} +1 -1
  114. package/dist/public/assets/{use-activity-panel-bJnzXq1_.js → use-activity-panel-DPJJ75w9.js} +1 -1
  115. package/dist/public/assets/{use-apply-config-color-theme-hdarUMLl.js → use-apply-config-color-theme-Eo0YlkiS.js} +1 -1
  116. package/dist/public/assets/{use-collab-url-BSs7OT15.js → use-collab-url-DtfgRTLQ.js} +1 -1
  117. package/dist/public/assets/{use-live-xterm-theme-BQNkHYLe.js → use-live-xterm-theme-DSbS2g15.js} +1 -1
  118. package/dist/public/assets/use-open-skill-CmlgDEiD.js +1 -0
  119. package/dist/public/assets/{use-popular-skills-DSYrjkIc.js → use-popular-skills-AdcFV1D_.js} +1 -1
  120. package/dist/public/assets/{use-settings-route-CAQ6W9p6.js → use-settings-route-B2jig6fs.js} +1 -1
  121. package/dist/public/assets/use-skill-origin-DXe-gG8s.js +1 -0
  122. package/dist/public/assets/{use-skills-BrC3Upu3.js → use-skills-Ct4t-6Ji.js} +1 -1
  123. package/dist/public/assets/{use-terminal-enabled-B-_ScHv6.js → use-terminal-enabled-DLCLwzPR.js} +1 -1
  124. package/dist/public/assets/{use-timeline-entry-diff-EyIHz_x3.js → use-timeline-entry-diff-B1RCXahh.js} +1 -1
  125. package/dist/public/assets/{use-workspace-CFSG46RY.js → use-workspace-DXg_fDor.js} +1 -1
  126. package/dist/public/index.html +56 -56
  127. package/dist/public/uninstall.html +7 -7
  128. package/dist/{repair-launch-json-BU_wTHU6.mjs → repair-launch-json-CnC1yFmy.mjs} +2 -2
  129. package/dist/{repair-mcp-configs-DLGnB9SW.mjs → repair-mcp-configs-CO6hDA8w.mjs} +2 -2
  130. package/dist/repair-skills-BmR0xC0t.mjs +1 -0
  131. package/dist/repair-skills-DC9YrDGX.mjs +4 -0
  132. package/dist/schemas/v0/config.project.schema.json +1 -1
  133. package/dist/server-lock-D-FV4bZf.mjs +1 -0
  134. package/dist/{server-lock-CucURT_N.mjs → server-lock-xhUgHytn.mjs} +2 -2
  135. package/dist/{skill-teardown-C2iNSWvT.mjs → skill-teardown-DVWO087y.mjs} +2 -2
  136. package/dist/{sleep-BU8QtSQy.mjs → sleep-D_nNc7T_.mjs} +2 -2
  137. package/dist/src-Bf9qn1Q1.mjs +1 -0
  138. package/dist/{src-C1pxKPYT.mjs → src-CBALwizo.mjs} +4 -4
  139. package/dist/src-CCW4TQuz.mjs +357 -0
  140. package/dist/src-D5ZZydZi.mjs +2017 -0
  141. package/dist/{src-CXbUZB_b.mjs → src-DT3BV-Jn.mjs} +1 -1
  142. package/dist/start-Df_2ALn7.mjs +1 -0
  143. package/dist/start-ZRhTJkN6.mjs +12 -0
  144. package/dist/{ui-UQBOE6mj.mjs → ui-D8O01OgQ.mjs} +3 -3
  145. package/dist/{write-project-skill-7xCQZ9iq.mjs → write-project-skill-BufydPiH.mjs} +3 -3
  146. package/package.json +4 -4
  147. package/dist/constants-CzhGjsFo.mjs +0 -2
  148. package/dist/fs-traced-corg4Obj.mjs +0 -1
  149. package/dist/git-handle-DEjt_7O0.mjs +0 -1
  150. package/dist/init-Ct7mqKVm.mjs +0 -1
  151. package/dist/loader-C6UUw0ZZ.mjs +0 -1
  152. package/dist/md-manager-FXuCv5zc.mjs +0 -2
  153. package/dist/preview-D9SZkYr5.mjs +0 -1
  154. package/dist/public/assets/ActivityModeContent-DB3zhNIv.js +0 -1
  155. package/dist/public/assets/ConsentDialogBody-DIXTiaxR.js +0 -2
  156. package/dist/public/assets/DocumentContext-BNs9Wc7G.js +0 -38
  157. package/dist/public/assets/EditorModeToggle-SBfl-yYh.js +0 -1
  158. package/dist/public/assets/EnableSyncConfirmDialog-BoBmQwEy.js +0 -1
  159. package/dist/public/assets/FeedbackForm-Bwghznhy.js +0 -1
  160. package/dist/public/assets/ImportSkillDialog-C7EVNmz7.js +0 -1
  161. package/dist/public/assets/ManagedArtifactProperties-B3ZJ9FFR.js +0 -1
  162. package/dist/public/assets/ManagedArtifactProperties-CZwQTU72.js +0 -1
  163. package/dist/public/assets/McpConsentDialogBody-CRg_BChy.js +0 -1
  164. package/dist/public/assets/SchemaConfigEditor-CntIIKsB.js +0 -1
  165. package/dist/public/assets/SessionsHost-CdJc0MSK.js +0 -2
  166. package/dist/public/assets/SettingsDialogBody-8GHLppL4.js +0 -13
  167. package/dist/public/assets/ShareBranchSwitchDialog-K6rF_BB-.js +0 -1
  168. package/dist/public/assets/ShareReceiveDialog-D2tJPvcw.js +0 -1
  169. package/dist/public/assets/ShareReceiveMissDialog-PifhU4tt.js +0 -1
  170. package/dist/public/assets/SlidesToolbarControls-Cf1lF5oY.js +0 -1
  171. package/dist/public/assets/TimelineDiffPane-BBmd35R9.js +0 -2
  172. package/dist/public/assets/comment-chips-DdMmWihZ.js +0 -5
  173. package/dist/public/assets/globals-BGlAio6U.css +0 -1
  174. package/dist/public/assets/i18n-fvzGnIHb.js +0 -1
  175. package/dist/public/assets/index-Br-j853R.js +0 -2095
  176. package/dist/public/assets/markdownlint-rule-browser-CjQ1_sCE.js +0 -1
  177. package/dist/public/assets/messages-6l97Z9l-.js +0 -1
  178. package/dist/public/assets/messages-B6xCk04J.js +0 -1
  179. package/dist/public/assets/messages-BdOR8jpl.js +0 -1
  180. package/dist/public/assets/messages-BiqhEyiZ.js +0 -1
  181. package/dist/public/assets/messages-CWuRF_g4.js +0 -1
  182. package/dist/public/assets/messages-ChE4ifHJ.js +0 -1
  183. package/dist/public/assets/messages-D-dvdC6u.js +0 -1
  184. package/dist/public/assets/messages-D3F4EU1O.js +0 -1
  185. package/dist/public/assets/messages-D7hPscmx.js +0 -1
  186. package/dist/public/assets/messages-Debu1u7T.js +0 -1
  187. package/dist/public/assets/messages-Dr79fPY9.js +0 -1
  188. package/dist/public/assets/messages-Dwk3zwPu.js +0 -1
  189. package/dist/public/assets/pending-receive-nav-store-DR3ooVas.js +0 -1
  190. package/dist/public/assets/skill-actions-BAWcLPFa.js +0 -1
  191. package/dist/public/assets/thread-client-rJFsjItr.js +0 -1
  192. package/dist/public/assets/use-open-skill-B2CpqHwW.js +0 -1
  193. package/dist/public/assets/use-skill-origin-DbGsYAIW.js +0 -1
  194. package/dist/repair-skills-6kXbAVAI.mjs +0 -1
  195. package/dist/repair-skills-B2XZB3Rs.mjs +0 -4
  196. package/dist/server-lock-Tb9AMsy7.mjs +0 -1
  197. package/dist/src-Bf5oIrhA.mjs +0 -1
  198. package/dist/src-BjPajWAS.mjs +0 -357
  199. package/dist/src-pjKDNsjY.mjs +0 -2017
  200. package/dist/start-C62GgsB9.mjs +0 -1
  201. package/dist/start-rya2hbae.mjs +0 -12
  202. /package/dist/public/assets/{dist-CMZSEMCN2.js → dist-CuH7ikCn.js} +0 -0
  203. /package/dist/public/assets/{dist-CdT2fVlj.js → dist-DUfEoSbR.js} +0 -0
  204. /package/dist/public/assets/{globals-BBuo3zzi.js → globals-OB7mlRhv.js} +0 -0
@@ -1 +1 @@
1
- import{B as e,Fs as t,Gs as n,Ns as r,W as i,_s as a,g as o,gs as s,ps as c,v as l,xc as u}from"./src-BjPajWAS.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,Ar as y,At as b,B as x,Bi as S,Bn as C,Bt as w,C as T,Ca as E,Ci as D,Cn as O,Cr as k,Ct as A,D as j,Di as M,Dn as N,Dr as P,Dt as F,E as I,Ei as L,En as R,Er as z,Et as B,F as V,Fi as H,Fn as U,Fr as W,Ft as G,G as K,Gi as q,Gn as J,Gr as Y,Gt as X,H as Z,Hi as Q,Hn as $,Hr as ee,Ht as te,I as ne,Ii as re,In as ie,Ir as ae,It as oe,J as se,Ji as ce,Jn as le,Jr as ue,Jt as de,K as fe,Ki as pe,Kn as me,Kr as he,Kt as ge,L as _e,Li as ve,Ln as ye,Lt as be,M as xe,Mi as Se,Mn as Ce,Mr as we,Mt as Te,N as Ee,Ni as De,Nn as Oe,Nr as ke,Nt as Ae,O as je,Oi as Me,On as Ne,Or as Pe,Ot as Fe,P as Ie,Pi as Le,Pn as Re,Pr as ze,Pt as Be,Q as Ve,Qi as He,Qn as Ue,Qr as We,Qt as Ge,R as Ke,Ri as qe,Rn as Je,Rt as Ye,S as Xe,Sa as Ze,Sn as Qe,Sr as $e,St as et,T as tt,Ti as nt,Tn as rt,Tr as it,Tt as at,U as ot,Ui as st,Un as ct,Ur as lt,Ut as ut,V as dt,Vi as ft,Vn as pt,Vt as mt,W as ht,Wi as gt,Wn as _t,Wr as vt,Wt as yt,X as bt,Xi as xt,Xn as St,Xr as Ct,Xt as wt,Y as Tt,Yi as Et,Yn as Dt,Yr as Ot,Yt as kt,Z as At,Zi as jt,Zn as Mt,Zr as Nt,Zt as Pt,_ as Ft,_a as It,_i as Lt,_n as Rt,_r as zt,_t as Bt,a as Vt,aa as Ht,ai as Ut,an as Wt,ar as Gt,at as Kt,b as qt,ba as Jt,bi as Yt,bn as Xt,br as Zt,bt as Qt,c as $t,ca as en,ci as tn,cn as nn,cr as rn,d as an,da as on,di as sn,dn as cn,dr as ln,ea as un,ei as dn,en as fn,er as pn,et as mn,f as hn,fa as gn,fi as _n,fn as vn,fr as yn,g as bn,ga as xn,gi as Sn,gn as Cn,gr as wn,gt as Tn,h as En,ha as Dn,hi as On,hn as kn,hr as An,ht as jn,i as Mn,ia as Nn,ii as Pn,in as Fn,ir as In,it as Ln,j as Rn,ji as zn,jn as Bn,jr as Vn,jt as Hn,k as Un,ki as Wn,kn as Gn,kr as Kn,kt as qn,l as Jn,la as Yn,li as Xn,ln as Zn,lr as Qn,m as $n,ma as er,mi as tr,mn as nr,mr as rr,mt as ir,n as ar,na as or,ni as sr,nn as cr,nr as lr,nt as ur,o as dr,oa as fr,oi as pr,on as mr,or as hr,ot as gr,p as _r,pa as vr,pi as yr,pn as br,pr as xr,q as Sr,qi as Cr,qn as wr,qr as Tr,qt as Er,r as Dr,ra as Or,ri as kr,rn as Ar,rr as jr,rt as Mr,s as Nr,sa as Pr,si as Fr,sn as Ir,sr as Lr,st as Rr,t as zr,ta as Br,ti as Vr,tn as Hr,tr as Ur,tt as Wr,u as Gr,ua as Kr,ui as qr,un as Jr,ur as Yr,v as Xr,va as Zr,vi as Qr,vn as $r,vr as ei,vt as ti,w as ni,wa as ri,wi as ii,wn as ai,wr as oi,wt as si,x as ci,xa as li,xi as ui,xn as di,xr as fi,xt as pi,y as mi,ya as hi,yi as gi,yn as _i,yr as vi,yt as yi,z as bi,zi as xi,zn as Si,zt as Ci}from"./src-pjKDNsjY.mjs";import{C as wi,E as Ti,T as Ei,_ as Di,b as Oi,c as ki,d as Ai,g as ji,i as Mi,l as Ni,m as Pi,n as Fi,p as Ii,s as Li,t as Ri,u as zi,v as Bi,w as Vi,x as Hi,y as Ui}from"./fs-traced-oq2wG9J_.mjs";import{a as Wi,d as Gi,f as Ki,i as qi,l as Ji,n as Yi,r as Xi,t as Zi,u as Qi}from"./logger-DFxEUjvj.mjs";import{C as $i,S as ea,_ as ta,a as na,c as ra,d as ia,g as aa,h as oa,i as sa,l as ca,m as la,n as ua,o as da,p as fa,r as pa,s as ma,t as ha,u as ga,v as _a,y as va}from"./server-lock-CucURT_N.mjs";export{Dn as AGENT_ID_MAX_LEN,xn as AGENT_ID_RE,zn as AGENT_WRITE_ORIGIN,Ze as AcpPermissionStore,hi as AcpRegistry,L as AcpThreadManager,ii as AgentFocusBroadcaster,D as AgentPresenceBroadcaster,Se as AgentSessionCapacityError,De as AgentSessionManager,jn as AutoStartDisabledError,$e as BUNDLE_IDS,k as BUNDLE_SCOPE,oi as BUNDLE_SKILL_NAME,Ur as BacklinkIndex,st as CC1Broadcaster,t as CC1_CONTRACT_VERSION,kn as CONFIG_FILENAME,Dt as CONFLICT_MARKER_RE,vt as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ft as ConfigSchema,Et as DEFAULT_CHECKPOINT_RETENTION,Xn as DEFAULT_EMBEDDINGS_DIMENSIONS,w as DEFAULT_PACK_ID,dt as DocumentDurabilityState,qr as EMBEDDINGS_API_KEY_ENV,O as ExposureConsentError,Jt as FEATURED_AGENT_IDS,xt as FILE_SYSTEM_WRITER,p as FILE_WATCHER_ORIGIN,kr as FileEmbeddingsBackend,cr as GIT_PREFLIGHT_FAIL_SPAN_NAME,jt as GIT_UPSTREAM_WRITER,E as GitDirAccessError,Fn as GitNotAvailableError,Wt as GitTooOldError,Tn as HOCUSPOCUS_AUTH_REJECTION_REASONS,Bt as HocuspocusAuthRejection,ti as HocuspocusAuthTokenSchema,Ct as INSTALLED_AGENTS_SCHEMES,r as LINEAGE_EPOCH_KEY,Ke as LIVE_DERIVED_INDEX_DEBOUNCE_MS,mt as LOG_MD_TEMPLATE,at as MANAGED_RENAME_ORIGIN,M as MAX_ACP_THREADS,Le as MAX_AGENT_SESSIONS,Wn as MCP_CONNECTION_ID_HEADER,c as MCP_SERVER_NAME,H as MIN_EVICTABLE_IDLE_MS,mr as MIN_GIT_VERSION,Z as MISSING_OK_CONFIG_MESSAGE,ri as MalformedGitPointerError,mn as McpLogger,ot as MissingOkConfigError,ve as OBSERVER_SYNC_ORIGIN,Cn as OK_OKIGNORE_TEMPLATE,s as ORPHAN_MODES,u as PROTOCOL_VERSION,Zi as PinoLogger,ra as ProcessLockCollisionError,Jn as ProjectGitInitError,B as ROLLBACK_ORIGIN,Rt as ROOT_GITIGNORE_TEMPLATE,ta as RUNTIME_VERSION,He as SERVICE_WRITER,zt as SKILL_INSTALL_EVENTS_FILE_REL,e as SKILL_STATE_TARGETS,te as STARTER_FOLDERS,ut as STARTER_FOLDER_FRONTMATTER_FILENAME,yt as STARTER_PACKS,X as STARTER_PACK_IDS,ge as STARTER_TEMPLATES,tt as STATE_MANIFEST_FILENAME,_a as STATE_SCHEMA_VERSION,n as SYSTEM_DOC_NAME,Ge as SeedPrerequisiteError,h as SeedRootDirError,ha as ServerLockCollisionError,zr as SingleFileNotAFileError,ar as SingleFileNotFoundError,Dr as SingleFileNotMarkdownError,I as StateManifestError,pn as TagIndex,it as USER_GLOBAL_BUNDLE_IDS,Te as UiLockCollisionError,F as __getShowAllWalkStatsForTesting,Fe as __resetShowAllWalkStatsForTesting,ca as acquireProcessLock,ua as acquireServerLock,Ae as acquireUiLock,re as applyAgentMarkdownWrite,wr as applyExternalChange,Ci as applySeed,j as assertCompatibleStateManifest,Ir as assertGitAvailable,U as assertNeverDiskEvent,nt as attachAcpThreadSocket,ir as attachIdleShutdown,Xr as bootServer,jr as buildAndOpenSkill,$r as buildConfigYmlContent,Tt as buildExecResult,ai as buildIngressPolicy,Me as buildOkMcpStdioCommand,vi as buildSkillZip,Er as buildStarterFolderFrontmatterYaml,f as buildWipTree,z as bundleSkillMdPath,Pn as canonicalProjectKey,ie as classifyEvents,Ri as classifyFsPath,Ut as clearAllEmbeddingsKeys,_n as clearContributors,de as coercePackId,o as colorFromSeed,un as commitUpstreamImport,Br as commitWip,or as commitWipFromTree,nn as compareSemver,Kn as composeEffectiveLinterConfig,y as composeFrontmatterSchemasConfig,St as containsConflictMarkers,ye as contentHash,yr as contributorCount,Ie as countShadowObjects,V as countStaleAgentWipRefs,ne as countWipRefs,qn as createApiExtension,si as createAssetServeMiddleware,K as createCollaborationHost,ee as createContentFilter,lt as createContentFilterAsync,pr as createEmbeddingsSecretStore,Mn as createEphemeralProjectDir,le as createExternalChangeHandler,hn as createFileLogger,bi as createLiveDerivedIndexExtension,Sr as createMcpHttpHandler,Nt as createOsProbe,Ee as createPersistenceExtension,T as createServer,Rn as createServerObserverExtension,S as createStreamingErrorWriter,Yi as createTestLogger,Fr as describeStoredEmbeddingsKey,bn as detectClaudeDesktopPresence,Zn as detectGit,je as detectProjectShape,In as detectUserSkillHosts,Mr as discoverLockDirs,ke as discoverMarkdownlintConfig,Ar as emitPreflightFailureSpan,bt as encodeDocName,At as encodeFolderRoute,Ve as encodeSkillRoute,Gr as ensureProjectGit,_i as ensureProjectSkillGitignore,ft as errorResponse,Je as evictStaleTrackerEntries,b as extractHeadings,Ln as extractOkBinaryPath,lr as extractWikiLinksFromMarkdown,Jr as fallbackPaths,an as findEnclosingGitRoot,Oe as findEnclosingProjectRoot,ze as findNativeMarkdownlintFile,_r as flushFileLogger,yi as formatAuthRejectionWire,tr as formatContributors,On as formatContributorsFrom,be as formatPackRationale,Or as gcCheckpointRefs,Wr as getCurrentMcpLogger,rt as getIngressContext,gi as getLocalDir,$n as getLogFilePath,Xi as getLogger,En as getLogsDir,va as getMachineId,Ui as getMeter,Kr as getMetrics,Oi as getTracer,on as handleCollabSocketError,Y as handleSpawnCursor,R as hasForwardingHeaders,_e as hasGcLogLatch,l as iconFromClientName,gn as incrementCollabSocketFilteredError,vr as incrementServerObserverFire,Xt as initContent,Nn as initShadowRepo,Hi as initTelemetry,qt as initToleranceTelemetryWriter,Rr as installPrettyZodErrors,qi as installTestLoggers,Gt as installUserSkill,Ce as isAllowedApiOrigin,v as isAllowedWorkspaceHostHeader,gt as isConfigDoc,Qt as isHocuspocusAuthRejectionReason,N as isHostAdmitted,kt as isKnownPackId,q as isLinkIndexExcludedDoc,Bn as isLoopbackAddress,pe as isManagedArtifactDoc,Ne as isOriginAdmitted,a as isOrphanMode,qe as isPairedWriteOrigin,he as isPathWithinDir,Gn as isPeerAdmitted,ea as isProcessAlive,Re as isProjectRoot,Cr as isReservedForUserTree,Si as isSelfWrite,ce as isSystemDoc,ci as isToleranceTelemetryEnabled,$i as isValidLockPid,C as lastKnownHash,Ht as listRescueCheckpoints,wt as listStarterPacks,li as loadCustomAgents,xe as loadPrincipal,ga as lockBaseUrl,ia as lockFilePath,Wi as loggerFactory,Ji as logsCurrentPath,Qi as logsPreviousPath,tn as makeLazyEmbeddingsKeyStore,pa as markServerLockDraining,ht as mountMcpAndApi,Fi as normalizeFsPath,P as originGitHubHost,di as packageVersionMajorMinor,pi as parseAuthRejectionWire,cn as parseGitVersion,et as parseHocuspocusAuthToken,fe as parseKeepaliveConnectionId,pt as pathToDocName,Ye as planSeed,Vt as prepareSingleFileOpen,Kt as processCommand,gr as processUsage,rn as readAllTargets,Qn as readBundleDecision,W as readOwnNativeRules,fa as readProcessLock,la as readProcessLockDetailed,x as readProjectHeadState,sr as readProjectLocalSemanticConfig,sa as readServerLock,Yr as readServerPackageVersion,ln as readSkillInstallStateSnapshot,Un as readStateManifest,yn as readTargetRecordedAt,xr as readTargetVersion,Be as readUiLock,Mt as reconcile,Sn as recordContributor,ei as recordSkillInstallEvent,se as registerAllTools,$ as registerWrite,oa as releaseProcessLock,na as releaseServerLock,G as releaseUiLock,ct as removeLastKnownHash,Lr as reportSkillInstall,er as resetMetrics,hr as resolveBuiltinSkillHosts,i as resolveBundleEnabled,Zt as resolveBundledSkillDir,Yt as resolveContentDir,Tr as resolveCursorBinaryDefault,ue as resolveCursorSpawnInvocation,Vn as resolveEffectiveLinterConfig,sn as resolveEmbeddingsCredential,ui as resolveLockDir,we as resolveNativeConfigForDoc,ae as resolveNativeMarkdownlintConfig,Pt as resolvePack,Nr as resolvePackageVersion,wn as resolveSkillInstallReportSettings,d as resolveUiInfo,Lt as restoreContributors,mi as restoreLifecycleFromConflictsJson,dn as rewriteMarkdownLinksForDocumentRename,Vr as rewriteWikiLinksForDocumentRename,vn as runAuthReposSubprocess,br as runAuthStatusSubprocess,fn as runCloneSubprocess,nr as runDeviceFlowSubprocess,ur as runWithMcpLogger,m as safeContentPath,Hn as safeSubdir,fr as safetyCheckpoint,_ as sanitizeClientName,Pr as saveInMemoryCheckpoint,en as saveVersion,A as seedBasenameIndex,dr as serializeError,wi as setActiveSpanAttributes,xi as setupServerObservers,Yn as shadowGit,Vi as shutdownTelemetry,Gi as spansCurrentPath,Ki as spansPreviousPath,Ot as spawnDetached,Ue as splitMarkdownBlocks,_t as startWatcher,Q as streamingProblemEvent,Qr as swapContributors,Xe as teardownToleranceTelemetryWriter,It as toBroadcasterKey,Mi as tracedAppendFileSync,Li as tracedLinkSync,ki as tracedMkdir,Ni as tracedMkdirSync,zi as tracedRename,Ai as tracedRenameSync,Ii as tracedRmSync,Pi as tracedRmdirSync,ji as tracedUnlinkSync,Di as tracedWriteFile,Bi as tracedWriteFileSync,ni as trustSystemCertificates,$t as untrackTrackedProjectSkillProjection,J as updateLastKnownHash,aa as updateProcessLockPort,da as updateServerLockPort,oe as updateUiLockPort,Zr as validateAgentId,Hr as validateCloneInputs,fi as validateSkillZip,ma as waitForServerLockDrain,We as withHiddenWindowsConsole,Ei as withSpan,Ti as withSpanSync,rr as writeBundleDecision,Pe as writeMarkdownlintRule,Qe as writeRootGitignoreForNewRepo,g as writeStateManifest,An as writeTargetVersion,me as writeTracker};
1
+ import{B as e,Ms as t,Ps as n,W as r,Ws as i,bc as a,fs as o,g as s,gs as c,hs as l,v as u}from"./src-CCW4TQuz.mjs";import{$ as d,$i as f,$n as p,$r as m,$t as h,A as g,Ai as _,An as v,Ar as y,At as b,B as x,Bi as S,Bn as C,Bt as w,C as T,Ca as E,Ci as D,Cn as O,Cr as k,Ct as A,D as j,Di as M,Dn as N,Dr as P,Dt as F,E as I,Ei as L,En as R,Er as z,Et as B,F as V,Fi as H,Fn as U,Fr as W,Ft as G,G as K,Gi as q,Gn as J,Gr as Y,Gt as X,H as Z,Hi as Q,Hn as $,Hr as ee,Ht as te,I as ne,Ii as re,In as ie,Ir as ae,It as oe,J as se,Ji as ce,Jn as le,Jr as ue,Jt as de,K as fe,Ki as pe,Kn as me,Kr as he,Kt as ge,L as _e,Li as ve,Ln as ye,Lt as be,M as xe,Mi as Se,Mn as Ce,Mr as we,Mt as Te,N as Ee,Ni as De,Nn as Oe,Nr as ke,Nt as Ae,O as je,Oi as Me,On as Ne,Or as Pe,Ot as Fe,P as Ie,Pi as Le,Pn as Re,Pr as ze,Pt as Be,Q as Ve,Qi as He,Qn as Ue,Qr as We,Qt as Ge,R as Ke,Ri as qe,Rn as Je,Rt as Ye,S as Xe,Sa as Ze,Sn as Qe,Sr as $e,St as et,T as tt,Ti as nt,Tn as rt,Tr as it,Tt as at,U as ot,Ui as st,Un as ct,Ur as lt,Ut as ut,V as dt,Vi as ft,Vn as pt,Vt as mt,W as ht,Wi as gt,Wn as _t,Wr as vt,Wt as yt,X as bt,Xi as xt,Xn as St,Xr as Ct,Xt as wt,Y as Tt,Yi as Et,Yn as Dt,Yr as Ot,Yt as kt,Z as At,Zi as jt,Zn as Mt,Zr as Nt,Zt as Pt,_ as Ft,_a as It,_i as Lt,_n as Rt,_r as zt,_t as Bt,a as Vt,aa as Ht,ai as Ut,an as Wt,ar as Gt,at as Kt,b as qt,ba as Jt,bi as Yt,bn as Xt,br as Zt,bt as Qt,c as $t,ca as en,ci as tn,cn as nn,cr as rn,d as an,da as on,di as sn,dn as cn,dr as ln,ea as un,ei as dn,en as fn,er as pn,et as mn,f as hn,fa as gn,fi as _n,fn as vn,fr as yn,g as bn,ga as xn,gi as Sn,gn as Cn,gr as wn,gt as Tn,h as En,ha as Dn,hi as On,hn as kn,hr as An,ht as jn,i as Mn,ia as Nn,ii as Pn,in as Fn,ir as In,it as Ln,j as Rn,ji as zn,jn as Bn,jr as Vn,jt as Hn,k as Un,ki as Wn,kn as Gn,kr as Kn,kt as qn,l as Jn,la as Yn,li as Xn,ln as Zn,lr as Qn,m as $n,ma as er,mi as tr,mn as nr,mr as rr,mt as ir,n as ar,na as or,ni as sr,nn as cr,nr as lr,nt as ur,o as dr,oa as fr,oi as pr,on as mr,or as hr,ot as gr,p as _r,pa as vr,pi as yr,pn as br,pr as xr,q as Sr,qi as Cr,qn as wr,qr as Tr,qt as Er,r as Dr,ra as Or,ri as kr,rn as Ar,rr as jr,rt as Mr,s as Nr,sa as Pr,si as Fr,sn as Ir,sr as Lr,st as Rr,t as zr,ta as Br,ti as Vr,tn as Hr,tr as Ur,tt as Wr,u as Gr,ua as Kr,ui as qr,un as Jr,ur as Yr,v as Xr,va as Zr,vi as Qr,vn as $r,vr as ei,vt as ti,w as ni,wa as ri,wi as ii,wn as ai,wr as oi,wt as si,x as ci,xa as li,xi as ui,xn as di,xr as fi,xt as pi,y as mi,ya as hi,yi as gi,yn as _i,yr as vi,yt as yi,z as bi,zi as xi,zn as Si,zt as Ci}from"./src-D5ZZydZi.mjs";import{C as wi,E as Ti,T as Ei,_ as Di,b as Oi,c as ki,d as Ai,g as ji,i as Mi,l as Ni,m as Pi,n as Fi,p as Ii,s as Li,t as Ri,u as zi,v as Bi,w as Vi,x as Hi,y as Ui}from"./fs-traced-xJfl5Rxd.mjs";import{a as Wi,d as Gi,f as Ki,i as qi,l as Ji,n as Yi,r as Xi,t as Zi,u as Qi}from"./logger-DFxEUjvj.mjs";import{C as $i,S as ea,_ as ta,a as na,c as ra,d as ia,g as aa,h as oa,i as sa,l as ca,m as la,n as ua,o as da,p as fa,r as pa,s as ma,t as ha,u as ga,v as _a,y as va}from"./server-lock-xhUgHytn.mjs";export{Dn as AGENT_ID_MAX_LEN,xn as AGENT_ID_RE,zn as AGENT_WRITE_ORIGIN,Ze as AcpPermissionStore,hi as AcpRegistry,L as AcpThreadManager,ii as AgentFocusBroadcaster,D as AgentPresenceBroadcaster,Se as AgentSessionCapacityError,De as AgentSessionManager,jn as AutoStartDisabledError,$e as BUNDLE_IDS,k as BUNDLE_SCOPE,oi as BUNDLE_SKILL_NAME,Ur as BacklinkIndex,st as CC1Broadcaster,n as CC1_CONTRACT_VERSION,kn as CONFIG_FILENAME,Dt as CONFLICT_MARKER_RE,vt as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ft as ConfigSchema,Et as DEFAULT_CHECKPOINT_RETENTION,Xn as DEFAULT_EMBEDDINGS_DIMENSIONS,w as DEFAULT_PACK_ID,dt as DocumentDurabilityState,qr as EMBEDDINGS_API_KEY_ENV,O as ExposureConsentError,Jt as FEATURED_AGENT_IDS,xt as FILE_SYSTEM_WRITER,p as FILE_WATCHER_ORIGIN,kr as FileEmbeddingsBackend,cr as GIT_PREFLIGHT_FAIL_SPAN_NAME,jt as GIT_UPSTREAM_WRITER,E as GitDirAccessError,Fn as GitNotAvailableError,Wt as GitTooOldError,Tn as HOCUSPOCUS_AUTH_REJECTION_REASONS,Bt as HocuspocusAuthRejection,ti as HocuspocusAuthTokenSchema,Ct as INSTALLED_AGENTS_SCHEMES,t as LINEAGE_EPOCH_KEY,Ke as LIVE_DERIVED_INDEX_DEBOUNCE_MS,mt as LOG_MD_TEMPLATE,at as MANAGED_RENAME_ORIGIN,M as MAX_ACP_THREADS,Le as MAX_AGENT_SESSIONS,Wn as MCP_CONNECTION_ID_HEADER,o as MCP_SERVER_NAME,H as MIN_EVICTABLE_IDLE_MS,mr as MIN_GIT_VERSION,Z as MISSING_OK_CONFIG_MESSAGE,ri as MalformedGitPointerError,mn as McpLogger,ot as MissingOkConfigError,ve as OBSERVER_SYNC_ORIGIN,Cn as OK_OKIGNORE_TEMPLATE,l as ORPHAN_MODES,a as PROTOCOL_VERSION,Zi as PinoLogger,ra as ProcessLockCollisionError,Jn as ProjectGitInitError,B as ROLLBACK_ORIGIN,Rt as ROOT_GITIGNORE_TEMPLATE,ta as RUNTIME_VERSION,He as SERVICE_WRITER,zt as SKILL_INSTALL_EVENTS_FILE_REL,e as SKILL_STATE_TARGETS,te as STARTER_FOLDERS,ut as STARTER_FOLDER_FRONTMATTER_FILENAME,yt as STARTER_PACKS,X as STARTER_PACK_IDS,ge as STARTER_TEMPLATES,tt as STATE_MANIFEST_FILENAME,_a as STATE_SCHEMA_VERSION,i as SYSTEM_DOC_NAME,Ge as SeedPrerequisiteError,h as SeedRootDirError,ha as ServerLockCollisionError,zr as SingleFileNotAFileError,ar as SingleFileNotFoundError,Dr as SingleFileNotMarkdownError,I as StateManifestError,pn as TagIndex,it as USER_GLOBAL_BUNDLE_IDS,Te as UiLockCollisionError,F as __getShowAllWalkStatsForTesting,Fe as __resetShowAllWalkStatsForTesting,ca as acquireProcessLock,ua as acquireServerLock,Ae as acquireUiLock,re as applyAgentMarkdownWrite,wr as applyExternalChange,Ci as applySeed,j as assertCompatibleStateManifest,Ir as assertGitAvailable,U as assertNeverDiskEvent,nt as attachAcpThreadSocket,ir as attachIdleShutdown,Xr as bootServer,jr as buildAndOpenSkill,$r as buildConfigYmlContent,Tt as buildExecResult,ai as buildIngressPolicy,Me as buildOkMcpStdioCommand,vi as buildSkillZip,Er as buildStarterFolderFrontmatterYaml,f as buildWipTree,z as bundleSkillMdPath,Pn as canonicalProjectKey,ie as classifyEvents,Ri as classifyFsPath,Ut as clearAllEmbeddingsKeys,_n as clearContributors,de as coercePackId,s as colorFromSeed,un as commitUpstreamImport,Br as commitWip,or as commitWipFromTree,nn as compareSemver,Kn as composeEffectiveLinterConfig,y as composeFrontmatterSchemasConfig,St as containsConflictMarkers,ye as contentHash,yr as contributorCount,Ie as countShadowObjects,V as countStaleAgentWipRefs,ne as countWipRefs,qn as createApiExtension,si as createAssetServeMiddleware,K as createCollaborationHost,ee as createContentFilter,lt as createContentFilterAsync,pr as createEmbeddingsSecretStore,Mn as createEphemeralProjectDir,le as createExternalChangeHandler,hn as createFileLogger,bi as createLiveDerivedIndexExtension,Sr as createMcpHttpHandler,Nt as createOsProbe,Ee as createPersistenceExtension,T as createServer,Rn as createServerObserverExtension,S as createStreamingErrorWriter,Yi as createTestLogger,Fr as describeStoredEmbeddingsKey,bn as detectClaudeDesktopPresence,Zn as detectGit,je as detectProjectShape,In as detectUserSkillHosts,Mr as discoverLockDirs,ke as discoverMarkdownlintConfig,Ar as emitPreflightFailureSpan,bt as encodeDocName,At as encodeFolderRoute,Ve as encodeSkillRoute,Gr as ensureProjectGit,_i as ensureProjectSkillGitignore,ft as errorResponse,Je as evictStaleTrackerEntries,b as extractHeadings,Ln as extractOkBinaryPath,lr as extractWikiLinksFromMarkdown,Jr as fallbackPaths,an as findEnclosingGitRoot,Oe as findEnclosingProjectRoot,ze as findNativeMarkdownlintFile,_r as flushFileLogger,yi as formatAuthRejectionWire,tr as formatContributors,On as formatContributorsFrom,be as formatPackRationale,Or as gcCheckpointRefs,Wr as getCurrentMcpLogger,rt as getIngressContext,gi as getLocalDir,$n as getLogFilePath,Xi as getLogger,En as getLogsDir,va as getMachineId,Ui as getMeter,Kr as getMetrics,Oi as getTracer,on as handleCollabSocketError,Y as handleSpawnCursor,R as hasForwardingHeaders,_e as hasGcLogLatch,u as iconFromClientName,gn as incrementCollabSocketFilteredError,vr as incrementServerObserverFire,Xt as initContent,Nn as initShadowRepo,Hi as initTelemetry,qt as initToleranceTelemetryWriter,Rr as installPrettyZodErrors,qi as installTestLoggers,Gt as installUserSkill,Ce as isAllowedApiOrigin,v as isAllowedWorkspaceHostHeader,gt as isConfigDoc,Qt as isHocuspocusAuthRejectionReason,N as isHostAdmitted,kt as isKnownPackId,q as isLinkIndexExcludedDoc,Bn as isLoopbackAddress,pe as isManagedArtifactDoc,Ne as isOriginAdmitted,c as isOrphanMode,qe as isPairedWriteOrigin,he as isPathWithinDir,Gn as isPeerAdmitted,ea as isProcessAlive,Re as isProjectRoot,Cr as isReservedForUserTree,Si as isSelfWrite,ce as isSystemDoc,ci as isToleranceTelemetryEnabled,$i as isValidLockPid,C as lastKnownHash,Ht as listRescueCheckpoints,wt as listStarterPacks,li as loadCustomAgents,xe as loadPrincipal,ga as lockBaseUrl,ia as lockFilePath,Wi as loggerFactory,Ji as logsCurrentPath,Qi as logsPreviousPath,tn as makeLazyEmbeddingsKeyStore,pa as markServerLockDraining,ht as mountMcpAndApi,Fi as normalizeFsPath,P as originGitHubHost,di as packageVersionMajorMinor,pi as parseAuthRejectionWire,cn as parseGitVersion,et as parseHocuspocusAuthToken,fe as parseKeepaliveConnectionId,pt as pathToDocName,Ye as planSeed,Vt as prepareSingleFileOpen,Kt as processCommand,gr as processUsage,rn as readAllTargets,Qn as readBundleDecision,W as readOwnNativeRules,fa as readProcessLock,la as readProcessLockDetailed,x as readProjectHeadState,sr as readProjectLocalSemanticConfig,sa as readServerLock,Yr as readServerPackageVersion,ln as readSkillInstallStateSnapshot,Un as readStateManifest,yn as readTargetRecordedAt,xr as readTargetVersion,Be as readUiLock,Mt as reconcile,Sn as recordContributor,ei as recordSkillInstallEvent,se as registerAllTools,$ as registerWrite,oa as releaseProcessLock,na as releaseServerLock,G as releaseUiLock,ct as removeLastKnownHash,Lr as reportSkillInstall,er as resetMetrics,hr as resolveBuiltinSkillHosts,r as resolveBundleEnabled,Zt as resolveBundledSkillDir,Yt as resolveContentDir,Tr as resolveCursorBinaryDefault,ue as resolveCursorSpawnInvocation,Vn as resolveEffectiveLinterConfig,sn as resolveEmbeddingsCredential,ui as resolveLockDir,we as resolveNativeConfigForDoc,ae as resolveNativeMarkdownlintConfig,Pt as resolvePack,Nr as resolvePackageVersion,wn as resolveSkillInstallReportSettings,d as resolveUiInfo,Lt as restoreContributors,mi as restoreLifecycleFromConflictsJson,dn as rewriteMarkdownLinksForDocumentRename,Vr as rewriteWikiLinksForDocumentRename,vn as runAuthReposSubprocess,br as runAuthStatusSubprocess,fn as runCloneSubprocess,nr as runDeviceFlowSubprocess,ur as runWithMcpLogger,m as safeContentPath,Hn as safeSubdir,fr as safetyCheckpoint,_ as sanitizeClientName,Pr as saveInMemoryCheckpoint,en as saveVersion,A as seedBasenameIndex,dr as serializeError,wi as setActiveSpanAttributes,xi as setupServerObservers,Yn as shadowGit,Vi as shutdownTelemetry,Gi as spansCurrentPath,Ki as spansPreviousPath,Ot as spawnDetached,Ue as splitMarkdownBlocks,_t as startWatcher,Q as streamingProblemEvent,Qr as swapContributors,Xe as teardownToleranceTelemetryWriter,It as toBroadcasterKey,Mi as tracedAppendFileSync,Li as tracedLinkSync,ki as tracedMkdir,Ni as tracedMkdirSync,zi as tracedRename,Ai as tracedRenameSync,Ii as tracedRmSync,Pi as tracedRmdirSync,ji as tracedUnlinkSync,Di as tracedWriteFile,Bi as tracedWriteFileSync,ni as trustSystemCertificates,$t as untrackTrackedProjectSkillProjection,J as updateLastKnownHash,aa as updateProcessLockPort,da as updateServerLockPort,oe as updateUiLockPort,Zr as validateAgentId,Hr as validateCloneInputs,fi as validateSkillZip,ma as waitForServerLockDrain,We as withHiddenWindowsConsole,Ei as withSpan,Ti as withSpanSync,rr as writeBundleDecision,Pe as writeMarkdownlintRule,Qe as writeRootGitignoreForNewRepo,g as writeStateManifest,An as writeTargetVersion,me as writeTracker};
@@ -0,0 +1 @@
1
+ import{T as e,_ as t,m as n,n as r}from"./start-ZRhTJkN6.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
@@ -0,0 +1,12 @@
1
+ import{M as e}from"./sleep-D_nNc7T_.mjs";import{ac as t,dc as n,lc as r,nc as i,rc as a,uc as o}from"./src-CCW4TQuz.mjs";import{Pn as s,a as ee,ci as c}from"./src-D5ZZydZi.mjs";import{b as l,v as u,y as d}from"./write-project-skill-BufydPiH.mjs";import{a as f,c as p,d as m,i as h,o as g,r as _,t as v}from"./acp-harness-probe-EY118B13.mjs";import{n as y}from"./constants-CGYatEBL.mjs";import{spawn as b}from"node:child_process";import{basename as x,resolve as S}from"node:path";import{existsSync as C}from"node:fs";import{rm as w}from"node:fs/promises";import{setTimeout as te}from"node:timers/promises";function T(e,t){return e.bind?.[0]??e.host??t.HOST??`127.0.0.1`}function E(e){if(e===`ui`||e===`server`)return e;throw new d(`--only must be 'ui' or 'server'`)}function D(e=C){let t=import.meta.dirname??new URL(`.`,import.meta.url).pathname;return[S(t,`public`),S(t,`../../app/dist`),S(t,`../../../app/dist`)].find(t=>e(t))}function O(e){if(e.explicitDir!==void 0)return{dir:e.explicitDir,missingBundle:!1};if(e.only===`server`)return{dir:void 0,missingBundle:!1};let t=e.findBundledDir();return{dir:t,missingBundle:t===void 0}}function k(t){if(t===`off`)return`off`;if(!e.test(t))throw new d(`--idle-shutdown must be 'off' or a duration like 90s, 30m, 2h`);return t}function A(e){return e===`localhost`||e===`::1`||e===`[::1]`||e.startsWith(`127.`)}function j(e){return!e.flagBindSet&&!e.okBindSet&&e.hostEnvSet&&e.fileBindCount>1}function M(e){return!e.openBrowser||e.remoteEnabled||e.ephemeral||e.only===`server`||!e.servesUi?!1:e.legacyOpen?!0:(e.explicitOn||A(e.host))&&e.isTTY}function N(e,t){return t&&(e===`::`||e===`::1`||e===`[::1]`||e===`localhost`||e===`0.0.0.0`)?{host:`127.0.0.1`,coerced:!0}:{host:e,coerced:!1}}function P(e,t){return a(t)?e:{externalUrl:e.externalUrl,idleShutdown:e.idleShutdown}}function F(e,t){if(e===void 0||e===!1)return null;let n=typeof e==`string`?e:t;if(n===void 0||n===``)return{ok:!1,errorMessage:"--remote requires a public tunnel URL — pass it (`ok start --remote https://<your-tunnel-host>`) or set remote.url in .ok/config.yml."};let r;try{r=new URL(n)}catch{return{ok:!1,errorMessage:`remote.url is not a valid URL: ${n}`}}if(r.protocol!==`https:`)return{ok:!1,errorMessage:`remote.url must be https — it is the public tunnel URL remote clients connect to (got: ${n})`};let i=n.replace(/\/+$/,``);return{ok:!0,url:i,serverOverlay:{externalUrl:i,allowExternal:!0,idleShutdown:`off`}}}function I(e,t){let n;try{n=new URL(t)}catch{throw new d(`${e} is not a valid URL: ${t}`)}if(n.protocol!==`http:`&&n.protocol!==`https:`)throw new d(`${e} must be an http(s) origin (got: ${t})`);return t}function L(e){return I(`--external-url`,e)}function ne(e){return e.externalUrl??e.publicUrl}function R(e){return I(`--public-url`,e)}function z(e){let t=x(e).replace(/[^\x20-\x7E]/g,``).trim().slice(0,64);return`open-knowledge-server ${t.length>0?t:`unknown`}`}var B=class extends Error{cwd;constructor(e){super("This directory isn't set up yet. Run `ok init` first, then `ok start` again."),this.name=`OkDirMissingError`,this.cwd=e}};function V(e,t,n=!1){return e??(n?void 0:t)}function H(e,t,n=e=>w(e,{recursive:!0,force:!0})){return async()=>{try{await e()}finally{try{await n(t)}catch(e){process.stderr.write(`[start] ephemeral temp dir reap failed for ${t}: ${e instanceof Error?e.message:String(e)}\n`)}}}}function U(e,t={}){let n=t.exit??(e=>process.exit(e)),r=t.getActiveHandles??(()=>{let e=process._getActiveHandles;return e?e.call(process):null});return async()=>{let i=!1;try{await e()}catch(e){i=!0,t.log?.error({err:e},`idle-shutdown: destroy failed — exiting anyway`)}finally{let e=null;try{let t=r();if(t!==null){e={};for(let n of t){let t=n?.constructor?.name??`unknown`;e[t]=(e[t]??0)+1}}}catch{e=null}t.log?.info({event:`idle-shutdown-exit`,exitCode:+!!i,openHandles:e??{},handlesAvailable:e!==null},`idle-shutdown: teardown finished — exiting process`),n(+!!i)}}}async function W(e){let{config:t,cwd:n,host:r}=e,i=e.skipAutoInit??!1,a=e.idleThresholdMs===void 0?18e5:e.idleThresholdMs,{existsSync:o,mkdirSync:l}=await import(`node:fs`),{basename:u,dirname:d}=await import(`node:path`),{bootServer:f,getLogger:h,resolveContentDir:g,resolveLockDir:_,waitForServerLockDrain:y}=await import(`./src-DT3BV-Jn.mjs`),b=e.log??h(`start`),x=e.singleFile!==void 0,S=e.projectDir??n,C=x?ee(e.singleFile).canonicalFilePath:void 0,w=C?d(C):void 0,te=C?u(C):void 0;if(!x){if(!i&&!s(n))throw new B(n);let t=process.env.OK_RECLAIM_DISABLE??null,r=e=>{let t=typeof e.event==`string`?e.event:``;(t.endsWith(`-failed`)||t.endsWith(`-error`)||t.endsWith(`-missing`))&&b.warn({event:e},`[start] reclaim sweep reported a problem`)};try{(e.repairMcpConfigsFn??(await import(`./repair-mcp-configs-CO6hDA8w.mjs`)).repairMcpConfigs)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){b.warn({err:e},`[start] mcp-config repair sweep failed; continuing`)}try{(e.repairLaunchJsonFn??(await import(`./repair-launch-json-CnC1yFmy.mjs`)).repairLaunchJson)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){b.warn({err:e},`[start] launch.json repair sweep failed; continuing`)}try{await(e.repairSkillsFn??(await import(`./repair-skills-BmR0xC0t.mjs`)).repairSkills)({projectDir:n,reclaimDisableEnv:t,logger:r})}catch(e){b.warn({err:e},`[start] skill repair sweep failed; continuing`)}}let T=w??g(t,n);!x&&!o(T)&&(l(T,{recursive:!0}),b.info({contentDir:T},`Created content directory`));let E=m(),D=c();{let e=_(x?S:n),t=Date.now(),r=await y(e);r!==`no-drain`&&b.info({event:`start-waited-for-draining-predecessor`,outcome:r,waitedMs:Date.now()-t,drainLockDir:e},r===`released`?`[start] predecessor server finished draining — proceeding`:`[start] predecessor server still draining after wait — proceeding to collide`)}let O=await f({config:t,contentDir:T,projectDir:x?S:n,contentRoot:x?void 0:t.content.dir,port:e.port,host:r,quiet:!1,detectGh:p,tokenStore:E,embeddingsKeyStore:D,...x?{ephemeral:!0,singleDocRelPath:te,gitEnabled:!1,gitPreflight:()=>({ok:!0,version:`0.0.0`,resolvedPath:`git`,source:`PATH`})}:{},localOpCliArgs:[process.execPath,process.argv[1]],probeHarnessManagedMcpEntry:(e,t)=>v(e,t),idleShutdownMs:a,...e.serverRuntime===void 0?{}:{serverRuntime:e.serverRuntime},...e.bind===void 0?{}:{bind:e.bind},skipAutoInit:!0,idleShutdownHandler:t=>{let n=t;return U(x?H(n,S):n,{log:b,exit:e.idleExit})},log:b,...e.serveContentAssets===void 0?{}:{serveContentAssets:e.serveContentAssets},...e.reactShellDistDir?{reactShellDistDir:e.reactShellDistDir}:{}});return{httpServer:O.httpServer,destroy:O.destroy,lockDir:O.lockDir,contentDir:T,port:O.port,ready:O.ready,degraded:O.degraded}}function G(e){if(e===`browser`||e===`app`)return e;throw new d(`--mode must be 'browser' or 'app'`)}function K(e){return e.OK_CONSOLE_LEVEL!==void 0||e.LOG_LEVEL!==void 0?null:`warn`}function q(e){let t=[`Stopping OpenKnowledge…`,`Saving pending changes and releasing the server lock — this can take a few seconds.`];return e===`SIGINT`&&t.push(`Press Ctrl+C again to force quit.`),t}async function J(e,a){let s=K(process.env);s!==null&&(process.env.OK_CONSOLE_LEVEL=s);let{renderBanner:ee}=await import(`./banner-Ev4hKBM4.mjs`),{accent:c,dim:l,error:u,warning:d}=await import(`./colors-MGDi6UGf.mjs`),f=process.cwd(),p=a.remote!==void 0&&a.remote!==!1;process.title=z(f),p&&console.warn(d("--remote is deprecated — use `OK_IDLE_SHUTDOWN=off OK_ALLOW_EXTERNAL=1 ok start --external-url <url>` instead (add --bind to serve a non-loopback address; keep OK_IDLE_SHUTDOWN=off — the idle timer only counts WS clients and would tear the server down under a live remote MCP client). The flag now just expands to those server.* keys and will be removed in a later release.")),a.publicUrl!==void 0&&console.warn(d(`--public-url is deprecated — use --external-url <url> (same value and semantics; the key was renamed to server.externalUrl). The old spelling will be removed in a later release.`)),t(e).externalUrlFromDeprecatedKey&&console.warn(d(`[config] server.publicUrl is deprecated — use server.externalUrl instead (same value and semantics). If this config is committed and shared, keep both keys until every collaborator has upgraded — older versions read only server.publicUrl; see https://openknowledge.ai/docs/reference/configuration. The old key will be removed in a later release.`));let m=F(a.remote,e.remote?.url);m!==null&&!m.ok&&(console.error(u(m.errorMessage)),process.exit(78));let h=m?.ok?m:null,g=h!==null;h!==null&&console.warn(d([``,`⚠ REMOTE ACCESS ENABLED — no server-side authentication.`,` Anyone who can reach ${h.url} has FULL control of this`,` knowledge base, including sync, publishing, credentials, and local operations.`,` Restrict who can reach it at the tunnel: ngrok OAuth, Cloudflare Access,`,` Tailscale ACLs, or equivalent edge auth.`,``].join(`
2
+ `)));let _;try{_=n(process.env)}catch(e){throw e instanceof r&&(console.error(u(e.message)),process.exit(78)),e}for(let e of _.diagnostics)console.warn(d(`[config] ${e.message}`));let v=o(e,_.layer),b=_.overrides.some(e=>e.envVar===`OK_BIND`),x=a.bind!==void 0&&a.bind.length>0?a.bind:a.host===void 0?void 0:[a.host],S=process.env.HOST,C=S!==void 0&&S.trim()!==``?S:void 0,w=t(v),T=x??(b||C===void 0?[...w.bind]:[C]);j({flagBindSet:x!==void 0,okBindSet:b,hostEnvSet:C!==void 0,fileBindCount:w.bind.length})&&console.warn(d(`[config] HOST=${C} overrides server.bind — dropping the file-configured addresses (${w.bind.join(`, `)}). Use OK_BIND with a space-separated list to keep multiple binds.`));let E=T[0]??`127.0.0.1`,k=N(E,g);k.coerced&&console.warn(`remote access is enabled and ${E} is not an IPv4 loopback bind — tunnels proxy to 127.0.0.1, so binding ${E} would leave the tunnel dialing a dead port. Using 127.0.0.1.`);let A=k.host,I=g?[A]:T,L=h===null?{}:P(h.serverOverlay,I);h!==null&&!(`allowExternal`in L)&&console.warn(d(`--remote does not consent to exposing a non-loopback bind (${I.join(`, `)}) — the tunnel is the only ingress the alias vouches for. Consent explicitly with OK_ALLOW_EXTERNAL=1 (or server.allowExternal in .ok/local/config.yml), or drop the non-loopback bind.`));let R=ne(a),H=t(o(v,{server:{bind:I,...L,...R===void 0?{}:{externalUrl:R}}}));if(!g&&H.allowExternal&&(!H.loopbackOnly||H.externalUrl)){let e=H.externalUrl??H.bind.join(`, `);console.warn(d([``,`⚠ EXTERNAL ACCESS ENABLED (server.allowExternal) — no server-side authentication.`,` This server is reachable beyond this machine (${e}). Anyone who can`,` reach it has FULL control of this knowledge base — sync, publishing, GitHub`,` credentials, and local operations (clone, sign-in, repo spawn).`,` Restrict who can reach it at the edge: a Tailscale ACL, a reverse proxy with`,` auth (Cloudflare Access, oauth2-proxy), or a firewall.`,``].join(`
3
+ `)))}let U=a.port===void 0?void 0:Number(a.port),G=_.overrides.find(e=>e.envVar===`PORT`)?.value,J=t(e).port,ae=e.server?.port;g&&U===void 0&&G!==void 0&&console.warn(`remote access is enabled — ignoring env PORT=${process.env.PORT}; the tunnel's port mapping targets the stable remote port (${J??24550}). Pass --port to override deliberately.`);let oe=V(U,G,g)??(g?J??24550:ae),se=O({explicitDir:a.reactShellDistDir,only:a.only,findBundledDir:D}),Z=se.dir;se.missingBundle&&console.warn(g?`remote access: bundled web UI not found — serving /mcp and /api only over the tunnel.`:`bundled web UI not found — serving /api and /mcp only. Reinstall @inkeep/open-knowledge, or build packages/app in a source checkout.`);let Q;try{Q=await W({config:e,cwd:f,host:A,port:oe,bind:I,...a.serveContentAssets===void 0?{}:{serveContentAssets:a.serveContentAssets},...Z?{reactShellDistDir:Z}:{},idleThresholdMs:i((g?void 0:a.idleShutdown)??H.idleShutdown),serverRuntime:H,...a.singleFile?{singleFile:a.singleFile}:{},...a.projectDir?{projectDir:a.projectDir}:{}})}catch(e){e instanceof B&&(console.error(u(e.message)),process.exit(1));let t=await import(`./src-DT3BV-Jn.mjs`);if((e instanceof t.GitNotAvailableError||e instanceof t.GitTooOldError)&&process.exit(78),e instanceof t.ExposureConsentError&&(console.error(u(e.message)),process.exit(78)),(e instanceof t.SingleFileNotFoundError||e instanceof t.SingleFileNotAFileError||e instanceof t.SingleFileNotMarkdownError)&&(console.error(u(e.message)),process.exit(1)),re(e,t)){let e=t.resolveLockDir(f),n=null;try{n=await Y({readServerLock:()=>t.readServerLock(e),readUiLock:()=>t.readUiLock(e),now:Date.now,sleep:e=>te(e),timeoutMs:3e3,pollIntervalMs:50})}catch(e){process.stderr.write(`[start] spawn-or-reuse: lock poll failed (${e instanceof Error?e.message:String(e)}) — falling back to the collision message\n`)}if(n!==null){let[e,...t]=X(n);console.log(c(e));for(let e of t)console.log(l(e));process.exit(0)}}let n=ie(e,f,t);n!==null&&(console.error(u(n)),process.exit(1)),console.error(`${u(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let ce=!1,$=async e=>{if(ce)return;ce=!0;let[t,...n]=q(e);console.log(c(`\n${t}`));for(let e of n)console.log(l(` ${e}`));try{await Q.destroy()}catch(e){console.error(`${u(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)};process.once(`SIGINT`,()=>{$(`SIGINT`)}),process.once(`SIGTERM`,()=>{$(`SIGTERM`)});let le=`http://${A.includes(`:`)&&!A.startsWith(`[`)?`[${A}]`:A}:${Q.port}`,ue=A===`0.0.0.0`||A===`::`?`http://0.0.0.0:${Q.port}`:void 0,de=le;console.log(ee({name:`open-knowledge`,version:y,localUrl:de,networkUrl:ue,nextSteps:[`Open the Editor URL in your browser to start editing.`]}));let fe={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};Q.ready.then(async()=>{if(Q.degraded.length>0){console.log();for(let e of Q.degraded){let t=fe[e]??`${e} (check server logs for details)`;console.warn(` ${d(`⚠`)} ${d(e)}: ${l(t)}`)}console.log()}if(M({openBrowser:a.openBrowser!==!1&&H.openBrowser,explicitOn:a.openBrowser!==!1&&v.server?.openBrowser===!0,legacyOpen:a.open===!0,host:A,isTTY:process.stdout.isTTY===!0,remoteEnabled:g,ephemeral:a.singleFile!==void 0,only:a.only,servesUi:Z!==void 0})){let{openBrowser:e}=await import(`./open-browser-BXT69qcq.mjs`);e(de)}}).catch(e=>{console.error(` ${u(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})}async function Y(e){let t=e.now()+e.timeoutMs,n=e.readServerLock();for(;n!==null&&n.draining!==!0&&n.port<=0&&e.now()<t;)await e.sleep(e.pollIntervalMs),n=e.readServerLock();if(n===null||n.draining===!0||n.port<=0)return null;if(n.capabilities?.includes(`ui`)===!0&&n.url!==void 0)return{url:n.url,kind:n.kind,pid:n.pid,servesUi:!0};let r=e.readUiLock();return r!==null&&r.port>0?{url:r.url??`http://localhost:${r.port}`,kind:n.kind,pid:n.pid,servesUi:!1}:{url:n.url??`http://127.0.0.1:${n.port}`,kind:n.kind,pid:n.pid,servesUi:!1}}function X(e){return[`${e.kind===`mcp-spawned`?`An MCP-spawned OpenKnowledge server is already running on this project`:`OpenKnowledge is already running on this project`} (pid ${e.pid}).`,` ${e.url}`,"Leaving it running — run `ok stop` first if you want a fresh server."]}function re(e,t){let n=t.ServerLockCollisionError;return n!==void 0&&e instanceof n}function ie(e,t,n){let r=n.ServerLockCollisionError;if(r===void 0||!(e instanceof r))return null;try{let e=n.readServerLock(n.resolveLockDir(t));return e&&e.kind===`mcp-spawned`?"An MCP-spawned server holds this lock; it should release on idle-shutdown (~30 min). Or run `ok stop`.":"OpenKnowledge server is already running on this project — check `ok status` or `ok stop`."}catch{return null}}function ae(e){return new u(`start`).description(`Start the OpenKnowledge server (UI + API + MCP + collab on one port)`).option(`-p, --port <port>`,`Server port`,void 0).option(`--bind <address>`,`Bind address (repeatable; default 127.0.0.1 — loopback only)`,(e,t)=>[...t??[],e]).addOption(new l(`-H, --host <host>`,`Deprecated alias of --bind`).hideHelp()).option(`--no-open-browser`,`Do not open the browser after start (interactive loopback starts open it by default)`).addOption(new l(`--open`,`Deprecated: force-open the browser after start`).hideHelp()).option(`--only <module>`,`Serve one module: 'server' (API + MCP only, no shell or browser) or 'ui' (shell + proxy only; requires --server-url)`,E).option(`--server-url <url>`,`Project-server URL the --only ui process proxies to (e.g. http://127.0.0.1:24550)`).option(`--idle-shutdown <duration>`,`Shut the server down after this long with no connected clients ('off', or a duration like 90s, 30m, 2h; default 30m)`,k).option(`--mode <mode>`,`Force dispatch mode: 'browser' or 'app'`,G).option(`--serve-content-assets`,`Serve content assets from this server (now the default; kept for compatibility)`).option(`--react-shell-dist-dir <path>`,`Serve React shell from <path>`).option(`--single-file <path>`,`No-project ephemeral single-file mode: scope the server to one markdown file (git + MCP off)`).option(`--project-dir <dir>`,`Throwaway project root for --single-file (where ephemeral .ok/ state lives)`).option(`--external-url <url>`,`Canonical external origin clients dial (sets server.externalUrl for this run) — its host joins the Host/Origin allowlists and issued URLs. External exposure additionally requires consent (OK_ALLOW_EXTERNAL=1 or server.allowExternal).`,L).option(`--public-url <url>`,`Deprecated alias of --external-url (the former name of that flag) — same value and semantics.`,R).option(`--remote [url]`,`Deprecated alias: expands to --external-url <url> + OK_ALLOW_EXTERNAL consent on a loopback bind. Serves through a tunnel with NO server-side auth (anyone who can reach the URL has full control — restrict access at the tunnel with edge auth). Bare --remote uses remote.url from .ok/config.yml; --remote <url> supplies it for this run.`).action(async t=>{let n=e();if(t.serverUrl!==void 0&&t.only!==`ui`&&(process.stderr.write(`error: option '--server-url' requires '--only ui'
4
+ `),process.exit(2)),t.externalUrl!==void 0&&t.publicUrl!==void 0&&(process.stderr.write(`error: option '--public-url' cannot be combined with '--external-url' (--public-url is a deprecated alias of --external-url)
5
+ `),process.exit(2)),(t.externalUrl!==void 0||t.publicUrl!==void 0)&&t.remote!==void 0&&t.remote!==!1){let e=t.externalUrl===void 0?`--public-url`:`--external-url`;process.stderr.write(`error: option '--remote' cannot be combined with '${e}' (--remote is a deprecated alias that sets server.externalUrl)\n`),process.exit(2)}if(t.singleFile!==void 0&&t.remote!==void 0&&t.remote!==!1&&(process.stderr.write(`error: option '--single-file' cannot be combined with '--remote' — ephemeral single-file mode has no project and no consented root to serve remotely
6
+ `),process.exit(2)),t.only===`server`&&t.reactShellDistDir!==void 0&&(process.stderr.write(`error: option '--only server' cannot be combined with '--react-shell-dist-dir'
7
+ `),process.exit(2)),t.only===`ui`){{let{warning:e}=await import(`./colors-MGDi6UGf.mjs`);console.error(e("[start] `--only ui` is deprecated — plain `ok start` serves the editor UI, API, and MCP on one port. The split-mode proxy will be removed in a future release."))}t.serverUrl===void 0&&(process.stderr.write(`error: '--only ui' requires '--server-url <url>' (where the project server runs)
8
+ `),process.exit(2)),t.mode===`app`&&(process.stderr.write(`error: option '--only ui' cannot be combined with '--mode app'
9
+ `),process.exit(2)),t.remote!==void 0&&t.remote!==!1&&(process.stderr.write(`error: option '--only ui' cannot be combined with '--remote'
10
+ `),process.exit(2));let{runUiCommand:e}=await import(`./ui-D8O01OgQ.mjs`);await e(n,{...t.port===void 0?{}:{port:String(t.port)},...t.bind?.[0]===void 0?t.host===void 0?{}:{host:t.host}:{host:t.bind[0]},upstreamUrl:t.serverUrl});return}if(t.mode===`app`){t.open&&(process.stderr.write(`error: option '--mode=app' cannot be combined with '--open' (--open opens a browser tab against the local server, which app mode does not boot)
11
+ `),process.exit(2));let e=[];if(t.port!==void 0&&e.push(`--port`),t.bind!==void 0&&e.push(`--bind`),t.host!==void 0&&e.push(`--host`),t.only!==void 0&&e.push(`--only`),t.serverUrl!==void 0&&e.push(`--server-url`),t.idleShutdown!==void 0&&e.push(`--idle-shutdown`),t.openBrowser===!1&&e.push(`--no-open-browser`),t.externalUrl!==void 0&&e.push(`--external-url`),t.publicUrl!==void 0&&e.push(`--public-url`),t.remote!==void 0&&t.remote!==!1&&e.push(`--remote`),e.length>0){let t=process.env.OK_LOG_LEVEL??`info`;(t===`debug`||t===`trace`)&&console.error(`--mode=app: ignoring ${e.join(`, `)}`)}let n=h(_());if(n.available){f({spawn:b},n);return}console.error(g(n.reason)),process.exit(1)}await J(n,t)})}export{M as C,H as D,ie as E,U as O,P as S,ae as T,T as _,F as a,O as b,A as c,k as d,E as f,ne as g,V as h,z as i,re as l,D as m,W as n,X as o,R as p,N as r,q as s,B as t,L as u,Y as v,j as w,J as x,K as y};
12
+ //# sourceMappingURL=start-ZRhTJkN6.mjs.map
@@ -1,3 +1,3 @@
1
- import{Q as e,it as t,tt as n}from"./sleep-BU8QtSQy.mjs";import{ft as r,ls as i,yo as a}from"./src-BjPajWAS.mjs";import{An as o,Mn as s,jn as c}from"./src-pjKDNsjY.mjs";import{randomUUID as l}from"node:crypto";import{createServer as u,request as d}from"node:http";import{connect as f}from"node:net";function p(e,t,n,r,i){let o=`urn:uuid:${l()}`;if(e.headersSent||e.writableEnded||e.destroyed){console.error(`[ok ui] emitProblem called after headers sent — suppressed`,{type:n,status:t,instance:o});return}let s={type:n,title:r,status:t,instance:o,...i===void 0?{}:{detail:i}},c=a.safeParse(s);if(!c.success){console.error(`[ok ui] emitProblem produced an invalid ProblemDetails body:`,{issues:c.error.issues,originalStatus:t,body:s}),e.writeHead(500,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify({type:`urn:ok:error:internal-server-error`,title:`Internal server error.`,status:500,instance:o}));return}e.writeHead(t,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify(s))}const m=1e4;function h(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!c(n))return p(t,403,`urn:ok:error:loopback-required`,`Request must originate from a loopback address.`),!0;if(!o(e.headers.host))return p(t,403,`urn:ok:error:host-not-allowed`,`Host header is not in the loopback allowlist.`),!0;let r=e.headers.origin;return r!==void 0&&!s(r)?(p(t,403,`urn:ok:error:invalid-origin`,`Origin header is not in the loopback allowlist.`),!0):!1}const g=3e4;function _(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!c(n)||!o(e.headers.host))return t.destroy(),!0;let r=e.headers.origin;return typeof r==`string`&&!s(r)?(t.destroy(),!0):!1}function v(e,t,n,r,i,a){a.add(t),t.once(`close`,()=>a.delete(t));let o=f({host:r,port:i,timeout:m});a.add(o),o.once(`close`,()=>a.delete(o));let s=!1,c=n=>{if(!s){if(s=!0,n!==void 0){let t=n.err;console.warn(JSON.stringify({event:n.event,upstreamHost:r,upstreamPort:i,url:e.url,code:t instanceof Error?t.code:void 0,message:t instanceof Error?t.message:void 0}))}try{o.destroy()}catch{}try{t.destroy()}catch{}}};o.once(`connect`,()=>{o.setTimeout(0);let a=[`${e.method??`GET`} ${e.url??`/`} HTTP/1.1`,`host: ${r}:${i}`];for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()!==`host`&&n!==void 0)if(Array.isArray(n))for(let e of n)a.push(`${t}: ${e}`);else a.push(`${t}: ${n}`);try{o.write(`${a.join(`\r
2
- `)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const y=[`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`cookie`,`set-cookie`];async function b(e){let t=e.upstreamTimeoutMs??m,n=new Set,r=u((n,r)=>{h(n,r)||x(n,r,e.upstreamHost,e.upstreamPort,t)});r.on(`upgrade`,(t,r,i)=>{_(t,r)||v(t,r,i,e.upstreamHost,e.upstreamPort,n)}),await new Promise((t,n)=>{let i=e=>n(e);r.once(`error`,i),r.listen(e.listenPort,e.host,()=>{r.off(`error`,i),t()})});let i=r.address();return{httpServer:r,port:typeof i==`object`&&i?i.port:e.listenPort,close:()=>new Promise(e=>{for(let e of n)try{e.destroy()}catch{}n.clear(),r.close(()=>e()),r.closeIdleConnections()})}}function ee(e,t,n){x(e,t,n.upstreamHost,n.upstreamPort,n.upstreamTimeoutMs??m)}function x(e,t,n,r,i){let a={...e.headers};delete a.host;for(let e of y)delete a[e];e.setTimeout(g,()=>{if(t.headersSent)try{t.end()}catch{}else try{p(t,408,`urn:ok:error:request-timeout`,`Proxy request exceeded the per-request deadline.`,`Slow-loris-class: client did not finish within ${g/1e3}s.`)}catch{}try{e.socket?.destroy()}catch{}});let o=d({host:n,port:r,method:e.method,path:e.url,headers:{...a,host:`${n}:${r}`}},e=>{let n={...e.headers};for(let e of y)delete n[e];t.writeHead(e.statusCode??502,n),e.pipe(t),e.once(`error`,()=>{try{t.end()}catch{}})});i>0&&o.setTimeout(i,()=>{if(!t.headersSent)p(t,504,`urn:ok:error:gateway-timeout`,`Upstream did not respond before the gateway deadline.`,`Upstream timeout: ${i/1e3}s elapsed without a response.`);else try{t.end()}catch{}o.destroy()}),o.on(`error`,()=>{if(!t.headersSent)p(t,502,`urn:ok:error:collab-server-not-running`,`Collab server is unreachable.`,`Upstream connection failed or dropped before a response was received.`);else try{t.end()}catch{}}),e.on(`error`,()=>{o.destroy()}),e.pipe(o)}async function S(e){await Promise.all(e.map(e=>new Promise(t=>{e.close(()=>t())})))}function C(e){let t;try{t=new URL(e)}catch{throw Error(`Invalid --server-url '${e}' — expected e.g. http://127.0.0.1:24550`)}if(t.protocol!==`http:`)throw Error(`--server-url must be http: (got '${t.protocol}//') — the UI proxy speaks plain HTTP; terminate TLS at your ingress`);let n=t.port===``?80:Number(t.port);return{host:t.hostname.replace(/^\[(.+)\]$/,`$1`),port:n}}async function w(a){let{existsSync:o}=await import(`node:fs`),{createServer:s}=await import(`node:http`),{resolve:c}=await import(`node:path`),{acquireUiLock:l,buildIngressPolicy:u,createAssetServeMiddleware:d,createContentFilter:f,readServerLock:m,releaseUiLock:g,updateUiLockPort:y}=await import(`./src-CXbUZB_b.mjs`),{default:b}=await import(`./build-BcDJ6qQ2.mjs`),{resolveContentDir:x,resolveLockDir:S}=await import(`./src-CXbUZB_b.mjs`),w=x(a.config,a.cwd),E=S(a.cwd);l(E,{port:0,worktreeRoot:a.cwd});let D=import.meta.dirname??new URL(`.`,import.meta.url).pathname,O=[c(D,`public`),c(D,`../../app/dist`),c(D,`../../../app/dist`)],k=a.assetDir??O.find(e=>o(e)),A=k?b(k,{single:!0,gzip:!0,etag:!0,dev:!0,extensions:[]}):null,j=o(w)?d({contentFilter:f({projectDir:a.cwd,contentDir:w}),contentSirv:b(w,{dotfiles:!1,dev:!0,extensions:[]}),inlineExtensions:t,assetExtensions:e,blocklistExtensions:n,ingressPolicy:u({})}):null,M=a.upstreamUrl===void 0?null:C(a.upstreamUrl),N=()=>{if(M!==null)return M;let e=m(E);return!e||e.port<=0?null:{host:i,port:e.port}},P=a.port,F=null,I=(e,t)=>{let n=e.url?.split(`?`)[0];if((n===`/`||n===``)&&(e.url=`/index.html`),!(n?.startsWith(`/api/`)&&h(e,t))){if(n===`/api/config`&&(e.method===`GET`||e.method===`HEAD`)){F?.();let n=e.headers.host??`localhost:${P}`,r=N()===null?null:`ws://${n}/collab`,i=JSON.stringify({collabUrl:r,previewUrl:null,port:P});t.setHeader(`Content-Type`,`application/json`),t.setHeader(`Cache-Control`,`no-store`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.statusCode=200,e.method===`HEAD`?t.end():t.end(i);return}if(n?.startsWith(`/api/`)){F?.();let r=N();if(r===null){p(t,503,`urn:ok:error:collab-server-not-running`,"Collab server not running. Start `ok start` or run `ok status`.",`Path: ${n}`);return}ee(e,t,{upstreamHost:r.host,upstreamPort:r.port});return}if(A&&n?.startsWith(`/assets/`)){A(e,t,()=>{j?j(e,t,()=>T(t)):T(t)});return}if(j){j(e,t,()=>{A?A(e,t):T(t)});return}if(A){A(e,t);return}T(t)}},L=new Set,R=(e,t,n)=>{if(_(e,t))return;let r=e.url?.split(`?`)[0]??``;if(r!==`/collab`&&!r.startsWith(`/collab/`)){t.destroy();return}let i=N();if(i===null){console.warn(JSON.stringify({event:`ok-ui-upgrade-no-collab-lock`,url:r,reason:"server.lock missing or port unbound — is `ok start` running?"})),t.destroy();return}v(e,t,n,i.host,i.port,L)},z=()=>{for(let e of L)try{e.destroy()}catch{}L.clear()},te=a.host===void 0?[`::1`,`127.0.0.1`]:[a.host],B=[],V=a.port,ne=e=>e instanceof Error&&e.code===`EADDRINUSE`,H=async()=>{await Promise.all(B.splice(0).map(e=>new Promise(t=>{try{e.close(()=>t())}catch{t()}})))},U=async e=>{V=e;for(let e of te){let t=s(I);t.on(`upgrade`,R),B.push(t),await new Promise((n,r)=>{let i=e=>r(e);t.once(`error`,i),t.listen(V,e,()=>{t.off(`error`,i);let e=t.address();typeof e==`object`&&e&&(V=e.port),n()})})}};try{try{await U(a.port)}catch(e){if(a.fallbackToKernel===!0&&ne(e))await H(),await U(0);else throw e}}catch(e){await H();try{g(E)}catch{}throw e}let W=V;P=W,y(E,W,`http://localhost:${W}`);let G=a.scheduler??r,K=a.safetyNetMs??432e5,q=null,J=!1,Y=!1,X=()=>{J||(J=!0,q!==null&&(G.clearTimeout(q),q=null))},Z=()=>{if(X(),!Y){Y=!0;try{g(E)}catch{}}},Q=()=>{J||K<=0||(q!==null&&(G.clearTimeout(q),q=null),q=G.setTimeout(()=>{q=null,console.warn(`[ui] safety-net (${K}ms) reached — shutting down (D-025 backstop)`);try{a.onSafetyNet?.()}catch{}z();for(let e of B)try{e.close()}catch{}Z()},K))},$=()=>{J||K<=0||Q()};return F=$,Q(),{httpServers:B,port:W,release:Z,detachSafetyNet:X,nudgeSafetyNet:$,drainUpgradeSockets:z}}function T(e){e.headersSent||e.writableEnded||e.destroyed||(e.setHeader(`X-Content-Type-Options`,`nosniff`),e.setHeader(`Cache-Control`,`no-store`),e.statusCode=404,e.end())}function E(e,t){if(e!==void 0){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<0||t>65535)throw Error(`Invalid --port value '${e}'`);return{port:t,fallbackToKernel:!1}}if(t!==void 0&&t!==``){let e=Number.parseInt(t,10);if(Number.isNaN(e)||e<0||e>65535)throw Error(`Invalid PORT env value '${t}'`);return{port:e,fallbackToKernel:!1}}return{port:39847,fallbackToKernel:!0}}async function D(e){let t=e.readLock??(async()=>{let{readUiLock:t}=await import(`./src-CXbUZB_b.mjs`);return t(e.lockDir)}),n=await t();if(!n)throw Error(`UI lock collision reported but the lock disappeared before handling — retry acquiring.`);if(n.port===e.requestedPort&&n.port>0)return{mode:`already-running`,port:n.port};let r=n.port;if(r===0){let n=Date.now()+(e.pollDeadlineMs??2e3),i=e.pollIntervalMs??100;for(;Date.now()<n;){await new Promise(e=>{setTimeout(e,i)});let e=await t();if(e&&e.port>0){r=e.port;break}}if(r===0)throw Error("UI did not bind within 2s; run `ok clean`");if(r===e.requestedPort)return{mode:`already-running`,port:r}}return{mode:`proxy`,handle:await b({listenPort:e.requestedPort,host:e.host,upstreamHost:`localhost`,upstreamPort:r}),upstreamPort:r}}async function O(e,t){let{dim:n}=await import(`./colors-MGDi6UGf.mjs`),{UiLockCollisionError:r}=await import(`./src-CXbUZB_b.mjs`),{resolveLockDir:i}=await import(`./src-CXbUZB_b.mjs`),a=t.host;if(t.upstreamUrl!==void 0)try{C(t.upstreamUrl)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(2)}let o;try{o=E(t.port,process.env.PORT)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(2)}let s=o.port;try{let r=await w({config:e,cwd:process.cwd(),port:s,fallbackToKernel:o.fallbackToKernel,host:a,...t.upstreamUrl===void 0?{}:{upstreamUrl:t.upstreamUrl}}),i=a===void 0||a===`::`||a===`0.0.0.0`?`localhost`:a;console.log(`${n(`[ui]`)} listening on http://${i}:${r.port}`);let c=!1,l=e=>{if(c)return;c=!0,console.log(n(`\n[ui] Shutting down (${e})`)),r.detachSafetyNet();let t=()=>{try{r.release()}finally{process.exit(process.exitCode??0)}};r.drainUpgradeSockets(),S(r.httpServers).then(t,t),setTimeout(t,2e3).unref()};process.once(`SIGINT`,()=>l(`SIGINT`)),process.once(`SIGTERM`,()=>l(`SIGTERM`));return}catch(e){if(!(e instanceof r))throw e;let t=i(process.cwd()),o=a??`localhost`,c;try{c=await D({requestedPort:s,host:o,lockDir:t})}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}if(c.mode===`already-running`){if(console.log(`UI already running at http://${o}:${c.port}`),k(process)){await new Promise(e=>{let t=t=>{console.log(n(`\n[ui-keepalive] Shutting down (${t})`)),e()};process.once(`SIGINT`,()=>t(`SIGINT`)),process.once(`SIGTERM`,()=>t(`SIGTERM`))});return}process.exit(0)}console.log(`UI running at http://${o}:${c.upstreamPort}; acting as HTTP proxy on port ${c.handle.port}`);let l=!1,u=e=>{l||(l=!0,console.log(n(`\n[ui-proxy] Shutting down (${e})`)),c.handle.close().finally(()=>process.exit(process.exitCode??0)),setTimeout(()=>process.exit(process.exitCode??0),2e3).unref())};process.once(`SIGINT`,()=>u(`SIGINT`)),process.once(`SIGTERM`,()=>u(`SIGTERM`))}}function k(e){let t=e.stdout.isTTY===!0,n=typeof e.env.PORT==`string`&&e.env.PORT!==``;return!t||n}export{O as runUiCommand};
3
- //# sourceMappingURL=ui-UQBOE6mj.mjs.map
1
+ import{Q as e,it as t,tt as n}from"./sleep-D_nNc7T_.mjs";import{cs as r,dt as i,vo as a}from"./src-CCW4TQuz.mjs";import{An as o,Mn as s,jn as c}from"./src-D5ZZydZi.mjs";import{randomUUID as l}from"node:crypto";import{createServer as u,request as d}from"node:http";import{connect as f}from"node:net";function p(e,t,n,r,i){let o=`urn:uuid:${l()}`;if(e.headersSent||e.writableEnded||e.destroyed){console.error(`[ok ui] emitProblem called after headers sent — suppressed`,{type:n,status:t,instance:o});return}let s={type:n,title:r,status:t,instance:o,...i===void 0?{}:{detail:i}},c=a.safeParse(s);if(!c.success){console.error(`[ok ui] emitProblem produced an invalid ProblemDetails body:`,{issues:c.error.issues,originalStatus:t,body:s}),e.writeHead(500,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify({type:`urn:ok:error:internal-server-error`,title:`Internal server error.`,status:500,instance:o}));return}e.writeHead(t,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify(s))}const m=1e4;function h(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!c(n))return p(t,403,`urn:ok:error:loopback-required`,`Request must originate from a loopback address.`),!0;if(!o(e.headers.host))return p(t,403,`urn:ok:error:host-not-allowed`,`Host header is not in the loopback allowlist.`),!0;let r=e.headers.origin;return r!==void 0&&!s(r)?(p(t,403,`urn:ok:error:invalid-origin`,`Origin header is not in the loopback allowlist.`),!0):!1}const g=3e4;function _(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!c(n)||!o(e.headers.host))return t.destroy(),!0;let r=e.headers.origin;return typeof r==`string`&&!s(r)?(t.destroy(),!0):!1}function v(e,t,n,r,i,a){a.add(t),t.once(`close`,()=>a.delete(t));let o=f({host:r,port:i,timeout:m});a.add(o),o.once(`close`,()=>a.delete(o));let s=!1,c=n=>{if(!s){if(s=!0,n!==void 0){let t=n.err;console.warn(JSON.stringify({event:n.event,upstreamHost:r,upstreamPort:i,url:e.url,code:t instanceof Error?t.code:void 0,message:t instanceof Error?t.message:void 0}))}try{o.destroy()}catch{}try{t.destroy()}catch{}}};o.once(`connect`,()=>{o.setTimeout(0);let a=[`${e.method??`GET`} ${e.url??`/`} HTTP/1.1`,`host: ${r}:${i}`];for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()!==`host`&&n!==void 0)if(Array.isArray(n))for(let e of n)a.push(`${t}: ${e}`);else a.push(`${t}: ${n}`);try{o.write(`${a.join(`\r
2
+ `)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const y=[`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`cookie`,`set-cookie`];async function b(e){let t=e.upstreamTimeoutMs??m,n=new Set,r=u((n,r)=>{h(n,r)||x(n,r,e.upstreamHost,e.upstreamPort,t)});r.on(`upgrade`,(t,r,i)=>{_(t,r)||v(t,r,i,e.upstreamHost,e.upstreamPort,n)}),await new Promise((t,n)=>{let i=e=>n(e);r.once(`error`,i),r.listen(e.listenPort,e.host,()=>{r.off(`error`,i),t()})});let i=r.address();return{httpServer:r,port:typeof i==`object`&&i?i.port:e.listenPort,close:()=>new Promise(e=>{for(let e of n)try{e.destroy()}catch{}n.clear(),r.close(()=>e()),r.closeIdleConnections()})}}function ee(e,t,n){x(e,t,n.upstreamHost,n.upstreamPort,n.upstreamTimeoutMs??m)}function x(e,t,n,r,i){let a={...e.headers};delete a.host;for(let e of y)delete a[e];e.setTimeout(g,()=>{if(t.headersSent)try{t.end()}catch{}else try{p(t,408,`urn:ok:error:request-timeout`,`Proxy request exceeded the per-request deadline.`,`Slow-loris-class: client did not finish within ${g/1e3}s.`)}catch{}try{e.socket?.destroy()}catch{}});let o=d({host:n,port:r,method:e.method,path:e.url,headers:{...a,host:`${n}:${r}`}},e=>{let n={...e.headers};for(let e of y)delete n[e];t.writeHead(e.statusCode??502,n),e.pipe(t),e.once(`error`,()=>{try{t.end()}catch{}})});i>0&&o.setTimeout(i,()=>{if(!t.headersSent)p(t,504,`urn:ok:error:gateway-timeout`,`Upstream did not respond before the gateway deadline.`,`Upstream timeout: ${i/1e3}s elapsed without a response.`);else try{t.end()}catch{}o.destroy()}),o.on(`error`,()=>{if(!t.headersSent)p(t,502,`urn:ok:error:collab-server-not-running`,`Collab server is unreachable.`,`Upstream connection failed or dropped before a response was received.`);else try{t.end()}catch{}}),e.on(`error`,()=>{o.destroy()}),e.pipe(o)}async function S(e){await Promise.all(e.map(e=>new Promise(t=>{e.close(()=>t())})))}function C(e){let t;try{t=new URL(e)}catch{throw Error(`Invalid --server-url '${e}' — expected e.g. http://127.0.0.1:24550`)}if(t.protocol!==`http:`)throw Error(`--server-url must be http: (got '${t.protocol}//') — the UI proxy speaks plain HTTP; terminate TLS at your ingress`);let n=t.port===``?80:Number(t.port);return{host:t.hostname.replace(/^\[(.+)\]$/,`$1`),port:n}}async function w(a){let{existsSync:o}=await import(`node:fs`),{createServer:s}=await import(`node:http`),{resolve:c}=await import(`node:path`),{acquireUiLock:l,buildIngressPolicy:u,createAssetServeMiddleware:d,createContentFilter:f,readServerLock:m,releaseUiLock:g,updateUiLockPort:y}=await import(`./src-DT3BV-Jn.mjs`),{default:b}=await import(`./build-BcDJ6qQ2.mjs`),{resolveContentDir:x,resolveLockDir:S}=await import(`./src-DT3BV-Jn.mjs`),w=x(a.config,a.cwd),E=S(a.cwd);l(E,{port:0,worktreeRoot:a.cwd});let D=import.meta.dirname??new URL(`.`,import.meta.url).pathname,O=[c(D,`public`),c(D,`../../app/dist`),c(D,`../../../app/dist`)],k=a.assetDir??O.find(e=>o(e)),A=k?b(k,{single:!0,gzip:!0,etag:!0,dev:!0,extensions:[]}):null,j=o(w)?d({contentFilter:f({projectDir:a.cwd,contentDir:w}),contentSirv:b(w,{dotfiles:!1,dev:!0,extensions:[]}),inlineExtensions:t,assetExtensions:e,blocklistExtensions:n,ingressPolicy:u({})}):null,M=a.upstreamUrl===void 0?null:C(a.upstreamUrl),N=()=>{if(M!==null)return M;let e=m(E);return!e||e.port<=0?null:{host:r,port:e.port}},P=a.port,F=null,I=(e,t)=>{let n=e.url?.split(`?`)[0];if((n===`/`||n===``)&&(e.url=`/index.html`),!(n?.startsWith(`/api/`)&&h(e,t))){if(n===`/api/config`&&(e.method===`GET`||e.method===`HEAD`)){F?.();let n=e.headers.host??`localhost:${P}`,r=N()===null?null:`ws://${n}/collab`,i=JSON.stringify({collabUrl:r,previewUrl:null,port:P});t.setHeader(`Content-Type`,`application/json`),t.setHeader(`Cache-Control`,`no-store`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.statusCode=200,e.method===`HEAD`?t.end():t.end(i);return}if(n?.startsWith(`/api/`)){F?.();let r=N();if(r===null){p(t,503,`urn:ok:error:collab-server-not-running`,"Collab server not running. Start `ok start` or run `ok status`.",`Path: ${n}`);return}ee(e,t,{upstreamHost:r.host,upstreamPort:r.port});return}if(A&&n?.startsWith(`/assets/`)){A(e,t,()=>{j?j(e,t,()=>T(t)):T(t)});return}if(j){j(e,t,()=>{A?A(e,t):T(t)});return}if(A){A(e,t);return}T(t)}},L=new Set,R=(e,t,n)=>{if(_(e,t))return;let r=e.url?.split(`?`)[0]??``;if(r!==`/collab`&&!r.startsWith(`/collab/`)){t.destroy();return}let i=N();if(i===null){console.warn(JSON.stringify({event:`ok-ui-upgrade-no-collab-lock`,url:r,reason:"server.lock missing or port unbound — is `ok start` running?"})),t.destroy();return}v(e,t,n,i.host,i.port,L)},z=()=>{for(let e of L)try{e.destroy()}catch{}L.clear()},te=a.host===void 0?[`::1`,`127.0.0.1`]:[a.host],B=[],V=a.port,ne=e=>e instanceof Error&&e.code===`EADDRINUSE`,H=async()=>{await Promise.all(B.splice(0).map(e=>new Promise(t=>{try{e.close(()=>t())}catch{t()}})))},U=async e=>{V=e;for(let e of te){let t=s(I);t.on(`upgrade`,R),B.push(t),await new Promise((n,r)=>{let i=e=>r(e);t.once(`error`,i),t.listen(V,e,()=>{t.off(`error`,i);let e=t.address();typeof e==`object`&&e&&(V=e.port),n()})})}};try{try{await U(a.port)}catch(e){if(a.fallbackToKernel===!0&&ne(e))await H(),await U(0);else throw e}}catch(e){await H();try{g(E)}catch{}throw e}let W=V;P=W,y(E,W,`http://localhost:${W}`);let G=a.scheduler??i,K=a.safetyNetMs??432e5,q=null,J=!1,Y=!1,X=()=>{J||(J=!0,q!==null&&(G.clearTimeout(q),q=null))},Z=()=>{if(X(),!Y){Y=!0;try{g(E)}catch{}}},Q=()=>{J||K<=0||(q!==null&&(G.clearTimeout(q),q=null),q=G.setTimeout(()=>{q=null,console.warn(`[ui] safety-net (${K}ms) reached — shutting down (D-025 backstop)`);try{a.onSafetyNet?.()}catch{}z();for(let e of B)try{e.close()}catch{}Z()},K))},$=()=>{J||K<=0||Q()};return F=$,Q(),{httpServers:B,port:W,release:Z,detachSafetyNet:X,nudgeSafetyNet:$,drainUpgradeSockets:z}}function T(e){e.headersSent||e.writableEnded||e.destroyed||(e.setHeader(`X-Content-Type-Options`,`nosniff`),e.setHeader(`Cache-Control`,`no-store`),e.statusCode=404,e.end())}function E(e,t){if(e!==void 0){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<0||t>65535)throw Error(`Invalid --port value '${e}'`);return{port:t,fallbackToKernel:!1}}if(t!==void 0&&t!==``){let e=Number.parseInt(t,10);if(Number.isNaN(e)||e<0||e>65535)throw Error(`Invalid PORT env value '${t}'`);return{port:e,fallbackToKernel:!1}}return{port:39847,fallbackToKernel:!0}}async function D(e){let t=e.readLock??(async()=>{let{readUiLock:t}=await import(`./src-DT3BV-Jn.mjs`);return t(e.lockDir)}),n=await t();if(!n)throw Error(`UI lock collision reported but the lock disappeared before handling — retry acquiring.`);if(n.port===e.requestedPort&&n.port>0)return{mode:`already-running`,port:n.port};let r=n.port;if(r===0){let n=Date.now()+(e.pollDeadlineMs??2e3),i=e.pollIntervalMs??100;for(;Date.now()<n;){await new Promise(e=>{setTimeout(e,i)});let e=await t();if(e&&e.port>0){r=e.port;break}}if(r===0)throw Error("UI did not bind within 2s; run `ok clean`");if(r===e.requestedPort)return{mode:`already-running`,port:r}}return{mode:`proxy`,handle:await b({listenPort:e.requestedPort,host:e.host,upstreamHost:`localhost`,upstreamPort:r}),upstreamPort:r}}async function O(e,t){let{dim:n}=await import(`./colors-MGDi6UGf.mjs`),{UiLockCollisionError:r}=await import(`./src-DT3BV-Jn.mjs`),{resolveLockDir:i}=await import(`./src-DT3BV-Jn.mjs`),a=t.host;if(t.upstreamUrl!==void 0)try{C(t.upstreamUrl)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(2)}let o;try{o=E(t.port,process.env.PORT)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(2)}let s=o.port;try{let r=await w({config:e,cwd:process.cwd(),port:s,fallbackToKernel:o.fallbackToKernel,host:a,...t.upstreamUrl===void 0?{}:{upstreamUrl:t.upstreamUrl}}),i=a===void 0||a===`::`||a===`0.0.0.0`?`localhost`:a;console.log(`${n(`[ui]`)} listening on http://${i}:${r.port}`);let c=!1,l=e=>{if(c)return;c=!0,console.log(n(`\n[ui] Shutting down (${e})`)),r.detachSafetyNet();let t=()=>{try{r.release()}finally{process.exit(process.exitCode??0)}};r.drainUpgradeSockets(),S(r.httpServers).then(t,t),setTimeout(t,2e3).unref()};process.once(`SIGINT`,()=>l(`SIGINT`)),process.once(`SIGTERM`,()=>l(`SIGTERM`));return}catch(e){if(!(e instanceof r))throw e;let t=i(process.cwd()),o=a??`localhost`,c;try{c=await D({requestedPort:s,host:o,lockDir:t})}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}if(c.mode===`already-running`){if(console.log(`UI already running at http://${o}:${c.port}`),k(process)){await new Promise(e=>{let t=t=>{console.log(n(`\n[ui-keepalive] Shutting down (${t})`)),e()};process.once(`SIGINT`,()=>t(`SIGINT`)),process.once(`SIGTERM`,()=>t(`SIGTERM`))});return}process.exit(0)}console.log(`UI running at http://${o}:${c.upstreamPort}; acting as HTTP proxy on port ${c.handle.port}`);let l=!1,u=e=>{l||(l=!0,console.log(n(`\n[ui-proxy] Shutting down (${e})`)),c.handle.close().finally(()=>process.exit(process.exitCode??0)),setTimeout(()=>process.exit(process.exitCode??0),2e3).unref())};process.once(`SIGINT`,()=>u(`SIGINT`)),process.once(`SIGTERM`,()=>u(`SIGTERM`))}}function k(e){let t=e.stdout.isTTY===!0,n=typeof e.env.PORT==`string`&&e.env.PORT!==``;return!t||n}export{O as runUiCommand};
3
+ //# sourceMappingURL=ui-D8O01OgQ.mjs.map
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{Es as r,Ss as i,ps as a,xs as o}from"./src-BjPajWAS.mjs";import{Br as s,br as c}from"./src-pjKDNsjY.mjs";import{basename as l,dirname as u,isAbsolute as d,join as f,posix as p,relative as m,resolve as h,sep as g,win32 as _}from"node:path";import{cpSync as ee,existsSync as v,lstatSync as te,mkdirSync as y,readFileSync as ne,realpathSync as b,rmSync as x,statSync as re}from"node:fs";import{homedir as S}from"node:os";var C=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),w=n((e=>{let{InvalidArgumentError:t}=C();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),T=n((e=>{let{humanReadableArgName:t}=w();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1
+ import{i as e,o as t,t as n}from"./chunk-DTipWd-i.mjs";import{Ts as r,bs as i,fs as a,xs as o}from"./src-CCW4TQuz.mjs";import{Br as s,br as c}from"./src-D5ZZydZi.mjs";import{basename as l,dirname as u,isAbsolute as d,join as f,posix as p,relative as m,resolve as h,sep as g,win32 as _}from"node:path";import{cpSync as ee,existsSync as v,lstatSync as te,mkdirSync as y,readFileSync as ne,realpathSync as b,rmSync as x,statSync as re}from"node:fs";import{homedir as S}from"node:os";var C=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),w=n((e=>{let{InvalidArgumentError:t}=C();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),T=n((e=>{let{humanReadableArgName:t}=w();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
2
2
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
3
3
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
4
4
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),E=n((e=>{let{InvalidArgumentError:t}=C();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -16,7 +16,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
17
  - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
18
18
  `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
19
- Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}t.Command=h,t.useColor=_}));const{program:oe,createCommand:se,createArgument:ce,createOption:le,CommanderError:ue,InvalidArgumentError:D,InvalidOptionArgumentError:de,Command:fe,Argument:pe,Option:me,Help:he}=t(n((e=>{let{Argument:t}=w(),{Command:n}=ae(),{CommanderError:r,InvalidArgumentError:i}=C(),{Help:a}=T(),{Option:o}=E();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default,O=o,k=i,ge=r,A=`node`,j={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},M=`# ok-mcp-v2
19
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}t.Command=h,t.useColor=_}));const{program:oe,createCommand:se,createArgument:ce,createOption:le,CommanderError:ue,InvalidArgumentError:D,InvalidOptionArgumentError:de,Command:fe,Argument:pe,Option:me,Help:he}=t(n((e=>{let{Argument:t}=w(),{Command:n}=ae(),{CommanderError:r,InvalidArgumentError:i}=C(),{Help:a}=T(),{Option:o}=E();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default,O=i,k=o,ge=r,A=`node`,j={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},M=`# ok-mcp-v2
20
20
  USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
21
21
  [ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
22
22
  BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
@@ -53,4 +53,4 @@ foreach ($d in $dirs) {
53
53
  }
54
54
  [Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
55
55
  exit 127`,P=`// ok-pi-bridge`,F=`${P}-v1`,I=`ok-pi-managed-extension`;function L(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(F)}return!1}function R(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=h(e);if(l(t)===`cli.mjs`&&l(u(t))===`dist`)return t;let n=t.split(g),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return f(i.length===0?g:i.join(g),`packages`,`cli`,`dist`,`cli.mjs`)}function z(e={}){return e.mode===`dev`?{command:A,args:[R(),`mcp`],env:{...j}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,N]}:{command:`/bin/sh`,args:[`-l`,`-c`,M]}}function _e(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[A,R(),`mcp`],environment:{...j}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,N]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,M]}}function ve(e){if(typeof e!=`object`||!e)return!1;let t=e;return B(t,z({mode:`published`,platformName:`darwin`}))||B(t,z({mode:`published`,platformName:`win32`}))}function B(e,t){return Object.keys(e).length===Object.keys(t).length?ye(e,t):!1}function ye(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function V(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`?e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3]):!1}function be(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:V(t.args,t.command)}function xe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&V(r,n)}function H(e){return e===`win32`?_:p}function Se(e={}){let t=e.platformName??process.platform,n=e.home??S(),r=e.env??process.env,i=H(t);return t===`darwin`?i.join(n,`Library`,`Application Support`):t===`win32`?r.APPDATA??i.join(n,`AppData`,`Roaming`):r.XDG_CONFIG_HOME??i.join(n,`.config`)}function Ce(e={}){let t=e.platformName??process.platform,n=e.home??S();return H(t).join(n,`.claude.json`)}function U(e={}){let t=e.platformName??process.platform,n=e.home??S(),r=e.env??process.env;if(t===`darwin`)return p.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??_.join(n,`AppData`,`Roaming`);return _.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function W(e={}){let t=e.platformName??process.platform,n=e.home??S();return H(t).join(n,`.cursor`,`mcp.json`)}function we(e={}){let t=e.platformName??process.platform,n=e.home??S();return(e.env??process.env).CODEX_HOME??H(t).join(n,`.codex`)}function G(e={}){return H(e.platformName??process.platform).join(we(e),`config.toml`)}function K(e={}){let t=e.platformName??process.platform,n=e.home??S(),r=(e.env??process.env).COPILOT_HOME??H(t).join(n,`.copilot`);return H(t).join(r,`mcp-config.json`)}function Te(e={}){let t=e.platformName??process.platform,n=e.home??S(),r=e.env??process.env,i=H(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function q(e={}){return H(e.platformName??process.platform).join(Te(e),`opencode.json`)}function Ee(e={}){let t=e.platformName??process.platform,n=e.home??S();return H(t).join(n,`.openclaw`,`openclaw.json`)}function De(e={}){let t=e.platformName??process.platform,n=e.home??S();return H(t).join(n,`.hermes`,`config.yaml`)}function Oe(e={}){let t=e.platformName??process.platform,n=e.home??S();return(e.env??process.env).PI_CODING_AGENT_DIR??H(t).join(n,`.pi`,`agent`)}function ke(e={}){let t=e.platformName??process.platform,n=e.home??S();return H(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function Ae(e,t){let n=H(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function J(e={}){let t=e.platformName??process.platform,n=Ae(e.home??S(),t);return n.find(e=>v(e))||n.find(e=>v(u(e)))||n[0]}const Y={claude:{id:`claude`,label:k.claude,configPath:(e,t)=>Ce({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>a,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(t??S(),`.claude`),projectConfigPath:e=>f(e,`.mcp.json`),projectSkillPath:e=>f(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:k[`claude-desktop`],configPath:(e,t)=>U({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>a,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>u(U({home:t}))},cursor:{id:`cursor`,label:k.cursor,configPath:(e,t)=>W({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>a,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>u(W({home:t})),projectConfigPath:e=>f(e,`.cursor`,`mcp.json`),projectSkillPath:e=>f(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:k.codex,configPath:(e,t)=>G({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>a,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>u(G({home:t})),projectConfigPath:e=>f(e,`.codex`,`config.toml`),projectSkillPath:e=>f(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:k.copilot,configPath:(e,t)=>K({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>a,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>u(K({home:t})),projectSkillPath:e=>f(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:k.opencode,configPath:(e,t)=>q({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>a,buildEntry:(e,t)=>_e(t),scope:`global`,detectPath:(e,t)=>u(q({home:t})),projectConfigPath:e=>f(e,`opencode.json`),projectSkillPath:e=>f(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:k.openclaw,configPath:(e,t)=>Ee({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>a,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(t??S(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:k.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>a,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>Oe({home:t}),projectConfigPath:e=>f(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>f(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:k.antigravity,configPath:(e,t)=>ke({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>a,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(t??S(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:k[`lm-studio`],configPath:(e,t)=>J({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>a,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>u(J({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:k.hermes,configPath:(e,t)=>De({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>a,buildEntry:(e,t)=>z(t),scope:`global`,detectPath:(e,t)=>f(t??S(),`.hermes`),offerOnlyWhenDetected:!0}};function je(e){let t=e.filter(e=>!Object.hasOwn(Y,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${O.join(`, `)}`);return e.map(e=>Y[e])}function X(e,t){let n;try{n=te(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);Z(e,t)}function Me(e,t){Z(e,t)}function Z(e,t){let n;try{n=b(t)}catch{n=h(t)}let r=u(e);for(;r.length>1&&r!==g;){let t;try{t=b(r)}catch(e){if(e.code===`ENOENT`){r=u(r);continue}throw e}let i=m(n,t);if(i===``||!i.startsWith(`..`)&&!d(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ne(e,t,n){try{if(re(n).size>10485760)return!1}catch{return!1}let r;try{r=ne(n,`utf-8`)}catch{return!1}let i=[],a=s(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!Q(a))return!1;let o=a[e.topLevelKey];if(!Q(o))return!1;let c=e.serverMapSubKey?o[e.serverMapSubKey]:o;return Q(c)?Q(c[e.serverName(t)]):!1}function Pe(e,t,n={}){if(e.id!==`copilot`)return!0;try{return Ne(e,t,e.configPath(t,n.home))}catch{return!1}}function $(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!Pe(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=c(`project`,{checkDesktop:!0}),i=u(r);X(i,t);let a=v(r)?`overwritten`:`written`;return x(i,{recursive:!0,force:!0}),y(u(i),{recursive:!0}),ee(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}export{je as _,k as a,me as b,P as c,z as d,be as f,Se as g,xe as h,O as i,F as l,ve as m,Me as n,Y as o,L as p,$ as r,ge as s,X as t,I as u,fe as v,D as y};
56
- //# sourceMappingURL=write-project-skill-7xCQZ9iq.mjs.map
56
+ //# sourceMappingURL=write-project-skill-BufydPiH.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/open-knowledge",
3
- "version": "0.58.0-beta.8",
3
+ "version": "0.58.0",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "private": false,
6
6
  "type": "module",
@@ -62,10 +62,10 @@
62
62
  "ajv-formats": "^3.0.1",
63
63
  "tsdown": "^0.21.7",
64
64
  "typescript": "^5.9.3",
65
- "@inkeep/open-knowledge-app": "0.58.0-beta.8",
66
- "@inkeep/open-knowledge-server": "0.58.0-beta.8",
67
65
  "@inkeep/open-knowledge-native-config": "0.0.0",
68
- "@inkeep/open-knowledge-core": "0.58.0-beta.8"
66
+ "@inkeep/open-knowledge-app": "0.58.0",
67
+ "@inkeep/open-knowledge-server": "0.58.0",
68
+ "@inkeep/open-knowledge-core": "0.58.0"
69
69
  },
70
70
  "scripts": {
71
71
  "build:cli": "rm -rf dist && tsdown",
@@ -1,2 +0,0 @@
1
- import"./src-BjPajWAS.mjs";var e=`0.58.0-beta.8`;const t=`config.yml`,n=e;export{n,t};
2
- //# sourceMappingURL=constants-CzhGjsFo.mjs.map
@@ -1 +0,0 @@
1
- import{_ as e,c as t}from"./fs-traced-oq2wG9J_.mjs";export{t as tracedMkdir,e as tracedWriteFile};
@@ -1 +0,0 @@
1
- import{r as e}from"./git-handle-2o4Vxedu.mjs";export{e as createGitInstance};
@@ -1 +0,0 @@
1
- import{g as e}from"./init-DasMrTCg.mjs";export{e as runInit};
@@ -1 +0,0 @@
1
- import{n as e}from"./loader-CFnKYZR2.mjs";export{e as loadConfig};
@@ -1,2 +0,0 @@
1
- import{Ko as e,Zo as t,oo as n}from"./src-BjPajWAS.mjs";const r=new n({extensions:e,deriveStructuralFreshness:!0}),i=t(e);export{i as n,r as t};
2
- //# sourceMappingURL=md-manager-FXuCv5zc.mjs.map
@@ -1 +0,0 @@
1
- import{n as e,t}from"./preview-Dv9l315C.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,o as r}from"./DocumentContext-BNs9Wc7G.js";import{t as i}from"./react-f2sANaYj.js";import{n as a,r as o}from"./dist-Nvb76hAm.js";import{t as s}from"./compiler-runtime-BfE3aGVn.js";import{t as c}from"./button-CA0dewJJ.js";import{i as l,n as u,t as d}from"./tooltip-DPvMEqsq.js";import{a as f,c as p,i as m,o as h,s as g,t as _}from"./dialog-nnyEatfT.js";import{n as v}from"./dist-CMZSEMCN2.js";import{t as y}from"./dist-CdT2fVlj.js";import{c as b}from"./Mermaid-DnS07V7q.js";import{r as x}from"./CopyButton-Y3fFETes.js";import{i as S}from"./prop-types-BWoV6rdx.js";import{t as C}from"./spinner-CbcfYaH_.js";import{t as w}from"./undo-2-B1iI1RfY.js";import{c as T}from"./navigation-targets-B9ZSMArq.js";import{a as E,i as D,n as O,o as k,t as A}from"./agent-diff-store-CKEwkZK6.js";import{t as j}from"./timeline-diff-store-yWTwVhRT.js";import{n as M}from"./use-activity-panel-bJnzXq1_.js";var N=s(),P=e(i(),1),F=t();function I(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function ee(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:v,onOpenDiff:y,onRestore:b}=e,{_:x}=o(),[S,T]=(0,P.useState)(te),D,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=setInterval(()=>T(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=D,t[1]=O):(D=t[0],O=t[1]),(0,P.useEffect)(D,O);let[k,A]=(0,P.useState)(!1),j=E(),M=n.stackIndex+1,ee=j?.docName===r&&j.keptCount===M,L=i-M,ne=!s||v||L<=0,re;t[2]!==L||t[3]!==b?(re=function(){A(!1),b(L)},t[2]=L,t[3]=b,t[4]=re):re=t[4];let ie=re,R;t[5]!==n||t[6]!==y?(R=()=>y(n),t[5]=n,t[6]=y,t[7]=R):R=t[7];let z;t[8]!==x||t[9]!==M||t[10]!==r?(z=x({id:`Z79bnE`,values:{burstNumber:M,docName:r}}),t[8]=x,t[9]=M,t[10]=r,t[11]=z):z=t[11];let ae=ee?`bg-muted`:`hover:bg-muted/40`,oe;t[12]===ae?oe=t[13]:(oe=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,ae],t[12]=ae,t[13]=oe);let se=oe.join(` `),B;t[14]!==n.ts||t[15]!==S?(B=I(n.ts,S),t[14]=n.ts,t[15]=S,t[16]=B):B=t[16];let V;t[17]===B?V=t[18]:(V=(0,F.jsx)(`span`,{className:`font-mono`,children:B}),t[17]=B,t[18]=V);let H;t[19]===n.additions?H=t[20]:(H=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=H);let U;t[21]===n.deletions?U=t[22]:(U=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=U);let W;t[23]!==H||t[24]!==U?(W=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[H,` `,U]}),t[23]=H,t[24]=U,t[25]=W):W=t[25];let G;t[26]!==ee||t[27]!==V||t[28]!==W||t[29]!==R||t[30]!==z||t[31]!==se?(G=(0,F.jsxs)(`button`,{type:`button`,onClick:R,"aria-pressed":ee,"aria-label":z,"data-testid":`activity-panel-burst-open`,className:se,children:[V,W]}),t[26]=ee,t[27]=V,t[28]=W,t[29]=R,t[30]=z,t[31]=se,t[32]=G):G=t[32];let ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=ce):ce=t[33];let K;t[34]!==x||t[35]!==M||t[36]!==r?(K=x({id:`Zhe80e`,values:{burstNumber:M,docName:r}}),t[34]=x,t[35]=M,t[36]=r,t[37]=K):K=t[37];let le;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(le=()=>A(!0),t[38]=le):le=t[38];let q;t[39]===v?q=t[40]:(q=v?(0,F.jsx)(C,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(w,{className:`size-3`,"aria-hidden":`true`}),t[39]=v,t[40]=q);let J;t[41]!==ne||t[42]!==K||t[43]!==q?(J=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0 text-muted-foreground hover:text-destructive`,"data-testid":`activity-panel-burst-restore`,"aria-label":K,disabled:ne,onClick:le,children:q})}),t[41]=ne,t[42]=K,t[43]=q,t[44]=J):J=t[44];let Y;t[45]!==x||t[46]!==L||t[47]!==s?(Y=x(s?L>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=x,t[46]=L,t[47]=s,t[48]=Y):Y=t[48];let X;t[49]===Y?X=t[50]:(X=(0,F.jsx)(u,{side:`left`,children:Y}),t[49]=Y,t[50]=X);let Z;t[51]!==J||t[52]!==X?(Z=(0,F.jsxs)(d,{children:[J,X]}),t[51]=J,t[52]=X,t[53]=Z):Z=t[53];let Q;t[54]!==G||t[55]!==Z?(Q=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[G,ce,Z]}),t[54]=G,t[55]=Z,t[56]=Q):Q=t[56];let ue;t[57]===v?ue=t[58]:(ue=e=>{!e&&!v?A(!1):e&&A(!0)},t[57]=v,t[58]=ue);let de;t[59]===x?de=t[60]:(de=x({id:`a4FRQv`}),t[59]=x,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(p,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===L?pe=t[64]:(pe=(0,F.jsx)(f,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:L}})}),t[63]=L,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(g,{children:[fe,pe]}),t[65]=fe,t[66]=pe,t[67]=$):$=t[67];let me;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(c,{variant:`outline`,"data-testid":`activity-panel-burst-restore-cancel`,onClick:()=>A(!1),children:(0,F.jsx)(a,{id:`dEgA5A`})}),t[68]=me):me=t[68];let he;t[69]===v?he=t[70]:(he=v?(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=v,t[70]=he);let ge;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,F.jsx)(a,{id:`9uI_rE`}),t[71]=ge):ge=t[71];let _e;t[72]!==ie||t[73]!==v||t[74]!==he?(_e=(0,F.jsxs)(h,{children:[me,(0,F.jsxs)(c,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:v,onClick:ie,children:[he,ge]})]}),t[72]=ie,t[73]=v,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(m,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==ue||t[81]!==ve?(ye=(0,F.jsx)(_,{open:k,onOpenChange:ue,children:ve}),t[79]=k,t[80]=ue,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Q||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Q,ye]}),t[83]=Q,t[84]=ye,t[85]=be):be=t[85],be}function te(){return Date.now()}function L(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return y._({id:`nYeBmY`,values:{hours:r}})}function ne(e){let t=(0,N.c)(56),{file:n,sessionAlive:r,isWriting:i,onNavigate:s,onUndoDrop:c,onSetVersion:l}=e,{_:u}=o(),{docName:d}=n,[f,p]=(0,P.useState)(!1),[m,h]=(0,P.useState)(re),g,_;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>{let e=setInterval(()=>h(Date.now()),3e4);return()=>clearInterval(e)},_=[],t[0]=g,t[1]=_):(g=t[0],_=t[1]),(0,P.useEffect)(g,_);let v=n.bursts.length,y;t[2]!==n.docName||t[3]!==c||t[4]!==r||t[5]!==f?(y=e=>{e<=0||!r||f||(p(!0),Promise.resolve(c(n.docName,e)).finally(()=>{p(!1),A()}))},t[2]=n.docName,t[3]=c,t[4]=r,t[5]=f,t[6]=y):y=t[6];let b=y;if(n.bursts.length===0)return null;let x;t[7]!==n.docName||t[8]!==s?(x=()=>s(n.docName),t[7]=n.docName,t[8]=s,t[9]=x):x=t[9];let S;t[10]!==u||t[11]!==d?(S=u({id:`QcpeeE`,values:{docName:d}}),t[10]=u,t[11]=d,t[12]=S):S=t[12];let C;t[13]!==n.docName||t[14]!==x||t[15]!==S?(C=(0,F.jsx)(`button`,{type:`button`,onClick:x,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":S,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[13]=n.docName,t[14]=x,t[15]=S,t[16]=C):C=t[16];let w;t[17]===n.additionsTotal?w=t[18]:(w=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[17]=n.additionsTotal,t[18]=w);let T;t[19]===n.deletionsTotal?T=t[20]:(T=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[19]=n.deletionsTotal,t[20]=T);let E;t[21]!==w||t[22]!==T?(E=(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[w,` `,T]}),t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==n.lastTs||t[25]!==m?(D=L(n.lastTs,m),t[24]=n.lastTs,t[25]=m,t[26]=D):D=t[26];let O;t[27]===D?O=t[28]:(O=(0,F.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:D}),t[27]=D,t[28]=O);let k;t[29]===i?k=t[30]:(k=i?(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:(0,F.jsx)(a,{id:`6q0rnH`})}):null,t[29]=i,t[30]=k);let j;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(j=(0,F.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[C,E,O,k]}),t[31]=O,t[32]=k,t[33]=C,t[34]=E,t[35]=j):j=t[35];let M;if(t[36]!==b||t[37]!==v||t[38]!==n.bursts||t[39]!==n.docName||t[40]!==l||t[41]!==r||t[42]!==f){let e;t[44]!==b||t[45]!==v||t[46]!==n.docName||t[47]!==l||t[48]!==r||t[49]!==f?(e=e=>(0,F.jsx)(ee,{burst:e,docName:n.docName,editCount:v,sessionAlive:r,inFlight:f,onOpenDiff:e=>l(e.stackIndex+1),onRestore:b},`${n.docName}:${e.stackIndex}`),t[44]=b,t[45]=v,t[46]=n.docName,t[47]=l,t[48]=r,t[49]=f,t[50]=e):e=t[50],M=n.bursts.map(e),t[36]=b,t[37]=v,t[38]=n.bursts,t[39]=n.docName,t[40]=l,t[41]=r,t[42]=f,t[43]=M}else M=t[43];let I;t[51]===M?I=t[52]:(I=(0,F.jsx)(`div`,{children:M}),t[51]=M,t[52]=I);let te;return t[53]!==j||t[54]!==I?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[j,I]}),t[53]=j,t[54]=I,t[55]=te):te=t[55],te}function re(){return Date.now()}async function ie(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function R(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function z(e){typeof window>`u`||(window.location.hash=R(e))}function ae(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(C,{className:`mr-2 size-4`,"aria-hidden":`true`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,F.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[t,(0,F.jsx)(`span`,{className:`text-sm`,children:(0,F.jsx)(a,{id:`ONPvOb`})})]}),e[1]=n):n=e[1],n}function oe(e){let t=(0,N.c)(10),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,F.jsx)(x,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,F.jsx)(`p`,{className:`text-sm font-medium`,children:(0,F.jsx)(a,{id:`DhLHEb`})}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(a,{id:`6gRgw8`}),t[4]=l):l=t[4];let u;t[5]===r?u=t[6]:(u=(0,F.jsx)(c,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:l}),t[5]=r,t[6]=u);let d;return t[7]!==s||t[8]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,u]}),t[7]=s,t[8]=u,t[9]=d):d=t[9],d}function se(){let e=(0,N.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,F.jsx)(`p`,{className:`text-sm italic`,children:(0,F.jsx)(a,{id:`iuTKci`})})}),e[0]=t):t=e[0],t}function B(e){let t=(0,N.c)(12),{onExit:n,showBackButton:r}=e,{_:i}=o(),s;t[0]===i?s=t[1]:(s=i({id:`kYL1lH`}),t[0]=i,t[1]=s);let c;t[2]!==n||t[3]!==r?(c=r?(0,F.jsx)(V,{onClick:n}):null,t[2]=n,t[3]=r,t[4]=c):c=t[4];let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[c,l]}),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,F.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,F.jsx)(`p`,{className:`text-center text-sm italic`,children:(0,F.jsx)(a,{id:`D_WKe_`})})}),t[8]=d):d=t[8];let f;return t[9]!==s||t[10]!==u?(f=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":s,children:[u,d]}),t[9]=s,t[10]=u,t[11]=f):f=t[11],f}function V(e){let t=(0,N.c)(9),{onClick:n}=e,{_:r}=o(),i;t[0]===r?i=t[1]:(i=r({id:`ogAuyr`}),t[0]=r,t[1]=i);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(b,{}),t[2]=s):s=t[2];let f;t[3]!==n||t[4]!==i?(f=(0,F.jsx)(l,{asChild:!0,children:(0,F.jsx)(c,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":i,"data-testid":`docpanel-exit-agent-mode`,children:s})}),t[3]=n,t[4]=i,t[5]=f):f=t[5];let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,F.jsx)(u,{side:`bottom`,children:(0,F.jsx)(a,{id:`ogAuyr`})}),t[6]=p):p=t[6];let m;return t[7]===f?m=t[8]:(m=(0,F.jsxs)(d,{children:[f,p]}),t[7]=f,t[8]=m),m}function H(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(U),i;t[0]!==n||t[1]!==r?(i=n?W(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let o=i,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(`span`,{className:`font-medium`,children:(0,F.jsx)(a,{id:`LCUy_N`})}),t[3]=s):s=t[3];let c;t[4]===o?c=t[5]:(c=o?(0,F.jsxs)(`span`,{children:[` · `,o]}):null,t[4]=o,t[5]=c);let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,F.jsx)(`div`,{className:`mt-1 opacity-80`,children:(0,F.jsx)(a,{id:`GK-IRZ`})}),t[6]=l):l=t[6];let u;return t[7]===c?u=t[8]:(u=(0,F.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[s,c,l]}),t[7]=c,t[8]=u),u}function U(){return Date.now()}function W(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return y._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return y._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return y._({id:`nYeBmY`,values:{hours:n}})}function G(e){let t=(0,N.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,F.jsx)(k,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,F.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function ce(e){let t=(0,N.c)(25),{data:n,status:r,error:i,reload:s,onExit:c,onNavigate:l,onUndoDrop:u,onSetVersion:d,showBackButton:f}=e,{_:p}=o(),m=n?.files?.[0]?.lastTs??null,h=n?.files?.length??0,g;t[0]===p?g=t[1]:(g=p({id:`kYL1lH`}),t[0]=p,t[1]=g);let _;t[2]!==c||t[3]!==f?(_=f?(0,F.jsx)(V,{onClick:c}):null,t[2]=c,t[3]=f,t[4]=_):_=t[4];let v;t[5]!==n||t[6]!==h||t[7]!==m?(v=n?.agent?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(G,{agent:n.agent}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,F.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?(0,F.jsx)(a,{id:`F6pfE9`}):m===null?(0,F.jsx)(a,{id:`PMyJ9C`}):(0,F.jsx)(a,{id:`237hSL`}),n.files.length>0?(0,F.jsxs)(F.Fragment,{children:[` · `,(0,F.jsx)(a,{id:`u3BOHd`,values:{fileCount:h}})]}):null]})]})]}):(0,F.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,F.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:(0,F.jsx)(a,{id:`kYL1lH`})})}),t[5]=n,t[6]=h,t[7]=m,t[8]=v):v=t[8];let y;t[9]!==_||t[10]!==v?(y=(0,F.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[_,v]}),t[9]=_,t[10]=v,t[11]=y):y=t[11];let b;t[12]!==n||t[13]!==i||t[14]!==m||t[15]!==l||t[16]!==d||t[17]!==u||t[18]!==s||t[19]!==r?(b=(0,F.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,F.jsx)(ae,{}):r===`error`&&i?(0,F.jsx)(oe,{error:i,onRetry:s}):n===null?(0,F.jsx)(se,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(H,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(se,{}):n.files.map(e=>(0,F.jsx)(ne,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:l,onUndoDrop:u,onSetVersion:t=>d(e,t)},e.docName))]})}),t[12]=n,t[13]=i,t[14]=m,t[15]=l,t[16]=d,t[17]=u,t[18]=s,t[19]=r,t[20]=b):b=t[20];let x;return t[21]!==g||t[22]!==y||t[23]!==b?(x=(0,F.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":g,children:[y,b]}),t[21]=g,t[22]=y,t[23]=b,t[24]=x):x=t[24],x}function K(e){let t=(0,N.c)(30),i;t[0]===e?i=t[1]:(i=e===void 0?{}:e,t[0]=e,t[1]=i);let{showBackButton:a}=i,s=a===void 0?!0:a,{_:c}=o(),{docPanelAgentId:l,closeActivityPanel:u}=n(),{openTargetTransition:d}=r(),{pageMeta:f}=S(),{data:p,status:m,error:h,reload:g}=M(l),_,y;if(t[2]!==p||t[3]!==l?(_=()=>{if(!(!p||l===null))for(let e of p.files)D(l,e.docName,e.bursts.length)},y=[p,l],t[2]=p,t[3]=l,t[4]=_,t[5]=y):(_=t[4],y=t[5]),(0,P.useEffect)(_,y),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(B,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let b;t[9]!==d||t[10]!==f?(b=e=>{d(T({kind:`doc`,target:e,docName:e},f),{disposition:`permanent`,consumeActiveNewTab:!0}),z(e)},t[9]=d,t[10]=f,t[11]=b):b=t[11];let x=b,C;t[12]!==p||t[13]!==l?(C=(e,t)=>{if(!p?.agent||l===null)return;j();let n=e.bursts.length;O({agentId:l,agentName:p.agent.displayName,agentColor:p.agent.color,agentIcon:p.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=p,t[13]=l,t[14]=C):C=t[14];let w=C,E;t[15]!==c||t[16]!==p||t[17]!==l||t[18]!==g?(E=async(e,t)=>{if(!(t<=0))try{await ie({connectionId:l,docName:e,scope:`count`,count:t,agentName:p?.agent?.displayName}),v.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),g()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);v.error(c({id:`EqrC_R`,values:{message:n}})),g()}},t[15]=c,t[16]=p,t[17]=l,t[18]=g,t[19]=E):E=t[19];let k=E,A;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==x||t[24]!==w||t[25]!==k||t[26]!==g||t[27]!==s||t[28]!==m?(A=(0,F.jsx)(ce,{data:p,status:m,error:h,reload:g,onExit:u,onNavigate:x,onUndoDrop:k,onSetVersion:w,showBackButton:s}),t[20]=u,t[21]=p,t[22]=h,t[23]=x,t[24]=w,t[25]=k,t[26]=g,t[27]=s,t[28]=m,t[29]=A):A=t[29],A}export{K as ActivityModeContent};
@@ -1,2 +0,0 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./button-CA0dewJJ.js";import{n as ee,r as s,t as c}from"./collapsible-COrqeoHr.js";import{a as l,c as u,i as d,n as f,o as p,s as m,t as h}from"./dialog-nnyEatfT.js";import{t as g}from"./checkbox-DBNdWraq.js";import{n as _}from"./dist-CMZSEMCN2.js";import{t as te}from"./chevron-right-DqiGllBX.js";import{t as v}from"./input-ugdhJ7_C.js";import{a as ne,n as re,r as y,t as ie}from"./project-paths-BShAgBI2.js";import{t as ae}from"./textarea-DUUB26q7.js";var oe=a(),b=e(n(),1),x=t(),se=750,ce={root:{id:`ZWolSV`},home:{id:`_RcqUM`},"home-documents":{id:`of3tF-`},"home-desktop":{id:`vfWA_g`},"home-downloads":{id:`wlwXUk`},"volumes-mount":{id:`nMSYz5`},"drive-root":{id:`M3ytY_`}},S={error:e=>_.error(e)};function C(e){let t=(0,oe.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{store:r,toast:i,payload:a}=n,o=r===void 0?y:r,ee=i===void 0?S:i,s;t[2]!==a||t[3]!==o?(s=a??o.getSnapshot(),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c=s;if(!c)return null;let l;return t[5]!==c||t[6]!==o||t[7]!==ee?(l=(0,x.jsx)(le,{payload:c,store:o,toast:ee}),t[5]=c,t[6]=o,t[7]=ee,t[8]=l):l=t[8],l}function le(e){let t=(0,oe.c)(125),{payload:n,store:a,toast:_}=e,{_:y}=i(),S=(0,b.useId)(),[C,le]=(0,b.useState)(n.defaultContentDir),[w,pe]=(0,b.useState)(``),me;t[0]===n.editorOptions?me=t[1]:(me=()=>new Set(n.editorOptions.map(de)),t[0]=n.editorOptions,t[1]=me);let[T,he]=(0,b.useState)(me),[E,ge]=(0,b.useState)(`shared`),[_e,ve]=(0,b.useState)(null),[D,ye]=(0,b.useState)(!1),[be,xe]=(0,b.useState)(null),[Se,Ce]=(0,b.useState)(!1),we,Te;t[2]!==y||t[3]!==C?(we=()=>{if(!ie(C)){ve(null);return}let e=!1,t=setTimeout(()=>{let t=window.okDesktop;t&&t.onboarding.probeContent({contentDir:C}).then(t=>{e||ve(t)}).catch(t=>{e||ve({ok:!1,error:t instanceof Error?t.message:y({id:`snrVQ7`})})})},se);return()=>{e=!0,clearTimeout(t)}},Te=[C,y],t[2]=y,t[3]=C,t[4]=we,t[5]=Te):(we=t[4],Te=t[5]),(0,b.useEffect)(we,Te);let Ee;t[6]===C?Ee=t[7]:(Ee=ie(C),t[6]=C,t[7]=Ee);let O=Ee,k=D||!O,De=Se||!O,Oe=n.projectDir,ke;t[8]!==n.pickedPath||t[9]!==n.projectDir?(ke=re(n.projectDir,n.pickedPath)??n.pickedPath,t[8]=n.pickedPath,t[9]=n.projectDir,t[10]=ke):ke=t[10];let Ae=ke,je;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(je=function(e){he(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[11]=je):je=t[11];let Me=je,Ne;t[12]!==y||t[13]!==n.projectDir?(Ne=async function(){let e=window.okDesktop;if(!e)return;let t;try{t=await e.dialog.openFolder({defaultPath:n.projectDir})}catch(e){let t=e;xe(t instanceof Error?t.message:y({id:`P-ye9o`}));return}if(t===null)return;let r=re(n.projectDir,t);if(r===null){xe(y({id:`UTZ97u`}));return}xe(null),le(r)},t[12]=y,t[13]=n.projectDir,t[14]=Ne):Ne=t[14];let Pe=Ne,Fe;t[15]!==w||t[16]!==C||t[17]!==T||t[18]!==E||t[19]!==a||t[20]!==_?(Fe=async function(){ye(!0);let e=await a.confirm({initGit:!0,contentDir:C,additionalIgnores:w,editorIds:Array.from(T),sharing:E});e.ok||(_.error(e.error),ye(!1))},t[15]=w,t[16]=C,t[17]=T,t[18]=E,t[19]=a,t[20]=_,t[21]=Fe):Fe=t[21];let Ie=Fe,Le;t[22]!==Ie||t[23]!==k?(Le=function(e){e.preventDefault(),!k&&Ie()},t[22]=Ie,t[23]=k,t[24]=Le):Le=t[24];let Re=Le,ze;t[25]!==a||t[26]!==_?(ze=async function(){ye(!0);let e=await a.cancel();e.ok||(_.error(e.error),ye(!1))},t[25]=a,t[26]=_,t[27]=ze):ze=t[27];let A=ze,Be;t[28]!==D||t[29]!==A?(Be=function(e){!e&&!D&&A()},t[28]=D,t[29]=A,t[30]=Be):Be=t[30];let Ve=Be,He;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,x.jsx)(u,{children:(0,x.jsx)(r,{id:`seeS6l`})}),t[31]=He):He=t[31];let Ue;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,x.jsxs)(m,{children:[He,(0,x.jsx)(l,{children:(0,x.jsx)(r,{id:`HqiZvw`,components:{0:(0,x.jsx)(`code`,{})}})})]}),t[32]=Ue):Ue=t[32];let j;t[33]!==n.gitRootPromoted||t[34]!==Ae||t[35]!==Oe?(j=n.gitRootPromoted?(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,x.jsx)(r,{id:`Y1kX2z`,values:{projectDir:Oe,pickedRelative:Ae},components:{0:(0,x.jsx)(`code`,{}),1:(0,x.jsx)(`code`,{}),2:(0,x.jsx)(`code`,{}),3:(0,x.jsx)(`code`,{}),4:(0,x.jsx)(`code`,{})}})}):null,t[33]=n.gitRootPromoted,t[34]=Ae,t[35]=Oe,t[36]=j):j=t[36];let M;t[37]!==y||t[38]!==n.warnings?(M=n.warnings.length>0?(0,x.jsx)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,children:n.warnings.map(e=>(0,x.jsx)(`p`,{className:`mb-1 last:mb-0`,children:y(ce[e.kind])},e.kind))}):null,t[37]=y,t[38]=n.warnings,t[39]=M):M=t[39];let N;t[40]!==O||t[41]!==_e?(N=O?(0,x.jsx)(fe,{probe:_e}):null,t[40]=O,t[41]=_e,t[42]=N):N=t[42];let P;t[43]!==D||t[44]!==S||t[45]!==E?(P=(0,x.jsx)(ne,{idPrefix:S,testIdPrefix:`consent-sharing`,value:E,onValueChange:ge,disabled:D}),t[43]=D,t[44]=S,t[45]=E,t[46]=P):P=t[46];let We;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,x.jsxs)(s,{className:`group flex w-full items-center justify-between gap-2 px-3 py-2 text-sm font-medium hover:bg-muted/50`,"data-testid":`consent-advanced-trigger`,children:[(0,x.jsx)(r,{id:`VNgKZz`}),(0,x.jsx)(te,{className:`size-4 transition-transform group-data-[state=open]:rotate-90 motion-reduce:transition-none`,"aria-hidden":!0})]}),t[47]=We):We=t[47];let Ge;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,x.jsx)(`label`,{htmlFor:`consent-content-dir`,className:`text-sm font-medium`,children:(0,x.jsx)(r,{id:`ll2yNl`})}),t[48]=Ge):Ge=t[48];let Ke;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=e=>{le(e.target.value),xe(null)},t[49]=Ke):Ke=t[49];let qe=!O,Je=be===null?O?void 0:`consent-content-dir-error`:`consent-content-dir-browse-error`,F;t[50]!==D||t[51]!==C||t[52]!==qe||t[53]!==Je?(F=(0,x.jsx)(v,{id:`consent-content-dir`,value:C,onChange:Ke,disabled:D,"aria-invalid":qe,"aria-describedby":Je,"data-testid":`consent-content-dir`,className:`flex-1`}),t[50]=D,t[51]=C,t[52]=qe,t[53]=Je,t[54]=F):F=t[54];let I;t[55]===Pe?I=t[56]:(I=()=>void Pe(),t[55]=Pe,t[56]=I);let Ye;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,x.jsx)(r,{id:`O2UpM1`}),t[57]=Ye):Ye=t[57];let L;t[58]!==D||t[59]!==I?(L=(0,x.jsx)(o,{type:`button`,variant:`outline`,disabled:D,onClick:I,"data-testid":`consent-content-dir-browse`,children:Ye}),t[58]=D,t[59]=I,t[60]=L):L=t[60];let R;t[61]!==F||t[62]!==L?(R=(0,x.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[F,L]}),t[61]=F,t[62]=L,t[63]=R):R=t[63];let z;t[64]!==be||t[65]!==O?(z=be===null?O?null:(0,x.jsx)(`p`,{id:`consent-content-dir-error`,className:`text-1sm text-destructive`,"data-testid":`consent-content-dir-error`,children:(0,x.jsx)(r,{id:`U5Spo9`})}):(0,x.jsx)(`p`,{id:`consent-content-dir-browse-error`,className:`text-1sm text-destructive`,"data-testid":`consent-content-dir-browse-error`,children:be}),t[64]=be,t[65]=O,t[66]=z):z=t[66];let B;t[67]!==R||t[68]!==z?(B=(0,x.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Ge,R,z]}),t[67]=R,t[68]=z,t[69]=B):B=t[69];let Xe;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Xe=(0,x.jsx)(`label`,{htmlFor:`consent-additional-ignores`,className:`text-sm font-medium`,children:(0,x.jsx)(r,{id:`3zyg_A`})}),t[70]=Xe):Xe=t[70];let Ze;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=e=>pe(e.target.value),t[71]=Ze):Ze=t[71];let V;t[72]!==w||t[73]!==D?(V=(0,x.jsx)(ae,{id:`consent-additional-ignores`,value:w,onChange:Ze,disabled:D,placeholder:`tmp/
2
- *.draft.md`,rows:3,"data-testid":`consent-additional-ignores`}),t[72]=w,t[73]=D,t[74]=V):V=t[74];let Qe;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,x.jsx)(r,{id:`aE2_XM`,components:{0:(0,x.jsx)(`code`,{})}})}),t[75]=Qe):Qe=t[75];let H;t[76]===V?H=t[77]:(H=(0,x.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Xe,V,Qe]}),t[76]=V,t[77]=H);let $e;t[78]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,x.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,x.jsx)(r,{id:`0YEbfk`})}),t[78]=$e):$e=t[78];let et;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(et=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,x.jsx)(r,{id:`SfxQX8`})}),t[79]=et):et=t[79];let U;if(t[80]!==D||t[81]!==T||t[82]!==n.editorOptions){let e;t[84]!==D||t[85]!==T?(e=e=>{let t=`consent-editor-${e.id}-cb`;return(0,x.jsxs)(`label`,{htmlFor:t,className:`flex items-center gap-2 text-sm`,children:[(0,x.jsx)(g,{id:t,checked:T.has(e.id),onCheckedChange:()=>Me(e.id),disabled:D,"data-testid":`consent-editor-${e.id}`}),(0,x.jsx)(`span`,{children:e.label}),(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`consent-editor-${e.id}-scope`,children:e.hasProjectConfig?e.hasUserConfig??!0?(0,x.jsx)(r,{id:`cKjLuT`}):(0,x.jsx)(r,{id:`fR-Kdc`}):(0,x.jsx)(r,{id:`nYKerc`})})]},e.id)},t[84]=D,t[85]=T,t[86]=e):e=t[86],U=n.editorOptions.map(e),t[80]=D,t[81]=T,t[82]=n.editorOptions,t[83]=U}else U=t[83];let W;t[87]===U?W=t[88]:(W=(0,x.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[$e,et,U]}),t[87]=U,t[88]=W);let G;t[89]!==B||t[90]!==H||t[91]!==W?(G=(0,x.jsxs)(ee,{className:`space-y-6 border-t border-border px-3 py-4`,children:[B,H,W]}),t[89]=B,t[90]=H,t[91]=W,t[92]=G):G=t[92];let K;t[93]!==De||t[94]!==G?(K=(0,x.jsxs)(c,{open:De,onOpenChange:Ce,className:`rounded-md border border-border`,"data-testid":`consent-advanced`,children:[We,G]}),t[93]=De,t[94]=G,t[95]=K):K=t[95];let q;t[96]!==S||t[97]!==Re||t[98]!==N||t[99]!==P||t[100]!==K?(q=(0,x.jsxs)(`form`,{id:S,onSubmit:Re,"data-testid":`consent-form`,className:`space-y-6`,children:[N,P,K]}),t[96]=S,t[97]=Re,t[98]=N,t[99]=P,t[100]=K,t[101]=q):q=t[101];let J;t[102]!==j||t[103]!==M||t[104]!==q?(J=(0,x.jsxs)(f,{className:`space-y-6`,children:[j,M,q]}),t[102]=j,t[103]=M,t[104]=q,t[105]=J):J=t[105];let Y;t[106]===A?Y=t[107]:(Y=()=>void A(),t[106]=A,t[107]=Y);let tt;t[108]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,x.jsx)(r,{id:`dEgA5A`}),t[108]=tt):tt=t[108];let X;t[109]!==D||t[110]!==Y?(X=(0,x.jsx)(o,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:Y,disabled:D,"data-testid":`consent-cancel`,children:tt}),t[109]=D,t[110]=Y,t[111]=X):X=t[111];let nt;t[112]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,x.jsx)(r,{id:`RDjuBN`}),t[112]=nt):nt=t[112];let Z;t[113]!==S||t[114]!==k?(Z=(0,x.jsx)(o,{type:`submit`,form:S,disabled:k,"data-testid":`consent-start`,children:nt}),t[113]=S,t[114]=k,t[115]=Z):Z=t[115];let Q;t[116]!==X||t[117]!==Z?(Q=(0,x.jsxs)(p,{children:[X,Z]}),t[116]=X,t[117]=Z,t[118]=Q):Q=t[118];let $;t[119]!==J||t[120]!==Q?($=(0,x.jsxs)(d,{className:`sm:max-w-lg`,onOpenAutoFocus:ue,children:[Ue,J,Q]}),t[119]=J,t[120]=Q,t[121]=$):$=t[121];let rt;return t[122]!==Ve||t[123]!==$?(rt=(0,x.jsx)(h,{open:!0,onOpenChange:Ve,children:$}),t[122]=Ve,t[123]=$,t[124]=rt):rt=t[124],rt}function ue(e){e.preventDefault(),e.currentTarget.querySelector(`[role="radio"]`)?.focus()}function de(e){return e.id}function fe(e){let t=(0,oe.c)(24),{probe:n}=e,{_:a}=i();if(n===null){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`consent-preview`,children:(0,x.jsx)(r,{id:`DiFKSL`})}),t[0]=e):e=t[0],e}if(!n.ok){let e=n.error,i;return t[1]===e?i=t[2]:(i=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`consent-preview`,children:(0,x.jsx)(r,{id:`9fvog2`,values:{errorDetail:e}})}),t[1]=e,t[2]=i),i}let o=n.truncated?`≥ 50,000`:String(n.count),l;t[3]!==a||t[4]!==o?(l=a({id:`MV-Dkb`,values:{countDisplay:o}}),t[3]=a,t[4]=o,t[5]=l):l=t[5];let u=l;if(n.sample.length===0){let e;return t[6]===u?e=t[7]:(e=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`consent-preview`,children:u}),t[6]=u,t[7]=e),e}let d=n.truncated?null:n.count-n.sample.length,f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,x.jsx)(te,{className:`size-3 transition-transform motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=f):f=t[8];let p;t[9]===u?p=t[10]:(p=(0,x.jsxs)(s,{className:`flex items-center gap-1 text-1sm text-muted-foreground hover:text-foreground [&[data-state=open]>svg]:rotate-90`,children:[f,(0,x.jsx)(`span`,{children:u})]}),t[9]=u,t[10]=p);let m;t[11]===n.sample?m=t[12]:(m=n.sample.map(w),t[11]=n.sample,t[12]=m);let h;t[13]===m?h=t[14]:(h=(0,x.jsx)(`ul`,{className:`space-y-1.5 font-mono`,children:m}),t[13]=m,t[14]=h);let g;t[15]!==n.truncated||t[16]!==d?(g=n.truncated||d!==null&&d>0?(0,x.jsx)(`p`,{className:`mt-1 italic`,children:n.truncated?(0,x.jsx)(r,{id:`5wV2qQ`}):(0,x.jsx)(r,{id:`nNYV3Y`,values:{remaining:d}})}):null,t[15]=n.truncated,t[16]=d,t[17]=g):g=t[17];let _;t[18]!==h||t[19]!==g?(_=(0,x.jsxs)(ee,{className:`pt-1 pl-4 text-1sm text-muted-foreground`,children:[h,g]}),t[18]=h,t[19]=g,t[20]=_):_=t[20];let v;return t[21]!==p||t[22]!==_?(v=(0,x.jsxs)(c,{"data-testid":`consent-preview`,children:[p,_]}),t[21]=p,t[22]=_,t[23]=v):v=t[23],v}function w(e){return(0,x.jsx)(`li`,{children:e},e)}export{C as default};