@inkeep/open-knowledge 0.79.0-beta.4 → 0.79.0-beta.6

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 (134) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-BFY9H31K.mjs +1 -0
  3. package/dist/{dist-BGAj9i2M.mjs → dist-Cmgb0r3p.mjs} +456 -456
  4. package/dist/{dist-CFc5ttOT.mjs → dist-DzdGKL8W.mjs} +1 -1
  5. package/dist/index.mjs +1 -1
  6. package/dist/{init-Ckl8TtgW.mjs → init-06Lf5_Em.mjs} +2 -2
  7. package/dist/init-DZaEIOfI.mjs +1 -0
  8. package/dist/{launch-json-removal-C8iHTVBl.mjs → launch-json-removal-ZsbUvEQ3.mjs} +1 -1
  9. package/dist/loader-B4ZOsV9p.mjs +1 -0
  10. package/dist/{loader-muK5wdYV.mjs → loader-CO47qD8D.mjs} +1 -1
  11. package/dist/{open-browser-BLgL-giQ.mjs → open-browser-CNVUL-A_.mjs} +1 -1
  12. package/dist/preview-CeOwiTVJ.mjs +1 -0
  13. package/dist/{preview-Dl0Pict5.mjs → preview-CkmKb3M6.mjs} +1 -1
  14. package/dist/public/assets/{ActivityModeContent-B45xhYD5.js → ActivityModeContent-CMQ3yKq7.js} +1 -1
  15. package/dist/public/assets/{AddPropertiesButton-MQnD4mIM.js → AddPropertiesButton-CAVgdUw9.js} +2 -2
  16. package/dist/public/assets/{AgentDiffPane-BUeoDOhR.js → AgentDiffPane-CNxxM1cw.js} +1 -1
  17. package/dist/public/assets/{AgentIconCluster-DHt2yS3f.js → AgentIconCluster-CcWJGxIl.js} +1 -1
  18. package/dist/public/assets/{AgentThreadClientBinder-3iapYztq.js → AgentThreadClientBinder-CvxQuIBX.js} +1 -1
  19. package/dist/public/assets/{BugReportHistory-BBxEv9e1.js → BugReportHistory-DZkrVFAB.js} +1 -1
  20. package/dist/public/assets/{BugReportHistoryDialog-BgoyZyaC.js → BugReportHistoryDialog-CAaSH8Z8.js} +1 -1
  21. package/dist/public/assets/{CodeMirrorPropInput-DIw7oibv.js → CodeMirrorPropInput-Bs5Zz6zc.js} +1 -1
  22. package/dist/public/assets/{ConsentDialogBody-Bd1a1M-0.js → ConsentDialogBody-Dw2RsiPu.js} +1 -1
  23. package/dist/public/assets/{DeleteConfirmationDialog-B_KzG8en.js → DeleteConfirmationDialog-C7TRpBFu.js} +1 -1
  24. package/dist/public/assets/{DiffViewBoundary-D5_GKHyC.js → DiffViewBoundary-B8ygEYRx.js} +1 -1
  25. package/dist/public/assets/{DocumentContext-Cp-NsV6p.js → DocumentContext-DFZKvfvg.js} +1 -1
  26. package/dist/public/assets/{EditorModeToggle-3GKODD3b.js → EditorModeToggle-D1sH5zyp.js} +1 -1
  27. package/dist/public/assets/{EnableSyncConfirmDialog-Cweb4sSE.js → EnableSyncConfirmDialog-D7XgtzZ6.js} +1 -1
  28. package/dist/public/assets/{ExcalidrawDocEditor-DtRoHpPO.js → ExcalidrawDocEditor-LkoeP6TS.js} +1 -1
  29. package/dist/public/assets/FeedbackForm-Vd7E-3c5.js +1 -0
  30. package/dist/public/assets/{GraphPanel-CYXSQp5a.js → GraphPanel-DFPyCL13.js} +1 -1
  31. package/dist/public/assets/{ImageAttachments-DRtQAqvy.js → ImageAttachments-B3P_uoX-.js} +1 -1
  32. package/dist/public/assets/{ImportSkillDialog-B4vgclYe.js → ImportSkillDialog-C5wB1ZPM.js} +1 -1
  33. package/dist/public/assets/{LintConfigEditor-waWQnoZe.js → LintConfigEditor-C2Zhcya0.js} +1 -1
  34. package/dist/public/assets/ManagedArtifactProperties-BGGM89Iv.js +1 -0
  35. package/dist/public/assets/{ManagedArtifactProperties-nNGySIUf.js → ManagedArtifactProperties-BzV-ytKX.js} +1 -1
  36. package/dist/public/assets/{MermaidDocEditor-C7ylpFJ9.js → MermaidDocEditor-BYLl76k-.js} +1 -1
  37. package/dist/public/assets/{OpenInAgentMenuItem-BPMFSCUW.js → OpenInAgentMenuItem-WDk8OSU_.js} +1 -1
  38. package/dist/public/assets/{PropertyDisplayRow-CAG8UoQ7.js → PropertyDisplayRow-Di40R_uZ.js} +1 -1
  39. package/dist/public/assets/{RegisteredAgentIcon-DAQuY_KC.js → RegisteredAgentIcon-D1mT8XgE.js} +1 -1
  40. package/dist/public/assets/{ReportBugDialogBody-RWDL1lW3.js → ReportBugDialogBody-Dh3WD2VN.js} +1 -1
  41. package/dist/public/assets/{ReportBugMenuTrigger-TDYyFjbk.js → ReportBugMenuTrigger-B54YjZe2.js} +1 -1
  42. package/dist/public/assets/{SchemaConfigEditor-BYr7wZ05.js → SchemaConfigEditor-BXUj0uFL.js} +1 -1
  43. package/dist/public/assets/{SessionsHost-CQlKxivD.js → SessionsHost-DOi4zI61.js} +2 -2
  44. package/dist/public/assets/{SettingsDialogBody-ajRDN8FY.js → SettingsDialogBody-CTcChDnS.js} +1 -1
  45. package/dist/public/assets/{ShareBranchSwitchDialog-DV6o2dzF.js → ShareBranchSwitchDialog-BYpslO0e.js} +1 -1
  46. package/dist/public/assets/{ShareReceiveDialog-DFt7j54V.js → ShareReceiveDialog-QU9uVVie.js} +1 -1
  47. package/dist/public/assets/{ShareReceiveMissDialog-BWUOCiPi.js → ShareReceiveMissDialog-Cr-9ZD4P.js} +1 -1
  48. package/dist/public/assets/{SkillCostValue-DvR53V_Q.js → SkillCostValue-BdBcXHlx.js} +1 -1
  49. package/dist/public/assets/{SkillEditBanner-DmsUG2gE.js → SkillEditBanner-ClPPeqZ0.js} +1 -1
  50. package/dist/public/assets/{SkillForkDialog-Dl24BGBJ.js → SkillForkDialog-D034m56I.js} +1 -1
  51. package/dist/public/assets/{SkillInstallMenu-rvVa9UP3.js → SkillInstallMenu-Bnk1xL2_.js} +1 -1
  52. package/dist/public/assets/{SkillOriginInline-tqp0pgQi.js → SkillOriginInline-DqGGomSX.js} +1 -1
  53. package/dist/public/assets/{SkillToolbarControls-C9SCaIkB.js → SkillToolbarControls-C2tntbUk.js} +1 -1
  54. package/dist/public/assets/{SlidesToolbarControls-Bt0XHPrH.js → SlidesToolbarControls-DX59frog.js} +1 -1
  55. package/dist/public/assets/{SourceEditor-CraGQ7DT.js → SourceEditor-BK2MItYu.js} +1 -1
  56. package/dist/public/assets/{TerminalPanel-DMmgrH2k.js → TerminalPanel-BA8pLHQU.js} +1 -1
  57. package/dist/public/assets/{TerminalWindowApp-dm5oD1y4.js → TerminalWindowApp-raSirwID.js} +1 -1
  58. package/dist/public/assets/{TextDocEditor-B-O6GkNh.js → TextDocEditor-Q46PlwHW.js} +1 -1
  59. package/dist/public/assets/{ThreadView-C49JxYjW.js → ThreadView-De4fAzYv.js} +1 -1
  60. package/dist/public/assets/{TimelineDiffPane-Dlp2o8DF.js → TimelineDiffPane-Czlzxejs.js} +1 -1
  61. package/dist/public/assets/{agent-connection-status-B-5aW-ac.js → agent-connection-status-6xEDgtVY.js} +1 -1
  62. package/dist/public/assets/{auth-state-cache-D-u7UZKz.js → auth-state-cache-BbXZVcrL.js} +1 -1
  63. package/dist/public/assets/{bug-report-send-manager-JDec9Bli.js → bug-report-send-manager-CFQeWhI7.js} +1 -1
  64. package/dist/public/assets/{client-version-CjuLBOy3.js → client-version-BZrDNG1U.js} +1 -1
  65. package/dist/public/assets/{comment-chips-ClAgyzus.js → comment-chips-DQwYObOB.js} +1 -1
  66. package/dist/public/assets/{config-provider-C1j4GifZ.js → config-provider-CJtciSEp.js} +1 -1
  67. package/dist/public/assets/{css-color-to-hex-BZkIhdeD.js → css-color-to-hex-a2B-BvaC.js} +1 -1
  68. package/dist/public/assets/{diagnostic-breadcrumb-uN5gSaff.js → diagnostic-breadcrumb-C5JgIaag.js} +1 -1
  69. package/dist/public/assets/{dist-BeWkn8Ul.js → dist-DJGeR4t4.js} +182 -182
  70. package/dist/public/assets/{doc-paths-BHMHTMzR.js → doc-paths-BX7XJ9w6.js} +1 -1
  71. package/dist/public/assets/{doc-undo-manager-CV-iLCEi.js → doc-undo-manager-D7L8yaA-.js} +1 -1
  72. package/dist/public/assets/{documents-events-DLthFMWT.js → documents-events-CnCkgB3l.js} +1 -1
  73. package/dist/public/assets/{file-tree-adapter-Dr7ixRCU.js → file-tree-adapter-BNla68il.js} +1 -1
  74. package/dist/public/assets/{file-tree-utils-B2YaQvaQ.js → file-tree-utils-Zq3ePIrS.js} +1 -1
  75. package/dist/public/assets/{folder-config-api-BPiFcioc.js → folder-config-api-CzDFKSHb.js} +1 -1
  76. package/dist/public/assets/{index-BYcSr6L0.js → index-Cdw88IDb.js} +9 -9
  77. package/dist/public/assets/{lint-config-client-BfAyK2uP.js → lint-config-client-D4exB0U2.js} +1 -1
  78. package/dist/public/assets/{markdownlint-rule-browser-CSQ2Uq7N.js → markdownlint-rule-browser-62Ha9Ett.js} +1 -1
  79. package/dist/public/assets/{navigation-targets-BYkbsVHW.js → navigation-targets-DRmErmHI.js} +1 -1
  80. package/dist/public/assets/{page-list-cache-CoTOj4OM.js → page-list-cache-B-RIMSul.js} +1 -1
  81. package/dist/public/assets/{pending-receive-nav-store-DhPMduqb.js → pending-receive-nav-store-rpT2htd7.js} +1 -1
  82. package/dist/public/assets/{preferred-session-events-Dr3-iW6l.js → preferred-session-events-D67LV6Ro.js} +1 -1
  83. package/dist/public/assets/{progress-DLb9Nck-.js → progress-BQTeRDUZ.js} +1 -1
  84. package/dist/public/assets/{project-paths-Div6T5Zc.js → project-paths-WrSwjFrW.js} +1 -1
  85. package/dist/public/assets/{prop-types-CLE_x_KL.js → prop-types-B89-ahXp.js} +1 -1
  86. package/dist/public/assets/{receive-store-DymoFN6s.js → receive-store-c_psik1Z.js} +1 -1
  87. package/dist/public/assets/{selection-context-BFBgtwHB.js → selection-context-BNQQRGrZ.js} +1 -1
  88. package/dist/public/assets/{sign-in-terminal-events-EfLYDC4c.js → sign-in-terminal-events-DWlbwYa8.js} +1 -1
  89. package/dist/public/assets/{skill-scope-D_RNVmxr.js → skill-scope-Dv1qfrIr.js} +1 -1
  90. package/dist/public/assets/{skills-api-gNJqpZZB.js → skills-api-tBdkCsaK.js} +1 -1
  91. package/dist/public/assets/{src-DQdCoRJr.js → src-BajtZ0QZ.js} +1 -1
  92. package/dist/public/assets/{startup-marks-CWpvZBNg.js → startup-marks-BYZ0ulrV.js} +1 -1
  93. package/dist/public/assets/{tag-pill-input-jQ6rT6GZ.js → tag-pill-input-D0eqNxOI.js} +1 -1
  94. package/dist/public/assets/{target-navigation-intent-HUejYd93.js → target-navigation-intent-B-2as9vj.js} +1 -1
  95. package/dist/public/assets/{telemetry-startup-CjhYCcO7.js → telemetry-startup-poUQk5mt.js} +1 -1
  96. package/dist/public/assets/{terminal-command-events-oSswLJEm.js → terminal-command-events-C5J8kk91.js} +1 -1
  97. package/dist/public/assets/{terminal-launch-events-C5-BwFtz.js → terminal-launch-events-ChcAyhpW.js} +1 -1
  98. package/dist/public/assets/{terminal-telemetry-BuA3cZ2W.js → terminal-telemetry-8FjHW7qz.js} +1 -1
  99. package/dist/public/assets/{thread-client-DqbMKtSy.js → thread-client-BLcdIOaO.js} +1 -1
  100. package/dist/public/assets/{typing-burst-detector-CpBqcanx.js → typing-burst-detector-DvZ3MhGG.js} +1 -1
  101. package/dist/public/assets/{uninstall-DMnFfeRY.js → uninstall-A3a4moPV.js} +1 -1
  102. package/dist/public/assets/{use-activity-panel-Di2c9gC0.js → use-activity-panel-Btpqtgnc.js} +1 -1
  103. package/dist/public/assets/{use-apply-config-language-Dmck86jC.js → use-apply-config-language-DMh-mO10.js} +1 -1
  104. package/dist/public/assets/{use-collab-url-DY8Ohpil.js → use-collab-url-0YmMiCnb.js} +1 -1
  105. package/dist/public/assets/{use-conflicts-C8QcnAH6.js → use-conflicts-Bv5qpMjG.js} +1 -1
  106. package/dist/public/assets/{use-git-sync-status-Cgwu2ZWb.js → use-git-sync-status-CAwAUWxe.js} +1 -1
  107. package/dist/public/assets/{use-installed-clis-DbaJ79n8.js → use-installed-clis-pLpwg3EF.js} +2 -2
  108. package/dist/public/assets/{use-live-xterm-theme-BzPWQMzU.js → use-live-xterm-theme-CoIE-sU_.js} +1 -1
  109. package/dist/public/assets/{use-open-skill-DNIlXgqH.js → use-open-skill-DS_Opn4I.js} +1 -1
  110. package/dist/public/assets/{use-settings-route-BIkFPL4R.js → use-settings-route-hjVzW5Tp.js} +1 -1
  111. package/dist/public/assets/{use-skill-origin-Cy93N8mK.js → use-skill-origin-CM-tUzQ6.js} +1 -1
  112. package/dist/public/assets/{use-skills-D6sG98MZ.js → use-skills-CgeMgxi9.js} +1 -1
  113. package/dist/public/assets/{use-terminal-enabled-BrsjUQ97.js → use-terminal-enabled-C5ZRMFdk.js} +1 -1
  114. package/dist/public/assets/{use-timeline-entry-diff-Cr116p0w.js → use-timeline-entry-diff-CrahfCFR.js} +1 -1
  115. package/dist/public/assets/{use-workspace-D_21jpYF.js → use-workspace-qpv3ZWQV.js} +1 -1
  116. package/dist/public/index.html +59 -59
  117. package/dist/public/uninstall.html +3 -3
  118. package/dist/{registry-probes-DEhr2b9I.mjs → registry-probes-C8XuKgex.mjs} +1 -1
  119. package/dist/{removal-file-path-BNuJNxLA.mjs → removal-file-path-BebBssVX.mjs} +1 -1
  120. package/dist/{repair-launch-json-472_G7jS.mjs → repair-launch-json-B8fZ2tN5.mjs} +1 -1
  121. package/dist/{repair-mcp-configs-BZGySHhG.mjs → repair-mcp-configs-lb2BaZvv.mjs} +1 -1
  122. package/dist/{src-DepCRykv.mjs → src-B3896kc4.mjs} +1 -1
  123. package/dist/src-D4mlVJbP.mjs +1 -0
  124. package/dist/start-DYGO2vW_.mjs +1 -0
  125. package/dist/{start-CSeaaSZM.mjs → start-QlDaS3eQ.mjs} +3 -3
  126. package/package.json +5 -5
  127. package/dist/constants-DGKD-mBU.mjs +0 -1
  128. package/dist/init-DA9-xTb1.mjs +0 -1
  129. package/dist/loader-s6q3kh95.mjs +0 -1
  130. package/dist/preview-Dqsl68Ly.mjs +0 -1
  131. package/dist/public/assets/FeedbackForm-Bnv4CDav.js +0 -1
  132. package/dist/public/assets/ManagedArtifactProperties-DpwzRse8.js +0 -1
  133. package/dist/src-D_m35QRa.mjs +0 -1
  134. package/dist/start-Bgh0xQF1.mjs +0 -1
