@inkeep/open-knowledge 0.5.1-beta.1 → 0.6.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/THIRD_PARTY_NOTICES.md +5 -0
- package/dist/assets/skills/open-knowledge/SKILL.md +1 -1
- package/dist/cli.mjs +4 -4
- package/dist/constants-JUZqR_Yu.mjs +2 -0
- package/dist/{dist-Du77nM-Z.mjs → dist-B_Nlx5d6.mjs} +15 -16
- package/dist/{dist-1yEbYw4s.mjs → dist-Bq1Nm7Hl.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/init-DD_r2nwd.mjs +1 -0
- package/dist/{init-wE_PoDlt.mjs → init-pu_7zCAy.mjs} +4 -4
- package/dist/loader-CTWe5z9-.mjs +1 -0
- package/dist/{loader-CyRBTmf0.mjs → loader-DwgxIIbN.mjs} +2 -2
- package/dist/{preview-DIChsLP0.mjs → preview-Bep4xj-R.mjs} +2 -2
- package/dist/preview-DtrIs0gZ.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-BA_Hv5zU.js → ActivityModeContent-nwB2ciii.js} +1 -1
- package/dist/public/assets/ConsentDialogBody-BncX7dD1.js +2 -0
- package/dist/public/assets/DocumentContext-Bc83ypCd.js +52 -0
- package/dist/public/assets/{GraphPanel-8RBGIUIt.js → GraphPanel-DwHnIo6r.js} +3 -3
- package/dist/public/assets/McpConsentDialogBody-Dw8kQ_BH.js +1 -0
- package/dist/public/assets/SettingsDialogBody-o-ExGcAl.js +11 -0
- package/dist/public/assets/{SourceEditor-DUA4Uo0Z.js → SourceEditor-DF322IKX.js} +1 -1
- package/dist/public/assets/{agent-presence-8VSgL2U2.js → agent-presence-DUe_PdKt.js} +1 -1
- package/dist/public/assets/{architectureDiagram-Q4EWVU46-CIVh0TLx.js → architectureDiagram-Q4EWVU46-C4pUyyy6.js} +1 -1
- package/dist/public/assets/{blockDiagram-DXYQGD6D-Cg-UHasz.js → blockDiagram-DXYQGD6D-VkwkYpUF.js} +1 -1
- package/dist/public/assets/{c4Diagram-AHTNJAMY-KFeHAAOO.js → c4Diagram-AHTNJAMY-uR85wHTj.js} +1 -1
- package/dist/public/assets/channel-DtU-CCDV.js +1 -0
- package/dist/public/assets/checkbox-CTrUepCv.js +1 -0
- package/dist/public/assets/{chunk-336JU56O-DHqaXNrn.js → chunk-336JU56O-CcUNcCyG.js} +2 -2
- package/dist/public/assets/{chunk-426QAEUC-CuPmuy8t.js → chunk-426QAEUC-D-Drhg6m.js} +1 -1
- package/dist/public/assets/{chunk-4TB4RGXK-QLafKs7A.js → chunk-4TB4RGXK-DylOpICA.js} +1 -1
- package/dist/public/assets/{chunk-5FUZZQ4R-DoG5zk7O.js → chunk-5FUZZQ4R-COpN1802.js} +1 -1
- package/dist/public/assets/{chunk-5PVQY5BW--zDnbXdQ.js → chunk-5PVQY5BW-SLEOUaCC.js} +1 -1
- package/dist/public/assets/{chunk-EDXVE4YY-BfT15Ufb.js → chunk-EDXVE4YY-Cr4fB83o.js} +1 -1
- package/dist/public/assets/{chunk-ENJZ2VHE-DEtEhITq.js → chunk-ENJZ2VHE-jO5Yn0Ti.js} +1 -1
- package/dist/public/assets/{chunk-ICPOFSXX-C8AElYY_.js → chunk-ICPOFSXX-DO-wz1LJ.js} +1 -1
- package/dist/public/assets/{chunk-OYMX7WX6-CX3nrwxJ.js → chunk-OYMX7WX6-DlOfgU2U.js} +1 -1
- package/dist/public/assets/{chunk-U2HBQHQK-CfAyyLJz.js → chunk-U2HBQHQK-fFQ_IUwS.js} +1 -1
- package/dist/public/assets/{chunk-X2U36JSP-CmACymAN.js → chunk-X2U36JSP-JbIA9pf5.js} +1 -1
- package/dist/public/assets/{chunk-YZCP3GAM-CiWxV9XS.js → chunk-YZCP3GAM-Cx9wuApW.js} +1 -1
- package/dist/public/assets/{chunk-ZZ45TVLE-B7t5_MqN.js → chunk-ZZ45TVLE-CdiDiZYV.js} +1 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-BZpd1T4J.js +1 -0
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-C6GyLa0q.js +1 -0
- package/dist/public/assets/clone-CvvNDZ2x.js +1 -0
- package/dist/public/assets/{collapsible-L2bca9Ur.js → collapsible-DfUFsfqv.js} +1 -1
- package/dist/public/assets/config-validation-events-BCNaZEDf.js +10 -0
- package/dist/public/assets/{dagre-BuFRtOcC.js → dagre-D0NgAcgy.js} +1 -1
- package/dist/public/assets/{dagre-KV5264BT-BpBW6R71.js → dagre-KV5264BT-D00jhTEj.js} +1 -1
- package/dist/public/assets/{diagram-5BDNPKRD-B5phtkJp.js → diagram-5BDNPKRD-53lAVvrc.js} +1 -1
- package/dist/public/assets/{diagram-G4DWMVQ6-tjReW6yx.js → diagram-G4DWMVQ6-DvnMPxCL.js} +1 -1
- package/dist/public/assets/{diagram-MMDJMWI5-b4CgKryF.js → diagram-MMDJMWI5-bSOxNuvv.js} +1 -1
- package/dist/public/assets/{diagram-TYMM5635-D5B0g2lj.js → diagram-TYMM5635-ftQ9f3sM.js} +1 -1
- package/dist/public/assets/{dialog-DSzqKgdW.js → dialog-bA5Nvc2p.js} +1 -1
- package/dist/public/assets/{dist-DQ1oWohr.js → dist-BUk_vKk2.js} +1 -1
- package/dist/public/assets/{dist-DXgyWuz5.js → dist-C8kKU7Ya.js} +1 -1
- package/dist/public/assets/{dist-DpEGxZ9h.js → dist-CruwjFAC.js} +1 -1
- package/dist/public/assets/{dist-D3YXABda.js → dist-DNQ2xKmK.js} +1 -1
- package/dist/public/assets/{dist-DllAuqQQ.js → dist-DiQSHtaM.js} +1 -1
- package/dist/public/assets/{dist-By89CQBy.js → dist-SeK3HGs7.js} +1 -1
- package/dist/public/assets/{dist-D-oqC0-R.js → dist-semR8ZB_.js} +1 -1
- package/dist/public/assets/{doc-hash-CO_0WoMz.js → doc-hash-BrKkCdCz.js} +147 -147
- package/dist/public/assets/{erDiagram-SMLLAGMA-CRJz10Jv.js → erDiagram-SMLLAGMA-B1J-oh72.js} +1 -1
- package/dist/public/assets/{flowDiagram-DWJPFMVM-BDCJTgJ7.js → flowDiagram-DWJPFMVM-lLrSyhC0.js} +1 -1
- package/dist/public/assets/{ganttDiagram-T4ZO3ILL-cPQKlGYc.js → ganttDiagram-T4ZO3ILL-CUjectuq.js} +1 -1
- package/dist/public/assets/{gitGraphDiagram-UUTBAWPF-BMyjc352.js → gitGraphDiagram-UUTBAWPF-vFBdpaIg.js} +1 -1
- package/dist/public/assets/{graphlib-BU8FnRz1.js → graphlib-C3wGX8GR.js} +1 -1
- package/dist/public/assets/index-Bzs40SFf.css +1 -0
- package/dist/public/assets/index-Izdfgq4i.js +1928 -0
- package/dist/public/assets/{infoDiagram-42DDH7IO-BZ6v5y-j.js → infoDiagram-42DDH7IO-p5UnX5VQ.js} +1 -1
- package/dist/public/assets/{ishikawaDiagram-UXIWVN3A-DA7_P2Up.js → ishikawaDiagram-UXIWVN3A-Dc_uLtDG.js} +1 -1
- package/dist/public/assets/{journeyDiagram-VCZTEJTY-CzZoB161.js → journeyDiagram-VCZTEJTY-D-OWzt5X.js} +1 -1
- package/dist/public/assets/{kanban-definition-6JOO6SKY-DKg7pXv1.js → kanban-definition-6JOO6SKY-Dg3mF5uv.js} +1 -1
- package/dist/public/assets/{label-CdSs0Skc.js → label-Bdsqm1CY.js} +1 -1
- package/dist/public/assets/{line-DGc-MCyQ.js → line-Blj6fR0j.js} +1 -1
- package/dist/public/assets/{mermaid.core-DRx0wZe0.js → mermaid.core-DKgSmEOt.js} +3 -3
- package/dist/public/assets/{mindmap-definition-QFDTVHPH-C9GRZxO6.js → mindmap-definition-QFDTVHPH-CzdOizWD.js} +1 -1
- package/dist/public/assets/{panel-Co559KoC.js → panel-CxlToFCs.js} +1 -1
- package/dist/public/assets/{pieDiagram-DEJITSTG-L6I3ft9Z.js → pieDiagram-DEJITSTG-CCKPY52f.js} +1 -1
- package/dist/public/assets/{propagation-api-3kmMXRwS.js → propagation-api-CobBjsTC.js} +1 -1
- package/dist/public/assets/{quadrantDiagram-34T5L4WZ-Dp2IeEPC.js → quadrantDiagram-34T5L4WZ-7k7hUHeX.js} +1 -1
- package/dist/public/assets/{requirementDiagram-MS252O5E-BxNWyIZg.js → requirementDiagram-MS252O5E-DtBI2UGc.js} +1 -1
- package/dist/public/assets/{sankeyDiagram-XADWPNL6-CRn0_xkw.js → sankeyDiagram-XADWPNL6-CsyAV-jZ.js} +1 -1
- package/dist/public/assets/{sequenceDiagram-FGHM5R23-Drkjb1j4.js → sequenceDiagram-FGHM5R23-BVVas0PB.js} +1 -1
- package/dist/public/assets/{stateDiagram-FHFEXIEX-BBUFKS0u.js → stateDiagram-FHFEXIEX-DSU8iqSJ.js} +1 -1
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-B8ew63Gv.js +1 -0
- package/dist/public/assets/{target-navigation-intent-BY2CtClj.js → target-navigation-intent-B5Xuyiwx.js} +1 -1
- package/dist/public/assets/{telemetry-impl-DPRMO_b_.js → telemetry-impl-BiWd9bHi.js} +1 -1
- package/dist/public/assets/{textarea-5ach84qM.js → textarea-CQGiqhkV.js} +1 -1
- package/dist/public/assets/{timeline-definition-GMOUNBTQ-CLoe9y-z.js → timeline-definition-GMOUNBTQ-Cz06Vse0.js} +1 -1
- package/dist/public/assets/{toggle-group-CJzcIZ91.js → toggle-group-Cimrwku9.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-L-hzCd9t.js → typing-burst-detector-ByUXt_f8.js} +1 -1
- package/dist/public/assets/{vennDiagram-DHZGUBPP-q2zdiy4F.js → vennDiagram-DHZGUBPP-Cf-DwVPO.js} +1 -1
- package/dist/public/assets/{wardleyDiagram-NUSXRM2D-Njg6YHso.js → wardleyDiagram-NUSXRM2D-CYXaSU9R.js} +1 -1
- package/dist/public/assets/{xychartDiagram-5P7HB3ND-Ct8Wgp45.js → xychartDiagram-5P7HB3ND-Czjmctj-.js} +1 -1
- package/dist/public/index.html +24 -24
- package/dist/{repair-launch-json-Co3PPh9L.mjs → repair-launch-json-ByfyoscN.mjs} +2 -2
- package/dist/{repair-mcp-configs-9moWefpg.mjs → repair-mcp-configs-D6LjdRhL.mjs} +2 -2
- package/dist/{src-DD5sVihr.mjs → src-DOCgFp9P.mjs} +2 -2
- package/dist/{start-Bq6io6Ey.mjs → start-CojePtz9.mjs} +2 -2
- package/dist/start-PJUtb0rl.mjs +1 -0
- package/package.json +1 -1
- package/dist/constants-CxGUnR2R.mjs +0 -2
- package/dist/init-8rAVRY8c.mjs +0 -1
- package/dist/loader-Cx9FryMP.mjs +0 -1
- package/dist/preview-DoBZjq8W.mjs +0 -1
- package/dist/public/assets/ConsentDialogBody-Dfx6N7pC.js +0 -2
- package/dist/public/assets/DocumentContext-DLUOyqhE.js +0 -52
- package/dist/public/assets/McpConsentDialogBody-fka4wJP7.js +0 -1
- package/dist/public/assets/SettingsDialogBody-WO4dhoz2.js +0 -11
- package/dist/public/assets/channel-BqqURnVG.js +0 -1
- package/dist/public/assets/checkbox-kroC1jEP.js +0 -1
- package/dist/public/assets/classDiagram-6PBFFD2Q-DrN_pUa5.js +0 -1
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-C1MJ1Ukt.js +0 -1
- package/dist/public/assets/clone-CecJCxEU.js +0 -1
- package/dist/public/assets/config-validation-events-BDg76Ro_.js +0 -10
- package/dist/public/assets/index-BBU-QASR.css +0 -1
- package/dist/public/assets/index-mEf0JUM_.js +0 -1928
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-BtYsWsIg.js +0 -1
- package/dist/start-By-gUCPK.mjs +0 -1
- /package/dist/public/assets/{button-DBLnjjvQ.js → button-JrGyO3-P.js} +0 -0
- /package/dist/public/assets/{katex-DX-tM4Fr.js → katex-qwlL5fSd.js} +0 -0
- /package/dist/public/assets/{trace-api-CiCjX4Sz.js → trace-api-3dczfLSc.js} +0 -0
- /package/dist/public/assets/{w3c-keyname-B5t0fahT.js → w3c-keyname-BSTW6KzM.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,$n as t,$t as n,A as r,An as i,Ar as a,At as o,B as s,Bn as c,Br as l,Bt as u,C as d,Cn as f,Cr as p,Ct as m,D as h,Dn as g,Dr as _,Dt as v,E as y,En as b,Er as x,Et as S,F as C,Fn as w,Fr as T,Ft as E,G as D,Gn as O,Gt as k,H as A,Hn as j,Ht as M,I as N,In as P,Ir as F,It as I,J as L,Jn as R,Jt as z,K as B,Kn as V,Kt as H,L as U,Ln as W,Lr as G,Lt as K,M as q,Mn as J,Mr as Y,Mt as X,N as Z,Nn as Q,Nr as $,Nt as ee,O as te,On as ne,Or as re,Ot as ie,P as ae,Pn as oe,Pr as se,Pt as ce,Q as le,Qn as ue,Qr as de,Qt as fe,R as pe,Rn as me,Rr as he,Rt as ge,S as _e,Sn as ve,Sr as ye,St as be,T as xe,Tn as Se,Tr as Ce,Tt as we,U as Te,Un as Ee,Ut as De,V as Oe,Vn as ke,Vr as Ae,Vt as je,W as Me,Wn as Ne,Wt as Pe,X as Fe,Xn as Ie,Xt as Le,Y as Re,Yn as ze,Yt as Be,Z as Ve,Zn as He,Zr as Ue,Zt as We,_ as Ge,_n as Ke,_r as qe,_t as Je,a as Ye,an as Xe,ar as Ze,at as Qe,b as $e,bn as et,br as tt,bt as nt,c as rt,cn as it,cr as at,ct as ot,d as st,di as ct,dn as lt,dr as ut,dt,en as ft,er as pt,et as mt,f as ht,fn as gt,fr as _t,ft as vt,g as yt,gn as bt,gr as xt,gt as St,h as Ct,hi as wt,hn as Tt,hr as Et,ht as Dt,i as Ot,in as kt,ir as At,it as jt,j as Mt,jn as Nt,jr as Pt,jt as Ft,k as It,kn as Lt,kr as Rt,kt as zt,l as Bt,li as Vt,ln as Ht,lr as Ut,lt as Wt,m as Gt,mi as Kt,mn as qt,mr as Jt,mt as Yt,n as Xt,nn as Zt,nr as Qt,nt as $t,o as en,on as tn,or as nn,ot as rn,p as an,pn as on,pr as sn,pt as cn,q as ln,qn as un,qt as dn,r as fn,rn as pn,rr as mn,rt as hn,s as gn,si as _n,sn as vn,sr as yn,st as bn,t as xn,ti as Sn,tn as Cn,tr as wn,tt as Tn,u as En,ui as Dn,un as On,ur as kn,ut as An,v as jn,vn as Mn,vr as Nn,vt as Pn,w as Fn,wn as In,wr as Ln,wt as Rn,x as zn,xn as Bn,xr as Vn,xt as Hn,y as Un,yn as Wn,yr as Gn,yt as Kn,z as qn,zn as Jn,zr as Yn,zt as Xn}from"./dist-
|
|
1
|
+
import{$ as e,$n as t,$t as n,A as r,An as i,Ar as a,At as o,B as s,Bn as c,Br as l,Bt as u,C as d,Cn as f,Cr as p,Ct as m,D as h,Dn as g,Dr as _,Dt as v,E as y,En as b,Er as x,Et as S,F as C,Fn as w,Fr as T,Ft as E,G as D,Gn as O,Gt as k,H as A,Hn as j,Ht as M,I as N,In as P,Ir as F,It as I,J as L,Jn as R,Jt as z,K as B,Kn as V,Kt as H,L as U,Ln as W,Lr as G,Lt as K,M as q,Mn as J,Mr as Y,Mt as X,N as Z,Nn as Q,Nr as $,Nt as ee,O as te,On as ne,Or as re,Ot as ie,P as ae,Pn as oe,Pr as se,Pt as ce,Q as le,Qn as ue,Qr as de,Qt as fe,R as pe,Rn as me,Rr as he,Rt as ge,S as _e,Sn as ve,Sr as ye,St as be,T as xe,Tn as Se,Tr as Ce,Tt as we,U as Te,Un as Ee,Ut as De,V as Oe,Vn as ke,Vr as Ae,Vt as je,W as Me,Wn as Ne,Wt as Pe,X as Fe,Xn as Ie,Xt as Le,Y as Re,Yn as ze,Yt as Be,Z as Ve,Zn as He,Zr as Ue,Zt as We,_ as Ge,_n as Ke,_r as qe,_t as Je,a as Ye,an as Xe,ar as Ze,at as Qe,b as $e,bn as et,br as tt,bt as nt,c as rt,cn as it,cr as at,ct as ot,d as st,di as ct,dn as lt,dr as ut,dt,en as ft,er as pt,et as mt,f as ht,fn as gt,fr as _t,ft as vt,g as yt,gn as bt,gr as xt,gt as St,h as Ct,hi as wt,hn as Tt,hr as Et,ht as Dt,i as Ot,in as kt,ir as At,it as jt,j as Mt,jn as Nt,jr as Pt,jt as Ft,k as It,kn as Lt,kr as Rt,kt as zt,l as Bt,li as Vt,ln as Ht,lr as Ut,lt as Wt,m as Gt,mi as Kt,mn as qt,mr as Jt,mt as Yt,n as Xt,nn as Zt,nr as Qt,nt as $t,o as en,on as tn,or as nn,ot as rn,p as an,pn as on,pr as sn,pt as cn,q as ln,qn as un,qt as dn,r as fn,rn as pn,rr as mn,rt as hn,s as gn,si as _n,sn as vn,sr as yn,st as bn,t as xn,ti as Sn,tn as Cn,tr as wn,tt as Tn,u as En,ui as Dn,un as On,ur as kn,ut as An,v as jn,vn as Mn,vr as Nn,vt as Pn,w as Fn,wn as In,wr as Ln,wt as Rn,x as zn,xn as Bn,xr as Vn,xt as Hn,y as Un,yn as Wn,yr as Gn,yt as Kn,z as qn,zn as Jn,zr as Yn,zt as Xn}from"./dist-B_Nlx5d6.mjs";import{_ as Zn,a as Qn,c as $n,d as er,f as tr,g as nr,i as rr,l as ir,m as ar,n as or,o as sr,p as cr,r as lr,s as ur,t as dr,u as fr}from"./server-lock-D7DXNVql-BRVVzA6T.mjs";export{xn as AGENT_ID_MAX_LEN,Xt as AGENT_ID_RE,fn as AGENT_WRITE_ORIGIN,Ot as AgentFocusBroadcaster,Ye as AgentPresenceBroadcaster,en as AgentSessionCapacityError,gn as AgentSessionManager,rt as BacklinkIndex,Bt as CC1Broadcaster,Sn as CC1_CONTRACT_VERSION,En as CONFLICT_MARKER_RE,st as CURSOR_BUNDLE_PATHS_BY_PLATFORM,ht as ConfigSchema,an as DEFAULT_CHECKPOINT_RETENTION,Gt as DEFAULT_PACK_ID,Ct as FILE_SYSTEM_WRITER,yt as FILE_WATCHER_ORIGIN,Ge as GIT_UPSTREAM_WRITER,Ue as GitDirAccessError,jn as HOCUSPOCUS_AUTH_REJECTION_REASONS,Un as HocuspocusAuthRejection,$e as HocuspocusAuthTokenSchema,zn as INSTALLED_AGENTS_SCHEMES,_e as LIVE_DERIVED_INDEX_DEBOUNCE_MS,d as LOG_MD_TEMPLATE,Fn as MANAGED_RENAME_ORIGIN,xe as MAX_AGENT_SESSIONS,y as MCP_CONNECTION_ID_HEADER,h as MCP_SERVER_NAME,te as MISSING_OK_CONFIG_MESSAGE,de as MalformedGitPointerError,It as McpLogger,r as MissingOkConfigError,Mt as OBSERVER_SYNC_ORIGIN,_n as ORPHAN_MODES,q as PinoLogger,dr as ProcessLockCollisionError,Z as ProjectGitInitError,ae as ROLLBACK_ORIGIN,or as RUNTIME_VERSION,C as SERVICE_WRITER,N as SKILL_INSTALL_EVENTS_FILE_REL,Vt as SKILL_STATE_TARGETS,U as STARTER_FOLDERS,pe as STARTER_FOLDER_FRONTMATTER_FILENAME,qn as STARTER_PACKS,s as STARTER_PACK_IDS,Oe as STARTER_TEMPLATES,A as STATE_MANIFEST_FILENAME,lr as STATE_SCHEMA_VERSION,Dn as SYSTEM_DOC_NAME,Te as SeedPrerequisiteError,Me as SeedRootDirError,rr as ServerLockCollisionError,D as StateManifestError,B as TagIndex,ln as UiLockCollisionError,Qn as acquireProcessLock,sr as acquireServerLock,L as acquireUiLock,Re as applyAgentMarkdownWrite,Fe as applyExternalChange,Ve as applySeed,le as assertCompatibleStateManifest,e as assertNeverDiskEvent,mt as attachIdleShutdown,Tn as bootServer,$t as buildAndOpenSkill,hn as buildExecResult,jt as buildInstructions,Qe as buildReadResult,rn as buildSkillZip,bn as buildStarterFolderFrontmatterYaml,ot as buildWipTree,Wt as classifyEvents,An as classifyFsPath,dt as clearContributors,vt as coercePackId,ct as colorFromSeed,cn as commitUpstreamImport,Yt as commitWip,Dt as commitWipFromTree,St as containsConflictMarkers,Je as contentHash,Pn as contributorCount,Kn as createApiExtension,nt as createAssetServeMiddleware,Hn as createContentFilter,be as createContentFilterAsync,m as createExternalChangeHandler,Rn as createLiveDerivedIndexExtension,we as createMcpHttpHandler,S as createOsProbe,v as createPersistenceExtension,ie as createServer,zt as createServerObserverExtension,o as createStreamingErrorWriter,Ft as createTestLogger,X as detectClaudeDesktopPresence,ee as detectProjectShape,ce as ensureProjectGit,E as errorResponse,I as evictStaleTrackerEntries,K as extractWikiLinksFromMarkdown,ge as findEnclosingGitRoot,Xn as findEnclosingProjectRoot,u as formatAuthRejectionWire,je as formatContributors,M as formatContributorsFrom,De as gcCheckpointRefs,Pe as getCurrentMcpLogger,k as getLocalDir,H as getLogger,dn as getMeter,z as getMetrics,Be as getTracer,Le as handleCollabSocketError,We as handleSpawnCursor,Kt as iconFromClientName,fe as incrementCollabSocketFilteredError,n as incrementServerObserverFire,ft as initShadowRepo,Cn as initTelemetry,Zt as installPrettyZodErrors,pn as installTestLoggers,kt as installUserSkill,Xe as isAllowedApiOrigin,tn as isAllowedWorkspaceHostHeader,vn as isConfigDoc,it as isHocuspocusAuthRejectionReason,Ht as isKnownPackId,On as isLoopbackAddress,wt as isOrphanMode,lt as isPairedWriteOrigin,gt as isPathWithinDir,ur as isProcessAlive,on as isProjectRoot,qt as isSelfWrite,Tt as isSystemDoc,$n as isValidLockPid,bt as lastKnownHash,Ke as listRescueCheckpoints,Mn as listStarterPacks,Wn as loadPrincipal,ir as lockFilePath,et as loggerFactory,Bn as mountMcpAndApi,ve as normalizeFsPath,f as parseAuthRejectionWire,In as parseHocuspocusAuthToken,Se as parseKeepaliveConnectionId,b as pathToDocName,g as planSeed,ne as readAllTargets,Lt as readBranchFromHead,fr as readProcessLock,er as readProcessLockDetailed,tr as readServerLock,i as readServerPackageVersion,Nt as readSkillInstallStateSnapshot,J as readStateManifest,Q as readTargetRecordedAt,oe as readTargetVersion,w as readUiLock,P as reconcile,W as recordContributor,me as recordSkillInstallEvent,Jn as registerAllTools,c as registerWrite,cr as releaseProcessLock,ar as releaseServerLock,ke as releaseUiLock,j as removeLastKnownHash,Ee as resetMetrics,Ne as resolveBundledSkillDir,O as resolveContentDir,V as resolveCursorBinaryDefault,un as resolveCursorSpawnInvocation,R as resolveLockDir,ze as resolvePack,Ie as resolvePackageVersion,He as restoreContributors,ue as rewriteMarkdownLinksForDocumentRename,t as rewriteWikiLinksForDocumentRename,pt as runAuthReposSubprocess,wn as runAuthStatusSubprocess,Qt as runCloneSubprocess,mn as runDeviceFlowSubprocess,At as runWithMcpLogger,Ze as safeContentPath,nn as safeSubdir,yn as safetyCheckpoint,at as sanitizeClientName,Ut as saveInMemoryCheckpoint,kn as saveVersion,ut as seedBasenameIndex,_t as setActiveSpanAttributes,sn as shadowGit,Jt as shutdownTelemetry,Et as spawnDetached,xt as splitMarkdownBlocks,qe as startWatcher,Nn as streamingProblemEvent,Gn as swapContributors,tt as toBroadcasterKey,Vn as tracedAppendFileSync,ye as tracedLinkSync,p as tracedMkdir,Ln as tracedMkdirSync,Ce as tracedRename,x as tracedRenameSync,_ as tracedRmSync,re as tracedRmdirSync,Rt as tracedUnlinkSync,a as tracedWriteFile,Pt as tracedWriteFileSync,Y as updateLastKnownHash,nr as updateProcessLockPort,Zn as updateServerLockPort,$ as updateUiLockPort,se as validateAgentId,T as validateCloneInputs,F as validateSkillZip,G as withSpan,he as withSpanSync,Yn as writeStateManifest,l as writeTargetVersion,Ae as writeTracker};
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as e,f as t,g as n,h as r,i,m as a,r as o,s,t as c,u as l,v as u,y as d}from"./init-
|
|
1
|
+
import{d as e,f as t,g as n,h as r,i,m as a,r as o,s,t as c,u as l,v as u,y as d}from"./init-pu_7zCAy.mjs";import{i as f,n as p,r as m,t as h}from"./src-DOCgFp9P.mjs";import{n as g}from"./loader-DwgxIIbN.mjs";import{n as _}from"./preview-Bep4xj-R.mjs";export{a as ALL_EDITOR_IDS,r as EDITOR_LABELS,n as EDITOR_TARGETS,c as LAUNCH_CONFIG_NAME,o as classifyExistingMcpEntry,i as detectInstalledEditors,d as initContent,g as loadConfig,m as parseGitHubBlobUrl,f as parseGitUrl,_ as previewContent,s as readExistingMcpEntry,u as resolveProjectRoot,l as scaffoldLaunchJson,p as validateLocalFolderForShare,e as writeEditorMcpConfig,h as writeProjectAiIntegrations,t as writeUserMcpConfigs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as e}from"./init-pu_7zCAy.mjs";export{e as runInit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,Mt as s,N as c,Pt as l,Wn as u,_i as d,ai as f,an as p,ci as m,ei as h,fi as g,gi as _,ii as v,in as y,oi as b,on as x,pn as S,un as C}from"./dist-Du77nM-Z.mjs";import{n as ee,t as te}from"./constants-CxGUnR2R.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-DIChsLP0.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},xe={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},Se={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Ee=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===je?Ee(e.slice(p,n.lastIndex)):n===Ne?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(ze,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(e)));let l=s.join(`
|
|
1
|
+
import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{$r as a,D as o,Mt as s,N as c,Pt as l,Wn as u,_i as d,ai as f,an as p,ci as m,ei as h,fi as g,gi as _,ii as v,in as y,oi as b,on as x,pn as S,un as C}from"./dist-B_Nlx5d6.mjs";import{n as ee,t as te}from"./constants-JUZqR_Yu.mjs";import{t as w}from"./is-object-C-4FJ0rP.mjs";import{i as T,o as E,r as ne,s as D,t as O}from"./colors-BtKMHmBX.mjs";import{t as re}from"./preview-Bep4xj-R.mjs";import{execFileSync as ie}from"node:child_process";import ae,{basename as oe,dirname as k,isAbsolute as A,join as j,posix as M,relative as N,resolve as P,sep as F,win32 as I}from"node:path";import{cpSync as se,existsSync as L,lstatSync as ce,mkdirSync as R,readFileSync as z,realpathSync as le,rmSync as ue,writeFileSync as B}from"node:fs";import V from"node:process";import{homedir as H}from"node:os";import{AsyncLocalStorage as de,AsyncResource as fe}from"node:async_hooks";import{stripVTControlCharacters as pe,styleText as U}from"node:util";import*as me from"node:readline";import{randomUUID as he}from"node:crypto";import{createServer as ge,request as _e}from"node:http";import{connect as ve}from"node:net";function ye(){return V.platform.startsWith(`win`)?!!V.env.CI||!!V.env.WT_SESSION||!!V.env.TERMINUS_SUBLIME||V.env.ConEmuTask===`{cmd::Cmder}`||V.env.TERM_PROGRAM===`Terminus-Sublime`||V.env.TERM_PROGRAM===`vscode`||V.env.TERM===`xterm-256color`||V.env.TERM===`alacritty`||V.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:V.env.TERM!==`linux`}const be={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},xe={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},Se={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},Ce={...be,...xe},we={...be,...Se},W=ye()?Ce:we;Object.entries(xe);var Te=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const Ee=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),De=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,Oe=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,ke=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Ae=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,je=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Me=/\t{1,1000}/y,Ne=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Pe=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Fe=/\p{M}+/gu,Ie={limit:1/0,ellipsis:``},Le=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Le(i,Ie,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Pe,l],[ke,0],[Ae,o],[Me,s],[Ne,c],[je,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Fe,``)){let t=e.codePointAt(0)||0;if(S=De(t)?2:Oe(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===je?Ee(e.slice(p,n.lastIndex)):n===Ne?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},Re={limit:1/0,ellipsis:``,ellipsisWidth:0},G=(e,t={})=>Le(e,Re,t).width,ze=`]8;;`,Be=RegExp(`(?:\\[(?<code>\\d+)m|\\${ze}(?<uri>.*))`,`y`),Ve=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},He=e=>`[${e}m`,Ue=e=>`${ze}${e}`,We=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:G(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=G(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===``)&&(i=!0,a=t.startsWith(ze,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ge=e=>{let t=e.split(` `),n=t.length;for(;n&&!G(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Ke=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=G(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=G(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),We(s,r,t),c=G(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){We(s,r,t),c=G(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){We(s,r,t),c=G(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ge(e)));let l=s.join(`
|
|
2
2
|
`),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===``){Be.lastIndex=e+1;let t=Be.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
|
|
3
3
|
`){a&&(r+=Ue(``));let e=i?Ve(i):void 0;i&&e&&(r+=He(e))}else t===`
|
|
4
4
|
`&&(i&&Ve(i)&&(r+=He(i)),a&&(r+=Ue(a)))}return r},qe=/\r?\n/;function Je(e,t,n){return String(e).normalize().split(qe).map(e=>Ke(e,t,n)).join(`
|
|
@@ -401,9 +401,9 @@ last-spawn-error.log
|
|
|
401
401
|
# *.draft.md # exclude files matching a pattern
|
|
402
402
|
# !keep.md # re-include a file .gitignore excluded
|
|
403
403
|
`,`.okignore`)?r.push(`.okignore`):a.push(`.okignore`),{created:r,updated:i,skipped:a}}function $n(e,t){let n=N(t,e);return n.length>0&&!n.startsWith(`..`)&&!A(n)}const er=e=>{try{let t=ie(`git`,[`rev-parse`,`--show-toplevel`],{cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();return t.length>0?t:null}catch{return null}};function tr(e,t={}){let n=t.homeDir??H(),r=t.gitTopLevel??er,i=P(e),a;try{a=le(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(S(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=k(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&$n(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}const nr=a,rr=v,ir=[`-y`,`@inkeep/open-knowledge@latest`,`mcp`],ar={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`};function or(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=P(e);if(oe(t)===`cli.mjs`&&oe(k(t))===`dist`)return t;let n=t.split(F),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return j(i.length===0?F:i.join(F),`packages`,`cli`,`dist`,`cli.mjs`)}function sr(e={}){return e.cliPath?{command:e.cliPath,args:[`mcp`]}:e.mode===`dev`?{command:`node`,args:[or(),`mcp`],env:{...ar}}:{command:`npx`,args:[...ir]}}function cr(e){return e===`win32`?I:M}function lr(e={}){let t=e.platformName??process.platform,n=e.home??H();return cr(t).join(n,`.claude.json`)}function ur(e={}){let t=e.platformName??process.platform,n=e.home??H(),r=e.env??process.env;if(t===`darwin`)return M.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??I.join(n,`AppData`,`Roaming`);return I.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function dr(e={}){let t=e.platformName??process.platform,n=e.home??H();return cr(t).join(n,`.cursor`,`mcp.json`)}function fr(e={}){let t=e.platformName??process.platform,n=e.home??H();return(e.env??process.env).CODEX_HOME??cr(t).join(n,`.codex`)}function pr(e={}){return cr(e.platformName??process.platform).join(fr(e),`config.toml`)}function mr(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,n)=>mr(e,t[n]));if(w(e)&&w(t)){let n=Object.keys(e).sort(),r=Object.keys(t).sort();return n.length===r.length&&n.every((e,t)=>e===r[t])&&n.every(n=>mr(e[n],t[n]))}return!1}function hr(e,t){return Object.entries(t).every(([t,n])=>mr(e[t],n))}function gr(e,t){return{...e,...t}}function _r(e){return{...e,isCompatible(t,n,r){return hr(t,e.buildEntry(n,r))},mergeManagedFields(t,n,r){return gr(t,e.buildEntry(n,r))}}}const Q={claude:_r({id:`claude`,label:rr.claude,configPath:(e,t)=>lr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>sr(t),scope:`global`,detectPath:(e,t)=>j(t??H(),`.claude`),projectConfigPath:e=>j(e,`.mcp.json`),projectSkillPath:e=>j(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)}),"claude-desktop":_r({id:`claude-desktop`,label:rr[`claude-desktop`],configPath:(e,t)=>ur({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>sr(t),scope:`global`,detectPath:(e,t)=>k(ur({home:t}))}),cursor:_r({id:`cursor`,label:rr.cursor,configPath:(e,t)=>dr({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>o,buildEntry:(e,t)=>sr(t),scope:`global`,detectPath:(e,t)=>k(dr({home:t})),projectConfigPath:e=>j(e,`.cursor`,`mcp.json`),projectSkillPath:e=>j(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)}),codex:_r({id:`codex`,label:rr.codex,configPath:(e,t)=>pr({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>o,buildEntry:(e,t)=>sr(t),scope:`global`,detectPath:(e,t)=>k(pr({home:t})),projectConfigPath:e=>j(e,`.codex`,`config.toml`),projectSkillPath:e=>j(e,`.agents`,`skills`,`open-knowledge`,`SKILL.md`)})};function vr(e){let t=e.filter(e=>!Object.hasOwn(Q,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${nr.join(`, `)}`);return e.map(e=>Q[e])}function $(e,t,n,r,i){let a=`urn:uuid:${he()}`;if(e.headersSent||e.writableEnded||e.destroyed){console.error(`[ok ui] emitProblem called after headers sent — suppressed`,{type:n,status:t,instance:a});return}let o={type:n,title:r,status:t,instance:a,...i===void 0?{}:{detail:i}},s=m.safeParse(o);if(!s.success){console.error(`[ok ui] emitProblem produced an invalid ProblemDetails body:`,{issues:s.error.issues,originalStatus:t,body:o}),e.writeHead(500,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify({type:`urn:ok:error:internal-server-error`,title:`Internal server error.`,status:500,instance:a}));return}e.writeHead(t,{"Content-Type":`application/problem+json`,"X-Content-Type-Options":`nosniff`,"Cache-Control":`no-store`}),e.end(JSON.stringify(o))}const yr=1e4;function br(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!C(n))return $(t,403,`urn:ok:error:loopback-required`,`Request must originate from a loopback address.`),!0;if(!x(e.headers.host))return $(t,403,`urn:ok:error:host-not-allowed`,`Host header is not in the loopback allowlist.`),!0;let r=e.headers.origin;return r!==void 0&&!p(r)?($(t,403,`urn:ok:error:invalid-origin`,`Origin header is not in the loopback allowlist.`),!0):!1}const xr=3e4;function Sr(e,t){let n=e.socket?.remoteAddress;if(n!==void 0&&!C(n)||!x(e.headers.host))return t.destroy(),!0;let r=e.headers.origin;return typeof r==`string`&&!p(r)?(t.destroy(),!0):!1}function Cr(e,t,n,r,i,a){a.add(t),t.once(`close`,()=>a.delete(t));let o=ve({host:r,port:i,timeout:yr});a.add(o),o.once(`close`,()=>a.delete(o));let s=!1,c=n=>{if(!s){if(s=!0,n!==void 0){let t=n.err;console.warn(JSON.stringify({event:n.event,upstreamHost:r,upstreamPort:i,url:e.url,code:t instanceof Error?t.code:void 0,message:t instanceof Error?t.message:void 0}))}try{o.destroy()}catch{}try{t.destroy()}catch{}}};o.once(`connect`,()=>{o.setTimeout(0);let a=[`${e.method??`GET`} ${e.url??`/`} HTTP/1.1`,`host: ${r}:${i}`];for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()!==`host`&&n!==void 0)if(Array.isArray(n))for(let e of n)a.push(`${t}: ${e}`);else a.push(`${t}: ${n}`);try{o.write(`${a.join(`\r
|
|
404
|
-
`)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const wr=[`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`cookie`,`set-cookie`];async function Tr(e){let t=e.upstreamTimeoutMs??yr,n=new Set,r=ge((n,r)=>{br(n,r)||Dr(n,r,e.upstreamHost,e.upstreamPort,t)});r.on(`upgrade`,(t,r,i)=>{Sr(t,r)||Cr(t,r,i,e.upstreamHost,e.upstreamPort,n)}),await new Promise((t,n)=>{let i=e=>n(e);r.once(`error`,i),r.listen(e.listenPort,e.host,()=>{r.off(`error`,i),t()})});let i=r.address();return{httpServer:r,port:typeof i==`object`&&i?i.port:e.listenPort,close:()=>new Promise(e=>{for(let e of n)try{e.destroy()}catch{}n.clear(),r.close(()=>e()),r.closeIdleConnections()})}}function Er(e,t,n){Dr(e,t,n.upstreamHost,n.upstreamPort,n.upstreamTimeoutMs??yr)}function Dr(e,t,n,r,i){let a={...e.headers};delete a.host;for(let e of wr)delete a[e];e.setTimeout(xr,()=>{if(t.headersSent)try{t.end()}catch{}else try{$(t,408,`urn:ok:error:request-timeout`,`Proxy request exceeded the per-request deadline.`,`Slow-loris-class: client did not finish within ${xr/1e3}s.`)}catch{}try{e.socket?.destroy()}catch{}});let o=_e({host:n,port:r,method:e.method,path:e.url,headers:{...a,host:`${n}:${r}`}},e=>{let n={...e.headers};for(let e of wr)delete n[e];t.writeHead(e.statusCode??502,n),e.pipe(t),e.once(`error`,()=>{try{t.end()}catch{}})});i>0&&o.setTimeout(i,()=>{if(!t.headersSent)$(t,504,`urn:ok:error:gateway-timeout`,`Upstream did not respond before the gateway deadline.`,`Upstream timeout: ${i/1e3}s elapsed without a response.`);else try{t.end()}catch{}o.destroy()}),o.on(`error`,()=>{if(!t.headersSent)$(t,502,`urn:ok:error:collab-server-not-running`,`Collab server is unreachable.`,`Upstream connection failed or dropped before a response was received.`);else try{t.end()}catch{}}),e.on(`error`,()=>{o.destroy()}),e.pipe(o)}const Or=39847,kr=39848;async function Ar(e){await Promise.all(e.map(e=>new Promise(t=>{e.close(()=>t())})))}async function jr(e){let{existsSync:t}=await import(`node:fs`),{createServer:n}=await import(`node:http`),{resolve:r}=await import(`node:path`),{acquireUiLock:i,createAssetServeMiddleware:a,createContentFilter:o,readServerLock:s,releaseUiLock:c,updateUiLockPort:l}=await import(`./dist-
|
|
404
|
+
`)}\r\n\r\n`),n.length>0&&o.write(n)}catch(e){c({event:`proxy-upgrade-handshake-write-failed`,err:e});return}o.on(`data`,e=>{t.writable&&t.write(e)}),t.on(`data`,e=>{o.writable&&o.write(e)})}),o.once(`timeout`,()=>{c({event:`proxy-upgrade-upstream-connect-timeout`})}),o.on(`error`,e=>c({event:`proxy-upgrade-upstream-error`,err:e})),t.on(`error`,e=>c({event:`proxy-upgrade-client-error`,err:e})),o.once(`close`,()=>c()),t.once(`close`,()=>c())}const wr=[`connection`,`keep-alive`,`proxy-authenticate`,`proxy-authorization`,`te`,`trailer`,`transfer-encoding`,`upgrade`,`cookie`,`set-cookie`];async function Tr(e){let t=e.upstreamTimeoutMs??yr,n=new Set,r=ge((n,r)=>{br(n,r)||Dr(n,r,e.upstreamHost,e.upstreamPort,t)});r.on(`upgrade`,(t,r,i)=>{Sr(t,r)||Cr(t,r,i,e.upstreamHost,e.upstreamPort,n)}),await new Promise((t,n)=>{let i=e=>n(e);r.once(`error`,i),r.listen(e.listenPort,e.host,()=>{r.off(`error`,i),t()})});let i=r.address();return{httpServer:r,port:typeof i==`object`&&i?i.port:e.listenPort,close:()=>new Promise(e=>{for(let e of n)try{e.destroy()}catch{}n.clear(),r.close(()=>e()),r.closeIdleConnections()})}}function Er(e,t,n){Dr(e,t,n.upstreamHost,n.upstreamPort,n.upstreamTimeoutMs??yr)}function Dr(e,t,n,r,i){let a={...e.headers};delete a.host;for(let e of wr)delete a[e];e.setTimeout(xr,()=>{if(t.headersSent)try{t.end()}catch{}else try{$(t,408,`urn:ok:error:request-timeout`,`Proxy request exceeded the per-request deadline.`,`Slow-loris-class: client did not finish within ${xr/1e3}s.`)}catch{}try{e.socket?.destroy()}catch{}});let o=_e({host:n,port:r,method:e.method,path:e.url,headers:{...a,host:`${n}:${r}`}},e=>{let n={...e.headers};for(let e of wr)delete n[e];t.writeHead(e.statusCode??502,n),e.pipe(t),e.once(`error`,()=>{try{t.end()}catch{}})});i>0&&o.setTimeout(i,()=>{if(!t.headersSent)$(t,504,`urn:ok:error:gateway-timeout`,`Upstream did not respond before the gateway deadline.`,`Upstream timeout: ${i/1e3}s elapsed without a response.`);else try{t.end()}catch{}o.destroy()}),o.on(`error`,()=>{if(!t.headersSent)$(t,502,`urn:ok:error:collab-server-not-running`,`Collab server is unreachable.`,`Upstream connection failed or dropped before a response was received.`);else try{t.end()}catch{}}),e.on(`error`,()=>{o.destroy()}),e.pipe(o)}const Or=39847,kr=39848;async function Ar(e){await Promise.all(e.map(e=>new Promise(t=>{e.close(()=>t())})))}async function jr(e){let{existsSync:t}=await import(`node:fs`),{createServer:n}=await import(`node:http`),{resolve:r}=await import(`node:path`),{acquireUiLock:i,createAssetServeMiddleware:a,createContentFilter:o,readServerLock:s,releaseUiLock:c,updateUiLockPort:l}=await import(`./dist-Bq1Nm7Hl.mjs`),{default:u}=await import(`./build-B4ZT2GMK.mjs`),{resolveContentDir:d,resolveLockDir:p}=await import(`./dist-Bq1Nm7Hl.mjs`),m=d(e.config,e.cwd),_=p(e.cwd);i(_,{port:0,worktreeRoot:e.cwd});let v=import.meta.dirname??new URL(`.`,import.meta.url).pathname,y=[r(v,`public`),r(v,`../../app/dist`),r(v,`../../../app/dist`)].find(e=>t(e)),x=y?u(y,{single:!0,gzip:!0,immutable:!0,extensions:[]}):null,S=t(m)?a({contentFilter:o({projectDir:e.cwd,contentDir:m}),contentSirv:u(m,{dotfiles:!1,dev:!0,extensions:[]}),inlineExtensions:b,assetExtensions:h,blocklistExtensions:f}):null,C=e.port,ee=null,te=(e,t)=>{let n=e.url?.split(`?`)[0];if((n===`/`||n===``)&&(e.url=`/index.html`),!(n?.startsWith(`/api/`)&&br(e,t))){if(n===`/api/config`&&(e.method===`GET`||e.method===`HEAD`)){ee?.();let n=s(_),r=e.headers.host??`localhost:${C}`,i=n&&n.port>0?`ws://${r}/collab`:null,a=JSON.stringify({collabUrl:i,previewUrl:null,port:C});t.setHeader(`Content-Type`,`application/json`),t.setHeader(`Cache-Control`,`no-store`),t.setHeader(`X-Content-Type-Options`,`nosniff`),t.statusCode=200,e.method===`HEAD`?t.end():t.end(a);return}if(n?.startsWith(`/api/`)){ee?.();let r=s(_);if(!r||r.port<=0){$(t,503,`urn:ok:error:collab-server-not-running`,"Collab server not running. Start `ok start` or run `ok status`.",`Path: ${n}`);return}Er(e,t,{upstreamHost:`localhost`,upstreamPort:r.port});return}if(x&&n?.startsWith(`/assets/`)){x(e,t,()=>{S?S(e,t,()=>Mr(t,n)):Mr(t,n)});return}if(S){S(e,t,()=>{x?x(e,t):Mr(t,n)});return}if(x){x(e,t);return}Mr(t,n)}},w=new Set,T=(e,t,n)=>{if(Sr(e,t))return;let r=e.url?.split(`?`)[0]??``;if(r!==`/collab`&&!r.startsWith(`/collab/`)){t.destroy();return}let i=s(_);if(!i||i.port<=0){console.warn(JSON.stringify({event:`ok-ui-upgrade-no-collab-lock`,url:r,reason:"server.lock missing or port unbound — is `ok start` running?"})),t.destroy();return}Cr(e,t,n,`localhost`,i.port,w)},E=()=>{for(let e of w)try{e.destroy()}catch{}w.clear()},ne=e.host===void 0?[`::1`,`127.0.0.1`]:[e.host],D=[],O=e.port,re=e=>e instanceof Error&&e.code===`EADDRINUSE`,ie=async()=>{await Promise.all(D.splice(0).map(e=>new Promise(t=>{try{e.close(()=>t())}catch{t()}})))},ae=async e=>{O=e;for(let e of ne){let t=n(te);t.on(`upgrade`,T),D.push(t),await new Promise((n,r)=>{let i=e=>r(e);t.once(`error`,i),t.listen(O,e,()=>{t.off(`error`,i);let e=t.address();typeof e==`object`&&e&&(O=e.port),n()})})}};try{try{await ae(e.port)}catch(t){if(e.fallbackToKernel===!0&&re(t))await ie(),await ae(0);else throw t}}catch(e){await ie();try{c(_)}catch{}throw e}let oe=O;C=oe,l(_,oe);let k=e.scheduler??g,A=e.safetyNetMs??432e5,j=null,M=!1,N=!1,P=()=>{M||(M=!0,j!==null&&(k.clearTimeout(j),j=null))},F=()=>{if(P(),!N){N=!0;try{c(_)}catch{}}},I=()=>{M||A<=0||(j!==null&&(k.clearTimeout(j),j=null),j=k.setTimeout(()=>{j=null,console.warn(`[ui] safety-net (${A}ms) reached — shutting down (D-025 backstop)`);try{e.onSafetyNet?.()}catch{}E();for(let e of D)try{e.close()}catch{}F()},A))},se=()=>{M||A<=0||I()};return ee=se,I(),{httpServers:D,port:oe,release:F,detachSafetyNet:P,nudgeSafetyNet:se,drainUpgradeSockets:E}}function Mr(e,t){$(e,404,`urn:ok:error:not-found`,`Resource not found.`,t===void 0?void 0:`Path: ${t}`)}function Nr(e,t){if(e!==void 0){let t=Number.parseInt(e,10);if(Number.isNaN(t)||t<0||t>65535)throw Error(`Invalid --port value '${e}'`);return{port:t,fallbackToKernel:!1}}if(t!==void 0&&t!==``){let e=Number.parseInt(t,10);if(Number.isNaN(e)||e<0||e>65535)throw Error(`Invalid PORT env value '${t}'`);return{port:e,fallbackToKernel:!1}}return{port:Or,fallbackToKernel:!0}}async function Pr(e){let t=e.readLock??(async()=>{let{readUiLock:t}=await import(`./dist-Bq1Nm7Hl.mjs`);return t(e.lockDir)}),n=await t();if(!n)throw Error(`UI lock collision reported but the lock disappeared before handling — retry acquiring.`);if(n.port===e.requestedPort&&n.port>0)return{mode:`already-running`,port:n.port};let r=n.port;if(r===0){let n=Date.now()+(e.pollDeadlineMs??2e3),i=e.pollIntervalMs??100;for(;Date.now()<n;){await new Promise(e=>{setTimeout(e,i)});let e=await t();if(e&&e.port>0){r=e.port;break}}if(r===0)throw Error("UI did not bind within 2s; run `ok clean`");if(r===e.requestedPort)return{mode:`already-running`,port:r}}return{mode:`proxy`,handle:await Tr({listenPort:e.requestedPort,host:e.host,upstreamHost:`localhost`,upstreamPort:r}),upstreamPort:r}}function Fr(e){return new i(`ui`).description(`Serve the Open Knowledge React editor UI`).option(`-p, --port <port>`,`UI port (default: $PORT env or ${Or}, kernel-allocated fallback if busy)`).option(`-H, --host <host>`,"UI host. Default: two-socket loopback bind (`[::1]` + `127.0.0.1`) so cross-family collisions fail loud. Pass an explicit host (e.g. `127.0.0.1`, `0.0.0.0`) to bind a single socket on that host.").action(async t=>{let{dim:n}=await import(`./colors-BCE2jNgl.mjs`),{UiLockCollisionError:r}=await import(`./dist-Bq1Nm7Hl.mjs`),{resolveLockDir:i}=await import(`./dist-Bq1Nm7Hl.mjs`),a=e(),o=t.host,s;try{s=Nr(t.port,process.env.PORT)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1;return}let c=s.port;try{let e=await jr({config:a,cwd:process.cwd(),port:c,fallbackToKernel:s.fallbackToKernel,host:o}),t=o===void 0||o===`::`||o===`0.0.0.0`?`localhost`:o;console.log(`${n(`[ui]`)} listening on http://${t}:${e.port}`);let r=!1,i=t=>{if(r)return;r=!0,console.log(n(`\n[ui] Shutting down (${t})`)),e.detachSafetyNet();let i=()=>{try{e.release()}finally{process.exit(process.exitCode??0)}};e.drainUpgradeSockets(),Ar(e.httpServers).then(i,i),setTimeout(i,2e3).unref()};process.once(`SIGINT`,()=>i(`SIGINT`)),process.once(`SIGTERM`,()=>i(`SIGTERM`));return}catch(e){if(!(e instanceof r))throw e;let t=i(process.cwd()),a=o??`localhost`,s;try{s=await Pr({requestedPort:c,host:a,lockDir:t})}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exit(1)}s.mode===`already-running`&&(console.log(`UI already running at http://${a}:${s.port}`),process.exit(0)),console.log(`UI running at http://${a}:${s.upstreamPort}; acting as HTTP proxy on port ${s.handle.port}`);let l=!1,u=e=>{l||(l=!0,console.log(n(`\n[ui-proxy] Shutting down (${e})`)),s.handle.close().finally(()=>process.exit(process.exitCode??0)),setTimeout(()=>process.exit(process.exitCode??0),2e3).unref())};process.once(`SIGINT`,()=>u(`SIGINT`)),process.once(`SIGTERM`,()=>u(`SIGTERM`))}})}function Ir(e){if(!L(e))return{};let t=z(e,`utf-8`).trim();if(t===``)return{};try{let n=JSON.parse(t);if(w(n))return n;throw Error(`${e} root must be a JSON object`)}catch(t){throw t instanceof SyntaxError?Error(`${e} contains invalid JSON: ${t.message}`):t}}function Lr(e){if(!L(e))return{};let t=z(e,`utf-8`).trim();if(t===``)return{};try{let n=Fn(t);if(w(n))return n;throw Error(`${e} root must be a TOML table`)}catch(t){throw Error(`${e} contains invalid TOML: ${t instanceof Error?t.message:String(t)}`)}}function Rr(e,t){R(k(e),{recursive:!0}),B(e,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function zr(e,t){R(k(e),{recursive:!0});let n=Gn(t);B(e,n.endsWith(`
|
|
405
405
|
`)?n:`${n}\n`,`utf-8`)}function Br(e,t){let n;try{n=le(t)}catch{n=P(t)}let r;try{r=ce(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(r?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run \`ok init\`, or pass \`--no-mcp\` to skip MCP config writes.`);let i=k(e);for(;i.length>1&&i!==F;){let t;try{t=le(i)}catch(e){if(e.code===`ENOENT`){i=k(i);continue}throw e}let r=N(n,t);if(r===``||!r.startsWith(`..`)&&!A(r))return;throw Error(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run, or pass \`--no-mcp\`.`)}}const Vr=e=>e!==`project`,Hr=e=>e!==`user`;async function Ur(){let e=await dn({message:`Where should the MCP server be configured?
|
|
406
406
|
`,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 Wr(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??Ur)():`both`}const Gr=`0.0.1`,Kr=`open-knowledge-ui`,qr=[`-y`,`@inkeep/open-knowledge@latest`,`ui`];function Jr(e,t={}){let n=j(e,`.claude`,`launch.json`),r=t.cliPath===void 0?t.mode===`dev`?{name:Kr,runtimeExecutable:`node`,runtimeArgs:[or(),`ui`],port:kr,autoPort:!0}:{name:Kr,runtimeExecutable:`npx`,runtimeArgs:[...qr],port:kr,autoPort:!0}:{name:Kr,runtimeExecutable:t.cliPath,runtimeArgs:[`ui`],port:kr,autoPort:!0};try{if(Br(n,e),!L(n))return R(k(n),{recursive:!0}),B(n,`${JSON.stringify({version:Gr,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let t=z(n,`utf-8`).trim(),i=t?JSON.parse(t):{};if(!w(i))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let a=Array.isArray(i.configurations)?i.configurations:[],o=a.findIndex(e=>w(e)&&e.name===`open-knowledge-ui`);o>=0?a[o]=r:a.push(r);let s={...i,version:i.version??Gr,configurations:a};return B(n,`${JSON.stringify(s,null,2)}\n`,`utf-8`),{action:o>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function Yr(e,t,n){try{return L(e.detectPath?.(t,n)??k(e.configPath(t,n)))}catch{return!1}}function Xr(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)}}if(!i&&!n.skipAvailabilityCheck&&!Yr(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{Br(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`}}let s;try{s=e.format===`toml`?Lr(o):Ir(o)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let c=s[e.topLevelKey]??{},l=c[a],u;try{u=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)}}let d={...s,[e.topLevelKey]:{...c,[a]:u}};try{e.format===`toml`?zr(o,d):Rr(o,d)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}return{editorId:e.id,label:e.label,action:l===void 0?`written`:`overwritten`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}function Zr(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=u(),i=k(n);Br(i,t);let a=L(n)?`overwritten`:`written`;return ue(i,{recursive:!0,force:!0}),R(k(i),{recursive:!0}),se(r,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function Qr(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function $r(e){let t=vr(e.editors),n={mode:`published`,cliPath:e.cliPath,skipAvailabilityCheck:!0};return t.map(t=>Xr(t,``,n,e.home))}function ei(e,t,n,r){let i=ti(e,t,n,r);return i.kind===`present`?i.entry:null}function ti(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};let a;try{a=z(i,`utf-8`)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}if(a.trim()===``)return{kind:`corrupt`,error:`file is empty`};let o;try{o=e.format===`toml`?Lr(i):Ir(i)}catch(e){return{kind:`corrupt`,error:e instanceof Error?e.message:String(e)}}let s=o[e.topLevelKey];if(!w(s))return{kind:`no-entry`};let c=s[e.serverName(t)];return w(c)?{kind:`present`,entry:c}:{kind:`no-entry`}}async function ni(e={}){let t=P(e.cwd??process.cwd()),n=tr(t,{homeDir:e.home}),r=n.projectRoot,i=!L(j(r,`.ok`));n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&console.log(`[ok] Initialized OK at ${r} — opened parent of ${N(r,t)} because it contains a .git folder`);let a={mode:e.devMcp?`dev`:`published`},o=await l(r),c;try{c=Qn(r,{contentDir:n.defaultContentDir})}catch(t){let n=Q.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:o.didInit,claudeDesktopDetected:!1,mcpAction:`failed`,mcpPath:n,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`}}let u=await Wr({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),d=e.editors??ii(r,e.home),f=e.editors??nr.filter(e=>Q[e].projectConfigPath!==void 0),p=vr(d),m=vr(f),h=e.mcp===!1||u===null,g=Array.from(new Map([...p,...h?[]:m].map(e=>[e.id,e])).values()),_=p.filter(t=>Yr(t,r,e.home)),v=[],b=[],x=new Set;for(let t of g){if(h){let n=``;try{n=t.configPath(r,e.home)}catch{}v.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(Vr(u)&&p.includes(t)&&v.push(Xr(t,r,a,e.home)),Hr(u)&&m.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Xr(t,r,a,e.home,n);v.push(i),(i.action===`written`||i.action===`overwritten`)&&(x.add(n),b.push(Zr(t,r)))}}let S=!h&&u!==null&&Hr(u)?m.filter(e=>!e.projectConfigPath).map(e=>e.label):void 0,C=h?[]:_.map(e=>Qr(e,r)).filter(e=>e!==void 0).filter(e=>!x.has(e.path)),ee=_.some(e=>e.id===`claude`)&&!h?Jr(r,a):void 0,te=await(e.installUserSkill??y)({home:e.home}),w=s({home:e.home}),T=h?`skipped-flag`:`skipped-missing`,E=v.find(e=>e.editorId===`claude`)??v[0]??{action:T,configPath:Q.claude.configPath(r,e.home)};return{projectRoot:r,contentCreated:c.created,contentUpdated:c.updated,contentSkipped:c.skipped,editors:v,projectSkills:b,legacyProjectConfigs:C,launchJson:ee,skillInstall:te,didGitInit:o.didInit,claudeDesktopDetected:w,mcpAction:E.action,mcpPath:E.configPath,mcpError:`error`in E?E.error:void 0,projectScopeUnsupportedLabels:S}}function ri(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`),s=e=>{let n=e.configPath.startsWith(t)?N(t,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${n} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${n} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${n} FAILED: ${e.error}`}};e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`);let c=j(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(O(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(O(`Content already present at ${c}/`)),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(O(`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(O(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(O(`MCP server configuration:`));for(let r of e.editors){let i=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),a=r.serverName===`open-knowledge`?``:` (${r.serverName})`,o=r.configScope===`project`?` (project)`:``,c=`${r.label}${o}`,l=` `.repeat(Math.max(1,20-c.length)),u=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${c}${l}${i} ${E(`registered`)}${a}${u}`);break;case`overwritten`:n.push(` ${c}${l}${i} ${E(`updated`)}${a}${u}`);break;case`skipped-missing`:n.push(` ${c}${l}${i} config root missing; skipped`);break;case`failed`:n.push(` ${c}${l}${i} ${ne(`FAILED`)}: ${r.error}`);break;case`skipped-flag`:break}r.editorId===`claude`&&e.launchJson&&n.push(s(e.launchJson))}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(O(`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`failed`:n.push(` ${e}${i}${a} ${ne(`FAILED`)}: ${r.error}`);break}}}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(O(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${E(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${E(`already installed at current version`)}`);break;case`failed`:n.push(` ${D(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${D(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.claudeDesktopDetected&&(n.push(``),n.push(`Claude Desktop App detected. To enable in Claude Chat & Cowork, run: ${O(`ok install-skill`)}`)),e.preview?(n.push(``),n.push(re(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),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(`✓`)} ${O(`Next steps:`)}`),n.push(` 1. Open your editor (${T(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${T(`ok seed`)} — empty repo, Karpathy 3-layer`),n.push(` - ${T(`mcp__open-knowledge__discover`)} — existing repo, extract conventions`),n.push(` 4. Use the MCP workflow tools as you build the wiki:`),n.push(` - ${T(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${T(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${T(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
|
|
407
407
|
`)}function ii(e,t){let n=[];for(let r of nr)Yr(Q[r],e,t)&&n.push(r);return n}function ai(){return new i(`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`).addOption(new r(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).action(async e=>{let t=process.cwd(),n;try{n=await ni({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope})}catch(e){if(e instanceof c){process.stderr.write(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.
|
|
408
|
-
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-
|
|
409
|
-
//# sourceMappingURL=init-
|
|
408
|
+
`),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-DtrIs0gZ.mjs`),{loadConfig:t}=await import(`./loader-CTWe5z9-.mjs`),{resolveContentDir:r}=await import(`./dist-Bq1Nm7Hl.mjs`),{config:i}=t(n.projectRoot),a=r(i,n.projectRoot);n.preview=e({projectDir:n.projectRoot,contentDir:a})}catch(e){n.previewWarning=e instanceof Error?e.message:String(e)}process.stdout.write(`${ri(n,n.projectRoot)}\n`),(n.editors.some(e=>e.action===`failed`)||n.mcpAction===`failed`)&&(process.exitCode=1)})}export{W as A,pt as C,Ye as D,ot as E,Je as O,ut as S,ht as T,ir as _,ri as a,ft as b,Wr as c,Xr as d,$r as f,Q as g,rr as h,ii as i,Te as k,ni as l,nr as m,qr as n,ai as o,Fr as p,ti as r,ei as s,Kr as t,Jr as u,tr as v,dt as w,lt as x,Qn as y};
|
|
409
|
+
//# sourceMappingURL=init-pu_7zCAy.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./loader-DwgxIIbN.mjs";export{e as loadConfig};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Jr as e,Mi as t,Yr as n,f as r,pi as i,yi as a}from"./dist-
|
|
1
|
+
import{Jr as e,Mi as t,Yr as n,f as r,pi as i,yi as a}from"./dist-B_Nlx5d6.mjs";import{t as o}from"./constants-JUZqR_Yu.mjs";import{t as s}from"./is-object-C-4FJ0rP.mjs";import{resolve as c}from"node:path";import{existsSync as l,readFileSync as u}from"node:fs";import{realpath as d}from"node:fs/promises";async function f(e){let t=c(e);try{return await d(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}}var p=t();function m(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];s(a)&&s(i)?n[r]=m(i,a):a!==void 0&&(n[r]=a)}return n}function h(e){if(!l(e))return{value:null,path:e,source:null,doc:null};let t;try{t=u(e,`utf-8`)}catch(t){return console.warn(`[config] Failed to read ${e}: ${t instanceof Error?t.message:t}`),{value:null,path:e,source:null,doc:null}}let n=(0,p.parseDocument)(t);if(n.errors.length>0)return console.warn(`[config] Failed to parse ${e}: ${n.errors.map(e=>e.message).join(`; `)}`),{value:null,path:e,source:t,doc:null};let r=n.toJSON();return s(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}const g=[`include`,`exclude`];function _(e){let t="Run `ok config migrate` to strip the obsolete key from config.yml automatically, or remove it by hand.";return e===`exclude`?[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,t].join(` `):[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,t].join(` `)}function v(e){let t=e.value;if(!s(t))return[];let n=t.content;if(!s(n))return[];let r=[];for(let t of g)if(t in n){let n=[`content`,t],i;e.doc!==null&&e.source!==null&&(i=a({file:e.path,source:e.source,doc:e.doc,path:n})),r.push({code:`REMOVED_KEY`,path:n,redirect:_(t),...i===void 0?{}:{source:i}})}return r}function y(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=a({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function b(t){let a=t??process.cwd(),s=[],l=n(`user`,a),u=e({absPath:l}),d={};u.valid&&u.source!==void 0?(d=m(d,u.value),s.push(l)):u.valid;let f=c(a,`.ok`,o),p=h(f);if(p.value!==null){let e=v(p);if(e.length>0)throw Error(e.map(i).join(`
|
|
2
2
|
|
|
3
3
|
`));d=m(d,p.value),s.push(f)}x(d,[`upload`,`maxBytes`],`streaming uploads have no user-facing cap`),x(d,[`github`,`oauthAppClientId`],`use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID env var instead`),x(d,[`server`,`host`],`use the --host flag or HOST env var instead`),x(d,[`server`,`openOnAgentEdit`]),x(d,[`mcp`,`autoStart`],`to disable auto-start, set OK_MCP_AUTOSTART=0`),x(d,[`mcp`,`tools`,`read_document`,`historyDepth`]),x(d,[`mcp`,`tools`,`grep`,`maxResults`]),x(d,[`mcp`,`tools`,`search`,`maxResults`]),x(d,[`preview`,`baseUrl`],"preview URLs now resolve only to the running UI process — start one with `ok ui`");let g=r.safeParse(d);if(!g.success){let e={code:`SCHEMA_INVALID`,issues:y(g.error.issues,p)};throw Error(i(e))}return{config:g.data,sources:s}}function x(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){if(!s(r))return;r=r[t[e]]}if(!s(r))return;let i=t[t.length-1];if(r[i]===void 0)return;let a=t.join(`.`);console.warn(`[config] ${a} is no longer user-configurable; ${n??`the value is hardcoded in @inkeep/open-knowledge-core`}. Remove the key to silence this warning.`)}function S(e){let t=e.cacheMs??1e3,n=e.loadConfigFn??b,r=new Map,i=new Map,a=f(e.startupCwd);return async o=>{let s=await f(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,S as t};
|
|
4
|
-
//# sourceMappingURL=loader-
|
|
4
|
+
//# sourceMappingURL=loader-DwgxIIbN.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{xt as e}from"./dist-
|
|
1
|
+
import{xt as e}from"./dist-B_Nlx5d6.mjs";import"./constants-JUZqR_Yu.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}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(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};
|
|
3
|
-
//# sourceMappingURL=preview-
|
|
3
|
+
//# sourceMappingURL=preview-Bep4xj-R.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-Bep4xj-R.mjs";export{t as formatPreviewBlock,e as previewContent};
|
package/dist/public/assets/{ActivityModeContent-BA_Hv5zU.js → ActivityModeContent-nwB2ciii.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-d4ec9M69.js","./chunk-CFjPhJqf.js","./compiler-runtime-CVnuRdak.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./preload-helper-2ej06EnG.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{Qn as a,er as o,jn as s,n as c,nt as l,r as u}from"./DocumentContext-DLUOyqhE.js";import{$ as d,A as f,D as p,O as m,Vt as h,_ as g,et as _}from"./doc-hash-CO_0WoMz.js";import{C as v,t as y}from"./button-DBLnjjvQ.js";import{f as b,i as x,m as S,r as C,t as w}from"./agent-presence-8VSgL2U2.js";import{a as T,c as E,i as D,o as O,s as ee,t as te,x as k}from"./dialog-DSzqKgdW.js";import{a as ne}from"./collapsible-L2bca9Ur.js";var re=v(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),A=i(),j=e(n(),1),ie=500,ae=64;async function oe(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new l(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=h.safeParse(r);throw e.success?Error(e.data.title):new l(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=d.safeParse(r);if(!i.success)throw new l(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function se(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r),a;try{a=await i.json()}catch(e){throw new l(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=h.safeParse(a);throw e.success?Error(e.data.title):new l(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=_.safeParse(a);if(!o.success)throw new l(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function ce(e){let t=(0,A.c)(23),{systemProvider:n}=c(),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(`idle`),[s,l]=(0,j.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new x(ae),t[0]=u):u=t[0];let d=(0,j.useRef)(u),f=(0,j.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;o(`loading`),l(null),oe(e).then(r=>{if(f.current!==t)return;let a=ue(n,e);i({...r,writingDocs:a}),o(`ready`)}).catch(e=>{f.current===t&&(l(e instanceof Error?e.message:String(e)),o(`error`))})},t[1]=n,t[2]=p);let m=p,h;t[3]!==e||t[4]!==m?(h=()=>{if(!e){f.current+=1,i(null),o(`idle`),l(null),d.current.clear();return}d.current.clear(),m(e);let t=null,n=g(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},ie))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=m,t[5]=h):h=t[5];let _;t[6]===e?_=t[7]:(_=[e],t[6]=e,t[7]=_),(0,j.useEffect)(h,_);let v,y;t[8]!==e||t[9]!==n?(v=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=ue(n,e);i(e=>!e||le(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},y=[e,n],t[8]=e,t[9]=n,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,j.useEffect)(v,y);let b;t[12]===e?b=t[13]:(b=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=d.current.get(r);if(i!==void 0)return i;let a=await se(e,t,n);return d.current.set(r,a),a},t[12]=e,t[13]=b);let S=b,C;t[14]!==e||t[15]!==m?(C=()=>{e&&m(e)},t[14]=e,t[15]=m,t[16]=C):C=t[16];let w=C,T;return t[17]!==r||t[18]!==s||t[19]!==S||t[20]!==w||t[21]!==a?(T={data:r,status:a,error:s,reload:w,fetchBurstDiff:S},t[17]=r,t[18]=s,t[19]=S,t[20]=w,t[21]=a,t[22]=T):T=t[22],T}function le(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ue(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!w(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var M=r(),de=(0,j.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-d4ec9M69.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function fe(e,t){let n=Math.max(0,t-e);return n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function pe(e){let t=(0,A.c)(38),{burst:n,docName:r,fetchBurstDiff:i}=e,[a,s]=(0,j.useState)(!1),[c,l]=(0,j.useState)(null),[u,d]=(0,j.useState)(null),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(N),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,j.useEffect)(g,_);let v;t[2]!==n.stackIndex||t[3]!==c||t[4]!==r||t[5]!==a||t[6]!==i||t[7]!==f?(v=()=>{let e=!a;s(e),e&&c===null&&!f&&(p(!0),d(null),i(r,n.stackIndex).then(e=>{l(e),p(!1)}).catch(e=>{d(e instanceof Error?e.message:String(e)),p(!1)}))},t[2]=n.stackIndex,t[3]=c,t[4]=r,t[5]=a,t[6]=i,t[7]=f,t[8]=v):v=t[8];let y=v,b=`${a?`Collapse`:`Expand`} burst ${n.stackIndex+1} diff`,x;t[9]===a?x=t[10]:(x=a?(0,M.jsx)(o,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,M.jsx)(ne,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[9]=a,t[10]=x);let S;t[11]!==n.ts||t[12]!==m?(S=fe(n.ts,m),t[11]=n.ts,t[12]=m,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,M.jsx)(`span`,{className:`font-mono`,children:S}),t[14]=S,t[15]=C);let w;t[16]===n.additions?w=t[17]:(w=(0,M.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[16]=n.additions,t[17]=w);let T;t[18]===n.deletions?T=t[19]:(T=(0,M.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[18]=n.deletions,t[19]=T);let E;t[20]!==w||t[21]!==T?(E=(0,M.jsxs)(`span`,{className:`ml-auto font-mono`,children:[w,` `,T]}),t[20]=w,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==a||t[24]!==E||t[25]!==b||t[26]!==x||t[27]!==C||t[28]!==y?(D=(0,M.jsxs)(`button`,{type:`button`,onClick:y,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":a,"aria-label":b,children:[x,C,E]}),t[23]=a,t[24]=E,t[25]=b,t[26]=x,t[27]=C,t[28]=y,t[29]=D):D=t[29];let O;t[30]!==c||t[31]!==a||t[32]!==u||t[33]!==f?(O=a?(0,M.jsx)(`div`,{className:`bg-muted/20`,children:f?(0,M.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`Loading diff`}):u?(0,M.jsxs)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:[`Failed: `,u]}):c===null?(0,M.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`No diff.`}):(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`Loading diff`}),children:(0,M.jsx)(de,{diff:c})})}):null,t[30]=c,t[31]=a,t[32]=u,t[33]=f,t[34]=O):O=t[34];let ee;return t[35]!==D||t[36]!==O?(ee=(0,M.jsxs)(`div`,{className:`border-t border-border/50`,children:[D,O]}),t[35]=D,t[36]=O,t[37]=ee):ee=t[37],ee}function N(){return Date.now()}function me(e,t){let n=Math.max(0,t-e);return n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:`${Math.round(n/36e5)}h ago`}function P(e){let t=(0,A.c)(93),{file:n,sessionAlive:r,isWriting:i,onNavigate:a,onUndoLast:s,onUndoAll:c,fetchBurstDiff:l}=e,[u,d]=(0,j.useState)(!1),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(!1),[x,S]=(0,j.useState)(ge),C,w;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{let e=setInterval(()=>S(Date.now()),3e4);return()=>clearInterval(e)},w=[],t[0]=C,t[1]=w):(C=t[0],w=t[1]),(0,j.useEffect)(C,w),n.bursts.length===0)return null;let k=!r||n.bursts.length===0||_,ie=r?n.bursts.length===0?`Nothing to undo on this file`:null:`Session ended — undo unavailable`,ae;t[2]!==k||t[3]!==n.docName||t[4]!==s?(ae=e=>{e.stopPropagation(),!k&&(v(!0),Promise.resolve(s(n.docName)).finally(()=>v(!1)))},t[2]=k,t[3]=n.docName,t[4]=s,t[5]=ae):ae=t[5];let oe=ae,se;t[6]===k?se=t[7]:(se=e=>{e.stopPropagation(),!k&&g(!0)},t[6]=k,t[7]=se);let ce=se,le;t[8]!==k||t[9]!==n.docName||t[10]!==c?(le=()=>{g(!1),!k&&(v(!0),Promise.resolve(c(n.docName)).finally(()=>v(!1)))},t[8]=k,t[9]=n.docName,t[10]=c,t[11]=le):le=t[11];let ue=le,de;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>d(he),t[12]=de):de=t[12];let fe=u?`Collapse ${n.docName}`:`Expand ${n.docName}`,N;t[13]===u?N=t[14]:(N=u?(0,M.jsx)(o,{className:`size-4`,"aria-hidden":`true`}):(0,M.jsx)(ne,{className:`size-4`,"aria-hidden":`true`}),t[13]=u,t[14]=N);let P;t[15]!==u||t[16]!==fe||t[17]!==N?(P=(0,M.jsx)(`button`,{type:`button`,onClick:de,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":u,"aria-label":fe,"data-testid":`activity-panel-file-row-carrot`,children:N}),t[15]=u,t[16]=fe,t[17]=N,t[18]=P):P=t[18];let F;t[19]!==n.docName||t[20]!==a?(F=()=>a(n.docName),t[19]=n.docName,t[20]=a,t[21]=F):F=t[21];let _e=`Navigate to ${n.docName}`,I;t[22]!==n.docName||t[23]!==F||t[24]!==_e?(I=(0,M.jsx)(`button`,{type:`button`,onClick:F,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":_e,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[22]=n.docName,t[23]=F,t[24]=_e,t[25]=I):I=t[25];let ve=`Undo last edit on ${n.docName}`,ye;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,M.jsx)(b,{className:`size-3.5`,"aria-hidden":`true`}),t[26]=ye):ye=t[26];let L;t[27]!==k||t[28]!==oe||t[29]!==ve?(L=(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:oe,disabled:k,"aria-label":ve,"data-testid":`activity-panel-undo-last`,children:ye})}),t[27]=k,t[28]=oe,t[29]=ve,t[30]=L):L=t[30];let be=ie??`Undo last edit`,R;t[31]===be?R=t[32]:(R=(0,M.jsx)(m,{side:`bottom`,children:be}),t[31]=be,t[32]=R);let z;t[33]!==L||t[34]!==R?(z=(0,M.jsxs)(p,{children:[L,R]}),t[33]=L,t[34]=R,t[35]=z):z=t[35];let xe=`Undo all edits on ${n.docName}`,Se;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,M.jsx)(re,{className:`size-3.5`,"aria-hidden":`true`}),t[36]=Se):Se=t[36];let B;t[37]!==k||t[38]!==ce||t[39]!==xe?(B=(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ce,disabled:k,"aria-label":xe,"data-testid":`activity-panel-undo-all`,children:Se})}),t[37]=k,t[38]=ce,t[39]=xe,t[40]=B):B=t[40];let Ce=ie??`Undo all edits`,V;t[41]===Ce?V=t[42]:(V=(0,M.jsx)(m,{side:`bottom`,children:Ce}),t[41]=Ce,t[42]=V);let H;t[43]!==B||t[44]!==V?(H=(0,M.jsxs)(p,{children:[B,V]}),t[43]=B,t[44]=V,t[45]=H):H=t[45];let U;t[46]===n.additionsTotal?U=t[47]:(U=(0,M.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[46]=n.additionsTotal,t[47]=U);let W;t[48]===n.deletionsTotal?W=t[49]:(W=(0,M.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[48]=n.deletionsTotal,t[49]=W);let G;t[50]!==U||t[51]!==W?(G=(0,M.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[U,` `,W]}),t[50]=U,t[51]=W,t[52]=G):G=t[52];let K;t[53]!==n.lastTs||t[54]!==x?(K=me(n.lastTs,x),t[53]=n.lastTs,t[54]=x,t[55]=K):K=t[55];let q;t[56]===K?q=t[57]:(q=(0,M.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:K}),t[56]=K,t[57]=q);let J;t[58]===i?J=t[59]:(J=i?(0,M.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:`writing`}):null,t[58]=i,t[59]=J);let Y;t[60]!==I||t[61]!==z||t[62]!==H||t[63]!==G||t[64]!==q||t[65]!==J||t[66]!==P?(Y=(0,M.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[P,I,z,H,G,q,J]}),t[60]=I,t[61]=z,t[62]=H,t[63]=G,t[64]=q,t[65]=J,t[66]=P,t[67]=Y):Y=t[67];let X;t[68]!==u||t[69]!==l||t[70]!==n.bursts||t[71]!==n.docName?(X=u?(0,M.jsx)(`div`,{children:n.bursts.map(e=>(0,M.jsx)(pe,{burst:e,docName:n.docName,fetchBurstDiff:l},`${n.docName}:${e.stackIndex}`))}):null,t[68]=u,t[69]=l,t[70]=n.bursts,t[71]=n.docName,t[72]=X):X=t[72];let we;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,M.jsx)(E,{children:`Undo all edits on this file?`}),t[73]=we):we=t[73];let Z;t[74]===n.docName?Z=t[75]:(Z=(0,M.jsx)(`span`,{className:`font-mono text-foreground`,children:n.docName}),t[74]=n.docName,t[75]=Z);let Te=n.bursts.length===1?``:`s`,Q;t[76]!==n.bursts.length||t[77]!==Z||t[78]!==Te?(Q=(0,M.jsxs)(ee,{children:[we,(0,M.jsxs)(T,{children:[`Reverts every change this agent made to`,` `,Z,` this session (`,n.bursts.length,` burst`,Te,`). Other files and writers are unaffected.`]})]}),t[76]=n.bursts.length,t[77]=Z,t[78]=Te,t[79]=Q):Q=t[79];let Ee;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,M.jsx)(y,{type:`button`,variant:`outline`,onClick:()=>g(!1),"data-testid":`activity-panel-undo-all-cancel`,children:`Cancel`}),t[80]=Ee):Ee=t[80];let $;t[81]===ue?$=t[82]:($=(0,M.jsxs)(O,{children:[Ee,(0,M.jsx)(y,{type:`button`,variant:`destructive`,onClick:ue,"data-testid":`activity-panel-undo-all-confirm`,children:`Undo all`})]}),t[81]=ue,t[82]=$);let De;t[83]!==Q||t[84]!==$?(De=(0,M.jsxs)(D,{className:`sm:max-w-md`,children:[Q,$]}),t[83]=Q,t[84]=$,t[85]=De):De=t[85];let Oe;t[86]!==h||t[87]!==De?(Oe=(0,M.jsx)(te,{open:h,onOpenChange:g,children:De}),t[86]=h,t[87]=De,t[88]=Oe):Oe=t[88];let ke;return t[89]!==Y||t[90]!==X||t[91]!==Oe?(ke=(0,M.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Y,X,Oe]}),t[89]=Y,t[90]=X,t[91]=Oe,t[92]=ke):ke=t[92],ke}function he(e){return!e}function ge(){return Date.now()}async function F(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 _e(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function I(e){typeof window>`u`||(window.location.hash=_e(e))}function ve(){let e=(0,A.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[(0,M.jsx)(s,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),(0,M.jsx)(`span`,{className:`text-sm`,children:`Loading agent activity`})]}),e[0]=t):t=e[0],t}function ye(e){let t=(0,A.c)(9),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,M.jsx)(a,{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,M.jsx)(`p`,{className:`text-sm font-medium`,children:`Failed to load activity`}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,M.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,M.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:`Retry`}),t[4]=r,t[5]=c);let l;return t[6]!==s||t[7]!==c?(l=(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function L(){let e=(0,A.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,M.jsx)(`p`,{className:`text-sm italic`,children:`No edits yet.`})}),e[0]=t):t=e[0],t}function be(e){let t=(0,A.c)(9),{onExit:n,showBackButton:r}=e,i;t[0]!==n||t[1]!==r?(i=r?(0,M.jsx)(R,{onClick:n}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,M.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:`Agent activity`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,M.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[i,a]}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,M.jsx)(`p`,{className:`text-center text-sm italic`,children:`Click an agent's avatar in the presence bar to view their session.`})}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,M.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":`Agent activity`,children:[o,s]}),t[7]=o,t[8]=c),c}function R(e){let t=(0,A.c)(6),{onClick:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,M.jsx)(S,{}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":`Back to document view`,"data-testid":`docpanel-exit-agent-mode`,children:r})}),t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,M.jsx)(m,{side:`bottom`,children:`Back to document view`}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,M.jsxs)(p,{children:[i,a]}),t[4]=i,t[5]=o),o}function z(e){let t=(0,A.c)(9),{lastTs:n}=e,[r]=(0,j.useState)(xe),i;t[0]!==n||t[1]!==r?(i=n?Se(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,M.jsx)(`span`,{className:`font-medium`,children:`Session ended`}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=a?(0,M.jsxs)(`span`,{children:[` · `,a]}):null,t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,M.jsx)(`div`,{className:`mt-1 opacity-80`,children:`Undo buttons are disabled — per-session state has been garbage-collected.`}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,M.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:[o,s,c]}),t[7]=s,t[8]=l),l}function xe(){return Date.now()}function Se(e){let t=Math.max(0,e);return t<6e4?`${Math.round(t/1e3)}s ago`:t<36e5?`${Math.round(t/6e4)}m ago`:`${Math.round(t/36e5)}h ago`}function B(e){let t=(0,A.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,M.jsx)(C,{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,M.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function Ce(e){let t=(0,A.c)(22),{data:n,status:r,error:i,reload:a,fetchBurstDiff:o,onExit:s,onNavigate:c,onUndoLast:l,onUndoAll:u,showBackButton:d}=e,f=n?.files?.[0]?.lastTs??null,p;t[0]!==s||t[1]!==d?(p=d?(0,M.jsx)(R,{onClick:s}):null,t[0]=s,t[1]=d,t[2]=p):p=t[2];let m;t[3]!==n||t[4]!==f?(m=n?.agent?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{agent:n.agent}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,M.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?`Active`:f===null?`No edit session yet`:`Ended`,n.files.length>0?` · ${n.files.length} file${n.files.length===1?``:`s`}`:``]})]})]}):(0,M.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,M.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:`Agent activity`})}),t[3]=n,t[4]=f,t[5]=m):m=t[5];let h;t[6]!==p||t[7]!==m?(h=(0,M.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[p,m]}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let g;t[9]!==n||t[10]!==i||t[11]!==o||t[12]!==f||t[13]!==c||t[14]!==u||t[15]!==l||t[16]!==a||t[17]!==r?(g=(0,M.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,M.jsx)(ve,{}):r===`error`&&i?(0,M.jsx)(ye,{error:i,onRetry:a}):n===null?(0,M.jsx)(L,{}):(0,M.jsxs)(M.Fragment,{children:[!n.sessionAlive&&f!==null?(0,M.jsx)(z,{lastTs:f}):null,n.files.length===0?(0,M.jsx)(L,{}):n.files.map(e=>(0,M.jsx)(P,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:c,onUndoLast:l,onUndoAll:u,fetchBurstDiff:o},e.docName))]})}),t[9]=n,t[10]=i,t[11]=o,t[12]=f,t[13]=c,t[14]=u,t[15]=l,t[16]=a,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==h||t[20]!==g?(_=(0,M.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":`Agent activity`,children:[h,g]}),t[19]=h,t[20]=g,t[21]=_):_=t[21],_}function V(e){let t=(0,A.c)(26),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:r}=n,i=r===void 0?!0:r,{docPanelAgentId:a,closeActivityPanel:o}=c(),{openDocumentTransition:s}=u(),{data:l,status:d,error:f,reload:p,fetchBurstDiff:m}=ce(a);if(a===null){let e;return t[2]!==o||t[3]!==i?(e=(0,M.jsx)(be,{onExit:o,showBackButton:i}),t[2]=o,t[3]=i,t[4]=e):e=t[4],e}let h;t[5]===s?h=t[6]:(h=e=>{s(e),I(e)},t[5]=s,t[6]=h);let g=h,_;t[7]!==l||t[8]!==a||t[9]!==p?(_=async e=>{try{await F({connectionId:a,docName:e,scope:`last`,agentName:l?.agent?.displayName}),p()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);k.error(`Undo failed: ${n}`),p()}},t[7]=l,t[8]=a,t[9]=p,t[10]=_):_=t[10];let v=_,y;t[11]!==l||t[12]!==a||t[13]!==p?(y=async e=>{try{await F({connectionId:a,docName:e,scope:`file`,agentName:l?.agent?.displayName}),k.success(`Undone all edits on ${e}`),p()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);k.error(`Undo all failed: ${n}`),p()}},t[11]=l,t[12]=a,t[13]=p,t[14]=y):y=t[14];let b=y,x;return t[15]!==o||t[16]!==l||t[17]!==f||t[18]!==m||t[19]!==g||t[20]!==b||t[21]!==v||t[22]!==p||t[23]!==i||t[24]!==d?(x=(0,M.jsx)(Ce,{data:l,status:d,error:f,reload:p,fetchBurstDiff:m,onExit:o,onNavigate:g,onUndoLast:v,onUndoAll:b,showBackButton:i}),t[15]=o,t[16]=l,t[17]=f,t[18]=m,t[19]=g,t[20]=b,t[21]=v,t[22]=p,t[23]=i,t[24]=d,t[25]=x):x=t[25],x}export{V as ActivityModeContent};
|
|
2
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{t}from"./preload-helper-2ej06EnG.js";import{n,r,t as i}from"./compiler-runtime-CVnuRdak.js";import{Qn as a,er as o,jn as s,n as c,nt as l,r as u}from"./DocumentContext-Bc83ypCd.js";import{$ as d,A as f,D as p,O as m,Vt as h,_ as g,et as _}from"./doc-hash-BrKkCdCz.js";import{C as v,t as y}from"./button-JrGyO3-P.js";import{f as b,i as x,m as S,r as C,t as w}from"./agent-presence-DUe_PdKt.js";import{a as T,c as E,i as D,o as O,s as ee,t as te,x as k}from"./dialog-bA5Nvc2p.js";import{a as ne}from"./collapsible-DfUFsfqv.js";var re=v(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),A=i(),j=e(n(),1),ie=500,ae=64;async function oe(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t),r;try{r=await n.json()}catch(e){throw new l(`Could not parse /api/agent-activity response.`,{cause:e,status:n.status})}if(!n.ok){let e=h.safeParse(r);throw e.success?Error(e.data.title):new l(`/api/agent-activity returned a non-RFC-9457 error response.`,{cause:e.error,status:n.status})}let i=d.safeParse(r);if(!i.success)throw new l(`/api/agent-activity returned a body that did not match AgentActivitySuccessSchema.`,{cause:i.error,status:n.status});return i.data}async function se(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r),a;try{a=await i.json()}catch(e){throw new l(`Could not parse /api/agent-burst-diff response.`,{cause:e,status:i.status})}if(!i.ok){let e=h.safeParse(a);throw e.success?Error(e.data.title):new l(`/api/agent-burst-diff returned a non-RFC-9457 error response.`,{cause:e.error,status:i.status})}let o=_.safeParse(a);if(!o.success)throw new l(`/api/agent-burst-diff returned a body that did not match AgentBurstDiffSuccessSchema.`,{cause:o.error,status:i.status});return o.data.diff}function ce(e){let t=(0,A.c)(23),{systemProvider:n}=c(),[r,i]=(0,j.useState)(null),[a,o]=(0,j.useState)(`idle`),[s,l]=(0,j.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new x(ae),t[0]=u):u=t[0];let d=(0,j.useRef)(u),f=(0,j.useRef)(0),p;t[1]===n?p=t[2]:(p=e=>{let t=f.current+=1;o(`loading`),l(null),oe(e).then(r=>{if(f.current!==t)return;let a=ue(n,e);i({...r,writingDocs:a}),o(`ready`)}).catch(e=>{f.current===t&&(l(e instanceof Error?e.message:String(e)),o(`error`))})},t[1]=n,t[2]=p);let m=p,h;t[3]!==e||t[4]!==m?(h=()=>{if(!e){f.current+=1,i(null),o(`idle`),l(null),d.current.clear();return}d.current.clear(),m(e);let t=null,n=g(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,m(e)},ie))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=m,t[5]=h):h=t[5];let _;t[6]===e?_=t[7]:(_=[e],t[6]=e,t[7]=_),(0,j.useEffect)(h,_);let v,y;t[8]!==e||t[9]!==n?(v=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=ue(n,e);i(e=>!e||le(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},y=[e,n],t[8]=e,t[9]=n,t[10]=v,t[11]=y):(v=t[10],y=t[11]),(0,j.useEffect)(v,y);let b;t[12]===e?b=t[13]:(b=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=d.current.get(r);if(i!==void 0)return i;let a=await se(e,t,n);return d.current.set(r,a),a},t[12]=e,t[13]=b);let S=b,C;t[14]!==e||t[15]!==m?(C=()=>{e&&m(e)},t[14]=e,t[15]=m,t[16]=C):C=t[16];let w=C,T;return t[17]!==r||t[18]!==s||t[19]!==S||t[20]!==w||t[21]!==a?(T={data:r,status:a,error:s,reload:w,fetchBurstDiff:S},t[17]=r,t[18]=s,t[19]=S,t[20]=w,t[21]=a,t[22]=T):T=t[22],T}function le(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ue(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!w(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var M=r(),de=(0,j.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-d4ec9M69.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function fe(e,t){let n=Math.max(0,t-e);return n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function pe(e){let t=(0,A.c)(38),{burst:n,docName:r,fetchBurstDiff:i}=e,[a,s]=(0,j.useState)(!1),[c,l]=(0,j.useState)(null),[u,d]=(0,j.useState)(null),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(N),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,j.useEffect)(g,_);let v;t[2]!==n.stackIndex||t[3]!==c||t[4]!==r||t[5]!==a||t[6]!==i||t[7]!==f?(v=()=>{let e=!a;s(e),e&&c===null&&!f&&(p(!0),d(null),i(r,n.stackIndex).then(e=>{l(e),p(!1)}).catch(e=>{d(e instanceof Error?e.message:String(e)),p(!1)}))},t[2]=n.stackIndex,t[3]=c,t[4]=r,t[5]=a,t[6]=i,t[7]=f,t[8]=v):v=t[8];let y=v,b=`${a?`Collapse`:`Expand`} burst ${n.stackIndex+1} diff`,x;t[9]===a?x=t[10]:(x=a?(0,M.jsx)(o,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,M.jsx)(ne,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[9]=a,t[10]=x);let S;t[11]!==n.ts||t[12]!==m?(S=fe(n.ts,m),t[11]=n.ts,t[12]=m,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,M.jsx)(`span`,{className:`font-mono`,children:S}),t[14]=S,t[15]=C);let w;t[16]===n.additions?w=t[17]:(w=(0,M.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[16]=n.additions,t[17]=w);let T;t[18]===n.deletions?T=t[19]:(T=(0,M.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[18]=n.deletions,t[19]=T);let E;t[20]!==w||t[21]!==T?(E=(0,M.jsxs)(`span`,{className:`ml-auto font-mono`,children:[w,` `,T]}),t[20]=w,t[21]=T,t[22]=E):E=t[22];let D;t[23]!==a||t[24]!==E||t[25]!==b||t[26]!==x||t[27]!==C||t[28]!==y?(D=(0,M.jsxs)(`button`,{type:`button`,onClick:y,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":a,"aria-label":b,children:[x,C,E]}),t[23]=a,t[24]=E,t[25]=b,t[26]=x,t[27]=C,t[28]=y,t[29]=D):D=t[29];let O;t[30]!==c||t[31]!==a||t[32]!==u||t[33]!==f?(O=a?(0,M.jsx)(`div`,{className:`bg-muted/20`,children:f?(0,M.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`Loading diff`}):u?(0,M.jsxs)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:[`Failed: `,u]}):c===null?(0,M.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`No diff.`}):(0,M.jsx)(j.Suspense,{fallback:(0,M.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`Loading diff`}),children:(0,M.jsx)(de,{diff:c})})}):null,t[30]=c,t[31]=a,t[32]=u,t[33]=f,t[34]=O):O=t[34];let ee;return t[35]!==D||t[36]!==O?(ee=(0,M.jsxs)(`div`,{className:`border-t border-border/50`,children:[D,O]}),t[35]=D,t[36]=O,t[37]=ee):ee=t[37],ee}function N(){return Date.now()}function me(e,t){let n=Math.max(0,t-e);return n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:`${Math.round(n/36e5)}h ago`}function P(e){let t=(0,A.c)(93),{file:n,sessionAlive:r,isWriting:i,onNavigate:a,onUndoLast:s,onUndoAll:c,fetchBurstDiff:l}=e,[u,d]=(0,j.useState)(!1),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(!1),[x,S]=(0,j.useState)(ge),C,w;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{let e=setInterval(()=>S(Date.now()),3e4);return()=>clearInterval(e)},w=[],t[0]=C,t[1]=w):(C=t[0],w=t[1]),(0,j.useEffect)(C,w),n.bursts.length===0)return null;let k=!r||n.bursts.length===0||_,ie=r?n.bursts.length===0?`Nothing to undo on this file`:null:`Session ended — undo unavailable`,ae;t[2]!==k||t[3]!==n.docName||t[4]!==s?(ae=e=>{e.stopPropagation(),!k&&(v(!0),Promise.resolve(s(n.docName)).finally(()=>v(!1)))},t[2]=k,t[3]=n.docName,t[4]=s,t[5]=ae):ae=t[5];let oe=ae,se;t[6]===k?se=t[7]:(se=e=>{e.stopPropagation(),!k&&g(!0)},t[6]=k,t[7]=se);let ce=se,le;t[8]!==k||t[9]!==n.docName||t[10]!==c?(le=()=>{g(!1),!k&&(v(!0),Promise.resolve(c(n.docName)).finally(()=>v(!1)))},t[8]=k,t[9]=n.docName,t[10]=c,t[11]=le):le=t[11];let ue=le,de;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>d(he),t[12]=de):de=t[12];let fe=u?`Collapse ${n.docName}`:`Expand ${n.docName}`,N;t[13]===u?N=t[14]:(N=u?(0,M.jsx)(o,{className:`size-4`,"aria-hidden":`true`}):(0,M.jsx)(ne,{className:`size-4`,"aria-hidden":`true`}),t[13]=u,t[14]=N);let P;t[15]!==u||t[16]!==fe||t[17]!==N?(P=(0,M.jsx)(`button`,{type:`button`,onClick:de,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":u,"aria-label":fe,"data-testid":`activity-panel-file-row-carrot`,children:N}),t[15]=u,t[16]=fe,t[17]=N,t[18]=P):P=t[18];let F;t[19]!==n.docName||t[20]!==a?(F=()=>a(n.docName),t[19]=n.docName,t[20]=a,t[21]=F):F=t[21];let _e=`Navigate to ${n.docName}`,I;t[22]!==n.docName||t[23]!==F||t[24]!==_e?(I=(0,M.jsx)(`button`,{type:`button`,onClick:F,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":_e,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[22]=n.docName,t[23]=F,t[24]=_e,t[25]=I):I=t[25];let ve=`Undo last edit on ${n.docName}`,ye;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,M.jsx)(b,{className:`size-3.5`,"aria-hidden":`true`}),t[26]=ye):ye=t[26];let L;t[27]!==k||t[28]!==oe||t[29]!==ve?(L=(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:oe,disabled:k,"aria-label":ve,"data-testid":`activity-panel-undo-last`,children:ye})}),t[27]=k,t[28]=oe,t[29]=ve,t[30]=L):L=t[30];let be=ie??`Undo last edit`,R;t[31]===be?R=t[32]:(R=(0,M.jsx)(m,{side:`bottom`,children:be}),t[31]=be,t[32]=R);let z;t[33]!==L||t[34]!==R?(z=(0,M.jsxs)(p,{children:[L,R]}),t[33]=L,t[34]=R,t[35]=z):z=t[35];let xe=`Undo all edits on ${n.docName}`,Se;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,M.jsx)(re,{className:`size-3.5`,"aria-hidden":`true`}),t[36]=Se):Se=t[36];let B;t[37]!==k||t[38]!==ce||t[39]!==xe?(B=(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ce,disabled:k,"aria-label":xe,"data-testid":`activity-panel-undo-all`,children:Se})}),t[37]=k,t[38]=ce,t[39]=xe,t[40]=B):B=t[40];let Ce=ie??`Undo all edits`,V;t[41]===Ce?V=t[42]:(V=(0,M.jsx)(m,{side:`bottom`,children:Ce}),t[41]=Ce,t[42]=V);let H;t[43]!==B||t[44]!==V?(H=(0,M.jsxs)(p,{children:[B,V]}),t[43]=B,t[44]=V,t[45]=H):H=t[45];let U;t[46]===n.additionsTotal?U=t[47]:(U=(0,M.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[46]=n.additionsTotal,t[47]=U);let W;t[48]===n.deletionsTotal?W=t[49]:(W=(0,M.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[48]=n.deletionsTotal,t[49]=W);let G;t[50]!==U||t[51]!==W?(G=(0,M.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[U,` `,W]}),t[50]=U,t[51]=W,t[52]=G):G=t[52];let K;t[53]!==n.lastTs||t[54]!==x?(K=me(n.lastTs,x),t[53]=n.lastTs,t[54]=x,t[55]=K):K=t[55];let q;t[56]===K?q=t[57]:(q=(0,M.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:K}),t[56]=K,t[57]=q);let J;t[58]===i?J=t[59]:(J=i?(0,M.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:`writing`}):null,t[58]=i,t[59]=J);let Y;t[60]!==I||t[61]!==z||t[62]!==H||t[63]!==G||t[64]!==q||t[65]!==J||t[66]!==P?(Y=(0,M.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[P,I,z,H,G,q,J]}),t[60]=I,t[61]=z,t[62]=H,t[63]=G,t[64]=q,t[65]=J,t[66]=P,t[67]=Y):Y=t[67];let X;t[68]!==u||t[69]!==l||t[70]!==n.bursts||t[71]!==n.docName?(X=u?(0,M.jsx)(`div`,{children:n.bursts.map(e=>(0,M.jsx)(pe,{burst:e,docName:n.docName,fetchBurstDiff:l},`${n.docName}:${e.stackIndex}`))}):null,t[68]=u,t[69]=l,t[70]=n.bursts,t[71]=n.docName,t[72]=X):X=t[72];let we;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,M.jsx)(E,{children:`Undo all edits on this file?`}),t[73]=we):we=t[73];let Z;t[74]===n.docName?Z=t[75]:(Z=(0,M.jsx)(`span`,{className:`font-mono text-foreground`,children:n.docName}),t[74]=n.docName,t[75]=Z);let Te=n.bursts.length===1?``:`s`,Q;t[76]!==n.bursts.length||t[77]!==Z||t[78]!==Te?(Q=(0,M.jsxs)(ee,{children:[we,(0,M.jsxs)(T,{children:[`Reverts every change this agent made to`,` `,Z,` this session (`,n.bursts.length,` burst`,Te,`). Other files and writers are unaffected.`]})]}),t[76]=n.bursts.length,t[77]=Z,t[78]=Te,t[79]=Q):Q=t[79];let Ee;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,M.jsx)(y,{type:`button`,variant:`outline`,onClick:()=>g(!1),"data-testid":`activity-panel-undo-all-cancel`,children:`Cancel`}),t[80]=Ee):Ee=t[80];let $;t[81]===ue?$=t[82]:($=(0,M.jsxs)(O,{children:[Ee,(0,M.jsx)(y,{type:`button`,variant:`destructive`,onClick:ue,"data-testid":`activity-panel-undo-all-confirm`,children:`Undo all`})]}),t[81]=ue,t[82]=$);let De;t[83]!==Q||t[84]!==$?(De=(0,M.jsxs)(D,{className:`sm:max-w-md`,children:[Q,$]}),t[83]=Q,t[84]=$,t[85]=De):De=t[85];let Oe;t[86]!==h||t[87]!==De?(Oe=(0,M.jsx)(te,{open:h,onOpenChange:g,children:De}),t[86]=h,t[87]=De,t[88]=Oe):Oe=t[88];let ke;return t[89]!==Y||t[90]!==X||t[91]!==Oe?(ke=(0,M.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Y,X,Oe]}),t[89]=Y,t[90]=X,t[91]=Oe,t[92]=ke):ke=t[92],ke}function he(e){return!e}function ge(){return Date.now()}async function F(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 _e(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function I(e){typeof window>`u`||(window.location.hash=_e(e))}function ve(){let e=(0,A.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[(0,M.jsx)(s,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),(0,M.jsx)(`span`,{className:`text-sm`,children:`Loading agent activity`})]}),e[0]=t):t=e[0],t}function ye(e){let t=(0,A.c)(9),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,M.jsx)(a,{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,M.jsx)(`p`,{className:`text-sm font-medium`,children:`Failed to load activity`}),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=(0,M.jsxs)(`div`,{className:`space-y-1`,children:[o,(0,M.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,M.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:`Retry`}),t[4]=r,t[5]=c);let l;return t[6]!==s||t[7]!==c?(l=(0,M.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function L(){let e=(0,A.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,M.jsx)(`p`,{className:`text-sm italic`,children:`No edits yet.`})}),e[0]=t):t=e[0],t}function be(e){let t=(0,A.c)(9),{onExit:n,showBackButton:r}=e,i;t[0]!==n||t[1]!==r?(i=r?(0,M.jsx)(R,{onClick:n}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,M.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:`Agent activity`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,M.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[i,a]}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,M.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,M.jsx)(`p`,{className:`text-center text-sm italic`,children:`Click an agent's avatar in the presence bar to view their session.`})}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,M.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":`Agent activity`,children:[o,s]}),t[7]=o,t[8]=c),c}function R(e){let t=(0,A.c)(6),{onClick:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,M.jsx)(S,{}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=(0,M.jsx)(f,{asChild:!0,children:(0,M.jsx)(y,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":`Back to document view`,"data-testid":`docpanel-exit-agent-mode`,children:r})}),t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,M.jsx)(m,{side:`bottom`,children:`Back to document view`}),t[3]=a):a=t[3];let o;return t[4]===i?o=t[5]:(o=(0,M.jsxs)(p,{children:[i,a]}),t[4]=i,t[5]=o),o}function z(e){let t=(0,A.c)(9),{lastTs:n}=e,[r]=(0,j.useState)(xe),i;t[0]!==n||t[1]!==r?(i=n?Se(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,M.jsx)(`span`,{className:`font-medium`,children:`Session ended`}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=a?(0,M.jsxs)(`span`,{children:[` · `,a]}):null,t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,M.jsx)(`div`,{className:`mt-1 opacity-80`,children:`Undo buttons are disabled — per-session state has been garbage-collected.`}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,M.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:[o,s,c]}),t[7]=s,t[8]=l),l}function xe(){return Date.now()}function Se(e){let t=Math.max(0,e);return t<6e4?`${Math.round(t/1e3)}s ago`:t<36e5?`${Math.round(t/6e4)}m ago`:`${Math.round(t/36e5)}h ago`}function B(e){let t=(0,A.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,M.jsx)(C,{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,M.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function Ce(e){let t=(0,A.c)(22),{data:n,status:r,error:i,reload:a,fetchBurstDiff:o,onExit:s,onNavigate:c,onUndoLast:l,onUndoAll:u,showBackButton:d}=e,f=n?.files?.[0]?.lastTs??null,p;t[0]!==s||t[1]!==d?(p=d?(0,M.jsx)(R,{onClick:s}):null,t[0]=s,t[1]=d,t[2]=p):p=t[2];let m;t[3]!==n||t[4]!==f?(m=n?.agent?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(B,{agent:n.agent}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,M.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?`Active`:f===null?`No edit session yet`:`Ended`,n.files.length>0?` · ${n.files.length} file${n.files.length===1?``:`s`}`:``]})]})]}):(0,M.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,M.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:`Agent activity`})}),t[3]=n,t[4]=f,t[5]=m):m=t[5];let h;t[6]!==p||t[7]!==m?(h=(0,M.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[p,m]}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let g;t[9]!==n||t[10]!==i||t[11]!==o||t[12]!==f||t[13]!==c||t[14]!==u||t[15]!==l||t[16]!==a||t[17]!==r?(g=(0,M.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,M.jsx)(ve,{}):r===`error`&&i?(0,M.jsx)(ye,{error:i,onRetry:a}):n===null?(0,M.jsx)(L,{}):(0,M.jsxs)(M.Fragment,{children:[!n.sessionAlive&&f!==null?(0,M.jsx)(z,{lastTs:f}):null,n.files.length===0?(0,M.jsx)(L,{}):n.files.map(e=>(0,M.jsx)(P,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:c,onUndoLast:l,onUndoAll:u,fetchBurstDiff:o},e.docName))]})}),t[9]=n,t[10]=i,t[11]=o,t[12]=f,t[13]=c,t[14]=u,t[15]=l,t[16]=a,t[17]=r,t[18]=g):g=t[18];let _;return t[19]!==h||t[20]!==g?(_=(0,M.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":`Agent activity`,children:[h,g]}),t[19]=h,t[20]=g,t[21]=_):_=t[21],_}function V(e){let t=(0,A.c)(26),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{showBackButton:r}=n,i=r===void 0?!0:r,{docPanelAgentId:a,closeActivityPanel:o}=c(),{openDocumentTransition:s}=u(),{data:l,status:d,error:f,reload:p,fetchBurstDiff:m}=ce(a);if(a===null){let e;return t[2]!==o||t[3]!==i?(e=(0,M.jsx)(be,{onExit:o,showBackButton:i}),t[2]=o,t[3]=i,t[4]=e):e=t[4],e}let h;t[5]===s?h=t[6]:(h=e=>{s(e),I(e)},t[5]=s,t[6]=h);let g=h,_;t[7]!==l||t[8]!==a||t[9]!==p?(_=async e=>{try{await F({connectionId:a,docName:e,scope:`last`,agentName:l?.agent?.displayName}),p()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);k.error(`Undo failed: ${n}`),p()}},t[7]=l,t[8]=a,t[9]=p,t[10]=_):_=t[10];let v=_,y;t[11]!==l||t[12]!==a||t[13]!==p?(y=async e=>{try{await F({connectionId:a,docName:e,scope:`file`,agentName:l?.agent?.displayName}),k.success(`Undone all edits on ${e}`),p()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);k.error(`Undo all failed: ${n}`),p()}},t[11]=l,t[12]=a,t[13]=p,t[14]=y):y=t[14];let b=y,x;return t[15]!==o||t[16]!==l||t[17]!==f||t[18]!==m||t[19]!==g||t[20]!==b||t[21]!==v||t[22]!==p||t[23]!==i||t[24]!==d?(x=(0,M.jsx)(Ce,{data:l,status:d,error:f,reload:p,fetchBurstDiff:m,onExit:o,onNavigate:g,onUndoLast:v,onUndoAll:b,showBackButton:i}),t[15]=o,t[16]=l,t[17]=f,t[18]=m,t[19]=g,t[20]=b,t[21]=v,t[22]=p,t[23]=i,t[24]=d,t[25]=x):x=t[25],x}export{V as ActivityModeContent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{o as e}from"./chunk-CFjPhJqf.js";import{n as t,r as n,t as r}from"./compiler-runtime-CVnuRdak.js";import{i as ee,r as i,t as a}from"./checkbox-CTrUepCv.js";import{t as o}from"./button-JrGyO3-P.js";import{a as s,c,i as l,n as u,o as d,s as f,t as p,x as m}from"./dialog-bA5Nvc2p.js";import{a as h,i as g,n as _,r as v,t as te}from"./collapsible-DfUFsfqv.js";import{n as ne,r as y,t as re}from"./project-paths-DKT5BePl.js";import{t as ie}from"./textarea-CQGiqhkV.js";var ae=r(),b=e(t(),1),x=n(),oe=750,se={root:{id:`ZWolSV`},home:{id:`GgQgML`},"home-documents":{id:`HRU-eL`},"home-desktop":{id:`mYLRjR`},"home-downloads":{id:`wlwXUk`},"volumes-mount":{id:`AMyJts`},"drive-root":{id:`M3ytY_`}},ce={error:e=>m.error(e)};function S(e){let t=(0,ae.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{store:r,toast:ee,payload:i}=n,a=r===void 0?y:r,o=ee===void 0?ce:ee,s;t[2]!==i||t[3]!==a?(s=i??a.getSnapshot(),t[2]=i,t[3]=a,t[4]=s):s=t[4];let c=s;if(!c)return null;let l;return t[5]!==c||t[6]!==a||t[7]!==o?(l=(0,x.jsx)(C,{payload:c,store:a,toast:o}),t[5]=c,t[6]=a,t[7]=o,t[8]=l):l=t[8],l}function C(e){let t=(0,ae.c)(109),{payload:n,store:r,toast:m}=e,{_:h}=ee(),_=(0,b.useId)(),[v,te]=(0,b.useState)(n.defaultContentDir),[y,ce]=(0,b.useState)(``),S;t[0]===n.editorOptions?S=t[1]:(S=()=>new Set(n.editorOptions.map(le)),t[0]=n.editorOptions,t[1]=S);let[C,de]=(0,b.useState)(S),[fe,pe]=(0,b.useState)(null),[w,me]=(0,b.useState)(!1),[he,ge]=(0,b.useState)(null),_e,ve;t[2]!==h||t[3]!==v?(_e=()=>{if(!re(v)){pe(null);return}let e=!1,t=setTimeout(()=>{let t=window.okDesktop;t&&t.onboarding.probeContent({contentDir:v}).then(t=>{e||pe(t)}).catch(t=>{e||pe({ok:!1,error:t instanceof Error?t.message:h({id:`snrVQ7`})})})},oe);return()=>{e=!0,clearTimeout(t)}},ve=[v,h],t[2]=h,t[3]=v,t[4]=_e,t[5]=ve):(_e=t[4],ve=t[5]),(0,b.useEffect)(_e,ve);let ye;t[6]===v?ye=t[7]:(ye=re(v),t[6]=v,t[7]=ye);let T=ye,E=w||!T,be=n.projectDir,xe;t[8]!==n.pickedPath||t[9]!==n.projectDir?(xe=ne(n.projectDir,n.pickedPath)??n.pickedPath,t[8]=n.pickedPath,t[9]=n.projectDir,t[10]=xe):xe=t[10];let Se=xe,D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=function(e){de(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[11]=D):D=t[11];let Ce=D,O;t[12]!==h||t[13]!==n.projectDir?(O=async function(){let e=window.okDesktop;if(!e)return;let t;try{t=await e.dialog.openFolder({defaultPath:n.projectDir})}catch(e){let t=e;ge(t instanceof Error?t.message:h({id:`P-ye9o`}));return}if(t===null)return;let r=ne(n.projectDir,t);if(r===null){ge(h({id:`UTZ97u`}));return}ge(null),te(r)},t[12]=h,t[13]=n.projectDir,t[14]=O):O=t[14];let we=O,k;t[15]!==y||t[16]!==v||t[17]!==C||t[18]!==r||t[19]!==m?(k=async function(){me(!0);let e=await r.confirm({initGit:!0,contentDir:v,additionalIgnores:y,editorIds:Array.from(C)});e.ok||(m.error(e.error),me(!1))},t[15]=y,t[16]=v,t[17]=C,t[18]=r,t[19]=m,t[20]=k):k=t[20];let Te=k,A;t[21]!==Te||t[22]!==E?(A=function(e){e.preventDefault(),!E&&Te()},t[21]=Te,t[22]=E,t[23]=A):A=t[23];let Ee=A,j;t[24]!==r||t[25]!==m?(j=async function(){me(!0);let e=await r.cancel();e.ok||(m.error(e.error),me(!1))},t[24]=r,t[25]=m,t[26]=j):j=t[26];let M=j,De;t[27]!==w||t[28]!==M?(De=function(e){!e&&!w&&M()},t[27]=w,t[28]=M,t[29]=De):De=t[29];let Oe=De,ke;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,x.jsx)(c,{children:(0,x.jsx)(i,{id:`pAlxX6`})}),t[30]=ke):ke=t[30];let Ae;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,x.jsxs)(f,{children:[ke,(0,x.jsx)(s,{children:(0,x.jsx)(i,{id:`fX82Jn`,components:{0:(0,x.jsx)(`code`,{})}})})]}),t[31]=Ae):Ae=t[31];let N;t[32]!==n.gitRootPromoted||t[33]!==Se||t[34]!==be?(N=n.gitRootPromoted?(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,x.jsx)(i,{id:`zXZ0sB`,values:{projectDir:be,pickedRelative:Se},components:{0:(0,x.jsx)(`code`,{}),1:(0,x.jsx)(`code`,{}),2:(0,x.jsx)(`code`,{}),3:(0,x.jsx)(`code`,{}),4:(0,x.jsx)(`code`,{})}})}):null,t[32]=n.gitRootPromoted,t[33]=Se,t[34]=be,t[35]=N):N=t[35];let P;t[36]!==h||t[37]!==n.warnings?(P=n.warnings.length>0?(0,x.jsx)(`div`,{role:`alert`,className:`rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-200`,children:n.warnings.map(e=>(0,x.jsx)(`p`,{className:`mb-1 last:mb-0`,children:h(se[e.kind])},e.kind))}):null,t[36]=h,t[37]=n.warnings,t[38]=P):P=t[38];let je;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,x.jsx)(`label`,{htmlFor:`consent-content-dir`,className:`text-sm font-medium`,children:(0,x.jsx)(i,{id:`ll2yNl`})}),t[39]=je):je=t[39];let Me;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(Me=e=>{te(e.target.value),ge(null)},t[40]=Me):Me=t[40];let Ne=!T,F;t[41]!==w||t[42]!==v||t[43]!==Ne?(F=(0,x.jsx)(g,{id:`consent-content-dir`,value:v,onChange:Me,disabled:w,"aria-invalid":Ne,"data-testid":`consent-content-dir`,className:`flex-1`}),t[41]=w,t[42]=v,t[43]=Ne,t[44]=F):F=t[44];let I;t[45]===we?I=t[46]:(I=()=>void we(),t[45]=we,t[46]=I);let Pe;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,x.jsx)(i,{id:`O2UpM1`}),t[47]=Pe):Pe=t[47];let L;t[48]!==w||t[49]!==I?(L=(0,x.jsx)(o,{type:`button`,variant:`outline`,disabled:w,onClick:I,"data-testid":`consent-content-dir-browse`,children:Pe}),t[48]=w,t[49]=I,t[50]=L):L=t[50];let R;t[51]!==F||t[52]!==L?(R=(0,x.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[F,L]}),t[51]=F,t[52]=L,t[53]=R):R=t[53];let z;t[54]!==he||t[55]!==T||t[56]!==fe?(z=he===null?T?(0,x.jsx)(ue,{probe:fe}):(0,x.jsx)(`p`,{className:`text-1sm text-destructive`,"data-testid":`consent-content-dir-error`,children:(0,x.jsx)(i,{id:`U5Spo9`})}):(0,x.jsx)(`p`,{className:`text-1sm text-destructive`,"data-testid":`consent-content-dir-browse-error`,children:he}),t[54]=he,t[55]=T,t[56]=fe,t[57]=z):z=t[57];let B;t[58]!==R||t[59]!==z?(B=(0,x.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[je,R,z]}),t[58]=R,t[59]=z,t[60]=B):B=t[60];let Fe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,x.jsx)(`label`,{htmlFor:`consent-additional-ignores`,className:`text-sm font-medium`,children:(0,x.jsx)(i,{id:`3zyg_A`})}),t[61]=Fe):Fe=t[61];let Ie;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=e=>ce(e.target.value),t[62]=Ie):Ie=t[62];let V;t[63]!==y||t[64]!==w?(V=(0,x.jsx)(ie,{id:`consent-additional-ignores`,value:y,onChange:Ie,disabled:w,placeholder:`tmp/
|
|
2
|
+
*.draft.md`,rows:3,"data-testid":`consent-additional-ignores`}),t[63]=y,t[64]=w,t[65]=V):V=t[65];let Le;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,x.jsx)(i,{id:`aE2_XM`,components:{0:(0,x.jsx)(`code`,{})}})}),t[66]=Le):Le=t[66];let H;t[67]===V?H=t[68]:(H=(0,x.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[Fe,V,Le]}),t[67]=V,t[68]=H);let U;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,x.jsx)(`legend`,{className:`text-sm font-medium`,children:(0,x.jsx)(i,{id:`0YEbfk`})}),t[69]=U):U=t[69];let Re;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,x.jsx)(i,{id:`eSu2Xn`,components:{0:(0,x.jsx)(`code`,{})}})}),t[70]=Re):Re=t[70];let W;if(t[71]!==w||t[72]!==C||t[73]!==n.editorOptions){let e;t[75]!==w||t[76]!==C?(e=e=>{let t=`consent-editor-${e.id}-cb`;return(0,x.jsxs)(`label`,{htmlFor:t,className:`flex items-center gap-2 text-sm`,children:[(0,x.jsx)(a,{id:t,checked:C.has(e.id),onCheckedChange:()=>Ce(e.id),disabled:w,"data-testid":`consent-editor-${e.id}`}),(0,x.jsx)(`span`,{children:e.label}),(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`consent-editor-${e.id}-scope`,children:e.hasProjectConfig?(0,x.jsx)(i,{id:`cKjLuT`}):(0,x.jsx)(i,{id:`nYKerc`})})]},e.id)},t[75]=w,t[76]=C,t[77]=e):e=t[77],W=n.editorOptions.map(e),t[71]=w,t[72]=C,t[73]=n.editorOptions,t[74]=W}else W=t[74];let G;t[78]===W?G=t[79]:(G=(0,x.jsxs)(`fieldset`,{className:`flex flex-col space-y-2 pb-2`,children:[U,Re,W]}),t[78]=W,t[79]=G);let K;t[80]!==_||t[81]!==Ee||t[82]!==B||t[83]!==H||t[84]!==G?(K=(0,x.jsxs)(`form`,{id:_,onSubmit:Ee,"data-testid":`consent-form`,className:`space-y-4`,children:[B,H,G]}),t[80]=_,t[81]=Ee,t[82]=B,t[83]=H,t[84]=G,t[85]=K):K=t[85];let q;t[86]!==N||t[87]!==P||t[88]!==K?(q=(0,x.jsxs)(u,{className:`space-y-4`,children:[N,P,K]}),t[86]=N,t[87]=P,t[88]=K,t[89]=q):q=t[89];let J;t[90]===M?J=t[91]:(J=()=>void M(),t[90]=M,t[91]=J);let ze;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,x.jsx)(i,{id:`dEgA5A`}),t[92]=ze):ze=t[92];let Y;t[93]!==w||t[94]!==J?(Y=(0,x.jsx)(o,{type:`button`,variant:`outline`,className:`font-mono uppercase`,onClick:J,disabled:w,"data-testid":`consent-cancel`,children:ze}),t[93]=w,t[94]=J,t[95]=Y):Y=t[95];let Be;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,x.jsx)(i,{id:`tXkhj_`}),t[96]=Be):Be=t[96];let X;t[97]!==_||t[98]!==E?(X=(0,x.jsx)(o,{type:`submit`,form:_,disabled:E,"data-testid":`consent-start`,children:Be}),t[97]=_,t[98]=E,t[99]=X):X=t[99];let Z;t[100]!==Y||t[101]!==X?(Z=(0,x.jsxs)(d,{children:[Y,X]}),t[100]=Y,t[101]=X,t[102]=Z):Z=t[102];let Q;t[103]!==q||t[104]!==Z?(Q=(0,x.jsxs)(l,{className:`sm:max-w-lg`,children:[Ae,q,Z]}),t[103]=q,t[104]=Z,t[105]=Q):Q=t[105];let $;return t[106]!==Oe||t[107]!==Q?($=(0,x.jsx)(p,{open:!0,onOpenChange:Oe,children:Q}),t[106]=Oe,t[107]=Q,t[108]=$):$=t[108],$}function le(e){return e.id}function ue(e){let t=(0,ae.c)(24),{probe:n}=e,{_:r}=ee();if(n===null){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`consent-preview`,children:(0,x.jsx)(i,{id:`DiFKSL`})}),t[0]=e):e=t[0],e}if(!n.ok){let e=n.error,r;return t[1]===e?r=t[2]:(r=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`consent-preview`,children:(0,x.jsx)(i,{id:`9fvog2`,values:{errorDetail:e}})}),t[1]=e,t[2]=r),r}let a=n.truncated?`≥ 50,000`:String(n.count),o;t[3]!==r||t[4]!==a?(o=r({id:`MV-Dkb`,values:{countDisplay:a}}),t[3]=r,t[4]=a,t[5]=o):o=t[5];let s=o;if(n.sample.length===0){let e;return t[6]===s?e=t[7]:(e=(0,x.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`consent-preview`,children:s}),t[6]=s,t[7]=e),e}let c=n.truncated?null:n.count-n.sample.length,l;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,x.jsx)(h,{className:`size-3 transition-transform motion-reduce:transition-none`,"aria-hidden":!0}),t[8]=l):l=t[8];let u;t[9]===s?u=t[10]:(u=(0,x.jsxs)(v,{className:`flex items-center gap-1 text-1sm text-muted-foreground hover:text-foreground [&[data-state=open]>svg]:rotate-90`,children:[l,(0,x.jsx)(`span`,{children:s})]}),t[9]=s,t[10]=u);let d;t[11]===n.sample?d=t[12]:(d=n.sample.map(de),t[11]=n.sample,t[12]=d);let f;t[13]===d?f=t[14]:(f=(0,x.jsx)(`ul`,{className:`space-y-1.5 font-mono`,children:d}),t[13]=d,t[14]=f);let p;t[15]!==n.truncated||t[16]!==c?(p=n.truncated||c!==null&&c>0?(0,x.jsx)(`p`,{className:`mt-1 italic`,children:n.truncated?(0,x.jsx)(i,{id:`5wV2qQ`}):(0,x.jsx)(i,{id:`nNYV3Y`,values:{remaining:c}})}):null,t[15]=n.truncated,t[16]=c,t[17]=p):p=t[17];let m;t[18]!==f||t[19]!==p?(m=(0,x.jsxs)(_,{className:`pt-1 pl-4 text-1sm text-muted-foreground`,children:[f,p]}),t[18]=f,t[19]=p,t[20]=m):m=t[20];let g;return t[21]!==u||t[22]!==m?(g=(0,x.jsxs)(te,{"data-testid":`consent-preview`,children:[u,m]}),t[21]=u,t[22]=m,t[23]=g):g=t[23],g}function de(e){return(0,x.jsx)(`li`,{children:e},e)}export{S as default};
|