@inkeep/open-knowledge 0.86.10 → 0.86.12-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/cli.mjs +6 -6
- package/dist/constants-CvznkgU4.mjs +1 -0
- package/dist/{dist-DikfvdOD.mjs → dist-CqyT6Kac.mjs} +1 -1
- package/dist/dist-qew1xYqg.mjs +2212 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +240 -238
- package/dist/init-CK3DgQiP.mjs +1 -0
- package/dist/{init-DMdD4mKR.mjs → init-Cb5cGxKf.mjs} +2 -2
- package/dist/{launch-json-removal-DrdcQSV2.mjs → launch-json-removal-1jdDi23_.mjs} +1 -1
- package/dist/loader-BwaFWYgH.mjs +1 -0
- package/dist/{loader-DKR6ymSV.mjs → loader-Cnmmedih.mjs} +1 -1
- package/dist/{md-manager-BGnqyqi1-CMF2qMhD.mjs → md-manager-BGnqyqi1-C80pMLi7.mjs} +1 -1
- package/dist/{open-browser-CsFrf5v1.mjs → open-browser-DdYx0HOD.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-CHFSL-OO.mjs → preview-C2nZOEOF.mjs} +1 -1
- package/dist/preview-DpN2RKRs.mjs +1 -0
- package/dist/public/assets/{AccountSection-Cn5QCaNJ.js → AccountSection-B5Akd_lT.js} +1 -1
- package/dist/public/assets/{ActivityModeContent--x2o9zBo.js → ActivityModeContent-D_PWtsd2.js} +1 -1
- package/dist/public/assets/AddPropertiesButton-CPmEiINR.js +2 -0
- package/dist/public/assets/{AgentConnectionsSection-C99QFz6Q.js → AgentConnectionsSection-C5YY2iqZ.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-B88McXwI.js → AgentDiffPane-GH9VSfje.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-B5NOz8W2.js → AttachmentsSection-De3luzw5.js} +1 -1
- package/dist/public/assets/{AuthModal-CaYJDCrL.js → AuthModal-CHid1zIl.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput--KUWom4J.js → CodeMirrorPropInput-541INHEl.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-rMM0vYc_.js → ContentRulesSection-DvspCgkN.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-DTwemWjU.js → DiffViewBoundary-L0r4YmEw.js} +1 -1
- package/dist/public/assets/DocumentContext-BhDKYP3I.js +108 -0
- package/dist/public/assets/{EditorModeToggle-L8LDYM-O.js → EditorModeToggle-DcLCuSh1.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-Bd3-sCnc.js → ExcalidrawDocEditor-6bsvmnp4.js} +1 -1
- package/dist/public/assets/FeedbackForm-DR0XDvRa.js +1 -0
- package/dist/public/assets/{GraphPanel-D8IPaKtn.js → GraphPanel-75Gq3M8g.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-Dkoo6uKk.js → ImportSkillDialog-D4baBg1I.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-C7uW5BS9.js → LinkPreviewsSection-BYLSlOtr.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-Bi_KzjAZ.js → LintConfigEditor-C0bykZjj.js} +1 -1
- package/dist/public/assets/{LintingSection-BUBlarvx.js → LintingSection-Dkw3Gy-L.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-DatL8HKW.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-99jKiC4K.js → ManagedArtifactProperties-DkLXqbca.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-4pTC6kEx.js → MermaidDocEditor-DdKA5_sd.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-CPNu28g3.js → NetworkAccessSection-C9S4FV2h.js} +1 -1
- package/dist/public/assets/{ProjectTemplatesSection-CVxoKTpG.js → ProjectTemplatesSection-BPIa6vCf.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-DrfDg7Gs.js → PropertyDisplayRow-BpyUE4rQ.js} +1 -1
- package/dist/public/assets/PublishToGitHubDialog-B5IUZX4A.js +1 -0
- package/dist/public/assets/{RegisteredAgentIcon-CNf09bvo.js → RegisteredAgentIcon-CH2UJPHT.js} +1 -1
- package/dist/public/assets/ReportBugDialogBody-Bz2XsWX2.js +3 -0
- package/dist/public/assets/{ReportBugMenuTrigger-CLFQqoKf.js → ReportBugMenuTrigger-DtOzXxK1.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-DTLOsl3A.js → SchemaConfigEditor-DjoiXTi6.js} +1 -1
- package/dist/public/assets/{SearchSection-CYK6OY4I.js → SearchSection-Z13NU7QH.js} +1 -1
- package/dist/public/assets/SessionsHost-CPF7ISZW.js +2 -0
- package/dist/public/assets/{SettingsDialogBody-C98qXz85.js → SettingsDialogBody-6x3yGlOk.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-BFeiie9N.js → ShareReceiveMissDialog-fQ2NCsxj.js} +1 -1
- package/dist/public/assets/{SkillCostValue-Br3p-1t8.js → SkillCostValue-D7i9jTwb.js} +1 -1
- package/dist/public/assets/{SkillForkDialog-HHZBdD9G.js → SkillForkDialog-BePu5Ab7.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-CYZkBfwA.js → SkillInstallMenu-ChTMNTo3.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-DaVrUMXJ.js → SkillOriginInline-BIqEXUYx.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-DisbU40N.js → SkillToolbarControls-V_rtwpQB.js} +1 -1
- package/dist/public/assets/{SkillsManagerSection-D4vdwn-z.js → SkillsManagerSection-CcVBU5-5.js} +1 -1
- package/dist/public/assets/{SlidesPluginSection-CIIOqcY1.js → SlidesPluginSection-JtRNI6Bl.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-groMA2mx.js → SlidesToolbarControls-PbLGA15n.js} +1 -1
- package/dist/public/assets/SourceEditor-pAuA5Jbq.js +1 -0
- package/dist/public/assets/{SpellingSettings-tjxObyGl.js → SpellingSettings-DH0T6Q-0.js} +1 -1
- package/dist/public/assets/{SyncSection-DgzrVS-J.js → SyncSection-DSdmvKYA.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-f93Xp2WA.js → SyncStatusBadge-CmqR-dvk.js} +1 -1
- package/dist/public/assets/{TemplateRow-Z1Yy07aA.js → TemplateRow-BOTg2YrV.js} +1 -1
- package/dist/public/assets/{TerminalLaunchContext-DncO203O.js → TerminalLaunchContext-BxQb0o6_.js} +1 -1
- package/dist/public/assets/{TerminalPanel-D4_fMtJN.js → TerminalPanel-TWLJT5Es.js} +37 -37
- package/dist/public/assets/{TerminalSection-CLieQzVc.js → TerminalSection-umX9YQiY.js} +1 -1
- package/dist/public/assets/TerminalStartingNotice-B5bh40C7.js +1 -0
- package/dist/public/assets/{TerminalWindowApp-BAMJC2KQ.js → TerminalWindowApp-BbSqFpI4.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Djo3Z9xi.js → TextDocEditor-DbiJOi-9.js} +1 -1
- package/dist/public/assets/{ThemePluginSection-DKuqb11s.js → ThemePluginSection-1CRBX5E8.js} +2 -2
- package/dist/public/assets/{ThreadView-8vQ3qaLS.js → ThreadView-DY-StT20.js} +5 -5
- package/dist/public/assets/{TimelineDiffPane-CtX0Zsqk.js → TimelineDiffPane-Dqif4LiO.js} +1 -1
- package/dist/public/assets/{_envelope-DwyyiIO_-B2czcEJX.js → _envelope-q8XHEv4O-C-Qnl5Tu.js} +1 -1
- package/dist/public/assets/{agent-connections-Dj9-89rY.js → agent-connections-C9gOf_nm.js} +1 -1
- package/dist/public/assets/{agent-registry-CUdBP9oP.js → agent-registry-JpS34dxk.js} +1 -1
- package/dist/public/assets/{bridge-D0M08jrS.js → bridge-D7uDalkC.js} +1 -1
- package/dist/public/assets/{card-V6OFaQxm.js → card-BluRJrIS.js} +1 -1
- package/dist/public/assets/{catalog-eC0BYrwO.js → catalog-D4vfUgQo.js} +1 -1
- package/dist/public/assets/{client-version-BT5YNkiN.js → client-version-Bwkz2KKL.js} +1 -1
- package/dist/public/assets/{comment-chips-Dt3LR9m5.js → comment-chips-D0yLVwnq.js} +2 -2
- package/dist/public/assets/{config-provider-BeHGQGq_.js → config-provider-CKxggsEF.js} +1 -1
- package/dist/public/assets/config-schema-B4_7xb9l.js +1 -0
- package/dist/public/assets/{css-color-to-hex-9GaMLm_g.js → css-color-to-hex-Bzp4vTWU.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-pdr_rHPj.js → doc-undo-manager-DDBrqZ8S.js} +1 -1
- package/dist/public/assets/field-controls-B1UqOPPr.js +1 -0
- package/dist/public/assets/{field-controls-DF5W5rNT.js → field-controls-e2mA3LBp.js} +1 -1
- package/dist/public/assets/{frontmatter-tags-BEkbJ1mW.js → frontmatter-tags-DRQIboHc.js} +1 -1
- package/dist/public/assets/{globals-GhMVb9g-.css → globals-BOsVqbg9.css} +1 -1
- package/dist/public/assets/handoff-sZd6nXho.js +31 -0
- package/dist/public/assets/index-KEo7R3RD.js +2205 -0
- package/dist/public/assets/{lint-config-client-BoKe6jyr.js → lint-config-client-Wa2rYzej.js} +1 -1
- package/dist/public/assets/{lint-plugins-BaFy5fAq.js → lint-plugins-srBOr3VN.js} +1 -1
- package/dist/public/assets/{markdown-lint-CYI0LvRG.js → markdown-lint-BgDulTY0.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-DDtJKHWc.js → markdownlint-rule-browser-a9COyrB0.js} +1 -1
- package/dist/public/assets/messages-BGitIwJv.js +1 -0
- package/dist/public/assets/messages-BuFKWWO0.js +1 -0
- package/dist/public/assets/messages-CPcdAR7C.js +1 -0
- package/dist/public/assets/messages-CQyiGlob.js +1 -0
- package/dist/public/assets/messages-Cqsnn-Hv.js +1 -0
- package/dist/public/assets/messages-D_bJ4QD4.js +1 -0
- package/dist/public/assets/messages-Dk0-lWsK.js +1 -0
- package/dist/public/assets/messages-DsTqc0X0.js +1 -0
- package/dist/public/assets/messages-P24UsvDC.js +1 -0
- package/dist/public/assets/messages-S2VsWP7M.js +1 -0
- package/dist/public/assets/messages-gI_pWN2B.js +1 -0
- package/dist/public/assets/messages-iUeUxelc.js +1 -0
- package/dist/public/assets/messages-nKp8uPkb.js +1 -0
- package/dist/public/assets/{pending-receive-nav-store-BWwEZMMZ.js → pending-receive-nav-store-DSl8bhNh.js} +1 -1
- package/dist/public/assets/{preferred-session-events-D3VGAbIb.js → preferred-session-events-CYm28hMK.js} +1 -1
- package/dist/public/assets/{progress-QiOUxuwt.js → progress-DFQn_hb4.js} +2 -2
- package/dist/public/assets/{saved-themes-client-BsAFKZmu.js → saved-themes-client-CdTWCmn6.js} +1 -1
- package/dist/public/assets/{schema-section-DFUWEIaE.js → schema-section-D0TwA1wk.js} +1 -1
- package/dist/public/assets/{schemas-api-DbKS2FSh.js → schemas-api-CzN0ZSyO.js} +1 -1
- package/dist/public/assets/{selection-context-DR972LHL.js → selection-context-BksGkV1v.js} +1 -1
- package/dist/public/assets/{skills-api-B9YEcMtk.js → skills-api-DZKblPpK.js} +1 -1
- package/dist/public/assets/{src-B8XG1xCw.js → src-msWh43qH.js} +1 -1
- package/dist/public/assets/storage-scope-RkgOxsbY.js +1 -0
- package/dist/public/assets/{tag-pill-input-CMMRt7b4.js → tag-pill-input-C2esRppI.js} +1 -1
- package/dist/public/assets/{telemetry-impl-BITViotm.js → telemetry-impl-CKc5wvGR.js} +1 -1
- package/dist/public/assets/{telemetry-startup-jGfiii8S.js → telemetry-startup-CZKMf_5M.js} +1 -1
- package/dist/public/assets/terminal-cli-display-CDqjsErM.js +1 -0
- package/dist/public/assets/{terminal-command-events-Bi72Lcf-.js → terminal-command-events-DbFkr7Tx.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-C_GWUJjY.js → terminal-launch-events-Ce-BtSYr.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-DlMapttq.js → typing-burst-detector-DQ2h6sm2.js} +3 -3
- package/dist/public/assets/{uninstall-XfZKAcit.js → uninstall-BvM8iYtm.js} +1 -1
- package/dist/public/assets/{use-activity-panel-Brr8UVsg.js → use-activity-panel-682w4exD.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-D0H8BLH0.js → use-apply-config-color-theme-Ddh-kKyn.js} +1 -1
- package/dist/public/assets/{use-apply-config-language-qXi2vtjh.js → use-apply-config-language-DJ85uRhm.js} +2 -2
- package/dist/public/assets/{use-conflicts-WBuTv_RW.js → use-conflicts-BMDLXGd4.js} +1 -1
- package/dist/public/assets/{use-installed-clis-DhpEl5n2.js → use-installed-clis-CQh-Lkjf.js} +2 -2
- package/dist/public/assets/{use-live-xterm-theme-B-M8VGC3.js → use-live-xterm-theme-M-20jT-Q.js} +1 -1
- package/dist/public/assets/{use-open-skill-BtkUsd5l.js → use-open-skill-BZu9ClPN.js} +1 -1
- package/dist/public/assets/{use-semantic-search-status-T5fnhjCX.js → use-semantic-search-status-BkAAt8Ua.js} +1 -1
- package/dist/public/assets/{use-skill-origin-CGXvvIZH.js → use-skill-origin-CKhQalbz.js} +1 -1
- package/dist/public/assets/{use-skill-targets-ED9Nr02L.js → use-skill-targets-6h1qor3V.js} +1 -1
- package/dist/public/assets/{use-skills-NvVxu3-j.js → use-skills-CdEaAQQ2.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-B9jkex8S.js → use-terminal-enabled-D-gWAxuJ.js} +1 -1
- package/dist/public/assets/use-timeline-entry-diff-CKLWMEPL.js +7 -0
- package/dist/public/assets/{use-workspace-eebQ7TvN.js → use-workspace-DLSxs3j7.js} +1 -1
- package/dist/public/index.html +56 -56
- package/dist/public/uninstall.html +5 -5
- package/dist/{registry-probes-Vc8vaNvp.mjs → registry-probes-DXYESJWL.mjs} +1 -1
- package/dist/{removal-file-path-BMQVhW9w.mjs → removal-file-path-DXIJFyxw.mjs} +1 -1
- package/dist/{repair-launch-json-DYzL1z70.mjs → repair-launch-json-DCNJiOIo.mjs} +1 -1
- package/dist/{repair-mcp-configs-oXvmF1OO.mjs → repair-mcp-configs-BISI44CH.mjs} +1 -1
- package/dist/src-CXbzpNvw.mjs +1 -0
- package/dist/src-e35-IXbd.mjs +16 -0
- package/dist/{start-rCcLLI91.mjs → start-D_u0K-Db.mjs} +3 -3
- package/dist/start-DnH8T2kW.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-ClYQyDPo.mjs +0 -1
- package/dist/dist-DO09Y6M7.mjs +0 -2212
- package/dist/init-CprOKHo1.mjs +0 -1
- package/dist/loader-C7VEW3r8.mjs +0 -1
- package/dist/preview-C9XypjLn.mjs +0 -1
- package/dist/public/assets/AddPropertiesButton-FjbdHDtk.js +0 -2
- package/dist/public/assets/DocumentContext-BspAexIE.js +0 -108
- package/dist/public/assets/FeedbackForm-MNxc_SBw.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-CObS-xVu.js +0 -1
- package/dist/public/assets/PublishToGitHubDialog-C1j-CPCq.js +0 -1
- package/dist/public/assets/ReportBugDialogBody-Cr8bLCEY.js +0 -3
- package/dist/public/assets/SessionsHost-dPRXv1f3.js +0 -2
- package/dist/public/assets/SourceEditor-hS6bCoLY.js +0 -1
- package/dist/public/assets/TerminalStartingNotice-5Fpi8PsO.js +0 -1
- package/dist/public/assets/config-schema-CVspiOf0.js +0 -1
- package/dist/public/assets/field-controls-D4p-urvz.js +0 -1
- package/dist/public/assets/handoff-Ccrokk1b.js +0 -30
- package/dist/public/assets/index-CwPK6ESR.js +0 -2205
- package/dist/public/assets/messages-3j3829lo.js +0 -1
- package/dist/public/assets/messages-BhHPIQWN.js +0 -1
- package/dist/public/assets/messages-C6Q_S_D5.js +0 -1
- package/dist/public/assets/messages-CFCBFMDq.js +0 -1
- package/dist/public/assets/messages-CZxISJ5C.js +0 -1
- package/dist/public/assets/messages-CmIBqeAU.js +0 -1
- package/dist/public/assets/messages-D-IQ345G.js +0 -1
- package/dist/public/assets/messages-DGoPyQAa.js +0 -1
- package/dist/public/assets/messages-DLdnfmYp.js +0 -1
- package/dist/public/assets/messages-DU8D8xnz.js +0 -1
- package/dist/public/assets/messages-DV4tFNQZ.js +0 -1
- package/dist/public/assets/messages-DzrjTCP0.js +0 -1
- package/dist/public/assets/messages-bD7WkuDq.js +0 -1
- package/dist/public/assets/storage-scope-DTSZLReS.js +0 -1
- package/dist/public/assets/terminal-cli-display-D_usGdw9.js +0 -1
- package/dist/public/assets/use-timeline-entry-diff-0ZcS3v_s.js +0 -5
- package/dist/src-DD8ifyZO.mjs +0 -1
- package/dist/src-DcksCw6O.mjs +0 -14
- package/dist/start-COEy6TqU.mjs +0 -1
- /package/dist/public/assets/{globals-CK5VM2T4.js → globals-JnwKCLiW.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./bridge-D0M08jrS.js";function t(e,t){return t===null?e:`${e}:${n(t)}`}function n(t){return e(t)}export{t as n,n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,y as t}from"./handoff-Ccrokk1b.js";var n=e;function r(e){return t[e].handoffTarget}export{r as n,n as t};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{_ as r,g as i,i as a}from"./DocumentContext-BspAexIE.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./react-dom-DPxgxlDT.js";import{t as u}from"./compiler-runtime-BfE3aGVn.js";import{T as d,X as f,Y as p,_t as m,at as h,dt as g,it as _,lt as v,mt as y,n as b,pt as x}from"./dist-Dc8tD1th.js";import{Wt as ee,et as te,gt as S}from"./schemas-api-DbKS2FSh.js";import{i as ne,l as re,m as C,n as ie,t as ae}from"./PropertyDisplayRow-DrfDg7Gs.js";import{$ as oe,K as se,Vt as ce,ht as le,tt as ue}from"./CodeMirrorPropInput--KUWom4J.js";import{t as de}from"./minus-DdRxss3A.js";import{n as fe,t as pe}from"./plus-zPnYzcqL.js";import{t as me}from"./libesm-BDXD3YGA.js";var w=u(),T=n(),E=200;function he(e){let t=(0,w.c)(27),{delta:n,open:r,onOpenChange:i}=e;if(n.unparseable!==null){let e;return t[0]===n.unparseable?e=t[1]:(e=(0,T.jsx)(be,{regions:n.unparseable}),t[0]=n.unparseable,t[1]=e),e}if(n.changes.length===0)return null;let a,o,c,l,u,d,f,p,m;if(t[2]!==n.changes||t[3]!==i||t[4]!==r){let e=n.changes.slice(0,50);o=n.changes.length-e.length,a=ie,t[14]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,T.jsx)(s,{id:`l_UFPv`}),t[14]=c):c=t[14],l=n.changes.length,u=`property-diff-block`,d=`border-b border-border py-3`,f=r,p=i,m=e.map(ge),t[2]=n.changes,t[3]=i,t[4]=r,t[5]=a,t[6]=o,t[7]=c,t[8]=l,t[9]=u,t[10]=d,t[11]=f,t[12]=p,t[13]=m}else a=t[5],o=t[6],c=t[7],l=t[8],u=t[9],d=t[10],f=t[11],p=t[12],m=t[13];let h;t[15]===o?h=t[16]:(h=o>0&&(0,T.jsx)(`p`,{className:`px-2 pt-1 text-xs text-muted-foreground italic`,children:(0,T.jsx)(s,{id:`6qFchx`,values:{omitted:o}})}),t[15]=o,t[16]=h);let g;return t[17]!==a||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p||t[24]!==m||t[25]!==h?(g=(0,T.jsxs)(a,{title:c,count:l,testId:u,className:d,open:f,onOpenChange:p,children:[m,h]}),t[17]=a,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m,t[25]=h,t[26]=g):g=t[26],g}function ge(e){return(0,T.jsx)(_e,{change:e},`${e.kind}-${e.key}`)}function _e(e){let t=(0,w.c)(22),{change:n}=e,{_:r}=c(),i=re[ee(n.kind===`removed`?n.before:n.after)],a;t[0]!==r||t[1]!==n.kind?(a=n.kind===`added`?{KindIcon:pe,kindLabel:r({id:`hp8OtS`})}:n.kind===`removed`?{KindIcon:de,kindLabel:r({id:`eps54V`})}:{KindIcon:fe,kindLabel:r({id:`cNsIJf`})},t[0]=r,t[1]=n.kind,t[2]=a):a=t[2];let{KindIcon:o,kindLabel:s}=a,l;t[3]===o?l=t[4]:(l=(0,T.jsx)(o,{"aria-hidden":`true`,className:`size-3.5`}),t[3]=o,t[4]=l);let u;t[5]===s?u=t[6]:(u=(0,T.jsx)(`span`,{className:`sr-only`,children:s}),t[5]=s,t[6]=u);let d;t[7]!==l||t[8]!==u?(d=(0,T.jsxs)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-muted-foreground`,children:[l,u]}),t[7]=l,t[8]=u,t[9]=d):d=t[9];let f;t[10]===i?f=t[11]:(f=(0,T.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),t[10]=i,t[11]=f);let p;t[12]===n?p=t[13]:(p=(0,T.jsx)(ve,{change:n}),t[12]=n,t[13]=p);let m;t[14]!==n.key||t[15]!==f||t[16]!==p?(m=(0,T.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,T.jsx)(ae,{icon:f,label:n.key,dataKey:n.key,children:p})}),t[14]=n.key,t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;return t[18]!==n.key||t[19]!==d||t[20]!==m?(h=(0,T.jsxs)(`div`,{"data-property-change":``,"data-key":n.key,"data-testid":`property-diff-row`,className:`flex items-start gap-1`,children:[d,m]}),t[18]=n.key,t[19]=d,t[20]=m,t[21]=h):h=t[21],h}function ve(e){let t=(0,w.c)(17),{change:n}=e;if(n.kind===`added`){let e;return t[0]!==n.after||t[1]!==n.key?(e=(0,T.jsx)(D,{value:n.after,keyName:n.key}),t[0]=n.after,t[1]=n.key,t[2]=e):e=t[2],e}if(n.kind===`removed`){let e;return t[3]!==n.before||t[4]!==n.key?(e=(0,T.jsx)(D,{value:n.before,keyName:n.key,removed:!0}),t[3]=n.before,t[4]=n.key,t[5]=e):e=t[5],e}let r=C(n.before)||C(n.after)?`flex flex-col gap-1`:`flex flex-wrap items-center gap-1.5`,i;t[6]!==n.before||t[7]!==n.key?(i=(0,T.jsx)(D,{value:n.before,keyName:n.key,removed:!0}),t[6]=n.before,t[7]=n.key,t[8]=i):i=t[8];let a;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground`,children:`→`}),t[9]=a):a=t[9];let o;t[10]!==n.after||t[11]!==n.key?(o=(0,T.jsx)(D,{value:n.after,keyName:n.key}),t[10]=n.after,t[11]=n.key,t[12]=o):o=t[12];let s;return t[13]!==r||t[14]!==i||t[15]!==o?(s=(0,T.jsxs)(`div`,{className:r,"data-testid":`property-diff-change-pair`,children:[i,a,o]}),t[13]=r,t[14]=i,t[15]=o,t[16]=s):s=t[16],s}function D(e){let t=(0,w.c)(17),{value:n,keyName:r,removed:i}=e,a=i===void 0?!1:i;if(C(n)){let e=a?`opacity-70`:void 0,i;t[0]!==r||t[1]!==n?(i=(0,T.jsx)(ne,{keyName:r,value:n}),t[0]=r,t[1]=n,t[2]=i):i=t[2];let o;return t[3]!==e||t[4]!==i?(o=(0,T.jsx)(`div`,{className:e,children:i}),t[3]=e,t[4]=i,t[5]=o):o=t[5],o}let o,s,c,l;if(t[6]!==a||t[7]!==n){let e=Array.isArray(n)?n.filter(ye).join(`, `):String(n),r=e.length>E;o=a?`px-1 text-sm break-words text-muted-foreground line-through`:`px-1 text-sm break-words`,s=r?e:void 0,c=`property-diff-value`,l=r?`${e.slice(0,E)}…`:e,t[6]=a,t[7]=n,t[8]=o,t[9]=s,t[10]=c,t[11]=l}else o=t[8],s=t[9],c=t[10],l=t[11];let u;return t[12]!==o||t[13]!==s||t[14]!==c||t[15]!==l?(u=(0,T.jsx)(`span`,{className:o,title:s,"data-testid":c,children:l}),t[12]=o,t[13]=s,t[14]=c,t[15]=l,t[16]=u):u=t[16],u}function ye(e){return typeof e==`string`}function be(e){let t=(0,w.c)(10),{regions:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:(0,T.jsx)(s,{id:`wFyXOW`})}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,T.jsx)(s,{id:`EmSrGB`}),t[1]=i):i=t[1];let a;t[2]===n.before?a=t[3]:(a=(0,T.jsx)(O,{label:i,text:n.before}),t[2]=n.before,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,T.jsx)(s,{id:`NawEr2`}),t[4]=o):o=t[4];let c;t[5]===n.after?c=t[6]:(c=(0,T.jsx)(O,{label:o,text:n.after}),t[5]=n.after,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,T.jsxs)(`div`,{className:`border-b border-border px-4 py-3`,"data-testid":`property-diff-unparseable`,"data-property-change":``,children:[r,(0,T.jsxs)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[a,c]})]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function O(e){let t=(0,w.c)(7),{label:n,text:r}=e,i;t[0]===n?i=t[1]:(i=(0,T.jsx)(`p`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:n}),t[0]=n,t[1]=i);let a=r===``?`—`:r,o;t[2]===a?o=t[3]:(o=(0,T.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted px-2 py-1.5 font-mono text-xs whitespace-pre-wrap`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,T.jsxs)(`div`,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}var k=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.unescapeToken=t,e.escapeToken=n;function t(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function n(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.Pointer=function(){function e(e){e===void 0&&(e=[``]),this.tokens=e}return e.fromJSON=function(n){var r=n.split(`/`).map(t);if(r[0]!==``)throw Error(`Invalid JSON Pointer: ${n}`);return new e(r)},e.prototype.toString=function(){return this.tokens.map(n).join(`/`)},e.prototype.evaluate=function(e){for(var t=null,n=``,r=e,i=1,a=this.tokens.length;i<a;i++)t=r,n=this.tokens[i],!(n==`__proto__`||n==`constructor`||n==`prototype`)&&(r=(t||{})[n]);return{parent:t,key:n,value:r}},e.prototype.get=function(e){return this.evaluate(e).value},e.prototype.set=function(e,t){var n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)},e.prototype.push=function(e){this.tokens.push(e)},e.prototype.add=function(t){return new e(this.tokens.concat(String(t)))},e.prototype.parent=function(){return new e(this.tokens.length>1?this.tokens.slice(0,-1):[``])},e}()})),A=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.hasOwnProperty=void 0,e.objectType=t,e.clone=r,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function n(e){return typeof e==`object`&&!!e}function r(t){if(!n(t))return t;if(t.constructor==Array){for(var i=t.length,a=Array(i),o=0;o<i;o++)a[o]=r(t[o]);return a}if(t.constructor==Date)return new Date(+t);var s={};for(var c in t)e.hasOwnProperty.call(t,c)&&(s[c]=r(t[c]));return s}})),j=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isDestructive=n,e.subtract=r,e.intersection=i,e.diffArrays=l,e.diffObjects=u,e.diffAny=d;var t=A();function n(e){var t=e.op;return t===`remove`||t===`replace`||t===`copy`||t===`move`}function r(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&!(t.hasOwnProperty.call(n,i)&&n[i]!==void 0)&&r.push(i);return r}function i(e){for(var n=e.length,r={},i=0;i<n;i++){var a=e[i];for(var o in a)t.hasOwnProperty.call(a,o)&&a[o]!==void 0&&(r[o]=(r[o]||0)+1)}for(var o in r)r[o]<n&&delete r[o];return Object.keys(r)}function a(e,n){var r=[];for(var i in e)t.hasOwnProperty.call(e,i)&&e[i]!==void 0&&t.hasOwnProperty.call(n,i)&&n[i]!==void 0&&r.push(i);return r}function o(e){return e.op===`add`}function s(e){return e.op===`remove`}function c(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function l(e,t,n,r){r===void 0&&(r=d);var i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function l(o,s){var u=o*i+s,d=a.get(u);if(d===void 0){if(o>0&&s>0&&!r(e[o-1],t[s-1],n.add(String(o-1))).length)d=l(o-1,s-1);else{var f=[];if(o>0){var p=l(o-1,s),m={op:`remove`,index:o-1};f.push(c(p,m))}if(s>0){var h=l(o,s-1),g={op:`add`,index:o-1,value:t[s-1]};f.push(c(h,g))}if(o>0&&s>0){var _=l(o-1,s-1),v={op:`replace`,index:o-1,original:e[o-1],value:t[s-1]};f.push(c(_,v))}d=f.sort(function(e,t){return e.cost-t.cost})[0]}a.set(u,d)}return d}var u=isNaN(e.length)||e.length<=0?0:e.length;return l(u,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(function(e,t){var i=e[0],a=e[1];if(o(t)){var c=t.index+1+a,l=c<u+a?String(c):`-`,d={op:t.op,path:n.add(l).toString(),value:t.value};return[i.concat(d),a+1]}else if(s(t)){var d={op:t.op,path:n.add(String(t.index+a)).toString()};return[i.concat(d),a-1]}else{var f=n.add(String(t.index+a)),p=r(t.original,t.value,f);return[i.concat.apply(i,p),a]}},[[],0])[0]}function u(e,t,n,i){i===void 0&&(i=d);var o=[];return r(e,t).forEach(function(e){o.push({op:`remove`,path:n.add(e).toString()})}),r(t,e).forEach(function(e){o.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),a(e,t).forEach(function(r){o.push.apply(o,i(e[r],t[r],n.add(r)))}),o}function d(e,n,r,i){if(i===void 0&&(i=d),e===n)return[];var a=(0,t.objectType)(e),o=(0,t.objectType)(n);return a==`array`&&o==`array`?l(e,n,r,i):a==`object`&&o==`object`?u(e,n,r,i):[{op:`replace`,path:r.toString(),value:n}]}})),xe=t((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,`__esModule`,{value:!0}),e.InvalidOperationError=e.TestError=e.MissingError=void 0,e.add=l,e.remove=u,e.replace=d,e.move=f,e.copy=p,e.test=m,e.apply=g;var n=k(),r=A(),i=j(),a=function(e){t(n,e);function n(t){var n=e.call(this,`Value required at path: ${t}`)||this;return n.path=t,n.name=`MissingError`,n}return n}(Error);e.MissingError=a;var o=function(e){t(n,e);function n(t,n){var r=e.call(this,`Test failed: ${t} != ${n}`)||this;return r.actual=t,r.expected=n,r.name=`TestError`,r}return n}(Error);e.TestError=o;function s(e,t,n){if(Array.isArray(e))if(t==`-`)e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function c(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function l(e,t,i){var o=n.Pointer.fromJSON(t.path);if(i?.implicitArrayCreation&&o.tokens[o.tokens.length-1]===`-`){var c=o.parent().evaluate(e);c.value===void 0&&(0,r.objectType)(c.parent)===`object`&&(c.parent[c.key]=[])}var l=o.evaluate(e);return l.parent===void 0||i?.implicitArrayCreation&&l.key===`-`&&!Array.isArray(l.parent)?new a(t.path):(s(l.parent,l.key,(0,r.clone)(t.value)),null)}function u(e,t,r){var i=n.Pointer.fromJSON(t.path).evaluate(e);return i.value===void 0?new a(t.path):(c(i.parent,i.key),null)}function d(e,t,i){var o=n.Pointer.fromJSON(t.path).evaluate(e);if(o.parent===null)return new a(t.path);if(Array.isArray(o.parent)){if(parseInt(o.key,10)>=o.parent.length)return new a(t.path)}else if(o.value===void 0)return new a(t.path);return o.parent[o.key]=(0,r.clone)(t.value),null}function f(e,t,r){var i=n.Pointer.fromJSON(t.from).evaluate(e);if(i.value===void 0)return new a(t.from);var o=n.Pointer.fromJSON(t.path).evaluate(e);return o.parent===void 0?new a(t.path):(c(i.parent,i.key),s(o.parent,o.key,i.value),null)}function p(e,t,i){var o=n.Pointer.fromJSON(t.from).evaluate(e);if(o.value===void 0)return new a(t.from);var c=n.Pointer.fromJSON(t.path).evaluate(e);return c.parent===void 0?new a(t.path):(s(c.parent,c.key,(0,r.clone)(o.value)),null)}function m(e,t,r){var a=n.Pointer.fromJSON(t.path).evaluate(e);return(0,i.diffAny)(a.value,t.value,new n.Pointer).length?new o(a.value,t.value):null}var h=function(e){t(n,e);function n(t){var n=e.call(this,`Invalid operation: ${t.op}`)||this;return n.operation=t,n.name=`InvalidOperationError`,n}return n}(Error);e.InvalidOperationError=h;function g(e,t,n){switch(t.op){case`add`:return l(e,t,n);case`remove`:return u(e,t,n);case`replace`:return d(e,t,n);case`move`:return f(e,t,n);case`copy`:return p(e,t,n);case`test`:return m(e,t,n)}return new h(t)}})),Se=t((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Pointer=void 0,e.applyPatch=i,e.createPatch=o;var t=k();Object.defineProperty(e,`Pointer`,{enumerable:!0,get:function(){return t.Pointer}});var n=xe(),r=j();function i(e,t,r){return t.map(function(t){return(0,n.apply)(e,t,r)})}function a(e){function t(n,i,a){var o=e(n,i,a);return Array.isArray(o)?o:(0,r.diffAny)(n,i,a,t)}return t}function o(e,n,i){var o=new t.Pointer;return(i?a(i):r.diffAny)(e,n,o)}})),M=e(o(),1),Ce=e(l(),1),N=Se();function P(){}P.prototype={diff:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.callback;typeof n==`function`&&(r=n,n={}),this.options=n;var i=this;function a(e){return r?(setTimeout(function(){r(void 0,e)},0),!0):e}e=this.castInput(e),t=this.castInput(t),e=this.removeEmpty(this.tokenize(e)),t=this.removeEmpty(this.tokenize(t));var o=t.length,s=e.length,c=1,l=o+s;n.maxEditLength&&(l=Math.min(l,n.maxEditLength));var u=n.timeout??1/0,d=Date.now()+u,f=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(f[0],t,e,0);if(f[0].oldPos+1>=s&&p+1>=o)return a([{value:this.join(t),count:t.length}]);var m=-1/0,h=1/0;function g(){for(var n=Math.max(m,-c);n<=Math.min(h,c);n+=2){var r=void 0,l=f[n-1],u=f[n+1];l&&(f[n-1]=void 0);var d=!1;if(u){var g=u.oldPos-n;d=u&&0<=g&&g<o}var _=l&&l.oldPos+1<s;if(!d&&!_){f[n]=void 0;continue}if(r=!_||d&&l.oldPos+1<u.oldPos?i.addToPath(u,!0,void 0,0):i.addToPath(l,void 0,!0,1),p=i.extractCommon(r,t,e,n),r.oldPos+1>=s&&p+1>=o)return a(we(i,r.lastComponent,t,e,i.useLongestToken));f[n]=r,r.oldPos+1>=s&&(h=Math.min(h,n-1)),p+1>=o&&(m=Math.max(m,n+1))}c++}if(r)(function e(){setTimeout(function(){if(c>l||Date.now()>d)return r();g()||e()},0)})();else for(;c<=l&&Date.now()<=d;){var _=g();if(_)return _}},addToPath:function(e,t,n,r){var i=e.lastComponent;return i&&i.added===t&&i.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:i.count+1,added:t,removed:n,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:i}}},extractCommon:function(e,t,n,r){for(var i=t.length,a=n.length,o=e.oldPos,s=o-r,c=0;s+1<i&&o+1<a&&this.equals(t[s+1],n[o+1]);)s++,o++,c++;return c&&(e.lastComponent={count:c,previousComponent:e.lastComponent}),e.oldPos=o,s},equals:function(e,t){return this.options.comparator?this.options.comparator(e,t):e===t||this.options.ignoreCase&&e.toLowerCase()===t.toLowerCase()},removeEmpty:function(e){for(var t=[],n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t},castInput:function(e){return e},tokenize:function(e){return e.split(``)},join:function(e){return e.join(``)}};function we(e,t,n,r,i){for(var a=[],o;t;)a.push(t),o=t.previousComponent,delete t.previousComponent,t=o;a.reverse();for(var s=0,c=a.length,l=0,u=0;s<c;s++){var d=a[s];if(!d.removed){if(!d.added&&i){var f=n.slice(l,l+d.count);f=f.map(function(e,t){var n=r[u+t];return n.length>e.length?n:e}),d.value=e.join(f)}else d.value=e.join(n.slice(l,l+d.count));l+=d.count,d.added||(u+=d.count)}else if(d.value=e.join(r.slice(u,u+d.count)),u+=d.count,s&&a[s-1].added){var p=a[s-1];a[s-1]=a[s],a[s]=p}}var m=a[c-1];return c>1&&typeof m.value==`string`&&(m.added||m.removed)&&e.equals(``,m.value)&&(a[c-2].value+=m.value,a.pop()),a}var Te=new P;function Ee(e,t,n){return Te.diff(e,t,n)}var F=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,I=/\S/,L=new P;L.equals=function(e,t){return this.options.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e===t||this.options.ignoreWhitespace&&!I.test(e)&&!I.test(t)},L.tokenize=function(e){for(var t=e.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<t.length-1;n++)!t[n+1]&&t[n+2]&&F.test(t[n])&&F.test(t[n+2])&&(t[n]+=t[n+2],t.splice(n+1,2),n--);return t};function De(e,t,n){return L.diff(e,t,n)}var R=new P;R.tokenize=function(e){this.options.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
2
|
-
`));var t=[],n=e.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var r=0;r<n.length;r++){var i=n[r];r%2&&!this.options.newlineIsToken?t[t.length-1]+=i:(this.options.ignoreWhitespace&&(i=i.trim()),t.push(i))}return t};var Oe=new P;Oe.tokenize=function(e){return e.split(/(\S.+?[.!?])(?=\s+|$)/)};var ke=new P;ke.tokenize=function(e){return e.split(/([{}:;,]|\s+)/)};function z(e){"@babel/helpers - typeof";return z=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},z(e)}var Ae=Object.prototype.toString,B=new P;B.useLongestToken=!0,B.tokenize=R.tokenize,B.castInput=function(e){var t=this.options,n=t.undefinedReplacement,r=t.stringifyReplacer,i=r===void 0?function(e,t){return t===void 0?n:t}:r;return typeof e==`string`?e:JSON.stringify(V(e,null,null,i),i,` `)},B.equals=function(e,t){return P.prototype.equals.call(B,e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`))};function V(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i,e));var a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];var o;if(Ae.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=V(e[a],t,n,r,i);return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),z(e)===`object`&&e!==null){t.push(e),o={},n.push(o);var s=[],c;for(c in e)e.hasOwnProperty(c)&&s.push(c);for(s.sort(),a=0;a<s.length;a+=1)c=s[a],o[c]=V(e[c],t,n,r,c);t.pop(),n.pop()}else o=e;return o}var H=new P;H.tokenize=function(e){return e.slice()},H.join=H.removeEmpty=function(e){return e};function U(e,t){let n=t.content.findDiffStart(e.content);if(n===null)return!1;let{a:r,b:i}=t.content.findDiffEnd(e.content),a=n-Math.min(r,i);return a>0&&(e.resolve(n-a).depth<t.resolve(r+a).depth?n-=a:(r+=a,i+=a)),new x(n,i,t.slice(n,r))}function je(e){if(!e.steps.length)return;let t=new y(e.docs[0]),n=e.steps.slice();for(;n.length;){let e=n.shift();for(;n.length&&e.merge(n[0]);){let r=n.shift();e=e instanceof x&&r instanceof x?U(t.doc,r.apply(e.apply(t.doc).doc).doc):e.merge(r)}t.step(e)}return t}function W(e){let t=new y(e);return t.removeMark(0,e.nodeSize-2),t.doc}function Me(e,t){let n=t.split(`/`);for(n.shift();n.length;){if(typeof e!=`object`)throw Error();let t=n.shift();e=e[t]}return e}function G(e){return JSON.parse(JSON.stringify(e))}var Ne=class{fromDoc;toDoc;complexSteps;wordDiffs;simplifyDiff;schema;tr;currentJSON;finalJSON;ops;constructor(e,t,n={}){let r={complexSteps:!0,wordDiffs:!1,simplifyDiff:!0,...n};this.fromDoc=e,this.toDoc=t,this.complexSteps=r.complexSteps,this.wordDiffs=r.wordDiffs,this.simplifyDiff=r.simplifyDiff,this.schema=e.type.schema,this.tr=new y(e),this.currentJSON={},this.finalJSON={},this.ops=[]}init(){return this.complexSteps?(this.currentJSON=W(this.fromDoc).toJSON(),this.finalJSON=W(this.toDoc).toJSON(),this.ops=(0,N.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps(),this.recreateChangeMarkSteps()):(this.currentJSON=this.fromDoc.toJSON(),this.finalJSON=this.toDoc.toJSON(),this.ops=(0,N.createPatch)(this.currentJSON,this.finalJSON),this.recreateChangeContentSteps()),this.simplifyDiff&&(this.tr=je(this.tr)||this.tr),this.tr}recreateChangeContentSteps(){let e=[];for(;this.ops.length;){let t=this.ops.shift();e.push(t);let n,r=G(this.currentJSON),i=t.path.split(`/`);for(;n==null;){(0,N.applyPatch)(r,[t]);try{n=this.schema.nodeFromJSON(r),n.check()}catch{if(n=null,this.ops.length>0)t=this.ops.shift(),e.push(t);else throw Error(`No valid diff possible applying ${t.path}`)}}this.complexSteps&&e.length===1&&(i.includes(`attrs`)||i.includes(`type`))?(this.addSetNodeMarkup(),e=[]):e.length===1&&t.op===`replace`&&i[i.length-1]===`text`?(this.addReplaceTextSteps(t,r),e=[]):this.addReplaceStep(n,r)&&(e=[])}}addSetNodeMarkup(){let e=this.schema.nodeFromJSON(this.currentJSON),t=this.schema.nodeFromJSON(this.finalJSON),n=t.content.findDiffStart(e.content),r=e.nodeAt(n),i=t.nodeAt(n);if(n!=null){let e=r.type===i.type?null:i.type;try{this.tr.setNodeMarkup(n,e,i.attrs,i.marks)}catch(t){if(e&&t.message.includes(`Invalid content`))this.tr.replaceWith(n,n+r.nodeSize,i);else throw t}return this.currentJSON=W(this.tr.doc).toJSON(),this.ops=(0,N.createPatch)(this.currentJSON,this.finalJSON),!0}return!1}recreateChangeMarkSteps(){this.toDoc.descendants((e,t)=>{if(!e.isInline)return!0;this.tr.doc.nodesBetween(t,t+e.nodeSize,(n,r)=>{if(!n.isInline)return!0;let i=Math.max(t,r),a=Math.min(t+e.nodeSize,r+n.nodeSize);n.marks.forEach(t=>{t.isInSet(e.marks)||this.tr.removeMark(i,a,t)}),e.marks.forEach(e=>{e.isInSet(n.marks)||this.tr.addMark(i,a,e)})})})}addReplaceStep(e,t){let n=U(this.schema.nodeFromJSON(this.currentJSON),e);if(!n)return!1;if(!this.tr.maybeStep(n).failed)return this.currentJSON=t,!0;throw Error(`No valid step found.`)}addReplaceTextSteps(e,t){let n={...e,value:`xx`},r={...e,value:`yy`},i=G(this.currentJSON),a=G(this.currentJSON);(0,N.applyPatch)(i,[n]),(0,N.applyPatch)(a,[r]);let o=this.schema.nodeFromJSON(i),s=this.schema.nodeFromJSON(a),c=e.value,l=Me(this.currentJSON,e.path),u=this.wordDiffs?De(l,c):Ee(l,c),d=o.content.findDiffStart(s.content),f=o.resolve(d+1).marks();for(;u.length;){let e=u.shift();if(e.added){let t=this.schema.nodeFromJSON({type:`text`,text:e.value}).mark(f);if(u.length&&u[0].removed){let e=u.shift();this.tr.replaceWith(d,d+e.value.length,t)}else this.tr.insert(d,t);d+=e.value.length}else if(e.removed)if(u.length&&u[0].added){let t=u.shift(),n=this.schema.nodeFromJSON({type:`text`,text:t.value}).mark(f);this.tr.replaceWith(d,d+e.value.length,n),d+=t.value.length}else this.tr.delete(d,d+e.value.length);else d+=e.value.length}this.currentJSON=t}};function Pe(e,t,n={}){return new Ne(e,t,n).init()}var Fe=new Set([`list`,`bulletList`,`orderedList`,`taskList`]);function K(e){let t=[];return e.forEach((e,n)=>{if(Fe.has(e.type.name)){let r=n+1,i=0;e.forEach(e=>{let n=r+i;t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`}),i+=e.nodeSize})}else t.push({from:n,to:n+e.nodeSize,key:`${e.type.name}:${e.textContent}`})}),t}function Ie(e,t){let n=e.length,r=t.length,i=Array.from({length:n+1},()=>Array(r+1).fill(0));for(let a=n-1;a>=0;a--)for(let n=r-1;n>=0;n--)i[a][n]=e[a].key===t[n].key?i[a+1][n+1]+1:Math.max(i[a+1][n],i[a][n+1]);let a=[],o=0,s=0;for(;o<n&&s<r;)e[o].key===t[s].key?(a.push({type:`same`,b:t[s]}),o++,s++):i[o+1][s]>=i[o][s+1]?(a.push({type:`del`,a:e[o]}),o++):(a.push({type:`ins`,b:t[s]}),s++);for(;o<n;)a.push({type:`del`,a:e[o++]});for(;s<r;)a.push({type:`ins`,b:t[s++]});return a}function Le(e,t){let n=Ie(K(e),K(t)),r=[],i=0;for(let e of n)e.type===`same`?i=e.b.to:e.type===`ins`?(r.push({fromA:0,toA:0,fromB:e.b.from,toB:e.b.to}),i=e.b.to):r.push({fromA:e.a.from,toA:e.a.to,fromB:i,toB:i});return r}var Re=400;function q(e,t,n){return t.nodeFromJSON(e.parseWithFallback(n))}function ze(e,t){let n=t.filter(e=>e.toB>e.fromB),r=[];return e.steps.forEach((t,i)=>{let a=t instanceof v?`add`:t instanceof g?`remove`:null;if(a===null)return;let o=t,s=e.mapping.slice(i+1),c=s.map(o.from,-1),l=s.map(o.to,1);if(l<=c||n.some(e=>e.fromB<=c&&l<=e.toB))return;let u=e.mapping.slice(0,i).invert(),d=u.map(o.from),f=u.map(o.to);f<=d||r.push({fromA:d,toA:f,fromB:c,toB:l,markName:o.mark.type.name,kind:a})}),r}function Be(e,t,n,r){if(e.length>2e5||t.length>2e5)return{ok:!1,reason:`ceiling`};let i,a;try{i=q(r,n,e),a=q(r,n,t)}catch{return{ok:!1,reason:`parse`}}let o=a,s=null;try{s=Pe(i,a,{complexSteps:!0,wordDiffs:!0,simplifyDiff:!0}),o=s.doc}catch{}let c=Le(i,o),l=s?ze(s,c):[];return c.length+l.length>Re?{ok:!1,reason:`ceiling`}:{ok:!0,afterDoc:o,beforeDoc:i,changes:c,markChanges:l}}var Ve=`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`;function He(e){return e.changes.length+2*e.markChanges.length}function J(e){let t=!1;return e.forEach(e=>{e.isBlock&&(t=!0)}),t}function Ue(e){if(e.childCount===0)return!1;let t=!0;return e.forEach(e=>{e.type.name!==`listItem`&&e.type.name!==`taskItem`&&(t=!1)}),t}function Y(e,t,n){let r=document.createElement(n?`div`:`span`);r.className=n?`ok-diff-del ok-diff-del-block`:`ok-diff-del`,r.setAttribute(`data-diff-deleted`,``);let i=e.serializeFragment(t);if(n&&Ue(t)){let e=document.createElement(`ul`);e.appendChild(i),r.appendChild(e)}else r.appendChild(i);return r}function We(e,t,n,r,i){let a=m.fromSchema(i),o=[];for(let e of r){let n=t.slice(e.fromA,e.toA),r=J(n.content);o.push(p.widget(e.fromB,()=>Y(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]})),o.push(p.inline(e.fromB,e.toB,{class:`ok-diff-ins`},{inclusiveEnd:!0}))}for(let e of n)if(e.toB>e.fromB&&o.push(p.node(e.fromB,e.toB,{class:`ok-diff-ins-block`})),e.toA>e.fromA){let n=t.slice(e.fromA,e.toA),r=J(n.content);o.push(p.widget(e.fromB,()=>Y(a,n.content,r),{side:-1,ignoreSelection:!0,marks:[]}))}return f.create(e,o)}var Ge=new Set([`slashCommand`,`blockDragHandle`,`blockMover`,`tableInsertControls`,`trailingAffordance`,`fileHandler`,`gfmAutolink`,`inlineLinkInputRule`,`keyboardNav`,`tiptapFindReplace`,`selectionState`,`sourceDirtyObserver`,`tabFocusTrap`]),X=r.filter(e=>!Ge.has(e.name)).map(e=>e.name===`jsxComponent`?ce:e),Z=d(X);function Q(e,t){return Be(e,t,Z,ue())}var Ke=b.create({name:`renderedDiffDecorations`,addOptions(){return{decorations:f.empty}},addProseMirrorPlugins(){let e=this.options.decorations;return[new _({key:new h(`renderedDiffDecorations`),props:{decorations:()=>e}})]}});function qe(e){let t=(0,w.c)(32),{diff:n,docName:r}=e,a,o,s;if(t[0]!==n.afterDoc||t[1]!==n.beforeDoc||t[2]!==n.changes||t[3]!==n.markChanges||t[4]!==r){let e=We(n.afterDoc,n.beforeDoc,n.changes,n.markChanges,Z);s=oe,a=!1,o=[...i(X,r),Ke.configure({decorations:e})],t[0]=n.afterDoc,t[1]=n.beforeDoc,t[2]=n.changes,t[3]=n.markChanges,t[4]=r,t[5]=a,t[6]=o,t[7]=s}else a=t[5],o=t[6],s=t[7];let c;t[8]===n.afterDoc?c=t[9]:(c=n.afterDoc.toJSON(),t[8]=n.afterDoc,t[9]=c);let l;t[10]===r?l=t[11]:(l=e=>{let{editor:t}=e;return le(t,r)},t[10]=r,t[11]=l);let u;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(u={attributes:{class:`pt-4`}},t[12]=u):u=t[12];let d;t[13]!==a||t[14]!==o||t[15]!==c||t[16]!==l?(d={editable:a,extensions:o,content:c,onBeforeCreate:l,editorProps:u},t[13]=a,t[14]=o,t[15]=c,t[16]=l,t[17]=d):d=t[17];let f;t[18]!==n||t[19]!==r?(f=[n,r],t[18]=n,t[19]=r,t[20]=f):f=t[20];let p=s(d,f),[m]=(0,M.useState)(Je),h=(0,M.useRef)(null),g,_;t[21]===m?(g=t[22],_=t[23]):(_=()=>{let e=h.current;if(e)return e.appendChild(m),()=>{m.parentNode===e&&e.removeChild(m)}},g=[m],t[21]=m,t[22]=g,t[23]=_),(0,M.useLayoutEffect)(_,g);let v;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,T.jsx)(`div`,{className:`tiptap-editor`,children:(0,T.jsx)(`div`,{ref:h,style:{display:`contents`}})}),t[24]=v):v=t[24];let y;t[25]===p?y=t[26]:(y=(0,T.jsx)(se,{editor:p,className:`tiptap-editor-portal-content`}),t[25]=p,t[26]=y);let b;t[27]!==m||t[28]!==y?(b=(0,Ce.createPortal)(y,m),t[27]=m,t[28]=y,t[29]=b):b=t[29];let x;return t[30]===b?x=t[31]:(x=(0,T.jsxs)(`div`,{className:`editor-doc-scroll min-h-0 flex-1`,"data-testid":`rendered-diff-view`,children:[v,b]}),t[30]=b,t[31]=x),x}function Je(){let e=document.createElement(`div`);return e.style.display=`contents`,e}var Ye=`[data-property-change]`,Xe=`[data-content] > [data-line-type="change-addition"], [data-content] > [data-line-type="change-deletion"]`;function Ze(e){let t=[];for(let n of e.querySelectorAll(`diffs-container`)){let e=n.shadowRoot;e&&t.push(...e.querySelectorAll(Xe))}return t}function Qe(e,t){let n=new Map;return{sync(){for(let r of e.querySelectorAll(`diffs-container`)){let e=r.shadowRoot;if(e===null||n.has(e))continue;let i=new MutationObserver(t);i.observe(e,{childList:!0,subtree:!0}),n.set(e,i)}},disconnect(){for(let e of n.values())e.disconnect();n.clear()}}}function $e(e){let t=Ze(e),n=[],r=null;for(let e of t)(r===null||e.previousElementSibling!==r)&&n.push(e),r=e;return n}function $(e){let t=0,n=0;for(let r of e.split(`
|
|
3
|
-
`))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return{additions:t,deletions:n}}function et(e,t){return`${e}\u0000${t}`}function tt(e,t,n){let r=S(e).body,i=S(t).body;return r===i?``:me(n,r,i,``,``,{context:Math.max(r.split(`
|
|
4
|
-
`).length,i.split(`
|
|
5
|
-
`).length)})}function nt(e,t,n,r,i){let o=(0,w.c)(10),s=r===void 0?`vs-live`:r,c=i===void 0?null:i,{activeProvider:l}=a(),u;o[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={status:`idle`,diff:null},o[0]=u):u=o[0];let[d,f]=(0,M.useState)(u),p=(0,M.useRef)(l),m;o[1]===l?m=o[2]:(m=()=>{p.current=l},o[1]=l,o[2]=m),(0,M.useEffect)(m);let h,g;return o[3]!==n||o[4]!==t||o[5]!==s||o[6]!==c||o[7]!==e?(h=()=>{if(!e){f({status:`idle`,diff:null});return}let r=e,i=!1;f({status:`loading`,diff:null});let a=async function(e){let r=et(t,e),i=n.get(r);if(i!==void 0)return i;let a=await fetch(`/api/history/${e}?docName=${encodeURIComponent(t)}`);if(!a.ok)return console.error(`[timeline-diff] history fetch returned non-ok response`,{sha:e,docName:t,status:a.status}),null;let o=(await a.json()).content??``;return n.set(r,o),o};return(async function(){try{let e=await a(r);if(i)return;if(e===null){f({status:`error`,diff:null});return}let n,o;if(s===`vs-parent`){let t=c?await a(c):``;if(i)return;if(t===null){f({status:`error`,diff:null});return}n=t,o=e}else n=e,o=p.current?.document.getText(`source`).toString()??``;let l=S(n).body,u=S(o).body,d=tt(n,o,t),m=te(n,o);if(i)return;let{additions:h,deletions:g}=$(d);f({status:`ready`,diff:d,additions:h,deletions:g,before:l,after:u,properties:m})}catch(e){i||(console.error(`[timeline-diff] failed to load entry diff`,{sha:r,docName:t,mode:s,err:e}),f({status:`error`,diff:null}))}})(),()=>{i=!0}},g=[e,t,n,s,c],o[3]=n,o[4]=t,o[5]=s,o[6]=c,o[7]=e,o[8]=h,o[9]=g):(h=o[8],g=o[9]),(0,M.useEffect)(h,g),d}export{Qe as a,Ve as c,$e as i,He as l,nt as n,qe as o,Ye as r,Q as s,$ as t,he as u};
|
package/dist/src-DD8ifyZO.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./md-manager-BGnqyqi1-CMF2qMhD.mjs";import"./src-DcksCw6O.mjs";import"./init-DMdD4mKR.mjs";import"./registry-probes-Vc8vaNvp.mjs";import"./start-rCcLLI91.mjs";import{n as e}from"./loader-DKR6ymSV.mjs";import"./preview-CHFSL-OO.mjs";import"./repair-mcp-configs-oXvmF1OO.mjs";export{e as loadConfig};
|
package/dist/src-DcksCw6O.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-tZXQYakl.mjs";import{Df as t,Fl as n,H as r,Jc as i,Pl as a,Sf as o,Tf as s,U as c,Uc as l,W as u,l as d,mf as f,qc as p,qu as m,u as ee,va as te,wf as h,ya as g,yf as _}from"./md-manager-BGnqyqi1-CMF2qMhD.mjs";import{At as v,Li as y,Qn as b,Ri as x,Si as S,Ta as C,Tr as w,as as T,bi as E,cr as D,fr as O,is as ne,ko as k,m as re,mi as A,rs as j,si as M,ts as N,ws as P,xi as ie}from"./dist-DO09Y6M7.mjs";import{t as ae}from"./yazl-BBz29IQN.mjs";import{Ct as oe,ot as F,st as se}from"./init-DMdD4mKR.mjs";import{l as ce,w as le}from"./registry-probes-Vc8vaNvp.mjs";import{c as ue}from"./colors-r_owlCuY.mjs";import{t as de}from"./is-object-BGze3w87.mjs";import{n as fe}from"./constants-ClYQyDPo.mjs";import"./loader-DKR6ymSV.mjs";import"./preview-CHFSL-OO.mjs";import{execFile as pe,execSync as me,spawnSync as he}from"node:child_process";import{basename as I,dirname as L,isAbsolute as ge,join as R,relative as _e,resolve as z,sep as B,win32 as ve}from"node:path";import{closeSync as ye,cpSync as be,createWriteStream as xe,existsSync as V,lstatSync as Se,mkdirSync as H,mkdtempSync as Ce,openSync as we,readFileSync as U,readSync as Te,readdirSync as W,readlinkSync as Ee,realpathSync as De,rmSync as G,rmdirSync as Oe,statSync as ke,writeFileSync as K}from"node:fs";import{arch as Ae,freemem as je,homedir as q,hostname as Me,platform as Ne,release as Pe,tmpdir as Fe,totalmem as Ie,type as Le,uptime as Re}from"node:os";import{readFile as ze,readdir as Be,stat as Ve}from"node:fs/promises";import{createHash as He}from"node:crypto";function Ue(e,t){let n=t.map(e=>[P(e),e]);for(let t of e){let e=P(t);if(e===null)continue;let r=n.find(([t])=>t===e);if(r!==void 0)return r[1]}}function We(e){let{override:t,storedPreference:n,preferenceList:r,supportedLocales:i}=e,a=e.autoDetectableLocales??i;if(t!==void 0){let e=Ue([t],i);if(e!==void 0)return{locale:e,source:`override`}}if(n!==void 0&&n!==`system`&&i.includes(n))return{locale:n,source:`explicit`};let o=Ue(r,a);return o===void 0?{locale:`en`,source:`fallback`}:{locale:o,source:`system`}}function Ge(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`unknown`;let r=Math.floor(Math.max(0,t-n)/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}const Ke=new Set([`start`,`stop`,`status`,`clean`,`ui`,`mcp`,`preview`,`lint`,`audit`,`deinit`,`auth`]);function qe(e,t,n=O){if(e!==void 0&&!Ke.has(e))return null;let r=n(t);return r===null||r.distance===0?null:r.rootPath}let Je=null;function Ye(e){Je=e}function Xe(){return Je??process.cwd()}const Ze=`Open Knowledge`;function Qe(e={}){let t=e.platformName??process.platform,n=e.productName??o().productName;return F(t).join(se({...e,platformName:t}),n)}function $e(e={}){let t=e.platformName??process.platform,n=e.home??q(),r=e.env??process.env,i=F(t),a;return a=t===`win32`?r.LOCALAPPDATA||i.join(n,`AppData`,`Local`):t===`darwin`?i.join(n,`Library`,`Caches`):r.XDG_CACHE_HOME||i.join(n,`.cache`),i.join(a,`${o().packageName.replaceAll(`/`,``)}-updater`)}function et(e){if(typeof e!=`object`||!e)return null;let t=e.recentProjects;if(!Array.isArray(t))return null;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;typeof t.path==`string`&&typeof t.name==`string`&&n.push({path:t.path,name:t.name})}return n}function tt(e){let t=R(e,`state.json`);if(!V(t))return[];let n;try{n=JSON.parse(U(t,`utf-8`))}catch{return[]}return et(n)??[]}function nt(e){let t=R(e,`state.json`);if(!V(t))return!1;try{return et(JSON.parse(U(t,`utf-8`)))!==null}catch{return!1}}const rt=8192;function it(e,t){if(e.outcome===`not-present`)return`not-present (no DiagnosticReports directory)`;if(e.outcome===`unreadable-directory`)return`unreadable (${e.directoryErrorCode??`unknown`} reading DiagnosticReports)`;let n=[`${e.windowDays}d`,`${e.foreignIgnored} other-process report(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&n.push(`${e.droppedOverCap} older dropped over cap`);let r=e.files.length-t;return r>0&&n.push(`${r} vanished before staging`),e.outcome===`none-in-window`?`none found in window (${n.join(`; `)})`:`${t} collected (${n.join(`; `)})`}function at(e){return e.replace(/\\+\/?/g,e=>{if(!e.endsWith(`/`))return e;let t=e.length-1;return`${`\\`.repeat(t-t%2)}/`})}const ot=RegExp(`("(?:${[`crashReporterKey`,`bootSessionUUID`,`deviceIdentifierForVendor`].join(`|`)})"\\s*:\\s*)"[^"]*"`,`g`);function st(e){return e.replace(ot,`$1"[REDACTED-DEVICE-ID]"`)}function ct(e){return st(at(e))}const lt=/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})(\.\d+)? ([+-]\d{2})(\d{2})$/;function ut(e){if(typeof e!=`string`)return null;let t=lt.exec(e.trim());if(t===null)return null;let[,n,r,i=``,a,o]=t,s=Date.parse(`${n}T${r}${i}${a}:${o}`);return Number.isNaN(s)?null:s}function dt(e){let t=we(e,`r`);try{let e=Buffer.alloc(rt),n=0,r=!1;for(;n<rt;){let i=Te(t,e,n,rt-n,n);if(i===0){r=!0;break}let a=n;n+=i;let o=e.subarray(0,n).indexOf(10,a);if(o!==-1)return e.subarray(0,o).toString(`utf-8`)}return r?e.subarray(0,n).toString(`utf-8`):null}finally{ye(t)}}function ft(e){try{let t=dt(e);if(t===null)return{kind:`unreadable`};let n=JSON.parse(t);if(typeof n!=`object`||!n)return{kind:`unreadable`};let{name:r,app_name:i,timestamp:a}=n,o=typeof r==`string`?r:typeof i==`string`?i:null;return o===null?{kind:`unreadable`}:{kind:`named`,name:o,timestampMs:ut(a)}}catch{return{kind:`unreadable`}}}function pt(e){return e===`OpenKnowledge`||e.startsWith(`OpenKnowledge `)}function mt(e,t){let n={files:[],foreignIgnored:0,unparseable:0,droppedOverCap:0,windowDays:7},r;try{r=W(e,{withFileTypes:!0})}catch(e){let t=e.code;return t===`ENOENT`?{...n,outcome:`not-present`}:{...n,outcome:`unreadable-directory`,directoryErrorCode:t??`unknown`}}let i=t.getTime()-6048e5,a=[],o=0,s=0;for(let t of r){if(!t.isFile()||!t.name.endsWith(`.ips`))continue;let n=R(e,t.name),r;try{r=ke(n).mtimeMs}catch{continue}if(r<i)continue;let c=ft(n),l=c.kind===`named`&&c.timestampMs!==null?c.timestampMs:r;if(c.kind===`unreadable`){s+=1;continue}if(!pt(c.name)){o+=1;continue}a.push({path:n,atMs:l})}a.sort((e,t)=>t.atMs-e.atMs);let c=a.slice(0,25),l={foreignIgnored:o,unparseable:s,droppedOverCap:a.length-c.length,windowDays:7};return c.length===0?{...l,files:[],outcome:`none-in-window`}:{...l,files:c.map(e=>e.path),outcome:`collected`}}const ht=`state/os-termination-evidence.json`,gt=6048e5,_t=/openknowledge/i,vt=Object.values(_).map(s);function yt(e={}){return(t,n)=>new Promise(r=>{try{pe(t,n,{encoding:`utf8`,timeout:e.timeoutMs??15e3,maxBuffer:e.maxBuffer??16777216,windowsHide:!0},(e,t,n)=>{r({...bt(e),stdout:t,stderr:n})})}catch(e){let t=e.code;r({status:null,stdout:``,stderr:``,errorCode:typeof t==`string`?t:`spawn-failed`})}})}function bt(e){return e===null?{status:0}:typeof e.code==`string`?{status:null,errorCode:e.code}:typeof e.code==`number`?{status:e.code}:e.killed===!0?{status:null,errorCode:`ETIMEDOUT`}:e.signal?{status:null,signal:e.signal}:{status:null}}function xt(e){if(e.errorCode!==void 0)return e.errorCode;if(e.signal!==void 0)return`signal ${e.signal}`;let t=(e.stderr.trim().split(`
|
|
2
|
-
`)[0]??``).replace(/\S*\/journal\/\S*/g,`<journal path>`).replace(/\b[0-9a-f]{32}\b/gi,`<id>`);return`exit ${e.status}${t===``?``:`: ${t}`}`}function J(e,t,n){return{schemaVersion:1,platform:e,source:t,outcome:`none-in-window`,readFrom:n,windowDays:7,foreignIgnored:0,unparseable:0,droppedOverCap:0,events:[]}}function St(e,t){return{...e,outcome:`unavailable`,unavailableReason:t}}function Ct(e){return{...e,outcome:e.events.length>0?`collected`:`none-in-window`}}function Y(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function wt(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function Tt(e,t){let n=t.indexOf(`
|
|
3
|
-
`);if(n===-1)return null;let r,i;try{r=wt(JSON.parse(t.slice(0,n))),i=wt(JSON.parse(t.slice(n+1)))}catch{return null}if(r===null||i===null||!Array.isArray(i.processes))return null;let a=[];for(let e of i.processes){let t=wt(e);t===null||typeof t.name!=`string`||!pt(t.name)||a.push({name:t.name,pid:Y(t.pid),killReason:typeof t.reason==`string`?t.reason:null,residentPages:Y(t.rpages),lifetimeMaxPages:Y(t.lifetimeMax)})}let o=ut(r.timestamp);return{kind:`jetsam`,at:o===null?null:new Date(o).toISOString(),file:e,pageSize:Y(wt(i.memoryStatus)?.pageSize),largestProcessOwned:typeof i.largestProcess==`string`?pt(i.largestProcess):null,ownedProcesses:a}}const Et=/^JetsamEvent-.*\.ips$/;function Dt(e,t,n,r){let i=e.flatMap(({file:e,mtimeMs:n})=>n!==null&&n>=t?[{file:e,mtimeMs:n}]:[]);return i.sort((e,t)=>r===`newest-first`?t.mtimeMs-e.mtimeMs:e.mtimeMs-t.mtimeMs),{files:i.slice(0,n).map(({file:e})=>e),statFailed:e.filter(({mtimeMs:e})=>e===null).length,droppedOverCap:Math.max(0,i.length-n)}}async function Ot(e,t){let n=J(`darwin`,`macos-jetsam`,[R(e,`JetsamEvent-*.ips`)]),r;try{r=await Be(e)}catch(e){return St(n,e.code??`unknown`)}let i=Dt(await Promise.all(r.filter(e=>Et.test(e)).map(async t=>{try{return{file:t,mtimeMs:(await Ve(R(e,t))).mtimeMs}}catch{return{file:t,mtimeMs:null}}})),t.getTime()-gt,50,`newest-first`);n.unparseable+=i.statFailed,n.droppedOverCap=i.droppedOverCap;for(let t of i.files){let r=null;try{r=Tt(t,await ze(R(e,t),`utf8`))}catch{}r===null?n.unparseable+=1:r.ownedProcesses.length===0?n.foreignIgnored+=1:n.events.push(r)}return Ct(n)}const kt=[`--no-pager`,`--output=short-iso-precise`,`--since=-7d`,`--grep=Out of memory|oom-kill|Killed process|Killed /|memory pressure`,`_TRANSPORT=kernel`,`+`,`_SYSTEMD_UNIT=systemd-oomd.service`],At=/^(\S+) \S+ ([^:\s[]+)(?:\[\d+\])?: (.*)$/;function jt(e,t){if(e===`systemd-oomd`){let e=/^Killed (\S+)/.exec(t);if(e===null)return null;let n=e[1]?.split(`/`).pop()??``;return{origin:`systemd-oomd`,action:`oomd-kill`,pid:null,processName:null,unit:_t.test(n)?n:null,trigger:/swap used/.test(t)?`swap`:/memory pressure/.test(t)?`memory-pressure`:null}}if(e!==`kernel`)return null;let n=/Killed process (\d+) \(([^)]+)\)/.exec(t);if(n!==null)return{origin:`kernel`,action:`oom-kill`,pid:Number(n[1]),processName:n[2]??null,unit:null,trigger:null};let r=/task=([^,]+),pid=(\d+)/.exec(t);if(r!==null)return{origin:`kernel`,action:`oom-kill`,pid:Number(r[2]),processName:r[1]??null,unit:null,trigger:null};let i=/^(\S+) invoked oom-killer/.exec(t);return i===null?null:{origin:`kernel`,action:`oom-invoked`,pid:null,processName:i[1]??null,unit:null,trigger:null}}function Mt(e){let t=[],n=0,r=0;for(let i of e.split(`
|
|
4
|
-
`)){if(i.trim()===``||i.startsWith(`-- `))continue;let e=At.exec(i);if(e===null){r+=1;continue}let[,a=``,o=``,s=``]=e;if(!_t.test(s)){n+=1;continue}let c=jt(o,s);if(c===null){r+=1;continue}t.push({kind:`journal`,at:a,...c})}return{events:t,foreignIgnored:n,unparseable:r}}async function Nt(e){let t=J(`linux`,`linux-journal`,[`journalctl ${kt.join(` `)}`]),n=await e(`journalctl`,[...kt]),r=n.status===1&&/^-- No entries --$/m.test(n.stdout);if(n.status!==0&&!r)return St(t,xt(n));let i=Mt(n.stdout);return t.droppedOverCap=Math.max(0,i.events.length-50),t.events.push(...i.events.slice(-50)),t.foreignIgnored=i.foreignIgnored,t.unparseable=i.unparseable,/not seeing messages from other users/i.test(`${n.stdout}\n${n.stderr}`)&&(t.restrictedToCurrentUser=!0),Ct(t)}const Pt={41:`Microsoft-Windows-Kernel-Power`,1074:`User32`,2004:`Microsoft-Windows-Resource-Exhaustion-Detector`,6008:`EventLog`},Ft={1e3:`Application Error`,1001:`Windows Error Reporting`,1002:`Application Hang`};function It(e){return e===`System`?Pt:Ft}function Lt(e){let t=`System[(${Object.keys(It(e)).map(e=>`EventID=${e}`).join(` or `)}) and TimeCreated[timediff(@SystemTime) <= ${gt}]]`;return e===`System`?`*[${t}]`:`*[${t} and EventData[${vt.map(e=>`Data='${e}'`).join(` or `)}]]`}function Rt(e){return[`qe`,e,`/q:${Lt(e)}`,`/f:xml`,`/rd:true`,`/c:200`]}function zt(e){return ve.join(e??`C:\\Windows`,`System32`,`wevtutil.exe`)}function Bt(e){return e.replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/&/g,`&`)}function Vt(e){return/[\\/]/.test(e)||/^[a-z]:/i.test(e)}function Ht(e,t){let n=RegExp(`<${t}(?:\\s[^>]*)?>([\\s\\S]*?)</${t}>`,`g`);return[...e.matchAll(n)].map(e=>Bt(e[1]??``).trim())}function Ut(e,t){let n=It(e),r=[],i=0,a=0;for(let o of t.match(/<Event[\s>][\s\S]*?<\/Event>/g)??[]){let t=/<Provider\s+Name=['"]([^'"]+)['"]/.exec(o)?.[1],s=Number(/<EventID[^>]*>(\d+)<\/EventID>/.exec(o)?.[1]),c=/<TimeCreated\s+SystemTime=['"]([^'"]+)['"]/.exec(o)?.[1];if(t===void 0||!Number.isInteger(s)||c===void 0){a+=1;continue}if(n[s]!==t){i+=1;continue}let l=Ht(o,`Data`),u=Ht(o,`Name`),d=[...l,...u].some(e=>_t.test(e));if(e===`Application`&&!d){i+=1;continue}r.push({kind:`windows-event`,at:c,log:e,provider:t,eventId:s,mentionsOpenKnowledge:d,data:e===`Application`?l.filter(e=>e!==``&&!Vt(e)):[]})}return{events:r,foreignIgnored:i,unparseable:a}}async function Wt(e,t){let n=zt(t),r=[`System`,`Application`],i=J(`win32`,`windows-event-log`,r.map(e=>`${n} ${Rt(e).join(` `)}`)),a=await Promise.all(r.map(async t=>({log:t,result:await e(n,Rt(t))}))),o=[];for(let{log:e,result:t}of a){if(t.status!==0){o.push(`${e}: ${xt(t)}`);continue}let n=Ut(e,t.stdout);i.droppedOverCap+=Math.max(0,n.events.length-50),i.events.push(...n.events.slice(0,50)),i.foreignIgnored+=n.foreignIgnored,i.unparseable+=n.unparseable}return o.length===r.length?St(i,o.join(`; `)):o.length>0?{...i,outcome:`partial`,unavailableReason:o.join(`; `)}:Ct(i)}async function Gt(e={}){let t=e.platform??process.platform,n=e.runCommand??yt(),r=(e.now??(()=>new Date))();switch(t){case`darwin`:return Ot(e.macosReportsDir??`/Library/Logs/DiagnosticReports`,r);case`linux`:return Nt(n);case`win32`:return Wt(n,e.systemRoot??process.env.SystemRoot);default:return{...J(t,null,[]),outcome:`unsupported`}}}const Kt={schemaVersion:1,outcome:`not-collected`};function qt(e){return`${JSON.stringify(e??Kt,null,2)}\n`}const Jt={"macos-jetsam":`macOS low-memory reports`,"linux-journal":`system journal`,"windows-event-log":`Windows event logs`};function Yt(e){let t=[`${e.windowDays}d`,`${e.events.length} kept`,`${e.foreignIgnored} other-process record(s) ignored`,`${e.unparseable} unparseable`];e.droppedOverCap>0&&t.push(`${e.droppedOverCap} older dropped over cap`);let n=e.source?` from ${Jt[e.source]}`:``,r=e.unavailableReason?`, ${e.unavailableReason}`:``;return`${e.outcome}${n}${r} (${t.join(`; `)})`}function Xt(){return R(N(),`bug-reports`)}function Zt(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=Xt(),r=`${t}-bugreport`,i=R(n,`${r}.zip`);for(let e=2;V(i);e+=1)i=R(n,`${r}-${e}.zip`);return i}function Qt(e,t){let{scrubbed:n}=e;return n!==void 0&&n.patterns.length>0?{file:t,lineCount:n.lineCount,patterns:[...n.patterns]}:null}function $t(e,t){let n=R(e,`.ok`,`config.yml`);if(V(n))try{let e=U(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return V(R(e,`.ok`))?He(`sha256`).update(z(e)).digest(`hex`).slice(0,12):null}function en(){let e={timestamp:new Date().toISOString(),platform:Ne(),osType:Le(),osRelease:Pe(),hostname:`[redacted]`,uptime:Re(),freeMem:je(),totalMem:Ie(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=me(`sw_vers -productVersion 2>/dev/null`,k({encoding:`utf8`})).trim()}catch{}try{let t=R(__dirname,`..`,`..`,`package.json`);V(t)&&(e.okVersion=JSON.parse(U(t,`utf8`)).version)}catch{}return e}const tn=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function nn(e){let t=I(e);return tn.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function rn(e,t){return cn(e,t).files}const an=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function on(e,t=ce){let n=R(e,`${t}.ShipIt`);if(!V(n))return[];let r;try{r=W(n)}catch{return[]}return an.flatMap(e=>r.map(t=>{if(t===e)return{entry:t,suffix:-1};if(!t.startsWith(`${e}.`))return null;let n=t.slice(e.length+1);return/^\d+$/.test(n)?{entry:t,suffix:Number(n)}:null}).filter(e=>e!==null).sort((e,t)=>e.suffix-t.suffix).slice(0,4).map(e=>R(n,e.entry)))}function sn(e){if(!V(e))return[];try{let t=new Map;for(let n of W(e).filter(e=>e.endsWith(`.yaml`)).sort()){let e=n.endsWith(`.sent.yaml`)?n.slice(0,-d.length):n.slice(0,-5),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}return[...t.values()].slice(-25).flat().map(t=>R(e,t))}catch{return[]}}function cn(e,t){if(!V(t))return{files:[],excludedByProjectSlug:0};let n=W(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>R(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(nn),i=[],a=r.filter(t=>{try{return U(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!nn(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function ln(e){let t=R(e,`.ok`,`local`);return V(t)?{files:[`server.lock`,`last-spawn-error.log`,p,l].map(e=>R(t,e)).filter(e=>V(e))}:{files:[]}}function un(e){let t=R(e,`.ok`,`local`,`logs`);return V(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>R(t,e)).filter(e=>V(e))}:{files:[]}}function dn(e){let t=0,n=new Map,r=e.replace(/("(?:docName|doc\.name|documentName)"\s*:\s*")((?:[^"\\]|\\.)*)"/g,(e,r,i)=>{t+=1;let a=n.get(i);return a===void 0&&(a=`doc#${He(`sha256`).update(i).digest(`hex`).slice(0,12)}`,n.set(i,a)),`${r}${a}"`});for(let[e,i]of[...n].sort(([e],[t])=>t.length-e.length)){if(e.length===0||!r.includes(e))continue;let n=r.split(e);t+=n.length-1,r=n.join(i)}return{text:r,count:t}}function fn(e){let t=e.revealDocNames?e.content:dn(e.content).text;if(e.redact){let{redacted:n,patterns:r,lineCount:i}=g(t);e.zipfile.addBuffer(Buffer.from(n,`utf8`),e.name),e.bundleFiles.push(e.name),r.length>0&&e.redactions.push({file:e.name,lineCount:i,patterns:r})}else e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name)}function X(e){for(let t of e.files)try{let n=U(t,`utf8`);fn({zipfile:e.zipfile,name:`${e.prefix}/${I(t)}`,content:t.endsWith(`.ips`)?ct(n):n,redact:e.redact,revealDocNames:e.revealDocNames,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function pn(t){let{redact:n,outputPath:r,logger:i}=t,a=t.revealDocNames??!1,o=t.userLogsDir??R(N(),`logs`),s=t.projectDir?$t(t.projectDir,i):null;H(L(r),{recursive:!0}),i?.info({projectSlug:s},`gathering diagnostic data`);let c=en();c.desktop=t.desktop??null,c.language=t.language??null;let{files:l,excludedByProjectSlug:u}=cn(s,o),{files:d}=t.projectDir?ln(t.projectDir):{files:[]},{files:f}=t.projectDir?un(t.projectDir):{files:[]},p=t.shipItLogFiles??[],m=t.diagnosticReports?.files??[];i?.info({logFileCount:l.length,logFilesExcludedByProjectSlug:u,lockFileCount:d.length,localSinkFileCount:f.length,shipItLogFileCount:p.length,diagnosticReportCount:m.length},`files collected`);let h=[],g=[],{ZipFile:_}=await import(`./yazl-BsCX6KWo.mjs`).then(t=>e(t.default,1)),v=new _;X({zipfile:v,files:[...l,...p],prefix:`logs`,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i}),X({zipfile:v,files:d,prefix:`lockdir`,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i}),X({zipfile:v,files:f,prefix:`local-logs`,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i}),X({zipfile:v,files:t.bugReportLedgerFiles??[],prefix:ee,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i}),X({zipfile:v,files:m,prefix:`diagnostic-reports`,redact:n,revealDocNames:a,bundleFiles:g,redactions:h,logger:i});for(let e of t.extraFiles??[])try{let t=U(e.sourcePath),n=`extra/${e.zipName??I(e.sourcePath)}`;v.addBuffer(t,n),g.push(n);let r=Qt(e,n);r!==null&&h.push(r)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&fn({zipfile:v,name:`note.txt`,content:t.note,redact:n,revealDocNames:a,bundleFiles:g,redactions:h});let y=new Set(m.map(e=>`diagnostic-reports/${I(e)}`)),b=g.filter(e=>y.has(e)),x=t.diagnosticReports===void 0?`not-collected (no collection attempted)`:it(t.diagnosticReports,b.length);v.addBuffer(Buffer.from(`${x}\n`,`utf8`),`state/diagnostic-reports-status.txt`),g.push(`state/diagnostic-reports-status.txt`),fn({zipfile:v,name:ht,content:qt(t.osTerminationEvidence),redact:n,revealDocNames:!0,bundleFiles:g,redactions:h});let S=JSON.stringify(c,null,2);v.addBuffer(Buffer.from(S,`utf8`),`sysinfo.json`),g.push(`sysinfo.json`);let C={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:s,files:g,redactions:h,sysinfo:c};v.addBuffer(Buffer.from(JSON.stringify(C,null,2),`utf8`),`MANIFEST.json`);let w=h.reduce((e,t)=>e+t.lineCount,0),T=new Set(p.map(e=>`logs/${I(e)}`)),E=g.filter(e=>T.has(e)),D=new Set((t.bugReportLedgerFiles??[]).map(e=>`${ee}/${I(e)}`)),O=g.filter(e=>D.has(e)),ne=s?g.filter(e=>e.startsWith(`logs/`)&&!nn(e)&&!T.has(e)):[],k=b.length>0?[`Crash reports under diagnostic-reports/ are rewritten on the way in,`,`independently of this setting: escaped path separators are normalised`,`so the scrub above can read them, and the identifiers that link this`,`machine's bundles to each other are replaced. Nothing else is changed;`,`they are not byte-identical to the files macOS wrote.`]:[],re=k.length>0?[`Redaction was disabled for this bundle; file contents are unmodified,`,`with one exception.`,...k]:[`Redaction was disabled for this bundle; file contents are unmodified.`],A=[`# Bug Report Bundle`,``,`Generated: ${C.generatedAt}`,`Project: ${s??`(unscoped)`}`,`Discipline version: ${C.disciplineVersion}`,``,`## Contents`,``,...g.map(e=>`- ${e}`),``,`## Privacy`,``,...ne.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...ne.map(e=>`- ${e}`),``]:[],...E.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...E.map(e=>`- ${e}`),``]:[],...b.length>0?[`Crash reports: written by macOS itself rather than by OpenKnowledge,`,`and machine-wide rather than scoped to any one project. They record`,`why the operating system ended a process of this app — the signal or`,`exception, the code-signing verdict, and whatever text the process`,`left behind as it died. They also carry machine details the OS puts`,`in every report: the account uid, the Mac model, and the name of the`,`process that launched this app, which on a managed machine can be`,`internal tooling. The identifiers that would link this machine's`,`bundles to each other are replaced before bundling. Only this`,`app's own reports are collected, never another application's, though`,`a report of ours still names the processes it ran alongside:`,...b.map(e=>`- ${e}`),``]:[],...(t.osTerminationEvidence?.events.length??0)>0?[`Termination records: read from the operating system rather than written`,`by OpenKnowledge, covering the last 7 days, to explain an exit the app`,`could not record itself. On macOS: the memory-pressure (jetsam) reports`,`that list processes of this app, with each one's memory use and whether`,`it was killed. On Linux: kernel and systemd-oomd out-of-memory kills of`,`this app, as structured fields with the machine name, cgroup paths and`,`user id left out. On Windows: crash and hang records for this app with`,`file paths left out, plus the time of every shutdown, restart, power`,`loss and low-memory warning on the machine, whatever caused it:`,`- ${ht}`,``]:[],...O.length>0?[`Send history: a small record for each bug report previously generated`,`on this machine — when it was generated, whether sending it`,`succeeded, and why it failed if it did. This is what makes a failed`,`send diagnosable at all. It is machine-wide rather than scoped to`,`this project, so it names the other projects reports were filed`,`from. It carries no document content:`,...O.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${te.join(`, `)}`,w>0?`${w} line(s) were scrubbed across ${h.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,...k,``,`This bundle is safe to attach to a GitHub issue.`]:re].join(`
|
|
5
|
-
`);v.addBuffer(Buffer.from(A,`utf8`),`README.md`),v.end();let j=xe(r);return v.outputStream.pipe(j),await new Promise((e,t)=>{j.on(`close`,e),j.on(`error`,t)}),i?.info({bundlePath:r,fileCount:g.length,redactionCount:w},`bundle written`),{zipPath:r,summary:{projectSlug:s,files:g,redactions:h,redactedLineCount:w,generatedAt:C.generatedAt}}}var mn=m(),hn=e(ae(),1),Z=e(ue(),1);function gn(e){let t=T(`user`,e,e);return j({absPath:t,sideline:!1,warn:()=>{}}).value.appearance?.language??`system`}function _n({home:e=q(),env:t=process.env}={}){let r=gn(e),{override:i,preferenceList:o}=ne(t),{locale:s,source:c}=We({override:i,storedPreference:r,supportedLocales:n,preferenceList:o,autoDetectableLocales:a});return{preference:r,locale:s,source:c,systemLanguages:o}}function vn(e){let t=new Set([e]);try{t.add(De.native(e))}catch{return[e].filter(e=>e.length>0)}return[...t].filter(e=>e.length>0).sort((e,t)=>t.length-e.length)}function yn(e,t){let n=e;for(let e of t)n.includes(e)&&(n=n.split(e).join(`<CONTENT_DIR>`));return n}function bn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xn(e,t){if(typeof e==`string`)return yn(e,t.contentDirSpellings);if(Array.isArray(e))return e.map(e=>xn(e,t));if(!bn(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=xn(i,t);return n}function Sn(e,t){let n=U(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
|
|
6
|
-
`),i=n.split(`
|
|
7
|
-
`),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(e!==i.length-1||n!==``){if(n.length===0){a.push(``);continue}try{let e=xn(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}let o=r?`${a.join(`
|
|
8
|
-
`)}\n`:a.join(`
|
|
9
|
-
`);K(e,o)}function Cn(e,t){let n=U(e,`utf-8`);if(n.trim().length!==0)try{let r=xn(JSON.parse(n),t),i=n.endsWith(`
|
|
10
|
-
`)?`
|
|
11
|
-
`:``;K(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=yn(n,t.contentDirSpellings);r!==n&&K(e,r)}}function wn(e,t){let n=U(e,`utf-8`),r=yn(n,t.contentDirSpellings);r!==n&&K(e,r)}function Tn(e){try{return W(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>R(e,t.name))}catch{return[]}}const En=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function Dn(e){return/\.log\.\d+$/.test(e)}function On(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||Dn(e)}const kn=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function An(e){let t={contentDirSpellings:vn(e.contentDir)};for(let n of kn)for(let r of Tn(R(e.stagingDir,n)))On(r)?Sn(r,t):r.endsWith(`.json`)?Cn(r,t):wn(r,t);for(let n of Tn(R(e.stagingDir,`state`))){let e=I(n);n.endsWith(`.jsonl`)?Sn(n,t):En.has(e)?Cn(n,t):wn(n,t)}}const jn=[`.ok`,`local`,`telemetry`],Mn=[`.ok`,`local`,`logs`],Nn=[`.ok`,`local`,`loss-capture`],Pn=`spans-current.jsonl`,Fn=`spans-prev.jsonl`,In=`server-current.jsonl`,Ln=`server-prev.jsonl`,Rn=`loss-current.jsonl`,zn=`loss-prev.jsonl`;function Bn(e){return R(e,...jn,Pn)}function Vn(e){return R(e,...jn,Fn)}function Hn(e){return R(e,...Mn,In)}function Un(e){return R(e,...Mn,Ln)}function Wn(e){return R(e,...Nn,Rn)}function Gn(e){return R(e,...Nn,zn)}const Kn=1e3;async function qn(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(Kn)});return t.ok?await t.text():null}catch{return null}}async function Jn(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(Kn)});return t.ok?await t.text():null}catch{return null}}async function Yn(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(Kn)});return t.ok?await t.text():null}catch{return null}}function Xn(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
|
|
12
|
-
`)}\n`:null}catch{return null}}function Zn(e){let t=R(e,`.git`,`ok`);if(!V(t))return null;let n=he(`git`,[`-C`,t,`log`,`--oneline`,`-50`],k({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function Qn(e){let t=R(e,`.git`,`ok`);if(!V(t))return null;let n=he(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],k({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function $n(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function er(){return{nodeVersion:process.version,platform:Ne(),arch:Ae()}}function tr(){return process.env.OTEL_SDK_DISABLED===`false`}function nr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function rr(e){if(!V(e))return{};let t;try{t=(0,mn.parse)(U(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!nr(t))return{};let n=t.telemetry;if(!nr(n))return{};let r=n.localSink;return nr(r)?r:{}}function ir(e){return typeof e==`boolean`?e:void 0}function ar(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function or(e){if(nr(e))return ar(e.maxBytes)}function sr(e){let t=rr(T(`project`,e)),n=rr(T(`project-local`,e));return{enabled:ir(n.enabled)??ir(t.enabled)??!0,spansMaxBytes:or(n.spans)??or(t.spans)??52428800,logsMaxBytes:or(n.logs)??or(t.logs)??26214400}}function cr(e){return He(`sha256`).update(e).digest(`hex`)}function lr(e){let t=U(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const ur=[`"doc.name"`,`"docName"`];function dr(e){let t=U(e,`utf-8`),n=0;for(let e of ur){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Q(e,t){if(!V(e))return!1;try{return H(L(t),{recursive:!0}),e.endsWith(`.ips`)?K(t,ct(U(e,`utf-8`))):be(e,t),!0}catch{return!1}}function fr(e){let t=[],n=e=>{let r=W(e,{withFileTypes:!0});for(let i of r){let r=R(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const pr=new Set([`.jsonl`]);function mr(e){let t=e.lastIndexOf(`.`);return t!==-1&&pr.has(e.slice(t))}const hr=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function gr(e){if(Dn(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&hr.has(e.slice(t))}function _r(e){let t=[];for(let n of fr(e)){let r=vr(e,n);if(!gr(r))continue;let{redacted:i,patterns:a,lineCount:o}=g(U(n,`utf-8`));a.length!==0&&(K(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function vr(e,t){return _e(e,t).split(B).join(`/`)}async function yr(e){let t=z(e.contentDir),n=z(e.projectDir??e.contentDir),r=e.deps??{},a=r.fetchAgentPresence??qn,o=r.fetchAgentEffects??Jn,s=r.fetchWatcherRecent??Yn,c=r.readShadowHead??Zn,u=r.readCheckpointRefs??Qn,d=r.now??(()=>new Date),f=r.okVersion??(()=>fe),m=r.readDesktopEnv??$n,te=r.readLanguage??_n,h=r.readRuntime??er,g=r.isOtlpPushEnabled??tr,_=Ce(R(Fe(),`ok-bundle-`));try{H(R(_,`telemetry`),{recursive:!0}),H(R(_,`logs`),{recursive:!0}),H(R(_,`state`),{recursive:!0}),Q(Bn(n),R(_,`telemetry`,Pn)),Q(Vn(n),R(_,`telemetry`,Fn)),Q(Hn(n),R(_,`logs`,In)),Q(Un(n),R(_,`logs`,Ln));for(let t of e.userLogFiles??[])Q(t,R(_,`logs`,I(t)));for(let t of e.userStateFiles??[])Q(t,R(_,ee,I(t)));let v=0;for(let t of e.diagnosticReports?.files??[])Q(t,R(_,`diagnostic-reports`,I(t)))&&(v+=1);let y=R(n,`.ok`,`local`),b=R(y,`server.lock`),x=`not-running`,S=`no server.lock`,C=null;if(V(b)){Q(b,R(_,`state`,`server.lock`));try{let e=U(b,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?C=t.port:S=`lock present but no port`}catch{S=`lock present but unparseable`}}if(C!==null){let e=await a(C);e===null?S=`agent-presence endpoint at :${C} unreachable`:(K(R(_,`state`,`agent-presence.json`),e),x=`running`,S=``);let t=await o(C);t!==null&&K(R(_,`state`,`agent-effects.json`),t);let n=await s(C);if(n!==null){let e=Xn(n);e!==null&&K(R(_,`state`,`watcher-recent.jsonl`),e)}}let w=c(t);w!==null&&K(R(_,`state`,`shadow-head.txt`),w);let T=u(t);T!==null&&K(R(_,`state`,`checkpoint-refs.txt`),T),Q(Wn(n),R(_,`state`,Rn)),Q(Gn(n),R(_,`state`,zn)),Q(R(y,`last-spawn-error.log`),R(_,`state`,`last-spawn-error.log`)),Q(R(y,i),R(_,`state`,i)),Q(R(y,p),R(_,`state`,p)),Q(R(y,l),R(_,`state`,l));let E=h(),D=m(),O=te(),ne={ok:{version:f(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:D,language:O}};K(R(_,`state`,`runtime.json`),`${JSON.stringify(ne,null,2)}\n`);let k=x===`running`?`running
|
|
13
|
-
`:`not-running (${S})\n`;K(R(_,`state`,`server-status.txt`),k);let re=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:it(e.diagnosticReports,v);if(K(R(_,`state`,`diagnostic-reports-status.txt`),`${re}\n`),K(R(_,ht),qt(e.osTerminationEvidence)),e.processDir&&V(e.processDir)){let t=R(_,`process`);H(t,{recursive:!0}),be(e.processDir,t,{recursive:!0})}let A=e.redact===!0;A&&An({stagingDir:_,contentDir:t}),e.note&&K(R(_,`note.txt`),e.note);let j=null;e.scrubSecrets===!0&&(j=_r(_));for(let t of e.extraFiles??[]){let e=t.zipName??I(t.sourcePath);if(!Q(t.sourcePath,R(_,`extra`,e))){r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=Qt(t,`extra/${e}`);n!==null&&(j??={redactions:[],redactedLineCount:0},j.redactions.push(n),j.redactedLineCount+=n.lineCount)}let M=sr(n),N=fr(_),P=[],ie=0,ae=0;for(let e of N){let t=vr(_,e),n=ke(e).size,r=mr(t)?lr(e):0;P.push({path:t,bytes:n,lines:r}),ie+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(ae+=dr(e))}let oe={applied:A};j!==null&&(oe.secretScrub=j);let F={schemaVersion:2,createdAt:d().toISOString(),ok:{version:f(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:D,language:O},contentDir:{pathSha256:cr(t),absolutePath:A?`<CONTENT_DIR>`:t},telemetry:{localSink:M,otlpPushEnabled:g()},redaction:oe,serverStatus:x,files:P};K(R(_,`manifest.json`),`${JSON.stringify(F,null,2)}\n`);let se=vn(t),ce=N.some(e=>{try{let t=U(e,`utf-8`);return se.some(e=>t.includes(e))}catch{return!1}}),le={stagedDiagnosticReports:v,totalBytes:ie,fileCount:P.length,docNameCount:ae,contentDirVisible:ce,redacted:A},ue=!1;return{stagingDir:_,manifest:F,summary:le,cleanup:()=>{ue||(ue=!0,G(_,{recursive:!0,force:!0}))}}}catch(e){throw G(_,{recursive:!0,force:!0}),e}}async function br(e){let{collected:t,outputPath:n}=e,r=L(n);if(!V(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new hn.ZipFile,a=fr(t.stagingDir);for(let e of a){let n=vr(t.stagingDir,e);i.addFile(e,n)}i.end();let o=xe(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function xr(e,t){let n=R(e,`.ok`,`config.yml`);if(V(n))try{let t=(0,mn.parse)(U(n,`utf-8`)),r=de(t)?t.content:void 0,i=de(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return z(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return z(e)}async function Sr(e,t,n,r,i,a){let o=$t(t,e.logger),s=await yr({contentDir:xr(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...rn(o,e.userLogsDir??R(N(),`logs`)),...on(e.cachesDir??R(q(),`Library`,`Caches`))],userStateFiles:sn(e.bugReportsDir??Xt()),diagnosticReports:i,osTerminationEvidence:a,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{H(L(e.outputPath),{recursive:!0}),await br({collected:s,outputPath:e.outputPath});let t=s.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:o,files:s.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:s.manifest.createdAt}}}finally{s.cleanup()}}async function Cr(e){let{projectDir:t}=e,n=e.readDesktopEnv??$n,r=e.readLanguage??_n,i=()=>mt(e.diagnosticReportsDir??R(q(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return Sr(e,t,n,r,i(),await Gt(e.osTerminationEvidenceDeps));let{zipPath:a,summary:o}=await pn({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:on(e.cachesDir??R(q(),`Library`,`Caches`)),bugReportLedgerFiles:sn(e.bugReportsDir??Xt()),diagnosticReports:e.level===`full`?i():void 0,osTerminationEvidence:e.level===`full`?await Gt(e.osTerminationEvidenceDeps):void 0,logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n(),language:r()});return{zipPath:a,summary:{level:e.level,systemWide:t===void 0,projectSlug:o.projectSlug,files:o.files,redactions:o.redactions,redactedLineCount:o.redactedLineCount,generatedAt:o.generatedAt}}}function $(e,t,n={}){let r=S(e,t),i;try{i=U(r,`utf-8`)}catch(e){return e&&typeof e==`object`&&`code`in e&&e.code===`ENOENT`?{status:`missing`,lockPath:r}:{status:`read-error`,lockPath:r,error:e instanceof Error?e.message:String(e)}}let a;try{a=JSON.parse(i)}catch{return{status:`corrupt`,lockPath:r}}let o=a&&typeof a==`object`?a:{},s=`machineId`in o&&typeof o.machineId==`string`?o.machineId!==(n.machineId??w()):`hostname`in o&&typeof o.hostname==`string`&&o.hostname!==(n.host??Me());if(!a||typeof a!=`object`||!A(a.pid))return{status:`corrupt`,lockPath:r,...s?{foreignHost:!0}:{}};let c=a.pid,l=`machineId`in o&&typeof o.machineId==`string`||`hostname`in o&&typeof o.hostname==`string`;return s?{status:`foreign-host`,lockPath:r,lock:a}:(n.isAlive??M)(c)?l?{status:`alive`,lockPath:r,lock:a}:{status:`unverified-owner`,lockPath:r,pid:c}:{status:`dead-pid`,lockPath:r,lock:a}}function wr(e){return e.status===`unverified-owner`?`Cannot verify shutdown: the server lock at ${e.lockPath} does not record its owning machine, and its recorded process ${e.pid} is still running on this machine. Check whether process ${e.pid} is an OpenKnowledge server. If it is, stop it and retry. Do not remove the lock file while that process is running.`:`Cannot verify shutdown: the server lock at ${e.lockPath} belongs to another machine. Stop OpenKnowledge on the owning machine. Confirm that no OpenKnowledge server is using this directory on the owning machine or any other machine sharing it. Only then remove the stale lock file at ${e.lockPath} and retry cleanup.`}function Tr(e){return e.replace(/:\d+$/,``)}function Er(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:Tr(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[^/?#]*@)?([^@/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:Tr(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:Tr(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.\-~%]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}const Dr=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function Or(e){return u(t(),e)}function kr(){return c(t())}function Ar(){let e=t();if(e===`stable`)return Dr;let n=r(e);return RegExp(`^# >>> ${n} >>>\\n[\\s\\S]*?^# <<< ${n} <<<\\n?`,`m`)}const jr={existsSync:e=>V(e),readFileSync:(e,t)=>U(e,t),lstatSync:e=>Se(e),readlinkSync:e=>Ee(e)};function Mr(e,t=jr){let n=Or(e);if(!t.existsSync(n))return null;try{let e=JSON.parse(t.readFileSync(n,`utf8`));return e?.version===1?e:null}catch{return null}}function Nr(e){let t=e.replace(Ar(),``);return{text:t,changed:t!==e,emptyAfter:t.trim()===``}}function Pr(e,t,n=jr){try{return n.lstatSync(e).isSymbolicLink()?n.readlinkSync(e)===t:!1}catch{return!1}}const Fr=[{hostDir:`.adal`,pruneRoot:`.adal`},{hostDir:`.aider-desk`,pruneRoot:`.aider-desk`},{hostDir:`.astrbot/data`,pruneRoot:`.astrbot`},{hostDir:`.augment`,pruneRoot:`.augment`},{hostDir:`.autohand`,pruneRoot:`.autohand`},{hostDir:`.bob`,pruneRoot:`.bob`},{hostDir:`.codeartsdoer`,pruneRoot:`.codeartsdoer`},{hostDir:`.codebuddy`,pruneRoot:`.codebuddy`},{hostDir:`.codeium/windsurf`,pruneRoot:`.codeium`},{hostDir:`.codemaker`,pruneRoot:`.codemaker`},{hostDir:`.codestudio`,pruneRoot:`.codestudio`},{hostDir:`.commandcode`,pruneRoot:`.commandcode`},{hostDir:`.config/crush`,pruneRoot:`.config/crush`},{hostDir:`.config/devin`,pruneRoot:`.config/devin`},{hostDir:`.config/goose`,pruneRoot:`.config/goose`},{hostDir:`.config/kimchi/harness`,pruneRoot:`.config/kimchi`},{hostDir:`.continue`,pruneRoot:`.continue`},{hostDir:`.factory`,pruneRoot:`.factory`},{hostDir:`.forge`,pruneRoot:`.forge`},{hostDir:`.grok`,pruneRoot:`.grok`},{hostDir:`.iflow`,pruneRoot:`.iflow`},{hostDir:`.inferencesh`,pruneRoot:`.inferencesh`},{hostDir:`.jazz`,pruneRoot:`.jazz`},{hostDir:`.junie`,pruneRoot:`.junie`},{hostDir:`.kilocode`,pruneRoot:`.kilocode`},{hostDir:`.kiro`,pruneRoot:`.kiro`},{hostDir:`.kode`,pruneRoot:`.kode`},{hostDir:`.lingma`,pruneRoot:`.lingma`},{hostDir:`.mcpjam`,pruneRoot:`.mcpjam`},{hostDir:`.moxby`,pruneRoot:`.moxby`},{hostDir:`.mux`,pruneRoot:`.mux`},{hostDir:`.neovate`,pruneRoot:`.neovate`},{hostDir:`.ona`,pruneRoot:`.ona`},{hostDir:`.openhands`,pruneRoot:`.openhands`},{hostDir:`.pochi`,pruneRoot:`.pochi`},{hostDir:`.qoder`,pruneRoot:`.qoder`},{hostDir:`.qoder-cn`,pruneRoot:`.qoder-cn`},{hostDir:`.qwen`,pruneRoot:`.qwen`},{hostDir:`.reasonix`,pruneRoot:`.reasonix`},{hostDir:`.roo`,pruneRoot:`.roo`},{hostDir:`.rovodev`,pruneRoot:`.rovodev`},{hostDir:`.snowflake/cortex`,pruneRoot:`.snowflake`},{hostDir:`.tabnine/agent`,pruneRoot:`.tabnine`},{hostDir:`.terramind`,pruneRoot:`.terramind`},{hostDir:`.tinycloud`,pruneRoot:`.tinycloud`},{hostDir:`.trae`,pruneRoot:`.trae`},{hostDir:`.trae-cn`,pruneRoot:`.trae-cn`},{hostDir:`.vibe`,pruneRoot:`.vibe`},{hostDir:`.zcode`,pruneRoot:`.zcode`},{hostDir:`.zencoder`,pruneRoot:`.zencoder`}],Ir=[...v.map(e=>re[e]),`open-knowledge`];function Lr(e){if(!ge(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=z(e);if(t===B||L(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function Rr(e,t){let n=_e(e,t);if(n.startsWith(`..`)||ge(n))return!1;let r=e;for(let e of n.split(B)){r=R(r,e);try{if(!Se(r).isDirectory())return!1}catch{return!1}}return!0}function zr(e,t){try{return W(e).every(n=>t.has(R(e,n)))}catch{return!1}}function Br(e){let t=Lr(e),n=[],r=[],i=new Set;for(let e of Fr){let a=R(t,e.hostDir,`skills`);if(!Rr(t,a))continue;let o=Ir.map(e=>R(a,e)).filter(e=>V(e));n.push(...o);for(let e of o)i.add(e);let s=R(t,e.pruneRoot),c=a;for(;zr(c,i)&&(r.push(c),i.add(c),c!==s);){let e=L(c);if(e===c||e===t||!e.startsWith(t+B))break;c=e}}return{skillDirs:n,emptyDirs:r}}function Vr(e){try{if(!Se(e).isDirectory())return!1;let t=W(e);return t.length===0||t.includes(`SKILL.md`)}catch{return!1}}function Hr(e){let t=new Set,n=new Set;for(let r of Fr){let i=R(e,r.hostDir,`skills`);for(let e of Ir)t.add(R(i,e));let a=R(e,r.pruneRoot),o=i;for(;n.add(o),o!==a;){let t=L(o);if(t===o||t===e||!t.startsWith(e+B))break;o=t}}return{skillDirs:t,emptyDirs:n}}function Ur(e,t){let n=Lr(e),r=Hr(n),i=[...t.skillDirs.filter(e=>!r.skillDirs.has(e)),...t.emptyDirs.filter(e=>!r.emptyDirs.has(e))];if(i.length>0)throw Error(`refusing skill cleanup — ${i.length} path(s) outside the known legacy set: ${i.join(`, `)}`);let a=[];for(let e of t.skillDirs)if(Rr(n,e)&&Vr(e))try{G(e,{recursive:!0,force:!0}),a.push(e)}catch{}for(let e of t.emptyDirs)if(Rr(n,e))try{Oe(e),a.push(e)}catch{}return a}function Wr(e){let t=Lr(e),n=[];for(let e of v){let r=re[e];n.push({path:R(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of f)n.push({path:R(t,i.skillsRoot,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function Gr(e,t){let n=[];for(let r of Wr(e))if(r.bundleId===t)try{G(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}function Kr(e){return e!=null&&e.includes(`--type=utility`)&&e.includes(`--utility-sub-type=node.mojom.NodeService`)}function qr(e,t=Date.now()){if(e===null)return`—`;let n=Ge(e,t);return n===`unknown`?`—`:n}function Jr(e){let t=L(e);return I(e)===`local`&&I(t)===`.ok`?L(t):I(e)===`.ok`?t:null}function Yr(e,t,n,r){if(t.status===`missing`||t.status===`corrupt`||t.status===`read-error`)return null;if(t.status===`unverified-owner`)return{directory:Jr(e),server:{port:null,status:t.status,pid:t.pid,startedAt:null,usage:null},ui:null,hostname:null,lockPath:t.lockPath,binary:null,command:null,isDesktop:!1};let i=t.lock,a=t.status===`alive`&&E(i)?{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r}:null;return{directory:i.worktreeRoot,server:{port:i.port,status:t.status,pid:i.pid,startedAt:i.startedAt,usage:r},ui:a,hostname:i.hostname,lockPath:t.lockPath,binary:n==null?null:D(n),command:n,isDesktop:Kr(n)}}function Xr(e){let t=e.server.status;switch(t){case`unverified-owner`:return`unverified`;case`alive`:return e.isDesktop?`desktop`:`running`;case`foreign-host`:return e.isDesktop?`desktop`:`foreign`;case`dead-pid`:return`stale`;default:return t}}const Zr=new Set([`running`,`desktop`,`foreign`,`unverified`]);function Qr(e){switch(e){case`running`:return Z.default.green(e);case`desktop`:return Z.default.blue(e);case`foreign`:return Z.default.cyan(e);case`unverified`:case`stale`:return Z.default.yellow(e)}}function $r(e){return e==null?`—`:`${e.cpuPercent.toFixed(1)}% / ${e.memPercent.toFixed(1)}%`}function ei(e){return`${$r(e.server.usage)} | ${$r(e.ui?.usage??null)}`}function ti(e){return`${e.server.port===null?`—`:e.server.port===0?`(starting)`:String(e.server.port)} / ${e.ui==null?`—`:String(e.ui.port)}`}function ni(e){if(e.length===0)return`No open-knowledge servers found.`;let t=[`DIRECTORY`,`PORTS (API/UI)`,`CPU/MEM (API | UI)`,`STATUS`,`PID`,`STARTED`,`BINARY`],n=e.map(e=>[e.directory??`—`,ti(e),ei(e),Xr(e),String(e.server.pid),qr(e.server.startedAt),e.binary??`—`]),r=t.length,i=t.map(e=>e.length);for(let e of n)for(let t=0;t<r;t++)i[t]=Math.max(i[t]??0,(e[t]??``).length);let a=t.map((e,t)=>e.padEnd(i[t]??0)).join(` `).trimEnd(),o=e.map((e,t)=>{let a=n[t]??[],o=[];for(let t=0;t<r;t++){let n=(a[t]??``).padEnd(i[t]??0);if(t===3){let r=a[t]??``;n=Qr(Xr(e))+` `.repeat(Math.max(0,(i[t]??0)-r.length))}o.push(n)}return o.join(` `).trimEnd()}),s=Z.default.dim(`To stop a server: ok stop <port|pid|directory|all>`);return[a,...o,``,s].join(`
|
|
14
|
-
`)}async function ri(e={}){let t=e.discover??b,n=e.inspect??(e=>$(e,`server`)),r=e.log??(e=>console.log(e)),i=e.resolveCommand??y,a=e.resolveUsage??x,o=await t(),s=[];for(let e of o){let t=n(e),r=Yr(e,t,t.status===`missing`||t.status===`corrupt`||t.status===`read-error`||t.status===`unverified-owner`?null:i(t.lock.pid),t.status===`missing`||t.status===`corrupt`||t.status===`read-error`||t.status===`unverified-owner`?null:a(t.lock.pid));r!=null&&s.push(r)}if(e.json){let e=s.map(e=>({...e,displayStatus:Xr(e)}));r(JSON.stringify(e,null,2));return}r(ni(e.all?s:s.filter(e=>Zr.has(Xr(e)))))}function ii(){return new oe(`ps`).description(`List all running open-knowledge servers`).argument(`[modifier]`,`"all" to include stale (dead-pid) entries`).option(`--all`,`Include stale entries (foreign and unverified entries already show)`).option(`--json`,`Emit structured JSON (always includes all statuses)`).action(async(e,t)=>{await ri({all:t.all===!0||e===`all`,json:t.json===!0})})}async function ai(e,t=le()){let n=$(e,`server`);if(n.status!==`alive`&&n.status!==`foreign-host`)return null;let r=ie(n.lock);if(r===null)return null;try{let n=await fetch(`${r}/api/server-info`,{signal:AbortSignal.timeout(1500),redirect:`manual`});if(!n.ok)return t?.warn({lockDir:e,baseUrl:r,outcome:`http-error`,status:n.status},`stop client-probe failed`),null;let i=(await n.json())?.collabClients;return typeof i==`number`&&Number.isFinite(i)?i:(t?.warn({lockDir:e,baseUrl:r,outcome:`no-client-count`,received:typeof i},`stop client-probe failed`),null)}catch(n){return t?.warn({lockDir:e,baseUrl:r,outcome:`unreachable`,err:n},`stop client-probe failed`),null}}function oi(e,t={}){return{targets:li(e,t.isAlive??M)?[{name:`server`,pid:e.lock.pid,port:e.lock.port}]:[]}}function si(e){try{return t()}catch(t){e?.warn({err:t},`stop channel check skipped: ${t instanceof Error?t.message:String(t)}`);return}}async function ci(e){let t=e.inspect??(()=>$(e.lockDir,`server`)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=e.probeClients??ai,o=e.logger??le(),s=t(),c=oi(s,{isAlive:e.isAlive});if(c.targets.length===0)return r(`No running open-knowledge processes.`),o?.info({lockDir:e.lockDir,targets:0},`stop found nothing to signal`),{stopped:[],failed:[],hadTargets:!1};let l=s.status===`alive`||s.status===`foreign-host`?s.lock.channel:void 0;if(e.force!==!0&&typeof l==`string`&&l.length>0){let t=e.selfChannel??si(o);if(t!==void 0&&l!==t)return i(`Not stopping: the server at ${e.lockDir} belongs to ${h(l)}. Stop it from that app or its CLI, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,holderChannel:l,selfChannel:t,pids:c.targets.map(e=>e.pid)},`stop declined: server belongs to another channel`),{stopped:[],failed:[],hadTargets:!0,declined:{otherChannel:l}}}if(e.force!==!0){let t=await a(e.lockDir,o);if(t!==null&&t>0)return i(`Not stopping: ${t} collaboration client${t===1?``:`s`} (editor window${t===1?``:`s`} or agents) still connected to the server at ${e.lockDir}. Close them, or re-run with --force to terminate anyway.`),o?.warn({lockDir:e.lockDir,clients:t,pids:c.targets.map(e=>e.pid)},`stop declined: live collaboration clients`),{stopped:[],failed:[],hadTargets:!0,declined:{clients:t}}}let u=[],d=[];for(let e of c.targets)try{n(e.pid,`SIGTERM`),u.push(e)}catch(t){d.push({target:e,error:t instanceof Error?t.message:String(t)})}return u.length>0&&r(`Stopped: ${u.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),o?.info({lockDir:e.lockDir,signalled:u.map(e=>({name:e.name,pid:e.pid,port:e.port})),failed:d.map(({target:e,error:t})=>({pid:e.pid,error:t})),forced:e.force===!0},`stop signalled processes`),d.length>0&&i(`Failed to stop: ${d.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:u,failed:d,hadTargets:!0}}function li(e,t){return e.status===`alive`||e.status===`foreign-host`&&t(e.lock.pid)}async function ui(e,t=M){let n=await b(),r=null;for(let i of n){let n=$(i,`server`);if(li(n,t)){if(n.lock.port===e)return i;r===null&&n.lock.pid===e&&(r=i)}}return r}async function di(e,t){let n=await ci({lockDir:e,force:t});return(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1),n}function fi(e,t,n={}){return t===0?`Nothing was running for ${e}, and no other open-knowledge servers are running.`:`Nothing was running for ${e}. ${t} other open-knowledge server${t===1?` is`:`s are`} running${n.listingFollows===!0?``:" — run `ok ps` to list them"}.`}async function pi(e){let t=await b(),n=0;for(let r of t)r!==e&&li($(r,`server`),M)&&n++;return n}function mi(e){return new oe(`stop`).description(`Stop open-knowledge server(s). With no argument: stops the server for the enclosing project — run it from anywhere inside the project. Pass a port number, a directory path, or "all" to target globally.`).argument(`[target...]`,`port number, directory path (spaces OK), or "all"`).option(`--force`,`Stop even when the server belongs to another OpenKnowledge app (Stable or Beta) or editor windows or agents are still connected to it`).action(async(t,n)=>{let r=n.force===!0,i=t.length===0?void 0:t.join(` `);if(i===void 0){e();let t=C(process.cwd()),n=await ci({lockDir:t,force:r,log:()=>{}});if(n.hadTargets){if(n.stopped.length>0){let e=n.stopped.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `);console.log(`Stopped: ${e}`)}(n.failed.length>0||n.declined!==void 0)&&(process.exitCode=1)}else{let e=await pi(t);console.log(fi(process.cwd(),e,{listingFollows:e>0})),e>0&&await ri({})}return}if(i===`all`){let e=await b();if(e.length===0){console.log(`No running open-knowledge servers found.`);return}let t=0;for(let n of e)li($(n,`server`),M)&&(await di(n,r),t++);t===0&&console.log(`No running open-knowledge servers found.`);return}if(/^\d+$/.test(i)){let e=Number.parseInt(i,10),t=await ui(e);if(t===null){console.log(`No running open-knowledge server found with port or PID ${e}.`);return}await di(t,r);return}let a=z(Xe(),i),o=C(a),s=[],c=await ci({lockDir:o,force:r,log:e=>s.push(e)});if((c.failed.length>0||c.declined!==void 0)&&(process.exitCode=1),c.hadTargets)for(let e of s)console.log(e);else console.log(fi(a,await pi(o)))})}export{tt as A,Gt as C,Ze as D,it as E,Xe as M,Ye as N,$e as O,qe as P,Xt as S,mt as T,$ as _,Ur as a,br as b,Wr as c,Or as d,kr as f,wr as g,Er as h,ii as i,nt as j,Qe as k,Dr as l,Nr as m,ci as n,Br as o,Mr as p,mi as r,Gr as s,ai as t,Pr as u,Cr as v,Yt as w,Zt as x,yr as y};
|
package/dist/start-COEy6TqU.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e,m as t,p as n,r}from"./start-rCcLLI91.mjs";export{r as bootStartServer,n as resolveBundledReactShellDir,t as resolveHost,e as startCommand};
|
|
File without changes
|