@@ -1 +1 @@
1
- import{Ht as e,Io as t,Jo as n,Kl as r,La as i,Rs as a,Zn as o,su as s,wn as c,yn as l,zd as u}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{$ as d,$a as f,$i as p,$n as m,$o as h,$r as g,$t as _,A as v,Aa as y,Ai as b,An as x,Ar as S,At as C,B as w,Ba as T,Bi as E,Bn as D,Br as O,Bt as k,C as A,Ca as j,Ci as M,Cn as N,Cr as P,Ct as F,D as I,Da as L,Di as R,Dn as z,Dr as B,Dt as V,E as H,Ea as U,Ei as W,En as G,Er as K,Et as q,F as J,Fa as Y,Fi as X,Fn as Z,Fr as Q,Ft as $,G as ee,Ga as te,Gi as ne,Gn as re,Gr as ie,Gt as ae,H as oe,Ha as se,Hi as ce,Hn as le,Hr as ue,Ht as de,I as fe,Ia as pe,Ii as me,In as he,Ir as ge,It as _e,J as ve,Ja as ye,Ji as be,Jn as xe,Jr as Se,Jt as Ce,K as we,Ka as Te,Ki as Ee,Kn as De,Ko as Oe,Kr as ke,Kt as Ae,L as je,La as Me,Li as Ne,Ln as Pe,Lr as Fe,Lt as Ie,M as Le,Ma as Re,Mi as ze,Mn as Be,Mr as Ve,Mt as He,N as Ue,Na as We,Ni as Ge,Nn as Ke,Nr as qe,Nt as Je,O as Ye,Oa as Xe,Oi as Ze,On as Qe,Or as $e,Ot as et,P as tt,Pa as nt,Pi as rt,Pn as it,Pr as at,Pt as ot,Q as st,Qa as ct,Qi as lt,Qn as ut,Qo as dt,Qr as ft,Qt as pt,R as mt,Ra as ht,Ri as gt,Rn as _t,Rr as vt,Rt as yt,S as bt,Sa as xt,Si as St,Sn as Ct,So as wt,Sr as Tt,St as Et,T as Dt,Ta as Ot,Ti as kt,Tn as At,Tr as jt,Tt as Mt,U as Nt,Ua as Pt,Ui as Ft,Un as It,Ur as Lt,Ut as Rt,V as zt,Va as Bt,Vi as Vt,Vn as Ht,Vr as Ut,Vt as Wt,W as Gt,Wa as Kt,Wi as qt,Wn as Jt,Wr as Yt,Wt as Xt,X as Zt,Xa as Qt,Xi as $t,Xn as en,Xr as tn,Xt as nn,Y as rn,Ya as an,Yi as on,Yn as sn,Yr as cn,Yt as ln,Z as un,Za as dn,Zi as fn,Zn as pn,Zo as mn,Zr as hn,Zt as gn,_ as _n,_a as vn,_i as yn,_n as bn,_o as xn,_r as Sn,_t as Cn,a as wn,aa as Tn,ai as En,an as Dn,ao as On,ar as kn,as as An,at as jn,b as Mn,ba as Nn,bi as Pn,bn as Fn,bo as In,br as Ln,bt as Rn,c as zn,ca as Bn,ci as Vn,cn as Hn,co as Un,cr as Wn,ct as Gn,d as Kn,da as qn,di as Jn,dn as Yn,do as Xn,dr as Zn,dt as Qn,ea as $n,ei as er,en as tr,eo as nr,er as rr,es as ir,et as ar,f as or,fa as sr,fi as cr,fn as lr,fo as ur,fr as dr,ft as fr,g as pr,ga as mr,gi as hr,gn as gr,go as _r,gr as vr,gt as yr,h as br,ha as xr,hi as Sr,hn as Cr,ho as wr,hr as Tr,ht as Er,i as Dr,ia as Or,ii as kr,in as Ar,io as jr,ir as Mr,is as Nr,it as Pr,j as Fr,ja as Ir,ji as Lr,jn as Rr,jr as zr,jt as Br,k as Vr,ka as Hr,ki as Ur,kn as Wr,kr as Gr,kt as Kr,l as qr,la as Jr,li as Yr,ln as Xr,lo as Zr,lr as Qr,lt as $r,m as ei,ma as ti,mi as ni,mn as ri,mo as ii,mr as ai,mt as oi,n as si,na as ci,ni as li,nn as ui,no as di,nr as fi,ns as pi,nt as mi,o as hi,oa as gi,oi as _i,on as vi,oo as yi,or as bi,ot as xi,p as Si,pa as Ci,pi as wi,pn as Ti,po as Ei,pr as Di,pt as Oi,q as ki,qa as Ai,qi as ji,qn as Mi,qo as Ni,qr as Pi,qt as Fi,r as Ii,ra as Li,ri as Ri,rn as zi,ro as Bi,rr as Vi,rs as Hi,rt as Ui,s as Wi,sa as Gi,si as Ki,sn as qi,so as Ji,sr as Yi,st as Xi,t as Zi,ta as Qi,ti as $i,tn as ea,to as ta,tr as na,ts as ra,tt as ia,u as aa,ua as oa,ui as sa,un as ca,uo as la,ur as ua,ut as da,v as fa,va as pa,vi as ma,vn as ha,vo as ga,vr as _a,vt as va,w as ya,wa as ba,wi as xa,wn as Sa,wr as Ca,wt as wa,x as Ta,xa as Ea,xi as Da,xn as Oa,xo as ka,xr as Aa,xt as ja,y as Ma,ya as Na,yi as Pa,yn as Fa,yo as Ia,yr as La,yt as Ra,z as za,za as Ba,zi as Va,zn as Ha,zr as Ua,zt as Wa}from"./dist-BGAj9i2M.mjs";export{Zi as AGENT_ID_MAX_LEN,si as AGENT_ID_RE,Ii as AGENT_WRITE_ORIGIN,Dr as AcpPermissionStore,wn as AcpRegistry,hi as AcpThreadManager,Wi as AgentFocusBroadcaster,zn as AgentPresenceBroadcaster,qr as AgentSessionCapacityError,aa as AgentSessionManager,Kn as AutoStartDisabledError,or as BUNDLE_IDS,Si as BUNDLE_SCOPE,ei as BUNDLE_SKILL_NAME,br as BacklinkIndex,pr as CC1Broadcaster,r as CC1_CONTRACT_VERSION,_n as CONCURRENT_REPLACE_WINDOW_MS,fa as CONFIG_FILENAME,Ma as CONFLICT_MARKER_RE,Mn as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ta as ConfigSchema,bt as ConflictAuthority,A as DEFAULT_CHECKPOINT_RETENTION,ya as DEFAULT_EMBEDDINGS_DIMENSIONS,Dt as DEFAULT_PACK_ID,H as DocumentDurabilityState,I as DocumentDurabilityStateError,Ye as EMBEDDINGS_API_KEY_ENV,Vr as EPHEMERAL_PROJECT_DIR_PREFIX,v as ExposureConsentError,Fr as FEATURED_AGENT_IDS,Le as FILE_SYSTEM_WRITER,Ue as FILE_WATCHER_ORIGIN,tt as FileEmbeddingsBackend,J as GIT_PREFLIGHT_FAIL_SPAN_NAME,fe as GIT_UPSTREAM_WRITER,Oe as GitDirAccessError,je as GitNotAvailableError,mt as GitTooOldError,za as HOCUSPOCUS_AUTH_REJECTION_REASONS,w as HocuspocusAuthRejection,zt as HocuspocusAuthTokenSchema,oe as HomeProjectRootError,Nt as INSTALLED_AGENTS_SCHEMES,Gt as JSON_SCHEMA_DIALECT_2020_12,e as LINEAGE_EPOCH_KEY,ee as LIVE_DERIVED_INDEX_DEBOUNCE_MS,we as MANAGED_RENAME_ORIGIN,ki as MAX_ACP_THREADS,ve as MAX_AGENT_SESSIONS,rn as MCP_CONNECTION_ID_HEADER,u as MCP_SERVER_NAME,Zt as MIN_EVICTABLE_IDLE_MS,un as MIN_GIT_VERSION,st as MISSING_OK_CONFIG_MESSAGE,Ni as MalformedGitPointerError,d as McpLogger,ar as MissingOkConfigError,ia as OBSERVER_SYNC_ORIGIN,mi as OK_OKIGNORE_TEMPLATE,Ui as ONBOARDING_BUNDLE_IDS,l as ORPHAN_MODES,c as PROTOCOL_VERSION,mn as PinoLogger,Pr as ProcessLockCollisionError,jn as ProjectGitInitError,xi as ROLLBACK_ORIGIN,Xi as ROOT_GITIGNORE_TEMPLATE,Gn as RUNTIME_VERSION,$r as SERVICE_WRITER,da as SKILL_INSTALL_EVENTS_FILE_REL,o as SKILL_STATE_TARGETS,Qn as STARTER_FOLDER_FRONTMATTER_FILENAME,fr as STARTER_PACKS,Oi as STARTER_PACK_IDS,oi as STATE_MANIFEST_FILENAME,Er as STATE_SCHEMA_VERSION,s as SYSTEM_DOC_NAME,yr as SeedPrerequisiteError,Cn as SeedRootDirError,va as ServerLockCollisionError,Ra as SingleFileNotAFileError,Rn as SingleFileNotFoundError,ja as SingleFileNotMarkdownError,Et as SingleFileProjectOverrideError,F as StateManifestError,wa as TagIndex,Mt as USER_GLOBAL_BUNDLE_IDS,q as __getShowAllWalkStatsForTesting,V as __resetShowAllWalkStatsForTesting,et as acpThreadStoreRoots,Kr as acpThreadsDir,C as acquireProcessLock,Br as acquireServerLock,He as applyAgentMarkdownWrite,Je as applyExternalChange,ot as applySeed,$ as assertCompatibleStateManifest,_e as assertGitAvailable,Ie as assertNeverDiskEvent,yt as assertNotHomeProjectRoot,Wa as attachAcpThreadSocket,k as attachCollabClientCounter,Wt as attachIdleShutdown,de as bindConflictAuthority,Rt as bootServer,Xt as buildAndOpenSkill,ae as buildConfigYmlContent,Ae as buildExecResult,Fi as buildIngressPolicy,Ce as buildOkMcpStdioCommand,ln as buildSkillZip,nn as buildStarterFolderFrontmatterYaml,gn as buildWipTree,pt as bundleSkillMdPath,_ as canonicalProjectKey,tr as canonicalizeForCompare,ea as classifyEvents,ui as classifyFsPath,zi as clearAllEmbeddingsKeys,Ar as coercePackId,Dn as collectServerHostSnapshot,i as colorFromSeed,vi as commitUpstreamImport,qi as commitWip,Hn as commitWipFromTree,Xr as compareSemver,ca as composeEffectiveLinterConfig,Yn as composeFrontmatterSchemasConfig,lr as containsConflictMarkers,Ti as contentHash,ri as contributorCount,Cr as countShadowObjects,gr as countStaleAgentWipRefs,bn as countWipRefs,ha as createApiExtension,Fa as createAssetServeMiddleware,Fn as createCollaborationHost,Oa as createContentFilter,Ct as createContentFilterAsync,N as createEmbeddingsSecretStore,Sa as createEphemeralProjectDir,At as createExternalChangeHandler,G as createFileLogger,z as createLiveDerivedIndexExtension,Qe as createMcpHttpHandler,Wr as createOsProbe,x as createPersistenceExtension,Rr as createProbeFailureReporter,Be as createServer,Ke as createServerObserverExtension,it as createServerProbeResolver,Z as createStreamingErrorWriter,dt as createTestLogger,he as describeStoredEmbeddingsKey,Pe as detectClaudeDesktopPresence,_t as detectGit,Ha as detectProjectShape,D as detectUserSkillHosts,Ht as discoverLockDirs,le as discoverMarkdownlintConfig,It as emitPreflightFailureSpan,Jt as encodeDocName,re as encodeFolderRoute,De as encodeSkillRoute,Mi as ensureProjectGit,xe as errorResponse,sn as evictStaleTrackerEntries,en as extractHeadings,pn as extractOkBinaryPath,ut as extractWikiLinksFromMarkdown,m as fallbackPaths,rr as findEnclosingGitRoot,na as findEnclosingProjectRoot,fi as findNativeMarkdownlintFile,Vi as flushFileLogger,Mr as formatAuditBrokenLinkSuppressionLine,kn as formatAuthRejectionWire,bi as formatContributorsFrom,Yi as formatPackRationale,Wn as gcCheckpointRefs,Qr as getCurrentMcpLogger,ua as getIngressContext,Zn as getLocalDir,dr as getLogFilePath,h as getLogger,Di as getLogsDir,ai as getMachineId,Tr as getMeter,vr as getMetrics,Sn as getTracer,_a as handleCollabSocketError,La as handleSpawnCursor,Ln as hasForwardingHeaders,Aa as hasGcLogLatch,t as iconFromClientName,Tt as incrementCollabSocketFilteredError,P as incrementServerObserverFire,Ca as initContent,jt as initShadowRepo,K as initTelemetry,B as initToleranceTelemetryWriter,$e as installJsonSchemaDialect,Gr as installPrettyZodErrors,ir as installTestLoggers,S as installUserSkill,zr as isAllowedApiOrigin,Ve as isAllowedWorkspaceHostHeader,qe as isConfigDoc,at as isDefunctProcess,Q as isDocInConflict,ge as isHocuspocusAuthRejectionReason,Fe as isHomeDir,vt as isHostAdmitted,Ua as isKnownPackId,O as isLinkIndexExcludedDoc,Ut as isLockProcessRunning,ue as isLoopbackAddress,Lt as isManagedArtifactDoc,Yt as isMintedThreadId,ie as isOriginAdmitted,n as isOrphanMode,ke as isPairedWriteOrigin,Pi as isPathWithinDir,Se as isPeerAdmitted,cn as isProcessAlive,tn as isProjectRoot,hn as isReservedForUserTree,ft as isSelfWrite,g as isSystemDoc,er as isToleranceTelemetryEnabled,$i as isValidLockPid,li as lastKnownHash,Ri as listRescueCheckpoints,kr as listStarterPacks,En as loadCustomAgents,_i as loadPrincipal,Ki as lockAdvertisesUi,Vn as lockBaseUrl,Yr as lockFilePath,ra as loggerFactory,sa as loginShapedUserinfoUser,pi as logsCurrentPath,Hi as logsPreviousPath,Jn as makeLazyEmbeddingsKeyStore,cr as markServerLockDraining,wi as mountMcpAndApi,ni as normalizeFsPath,Sr as observeReadiness,hr as packageVersionMajorMinor,yn as parseAuthRejectionWire,ma as parseGitVersion,Pa as parseHocuspocusAuthToken,Pn as parseKeepaliveConnectionId,Da as pathToDocName,St as planSeed,M as prepareSingleFileOpen,xa as processCommand,kt as processUsage,W as readAgentBrowserTools,R as readAllTargets,Ze as readBundleDecision,Ur as readDeclaredGitHubHosts,b as readOriginGitHubRepo,Lr as readOwnNativeRules,ze as readProcessLock,Ge as readProcessLockDetailed,rt as readProcessState,X as readProjectHeadState,me as readProjectLocalSemanticConfig,Ne as readServerLock,gt as readServerPackageVersion,Va as readSkillInstallStateSnapshot,E as readStateManifest,Vt as readTargetRecordedAt,ce as readTargetVersion,Ft as reconcile,qt as recordContributor,ne as recordSkillInstallEvent,Ee as redactShareSubprocessStderr,ji as registerAllTools,be as registerWrite,on as releaseProcessLock,$t as releaseServerLock,fn as removeLastKnownHash,lt as removeProjectSkillGitignoreBlock,p as reportSkillInstall,$n as resetMetrics,Qi as resolveBuiltinSkillHosts,a as resolveBundleEnabled,ci as resolveBundledSkillDir,Li as resolveContentDir,Or as resolveCursorBinaryDefault,Tn as resolveCursorSpawnInvocation,gi as resolveEffectiveLinterConfig,Gi as resolveEmbeddingsCredential,Bn as resolveGitHubAccountFromUrl,Jr as resolveGitHubAuthHost,oa as resolveLockDir,qn as resolveNativeConfigForDoc,sr as resolveNativeMarkdownlintConfig,Ci as resolvePack,ti as resolvePackageVersion,xr as resolveSkillInstallReportSettings,mr as resolveUiInfo,vn as restoreContributors,pa as rewriteMarkdownLinksForDocumentRename,Na as rewriteWikiLinksForDocumentRename,Nn as runAuthReposSubprocess,Ea as runAuthStatusSubprocess,xt as runCloneSubprocess,j as runDeviceFlowSubprocess,ba as runWithMcpLogger,Ot as safeContentPath,U as safeSubdir,L as safetyCheckpoint,Xe as sameGitHubLogin,Hr as sanitizeClientName,y as saveInMemoryCheckpoint,Ir as saveVersion,Re as scanLockProcesses,We as seedBasenameIndex,nt as seedEphemeralProjectDir,Y as serializeError,pe as setActiveSpanAttributes,Me as setupServerObservers,ht as shadowGit,Ba as shutdownTelemetry,Nr as spansCurrentPath,An as spansPreviousPath,T as spawnDetached,Bt as splitMarkdownBlocks,se as startWatcher,Pt as strategiesFor,Kt as streamedChunkOf,te as streamingProblemEvent,Te as swapContributors,Ai as teardownToleranceTelemetryWriter,ye as toBroadcasterKey,an as tracedAppendFileSync,Qt as tracedLinkSync,dn as tracedMkdir,ct as tracedMkdirSync,f as tracedRename,nr as tracedRenameSync,ta as tracedRmSync,di as tracedRmdirSync,Bi as tracedUnlinkSync,jr as tracedWriteFile,On as tracedWriteFileSync,yi as trustSystemCertificates,Ji as updateLastKnownHash,Un as updateProcessLockPort,Zr as updateServerLockPort,la as validateAgentId,Xn as validateCloneInputs,ur as validateSkillZip,Ei as waitForServerLockDrain,ii as withHiddenWindowsConsole,wr as withSpan,_r as withSpanSync,xn as writeBundleDecision,ga as writeMarkdownlintRule,Ia as writeRootGitignoreForNewRepo,In as writeStateManifest,ka as writeTargetVersion,wt as writeTracker};
1
+ import{Ht as e,Io as t,Jo as n,Kl as r,La as i,Rs as a,Zn as o,su as s,wn as c,yn as l,zd as u}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{$ as d,$a as f,$i as p,$n as m,$o as h,$r as g,$t as _,A as v,Aa as y,Ai as b,An as x,Ar as S,At as C,B as w,Ba as T,Bi as E,Bn as D,Br as O,Bt as k,C as A,Ca as j,Ci as M,Cn as N,Cr as P,Ct as F,D as I,Da as L,Di as R,Dn as z,Dr as B,Dt as V,E as H,Ea as U,Ei as W,En as G,Er as K,Et as q,F as J,Fa as Y,Fi as X,Fn as Z,Fr as Q,Ft as $,G as ee,Ga as te,Gi as ne,Gn as re,Gr as ie,Gt as ae,H as oe,Ha as se,Hi as ce,Hn as le,Hr as ue,Ht as de,I as fe,Ia as pe,Ii as me,In as he,Ir as ge,It as _e,J as ve,Ja as ye,Ji as be,Jn as xe,Jr as Se,Jt as Ce,K as we,Ka as Te,Ki as Ee,Kn as De,Ko as Oe,Kr as ke,Kt as Ae,L as je,La as Me,Li as Ne,Ln as Pe,Lr as Fe,Lt as Ie,M as Le,Ma as Re,Mi as ze,Mn as Be,Mr as Ve,Mt as He,N as Ue,Na as We,Ni as Ge,Nn as Ke,Nr as qe,Nt as Je,O as Ye,Oa as Xe,Oi as Ze,On as Qe,Or as $e,Ot as et,P as tt,Pa as nt,Pi as rt,Pn as it,Pr as at,Pt as ot,Q as st,Qa as ct,Qi as lt,Qn as ut,Qo as dt,Qr as ft,Qt as pt,R as mt,Ra as ht,Ri as gt,Rn as _t,Rr as vt,Rt as yt,S as bt,Sa as xt,Si as St,Sn as Ct,So as wt,Sr as Tt,St as Et,T as Dt,Ta as Ot,Ti as kt,Tn as At,Tr as jt,Tt as Mt,U as Nt,Ua as Pt,Ui as Ft,Un as It,Ur as Lt,Ut as Rt,V as zt,Va as Bt,Vi as Vt,Vn as Ht,Vr as Ut,Vt as Wt,W as Gt,Wa as Kt,Wi as qt,Wn as Jt,Wr as Yt,Wt as Xt,X as Zt,Xa as Qt,Xi as $t,Xn as en,Xr as tn,Xt as nn,Y as rn,Ya as an,Yi as on,Yn as sn,Yr as cn,Yt as ln,Z as un,Za as dn,Zi as fn,Zn as pn,Zo as mn,Zr as hn,Zt as gn,_ as _n,_a as vn,_i as yn,_n as bn,_o as xn,_r as Sn,_t as Cn,a as wn,aa as Tn,ai as En,an as Dn,ao as On,ar as kn,as as An,at as jn,b as Mn,ba as Nn,bi as Pn,bn as Fn,bo as In,br as Ln,bt as Rn,c as zn,ca as Bn,ci as Vn,cn as Hn,co as Un,cr as Wn,ct as Gn,d as Kn,da as qn,di as Jn,dn as Yn,do as Xn,dr as Zn,dt as Qn,ea as $n,ei as er,en as tr,eo as nr,er as rr,es as ir,et as ar,f as or,fa as sr,fi as cr,fn as lr,fo as ur,fr as dr,ft as fr,g as pr,ga as mr,gi as hr,gn as gr,go as _r,gr as vr,gt as yr,h as br,ha as xr,hi as Sr,hn as Cr,ho as wr,hr as Tr,ht as Er,i as Dr,ia as Or,ii as kr,in as Ar,io as jr,ir as Mr,is as Nr,it as Pr,j as Fr,ja as Ir,ji as Lr,jn as Rr,jr as zr,jt as Br,k as Vr,ka as Hr,ki as Ur,kn as Wr,kr as Gr,kt as Kr,l as qr,la as Jr,li as Yr,ln as Xr,lo as Zr,lr as Qr,lt as $r,m as ei,ma as ti,mi as ni,mn as ri,mo as ii,mr as ai,mt as oi,n as si,na as ci,ni as li,nn as ui,no as di,nr as fi,ns as pi,nt as mi,o as hi,oa as gi,oi as _i,on as vi,oo as yi,or as bi,ot as xi,p as Si,pa as Ci,pi as wi,pn as Ti,po as Ei,pr as Di,pt as Oi,q as ki,qa as Ai,qi as ji,qn as Mi,qo as Ni,qr as Pi,qt as Fi,r as Ii,ra as Li,ri as Ri,rn as zi,ro as Bi,rr as Vi,rs as Hi,rt as Ui,s as Wi,sa as Gi,si as Ki,sn as qi,so as Ji,sr as Yi,st as Xi,t as Zi,ta as Qi,ti as $i,tn as ea,to as ta,tr as na,ts as ra,tt as ia,u as aa,ua as oa,ui as sa,un as ca,uo as la,ur as ua,ut as da,v as fa,va as pa,vi as ma,vn as ha,vo as ga,vr as _a,vt as va,w as ya,wa as ba,wi as xa,wn as Sa,wr as Ca,wt as wa,x as Ta,xa as Ea,xi as Da,xn as Oa,xo as ka,xr as Aa,xt as ja,y as Ma,ya as Na,yi as Pa,yn as Fa,yo as Ia,yr as La,yt as Ra,z as za,za as Ba,zi as Va,zn as Ha,zr as Ua,zt as Wa}from"./dist-Cmgb0r3p.mjs";export{Zi as AGENT_ID_MAX_LEN,si as AGENT_ID_RE,Ii as AGENT_WRITE_ORIGIN,Dr as AcpPermissionStore,wn as AcpRegistry,hi as AcpThreadManager,Wi as AgentFocusBroadcaster,zn as AgentPresenceBroadcaster,qr as AgentSessionCapacityError,aa as AgentSessionManager,Kn as AutoStartDisabledError,or as BUNDLE_IDS,Si as BUNDLE_SCOPE,ei as BUNDLE_SKILL_NAME,br as BacklinkIndex,pr as CC1Broadcaster,r as CC1_CONTRACT_VERSION,_n as CONCURRENT_REPLACE_WINDOW_MS,fa as CONFIG_FILENAME,Ma as CONFLICT_MARKER_RE,Mn as CURSOR_BUNDLE_PATHS_BY_PLATFORM,Ta as ConfigSchema,bt as ConflictAuthority,A as DEFAULT_CHECKPOINT_RETENTION,ya as DEFAULT_EMBEDDINGS_DIMENSIONS,Dt as DEFAULT_PACK_ID,H as DocumentDurabilityState,I as DocumentDurabilityStateError,Ye as EMBEDDINGS_API_KEY_ENV,Vr as EPHEMERAL_PROJECT_DIR_PREFIX,v as ExposureConsentError,Fr as FEATURED_AGENT_IDS,Le as FILE_SYSTEM_WRITER,Ue as FILE_WATCHER_ORIGIN,tt as FileEmbeddingsBackend,J as GIT_PREFLIGHT_FAIL_SPAN_NAME,fe as GIT_UPSTREAM_WRITER,Oe as GitDirAccessError,je as GitNotAvailableError,mt as GitTooOldError,za as HOCUSPOCUS_AUTH_REJECTION_REASONS,w as HocuspocusAuthRejection,zt as HocuspocusAuthTokenSchema,oe as HomeProjectRootError,Nt as INSTALLED_AGENTS_SCHEMES,Gt as JSON_SCHEMA_DIALECT_2020_12,e as LINEAGE_EPOCH_KEY,ee as LIVE_DERIVED_INDEX_DEBOUNCE_MS,we as MANAGED_RENAME_ORIGIN,ki as MAX_ACP_THREADS,ve as MAX_AGENT_SESSIONS,rn as MCP_CONNECTION_ID_HEADER,u as MCP_SERVER_NAME,Zt as MIN_EVICTABLE_IDLE_MS,un as MIN_GIT_VERSION,st as MISSING_OK_CONFIG_MESSAGE,Ni as MalformedGitPointerError,d as McpLogger,ar as MissingOkConfigError,ia as OBSERVER_SYNC_ORIGIN,mi as OK_OKIGNORE_TEMPLATE,Ui as ONBOARDING_BUNDLE_IDS,l as ORPHAN_MODES,c as PROTOCOL_VERSION,mn as PinoLogger,Pr as ProcessLockCollisionError,jn as ProjectGitInitError,xi as ROLLBACK_ORIGIN,Xi as ROOT_GITIGNORE_TEMPLATE,Gn as RUNTIME_VERSION,$r as SERVICE_WRITER,da as SKILL_INSTALL_EVENTS_FILE_REL,o as SKILL_STATE_TARGETS,Qn as STARTER_FOLDER_FRONTMATTER_FILENAME,fr as STARTER_PACKS,Oi as STARTER_PACK_IDS,oi as STATE_MANIFEST_FILENAME,Er as STATE_SCHEMA_VERSION,s as SYSTEM_DOC_NAME,yr as SeedPrerequisiteError,Cn as SeedRootDirError,va as ServerLockCollisionError,Ra as SingleFileNotAFileError,Rn as SingleFileNotFoundError,ja as SingleFileNotMarkdownError,Et as SingleFileProjectOverrideError,F as StateManifestError,wa as TagIndex,Mt as USER_GLOBAL_BUNDLE_IDS,q as __getShowAllWalkStatsForTesting,V as __resetShowAllWalkStatsForTesting,et as acpThreadStoreRoots,Kr as acpThreadsDir,C as acquireProcessLock,Br as acquireServerLock,He as applyAgentMarkdownWrite,Je as applyExternalChange,ot as applySeed,$ as assertCompatibleStateManifest,_e as assertGitAvailable,Ie as assertNeverDiskEvent,yt as assertNotHomeProjectRoot,Wa as attachAcpThreadSocket,k as attachCollabClientCounter,Wt as attachIdleShutdown,de as bindConflictAuthority,Rt as bootServer,Xt as buildAndOpenSkill,ae as buildConfigYmlContent,Ae as buildExecResult,Fi as buildIngressPolicy,Ce as buildOkMcpStdioCommand,ln as buildSkillZip,nn as buildStarterFolderFrontmatterYaml,gn as buildWipTree,pt as bundleSkillMdPath,_ as canonicalProjectKey,tr as canonicalizeForCompare,ea as classifyEvents,ui as classifyFsPath,zi as clearAllEmbeddingsKeys,Ar as coercePackId,Dn as collectServerHostSnapshot,i as colorFromSeed,vi as commitUpstreamImport,qi as commitWip,Hn as commitWipFromTree,Xr as compareSemver,ca as composeEffectiveLinterConfig,Yn as composeFrontmatterSchemasConfig,lr as containsConflictMarkers,Ti as contentHash,ri as contributorCount,Cr as countShadowObjects,gr as countStaleAgentWipRefs,bn as countWipRefs,ha as createApiExtension,Fa as createAssetServeMiddleware,Fn as createCollaborationHost,Oa as createContentFilter,Ct as createContentFilterAsync,N as createEmbeddingsSecretStore,Sa as createEphemeralProjectDir,At as createExternalChangeHandler,G as createFileLogger,z as createLiveDerivedIndexExtension,Qe as createMcpHttpHandler,Wr as createOsProbe,x as createPersistenceExtension,Rr as createProbeFailureReporter,Be as createServer,Ke as createServerObserverExtension,it as createServerProbeResolver,Z as createStreamingErrorWriter,dt as createTestLogger,he as describeStoredEmbeddingsKey,Pe as detectClaudeDesktopPresence,_t as detectGit,Ha as detectProjectShape,D as detectUserSkillHosts,Ht as discoverLockDirs,le as discoverMarkdownlintConfig,It as emitPreflightFailureSpan,Jt as encodeDocName,re as encodeFolderRoute,De as encodeSkillRoute,Mi as ensureProjectGit,xe as errorResponse,sn as evictStaleTrackerEntries,en as extractHeadings,pn as extractOkBinaryPath,ut as extractWikiLinksFromMarkdown,m as fallbackPaths,rr as findEnclosingGitRoot,na as findEnclosingProjectRoot,fi as findNativeMarkdownlintFile,Vi as flushFileLogger,Mr as formatAuditBrokenLinkSuppressionLine,kn as formatAuthRejectionWire,bi as formatContributorsFrom,Yi as formatPackRationale,Wn as gcCheckpointRefs,Qr as getCurrentMcpLogger,ua as getIngressContext,Zn as getLocalDir,dr as getLogFilePath,h as getLogger,Di as getLogsDir,ai as getMachineId,Tr as getMeter,vr as getMetrics,Sn as getTracer,_a as handleCollabSocketError,La as handleSpawnCursor,Ln as hasForwardingHeaders,Aa as hasGcLogLatch,t as iconFromClientName,Tt as incrementCollabSocketFilteredError,P as incrementServerObserverFire,Ca as initContent,jt as initShadowRepo,K as initTelemetry,B as initToleranceTelemetryWriter,$e as installJsonSchemaDialect,Gr as installPrettyZodErrors,ir as installTestLoggers,S as installUserSkill,zr as isAllowedApiOrigin,Ve as isAllowedWorkspaceHostHeader,qe as isConfigDoc,at as isDefunctProcess,Q as isDocInConflict,ge as isHocuspocusAuthRejectionReason,Fe as isHomeDir,vt as isHostAdmitted,Ua as isKnownPackId,O as isLinkIndexExcludedDoc,Ut as isLockProcessRunning,ue as isLoopbackAddress,Lt as isManagedArtifactDoc,Yt as isMintedThreadId,ie as isOriginAdmitted,n as isOrphanMode,ke as isPairedWriteOrigin,Pi as isPathWithinDir,Se as isPeerAdmitted,cn as isProcessAlive,tn as isProjectRoot,hn as isReservedForUserTree,ft as isSelfWrite,g as isSystemDoc,er as isToleranceTelemetryEnabled,$i as isValidLockPid,li as lastKnownHash,Ri as listRescueCheckpoints,kr as listStarterPacks,En as loadCustomAgents,_i as loadPrincipal,Ki as lockAdvertisesUi,Vn as lockBaseUrl,Yr as lockFilePath,ra as loggerFactory,sa as loginShapedUserinfoUser,pi as logsCurrentPath,Hi as logsPreviousPath,Jn as makeLazyEmbeddingsKeyStore,cr as markServerLockDraining,wi as mountMcpAndApi,ni as normalizeFsPath,Sr as observeReadiness,hr as packageVersionMajorMinor,yn as parseAuthRejectionWire,ma as parseGitVersion,Pa as parseHocuspocusAuthToken,Pn as parseKeepaliveConnectionId,Da as pathToDocName,St as planSeed,M as prepareSingleFileOpen,xa as processCommand,kt as processUsage,W as readAgentBrowserTools,R as readAllTargets,Ze as readBundleDecision,Ur as readDeclaredGitHubHosts,b as readOriginGitHubRepo,Lr as readOwnNativeRules,ze as readProcessLock,Ge as readProcessLockDetailed,rt as readProcessState,X as readProjectHeadState,me as readProjectLocalSemanticConfig,Ne as readServerLock,gt as readServerPackageVersion,Va as readSkillInstallStateSnapshot,E as readStateManifest,Vt as readTargetRecordedAt,ce as readTargetVersion,Ft as reconcile,qt as recordContributor,ne as recordSkillInstallEvent,Ee as redactShareSubprocessStderr,ji as registerAllTools,be as registerWrite,on as releaseProcessLock,$t as releaseServerLock,fn as removeLastKnownHash,lt as removeProjectSkillGitignoreBlock,p as reportSkillInstall,$n as resetMetrics,Qi as resolveBuiltinSkillHosts,a as resolveBundleEnabled,ci as resolveBundledSkillDir,Li as resolveContentDir,Or as resolveCursorBinaryDefault,Tn as resolveCursorSpawnInvocation,gi as resolveEffectiveLinterConfig,Gi as resolveEmbeddingsCredential,Bn as resolveGitHubAccountFromUrl,Jr as resolveGitHubAuthHost,oa as resolveLockDir,qn as resolveNativeConfigForDoc,sr as resolveNativeMarkdownlintConfig,Ci as resolvePack,ti as resolvePackageVersion,xr as resolveSkillInstallReportSettings,mr as resolveUiInfo,vn as restoreContributors,pa as rewriteMarkdownLinksForDocumentRename,Na as rewriteWikiLinksForDocumentRename,Nn as runAuthReposSubprocess,Ea as runAuthStatusSubprocess,xt as runCloneSubprocess,j as runDeviceFlowSubprocess,ba as runWithMcpLogger,Ot as safeContentPath,U as safeSubdir,L as safetyCheckpoint,Xe as sameGitHubLogin,Hr as sanitizeClientName,y as saveInMemoryCheckpoint,Ir as saveVersion,Re as scanLockProcesses,We as seedBasenameIndex,nt as seedEphemeralProjectDir,Y as serializeError,pe as setActiveSpanAttributes,Me as setupServerObservers,ht as shadowGit,Ba as shutdownTelemetry,Nr as spansCurrentPath,An as spansPreviousPath,T as spawnDetached,Bt as splitMarkdownBlocks,se as startWatcher,Pt as strategiesFor,Kt as streamedChunkOf,te as streamingProblemEvent,Te as swapContributors,Ai as teardownToleranceTelemetryWriter,ye as toBroadcasterKey,an as tracedAppendFileSync,Qt as tracedLinkSync,dn as tracedMkdir,ct as tracedMkdirSync,f as tracedRename,nr as tracedRenameSync,ta as tracedRmSync,di as tracedRmdirSync,Bi as tracedUnlinkSync,jr as tracedWriteFile,On as tracedWriteFileSync,yi as trustSystemCertificates,Ji as updateLastKnownHash,Un as updateProcessLockPort,Zr as updateServerLockPort,la as validateAgentId,Xn as validateCloneInputs,ur as validateSkillZip,Ei as waitForServerLockDrain,ii as withHiddenWindowsConsole,wr as withSpan,_r as withSpanSync,xn as writeBundleDecision,ga as writeMarkdownlintRule,Ia as writeRootGitignoreForNewRepo,In as writeStateManifest,ka as writeTargetVersion,wt as writeTracker};
package/dist/index.mjs CHANGED
@@ -1539,6 +1539,6 @@ GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){funct
1539
1539
  `);re(e,o)}function M9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=A9(JSON.parse(n),t),i=n.endsWith(`
1540
1540
  `)?`
1541
1541
  `:``;re(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=k9(n,t.contentDir);r!==n&&re(e,r)}}function N9(e,t){let n=S(e,`utf-8`),r=k9(n,t.contentDir);r!==n&&re(e,r)}function P9(e){try{return w(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>N(e,t.name))}catch{return[]}}const jje=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function F9(e){return/\.log\.\d+$/.test(e)}function Mje(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||F9(e)}const Nje=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function Pje(e){let t={contentDir:e.contentDir};for(let n of Nje)for(let r of P9(N(e.stagingDir,n)))Mje(r)?j9(r,t):r.endsWith(`.json`)?M9(r,t):N9(r,t);for(let n of P9(N(e.stagingDir,`state`))){let e=me(n);n.endsWith(`.jsonl`)?j9(n,t):jje.has(e)?M9(n,t):N9(n,t)}}const I9=[`.ok`,`local`,`telemetry`],L9=[`.ok`,`local`,`logs`],R9=[`.ok`,`local`,`loss-capture`],z9=`spans-current.jsonl`,B9=`spans-prev.jsonl`,V9=`server-current.jsonl`,H9=`server-prev.jsonl`,U9=`loss-current.jsonl`,W9=`loss-prev.jsonl`;function Fje(e){return N(e,...I9,z9)}function Ije(e){return N(e,...I9,B9)}function Lje(e){return N(e,...L9,V9)}function Rje(e){return N(e,...L9,H9)}function zje(e){return N(e,...R9,U9)}function Bje(e){return N(e,...R9,W9)}const G9=1e3;async function Vje(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function Hje(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}async function Uje(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(G9)});return t.ok?await t.text():null}catch{return null}}function Wje(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
1542
- `)}\n`:null}catch{return null}}function Gje(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],V6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Kje(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],V6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function qje(){return{nodeVersion:process.version,platform:le(),arch:ae()}}function Jje(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,tn.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function Yje(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return Yje(e.maxBytes)}function Xje(e){let t=J9(LX(`project`,e)),n=J9(LX(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function Zje(e){return Ne(`sha256`).update(e).digest(`hex`)}function Qje(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const $je=[`"doc.name"`,`"docName"`];function eMe(e){let t=S(e,`utf-8`),n=0;for(let e of $je){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(M(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,C7(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const tMe=new Set([`.jsonl`]);function nMe(e){let t=e.lastIndexOf(`.`);return t!==-1&&tMe.has(e.slice(t))}const rMe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function iMe(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&rMe.has(e.slice(t))}function aMe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!iMe(r))continue;let{redacted:i,patterns:a,lineCount:o}=NB(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return ye(e,t).split(xe).join(`/`)}async function oMe(e){let t=be(e.contentDir),n=be(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Vje,a=r.fetchAgentEffects??Hje,o=r.fetchWatcherRecent??Uje,s=r.readShadowHead??Gje,c=r.readCheckpointRefs??Kje,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.79.0-beta.4`),d=r.readDesktopEnv??K9,f=r.readLanguage??O9,p=r.readRuntime??qje,h=r.isOtlpPushEnabled??Jje,_=y(N(A(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(Fje(n),N(_,`telemetry`,z9)),Z9(Ije(n),N(_,`telemetry`,B9)),Z9(Lje(n),N(_,`logs`,V9)),Z9(Rje(n),N(_,`logs`,H9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,me(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,tR,me(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,N(_,`diagnostic-reports`,me(t)))&&(y+=1);let b=N(n,`.ok`,`local`),x=N(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,N(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(N(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(N(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=Wje(n);e!==null&&re(N(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(N(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(N(_,`state`,`checkpoint-refs.txt`),D),Z9(zje(n),N(_,`state`,U9)),Z9(Bje(n),N(_,`state`,W9)),Z9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(b,Hu),N(_,`state`,Hu)),Z9(N(b,Uu),N(_,`state`,Uu)),Z9(N(b,Vu),N(_,`state`,Vu));let ee=p(),ne=d(),ie=f(),ae={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=C===`running`?`running
1542
+ `)}\n`:null}catch{return null}}function Gje(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],V6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Kje(e){let t=N(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],V6({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function K9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function qje(){return{nodeVersion:process.version,platform:le(),arch:ae()}}function Jje(){return process.env.OTEL_SDK_DISABLED===`false`}function q9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function J9(e){if(!g(e))return{};let t;try{t=(0,tn.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!q9(t))return{};let n=t.telemetry;if(!q9(n))return{};let r=n.localSink;return q9(r)?r:{}}function Y9(e){return typeof e==`boolean`?e:void 0}function Yje(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function X9(e){if(q9(e))return Yje(e.maxBytes)}function Xje(e){let t=J9(LX(`project`,e)),n=J9(LX(`project-local`,e));return{enabled:Y9(n.enabled)??Y9(t.enabled)??!0,spansMaxBytes:X9(n.spans)??X9(t.spans)??52428800,logsMaxBytes:X9(n.logs)??X9(t.logs)??26214400}}function Zje(e){return Ne(`sha256`).update(e).digest(`hex`)}function Qje(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const $je=[`"doc.name"`,`"docName"`];function eMe(e){let t=S(e,`utf-8`),n=0;for(let e of $je){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(M(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,C7(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=N(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const tMe=new Set([`.jsonl`]);function nMe(e){let t=e.lastIndexOf(`.`);return t!==-1&&tMe.has(e.slice(t))}const rMe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function iMe(e){if(F9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&rMe.has(e.slice(t))}function aMe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!iMe(r))continue;let{redacted:i,patterns:a,lineCount:o}=NB(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return ye(e,t).split(xe).join(`/`)}async function oMe(e){let t=be(e.contentDir),n=be(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??Vje,a=r.fetchAgentEffects??Hje,o=r.fetchWatcherRecent??Uje,s=r.readShadowHead??Gje,c=r.readCheckpointRefs??Kje,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.79.0-beta.6`),d=r.readDesktopEnv??K9,f=r.readLanguage??O9,p=r.readRuntime??qje,h=r.isOtlpPushEnabled??Jje,_=y(N(A(),`ok-bundle-`));try{v(N(_,`telemetry`),{recursive:!0}),v(N(_,`logs`),{recursive:!0}),v(N(_,`state`),{recursive:!0}),Z9(Fje(n),N(_,`telemetry`,z9)),Z9(Ije(n),N(_,`telemetry`,B9)),Z9(Lje(n),N(_,`logs`,V9)),Z9(Rje(n),N(_,`logs`,H9));for(let t of e.userLogFiles??[])Z9(t,N(_,`logs`,me(t)));for(let t of e.userStateFiles??[])Z9(t,N(_,tR,me(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,N(_,`diagnostic-reports`,me(t)))&&(y+=1);let b=N(n,`.ok`,`local`),x=N(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,N(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(N(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(N(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=Wje(n);e!==null&&re(N(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(N(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(N(_,`state`,`checkpoint-refs.txt`),D),Z9(zje(n),N(_,`state`,U9)),Z9(Bje(n),N(_,`state`,W9)),Z9(N(b,`last-spawn-error.log`),N(_,`state`,`last-spawn-error.log`)),Z9(N(b,Hu),N(_,`state`,Hu)),Z9(N(b,Uu),N(_,`state`,Uu)),Z9(N(b,Vu),N(_,`state`,Vu));let ee=p(),ne=d(),ie=f(),ae={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(N(_,`state`,`runtime.json`),`${JSON.stringify(ae,null,2)}\n`);let oe=C===`running`?`running
1543
1543
  `:`not-running (${w})\n`;re(N(_,`state`,`server-status.txt`),oe);let se=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:S7(e.diagnosticReports,y);if(re(N(_,`state`,`diagnostic-reports-status.txt`),`${se}\n`),e.processDir&&g(e.processDir)){let t=N(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let k=e.redact===!0;k&&Pje({stagingDir:_,contentDir:t}),e.note&&re(N(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=aMe(_));for(let t of e.extraFiles??[]){let e=t.zipName??me(t.sourcePath);if(!Z9(t.sourcePath,N(_,`extra`,e))){r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=T7(t,`extra/${e}`);n!==null&&(ce??={redactions:[],redactedLineCount:0},ce.redactions.push(n),ce.redactedLineCount+=n.lineCount)}let le=Xje(n),ue=Q9(_),A=[],j=0,de=0;for(let e of ue){let t=$9(_,e),n=te(e).size,r=nMe(t)?Qje(e):0;A.push({path:t,bytes:n,lines:r}),j+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=eMe(e))}let fe={applied:k};ce!==null&&(fe.secretScrub=ce);let pe={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie},contentDir:{pathSha256:Zje(t),absolutePath:k?`<CONTENT_DIR>`:t},telemetry:{localSink:le,otlpPushEnabled:h()},redaction:fe,serverStatus:C,files:A};re(N(_,`manifest.json`),`${JSON.stringify(pe,null,2)}\n`);let M=ue.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),he={stagedDiagnosticReports:y,totalBytes:j,fileCount:A.length,docNameCount:de,contentDirVisible:M,redacted:k},ge=!1;return{stagingDir:_,manifest:pe,summary:he,cleanup:()=>{ge||(ge=!0,O(_,{recursive:!0,force:!0}))}}}catch(e){throw O(_,{recursive:!0,force:!0}),e}}async function sMe(e){let{collected:t,outputPath:n}=e,r=M(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new cwe.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function cMe(e,t){let n=N(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,tn.parse)(S(n,`utf-8`)),r=W8(t)?t.content:void 0,i=W8(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return be(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return be(e)}async function lMe(e,t,n,r,i){let a=E7(t,e.logger),o=await oMe({contentDir:cMe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...yAe(a,e.userLogsDir??N(k(),`.ok`,`logs`)),...O7(e.cachesDir??N(k(),`Library`,`Caches`))],userStateFiles:k7(e.bugReportsDir??w7()),diagnosticReports:i,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(M(e.outputPath),{recursive:!0}),await sMe({collected:o,outputPath:e.outputPath});let t=o.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:a,files:o.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:o.manifest.createdAt}}}finally{o.cleanup()}}async function uMe(e){let{projectDir:t}=e,n=e.readDesktopEnv??K9,r=e.readLanguage??O9,i=()=>mAe(e.diagnosticReportsDir??N(k(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return lMe(e,t,n,r,i());let{zipPath:a,summary:o}=await wAe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:O7(e.cachesDir??N(k(),`Library`,`Caches`)),bugReportLedgerFiles:k7(e.bugReportsDir??w7()),diagnosticReports:e.level===`full`?i():void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}export{Z8 as ALL_EDITOR_IDS,Q8 as EDITOR_LABELS,O5 as EDITOR_TARGETS,FOe as HOSTS_WITH_USER_SKILL_DIR,eAe as LAUNCH_CONFIG_NAME,pje as PATH_SHIM_BEGIN,hje as PATH_SHIM_BLOCK_RE,mje as PATH_SHIM_END,F5 as ProjectPathSafetyError,Mke as addOkPathsToGitExclude,I5 as assertProjectPathSafe,u5 as buildManagedServerEntry,rje as buildMcpConfigDeclineEvent,ije as buildMcpConfigMigrateEvent,y7 as classifyExistingMcpEntry,uMe as collectReportBundle,bje as createCliProbeResolver,on as createTokenStore,gAe as defaultBugReportZipPath,We as detectGh,qe as detectGhAccounts,iAe as detectInstalledEditors,y5 as droppedManagedKeys,nke as editorConfigPathDisplay,tke as editorEntryLocator,KAe as ensurePiBridge,Z5 as formatTrackedRemediation,Fke as getExcludedOkPaths,Y5 as getInstalledSkillProjectionPaths,POe as getNativeTomlMcpEditor,J5 as getOkArtifactPaths,c5 as isEntryUpToDate,d5 as isOwnManagedEntry,uje as loadConfig,bee as makeLazyProbeTokenStore,w7 as okBugReportsDir,b9 as parseGitHubBlobUrl,dje as parseGitHubShareUrl,x9 as parseGitHubTreeUrl,y9 as parseGitUrl,gje as pathInstallMarkerPath,_ke as previewContent,aAe as probeOwnManagedEditorMcpEntry,WAe as probePiBridgeState,X5 as probeTrackedOkPaths,_7 as readExistingMcpEntry,Pke as readSharingMode,NB as redactContent,Nke as removeOkPathsFromGitExclude,$Ae as removeOwnMcpEntry,kke as removeProjectSkill,Sje as removeUserGlobalSkillBundle,Oje as removeUserSkill,Cke as resolveProjectRoot,sje as runStop,h9 as truncatePriorEntry,E9 as userGlobalSkillBundleTargets,Dje as userSkillPresentAnywhere,fje as validateLocalFolderForShare,g7 as writeEditorMcpConfig,Tje as writeProjectAiIntegrations,H5 as writeProjectSkill,rAe as writeUserMcpConfigs,Eje as writeUserSkill};
1544
1544
  //# sourceMappingURL=index.mjs.map
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{$l as r,Ft as i,Gd as a,Gl as o,Jd as s,Kd as c,Qu as l,Uu as u,Xd as d,Zd as f,ef as p,qu as m,ru as h,sc as g,tf as _,xs as v,ys as y,zd as b}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{$i as x,Ao as S,Ar as ee,Bn as te,H as ne,L as re,Lr as ie,Mo as ae,No as oe,Po as se,Qi as ce,R as le,Ro as C,Tt as ue,Wo as de,Xo as fe,Xr as pe,_o as me,at as he,en as ge,ha as _e,jo as ve,m as ye,mo as be,na as xe,qn as Se,rt as Ce,wr as we,yo as Te}from"./dist-BGAj9i2M.mjs";import{i as w,n as T,o as E,r as D,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as Ee}from"./constants-DGKD-mBU.mjs";import{t as De}from"./preview-Dl0Pict5.mjs";import{createRequire as Oe}from"node:module";import{execFileSync as ke}from"node:child_process";import Ae,{basename as je,dirname as j,isAbsolute as Me,join as M,posix as Ne,relative as N,resolve as P,sep as F,win32 as Pe}from"node:path";import I from"node:process";import{fileURLToPath as Fe}from"node:url";import{cpSync as Ie,existsSync as L,lstatSync as Le,mkdirSync as Re,readFileSync as R,readdirSync as ze,readlinkSync as Be,realpathSync as Ve,rmSync as He,statSync as Ue,writeFileSync as We}from"node:fs";import{homedir as z}from"node:os";import{inspect as Ge,stripVTControlCharacters as Ke,styleText as B}from"node:util";import*as qe from"node:readline";import{AsyncLocalStorage as Je,AsyncResource as Ye}from"node:async_hooks";var Xe=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})),Ze=n((e=>{let{InvalidArgumentError:t}=Xe();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}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})),Qe=n((e=>{let{humanReadableArgName:t}=Ze();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"./rolldown-runtime-tZXQYakl.mjs";import{$l as r,Ft as i,Gd as a,Gl as o,Jd as s,Kd as c,Qu as l,Uu as u,Xd as d,Zd as f,ef as p,qu as m,ru as h,sc as g,tf as _,xs as v,ys as y,zd as b}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{$i as x,Ao as S,Ar as ee,Bn as te,H as ne,L as re,Lr as ie,Mo as ae,No as oe,Po as se,Qi as ce,R as le,Ro as C,Tt as ue,Wo as de,Xo as fe,Xr as pe,_o as me,at as he,en as ge,ha as _e,jo as ve,m as ye,mo as be,na as xe,qn as Se,rt as Ce,wr as we,yo as Te}from"./dist-Cmgb0r3p.mjs";import{i as w,n as T,o as E,r as D,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as Ee}from"./constants-BFY9H31K.mjs";import{t as De}from"./preview-CkmKb3M6.mjs";import{createRequire as Oe}from"node:module";import{execFileSync as ke}from"node:child_process";import Ae,{basename as je,dirname as j,isAbsolute as Me,join as M,posix as Ne,relative as N,resolve as P,sep as F,win32 as Pe}from"node:path";import I from"node:process";import{fileURLToPath as Fe}from"node:url";import{cpSync as Ie,existsSync as L,lstatSync as Le,mkdirSync as Re,readFileSync as R,readdirSync as ze,readlinkSync as Be,realpathSync as Ve,rmSync as He,statSync as Ue,writeFileSync as We}from"node:fs";import{homedir as z}from"node:os";import{inspect as Ge,stripVTControlCharacters as Ke,styleText as B}from"node:util";import*as qe from"node:readline";import{AsyncLocalStorage as Je,AsyncResource as Ye}from"node:async_hooks";var Xe=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})),Ze=n((e=>{let{InvalidArgumentError:t}=Xe();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}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})),Qe=n((e=>{let{humanReadableArgName:t}=Ze();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}=Xe();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&&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}
@@ -689,5 +689,5 @@ export default function okBridge(pi: {
689
689
  `));let g=`${s?``:``}${m}`;return g!==o&&C(e,g,{mode:Ca(e)}),a&&g===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const _o=e=>e!==`project`,vo=e=>e!==`user`;async function yo(){let e=await Ma({message:`Where should the MCP server be configured?
690
690
  `,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function bo(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??yo)():`both`}async function xo(e){return La({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:"OK config stays on this machine only; teammates do not see it. Safe escape hatch via `ok config-sharing share`."}]})}async function So(e){if(e.sharing!==void 0)return e.sharing;let t=Ki(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??xo)(t):t}var Co=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}};function wo(e){if(e===void 0||e===!0)return new Set(Ce);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(ue.filter(e=>t.includes(e)))}function To(e,t,n){let r=P(n,e),i;try{i=Ue(r)}catch(e){let t=e.code;throw t===`ENOENT`?new Co(`--content-dir path does not exist: ${r}`):new Co(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new Co(`--content-dir must be a directory: ${r}`);let a=Eo(t),o=Eo(r),s=N(a,o);if(s.startsWith(`..`)||Me(s))throw new Co(`--content-dir must be inside the project root (${t}); got ${r}`);return s===``?`.`:s}function Eo(e){try{return Ve(e)}catch{return e}}const Do=`open-knowledge-ui`;function Oo(e,t,n){try{let r=e.detectPath?.(t,n)??j(e.configPath(t,n));return L(r)}catch{return!1}}function ko(e,t,n){try{let r=P(j(e.configPath(t,n))),i=P(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+F)}catch{return!1}}function Ao(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!L(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||ko(e,t,r);if(!i&&c&&!Oo(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{oa(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Mo(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||Re(j(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{de(`${o}.lock`,()=>{let t=Xa(o).writePath;if(s||Re(j(t),{recursive:!0}),e.format===`toml`){let r=po(Hr(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=go(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=fo(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const jo={pi:Ha};function Mo(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=jo[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{Re(j(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{de(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}C(t,c,e===null?void 0:{mode:Ca(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function No(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function Po(e){let t=zi(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>Ao(t,``,n,e.home))}function Fo(e,t,n,r){let i=Lo(e,t,n,r);return i.kind===`present`?i.entry:null}function Io(e,t,n,r){let i=uo(e,t,r);if(!A(i))return{kind:`no-entry`};let a=i[n];return A(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function Lo(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};try{if(Ue(i).size>io)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:ya(e)}}let a;try{a=R(i,`utf-8`)}catch(e){return{kind:`decline`,reason:ya(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Va(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=Hr().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return Io(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,kr.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:Io(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=$a(a);return s?eo(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:Io(ve(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function Ro(e={}){let t=P(e.cwd??process.cwd()),n=Ga(t,{homeDir:e.home}),r=n.projectRoot;if(ie(r,e.home??z()))throw new ne(r);let i=!L(M(r,`.ok`)),a=n.gitRootPromoted?N(r,t):void 0,o=e.contentDir===void 0?n.defaultContentDir:To(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&o===`.`&&process.stderr.write(`${O(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`ok init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let s={mode:e.devMcp?`dev`:`published`},c=await Se(r),l;try{l=we(r,{contentDir:o})}catch(t){let i=$.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:c.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let u=l.created.includes(Ee),d=!1;if(c.didInit)try{d=Te(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{ce(r)===`removed`&&console.warn(`[ok] Removed the OpenKnowledge project-skill lines from .gitignore. The skill is ordinary project content now — commit it if your team wants it on clone.`)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore cleanup at ${r}: ${e instanceof Error?e.message:String(e)}`)}let f=await bo({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),p=e.editors??Wo(r,e.home),m=e.editors??p,g=zi(p),_=zi(m),v=e.mcp===!1||f===null,y=Array.from(new Map([...g,...v?[]:_].map(e=>[e.id,e])).values()),b=g.filter(t=>Oo(t,r,e.home)),S=[],re=[],ae=new Set;for(let t of y){if(v){let n=``;try{n=t.configPath(r,e.home)}catch{}S.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(_o(f)&&g.includes(t)&&t.scope===`global`&&S.push(Ao(t,r,s,e.home)),vo(f)&&_.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Ao(t,r,s,e.home,n);S.push(i),(i.action===`written`||i.action===`overwritten`)&&ae.add(n)}}let oe=new Set;for(let t of _){let n=t.projectSkillPath?.(r);!n||oe.has(n)||(oe.add(n),re.push(_a(t,r,{home:e.home})))}let se=ga(r,_.map(e=>e.id));se&&re.push(se);let le=re.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(le.length>0){let t=e.home??z();x({source:h,skills:[ye.project],agents:le,scope:r},{home:t,enabled:_e(t).enabled})}let C=!v&&f!==null&&vo(f)?_.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,de=v?[]:b.map(e=>No(e,r)).filter(e=>e!==void 0).filter(e=>!ae.has(e.path)),fe=e.installUserSkill??ee,pe=e.home??z(),he=wo(e.skills),ge=!1,ve=!1,be=!1,xe=!1,Ce=!1;for(let t of ue){if(!he.has(t))continue;await me(pe,ye[t],!0).catch(()=>{}),ge=!0;let n=await fe({home:e.home,bundleId:t,force:!0});n===`installed`?ve=!0:n===`failed`?be=!0:n===`no-hosts`?Ce=!0:xe=!0}let w=be?`failed`:ve?`installed`:ge&&xe?`skip-current`:ge&&Ce?`no-hosts`:`declined`,T=ve?te(pe).map(e=>e.editorId):[],E=v?`skipped-flag`:`skipped-missing`,D=S.find(e=>e.editorId===`claude`)??S[0]??{action:E,configPath:$.claude.configPath(r,e.home)},k=await zo({projectRoot:r,desiredMode:await So({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:l.created,contentUpdated:l.updated,contentSkipped:l.skipped,editors:S,projectSkills:re,legacyProjectConfigs:de,skillInstall:w,skillHosts:T,didGitInit:c.didInit,rootGitignoreCreated:d,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:u?o:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:D.action,mcpPath:D.configPath,mcpError:`error`in D?D.error:void 0,projectScopeUnsupportedLabels:C,sharing:k}}async function zo(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=Ki(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=Hi(t);if(n===`local-only`){let e=Wi(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:Bo(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=Gi(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:Bo(t,o,`remove`)}function Bo(e,t,n){let r=Ki(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:t.removed.length>0?`cleaned`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:t.removed}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function Vo(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions`;case`unresolved-symlink`:return`could not resolve the path or symlink; check permissions and symlink cycles`;case`not-a-file`:return`config path is not a regular file`;case`disappeared`:return`config disappeared while being read; retry to check its current state`;case`unreadable`:return`could not read the config file; check that the path is accessible`;case`unparseable`:return`config could not be parsed`;case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;case void 0:return`config not readable`;default:throw Error(`unhandled MCP decline reason: ${e}`)}}function Ho(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let s=M(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(k(`Content scaffolded at ${s}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(k(`Content already present at ${s}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0){if(n.push(k(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`)}else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(k(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(k(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===`open-knowledge`?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${E(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${E(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${D(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${Vo(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(k(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${E(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${E(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${D(`FAILED`)}: ${r.error}`)}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${N(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(k(`User-global skill:`)),e.skillInstall){case`installed`:{let t=(e.skillHosts??[]).map(e=>X[e]??e),r=t.length>0?t.join(`, `):`the shared ~/.agents store`;n.push(` open-knowledge ${E(`installed for ${r}`)}`),n.push(` ${T(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${T(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`);break}case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`declined`:n.push(` open-knowledge ${T(`skipped for this run (--no-skills)`)}`),n.push(` ${T(`Nothing was installed or removed. Any built-in skills already on this`)}`),n.push(` ${T(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${T(` ok init`)}`);break;case`no-hosts`:n.push(` open-knowledge ${T(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${O(`open-knowledge install failed — MCP still configured; retry with:`)}`),n.push(` ${O(` ok repair-skills`)}`)}if(e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(O(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(O(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`ok init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(" To scope to just that sub-folder, re-run `ok init --content-dir .` from there, or set"),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(De(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...qo(e.sharing,t)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${E(`✓`)} ${k(`Next steps:`)}`),n.push(` 1. Open your editor (${w(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${w(`ok seed --list-packs`)} — browse the starter packs`),n.push(` - ${w(`ok seed`)} — scaffold an empty repo`),n.push(` 4. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}return n.join(`
691
691
  `)}function Uo(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function Wo(e,t){let n=[];for(let r of Wr)r!==`claude-desktop`&&Oo($[r],e,t)&&n.push(r);return n}function Go(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:Ge(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function Ko(){return new lt(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new dt(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new dt(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new dt(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd(),n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?Go():null;try{let r;try{r=await Ro({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof Co||e instanceof ne){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof re||e instanceof le){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof he){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
692
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-s6q3kh95.mjs`),{resolveContentDir:s}=await import(`./dist-CFc5ttOT.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-Dqsl68Ly.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Uo(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Ho(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function qo(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${E(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${E(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${E(`local-only`)} — already excluded; nothing to do.`):n.push(` ${E(`local-only`)}`):e.action===`removed`?n.push(` ${E(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${E(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
692
+ `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-B4ZOsV9p.mjs`),{resolveContentDir:s}=await import(`./dist-DzdGKL8W.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-CeOwiTVJ.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(Uo(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${Ho(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function qo(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${E(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${E(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${E(`local-only`)} — already excluded; nothing to do.`):n.push(` ${E(`local-only`)}`):e.action===`removed`?n.push(` ${E(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${E(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
693
693
  `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${w(`ok config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(O(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${w(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${w(`ok config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(O(`Sharing mode unavailable: ${e.reason}.`));return n}}export{yi as $,wa as A,Wi as B,Ga as C,lt as Ct,Ma as D,La as E,oa as F,Ji as G,qi as H,sa as I,Wr as J,Ki as K,va as L,ya as M,aa as N,Ca as O,la as P,Z as Q,ua as R,Xa as S,bt as St,Ba as T,dt as Tt,Ui as U,Qi as V,Hi as W,$ as X,X as Y,Gr as Z,Ro as _,Vn as _t,Uo as a,Si as at,Po as b,Kt as bt,Ho as c,Pi as ct,Oo as d,Hr as dt,vi as et,Fo as f,Y as ft,So as g,Qn as gt,To as h,Pr as ht,zo as i,ii as it,ba as j,Sa as k,qo as l,ci as lt,bo as m,jr as mt,Do as n,xi as nt,Lo as o,Q as ot,wo as p,Mr as pt,Gi as q,jo as r,ti as rt,Wo as s,Ci as st,Co as t,bi as tt,Ko as u,Ur as ut,co as v,Xt as vt,Ha as w,st as wt,ko as x,U as xt,Ao as y,qt as yt,_a as z};
@@ -0,0 +1 @@
1
+ import"./dist-Cmgb0r3p.mjs";import{_ as e}from"./init-06Lf5_Em.mjs";export{e as runInit};
@@ -1 +1 @@
1
- import{Po as e,Ro as t,jo as n}from"./dist-BGAj9i2M.mjs";import{A as r,M as i,O as a}from"./init-Ckl8TtgW.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-BNuJNxLA.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:i(e)}}let g=[],_=e(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=n(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=r(h,[`configurations`,y]);return x?(t(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
1
+ import{Po as e,Ro as t,jo as n}from"./dist-Cmgb0r3p.mjs";import{A as r,M as i,O as a}from"./init-06Lf5_Em.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-BebBssVX.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:i(e)}}let g=[],_=e(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=n(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=r(h,[`configurations`,y]);return x?(t(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./loader-CO47qD8D.mjs";export{e as loadConfig};
@@ -1 +1 @@
1
- import{Ml as e,Uu as t,ao as n,bl as r,fl as i,ls as a,ul as o}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{Bo as s,Ho as c,x as l}from"./dist-BGAj9i2M.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-DGKD-mBU.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=t();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return u(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=r({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...i,source:e}}return i})}function b(t){let r=t??process.cwd(),u=[],p=[],m=[],h=[],g=c(`user`,r),_=s({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(t,r=!1)=>{let i=v(t);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let a=o({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...a),u.push(t);let s=a.length>0?e(i.value):i.value;return r&&h.push(...n({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(r,`.ok`,d),S=b(x,!0),C=b(c(`project-local`,r)),w=a(_.value,S,C),T=l.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(i(t))}return{config:T.data,sources:u,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
1
+ import{Ml as e,Uu as t,ao as n,bl as r,fl as i,ls as a,ul as o}from"./md-manager-BGnqyqi1-BWyJhS5F.mjs";import{Bo as s,Ho as c,x as l}from"./dist-Cmgb0r3p.mjs";import{t as u}from"./is-object-BGze3w87.mjs";import{t as d}from"./constants-BFY9H31K.mjs";import{resolve as f}from"node:path";import{existsSync as p,readFileSync as m}from"node:fs";import{realpath as h}from"node:fs/promises";var g=t();async function _(e){let t=f(e);try{return await h(t)}catch(e){if(e.code!==`ENOENT`){let n=e instanceof Error?e.message:String(e);console.warn(`[normalize-cwd] realpath failed for ${t}: ${n}`)}return t}}function v(e){if(!p(e))return{value:null,path:e,source:null,doc:null};let t;try{t=m(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,g.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return u(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function y(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),i={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=r({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...i,source:e}}return i})}function b(t){let r=t??process.cwd(),u=[],p=[],m=[],h=[],g=c(`user`,r),_=s({absPath:g});p.push(..._.diagnostics),!_.valid&&_.sidelinedTo!==void 0&&m.push({from:g,to:_.sidelinedTo}),_.valid&&_.source!==void 0&&u.push(g);let b=(t,r=!1)=>{let i=v(t);if(i.diagnostic!==void 0&&p.push(i.diagnostic),i.value===null)return{};let a=o({value:i.value,file:i.path,source:i.source,doc:i.doc});p.push(...a),u.push(t);let s=a.length>0?e(i.value):i.value;return r&&h.push(...n({value:s,file:i.path,source:i.source,doc:i.doc})),s},x=f(r,`.ok`,d),S=b(x,!0),C=b(c(`project-local`,r)),w=a(_.value,S,C),T=l.safeParse(w);if(!T.success){let e=v(x),t={code:`SCHEMA_INVALID`,issues:y(T.error.issues,e)};throw Error(i(t))}return{config:T.data,sources:u,diagnostics:p,sidelined:m,ignoredCommittedKeys:h}}function x(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=_(e.startupCwd);return async o=>{let s=await _(o??e.startupCwd),c=Date.now(),l=r.get(s);if(l&&l.expiresAt>c)return l.config;let u=i.get(s);if(u)return await u;let d=(async()=>{if(s===await a)return r.set(s,{config:e.startupConfig,expiresAt:Date.now()+t}),e.startupConfig;let i=n(s).config;return r.set(s,{config:i,expiresAt:Date.now()+t}),i})();i.set(s,d);try{return await d}finally{i.delete(s)}}}export{b as n,x as t};
@@ -1 +1 @@
1
- import{mo as e}from"./dist-BGAj9i2M.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}let s=process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,c=process.platform===`win32`?[`/c`,`start`,``,a]:[a];t(s,c,e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
1
+ import{mo as e}from"./dist-Cmgb0r3p.mjs";import{execFile as t}from"node:child_process";const n=new Set([`http:`,`https:`]),r=/[\u0000-\u0020\u007F-\u009F"'`\\&|<>^()$;{}[\]*?!~]/;function i(e,t){console.warn(`Could not auto-open browser (${t}); visit ${e} manually`)}function a(a){let o;try{o=new URL(a)}catch{i(a,`invalid URL`);return}if(!n.has(o.protocol)){i(a,`unsupported scheme '${o.protocol}'`);return}if(r.test(a)){i(a,`URL contains unsafe characters`);return}let s=process.platform===`darwin`?`open`:process.platform===`win32`?`cmd`:`xdg-open`,c=process.platform===`win32`?[`/c`,`start`,``,a]:[a];t(s,c,e({}),e=>{e&&console.warn(`Could not auto-open browser (${e.message}); visit ${a} manually`)})}export{a as openBrowser};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./preview-CkmKb3M6.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1,2 +1,2 @@
1
- import{xn as e}from"./dist-BGAj9i2M.mjs";import"./constants-DGKD-mBU.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);a.push(``);let c=t(i,`.ok`,`config.yml`);return r(c)?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
1
+ import{xn as e}from"./dist-Cmgb0r3p.mjs";import"./constants-BFY9H31K.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);a.push(``);let c=t(i,`.ok`,`config.yml`);return r(c)?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
2
2
  `)}export{c as n,l as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,i as r}from"./DocumentContext-Cp-NsV6p.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-HKX9wT1K.js";import{i as l,n as u,t as d}from"./tooltip-DVBVVaAs.js";import{n as f}from"./dist-CJhtNlOm2.js";import{t as p}from"./dist-Cr4-nBVI.js";import{m}from"./Mermaid-DP2in8wt.js";import{t as h}from"./circle-alert-Czw40trT.js";import{i as g}from"./prop-types-CLE_x_KL.js";import{t as _}from"./spinner-D7ppCG-D.js";import{t as v}from"./undo-2--eop4_Wq.js";import{f as y}from"./doc-paths-BHMHTMzR.js";import{s as b}from"./navigation-targets-BYkbsVHW.js";import{a as x,c as S,i as C,o as w,s as T,t as E}from"./dialog-Q2r_wm4I.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-DItmUDIK.js";import{t as j}from"./timeline-diff-store-DzEGunqQ.js";import{n as M}from"./use-activity-panel-Di2c9gC0.js";var N=s(),P=e(i(),1),F=t();function te(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function I(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:f,onOpenDiff:p,onRestore:m}=e,{_:h}=o(),[g,y]=(0,P.useState)(ne),b,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{let e=setInterval(()=>y(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=b,t[1]=O):(b=t[0],O=t[1]),(0,P.useEffect)(b,O);let[k,A]=(0,P.useState)(!1),ee=D(),j=n.stackIndex+1,M=ee?.docName===r&&ee.keptCount===j,I=i-j,re=!s||f||I<=0,ie;t[2]!==I||t[3]!==m?(ie=function(){A(!1),m(I)},t[2]=I,t[3]=m,t[4]=ie):ie=t[4];let ae=ie,L;t[5]!==n||t[6]!==p?(L=()=>p(n),t[5]=n,t[6]=p,t[7]=L):L=t[7];let R;t[8]!==h||t[9]!==j||t[10]!==r?(R=h({id:`Z79bnE`,values:{burstNumber:j,docName:r}}),t[8]=h,t[9]=j,t[10]=r,t[11]=R):R=t[11];let oe=M?`bg-muted`:`hover:bg-muted/40`,se;t[12]===oe?se=t[13]:(se=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,oe],t[12]=oe,t[13]=se);let ce=se.join(` `),z;t[14]!==n.ts||t[15]!==g?(z=te(n.ts,g),t[14]=n.ts,t[15]=g,t[16]=z):z=t[16];let B;t[17]===z?B=t[18]:(B=(0,F.jsx)(`span`,{className:`font-mono`,children:z}),t[17]=z,t[18]=B);let V;t[19]===n.additions?V=t[20]:(V=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=V);let H;t[21]===n.deletions?H=t[22]:(H=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=H);let U;t[23]!==V||t[24]!==H?(U=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[V,` `,H]}),t[23]=V,t[24]=H,t[25]=U):U=t[25];let W;t[26]!==M||t[27]!==B||t[28]!==U||t[29]!==L||t[30]!==R||t[31]!==ce?(W=(0,F.jsxs)(`button`,{type:`button`,onClick:L,"aria-pressed":M,"aria-label":R,"data-testid":`activity-panel-burst-open`,className:ce,children:[B,U]}),t[26]=M,t[27]=B,t[28]=U,t[29]=L,t[30]=R,t[31]=ce,t[32]=W):W=t[32];let le;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=le):le=t[33];let G;t[34]!==h||t[35]!==j||t[36]!==r?(G=h({id:`Zhe80e`,values:{burstNumber:j,docName:r}}),t[34]=h,t[35]=j,t[36]=r,t[37]=G):G=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>A(!0),t[38]=ue):ue=t[38];let K;t[39]===f?K=t[40]:(K=f?(0,F.jsx)(_,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(v,{className:`size-3`,"aria-hidden":`true`}),t[39]=f,t[40]=K);let q;t[41]!==re||t[42]!==G||t[43]!==K?(q=(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":G,disabled:re,onClick:ue,children:K})}),t[41]=re,t[42]=G,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==h||t[46]!==I||t[47]!==s?(J=h(s?I>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=h,t[46]=I,t[47]=s,t[48]=J):J=t[48];let Y;t[49]===J?Y=t[50]:(Y=(0,F.jsx)(u,{side:`left`,children:J}),t[49]=J,t[50]=Y);let X;t[51]!==q||t[52]!==Y?(X=(0,F.jsxs)(d,{children:[q,Y]}),t[51]=q,t[52]=Y,t[53]=X):X=t[53];let Z;t[54]!==W||t[55]!==X?(Z=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[W,le,X]}),t[54]=W,t[55]=X,t[56]=Z):Z=t[56];let Q;t[57]===f?Q=t[58]:(Q=e=>{!e&&!f?A(!1):e&&A(!0)},t[57]=f,t[58]=Q);let de;t[59]===h?de=t[60]:(de=h({id:`a4FRQv`}),t[59]=h,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(S,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===I?pe=t[64]:(pe=(0,F.jsx)(x,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:I}})}),t[63]=I,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(T,{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]===f?he=t[70]:(he=f?(0,F.jsx)(_,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=f,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]!==ae||t[73]!==f||t[74]!==he?(_e=(0,F.jsxs)(w,{children:[me,(0,F.jsxs)(c,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:f,onClick:ae,children:[he,ge]})]}),t[72]=ae,t[73]=f,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(C,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==Q||t[81]!==ve?(ye=(0,F.jsx)(E,{open:k,onOpenChange:Q,children:ve}),t[79]=k,t[80]=Q,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Z||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Z,ye]}),t[83]=Z,t[84]=ye,t[85]=be):be=t[85],be}function ne(){return Date.now()}function re(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return p._({id:`nYeBmY`,values:{hours:r}})}function ie(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)(ae),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),ee()}))},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=re(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 A;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(A=(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]=A):A=t[35];let j;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)(I,{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],j=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]=j}else j=t[43];let M;t[51]===j?M=t[52]:(M=(0,F.jsx)(`div`,{children:j}),t[51]=j,t[52]=M);let te;return t[53]!==A||t[54]!==M?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[A,M]}),t[53]=A,t[54]=M,t[55]=te):te=t[55],te}function ae(){return Date.now()}async function L(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){typeof window>`u`||(window.location.hash=y(e))}function oe(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(_,{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 se(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)(h,{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 ce(){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 z(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)(B,{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 B(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)(m,{}),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 h;return t[7]===f?h=t[8]:(h=(0,F.jsxs)(d,{children:[f,p]}),t[7]=f,t[8]=h),h}function V(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(H),i;t[0]!==n||t[1]!==r?(i=n?U(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 H(){return Date.now()}function U(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return p._({id:`nYeBmY`,values:{hours:n}})}function W(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)(A,{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 le(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)(B,{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)(W,{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)(oe,{}):r===`error`&&i?(0,F.jsx)(se,{error:i,onRetry:s}):n===null?(0,F.jsx)(ce,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(V,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(ce,{}):n.files.map(e=>(0,F.jsx)(ie,{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 G(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}=r(),{openTargetTransition:d}=n(),{pageMeta:p}=g(),{data:m,status:h,error:_,reload:v}=M(l),y,x;if(t[2]!==m||t[3]!==l?(y=()=>{if(!(!m||l===null))for(let e of m.files)O(l,e.docName,e.bursts.length)},x=[m,l],t[2]=m,t[3]=l,t[4]=y,t[5]=x):(y=t[4],x=t[5]),(0,P.useEffect)(y,x),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(z,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let S;t[9]!==d||t[10]!==p?(S=e=>{d(b({kind:`doc`,target:e,docName:e},p),{disposition:`permanent`,consumeActiveNewTab:!0}),R(e)},t[9]=d,t[10]=p,t[11]=S):S=t[11];let C=S,w;t[12]!==m||t[13]!==l?(w=(e,t)=>{if(!m?.agent||l===null)return;j();let n=e.bursts.length;k({agentId:l,agentName:m.agent.displayName,agentColor:m.agent.color,agentIcon:m.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=m,t[13]=l,t[14]=w):w=t[14];let T=w,E;t[15]!==c||t[16]!==m||t[17]!==l||t[18]!==v?(E=async(e,t)=>{if(!(t<=0))try{await L({connectionId:l,docName:e,scope:`count`,count:t,agentName:m?.agent?.displayName}),f.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),v()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);f.error(c({id:`EqrC_R`,values:{message:n}})),v()}},t[15]=c,t[16]=m,t[17]=l,t[18]=v,t[19]=E):E=t[19];let D=E,A;return t[20]!==u||t[21]!==m||t[22]!==_||t[23]!==C||t[24]!==T||t[25]!==D||t[26]!==v||t[27]!==s||t[28]!==h?(A=(0,F.jsx)(le,{data:m,status:h,error:_,reload:v,onExit:u,onNavigate:C,onUndoDrop:D,onSetVersion:T,showBackButton:s}),t[20]=u,t[21]=m,t[22]=_,t[23]=C,t[24]=T,t[25]=D,t[26]=v,t[27]=s,t[28]=h,t[29]=A):A=t[29],A}export{G as ActivityModeContent};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{a as n,i as r}from"./DocumentContext-DFZKvfvg.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-HKX9wT1K.js";import{i as l,n as u,t as d}from"./tooltip-DVBVVaAs.js";import{n as f}from"./dist-CJhtNlOm2.js";import{t as p}from"./dist-Cr4-nBVI.js";import{m}from"./Mermaid-DP2in8wt.js";import{t as h}from"./circle-alert-Czw40trT.js";import{i as g}from"./prop-types-B89-ahXp.js";import{t as _}from"./spinner-D7ppCG-D.js";import{t as v}from"./undo-2--eop4_Wq.js";import{f as y}from"./doc-paths-BX7XJ9w6.js";import{s as b}from"./navigation-targets-DRmErmHI.js";import{a as x,c as S,i as C,o as w,s as T,t as E}from"./dialog-Q2r_wm4I.js";import{a as D,i as O,n as k,o as A,t as ee}from"./agent-diff-store-DItmUDIK.js";import{t as j}from"./timeline-diff-store-DzEGunqQ.js";import{n as M}from"./use-activity-panel-Btpqtgnc.js";var N=s(),P=e(i(),1),F=t();function te(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}return new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function I(e){let t=(0,N.c)(86),{burst:n,docName:r,editCount:i,sessionAlive:s,inFlight:f,onOpenDiff:p,onRestore:m}=e,{_:h}=o(),[g,y]=(0,P.useState)(ne),b,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{let e=setInterval(()=>y(Date.now()),3e4);return()=>clearInterval(e)},O=[],t[0]=b,t[1]=O):(b=t[0],O=t[1]),(0,P.useEffect)(b,O);let[k,A]=(0,P.useState)(!1),ee=D(),j=n.stackIndex+1,M=ee?.docName===r&&ee.keptCount===j,I=i-j,re=!s||f||I<=0,ie;t[2]!==I||t[3]!==m?(ie=function(){A(!1),m(I)},t[2]=I,t[3]=m,t[4]=ie):ie=t[4];let ae=ie,L;t[5]!==n||t[6]!==p?(L=()=>p(n),t[5]=n,t[6]=p,t[7]=L):L=t[7];let R;t[8]!==h||t[9]!==j||t[10]!==r?(R=h({id:`Z79bnE`,values:{burstNumber:j,docName:r}}),t[8]=h,t[9]=j,t[10]=r,t[11]=R):R=t[11];let oe=M?`bg-muted`:`hover:bg-muted/40`,se;t[12]===oe?se=t[13]:(se=[`flex min-w-0 flex-1 items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground transition-colors`,oe],t[12]=oe,t[13]=se);let ce=se.join(` `),z;t[14]!==n.ts||t[15]!==g?(z=te(n.ts,g),t[14]=n.ts,t[15]=g,t[16]=z):z=t[16];let B;t[17]===z?B=t[18]:(B=(0,F.jsx)(`span`,{className:`font-mono`,children:z}),t[17]=z,t[18]=B);let V;t[19]===n.additions?V=t[20]:(V=(0,F.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[19]=n.additions,t[20]=V);let H;t[21]===n.deletions?H=t[22]:(H=(0,F.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[21]=n.deletions,t[22]=H);let U;t[23]!==V||t[24]!==H?(U=(0,F.jsxs)(`span`,{className:`ml-auto font-mono`,children:[V,` `,H]}),t[23]=V,t[24]=H,t[25]=U):U=t[25];let W;t[26]!==M||t[27]!==B||t[28]!==U||t[29]!==L||t[30]!==R||t[31]!==ce?(W=(0,F.jsxs)(`button`,{type:`button`,onClick:L,"aria-pressed":M,"aria-label":R,"data-testid":`activity-panel-burst-open`,className:ce,children:[B,U]}),t[26]=M,t[27]=B,t[28]=U,t[29]=L,t[30]=R,t[31]=ce,t[32]=W):W=t[32];let le;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-1.5 h-3 w-px shrink-0 bg-border`}),t[33]=le):le=t[33];let G;t[34]!==h||t[35]!==j||t[36]!==r?(G=h({id:`Zhe80e`,values:{burstNumber:j,docName:r}}),t[34]=h,t[35]=j,t[36]=r,t[37]=G):G=t[37];let ue;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>A(!0),t[38]=ue):ue=t[38];let K;t[39]===f?K=t[40]:(K=f?(0,F.jsx)(_,{className:`size-3`,"aria-hidden":`true`}):(0,F.jsx)(v,{className:`size-3`,"aria-hidden":`true`}),t[39]=f,t[40]=K);let q;t[41]!==re||t[42]!==G||t[43]!==K?(q=(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":G,disabled:re,onClick:ue,children:K})}),t[41]=re,t[42]=G,t[43]=K,t[44]=q):q=t[44];let J;t[45]!==h||t[46]!==I||t[47]!==s?(J=h(s?I>0?{id:`SOPwPh`}:{id:`62bOuM`}:{id:`NzFvyK`}),t[45]=h,t[46]=I,t[47]=s,t[48]=J):J=t[48];let Y;t[49]===J?Y=t[50]:(Y=(0,F.jsx)(u,{side:`left`,children:J}),t[49]=J,t[50]=Y);let X;t[51]!==q||t[52]!==Y?(X=(0,F.jsxs)(d,{children:[q,Y]}),t[51]=q,t[52]=Y,t[53]=X):X=t[53];let Z;t[54]!==W||t[55]!==X?(Z=(0,F.jsxs)(`div`,{className:`flex items-center border-t border-border/50 pr-3`,children:[W,le,X]}),t[54]=W,t[55]=X,t[56]=Z):Z=t[56];let Q;t[57]===f?Q=t[58]:(Q=e=>{!e&&!f?A(!1):e&&A(!0)},t[57]=f,t[58]=Q);let de;t[59]===h?de=t[60]:(de=h({id:`a4FRQv`}),t[59]=h,t[60]=de);let fe;t[61]===de?fe=t[62]:(fe=(0,F.jsx)(S,{children:de}),t[61]=de,t[62]=fe);let pe;t[63]===I?pe=t[64]:(pe=(0,F.jsx)(x,{children:(0,F.jsx)(a,{id:`LKIPzv`,values:{laterEdits:I}})}),t[63]=I,t[64]=pe);let $;t[65]!==fe||t[66]!==pe?($=(0,F.jsxs)(T,{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]===f?he=t[70]:(he=f?(0,F.jsx)(_,{className:`mr-2 size-4`,"aria-hidden":`true`}):null,t[69]=f,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]!==ae||t[73]!==f||t[74]!==he?(_e=(0,F.jsxs)(w,{children:[me,(0,F.jsxs)(c,{variant:`destructive`,"data-testid":`activity-panel-burst-restore-confirm`,disabled:f,onClick:ae,children:[he,ge]})]}),t[72]=ae,t[73]=f,t[74]=he,t[75]=_e):_e=t[75];let ve;t[76]!==$||t[77]!==_e?(ve=(0,F.jsxs)(C,{children:[$,_e]}),t[76]=$,t[77]=_e,t[78]=ve):ve=t[78];let ye;t[79]!==k||t[80]!==Q||t[81]!==ve?(ye=(0,F.jsx)(E,{open:k,onOpenChange:Q,children:ve}),t[79]=k,t[80]=Q,t[81]=ve,t[82]=ye):ye=t[82];let be;return t[83]!==Z||t[84]!==ye?(be=(0,F.jsxs)(F.Fragment,{children:[Z,ye]}),t[83]=Z,t[84]=ye,t[85]=be):be=t[85],be}function ne(){return Date.now()}function re(e,t){let n=Math.max(0,t-e);if(n<6e4){let e=Math.round(n/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(n<36e5){let e=Math.round(n/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let r=Math.round(n/36e5);return p._({id:`nYeBmY`,values:{hours:r}})}function ie(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)(ae),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),ee()}))},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=re(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 A;t[31]!==O||t[32]!==k||t[33]!==C||t[34]!==E?(A=(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]=A):A=t[35];let j;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)(I,{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],j=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]=j}else j=t[43];let M;t[51]===j?M=t[52]:(M=(0,F.jsx)(`div`,{children:j}),t[51]=j,t[52]=M);let te;return t[53]!==A||t[54]!==M?(te=(0,F.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[A,M]}),t[53]=A,t[54]=M,t[55]=te):te=t[55],te}function ae(){return Date.now()}async function L(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){typeof window>`u`||(window.location.hash=y(e))}function oe(){let e=(0,N.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(_,{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 se(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)(h,{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 ce(){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 z(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)(B,{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 B(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)(m,{}),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 h;return t[7]===f?h=t[8]:(h=(0,F.jsxs)(d,{children:[f,p]}),t[7]=f,t[8]=h),h}function V(e){let t=(0,N.c)(9),{lastTs:n}=e,[r]=(0,P.useState)(H),i;t[0]!==n||t[1]!==r?(i=n?U(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 H(){return Date.now()}function U(e){let t=Math.max(0,e);if(t<6e4){let e=Math.round(t/1e3);return p._({id:`pbwTg6`,values:{seconds:e}})}if(t<36e5){let e=Math.round(t/6e4);return p._({id:`_rP3HI`,values:{minutes:e}})}let n=Math.round(t/36e5);return p._({id:`nYeBmY`,values:{hours:n}})}function W(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)(A,{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 le(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)(B,{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)(W,{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)(oe,{}):r===`error`&&i?(0,F.jsx)(se,{error:i,onRetry:s}):n===null?(0,F.jsx)(ce,{}):(0,F.jsxs)(F.Fragment,{children:[!n.sessionAlive&&m!==null?(0,F.jsx)(V,{lastTs:m}):null,n.files.length===0?(0,F.jsx)(ce,{}):n.files.map(e=>(0,F.jsx)(ie,{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 G(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}=r(),{openTargetTransition:d}=n(),{pageMeta:p}=g(),{data:m,status:h,error:_,reload:v}=M(l),y,x;if(t[2]!==m||t[3]!==l?(y=()=>{if(!(!m||l===null))for(let e of m.files)O(l,e.docName,e.bursts.length)},x=[m,l],t[2]=m,t[3]=l,t[4]=y,t[5]=x):(y=t[4],x=t[5]),(0,P.useEffect)(y,x),l===null){let e;return t[6]!==u||t[7]!==s?(e=(0,F.jsx)(z,{onExit:u,showBackButton:s}),t[6]=u,t[7]=s,t[8]=e):e=t[8],e}let S;t[9]!==d||t[10]!==p?(S=e=>{d(b({kind:`doc`,target:e,docName:e},p),{disposition:`permanent`,consumeActiveNewTab:!0}),R(e)},t[9]=d,t[10]=p,t[11]=S):S=t[11];let C=S,w;t[12]!==m||t[13]!==l?(w=(e,t)=>{if(!m?.agent||l===null)return;j();let n=e.bursts.length;k({agentId:l,agentName:m.agent.displayName,agentColor:m.agent.color,agentIcon:m.agent.icon,docName:e.docName,keptCount:Math.max(0,Math.min(t,n)),maxVersions:n})},t[12]=m,t[13]=l,t[14]=w):w=t[14];let T=w,E;t[15]!==c||t[16]!==m||t[17]!==l||t[18]!==v?(E=async(e,t)=>{if(!(t<=0))try{await L({connectionId:l,docName:e,scope:`count`,count:t,agentName:m?.agent?.displayName}),f.success(c(t===1?{id:`-dNlfM`,values:{docName:e}}:{id:`ApeA0n`,values:{dropCount:t,docName:e}})),v()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);f.error(c({id:`EqrC_R`,values:{message:n}})),v()}},t[15]=c,t[16]=m,t[17]=l,t[18]=v,t[19]=E):E=t[19];let D=E,A;return t[20]!==u||t[21]!==m||t[22]!==_||t[23]!==C||t[24]!==T||t[25]!==D||t[26]!==v||t[27]!==s||t[28]!==h?(A=(0,F.jsx)(le,{data:m,status:h,error:_,reload:v,onExit:u,onNavigate:C,onUndoDrop:D,onSetVersion:T,showBackButton:s}),t[20]=u,t[21]=m,t[22]=_,t[23]=C,t[24]=T,t[25]=D,t[26]=v,t[27]=s,t[28]=h,t[29]=A):A=t[29],A}export{G as ActivityModeContent};