@inkeep/open-knowledge 0.86.19-beta.2 → 0.86.19-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/dist/cli.mjs +6 -6
  2. package/dist/constants-C8IYq5J6.mjs +1 -0
  3. package/dist/{dist-DyVcFCkj.mjs → dist-D9qVgnke.mjs} +1 -1
  4. package/dist/{dist-DRgSOIS6.mjs → dist-G9AKZ6QI.mjs} +3 -3
  5. package/dist/index.mjs +3 -3
  6. package/dist/{init-Bfl6NStv.mjs → init-Blx_yRFH.mjs} +2 -2
  7. package/dist/init-Cv_KJAY1.mjs +1 -0
  8. package/dist/{launch-json-removal-Dod4a_-P.mjs → launch-json-removal-Dkbqp7bu.mjs} +1 -1
  9. package/dist/loader-B9K4PBZ0.mjs +1 -0
  10. package/dist/{loader-1QamI-_M.mjs → loader-BKb_bmT0.mjs} +1 -1
  11. package/dist/{md-manager-BGnqyqi1-BzZ_8EQ9.mjs → md-manager-BGnqyqi1-I7NmBKjQ.mjs} +108 -108
  12. package/dist/native/native-config.win32-arm64-msvc.node +0 -0
  13. package/dist/native/native-config.win32-x64-msvc.node +0 -0
  14. package/dist/{open-browser-CFW5reH2.mjs → open-browser-DOwoD8uY.mjs} +1 -1
  15. package/dist/parse-worker.mjs +1 -1
  16. package/dist/preview-CMz5OZc2.mjs +1 -0
  17. package/dist/{preview-CijEeyG0.mjs → preview-D_MaK6Cf.mjs} +1 -1
  18. package/dist/public/assets/{AboutSection-LPELvEUl.js → AboutSection-Bddd4fs4.js} +1 -1
  19. package/dist/public/assets/{AccountSection-3KFh0j-o.js → AccountSection-CYLdqmV3.js} +1 -1
  20. package/dist/public/assets/ActivityModeContent-eFgAeFdP.js +1 -0
  21. package/dist/public/assets/{AddPropertiesButton-CcTOufGc.js → AddPropertiesButton-DIl1NSfT.js} +2 -2
  22. package/dist/public/assets/AgentConnectionsSection-B9_oKPEW.js +1 -0
  23. package/dist/public/assets/{AgentDiffPane-DRt588ak.js → AgentDiffPane-CBToshG0.js} +1 -1
  24. package/dist/public/assets/{AttachmentsSection-BWoZqrFj.js → AttachmentsSection-5sp05aav.js} +1 -1
  25. package/dist/public/assets/AuthModal-YZGpNH__.js +3 -0
  26. package/dist/public/assets/{BugReportHistory-BM589t1t.js → BugReportHistory-CHujhV74.js} +1 -1
  27. package/dist/public/assets/{BugReportHistoryDialog-BfdDMBqN.js → BugReportHistoryDialog-CaE3cXFx.js} +1 -1
  28. package/dist/public/assets/{ChangedOutsideBadge-DhpGZlDx.js → ChangedOutsideBadge-BfH3veLO.js} +1 -1
  29. package/dist/public/assets/{CodeMirrorPropInput-CnMfk0hq.js → CodeMirrorPropInput-flWDPEHd.js} +3 -3
  30. package/dist/public/assets/{ConsentDialogBody-CaPp8huq.js → ConsentDialogBody-k0k7metW.js} +1 -1
  31. package/dist/public/assets/{ContentRulesSection-BC2ldoBA.js → ContentRulesSection-CnbR96TQ.js} +1 -1
  32. package/dist/public/assets/{DiffViewBoundary-Czp-0Arc.js → DiffViewBoundary-DFNHnF7f.js} +1 -1
  33. package/dist/public/assets/{DocumentContext-cZBCdTD5.js → DocumentContext-bzAw44oj.js} +4 -4
  34. package/dist/public/assets/{EditorModeToggle-I3lAEnBr.js → EditorModeToggle-D6cCOnvC.js} +1 -1
  35. package/dist/public/assets/{ExcalidrawDocEditor-BoI26knA.js → ExcalidrawDocEditor-B2CzQIys.js} +1 -1
  36. package/dist/public/assets/FeedbackForm-DI5KmoB0.js +1 -0
  37. package/dist/public/assets/{GraphPanel-D1tkoAHM.js → GraphPanel-4ARXQVWm.js} +1 -1
  38. package/dist/public/assets/{HotkeysSection-C9sCf3j3.js → HotkeysSection-D1qQH68p.js} +1 -1
  39. package/dist/public/assets/{ImportSkillDialog-Bhwizrdv.js → ImportSkillDialog-BYkdhIXi.js} +1 -1
  40. package/dist/public/assets/{IntegrationsSection-D3htSKMO.js → IntegrationsSection-r5E7Aje8.js} +1 -1
  41. package/dist/public/assets/{LinkPreviewsSection-C4IdUXLV.js → LinkPreviewsSection-8dNRALj3.js} +1 -1
  42. package/dist/public/assets/{LintConfigEditor-CgcVT_jk.js → LintConfigEditor-BaCQgOz7.js} +1 -1
  43. package/dist/public/assets/{LintingSection-BBxbWZ_Q.js → LintingSection-xp6xqNTt.js} +1 -1
  44. package/dist/public/assets/{ManagedArtifactProperties-BO0zNDF5.js → ManagedArtifactProperties-BgpWx4RL.js} +1 -1
  45. package/dist/public/assets/ManagedArtifactProperties-rYpfPbXp.js +1 -0
  46. package/dist/public/assets/McpConsentDialogBody-CVZcuVhW.js +1 -0
  47. package/dist/public/assets/{MermaidDocEditor-S1zzPuZ3.js → MermaidDocEditor-DH3JMaY-.js} +1 -1
  48. package/dist/public/assets/{NetworkAccessSection-D0394uvL.js → NetworkAccessSection-M8VN4Es2.js} +1 -1
  49. package/dist/public/assets/{OkignoreSection-BudJQycp.js → OkignoreSection-DplnnxQb.js} +2 -2
  50. package/dist/public/assets/{ProjectTemplatesSection-DCliKsre.js → ProjectTemplatesSection-BEchYRnN.js} +1 -1
  51. package/dist/public/assets/{PropertyDisplayRow-BMCB8N4a.js → PropertyDisplayRow-BTFqEgs9.js} +1 -1
  52. package/dist/public/assets/{PublishToGitHubDialog-BJBrU1gT.js → PublishToGitHubDialog-BNdDkjrx.js} +1 -1
  53. package/dist/public/assets/{RegisteredAgentIcon-FmoZTlpS.js → RegisteredAgentIcon-B0qjAvei.js} +1 -1
  54. package/dist/public/assets/ReportBugDialogBody-jHepd9au.js +3 -0
  55. package/dist/public/assets/{ReportBugMenuTrigger-CvL5wd-7.js → ReportBugMenuTrigger-KsljCE5p.js} +1 -1
  56. package/dist/public/assets/SchemaConfigEditor-DrIA448z.js +1 -0
  57. package/dist/public/assets/{SearchSection-C4AjULre.js → SearchSection-iyTMeNFm.js} +1 -1
  58. package/dist/public/assets/{SessionsHost-9FQITgE2.js → SessionsHost-DocsCuT7.js} +2 -2
  59. package/dist/public/assets/{SettingsDialogBody-3vIEV3s1.js → SettingsDialogBody-0D3Z76fS.js} +2 -2
  60. package/dist/public/assets/{SettingsSectionHeader-DDNA1hrR.js → SettingsSectionHeader-BKhNIRp2.js} +1 -1
  61. package/dist/public/assets/{ShareReceiveDialog-DVtBOlIm.js → ShareReceiveDialog-DJbtqR4t.js} +1 -1
  62. package/dist/public/assets/{ShareReceiveMissDialog-Dxusazw-.js → ShareReceiveMissDialog-Df8-TyRa.js} +1 -1
  63. package/dist/public/assets/{SharingSection-Y4AD8HPt.js → SharingSection-C-9tTPow.js} +1 -1
  64. package/dist/public/assets/SkillCostValue-DK-VfwfI.js +1 -0
  65. package/dist/public/assets/{SkillForkDialog-CPkWchji.js → SkillForkDialog-BHqkO5bK.js} +1 -1
  66. package/dist/public/assets/{SkillInstallMenu-DyKWxkEY.js → SkillInstallMenu-29VzNm-A.js} +1 -1
  67. package/dist/public/assets/{SkillOriginInline-D6YyylB6.js → SkillOriginInline-Z5JCe0T2.js} +1 -1
  68. package/dist/public/assets/{SkillPluginBundleDialog-BmLQqQms.js → SkillPluginBundleDialog-BnQu_DSM.js} +1 -1
  69. package/dist/public/assets/{SkillToolbarControls-DZn91aUb.js → SkillToolbarControls-B-Zt0MRy.js} +1 -1
  70. package/dist/public/assets/{SkillsManagerSection-C0pgRzfs.js → SkillsManagerSection-D4YW1uOY.js} +1 -1
  71. package/dist/public/assets/{SlidesPluginSection-B8KiQkqa.js → SlidesPluginSection-BhUKklqb.js} +1 -1
  72. package/dist/public/assets/{SlidesToolbarControls-DxIDubwo.js → SlidesToolbarControls-DXn_DkWH.js} +1 -1
  73. package/dist/public/assets/{SourceEditor-BdnYTYOr.js → SourceEditor-DJw2ivGM.js} +1 -1
  74. package/dist/public/assets/{SpellingSettings-CElN7mrA.js → SpellingSettings-bP1auvgR.js} +1 -1
  75. package/dist/public/assets/{SyncSection-ClflUgEs.js → SyncSection-CRaQvFSY.js} +1 -1
  76. package/dist/public/assets/SyncStatusBadge-CXKoI8EV.js +1 -0
  77. package/dist/public/assets/{TemplateRow-DsoFn6-i.js → TemplateRow-4LHta_yW.js} +2 -2
  78. package/dist/public/assets/{TerminalLaunchContext-DWUMDSpw.js → TerminalLaunchContext-DprnLNoQ.js} +1 -1
  79. package/dist/public/assets/{TerminalPanel-ByCiyPt3.js → TerminalPanel-BKIxzbz3.js} +2 -2
  80. package/dist/public/assets/{TerminalSection-ByKXggtz.js → TerminalSection-CHx8epmz.js} +1 -1
  81. package/dist/public/assets/{TerminalWindowApp-BNA3YnxV.js → TerminalWindowApp-CcNgwnUa.js} +1 -1
  82. package/dist/public/assets/{TextDocEditor-Dc5nvs6R.js → TextDocEditor-DRyjXNQi.js} +1 -1
  83. package/dist/public/assets/{ThemePluginSection-McKmY5If.js → ThemePluginSection-DzHdEoc9.js} +1 -1
  84. package/dist/public/assets/{ThreadView-CCTmdJ6C.js → ThreadView-eVb6KZa5.js} +10 -10
  85. package/dist/public/assets/{TimelineDiffPane-BYwWnMOf.js → TimelineDiffPane-DSLcfgt2.js} +1 -1
  86. package/dist/public/assets/agent-connections-D6YhmKlS.js +1 -0
  87. package/dist/public/assets/{agent-registry-DoeDgmSS.js → agent-registry-BdHe0AEQ.js} +1 -1
  88. package/dist/public/assets/badge-BIamhtRR.js +1 -0
  89. package/dist/public/assets/{bridge-BeevbgaB.js → bridge-BMIee44l.js} +1 -1
  90. package/dist/public/assets/{catalog-C1GEA-Va.js → catalog-CEXii1s5.js} +1 -1
  91. package/dist/public/assets/{client-version-DqA-WRwO.js → client-version-C2PAh-J-.js} +1 -1
  92. package/dist/public/assets/{comment-chips-Bw7GlIbv.js → comment-chips-C9M45e6k.js} +1 -1
  93. package/dist/public/assets/{config-provider-BhKxQXzB.js → config-provider-CZMIDk5w.js} +1 -1
  94. package/dist/public/assets/config-schema-CLqfIyDT.js +1 -0
  95. package/dist/public/assets/{css-color-to-hex-BRv_r6oZ.js → css-color-to-hex-Csde6-Qs.js} +1 -1
  96. package/dist/public/assets/{doc-undo-manager-CEaENJEP.js → doc-undo-manager-BMlUueBQ.js} +1 -1
  97. package/dist/public/assets/field-controls-Cn2Mgkxt.js +1 -0
  98. package/dist/public/assets/{field-controls-CKb1JSHS.js → field-controls-O3opfcMi.js} +2 -2
  99. package/dist/public/assets/globals-DsfYxVus.css +1 -0
  100. package/dist/public/assets/{ime-composition-_BDVzXn4.js → ime-composition-DSJh5ynW.js} +1 -1
  101. package/dist/public/assets/index-DMV_IIc8.js +2209 -0
  102. package/dist/public/assets/{lint-config-client-DRJNyM2s.js → lint-config-client-DiWvGg-9.js} +1 -1
  103. package/dist/public/assets/{lint-plugins-BPdC7Ccd.js → lint-plugins-p1xvsBln.js} +1 -1
  104. package/dist/public/assets/{markdown-lint-BuEapKhE.js → markdown-lint-CGM3vVSj.js} +1 -1
  105. package/dist/public/assets/{markdownlint-rule-browser-BQ4c4vDN.js → markdownlint-rule-browser-UeNH6Y1J.js} +1 -1
  106. package/dist/public/assets/{pending-receive-nav-store-CLuU0Nf4.js → pending-receive-nav-store-DpvYfX_D.js} +1 -1
  107. package/dist/public/assets/{preferred-session-events-C7R1dtVr.js → preferred-session-events-PAakbQ3r.js} +1 -1
  108. package/dist/public/assets/{progress-DU1CB6eE.js → progress-gp9Udqip.js} +1 -1
  109. package/dist/public/assets/{saved-themes-client-D09wxYQm.js → saved-themes-client-BBkw3w0l.js} +1 -1
  110. package/dist/public/assets/{schema-section-CalUQFIh.js → schema-section-g8My60ML.js} +1 -1
  111. package/dist/public/assets/{schemas-api-CD98jV86.js → schemas-api-CL5ZXlEj.js} +4 -4
  112. package/dist/public/assets/{selection-context-BzI58oKn.js → selection-context-CQ_o205k.js} +1 -1
  113. package/dist/public/assets/{skills-api-zXSg3eSX.js → skills-api-CCijBzjo.js} +1 -1
  114. package/dist/public/assets/{src-CSkeVnyf.js → src-BL2eI1Ml.js} +1 -1
  115. package/dist/public/assets/storage-scope-GPc8n3Ml.js +1 -0
  116. package/dist/public/assets/{tag-pill-input-D6mNhknm.js → tag-pill-input-qgfgpKpV.js} +1 -1
  117. package/dist/public/assets/{telemetry-impl-CkdG1Ih8.js → telemetry-impl-BeAS53nH.js} +1 -1
  118. package/dist/public/assets/{telemetry-startup-Dx5_pcAU.js → telemetry-startup-DZXuTnSR.js} +1 -1
  119. package/dist/public/assets/{terminal-launch-events-BhFGIVo_.js → terminal-launch-events-3vnER_eI.js} +1 -1
  120. package/dist/public/assets/typing-burst-detector-CH2aig9r.js +8 -0
  121. package/dist/public/assets/{uninstall-DBWFuFGF.js → uninstall-sQwjSGkE.js} +1 -1
  122. package/dist/public/assets/{use-activity-panel-LWbmeKGf.js → use-activity-panel-Bw2oMJR0.js} +1 -1
  123. package/dist/public/assets/{use-apply-config-color-theme-hiddt1uL.js → use-apply-config-color-theme-Bpi7AD0s.js} +2 -2
  124. package/dist/public/assets/{use-conflicts-BAjZ5TAV.js → use-conflicts-CIjDyM9c.js} +1 -1
  125. package/dist/public/assets/{use-installed-clis-DVpPDztg.js → use-installed-clis-BTrIR9--.js} +2 -2
  126. package/dist/public/assets/{use-live-xterm-theme-C1wLG0Im.js → use-live-xterm-theme-BJbDRXxo.js} +1 -1
  127. package/dist/public/assets/{use-open-skill-DCRAgl4B.js → use-open-skill-Dkcnt-E0.js} +1 -1
  128. package/dist/public/assets/{use-semantic-search-status-CRj98qO1.js → use-semantic-search-status-7_z6UOU1.js} +1 -1
  129. package/dist/public/assets/{use-skill-origin-BAc45a3e.js → use-skill-origin-B9YRoKsz.js} +1 -1
  130. package/dist/public/assets/{use-skill-targets-DIBQkXNG.js → use-skill-targets-DZmqRDS7.js} +1 -1
  131. package/dist/public/assets/{use-skills-B2fLFrq6.js → use-skills-CkvdjORj.js} +1 -1
  132. package/dist/public/assets/{use-terminal-enabled-ChBm9j7q.js → use-terminal-enabled-CVNy5iqU.js} +1 -1
  133. package/dist/public/assets/{use-timeline-entry-diff-C3J_ZzDZ.js → use-timeline-entry-diff-Cq_12FHK.js} +1 -1
  134. package/dist/public/assets/{use-workspace-Bgh-YT5K.js → use-workspace-h2j0Puyv.js} +1 -1
  135. package/dist/public/index.html +53 -53
  136. package/dist/public/uninstall.html +4 -4
  137. package/dist/{registry-probes-BizEx7Io.mjs → registry-probes-CkvUuj4g.mjs} +1 -1
  138. package/dist/{removal-file-path-GRJ8XNYy.mjs → removal-file-path-Ca2hpj-C.mjs} +1 -1
  139. package/dist/{repair-launch-json-C9kxB7_O.mjs → repair-launch-json-yNvKJ_Q_.mjs} +1 -1
  140. package/dist/{repair-mcp-configs-eUw0D6f1.mjs → repair-mcp-configs-B7zZmotV.mjs} +1 -1
  141. package/dist/src-B8QtJGMD.mjs +1 -0
  142. package/dist/{src-Dm3AegFc.mjs → src-DUEDmRUc.mjs} +1 -1
  143. package/dist/start-C093_BOB.mjs +1 -0
  144. package/dist/{start-CllFiQRt.mjs → start-DDmXXfli.mjs} +3 -3
  145. package/package.json +4 -4
  146. package/dist/constants-yBl2PJiO.mjs +0 -1
  147. package/dist/init-D4-zC4aD.mjs +0 -1
  148. package/dist/loader-DyylMkNo.mjs +0 -1
  149. package/dist/preview-C9hE3xLw.mjs +0 -1
  150. package/dist/public/assets/ActivityModeContent-BAMgVTks.js +0 -1
  151. package/dist/public/assets/AgentConnectionsSection-DhbJCdHu.js +0 -1
  152. package/dist/public/assets/AuthModal-DT32BOAJ.js +0 -3
  153. package/dist/public/assets/FeedbackForm-DH-e8ey4.js +0 -1
  154. package/dist/public/assets/ManagedArtifactProperties-Co9aRIgQ.js +0 -1
  155. package/dist/public/assets/McpConsentDialogBody-BwguVGDQ.js +0 -1
  156. package/dist/public/assets/ReportBugDialogBody-J5o6Nxwn.js +0 -3
  157. package/dist/public/assets/SchemaConfigEditor-CzR5Lg4c.js +0 -1
  158. package/dist/public/assets/SkillCostValue-DBT6aDG-.js +0 -1
  159. package/dist/public/assets/SyncStatusBadge-BMv_As0q.js +0 -1
  160. package/dist/public/assets/agent-connections-DSKODCmO.js +0 -1
  161. package/dist/public/assets/badge-DmdA1C7r.js +0 -1
  162. package/dist/public/assets/config-schema-CIaXsCAX.js +0 -1
  163. package/dist/public/assets/field-controls-CCcf2ybM.js +0 -1
  164. package/dist/public/assets/globals-Cn_PZ-hh.css +0 -1
  165. package/dist/public/assets/index-C5VIr_NL.js +0 -2209
  166. package/dist/public/assets/storage-scope-ldi41iCU.js +0 -1
  167. package/dist/public/assets/typing-burst-detector-BK3ePa1_.js +0 -8
  168. package/dist/src-BDX8WyNE.mjs +0 -1
  169. package/dist/start-CO72b_37.mjs +0 -1
  170. /package/dist/public/assets/{globals-nzGvH8Va.js → globals-1tYd9tvU.js} +0 -0
package/dist/index.mjs CHANGED
@@ -180,7 +180,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
180
180
  `,i),o==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},n.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},n.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}},n.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var i=this;function a(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),a=-1,o=``,s,c,l,u;(a=t.indexOf(r,a+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(a)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,a));o.length<f+d&&(o=t.substring(a-f,a)+t.substring(a,a+d),s=e.substring(0,n-f),c=e.substring(n+d),l=t.substring(0,a-f),u=t.substring(a+d))}return o.length*2>=e.length?[s,c,l,u,o]:null}var o=a(n,r,Math.ceil(n.length/4)),s=a(n,r,Math.ceil(n.length/2)),c;if(!o&&!s)return null;c=s?o&&o[4].length>s[4].length?o:s:o;var l,u,d,f;e.length>t.length?(l=c[0],u=c[1],d=c[2],f=c[3]):(d=c[0],f=c[1],l=c[2],u=c[3]);var p=c[4];return[l,u,d,f,p]},n.prototype.diff_cleanupSemantic=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=0,d=0,f=0,p=0;l<e.length;)e[l][0]==a?(o[s++]=l,u=f,d=p,f=0,p=0,c=e[l][1]):(e[l][0]==i?f+=e[l][1].length:p+=e[l][1].length,c&&c.length<=Math.max(u,d)&&c.length<=Math.max(f,p)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,s--,l=s>0?o[s-1]:-1,u=0,d=0,f=0,p=0,c=null,t=!0)),l++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l<e.length;){if(e[l-1][0]==r&&e[l][0]==i){var m=e[l-1][1],h=e[l][1],g=this.diff_commonOverlap_(m,h),_=this.diff_commonOverlap_(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(l,0,new n.Diff(a,h.substring(0,g))),e[l-1][1]=m.substring(0,m.length-g),e[l+1][1]=h.substring(g),l++):(_>=m.length/2||_>=h.length/2)&&(e.splice(l,0,new n.Diff(a,m.substring(0,_))),e[l-1][0]=i,e[l-1][1]=h.substring(0,h.length-_),e[l+1][0]=r,e[l+1][1]=m.substring(_),l++),l++}l++}},n.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var r=e.charAt(e.length-1),i=t.charAt(0),a=r.match(n.nonAlphaNumericRegex_),o=i.match(n.nonAlphaNumericRegex_),s=a&&r.match(n.whitespaceRegex_),c=o&&i.match(n.whitespaceRegex_),l=s&&r.match(n.linebreakRegex_),u=c&&i.match(n.linebreakRegex_),d=l&&e.match(n.blanklineEndRegex_),f=u&&t.match(n.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==a&&e[r+1][0]==a){var i=e[r-1][1],o=e[r][1],s=e[r+1][1],c=this.diff_commonSuffix(i,o);if(c){var l=o.substring(o.length-c);i=i.substring(0,i.length-c),o=l+o.substring(0,o.length-c),s=l+s}for(var u=i,d=o,f=s,p=t(i,o)+t(o,s);o.charAt(0)===s.charAt(0);){i+=o.charAt(0),o=o.substring(1)+s.charAt(0),s=s.substring(1);var m=t(i,o)+t(o,s);m>=p&&(p=m,u=i,d=o,f=s)}e[r-1][1]!=u&&(u?e[r-1][1]=u:(e.splice(r-1,1),r--),e[r][1]=d,f?e[r+1][1]=f:(e.splice(r+1,1),r--))}r++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=!1,d=!1,f=!1,p=!1;l<e.length;)e[l][0]==a?(e[l][1].length<this.Diff_EditCost&&(f||p)?(o[s++]=l,u=f,d=p,c=e[l][1]):(s=0,c=null),f=p=!1):(e[l][0]==r?p=!0:f=!0,c&&(u&&d&&f&&p||c.length<this.Diff_EditCost/2&&u+d+f+p==3)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,c=null,u&&d?(f=p=!0,s=0):(s--,l=s>0?o[s-1]:-1,f=p=!1),t=!0)),l++;t&&this.diff_cleanupMerge(e)},n.prototype.diff_cleanupMerge=function(e){e.push(new n.Diff(a,``));for(var t=0,o=0,s=0,c=``,l=``,u;t<e.length;)switch(e[t][0]){case i:s++,l+=e[t][1],t++;break;case r:o++,c+=e[t][1],t++;break;case a:o+s>1?(o!==0&&s!==0&&(u=this.diff_commonPrefix(l,c),u!==0&&(t-o-s>0&&e[t-o-s-1][0]==a?e[t-o-s-1][1]+=l.substring(0,u):(e.splice(0,0,new n.Diff(a,l.substring(0,u))),t++),l=l.substring(u),c=c.substring(u)),u=this.diff_commonSuffix(l,c),u!==0&&(e[t][1]=l.substring(l.length-u)+e[t][1],l=l.substring(0,l.length-u),c=c.substring(0,c.length-u))),t-=o+s,e.splice(t,o+s),c.length&&(e.splice(t,0,new n.Diff(r,c)),t++),l.length&&(e.splice(t,0,new n.Diff(i,l)),t++),t++):t!==0&&e[t-1][0]==a?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,s=0,o=0,c=``,l=``}e[e.length-1][1]===``&&e.pop();var d=!1;for(t=1;t<e.length-1;)e[t-1][0]==a&&e[t+1][0]==a&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),d=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),d=!0)),t++;d&&this.diff_cleanupMerge(e)},n.prototype.diff_xIndex=function(e,t){var n=0,a=0,o=0,s=0,c;for(c=0;c<e.length&&(e[c][0]!==i&&(n+=e[c][1].length),e[c][0]!==r&&(a+=e[c][1].length),!(n>t));c++)o=n,s=a;return e.length!=c&&e[c][0]===r?s:s+(t-o)},n.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,o=/</g,s=/>/g,c=/\n/g,l=0;l<e.length;l++){var u=e[l][0],d=e[l][1].replace(n,`&amp;`).replace(o,`&lt;`).replace(s,`&gt;`).replace(c,`&para;<br>`);switch(u){case i:t[l]=`<ins style="background:#e6ffe6;">`+d+`</ins>`;break;case r:t[l]=`<del style="background:#ffe6e6;">`+d+`</del>`;break;case a:t[l]=`<span>`+d+`</span>`}}return t.join(``)},n.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==i&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==r&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_levenshtein=function(e){for(var t=0,n=0,o=0,s=0;s<e.length;s++){var c=e[s][0],l=e[s][1];switch(c){case i:n+=l.length;break;case r:o+=l.length;break;case a:t+=Math.max(n,o),n=0,o=0}}return t+=Math.max(n,o),t},n.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case i:t[n]=`+`+encodeURI(e[n][1]);break;case r:t[n]=`-`+e[n][1].length;break;case a:t[n]=`=`+e[n][1].length}return t.join(` `).replace(/%20/g,` `)},n.prototype.diff_fromDelta=function(e,t){for(var o=[],s=0,c=0,l=t.split(/\t/g),u=0;u<l.length;u++){var d=l[u].substring(1);switch(l[u].charAt(0)){case`+`:try{o[s++]=new n.Diff(i,decodeURI(d))}catch{throw Error(`Illegal escape in diff_fromDelta: `+d)}break;case`-`:case`=`:var f=parseInt(d,10);if(isNaN(f)||f<0)throw Error(`Invalid number in diff_fromDelta: `+d);var p=e.substring(c,c+=f);l[u].charAt(0)==`=`?o[s++]=new n.Diff(a,p):o[s++]=new n.Diff(r,p);break;default:if(l[u])throw Error(`Invalid diff operation in diff_fromDelta: `+l[u])}}if(c!=e.length)throw Error(`Delta length (`+c+`) does not equal source text length (`+e.length+`).`);return o},n.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},n.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),s=e.lastIndexOf(t,n+t.length),s!=-1&&(o=Math.min(a(0,s),o)));var c=1<<t.length-1;s=-1;for(var l,u,d=t.length+e.length,f,p=0;p<t.length;p++){for(l=0,u=d;l<u;)a(p,n+u)<=o?l=u:d=u,u=Math.floor((d-l)/2+l);d=u;var m=Math.max(1,n-u+1),h=Math.min(n+u,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(p===0?g[_]=(g[_+1]<<1|1)&v:g[_]=(g[_+1]<<1|1)&v|(f[_+1]|f[_])<<1|1|f[_+1],g[_]&c){var y=a(p,_-1);if(y<=o){if(o=y,s=_-1,s>n)m=Math.max(1,2*n-s);else break}}}if(a(p+1,n)>o)break;f=g}return s},n.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},n.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=t.substring(e.start2,e.start2+e.length1),i=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=t.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var o=t.substring(e.start2-i,e.start2);o&&e.diffs.unshift(new n.Diff(a,o));var s=t.substring(e.start2+e.length1,e.start2+e.length1+i);s&&e.diffs.push(new n.Diff(a,s)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+s.length,e.length2+=o.length+s.length}},n.prototype.patch_make=function(e,t,o){var s,c;if(typeof e==`string`&&typeof t==`string`&&o===void 0)s=e,c=this.diff_main(s,t,!0),c.length>2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(e&&typeof e==`object`&&t===void 0&&o===void 0)c=e,s=this.diff_text1(c);else if(typeof e==`string`&&t&&typeof t==`object`&&o===void 0)s=e,c=t;else if(typeof e==`string`&&typeof t==`string`&&o&&typeof o==`object`)s=e,c=o;else throw Error(`Unknown call format to patch_make.`);if(c.length===0)return[];for(var l=[],u=new n.patch_obj,d=0,f=0,p=0,m=s,h=s,g=0;g<c.length;g++){var _=c[g][0],v=c[g][1];switch(!d&&_!==a&&(u.start1=f,u.start2=p),_){case i:u.diffs[d++]=c[g],u.length2+=v.length,h=h.substring(0,p)+v+h.substring(p);break;case r:u.length1+=v.length,u.diffs[d++]=c[g],h=h.substring(0,p)+h.substring(p+v.length);break;case a:v.length<=2*this.Patch_Margin&&d&&c.length!=g+1?(u.diffs[d++]=c[g],u.length1+=v.length,u.length2+=v.length):v.length>=2*this.Patch_Margin&&d&&(this.patch_addContext_(u,m),l.push(u),u=new n.patch_obj,d=0,m=h,f=p)}_!==i&&(f+=v.length),_!==r&&(p+=v.length)}return d&&(this.patch_addContext_(u,m),l.push(u)),l},n.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r],a=new n.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new n.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,t[r]=a}return t},n.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var o=0,s=[],c=0;c<e.length;c++){var l=e[c].start2+o,u=this.diff_text1(e[c].diffs),d,f=-1;if(u.length>this.Match_MaxBits?(d=this.match_main(t,u.substring(0,this.Match_MaxBits),l),d!=-1&&(f=this.match_main(t,u.substring(u.length-this.Match_MaxBits),l+u.length-this.Match_MaxBits),(f==-1||d>=f)&&(d=-1))):d=this.match_main(t,u,l),d==-1)s[c]=!1,o-=e[c].length2-e[c].length1;else{s[c]=!0,o=d-l;var p=f==-1?t.substring(d,d+u.length):t.substring(d,f+this.Match_MaxBits);if(u==p)t=t.substring(0,d)+this.diff_text2(e[c].diffs)+t.substring(d+u.length);else{var m=this.diff_main(u,p,!1);if(u.length>this.Match_MaxBits&&this.diff_levenshtein(m)/u.length>this.Patch_DeleteThreshold)s[c]=!1;else{this.diff_cleanupSemanticLossless(m);for(var h=0,g,_=0;_<e[c].diffs.length;_++){var v=e[c].diffs[_];v[0]!==a&&(g=this.diff_xIndex(m,h)),v[0]===i?t=t.substring(0,d+g)+v[1]+t.substring(d+g):v[0]===r&&(t=t.substring(0,d+g)+t.substring(d+this.diff_xIndex(m,h+v[1].length))),v[0]!==r&&(h+=v[1].length)}}}}}return t=t.substring(n.length,t.length-n.length),[t,s]},n.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r=``,i=1;i<=t;i++)r+=String.fromCharCode(i);for(var i=0;i<e.length;i++)e[i].start1+=t,e[i].start2+=t;var o=e[0],s=o.diffs;if(s.length==0||s[0][0]!=a)s.unshift(new n.Diff(a,r)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>s[0][1].length){var c=t-s[0][1].length;s[0][1]=r.substring(s[0][1].length)+s[0][1],o.start1-=c,o.start2-=c,o.length1+=c,o.length2+=c}if(o=e[e.length-1],s=o.diffs,s.length==0||s[s.length-1][0]!=a)s.push(new n.Diff(a,r)),o.length1+=t,o.length2+=t;else if(t>s[s.length-1][1].length){var c=t-s[s.length-1][1].length;s[s.length-1][1]+=r.substring(0,c),o.length1+=c,o.length2+=c}return r},n.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,o=0;o<e.length;o++)if(!(e[o].length1<=t)){var s=e[o];e.splice(o--,1);for(var c=s.start1,l=s.start2,u=``;s.diffs.length!==0;){var d=new n.patch_obj,f=!0;for(d.start1=c-u.length,d.start2=l-u.length,u!==``&&(d.length1=d.length2=u.length,d.diffs.push(new n.Diff(a,u)));s.diffs.length!==0&&d.length1<t-this.Patch_Margin;){var p=s.diffs[0][0],m=s.diffs[0][1];p===i?(d.length2+=m.length,l+=m.length,d.diffs.push(s.diffs.shift()),f=!1):p===r&&d.diffs.length==1&&d.diffs[0][0]==a&&m.length>2*t?(d.length1+=m.length,c+=m.length,f=!1,d.diffs.push(new n.Diff(p,m)),s.diffs.shift()):(m=m.substring(0,t-d.length1-this.Patch_Margin),d.length1+=m.length,c+=m.length,p===a?(d.length2+=m.length,l+=m.length):f=!1,d.diffs.push(new n.Diff(p,m)),m==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(m.length))}u=this.diff_text2(d.diffs),u=u.substring(u.length-this.Patch_Margin);var h=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);h!==``&&(d.length1+=h.length,d.length2+=h.length,d.diffs.length!==0&&d.diffs[d.diffs.length-1][0]===a?d.diffs[d.diffs.length-1][1]+=h:d.diffs.push(new n.Diff(a,h))),f||e.splice(++o,0,d)}}},n.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},n.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var o=e.split(`
181
181
  `),s=0,c=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<o.length;){var l=o[s].match(c);if(!l)throw Error(`Invalid patch string: `+o[s]);var u=new n.patch_obj;for(t.push(u),u.start1=parseInt(l[1],10),l[2]===``?(u.start1--,u.length1=1):l[2]==`0`?u.length1=0:(u.start1--,u.length1=parseInt(l[2],10)),u.start2=parseInt(l[3],10),l[4]===``?(u.start2--,u.length2=1):l[4]==`0`?u.length2=0:(u.start2--,u.length2=parseInt(l[4],10)),s++;s<o.length;){var d=o[s].charAt(0);try{var f=decodeURI(o[s].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+f)}if(d==`-`)u.diffs.push(new n.Diff(r,f));else if(d==`+`)u.diffs.push(new n.Diff(i,f));else if(d==` `)u.diffs.push(new n.Diff(a,f));else if(d==`@`)break;else if(d!==``)throw Error(`Invalid patch mode "`+d+`" in: `+f);s++}}return t},n.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},n.patch_obj.prototype.toString=function(){for(var e=this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1,t=this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2,n=[`@@ -`+e+` +`+t+` @@
182
182
  `],o,s=0;s<this.diffs.length;s++){switch(this.diffs[s][0]){case i:o=`+`;break;case r:o=`-`;break;case a:o=` `}n[s+1]=o+encodeURI(this.diffs[s][1])+`
183
- `}return n.join(``).replace(/%20/g,` `)},t.exports=n,t.exports.diff_match_patch=n,t.exports.DIFF_DELETE=r,t.exports.DIFF_INSERT=i,t.exports.DIFF_EQUAL=a}))(),1);new $s.default,Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});const ec=new $s.default;ec.Match_Threshold=.5;const tc=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function nc(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function rc(e){let t=nc(e);return t!==null&&tc.has(t)}function ic(e){let t=nc(e);return t===null?null:tc.get(t)??null}const ac=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function oc(e){ac.lastIndex=0;let t=e.match(ac);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=ic(e);if(t===null)return null;n+=t}return n}const sc=[`off`,`follow`,`full`],cc=`pull`,lc=[`off`,`follow`,`full`,cc],uc=[`follow`,`full`,cc],dc=3600,fc=[`github`],pc=new Set([`gitlab.com`,`bitbucket.org`,`codeberg.org`,`gitea.com`,`sr.ht`,`sourcehut.org`]),mc=/^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?(?::\d{1,5})?$/;function hc(e){return mc.test(e)}function gc(e){let t=e.toLowerCase(),n=t===`www.github.com`?`github.com`:t;return pc.has(n)?null:n}const _c=Symbol.for(`@inkeep/open-knowledge/field-registry`),vc=globalThis;vc[_c]===void 0&&(vc[_c]=sr());const yc=vc[_c];function bc(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=xc(t)?yc.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function xc(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}const Sc=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),Cc=new Set([`md`,`mdx`,`mmd`,`mermaid`]);new Set([...Sc,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!Cc.has(e)));const wc=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Tc=[`video/mp4`,`video/webm`,`video/ogg`],Ec=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Dc=[`application/pdf`],Oc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),kc=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Ac=new Set([`pdf`]),jc=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Mc=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Nc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Pc=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Fc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Ic=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],Lc=[`mp4`,`webm`,`mov`,`m4v`],Rc=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],zc=[`pdf`],Bc=[`json`,`toml`,`lock`];function Vc(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Vc(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,Ic,Oc),Vc(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,Lc,kc),Vc(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Rc,jc),Vc(`SIDEBAR_PDF_ASSET_EXTENSIONS`,zc,Ac),Vc(`FILE_ATTACHMENT_EXTENSIONS`,[...Mc],Fc),Vc(`WIKI_EMBED_EXTENSIONS`,[...Fc],Nc),new Set(Ic),new Set(Lc),new Set(Rc),new Set(zc),new Set(Bc),Vc(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...Ic,...Lc,...Rc,...zc,...Bc])],Pc);const Hc=new Set([`base`,`canvas`]),Uc=new Set([`mmd`,`mermaid`]),Wc=new Set([`excalidraw`]),Gc=new Set([...Nc,...Hc,...Uc,...Wc]),Kc=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`,`ko`,`pl`],qc=new Set([`ar`,`ur`]),Jc=Kc.filter(e=>!qc.has(e)),Yc=[`markdownlint`,`frontmatter`,`okf`],Xc=[`missing`,`invalid`];[...Yc];const Zc=[`off`,`warning`,`error`],Qc=`warning`,$c=[`error`,`warning`],el=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],tl={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`},nl=/^#[0-9a-fA-F]{6}$/,rl=/\P{White_Space}/u,il={graphical:3,text:4.5};function al(e){return rl.test(e)}function ol(e){return typeof e==`string`&&nl.test(e)}function sl(e,t){let n=_l(e),r=_l(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function cl(e,t){return t.reduce((t,n)=>sl(e,n)>sl(e,t)?n:t)}function ll(e,t){let n=cl(e,t);return sl(e,n)>=il.text?n:cl(e,[`#000000`,`#ffffff`])}function ul(e,t,n){if(sl(e,t)>=n)return t;let r=cl(e,[`#000000`,`#ffffff`]);for(let i=1;i<=255;i+=1){let a=gl(t,r,i/255);if(sl(e,a)>=n)return a}return console.warn(`[base16] No foreground reaches a ${n}:1 contrast ratio against ${e}; using the highest-contrast endpoint`),r}function dl(e){let t=e.palette,n=gl(t.base02,e.variant===`dark`?`#ffffff`:`#000000`,.04);return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-hover-foreground":ll(t.base02,[t.base00,t.base05,t.base07]),"sidebar-hover-muted-foreground":ul(t.base02,t.base04,il.text),"sidebar-hover-destructive-foreground":ul(t.base02,t.base08,il.graphical),"sidebar-selected":n,"sidebar-selected-foreground":ll(n,[t.base00,t.base05,t.base07]),"sidebar-selected-muted-foreground":ul(n,t.base04,il.text),"sidebar-selected-destructive-foreground":ul(n,t.base08,il.graphical),"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"diff-modified":t.base0D,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...ml(t)}}const fl={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},pl=Object.keys(fl);function ml(e){let t={};for(let n of pl)t[`ansi-${hl(n)}`]=e[fl[n]];return t}function hl(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function gl(e,t,n){let r=ol(e)?e:`#000000`,i=ol(t)?t:`#000000`,a=Math.min(1,Math.max(0,n)),o=`#`;for(let e=0;e<3;e++){let t=Number.parseInt(r.slice(1+e*2,3+e*2),16),n=Number.parseInt(i.slice(1+e*2,3+e*2),16);o+=Math.round(t+(n-t)*a).toString(16).padStart(2,`0`)}return o}function _l(e){let t=ol(e)?e:`#000000`,n=e=>{let n=Number.parseInt(t.slice(1+e*2,3+e*2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(1)+.0722*n(2)}const vl={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},yl={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},bl={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1d62ec`,base0E:`#8839ef`,base0F:`#dd7878`}},xl={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},uie={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},die={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#2995e1`,base0E:`#6c71c4`,base0F:`#d33682`}};function Sl(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>dl(n)}}function Cl(e,t){return{id:e,label:t,kind:`system`}}const wl=[Cl(`default`,`Default`),Sl(`dracula`,`Dracula`,vl),Sl(`catppuccin-frappe`,`Catppuccin Frappé`,yl),Sl(`catppuccin-latte`,`Catppuccin Latte`,bl),Sl(`monokai`,`Monokai`,xl),Sl(`gruvbox`,`Gruvbox`,uie),Sl(`solarized`,`Solarized`,die),Cl(`custom`,`Custom`)],fie=wl.map(e=>e.id),Tl=/^[a-z0-9-]{1,32}$/;new Map(wl.map(e=>[e.id,e]));const El={provider:U(fc).register(yc,{scope:`user`,agentSettable:!1,reload:`boot`,defaultScope:`user`,description:"Declares that this git host is a GitHub Enterprise Server instance, so OpenKnowledge treats its remotes the way it treats github.com (OpenKnowledge credential handling, the push-permission check, share links, and the default host for `ok auth`). 'github' is the only accepted value today. A host that is not declared here and is not github.com is treated as a generic git remote, so OpenKnowledge leaves the machine's own git credentials alone and does not check push permission. Per-machine (user scope, global.yml in the OpenKnowledge home folder); a value in a project's `.ok/config.yml` is ignored. The declaration takes effect when OpenKnowledge next starts."})},pie=Object.fromEntries(Object.entries(El).map(([e,t])=>[e,t.optional().catch(void 0)])),mie=Object.fromEntries(Object.entries(El).map(([e,t])=>[e,t.nullish()])),hie=Zi(pie).catch({}),gie=H(I(),Zi(El).partial());Zi({git:Zi({hosts:H(I(),Zi(mie).nullish()).nullish()}).nullish()});const Dl=V({prefix:I().regex(/^[A-Za-z][A-Za-z0-9_-]*$/,{message:`prefix must start with a letter and use only letters, digits, _ and -`}),url:I().regex(/^https?:\/\/[^\s<>]*<num>[^\s<>]*$/,{message:`url must be an http or https URL containing <num>`})}),_ie=B(Dl),vie=Dl.nullable().catch(null);function yie(){return Object.fromEntries(el.map(e=>[e,I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${tl[e]}, as a #rrggbb hex string.`}).optional()]))}function Ol(){return fie.filter(e=>e!=="default"&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const kl=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Al=52428800,jl=26214400,Ml=12582912,Nl=`https://api.openai.com/v1`,Pl=`text-embedding-3-small`,Fl=96e3,Il=3e4,Ll=2048,Rl=16384e3,zl=6e5,Bl=Object.freeze([`127.0.0.1`]),bie=/^[1-9]\d*(s|m|h)$/,xie=/^https?:\/\//;function Vl(e){let t=e.trim();return t===``?`./`:t}function Hl(e){let t=Vl(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`||!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ul=Zi({content:Zi({dir:I().register(yc,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:I().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets, and MCP write assets given a bare file name, are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Hl,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:Zi({theme:U([`light`,`dark`,`system`]).register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:U([`system`,...Kc]).register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Ol()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Tl,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Ol()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Tl,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex(Tl,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:Zi({name:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:U([`dark`,`light`]).register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...yie()}).optional(),preview:Zi({autoOpen:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:Zi({showHiddenFiles:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillGroups:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Group skills in the sidebar by where they came from — the publisher they were imported from, or the plugin that ships them. Skills you authored stay ungrouped at the top of their scope. Per-machine (project-local) — not shared with collaborators.`}).default(!0),pinnedProjectSkills:B(I()).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Project-scope skills pinned to the top of the Skills sidebar, by name. A pinned skill also keeps its normal row, so a provenance group still lists everything from its source. Per-machine (project-local) — not shared with collaborators.`}).default([]),pinnedGlobalSkills:B(I()).register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Global-scope skills pinned to the top of the Skills sidebar, by name. Stored per USER rather than per project, so a pinned global skill follows you into every project.`}).default([])}).optional()}).default({preview:{autoOpen:!0}}),editor:Zi({wordWrap:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:Zi({autoApproveOkTools:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools for agents launched from the built-in terminal (plus `ok open` on Claude) and for in-app Agents-panel chats with any ACP agent. Destructive tools (delete/move/share/install/import) still prompt. Per-machine personal preference (user scope)."}).default(!0),browserTools:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Give in-app Claude Code and Codex chats a browser they can drive (Playwright MCP, started through npx from OpenKnowledge's own folder with a fresh in-memory profile), so an agent can open pages, click, and take screenshots. Every browser action asks for approval, with no option to always allow it, unless the agent's own mode or permission settings skip approvals. Needs Google Chrome and Node.js. Off by default; takes effect for chats started after the change. Per-machine personal preference (user scope).`}).default(!1)}).default({autoApproveOkTools:!0,browserTools:!1}),autoSync:Zi({mode:U(lc).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`What this machine syncs on a schedule for this project: 'off' (Manual — nothing scheduled; the manual pull/push actions still work), 'follow' (Auto, pull only — scheduled pulls, never a scheduled push; 'pull' is accepted as a legacy alias), or 'full' (Auto, pull and push — bidirectional). Explicit user-triggered pushes work in every mode. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:U(uc).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),pullIntervalSeconds:L().int().min(30).max(dc).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pulls while autoSync.mode is follow or full (default 30). Per-machine (project-local) — not shared.`}).optional().catch(void 0),pushIntervalSeconds:L().int().min(30).max(dc).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pushes while autoSync.mode is full (default 60). Ignored in every other mode, which never pushes on a schedule. Each cycle with pending edits authors a commit, so a shorter interval means more, smaller commits in the repo's shared history. Per-machine (project-local) — not shared.`}).optional().catch(void 0),default:$i([R(),U(lc)]).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),git:Zi({hosts:H(I(),hie).register(yc,{scope:`user`,agentSettable:!1,reload:`boot`,defaultScope:`user`,description:"Per-git-host declarations, keyed by hostname (for example ghes.example.com). Each entry says how OpenKnowledge should treat remotes on that host; today the only key an entry carries is `provider`. Hosts absent from this map are treated as generic git remotes. Per-machine (user scope, global.yml in the OpenKnowledge home folder); a value in a project's `.ok/config.yml` is ignored. Declarations take effect when OpenKnowledge next starts."}).default({}).catch({})}).default({hosts:{}}),terminal:Zi({enabled:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null),shell:I().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Absolute Windows shell executable override for the in-app terminal. PowerShell, cmd.exe, and Git Bash support OpenKnowledge-managed launches (agent chat tabs and fixed commands such as Resolve in terminal or Install Slidev) and dropped-file path insertion. A different existing executable remains usable for plain terminal tabs and shows a capability notice; requested agent and command launches open only the plain shell without running the agent or command, and dropped-file paths are refused. Empty values use automatic shell discovery. Per-machine (project-local), human-managed, and never shared via git, clone, or sync.`}).optional()}).default({enabled:null}),slides:Zi({enabled:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:Zi({localSink:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:Zi({maxBytes:L().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Al)}).default({maxBytes:Al}),logs:Zi({maxBytes:L().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(jl)}).default({maxBytes:jl}),attributeDenylist:B(I()).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...kl])}).default({enabled:!0,spans:{maxBytes:Al},logs:{maxBytes:jl},attributeDenylist:[...kl]}),skillInstallReports:Zi({enabled:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default off; when it is on, the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables still turn it off.`}).default(!1)}).default({enabled:!1})}).default({localSink:{enabled:!0,spans:{maxBytes:Al},logs:{maxBytes:jl},attributeDenylist:[...kl]},skillInstallReports:{enabled:!1}}),lossCapture:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:L().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Ml)}).default({enabled:!0,maxBytes:Ml}),bridge:Zi({backgroundThrottle:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:Zi({semantic:Zi({enabled:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:I().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (stored in secrets.yml in the OpenKnowledge home folder); it is sent to whichever endpoint this names."}).default(Nl),model:I().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(Pl),dimensions:L().int().positive().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:L().min(0).max(1).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional(),maxBatchSize:L().int().min(1).max(Ll).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Maximum number of text chunks sent in one indexing request (1–2048, default 96). The ceiling follows OpenAI's input-array limit; other providers may impose different limits. Larger requests may still be split by the character budget. Changing it preserves cached vectors and document chunking; it applies to the next indexing pass. Invalid values use the default and are reported by ok config validate and server logs.`}).default(96).catch(96),maxBatchChars:L().int().min(1).max(Rl).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Approximate cumulative character budget per indexing request (1–16384000, default 96000). A single chunk can exceed this budget. OpenAI separately caps total input at 300000 tokens per request; this character budget does not enforce that limit, and high values can produce rejected requests. Other providers have their own limits. Changing it preserves cached vectors and document chunking; it applies to the next indexing pass. Invalid values use the default and are reported by ok config validate and server logs.`}).default(Fl).catch(Fl),docTimeoutMs:L().int().min(1).max(zl).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Timeout in milliseconds for each indexing request attempt (1–600000, default 30000). A request can retry four times, and a failed grouped request can trigger individual-document requests. There is no total indexing-pass deadline: large timeouts can delay newly queued work for hours. The query timeout remains 8 seconds per attempt. Changing it preserves cached vectors and applies to the next indexing pass; an in-progress pass keeps its current timeout. Invalid values use the default and are reported by ok config validate and server logs.`}).default(Il).catch(Il)}).default({enabled:!1,baseUrl:Nl,model:Pl,maxBatchSize:96,maxBatchChars:Fl,docTimeoutMs:Il})}).default({semantic:{enabled:!1,baseUrl:Nl,model:Pl,maxBatchSize:96,maxBatchChars:Fl,docTimeoutMs:Il}}),contentRules:Zi({markdownlint:V({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:V({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:B(V({appliesTo:$i([I(),B(I())]).optional(),file:I(),enabled:R().optional()})).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]}),okf:V({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:H(I(),R()).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:V({index:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:Zi({links:U(Zc).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Qc),fileTreeIndicators:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0),suppressLogLinkAdvisories:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether unresolved links in the reserved change-history documents (lowercase-stemmed log.md / log.mdx at any depth, where the extension's case does not matter and the stem's does) are omitted from broken-link advisories: the Problems panel, file-tree indicators, source diagnostics, audits, and agent write/edit results. Default true. Raw link views still show them, and LOG.md, Log.md, and every other stem spelling are ordinary documents.`}).default(!0)}).default({links:Qc,fileTreeIndicators:!0,suppressLogLinkAdvisories:!0}),autolinks:B(vie).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Turn ticket references into links; today they apply to Agents-panel chat messages. Each entry pairs a `prefix` (for example `PRD-`) with a `url` template containing `<num>` (for example `https://linear.app/inkeep/issue/PRD-<num>`); the prefix followed by digits links to that URL with the digits in place of `<num>`. Matching is case-sensitive. An invalid entry is skipped with a warning and the others still apply. Shared with collaborators (project scope, `.ok/config.yml`)."}).default([]).catch([]),linkPreviews:Zi({enabled:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor, and a status card when you hover a GitHub pull request or issue link in an agent chat. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata, and hovering a GitHub reference asks the GitHub host's API for it, signed in as you when a GitHub sign-in is available — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),server:Zi({port:L().int().min(1).max(65535).register(yc,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Read at server start; changing it requires a restart.`}).optional(),bind:B(I().min(1)).min(1).register(yc,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...Bl]),externalUrl:Wi({protocol:/^https?$/}).regex(xie).register(yc,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — its host joins the Host/Origin allowlists (external-Host + CORS admission). Unset by default: the server admits only loopback Hosts. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Read at server start; changing it requires a restart.`}).optional(),allowExternal:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. A non-loopback server.bind without allowExternal: true is refused at boot with a one-line fix; a server.externalUrl without it boots (a committed externalUrl never arms exposure on clones — but it is project-scoped, so its host still joins the Host/Origin allowlists there), but requests carrying forwarding headers (X-Forwarded-For etc.) are refused until consent is given — proxy tolerance requires both keys. Default off. The server has no authentication of its own, so only consent behind an authenticating edge. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:$i([W(`off`),I().regex(bie)]).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' for a loopback-only, unexposed server; 'off' otherwise — a non-loopback bind, or a loopback bind declared externally reachable (server.allowExternal + server.externalUrl), stays up, because a remote agent keeps it busy over /mcp, which the idle timer does not count. Residual case the derivation cannot see: a loopback server reached by remote agents with no server.externalUrl (e.g. behind a same-box reverse proxy) still idles at 30m — set 'off' by hand. Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...Bl],allowExternal:!1})});function Sie(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Cie(e,t){let n=e;for(let e of t){n=Sie(n);let t=n?._zod?.def?.shape;if(!t){let e=n?._zod?.def;if(e?.type!==`record`)return;n=e.valueType;continue}if(n=t[String(e)],n===void 0)return}return n}function Wl(e,t){let n=Cie(e,t);if(n!==void 0)return bc(n)}var Gl,Kl=n((()=>{Gl=`1.9.1`}));function wie(e){let t=new Set([e]),n=new Set,r=e.match(ql);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(ql);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var ql,Jl,Tie=n((()=>{Kl(),ql=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,Jl=wie(Gl)}));function Yl(e,t,n,r=!1){let i=eu[$l]=eu[$l]??{version:Gl};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Gl}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${Gl}.`),!0}function Xl(e){let t=eu[$l]?.version;if(!(!t||!Jl(t)))return eu[$l]?.[e]}function Zl(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Gl}.`);let n=eu[$l];n&&delete n[e]}var Ql,$l,eu,tu=n((()=>{Kl(),Tie(),Ql=Gl.split(`.`)[0],$l=Symbol.for(`opentelemetry.js.api.${Ql}`),eu=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function nu(e,t,n){let r=Xl(`diag`);if(r)return r[e](t,...n)}var ru,Eie=n((()=>{tu(),ru=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return nu(`debug`,this._namespace,e)}error(...e){return nu(`error`,this._namespace,e)}info(...e){return nu(`info`,this._namespace,e)}warn(...e){return nu(`warn`,this._namespace,e)}verbose(...e){return nu(`verbose`,this._namespace,e)}}})),iu,au=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(iu||={})}));function Die(e,t){e<iu.NONE?e=iu.NONE:e>iu.ALL&&(e=iu.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,iu.ERROR),warn:n(`warn`,iu.WARN),info:n(`info`,iu.INFO),debug:n(`debug`,iu.DEBUG),verbose:n(`verbose`,iu.VERBOSE)}}var Oie=n((()=>{au()})),ou,su,cu=n((()=>{Eie(),Oie(),au(),tu(),ou=`diag`,su=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=Xl(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:iu.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=Xl(`diag`),i=Die(n.logLevel??iu.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return Yl(`diag`,i,t,!0)},t.disable=()=>{Zl(ou,t)},t.createComponentLogger=e=>new ru(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}));function kie(e){return Symbol.for(e)}var lu,uu,du=n((()=>{lu=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},uu=new lu})),fu,Aie=n((()=>{du(),fu=class{active(){return uu}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),pu,mu,hu,gu=n((()=>{Aie(),tu(),cu(),pu=`context`,mu=new fu,hu=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return Yl(pu,e,su.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return Xl(pu)||mu}disable(){this._getContextManager().disable(),Zl(pu,su.instance())}}})),_u,vu=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(_u||={})})),yu,bu,xu,Su=n((()=>{vu(),yu=`0000000000000000`,bu=`00000000000000000000000000000000`,xu={traceId:bu,spanId:yu,traceFlags:_u.NONE}})),Cu,wu=n((()=>{Su(),Cu=class{constructor(e=xu){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function Tu(e){return e.getValue(Ou)||void 0}function jie(){return Tu(hu.getInstance().active())}function Eu(e,t){return e.setValue(Ou,t)}function Mie(e){return e.deleteValue(Ou)}function Nie(e,t){return Eu(e,new Cu(t))}function Du(e){return Tu(e)?.spanContext()}var Ou,ku=n((()=>{du(),wu(),gu(),Ou=kie(`OpenTelemetry Context Key SPAN`)}));function Au(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(Mu[e.charCodeAt(t)]|0)+(Mu[e.charCodeAt(t+1)]|0)+(Mu[e.charCodeAt(t+2)]|0)+(Mu[e.charCodeAt(t+3)]|0);return n===t}function Pie(e){return Au(e,32)&&e!==`00000000000000000000000000000000`}function Fie(e){return Au(e,16)&&e!==`0000000000000000`}function ju(e){return Pie(e.traceId)&&Fie(e.spanId)}function Iie(e){return new Cu(e)}var Mu,Nu=n((()=>{Su(),wu(),Mu=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function Lie(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Pu,Fu,Iu=n((()=>{gu(),ku(),wu(),Nu(),Pu=hu.getInstance(),Fu=class{startSpan(e,t,n=Pu.active()){if(t?.root)return new Cu;let r=n&&Du(n);return Lie(r)&&ju(r)?new Cu(r):new Cu}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Pu.active(),c=this.startSpan(e,i,s),l=Eu(s,c);return Pu.with(l,o,void 0,c)}}})),Lu,Ru,zu=n((()=>{Iu(),Lu=new Fu,Ru=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Lu}}})),Bu,Rie=n((()=>{Iu(),Bu=class{getTracer(e,t,n){return new Fu}}})),Vu,Hu,Uu=n((()=>{zu(),Rie(),Vu=new Bu,Hu=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Ru(this,e,t,n)}getDelegate(){return this._delegate??Vu}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),Wu,zie=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Wu||={})})),Gu,Bie=n((()=>{gu(),Gu=hu.getInstance()})),Ku,qu,Vie=n((()=>{tu(),Uu(),Nu(),ku(),cu(),Ku=`trace`,qu=class e{constructor(){this._proxyTracerProvider=new Hu,this.wrapSpanContext=Iie,this.isSpanContextValid=ju,this.deleteSpan=Mie,this.getSpan=Tu,this.getActiveSpan=jie,this.getSpanContext=Du,this.setSpan=Eu,this.setSpanContext=Nie}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=Yl(Ku,this._proxyTracerProvider,su.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return Xl(Ku)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){Zl(Ku,su.instance()),this._proxyTracerProvider=new Hu}}})),Ju,Hie=n((()=>{Vie(),Ju=qu.getInstance()})),Yu=n((()=>{cu(),du(),au(),zu(),Uu(),zie(),vu(),Nu(),Su(),Bie(),Hie()}));function Uie(e,t){if(t.length===0)return e.contents??null;let n=e.getIn(t,!0);if((0,xs.isNode)(n))return n;for(let n=t.length-1;n>=0;n--){let r=e.getIn(t.slice(0,n),!0);if((0,xs.isNode)(r))return r}return e.contents??null}function Wie(e,t){let n=1,r=1,i=Math.min(t,e.length);for(let t=0;t<i;t++)e.charCodeAt(t)===10?(n++,r=1):r++;return{line:n,column:r}}function Xu(e,t,n,r,i){let a=e.split(`
183
+ `}return n.join(``).replace(/%20/g,` `)},t.exports=n,t.exports.diff_match_patch=n,t.exports.DIFF_DELETE=r,t.exports.DIFF_INSERT=i,t.exports.DIFF_EQUAL=a}))(),1);new $s.default,Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});const ec=new $s.default;ec.Match_Threshold=.5;const tc=new Map([[32,` `],[9,` `],[160,`\xA0`]]);function nc(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function rc(e){let t=nc(e);return t!==null&&tc.has(t)}function ic(e){let t=nc(e);return t===null?null:tc.get(t)??null}const ac=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function oc(e){ac.lastIndex=0;let t=e.match(ac);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=ic(e);if(t===null)return null;n+=t}return n}const sc=[`off`,`follow`,`full`],cc=`pull`,lc=[`off`,`follow`,`full`,cc],uc=[`follow`,`full`,cc],dc=3600,fc=[`github`],pc=new Set([`gitlab.com`,`bitbucket.org`,`codeberg.org`,`gitea.com`,`sr.ht`,`sourcehut.org`]),mc=/^[A-Za-z0-9](?:[A-Za-z0-9.-]*[A-Za-z0-9])?(?::\d{1,5})?$/;function hc(e){return mc.test(e)}function gc(e){let t=e.toLowerCase(),n=t===`www.github.com`?`github.com`:t;return pc.has(n)?null:n}const _c=Symbol.for(`@inkeep/open-knowledge/field-registry`),vc=globalThis;vc[_c]===void 0&&(vc[_c]=sr());const yc=vc[_c];function bc(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=xc(t)?yc.get(t):void 0;if(e!==void 0)return e;let n=t._zod?.def?.innerType;if(n===void 0)return;t=n}}function xc(e){return typeof e==`object`&&!!e&&`_zod`in e&&`parse`in e}const Sc=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),Cc=new Set([`md`,`mdx`,`mmd`,`mermaid`]);new Set([...Sc,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!Cc.has(e)));const wc=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Tc=[`video/mp4`,`video/webm`,`video/ogg`],Ec=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Dc=[`application/pdf`],Oc=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),kc=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Ac=new Set([`pdf`]),jc=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Mc=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Nc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Pc=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),Fc=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Ic=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],Lc=[`mp4`,`webm`,`mov`,`m4v`],Rc=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],zc=[`pdf`],Bc=[`json`,`toml`,`lock`];function Vc(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}Vc(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,Ic,Oc),Vc(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,Lc,kc),Vc(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,Rc,jc),Vc(`SIDEBAR_PDF_ASSET_EXTENSIONS`,zc,Ac),Vc(`FILE_ATTACHMENT_EXTENSIONS`,[...Mc],Fc),Vc(`WIKI_EMBED_EXTENSIONS`,[...Fc],Nc),new Set(Ic),new Set(Lc),new Set(Rc),new Set(zc),new Set(Bc),Vc(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...Ic,...Lc,...Rc,...zc,...Bc])],Pc);const Hc=new Set([`base`,`canvas`]),Uc=new Set([`mmd`,`mermaid`]),Wc=new Set([`excalidraw`]),Gc=new Set([...Nc,...Hc,...Uc,...Wc]),Kc=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`,`ko`,`pl`],qc=new Set([`ar`,`ur`]),Jc=Kc.filter(e=>!qc.has(e)),Yc=[`markdownlint`,`frontmatter`,`okf`],Xc=[`missing`,`invalid`];[...Yc];const Zc=[`off`,`warning`,`error`],Qc=`warning`,$c=[`error`,`warning`],el=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],tl={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`},nl=/^#[0-9a-fA-F]{6}$/,rl=/\P{White_Space}/u,il={graphical:3,text:4.5};function al(e){return rl.test(e)}function ol(e){return typeof e==`string`&&nl.test(e)}function sl(e,t){let n=_l(e),r=_l(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function cl(e,t){return t.reduce((t,n)=>sl(e,n)>sl(e,t)?n:t)}function ll(e,t){let n=cl(e,t);return sl(e,n)>=il.text?n:cl(e,[`#000000`,`#ffffff`])}function ul(e,t,n,r=0){let i=cl(e[0]??`#ffffff`,[`#000000`,`#ffffff`]),a=e=>{for(let n=0;n<=255;n+=1){let r=n===0?t:gl(t,i,n/255);if(e(r))return r}return null},o=t=>e.every(e=>sl(e,t)>=n),s=t=>e.every(e=>sl(gl(e,t,r),t)>=n),c=a(e=>o(e)&&s(e))??a(o);return c===null?(console.warn(`[base16] No foreground reaches a ${n}:1 contrast ratio against ${e.join(`, `)}; using the highest-contrast endpoint`),i):c}function dl(e){let t=e.palette,n=gl(t.base02,e.variant===`dark`?`#ffffff`:`#000000`,.04),r=e=>ul([t.base00,t.base01],e,il.text,.25);return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:r(t.base08),success:r(t.base0B),warning:r(t.base0A),info:r(t.base0D),border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,"identity-1":t.base0E,"identity-2":t.base0C,"identity-3":t.base09,"identity-4":t.base0F,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-hover-foreground":ll(t.base02,[t.base00,t.base05,t.base07]),"sidebar-hover-muted-foreground":ul([t.base02],t.base04,il.text),"sidebar-hover-destructive-foreground":ul([t.base02],t.base08,il.graphical),"sidebar-selected":n,"sidebar-selected-foreground":ll(n,[t.base00,t.base05,t.base07]),"sidebar-selected-muted-foreground":ul([n],t.base04,il.text),"sidebar-selected-destructive-foreground":ul([n],t.base08,il.graphical),"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"diff-modified":t.base0D,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...ml(t)}}const fl={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},pl=Object.keys(fl);function ml(e){let t={};for(let n of pl)t[`ansi-${hl(n)}`]=e[fl[n]];return t}function hl(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}function gl(e,t,n){let r=ol(e)?e:`#000000`,i=ol(t)?t:`#000000`,a=Math.min(1,Math.max(0,n)),o=`#`;for(let e=0;e<3;e++){let t=Number.parseInt(r.slice(1+e*2,3+e*2),16),n=Number.parseInt(i.slice(1+e*2,3+e*2),16);o+=Math.round(t+(n-t)*a).toString(16).padStart(2,`0`)}return o}function _l(e){let t=ol(e)?e:`#000000`,n=e=>{let n=Number.parseInt(t.slice(1+e*2,3+e*2),16)/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*n(0)+.7152*n(1)+.0722*n(2)}const vl={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},yl={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},bl={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1d62ec`,base0E:`#8839ef`,base0F:`#dd7878`}},xl={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},uie={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},die={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#2995e1`,base0E:`#6c71c4`,base0F:`#d33682`}};function Sl(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>dl(n)}}function Cl(e,t){return{id:e,label:t,kind:`system`}}const wl=[Cl(`default`,`Default`),Sl(`dracula`,`Dracula`,vl),Sl(`catppuccin-frappe`,`Catppuccin Frappé`,yl),Sl(`catppuccin-latte`,`Catppuccin Latte`,bl),Sl(`monokai`,`Monokai`,xl),Sl(`gruvbox`,`Gruvbox`,uie),Sl(`solarized`,`Solarized`,die),Cl(`custom`,`Custom`)],fie=wl.map(e=>e.id),Tl=/^[a-z0-9-]{1,32}$/;new Map(wl.map(e=>[e.id,e]));const El={provider:U(fc).register(yc,{scope:`user`,agentSettable:!1,reload:`boot`,defaultScope:`user`,description:"Declares that this git host is a GitHub Enterprise Server instance, so OpenKnowledge treats its remotes the way it treats github.com (OpenKnowledge credential handling, the push-permission check, share links, and the default host for `ok auth`). 'github' is the only accepted value today. A host that is not declared here and is not github.com is treated as a generic git remote, so OpenKnowledge leaves the machine's own git credentials alone and does not check push permission. Per-machine (user scope, global.yml in the OpenKnowledge home folder); a value in a project's `.ok/config.yml` is ignored. The declaration takes effect when OpenKnowledge next starts."})},pie=Object.fromEntries(Object.entries(El).map(([e,t])=>[e,t.optional().catch(void 0)])),mie=Object.fromEntries(Object.entries(El).map(([e,t])=>[e,t.nullish()])),hie=Zi(pie).catch({}),gie=H(I(),Zi(El).partial());Zi({git:Zi({hosts:H(I(),Zi(mie).nullish()).nullish()}).nullish()});const Dl=V({prefix:I().regex(/^[A-Za-z][A-Za-z0-9_-]*$/,{message:`prefix must start with a letter and use only letters, digits, _ and -`}),url:I().regex(/^https?:\/\/[^\s<>]*<num>[^\s<>]*$/,{message:`url must be an http or https URL containing <num>`})}),_ie=B(Dl),vie=Dl.nullable().catch(null);function yie(){return Object.fromEntries(el.map(e=>[e,I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${tl[e]}, as a #rrggbb hex string.`}).optional()]))}function Ol(){return fie.filter(e=>e!=="default"&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const kl=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),Al=52428800,jl=26214400,Ml=12582912,Nl=`https://api.openai.com/v1`,Pl=`text-embedding-3-small`,Fl=96e3,Il=3e4,Ll=2048,Rl=16384e3,zl=6e5,Bl=Object.freeze([`127.0.0.1`]),bie=/^[1-9]\d*(s|m|h)$/,xie=/^https?:\/\//;function Vl(e){let t=e.trim();return t===``?`./`:t}function Hl(e){let t=Vl(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`||!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ul=Zi({content:Zi({dir:I().register(yc,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore. Read at server start; changing it requires a restart.`}).default(`.`),attachmentFolderPath:I().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Where pasted and dropped assets, and MCP write assets given a bare file name, are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(Hl,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:Zi({theme:U([`light`,`dark`,`system`]).register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:U([`system`,...Kc]).register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Ol()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Tl,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeDark:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), one of ${Ol()}, or the id of a saved theme. A short id of lowercase letters, digits, and hyphens (max 32 characters); an id no palette matches falls back to 'default' for this mode only, leaving the rest of your config untouched. A personal preference (user scope) — not shared with the project.`}).regex(Tl,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorTheme:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A short theme id (lowercase letters, digits, and hyphens; max 32 characters); an id no palette matches falls back to 'default'. A personal preference (user scope) — not shared with the project.`}).regex(Tl,{message:`Theme id must be lowercase letters, digits, and hyphens, 1–32 characters (e.g. 'dracula', 'custom', or a saved theme id).`}).optional(),colorThemeEnabled:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:Zi({name:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:I().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:U([`dark`,`light`]).register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...yie()}).optional(),preview:Zi({autoOpen:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:Zi({showHiddenFiles:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillGroups:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Group skills in the sidebar by where they came from — the publisher they were imported from, or the plugin that ships them. Skills you authored stay ungrouped at the top of their scope. Per-machine (project-local) — not shared with collaborators.`}).default(!0),pinnedProjectSkills:B(I()).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Project-scope skills pinned to the top of the Skills sidebar, by name. A pinned skill also keeps its normal row, so a provenance group still lists everything from its source. Per-machine (project-local) — not shared with collaborators.`}).default([]),pinnedGlobalSkills:B(I()).register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Global-scope skills pinned to the top of the Skills sidebar, by name. Stored per USER rather than per project, so a pinned global skill follows you into every project.`}).default([])}).optional()}).default({preview:{autoOpen:!0}}),editor:Zi({wordWrap:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:Zi({autoApproveOkTools:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools for agents launched from the built-in terminal (plus `ok open` on Claude) and for in-app Agents-panel chats with any ACP agent. Destructive tools (delete/move/share/install/import) still prompt. Per-machine personal preference (user scope)."}).default(!0),browserTools:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Give in-app Claude Code and Codex chats a browser they can drive (Playwright MCP, started through npx from OpenKnowledge's own folder with a fresh in-memory profile), so an agent can open pages, click, and take screenshots. Every browser action asks for approval, with no option to always allow it, unless the agent's own mode or permission settings skip approvals. Needs Google Chrome and Node.js. Off by default; takes effect for chats started after the change. Per-machine personal preference (user scope).`}).default(!1)}).default({autoApproveOkTools:!0,browserTools:!1}),autoSync:Zi({mode:U(lc).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`What this machine syncs on a schedule for this project: 'off' (Manual — nothing scheduled; the manual pull/push actions still work), 'follow' (Auto, pull only — scheduled pulls, never a scheduled push; 'pull' is accepted as a legacy alias), or 'full' (Auto, pull and push — bidirectional). Explicit user-triggered pushes work in every mode. null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:U(uc).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),pullIntervalSeconds:L().int().min(30).max(dc).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pulls while autoSync.mode is follow or full (default 30). Per-machine (project-local) — not shared.`}).optional().catch(void 0),pushIntervalSeconds:L().int().min(30).max(dc).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Seconds between scheduled pushes while autoSync.mode is full (default 60). Ignored in every other mode, which never pushes on a schedule. Each cycle with pending edits authors a commit, so a shorter interval means more, smaller commits in the repo's shared history. Per-machine (project-local) — not shared.`}).optional().catch(void 0),default:$i([R(),U(lc)]).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),git:Zi({hosts:H(I(),hie).register(yc,{scope:`user`,agentSettable:!1,reload:`boot`,defaultScope:`user`,description:"Per-git-host declarations, keyed by hostname (for example ghes.example.com). Each entry says how OpenKnowledge should treat remotes on that host; today the only key an entry carries is `provider`. Hosts absent from this map are treated as generic git remotes. Per-machine (user scope, global.yml in the OpenKnowledge home folder); a value in a project's `.ok/config.yml` is ignored. Declarations take effect when OpenKnowledge next starts."}).default({}).catch({})}).default({hosts:{}}),terminal:Zi({enabled:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null),shell:I().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Absolute Windows shell executable override for the in-app terminal. PowerShell, cmd.exe, and Git Bash support OpenKnowledge-managed launches (agent chat tabs and fixed commands such as Resolve in terminal or Install Slidev) and dropped-file path insertion. A different existing executable remains usable for plain terminal tabs and shows a capability notice; requested agent and command launches open only the plain shell without running the agent or command, and dropped-file paths are refused. Empty values use automatic shell discovery. Per-machine (project-local), human-managed, and never shared via git, clone, or sync.`}).optional()}).default({enabled:null}),slides:Zi({enabled:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:Zi({localSink:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:Zi({maxBytes:L().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(Al)}).default({maxBytes:Al}),logs:Zi({maxBytes:L().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(jl)}).default({maxBytes:jl}),attributeDenylist:B(I()).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...kl])}).default({enabled:!0,spans:{maxBytes:Al},logs:{maxBytes:jl},attributeDenylist:[...kl]}),skillInstallReports:Zi({enabled:R().register(yc,{scope:`user`,agentSettable:!1,reload:`live`,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default off; when it is on, the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables still turn it off.`}).default(!1)}).default({enabled:!1})}).default({localSink:{enabled:!0,spans:{maxBytes:Al},logs:{maxBytes:jl},attributeDenylist:[...kl]},skillInstallReports:{enabled:!1}}),lossCapture:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:L().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Ml)}).default({enabled:!0,maxBytes:Ml}),bridge:Zi({backgroundThrottle:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:Zi({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:Zi({semantic:Zi({enabled:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:I().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (stored in secrets.yml in the OpenKnowledge home folder); it is sent to whichever endpoint this names."}).default(Nl),model:I().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(Pl),dimensions:L().int().positive().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:L().min(0).max(1).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional(),maxBatchSize:L().int().min(1).max(Ll).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Maximum number of text chunks sent in one indexing request (1–2048, default 96). The ceiling follows OpenAI's input-array limit; other providers may impose different limits. Larger requests may still be split by the character budget. Changing it preserves cached vectors and document chunking; it applies to the next indexing pass. Invalid values use the default and are reported by ok config validate and server logs.`}).default(96).catch(96),maxBatchChars:L().int().min(1).max(Rl).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Approximate cumulative character budget per indexing request (1–16384000, default 96000). A single chunk can exceed this budget. OpenAI separately caps total input at 300000 tokens per request; this character budget does not enforce that limit, and high values can produce rejected requests. Other providers have their own limits. Changing it preserves cached vectors and document chunking; it applies to the next indexing pass. Invalid values use the default and are reported by ok config validate and server logs.`}).default(Fl).catch(Fl),docTimeoutMs:L().int().min(1).max(zl).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Timeout in milliseconds for each indexing request attempt (1–600000, default 30000). A request can retry four times, and a failed grouped request can trigger individual-document requests. There is no total indexing-pass deadline: large timeouts can delay newly queued work for hours. The query timeout remains 8 seconds per attempt. Changing it preserves cached vectors and applies to the next indexing pass; an in-progress pass keeps its current timeout. Invalid values use the default and are reported by ok config validate and server logs.`}).default(Il).catch(Il)}).default({enabled:!1,baseUrl:Nl,model:Pl,maxBatchSize:96,maxBatchChars:Fl,docTimeoutMs:Il})}).default({semantic:{enabled:!1,baseUrl:Nl,model:Pl,maxBatchSize:96,maxBatchChars:Fl,docTimeoutMs:Il}}),contentRules:Zi({markdownlint:V({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:V({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:B(V({appliesTo:$i([I(),B(I())]).optional(),file:I(),enabled:R().optional()})).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]}),okf:V({enabled:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the OKF plugin (Open Knowledge Format portability + conformance rules) contributes diagnostics. Advisory warnings; never blocks a write.`}).default(!1),rules:H(I(),R()).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Per-rule opt-outs for the OKF plugin, keyed by rule id (e.g. no-wiki-links). Omit a rule to leave it enabled; set false to silence it while keeping the plugin on.`}).optional(),generate:V({index:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether OK generates and maintains a navigation index.md in every folder that contains Markdown, each listing the documents in that folder grouped by frontmatter type and linking to its subfolders. OK owns these files: edits to them are replaced on the next rebuild.`}).default(!1)}).default({index:!1})}).default({enabled:!1,generate:{index:!1}})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]},okf:{enabled:!1,generate:{index:!1}}}),validation:Zi({links:U(Zc).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(Qc),fileTreeIndicators:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0),suppressLogLinkAdvisories:R().register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:`Whether unresolved links in the reserved change-history documents (lowercase-stemmed log.md / log.mdx at any depth, where the extension's case does not matter and the stem's does) are omitted from broken-link advisories: the Problems panel, file-tree indicators, source diagnostics, audits, and agent write/edit results. Default true. Raw link views still show them, and LOG.md, Log.md, and every other stem spelling are ordinary documents.`}).default(!0)}).default({links:Qc,fileTreeIndicators:!0,suppressLogLinkAdvisories:!0}),autolinks:B(vie).register(yc,{scope:`project`,agentSettable:!1,reload:`live`,defaultScope:`project`,description:"Turn ticket references into links; today they apply to Agents-panel chat messages. Each entry pairs a `prefix` (for example `PRD-`) with a `url` template containing `<num>` (for example `https://linear.app/inkeep/issue/PRD-<num>`); the prefix followed by digits links to that URL with the digits in place of `<num>`. Matching is case-sensitive. An invalid entry is skipped with a warning and the others still apply. Shared with collaborators (project scope, `.ok/config.yml`)."}).default([]).catch([]),linkPreviews:Zi({enabled:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor, and a status card when you hover a GitHub pull request or issue link in an agent chat. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata, and hovering a GitHub reference asks the GitHub host's API for it, signed in as you when a GitHub sign-in is available — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),server:Zi({port:L().int().min(1).max(65535).register(yc,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`TCP port the server listens on. Unset by default: a local start picks a free port dynamically, and deployment platforms inject the PORT environment variable instead. Read at server start; changing it requires a restart.`}).optional(),bind:B(I().min(1)).min(1).register(yc,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Addresses the server binds, e.g. [127.0.0.1] or [0.0.0.0]. Default loopback-only ([127.0.0.1]): nothing off this machine can connect. A non-loopback bind additionally requires the server.allowExternal consent interlock. Per-machine (project-local): a value committed to .ok/config.yml is ignored, so one machine exposing the server can never break local clones for the rest of the team — the exposing host sets it via OK_BIND, --bind, or .ok/local/config.yml. Lists replace, never merge. Read at server start; changing it requires a restart.`}).default([...Bl]),externalUrl:Wi({protocol:/^https?$/}).regex(xie).register(yc,{scope:`project`,agentSettable:!1,reload:`boot`,defaultScope:`project`,description:`Canonical external origin the server is reached at, e.g. https://kb.example.com — its host joins the Host/Origin allowlists (external-Host + CORS admission). Unset by default: the server admits only loopback Hosts. Setting it declares external exposure, which additionally requires the server.allowExternal consent interlock. Read at server start; changing it requires a restart.`}).optional(),allowExternal:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Exposure consent interlock. A non-loopback server.bind without allowExternal: true is refused at boot with a one-line fix; a server.externalUrl without it boots (a committed externalUrl never arms exposure on clones — but it is project-scoped, so its host still joins the Host/Origin allowlists there), but requests carrying forwarding headers (X-Forwarded-For etc.) are refused until consent is given — proxy tolerance requires both keys. Default off. The server has no authentication of its own, so only consent behind an authenticating edge. Per-machine (project-local) — consent never travels via git, clone, or share; containers consent via the environment instead.`}).default(!1),openBrowser:R().register(yc,{scope:`project-local`,agentSettable:!1,reload:`boot`,defaultScope:`project-local`,description:`Open the UI in a browser when the server starts. Default derived: true when every bind address is loopback (a laptop start pops the UI), false otherwise (a container or exposed bind is headless and must never try). Acts once at start. Per-machine (project-local) — not shared.`}).optional(),idleShutdown:$i([W(`off`),I().regex(bie)]).register(yc,{scope:`project-local`,agentSettable:!1,reload:`live`,defaultScope:`project-local`,description:`Shut the server down after this long with no activity: a duration like '30m' (positive integer with unit s, m, or h), or 'off'. Default derived: '30m' for a loopback-only, unexposed server; 'off' otherwise — a non-loopback bind, or a loopback bind declared externally reachable (server.allowExternal + server.externalUrl), stays up, because a remote agent keeps it busy over /mcp, which the idle timer does not count. Residual case the derivation cannot see: a loopback server reached by remote agents with no server.externalUrl (e.g. behind a same-box reverse proxy) still idles at 30m — set 'off' by hand. Reloadable — a valid change applies without a restart. Per-machine (project-local) — not shared.`}).optional()}).default({bind:[...Bl],allowExternal:!1})});function Sie(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function Cie(e,t){let n=e;for(let e of t){n=Sie(n);let t=n?._zod?.def?.shape;if(!t){let e=n?._zod?.def;if(e?.type!==`record`)return;n=e.valueType;continue}if(n=t[String(e)],n===void 0)return}return n}function Wl(e,t){let n=Cie(e,t);if(n!==void 0)return bc(n)}var Gl,Kl=n((()=>{Gl=`1.9.1`}));function wie(e){let t=new Set([e]),n=new Set,r=e.match(ql);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(ql);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var ql,Jl,Tie=n((()=>{Kl(),ql=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,Jl=wie(Gl)}));function Yl(e,t,n,r=!1){let i=eu[$l]=eu[$l]??{version:Gl};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Gl}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${Gl}.`),!0}function Xl(e){let t=eu[$l]?.version;if(!(!t||!Jl(t)))return eu[$l]?.[e]}function Zl(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Gl}.`);let n=eu[$l];n&&delete n[e]}var Ql,$l,eu,tu=n((()=>{Kl(),Tie(),Ql=Gl.split(`.`)[0],$l=Symbol.for(`opentelemetry.js.api.${Ql}`),eu=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function nu(e,t,n){let r=Xl(`diag`);if(r)return r[e](t,...n)}var ru,Eie=n((()=>{tu(),ru=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return nu(`debug`,this._namespace,e)}error(...e){return nu(`error`,this._namespace,e)}info(...e){return nu(`info`,this._namespace,e)}warn(...e){return nu(`warn`,this._namespace,e)}verbose(...e){return nu(`verbose`,this._namespace,e)}}})),iu,au=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(iu||={})}));function Die(e,t){e<iu.NONE?e=iu.NONE:e>iu.ALL&&(e=iu.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,iu.ERROR),warn:n(`warn`,iu.WARN),info:n(`info`,iu.INFO),debug:n(`debug`,iu.DEBUG),verbose:n(`verbose`,iu.VERBOSE)}}var Oie=n((()=>{au()})),ou,su,cu=n((()=>{Eie(),Oie(),au(),tu(),ou=`diag`,su=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=Xl(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:iu.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=Xl(`diag`),i=Die(n.logLevel??iu.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return Yl(`diag`,i,t,!0)},t.disable=()=>{Zl(ou,t)},t.createComponentLogger=e=>new ru(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}));function kie(e){return Symbol.for(e)}var lu,uu,du=n((()=>{lu=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},uu=new lu})),fu,Aie=n((()=>{du(),fu=class{active(){return uu}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),pu,mu,hu,gu=n((()=>{Aie(),tu(),cu(),pu=`context`,mu=new fu,hu=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return Yl(pu,e,su.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return Xl(pu)||mu}disable(){this._getContextManager().disable(),Zl(pu,su.instance())}}})),_u,vu=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(_u||={})})),yu,bu,xu,Su=n((()=>{vu(),yu=`0000000000000000`,bu=`00000000000000000000000000000000`,xu={traceId:bu,spanId:yu,traceFlags:_u.NONE}})),Cu,wu=n((()=>{Su(),Cu=class{constructor(e=xu){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function Tu(e){return e.getValue(Ou)||void 0}function jie(){return Tu(hu.getInstance().active())}function Eu(e,t){return e.setValue(Ou,t)}function Mie(e){return e.deleteValue(Ou)}function Nie(e,t){return Eu(e,new Cu(t))}function Du(e){return Tu(e)?.spanContext()}var Ou,ku=n((()=>{du(),wu(),gu(),Ou=kie(`OpenTelemetry Context Key SPAN`)}));function Au(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(Mu[e.charCodeAt(t)]|0)+(Mu[e.charCodeAt(t+1)]|0)+(Mu[e.charCodeAt(t+2)]|0)+(Mu[e.charCodeAt(t+3)]|0);return n===t}function Pie(e){return Au(e,32)&&e!==`00000000000000000000000000000000`}function Fie(e){return Au(e,16)&&e!==`0000000000000000`}function ju(e){return Pie(e.traceId)&&Fie(e.spanId)}function Iie(e){return new Cu(e)}var Mu,Nu=n((()=>{Su(),wu(),Mu=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])}));function Lie(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Pu,Fu,Iu=n((()=>{gu(),ku(),wu(),Nu(),Pu=hu.getInstance(),Fu=class{startSpan(e,t,n=Pu.active()){if(t?.root)return new Cu;let r=n&&Du(n);return Lie(r)&&ju(r)?new Cu(r):new Cu}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Pu.active(),c=this.startSpan(e,i,s),l=Eu(s,c);return Pu.with(l,o,void 0,c)}}})),Lu,Ru,zu=n((()=>{Iu(),Lu=new Fu,Ru=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Lu}}})),Bu,Rie=n((()=>{Iu(),Bu=class{getTracer(e,t,n){return new Fu}}})),Vu,Hu,Uu=n((()=>{zu(),Rie(),Vu=new Bu,Hu=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Ru(this,e,t,n)}getDelegate(){return this._delegate??Vu}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),Wu,zie=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Wu||={})})),Gu,Bie=n((()=>{gu(),Gu=hu.getInstance()})),Ku,qu,Vie=n((()=>{tu(),Uu(),Nu(),ku(),cu(),Ku=`trace`,qu=class e{constructor(){this._proxyTracerProvider=new Hu,this.wrapSpanContext=Iie,this.isSpanContextValid=ju,this.deleteSpan=Mie,this.getSpan=Tu,this.getActiveSpan=jie,this.getSpanContext=Du,this.setSpan=Eu,this.setSpanContext=Nie}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=Yl(Ku,this._proxyTracerProvider,su.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return Xl(Ku)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){Zl(Ku,su.instance()),this._proxyTracerProvider=new Hu}}})),Ju,Hie=n((()=>{Vie(),Ju=qu.getInstance()})),Yu=n((()=>{cu(),du(),au(),zu(),Uu(),zie(),vu(),Nu(),Su(),Bie(),Hie()}));function Uie(e,t){if(t.length===0)return e.contents??null;let n=e.getIn(t,!0);if((0,xs.isNode)(n))return n;for(let n=t.length-1;n>=0;n--){let r=e.getIn(t.slice(0,n),!0);if((0,xs.isNode)(r))return r}return e.contents??null}function Wie(e,t){let n=1,r=1,i=Math.min(t,e.length);for(let t=0;t<i;t++)e.charCodeAt(t)===10?(n++,r=1):r++;return{line:n,column:r}}function Xu(e,t,n,r,i){let a=e.split(`
184
184
  `),o=r-1;if(o<0||o>=a.length)return``;let s=a[o]??``,c=t-(i-1)+s.length,l=Math.max(1,Math.min(n,c)-t),u=[],d=String(o+2).length;for(let e=Math.max(0,o-1);e<=Math.min(a.length-1,o+1);e++){let t=e===o,n=t?`>`:` `,r=String(e+1).padStart(d,` `);if(u.push(`${n} ${r} | ${a[e]??``}`),t){let e=` `.repeat(2+d+3+i-1);u.push(`${e}${`^`.repeat(l)}`)}}return u.join(`
185
185
  `)}function Zu(e){let t=Uie(e.doc,e.path);if(!t)return;let n=t.range;if(!n)return;let[r,,i=r]=n,{line:a,column:o}=Wie(e.source,r),s=(0,xs.isCollection)(t)?Xu(e.source,r,r+1,a,o):Xu(e.source,r,i,a,o);return{file:e.file,line:a,column:o,snippet:s.length>0?s:void 0}}const Qu=()=>`Run \`${mt()} config migrate\` to strip the obsolete key automatically, or remove it by hand.`,$u=[{path:[`content`,`include`],get redirect(){return[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,Qu()].join(` `)}},{path:[`content`,`exclude`],get redirect(){return[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,Qu()].join(` `)}},{path:[`folders`],get redirect(){return[`folders is no longer a top-level config field.`,"A folder's own frontmatter (open-shape, like a doc's) lives in nested `<folder>/.ok/frontmatter.yml`; new-doc starting properties come from templates in `<folder>/.ok/templates/`.","Edit via the folder overview in the editor sidebar, or `edit({ folder: { path, frontmatter } })` via the MCP.",Qu()].join(` `)}},{path:[`appearance`,`editorModeDefault`],get redirect(){return[`appearance.editorModeDefault was removed and is never read — new docs always open in WYSIWYG; toggle mode via the editor mode button.`,Qu()].join(` `)}},{path:[`upload`,`maxBytes`],get redirect(){return[`streaming uploads have no user-facing cap; the value is hardcoded in @inkeep/open-knowledge-core.`,Qu()].join(` `)}},{path:[`github`,`oauthAppClientId`],get redirect(){return[`Use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID environment variable instead.`,Qu()].join(` `)}},{path:[`server`,`host`],get redirect(){return[`Use server.bind in .ok/config.yml instead — a list of bind addresses, e.g. [127.0.0.1]; a non-loopback bind additionally requires server.allowExternal.`,`The --bind CLI flag and HOST environment variable also remain available.`,Qu()].join(` `)}},{path:[`remote`,`url`],get redirect(){return[`remote.url has been removed. Use server.externalUrl in .ok/config.yml instead (the public origin your tunnel serves).`,Qu()].join(` `)}},{path:[`remote`,`port`],get redirect(){return[`remote.port has been removed. Use server.port in .ok/config.yml instead.`,Qu()].join(` `)}},{path:[`server`,`publicUrl`],get redirect(){return[`server.publicUrl has been removed. Use server.externalUrl in .ok/config.yml instead (the same key under its current name).`,Qu()].join(` `)}},{path:[`server`,`openOnAgentEdit`],get redirect(){return[`This behavior was removed; the value is hardcoded.`,Qu()].join(` `)}},{path:[`mcp`,`autoStart`],get redirect(){return[`To disable MCP auto-start, set OK_MCP_AUTOSTART=0.`,Qu()].join(` `)}},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],get redirect(){return[`This value is hardcoded in @inkeep/open-knowledge-core.`,Qu()].join(` `)}},{path:[`mcp`,`tools`,`grep`,`maxResults`],get redirect(){return[`This value is hardcoded in @inkeep/open-knowledge-core.`,Qu()].join(` `)}},{path:[`mcp`,`tools`,`search`,`maxResults`],get redirect(){return[`The search result cap is hardcoded in @inkeep/open-knowledge-core; this config key was removed.`,Qu()].join(` `)}},{path:[`preview`,`baseUrl`],get redirect(){return[`preview URLs now resolve only to the running server — start one with \`${mt()} start\`.`,Qu()].join(` `)}},{path:[`preview`,`scriptSrc`],get redirect(){return[`preview.scriptSrc has been removed.`,`The code-block preview iframe now runs a fixed open network policy (it is no longer configurable).`,Qu()].join(` `)}},{path:[`appearance`,`sidebar`,`showAllFiles`],get redirect(){return[`appearance.sidebar.showAllFiles has been removed.`,`The sidebar lists every file on disk by default; dot-prefixed entries are gated by appearance.sidebar.showHiddenFiles, and appearance.sidebar.showOnlyMarkdownFiles scopes the tree down to markdown documents as a per-machine view preference.`,Qu()].join(` `)}}];function ed(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function td(e,t){let n=e;for(let e=0;e<t.length-1;e++){if(!ed(n))return!1;n=n[t[e]]}return ed(n)?t[t.length-1]in n:!1}function nd(e){let{value:t,file:n,source:r,doc:i}=e;if(!ed(t))return[];let a=[];for(let e of $u){if(!td(t,e.path))continue;let o;i!=null&&r!=null&&n!=null&&(o=Zu({file:n,source:r,doc:i,path:e.path})),a.push({code:`REMOVED_KEY`,path:e.path,redirect:e.redirect,...o===void 0?{}:{source:o}})}return a}function rd(e,t){let[n,...r]=t;if(n===void 0)return e;let i={...e};if(r.length===0)return delete i[n],i;let a=i[n];return ed(a)&&(i[n]=rd(a,r)),i}function id(e){if(!ed(e))return e;let t=e;for(let e of $u)td(t,e.path)&&(t=rd(t,e.path));return t}const ad=`acp-launch-failures.log`,od=`last-server-exit.json`,sd=`last-server-crash.json`;function Gie(e){return new Promise(t=>{setTimeout(t,e)})}const cd=`local`,ld=[`principal.json`,`state.json`,`server.lock`,`ui.lock`,`sync-state.json`,`conflicts.json`,`last-spawn-error.log`],ud=`auth.yml`,Kie=[ud,`secrets.yml`],dd=[cd,`worktrees`],fd=[...dd,`cache`,`tmp`],qie=new Set(dd),Jie=fd.filter(e=>!qie.has(e));function pd(...e){return nee(ft(),...e)}const md=V({file:I(),line:L().int().min(1),column:L().int().min(1),snippet:I().optional()}),Yie=V({path:B($i([I(),L()])),message:I(),issueCode:I(),params:H(I(),z()).optional(),source:md.optional()}),Xie=U([`user`,`project`,`project-local`,`either`]),hd=U([`user`,`project`,`project-local`]),gd=V({code:W(`YAML_PARSE`),detail:I()}),_d=V({code:W(`UNREADABLE`),detail:I()}),vd=V({code:W(`SCHEMA_INVALID`),issues:B(Yie)}),yd=V({code:W(`REMOVED_KEY`),path:B(I()),redirect:I(),source:md.optional()}),bd=V({path:B(I()),message:I(),source:md.omit({snippet:!0}).optional()}),xd=V({code:W(`VALUE_FALLBACK`),issues:B(bd)}),Sd=ea(`code`,[gd,vd,_d,V({code:W(`SCOPE_VIOLATION`),path:B(I()),expectedScope:Xie,actualScope:hd}),V({code:W(`NOT_AGENT_SETTABLE`),path:B(I())}),V({code:W(`MIXED_SCOPE`),paths:B(V({path:B(I()),scope:hd}))}),yd,V({code:W(`NOT_SYNCED`),detail:I()}),V({code:W(`WRITE_ERROR`),detail:I()}),V({code:W(`OKIGNORE_INVALID`),detail:I(),lineNumber:L().int().min(1).optional()}),V({code:W(`UNKNOWN`),message:I().optional()})]);ea(`code`,[yd,xd,gd,vd,_d]),V({diagnostics:B(ea(`code`,[V({code:W(`VALUE_FALLBACK`),scope:hd,file:I(),issues:B(bd.omit({source:!0}).extend({line:md.shape.line.optional(),column:md.shape.column.optional()}))}),V({code:W(`REMOVED_KEY`),scope:hd,file:I(),path:B(I()),redirect:I()}),V({code:W(`YAML_PARSE`),scope:hd,file:I()}),V({code:W(`SCHEMA_INVALID`),scope:hd,file:I()}),V({code:W(`UNREADABLE`),scope:hd,file:I()})]))});const Zie=new Set(Sd.options.map(e=>e.shape.code.value)),Qie=$i([Sd,Zi({code:I(),message:I().optional()})]);function Cd(e){return Zie.has(e.code)}function wd(e){switch(e){case`user`:return pd(`global.yml`);case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ${pd(`global.yml`)}`}}function $ie(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function eae(e){if(e.code===`VALUE_FALLBACK`){let t=xd.safeParse(e);if(t.success){if(t.data.issues.length===0)return`Configuration loaded with defaults for invalid settings.`;let e=[`Configuration loaded with defaults for invalid settings:`];for(let n of t.data.issues)n.source&&e.push(` ${n.source.file}:${n.source.line}:${n.source.column}`),e.push(` ${n.path.join(`.`)}: ${n.message}`);return e.join(`
186
186
  `)}}if(!Cd(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
@@ -1110,7 +1110,7 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
1110
1110
  `);try{return[...e.rescanInPlaceSkillDirs(a)].sort().join(`
1111
1111
  `)}catch{return[...a].sort().join(`
1112
1112
  `)}},async rebuildIgnorePatterns(){let t=e=>(O=e().finally(()=>{O=null}),O),o=async()=>{if(c.reset(),e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs(a)}catch(e){l8.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}let t=d,o=f,s=p,l=m,u=h,g=_,S=v,C=Date.now();return mAe(`config.ignore.rebuild`,{attributes:{}},async e=>{try{let t=y();b.clear(),i===void 0&&await XAe(n,x,b);let a=Date.now()-C;if(e.setAttributes({"ok.ignore.pattern_count":t.patternCount,"ok.ignore.nested_file_count":t.nestedFileCount,"ok.ignore.bytes":t.bytes}),l8.info({patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a},`content-filter rebuild succeeded`),r)try{r()}catch(e){l8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter onAfterRebuild callback threw — derived views may be stale`)}return{ok:!0,patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:a}}catch(e){d=t,f=o,p=s,m=l,h=u,_=g,v=S,b.clear();try{T()}catch(e){l8.warn({err:e instanceof Error?e:Error(String(e))},`content-filter rollback dirCount re-walk failed — sibling-asset counts may be stale until next rebuild`)}let n=e instanceof Error?e.message:String(e);return l8.warn({err:e instanceof Error?e:Error(n)},`content-filter rebuild failed — rolled back to previous state`),{ok:!1,error:{message:n}}}})};return O===null?t(o):(ee===null&&(ee=O.catch(()=>null).then(()=>(ee=null,t(o)))),ee)}}}async function XAe(e,t,n){let r=[{dir:e,relPath:``}],i=0;for(;r.length>0;){let{dir:e,relPath:a}=r.pop();i+=1,i>=50&&(i=0,await new Promise(e=>setImmediate(e)));let o;try{o=w(e,{withFileTypes:!0})}catch(t){l8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);continue}for(let i of o){let o=a?`${a}/${i.name}`:i.name;if(i.isDirectory()){if(m8(i.name)||t(o)||t(`${o}/`))continue;r.push({dir:j(e,i.name),relPath:o})}else i.isFile()&&a8(i.name)&&!t(o)&&n.set(a,(n.get(a)??0)+1)}}}function k8(e,t,n,r){let i;try{i=w(e,{withFileTypes:!0})}catch(t){l8.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);return}for(let a of i){let i=t?`${t}/${a.name}`:a.name;if(a.isDirectory()){if(m8(a.name)||n(i)||n(`${i}/`))continue;k8(j(e,a.name),i,n,r)}else a.isFile()&&a8(a.name)&&!n(i)&&r.set(t,(r.get(t)??0)+1)}}function A8(e){return e.split(`
1113
- `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function j8(e,t){let n=e.startsWith(`!`),r=n?e.slice(1):e,i=r.startsWith(`/`)?r.slice(1):r,a=i.endsWith(`/`)?i.slice(0,-1):i,o=r.startsWith(`/`)||a.includes(`/`)?`${t}/${i}`:`${t}/**/${i}`;return n?`!${o}`:o}function M8(e,t,n,r,i){let a;try{a=w(e,{withFileTypes:!0})}catch(t){return l8.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||m8(s.name))continue;let a=j(e,s.name),c=o8(M(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of D8){let t=j(a,e);if(g(t))try{let a=S(t,`utf-8`);i.value+=a.length;let s=A8(a).map(e=>j8(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){l8.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=M8(a,t,n,r,i)}}return o}new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};const ZAe=/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/gu;function N8(e){return e.replace(ZAe,``).normalize(`NFC`).toUpperCase().toLowerCase().normalize(`NFC`)}function P8(e){let t=N8(e);for(let e=0;e<4;e++){let e=N8(t);if(e===t)break;t=e}return t.replace(/[. ]+$/u,(e,t)=>t===0?e:``)}const QAe=new Set([`.ok`,`.open-knowledge`,`.openknowledge`,...Object.values(rt).map(({userHomeDirName:e})=>e)].map(P8));new Set([...fd,...ld,...Kie].map(P8));function $Ae(e){let t=new Set;for(let n of e){let e=n.replace(/^\.+/u,``);if(!/^[a-z0-9-]+$/u.test(e))throw Error(`cannot derive 8.3 short names for config dir "${n}"`);e.length<=2?t.add(`${e}[0-9a-f]{4}`):(t.add(e.slice(0,6)),t.add(`${e.slice(0,2)}[0-9a-f]{4}`))}return RegExp(`^(?:${[...t].join(`|`)})~\\d+$`,`u`)}$Ae(QAe);const F8=I().min(1).refine(e=>!e.includes(`\0`)&&A(e)&&se(e)===e);ea(`kind`,[V({kind:W(`file`),path:F8}),V({kind:W(`tree`),path:F8,excluded:B(F8)}).refine(({path:e,excluded:t})=>t.every(t=>M(e,t)!==``&&eje(e,t)))]),V({server_instance_id:I().min(1),owner_token:Hi(),pid:L().int().positive(),lease_protocol:I().min(1),project_dir:F8,scope_json:I(),started_at:ki()});function eje(e,t){let n=M(e,t);return n===``||n!==`..`&&!n.startsWith(`..${le}`)&&!A(n)}RegExp(`<(${AJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const tje=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,nje=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,I8=String.raw`([^\]\n]*)`,L8=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,R8=e=>RegExp(`(!?)${tje}`,e),z8=(e,t)=>RegExp(`(!?)\\[${e}\\]${nje}`,t);R8(`y`),R8(`g`),z8(I8,`y`),z8(L8,`y`),z8(I8,`g`),z8(L8,`g`);const rje=String.raw`(!?)\[([^\]\n]*)\](?:\[([^\]\n]*)\])?`;new RegExp(rje,`y`),QX(`file-watcher`),QX(`conflict-authority`),QX(`parse-pool`),Math.max(1,Math.min(4,he()-1)),t8(()=>{}),QX(`bridge-watchdog`),t8(()=>{}),QX(`server-observers`),QX(`server-observers`),QX(`agent-sessions`),new class{writes=new WeakMap;record(e,t,n){let r=this.writes.get(e)??new Map;for(let[e,t]of r)ije(t,n)||r.delete(e);r.set(t,n),this.writes.set(e,r)}hasRecentPeer(e,t,n){let r=this.writes.get(e);if(r===void 0)return!1;for(let[e,i]of r){let a=n-i;if(Math.abs(a)>=2e3){r.delete(e);continue}if(e!==t)return!0}return!1}};function ije(e,t){return e!==void 0&&Math.abs(t-e)<2e3}const B8={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(B8));const aje=Object.keys(B8),oje={discovery:`user`,project:`project`,"write-skill":`user`},V8=aje.filter(e=>oje[e]===`user`);new Set(V8.map(e=>B8[e]));const H8=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function U8(e){return new URL(e).pathname.endsWith(`.ts`)}function sje(e,t,n){let r=n.platform??process.platform,i=n.checkDesktop??!1,a=n.home??_e(),o=[],s=process.env.NODE_ENV===`test`;return i&&r===`darwin`&&(s||o.push(j(`/Applications`,H8,e)),(!s||n.home!==void 0)&&o.push(j(a,`Applications`,H8,e))),U8(t)?(o.push(fe(new URL(`../assets/skills/${e}`,t))),o):(o.push(fe(new URL(`../dist/assets/skills/${e}`,t))),o.push(fe(new URL(`../assets/skills/${e}`,t))),o.push(fe(new URL(`./assets/skills/${e}`,t))),o)}function cje(e,t,n){let r=U8(t)?`Running from source, only the source assets are read, so the bundle name is unknown or its directory under packages/server/assets/skills is missing.`:"This usually means the package build did not copy packages/server/assets into dist/assets. Run `pnpm run build` in the package that ships the skills before publishing.";return`Bundled skill asset directory not found for bundle '${e}'. Tried: ${n.join(`, `)}. ${r}`}function W8(e,t={}){let n=sje(e,import.meta.url,t);for(let e of n)if(g(e))return e;throw Error(cje(e,import.meta.url,n))}function lje(){try{let e=k(fe(import.meta.url)),t=N(e,`..`,`package.json`),n=JSON.parse(S(t,`utf-8`));if(typeof n.version==`string`&&n.version.length>0)return n.version}catch{}return`0.0.0-unknown`}lje();function uje(e,t,n){let[r,i,a,...o]=process.argv.slice(1);(r===void 0||i===void 0||a===void 0)&&(process.stderr.write(`ok-browser relay: missing the folder, files or command argument
1113
+ `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function j8(e,t){let n=e.startsWith(`!`),r=n?e.slice(1):e,i=r.startsWith(`/`)?r.slice(1):r,a=i.endsWith(`/`)?i.slice(0,-1):i,o=r.startsWith(`/`)||a.includes(`/`)?`${t}/${i}`:`${t}/**/${i}`;return n?`!${o}`:o}function M8(e,t,n,r,i){let a;try{a=w(e,{withFileTypes:!0})}catch(t){return l8.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||m8(s.name))continue;let a=j(e,s.name),c=o8(M(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of D8){let t=j(a,e);if(g(t))try{let a=S(t,`utf-8`);i.value+=a.length;let s=A8(a).map(e=>j8(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){l8.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=M8(a,t,n,r,i)}}return o}new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}};const ZAe=/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/gu;function N8(e){return e.replace(ZAe,``).normalize(`NFC`).toUpperCase().toLowerCase().normalize(`NFC`)}function P8(e){let t=N8(e);for(let e=0;e<4;e++){let e=N8(t);if(e===t)break;t=e}return t.replace(/[. ]+$/u,(e,t)=>t===0?e:``)}const QAe=new Set([`.ok`,`.open-knowledge`,`.openknowledge`,...Object.values(rt).map(({userHomeDirName:e})=>e)].map(P8));new Set([...fd,...ld,...Kie].map(P8));function $Ae(e){let t=new Set;for(let n of e){let e=n.replace(/^\.+/u,``);if(!/^[a-z0-9-]+$/u.test(e))throw Error(`cannot derive 8.3 short names for config dir "${n}"`);e.length<=2?t.add(`${e}[0-9a-f]{4}`):(t.add(e.slice(0,6)),t.add(`${e.slice(0,2)}[0-9a-f]{4}`))}return RegExp(`^(?:${[...t].join(`|`)})~\\d+$`,`u`)}$Ae(QAe);const F8=I().min(1).refine(e=>!e.includes(`\0`)&&A(e)&&se(e)===e);ea(`kind`,[V({kind:W(`file`),path:F8}),V({kind:W(`tree`),path:F8,excluded:B(F8)}).refine(({path:e,excluded:t})=>t.every(t=>M(e,t)!==``&&eje(e,t)))]),V({server_instance_id:I().min(1),owner_token:Hi(),pid:L().int().positive(),lease_protocol:I().min(1),project_dir:F8,scope_json:I(),started_at:ki()});function eje(e,t){let n=M(e,t);return n===``||n!==`..`&&!n.startsWith(`..${le}`)&&!A(n)}RegExp(`<(${AJ.map(e=>e.tagName).join(`|`)})\\b([^>]*)\\/>`,`y`);const tje=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,nje=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,I8=String.raw`([^\]\n]*)`,L8=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,R8=e=>RegExp(`(!?)${tje}`,e),z8=(e,t)=>RegExp(`(!?)\\[${e}\\]${nje}`,t);R8(`y`),R8(`g`),z8(I8,`y`),z8(L8,`y`),z8(I8,`g`),z8(L8,`g`);const rje=String.raw`(!?)\[([^\]\n]*)\](?:\[([^\]\n]*)\])?`;new RegExp(rje,`y`),QX(`file-watcher`),QX(`conflict-authority`),QX(`parse-pool`),Math.max(1,Math.min(4,he()-1)),t8(()=>{}),QX(`bridge-watchdog`),t8(()=>{}),QX(`server-observers`),QX(`server-observers`),QX(`agent-sessions`),new class{writes=new WeakMap;record(e,t,n){let r=this.writes.get(e)??new Map;for(let[e,t]of r)ije(t,n)||r.delete(e);r.set(t,n),this.writes.set(e,r)}hasRecentPeer(e,t,n){let r=this.writes.get(e);if(r===void 0)return!1;for(let[e,i]of r){let a=n-i;if(Math.abs(a)>=2e3){r.delete(e);continue}if(e!==t)return!0}return!1}};function ije(e,t){return e!==void 0&&Math.abs(t-e)<2e3}const B8={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(B8));const aje=Object.keys(B8),oje={discovery:`user`,project:`project`,"write-skill":`user`},V8=aje.filter(e=>oje[e]===`user`);new Set(V8.map(e=>B8[e]));const H8=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function U8(e){return new URL(e).pathname.endsWith(`.ts`)}function sje(e,t,n){let r=n.platform??process.platform,i=n.checkDesktop??!1,a=n.home??_e(),o=[],s=process.env.NODE_ENV===`test`;return i&&r===`darwin`&&(s||o.push(j(`/Applications`,H8,e)),(!s||n.home!==void 0)&&o.push(j(a,`Applications`,H8,e))),U8(t)?(o.push(fe(new URL(`../assets/skills/${e}`,t))),o):(o.push(fe(new URL(`../dist/assets/skills/${e}`,t))),o.push(fe(new URL(`../assets/skills/${e}`,t))),o.push(fe(new URL(`./assets/skills/${e}`,t))),o)}function cje(e,t,n){let r=U8(t)?`Running from source, only the source assets are read, so the bundle name is unknown or its directory under packages/server/assets/skills is missing.`:"This usually means the package build did not copy packages/server/assets into dist/assets. Run `pnpm run build` in the package that ships the skills before publishing.";return`Bundled skill asset directory not found for bundle '${e}'. Tried: ${n.join(`, `)}. ${r}`}function W8(e,t={}){let n=sje(e,import.meta.url,t);for(let e of n)if(g(e))return e;throw Error(cje(e,import.meta.url,n))}function lje(e=N(k(fe(import.meta.url)),`..`,`package.json`)){try{let t=JSON.parse(S(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}lje();function uje(e,t,n){let[r,i,a,...o]=process.argv.slice(1);(r===void 0||i===void 0||a===void 0)&&(process.stderr.write(`ok-browser relay: missing the folder, files or command argument
1114
1114
  `),process.exit(2));let s=new Set(n),c={roots:[{uri:t.pathToFileURL(i).href,name:`chat files`}]},l=e.spawn(a,o,{cwd:r,stdio:[`pipe`,`pipe`,`inherit`],windowsHide:!0}),u=l.stdin,d=l.stdout;(u===null||d===null)&&(process.stderr.write(`ok-browser relay: the browser server has no pipes
1115
1115
  `),process.exit(1));let f=e=>typeof e==`object`&&e&&!Array.isArray(e)?e:null,p=e=>{u.write(`${JSON.stringify(e)}\n`)},m=e=>{process.stdout.write(`${JSON.stringify(e)}\n`)},h=(e,t)=>{process.stderr.write(`ok-browser relay: dropped a ${e} line that ${t}\n`)},g=(e,t,n)=>{if(e.trim()===``)return null;let r;try{r=JSON.parse(e)}catch{return h(t,`is not JSON`),null}let i=f(r);if(i!==null)return i;if(Array.isArray(r))for(let e of r){let t=f(e);t?.method!==void 0&&t.id!==void 0&&n({jsonrpc:`2.0`,id:t.id,error:{code:-32600,message:`Batched messages are not supported`}})}return h(t,`is not a single JSON-RPC message`),null},_=e=>{let t=g(e,`client`,m);if(t===null||t.method===`notifications/roots/list_changed`)return null;let n=f(t.params),r=n?.name;return t.method===`tools/call`&&(typeof r!=`string`||!s.has(r))?(t.id!==void 0&&m({jsonrpc:`2.0`,id:t.id,error:{code:-32602,message:`Tool ${String(r)} is not available`}}),null):(t.method===`initialize`&&n!==null&&(n.capabilities={...f(n.capabilities),roots:{listChanged:!1}}),JSON.stringify(t))},v=e=>{let t=g(e,`server`,p);if(t===null)return null;if(t.method===`roots/list`)return t.id!==void 0&&p({jsonrpc:`2.0`,id:t.id,result:c}),null;let n=f(t.result),r=n?.tools;if(n===null||!Array.isArray(r))return e;let i=r.filter(e=>{let t=f(e)?.name;return typeof t==`string`&&s.has(t)});for(let e of i){let t=f(f(e)?.annotations);t!==null&&(t.readOnlyHint=!1)}return n.tools=i,JSON.stringify(t)},y=(e,t,n,r)=>{let i=``,a=e=>{let r=n(e);r!==null&&t.write(`${r}\n`)};e.setEncoding(`utf8`),e.on(`data`,e=>{i+=String(e);let t=i.indexOf(`
1116
1116
  `);for(;t!==-1;)a(i.slice(0,t)),i=i.slice(t+1),t=i.indexOf(`
@@ -1550,6 +1550,6 @@ GFS4: `),console.error(e)}),r[c]||(d(r,global[c]||[]),r.close=(function(e){funct
1550
1550
  `);re(e,o)}function j9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=k9(JSON.parse(n),t),i=n.endsWith(`
1551
1551
  `)?`
1552
1552
  `:``;re(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=O9(n,t.contentDirSpellings);r!==n&&re(e,r)}}function M9(e,t){let n=S(e,`utf-8`),r=O9(n,t.contentDirSpellings);r!==n&&re(e,r)}function N9(e){try{return w(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>j(e,t.name))}catch{return[]}}const OPe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function P9(e){return/\.log\.\d+$/.test(e)}function kPe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||P9(e)}const APe=[`telemetry`,`logs`,`process`,`diagnostic-reports`];function jPe(e){let t={contentDirSpellings:D9(e.contentDir)};for(let n of APe)for(let r of N9(j(e.stagingDir,n)))kPe(r)?A9(r,t):r.endsWith(`.json`)?j9(r,t):M9(r,t);for(let n of N9(j(e.stagingDir,`state`))){let e=ae(n);n.endsWith(`.jsonl`)?A9(n,t):OPe.has(e)?j9(n,t):M9(n,t)}}const F9=[`.ok`,`local`,`telemetry`],I9=[`.ok`,`local`,`logs`],L9=[`.ok`,`local`,`loss-capture`],R9=`spans-current.jsonl`,z9=`spans-prev.jsonl`,B9=`server-current.jsonl`,V9=`server-prev.jsonl`,H9=`loss-current.jsonl`,U9=`loss-prev.jsonl`;function MPe(e){return j(e,...F9,R9)}function NPe(e){return j(e,...F9,z9)}function PPe(e){return j(e,...I9,B9)}function FPe(e){return j(e,...I9,V9)}function IPe(e){return j(e,...L9,H9)}function LPe(e){return j(e,...L9,U9)}const W9=1e3;async function RPe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function zPe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function BPe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}function VPe(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(`
1553
- `)}\n`:null}catch{return null}}function HPe(e){let t=j(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],c8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function UPe(e){let t=j(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],c8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){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 WPe(){return{nodeVersion:process.version,platform:ye(),arch:me()}}function GPe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,xs.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function KPe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return KPe(e.maxBytes)}function qPe(e){let t=q9(GJ(`project`,e)),n=q9(GJ(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function JPe(e){return Te(`sha256`).update(e).digest(`hex`)}function X9(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const YPe=[`"doc.name"`,`"docName"`];function XPe(e){let t=S(e,`utf-8`),n=0;for(let e of YPe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(k(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,Z5(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=j(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const ZPe=new Set([`.jsonl`]);function QPe(e){let t=e.lastIndexOf(`.`);return t!==-1&&ZPe.has(e.slice(t))}const $Pe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function eFe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&$Pe.has(e.slice(t))}function tFe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!eFe(r))continue;let{redacted:i,patterns:a,lineCount:o}=BP(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return M(e,t).split(le).join(`/`)}async function nFe(e){let t=N(e.contentDir),n=N(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??RPe,a=r.fetchAgentEffects??zPe,o=r.fetchWatcherRecent??BPe,s=r.readShadowHead??HPe,c=r.readCheckpointRefs??UPe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.86.19-beta.2`),d=r.readDesktopEnv??G9,f=r.readLanguage??E9,p=r.readRuntime??WPe,h=r.isOtlpPushEnabled??GPe,_=y(j(xe(),`ok-bundle-`));try{v(j(_,`telemetry`),{recursive:!0}),v(j(_,`logs`),{recursive:!0}),v(j(_,`state`),{recursive:!0}),Z9(MPe(n),j(_,`telemetry`,R9)),Z9(NPe(n),j(_,`telemetry`,z9)),Z9(PPe(n),j(_,`logs`,B9)),Z9(FPe(n),j(_,`logs`,V9));for(let t of e.userLogFiles??[])Z9(t,j(_,`logs`,ae(t)));for(let t of e.userStateFiles??[])Z9(t,j(_,TJ,ae(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,j(_,`diagnostic-reports`,ae(t)))&&(y+=1);let b=j(n,`.ok`,`local`),x=j(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,j(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(j(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(j(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=VPe(n);e!==null&&re(j(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(j(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(j(_,`state`,`checkpoint-refs.txt`),D),Z9(IPe(n),j(_,`state`,H9)),Z9(LPe(n),j(_,`state`,U9)),Z9(j(b,`last-spawn-error.log`),j(_,`state`,`last-spawn-error.log`)),Z9(j(b,od),j(_,`state`,od)),Z9(j(b,sd),j(_,`state`,sd)),Z9(j(b,ad),j(_,`state`,ad));let ee=p(),ne=d(),ie=f(),k={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(j(_,`state`,`runtime.json`),`${JSON.stringify(k,null,2)}\n`);let oe=C===`running`?`running
1553
+ `)}\n`:null}catch{return null}}function HPe(e){let t=j(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`log`,`--oneline`,`-50`],c8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function UPe(e){let t=j(e,`.git`,`ok`);if(!g(t))return null;let n=l(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],c8({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){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 WPe(){return{nodeVersion:process.version,platform:ye(),arch:me()}}function GPe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,xs.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function KPe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return KPe(e.maxBytes)}function qPe(e){let t=q9(GJ(`project`,e)),n=q9(GJ(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function JPe(e){return Te(`sha256`).update(e).digest(`hex`)}function X9(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}const YPe=[`"doc.name"`,`"docName"`];function XPe(e){let t=S(e,`utf-8`),n=0;for(let e of YPe){let r=t.indexOf(e);for(;r!==-1;)n++,r=t.indexOf(e,r+e.length)}return n}function Z9(e,t){if(!g(e))return!1;try{return v(k(t),{recursive:!0}),e.endsWith(`.ips`)?re(t,Z5(S(e,`utf-8`))):m(e,t),!0}catch{return!1}}function Q9(e){let t=[],n=e=>{let r=w(e,{withFileTypes:!0});for(let i of r){let r=j(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const ZPe=new Set([`.jsonl`]);function QPe(e){let t=e.lastIndexOf(`.`);return t!==-1&&ZPe.has(e.slice(t))}const $Pe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`,`.yaml`,`.yml`,`.ips`]);function eFe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t!==-1&&$Pe.has(e.slice(t))}function tFe(e){let t=[];for(let n of Q9(e)){let r=$9(e,n);if(!eFe(r))continue;let{redacted:i,patterns:a,lineCount:o}=BP(S(n,`utf-8`));a.length!==0&&(re(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return M(e,t).split(le).join(`/`)}async function nFe(e){let t=N(e.contentDir),n=N(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??RPe,a=r.fetchAgentEffects??zPe,o=r.fetchWatcherRecent??BPe,s=r.readShadowHead??HPe,c=r.readCheckpointRefs??UPe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.86.19-beta.4`),d=r.readDesktopEnv??G9,f=r.readLanguage??E9,p=r.readRuntime??WPe,h=r.isOtlpPushEnabled??GPe,_=y(j(xe(),`ok-bundle-`));try{v(j(_,`telemetry`),{recursive:!0}),v(j(_,`logs`),{recursive:!0}),v(j(_,`state`),{recursive:!0}),Z9(MPe(n),j(_,`telemetry`,R9)),Z9(NPe(n),j(_,`telemetry`,z9)),Z9(PPe(n),j(_,`logs`,B9)),Z9(FPe(n),j(_,`logs`,V9));for(let t of e.userLogFiles??[])Z9(t,j(_,`logs`,ae(t)));for(let t of e.userStateFiles??[])Z9(t,j(_,TJ,ae(t)));let y=0;for(let t of e.diagnosticReports?.files??[])Z9(t,j(_,`diagnostic-reports`,ae(t)))&&(y+=1);let b=j(n,`.ok`,`local`),x=j(b,`server.lock`),C=`not-running`,w=`no server.lock`,T=null;if(g(x)){Z9(x,j(_,`state`,`server.lock`));try{let e=S(x,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?T=t.port:w=`lock present but no port`}catch{w=`lock present but unparseable`}}if(T!==null){let e=await i(T);e===null?w=`agent-presence endpoint at :${T} unreachable`:(re(j(_,`state`,`agent-presence.json`),e),C=`running`,w=``);let t=await a(T);t!==null&&re(j(_,`state`,`agent-effects.json`),t);let n=await o(T);if(n!==null){let e=VPe(n);e!==null&&re(j(_,`state`,`watcher-recent.jsonl`),e)}}let E=s(t);E!==null&&re(j(_,`state`,`shadow-head.txt`),E);let D=c(t);D!==null&&re(j(_,`state`,`checkpoint-refs.txt`),D),Z9(IPe(n),j(_,`state`,H9)),Z9(LPe(n),j(_,`state`,U9)),Z9(j(b,`last-spawn-error.log`),j(_,`state`,`last-spawn-error.log`)),Z9(j(b,od),j(_,`state`,od)),Z9(j(b,sd),j(_,`state`,sd)),Z9(j(b,ad),j(_,`state`,ad));let ee=p(),ne=d(),ie=f(),k={ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie}};re(j(_,`state`,`runtime.json`),`${JSON.stringify(k,null,2)}\n`);let oe=C===`running`?`running
1554
1554
  `:`not-running (${w})\n`;re(j(_,`state`,`server-status.txt`),oe);let A=e.diagnosticReports===void 0?`not-collected (no collection attempted)`:X5(e.diagnosticReports,y);if(re(j(_,`state`,`diagnostic-reports-status.txt`),`${A}\n`),re(j(_,e7),x7(e.osTerminationEvidence)),e.processDir&&g(e.processDir)){let t=j(_,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let se=e.redact===!0;se&&jPe({stagingDir:_,contentDir:t}),e.note&&re(j(_,`note.txt`),e.note);let ce=null;e.scrubSecrets===!0&&(ce=tFe(_));for(let t of e.extraFiles??[]){let e=t.zipName??ae(t.sourcePath);if(!Z9(t.sourcePath,j(_,`extra`,e))){r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);continue}let n=C7(t,`extra/${e}`);n!==null&&(ce??={redactions:[],redactedLineCount:0},ce.redactions.push(n),ce.redactedLineCount+=n.lineCount)}let M=qPe(n),N=Q9(_),le=[],ue=0,de=0;for(let e of N){let t=$9(_,e),n=te(e).size,r=QPe(t)?X9(e):0;le.push({path:t,bytes:n,lines:r}),ue+=n,(t.startsWith(`telemetry/`)||t.startsWith(`logs/`))&&(de+=XPe(e))}let fe={applied:se};ce!==null&&(fe.secretScrub=ce);let P={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:ee.nodeVersion,platform:ee.platform,arch:ee.arch},host:{desktop:ne,language:ie},contentDir:{pathSha256:JPe(t),absolutePath:se?`<CONTENT_DIR>`:t},telemetry:{localSink:M,otlpPushEnabled:h()},redaction:fe,serverStatus:C,files:le};re(j(_,`manifest.json`),`${JSON.stringify(P,null,2)}\n`);let pe=D9(t),me=N.some(e=>{try{let t=S(e,`utf-8`);return pe.some(e=>t.includes(e))}catch{return!1}}),he={stagedDiagnosticReports:y,totalBytes:ue,fileCount:le.length,docNameCount:de,contentDirVisible:me,redacted:se},ge=!1;return{stagingDir:_,manifest:P,summary:he,cleanup:()=>{ge||(ge=!0,O(_,{recursive:!0,force:!0}))}}}catch(e){throw O(_,{recursive:!0,force:!0}),e}}async function rFe(e){let{collected:t,outputPath:n}=e,r=k(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new DDe.ZipFile,a=Q9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function iFe(e,t){let n=j(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,xs.parse)(S(n,`utf-8`)),r=dY(t)?t.content:void 0,i=dY(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return N(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 N(e)}async function aFe(e,t,n,r,i,a){let o=w7(t,e.logger),s=await nFe({contentDir:iFe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...hNe(o,e.userLogsDir??j(RJ(),`logs`)),...E7(e.cachesDir??j(_e(),`Library`,`Caches`))],userStateFiles:D7(e.bugReportsDir??S7()),diagnosticReports:i,osTerminationEvidence:a,deps:{readDesktopEnv:n,readLanguage:r,logger:e.logger}});try{v(k(e.outputPath),{recursive:!0}),await rFe({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 oFe(e){let{projectDir:t}=e,n=e.readDesktopEnv??G9,r=e.readLanguage??E9,i=()=>VMe(e.diagnosticReportsDir??j(_e(),`Library`,`Logs`,`DiagnosticReports`),new Date);if(e.level===`full`&&t!==void 0)return aFe(e,t,n,r,i(),await b7(e.osTerminationEvidenceDeps));let{zipPath:a,summary:o}=await bNe({projectDir:t,redact:e.redact,revealDocNames:e.level===`full`,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:E7(e.cachesDir??j(_e(),`Library`,`Caches`)),bugReportLedgerFiles:D7(e.bugReportsDir??S7()),diagnosticReports:e.level===`full`?i():void 0,osTerminationEvidence:e.level===`full`?await b7(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}}}export{vY as ALL_EDITOR_IDS,yY as EDITOR_LABELS,$Y as EDITOR_TARGETS,Pbe as HOSTS_WITH_USER_SKILL_DIR,kMe as LAUNCH_CONFIG_NAME,uPe as PATH_SHIM_BEGIN,fPe as PATH_SHIM_BLOCK_RE,dPe as PATH_SHIM_END,u5 as ProjectPathSafetyError,oMe as addOkPathsToGitExclude,d5 as assertProjectPathSafe,PY as buildManagedServerEntry,$Ne as buildMcpConfigDeclineEvent,ePe as buildMcpConfigMigrateEvent,WY as canonicalEntryFor,q5 as classifyExistingMcpEntry,oFe as collectReportBundle,_Pe as createCliProbeResolver,ZJ as createTokenStore,fNe as defaultBugReportZipPath,Ke as detectGh,Ye as detectGhAccounts,NMe as detectInstalledEditors,UY as droppedManagedKeys,txe as editorConfigPathDisplay,exe as editorEntryLocator,HNe as ensurePiBridge,qMe as findJetsamKillSync,T5 as formatTrackedRemediation,lMe as getExcludedOkPaths,C5 as getInstalledSkillProjectionPaths,Nbe as getNativeTomlMcpEditor,S5 as getOkArtifactPaths,MY as isEntryUpToDate,FY as isOwnManagedEntry,sPe as loadConfig,abe as makeLazyProbeTokenStore,S7 as okBugReportsDir,v9 as parseGitHubBlobUrl,cPe as parseGitHubShareUrl,y9 as parseGitHubTreeUrl,_9 as parseGitUrl,pPe as pathInstallMarkerPath,Gje as previewContent,PMe as probeOwnManagedEditorMcpEntry,BNe as probePiBridgeState,w5 as probeTrackedOkPaths,G5 as readExistingMcpEntry,cMe as readSharingMode,BP as redactContent,sMe as removeOkPathsFromGitExclude,YNe as removeOwnMcpEntry,nMe as removeProjectSkill,yPe as removeUserGlobalSkillBundle,TPe as removeUserSkill,Xje as resolveProjectRoot,iPe as runStop,p9 as truncatePriorEntry,w9 as userGlobalSkillBundleTargets,wPe as userSkillPresentAnywhere,lPe as validateLocalFolderForShare,W5 as writeEditorMcpConfig,SPe as writeProjectAiIntegrations,_5 as writeProjectSkill,MMe as writeUserMcpConfigs,CPe as writeUserSkill};
1555
1555
  //# sourceMappingURL=index.mjs.map
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{$u as r,Bf as i,Cf as a,Df as o,Ef as s,Ga as c,Jc as l,K as u,Mf as d,Nf as f,Pf as p,Sf as m,Tf as h,V as g,Wa as _,_ as v,_f as y,a as b,df as x,gd as S,jf as C,lf as ee,mf as te,pf as ne,tt as re,uf as ie,vc as ae,vf as oe,yd as se,z as ce,zf as le}from"./md-manager-BGnqyqi1-BzZ_8EQ9.mjs";import{Ao as ue,At as de,F as fe,Fo as pe,Fr as me,Hi as he,Jo as ge,Ko as w,No as _e,R as ve,U as ye,Vr as be,Xo as xe,Yo as Se,Yr as Ce,Zn as we,at as Te,ci as Ee,cs as De,di as Oe,dn as ke,ir as Ae,ja as je,m as Me,ma as Ne,ms as Pe,pa as Fe,qo as Ie,qr as Le,rt as Re,ts as T,va as ze,z as Be}from"./dist-DRgSOIS6.mjs";import{i as Ve,n as E,o as D,r as He,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as Ue}from"./constants-yBl2PJiO.mjs";import{t as We}from"./preview-CijEeyG0.mjs";import{createRequire as Ge}from"node:module";import{execFileSync as Ke}from"node:child_process";import qe,{basename as Je,dirname as j,isAbsolute as Ye,join as M,posix as Xe,relative as N,resolve as P,sep as F,win32 as Ze}from"node:path";import I from"node:process";import{fileURLToPath as Qe}from"node:url";import{cpSync as $e,existsSync as L,lstatSync as et,mkdirSync as tt,readFileSync as R,readdirSync as nt,readlinkSync as rt,realpathSync as it,rmSync as at,statSync as ot,writeFileSync as st}from"node:fs";import{homedir as z}from"node:os";import{inspect as ct,stripVTControlCharacters as lt,styleText as B}from"node:util";import*as ut from"node:readline";import{AsyncLocalStorage as dt,AsyncResource as ft}from"node:async_hooks";var pt=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),mt=n((e=>{let{InvalidArgumentError:t}=pt();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),ht=n((e=>{let{humanReadableArgName:t}=mt();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
1
+ import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.mjs";import{$u as r,Bf as i,Cf as a,Df as o,Ef as s,Ga as c,Jc as l,K as u,Mf as d,Nf as f,Pf as p,Sf as m,Tf as h,V as g,Wa as _,_ as v,_f as y,a as b,df as x,gd as S,jf as C,lf as ee,mf as te,pf as ne,tt as re,uf as ie,vc as ae,vf as oe,yd as se,z as ce,zf as le}from"./md-manager-BGnqyqi1-I7NmBKjQ.mjs";import{Ao as ue,At as de,F as fe,Fo as pe,Fr as me,Hi as he,Jo as ge,Ko as w,No as _e,R as ve,U as ye,Vr as be,Xo as xe,Yo as Se,Yr as Ce,Zn as we,at as Te,ci as Ee,cs as De,di as Oe,dn as ke,ir as Ae,ja as je,m as Me,ma as Ne,ms as Pe,pa as Fe,qo as Ie,qr as Le,rt as Re,ts as T,va as ze,z as Be}from"./dist-G9AKZ6QI.mjs";import{i as Ve,n as E,o as D,r as He,s as O,t as k}from"./colors-r_owlCuY.mjs";import{t as A}from"./is-object-BGze3w87.mjs";import{t as Ue}from"./constants-C8IYq5J6.mjs";import{t as We}from"./preview-D_MaK6Cf.mjs";import{createRequire as Ge}from"node:module";import{execFileSync as Ke}from"node:child_process";import qe,{basename as Je,dirname as j,isAbsolute as Ye,join as M,posix as Xe,relative as N,resolve as P,sep as F,win32 as Ze}from"node:path";import I from"node:process";import{fileURLToPath as Qe}from"node:url";import{cpSync as $e,existsSync as L,lstatSync as et,mkdirSync as tt,readFileSync as R,readdirSync as nt,readlinkSync as rt,realpathSync as it,rmSync as at,statSync as ot,writeFileSync as st}from"node:fs";import{homedir as z}from"node:os";import{inspect as ct,stripVTControlCharacters as lt,styleText as B}from"node:util";import*as ut from"node:readline";import{AsyncLocalStorage as dt,AsyncResource as ft}from"node:async_hooks";var pt=n((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),mt=n((e=>{let{InvalidArgumentError:t}=pt();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),ht=n((e=>{let{humanReadableArgName:t}=mt();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
2
2
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
3
3
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
4
4
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),gt=n((e=>{let{InvalidArgumentError:t}=pt();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -689,5 +689,5 @@ export default function okBridge(pi: {
689
689
  `));let g=`${s?``:``}${m}`;return g!==o&&T(e,g,{mode:Wa(e)}),a&&g===o?{kind:`unchanged`}:{kind:d?`overwritten`:`written`}}const Lo=e=>e!==`project`,Ro=e=>e!==`user`;async function zo(){let e=await $a({message:`Where should the MCP server be configured?
690
690
  `,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function Bo(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??zo)():`both`}async function Vo(e){return io({message:`How do you want to handle OpenKnowledge config files (.ok/, .mcp.json)?`,default:e,choices:[{name:`Share with my team (commit alongside content)`,value:`shared`,description:`OK config gets committed alongside your project content.`},{name:`Local only (keep out of git via .git/info/exclude)`,value:`local-only`,description:`OK config stays on this machine only; teammates do not see it. Safe escape hatch via \`${C()} config-sharing share\`.`}]})}async function Ho(e){if(e.sharing!==void 0)return e.sharing;let t=pa(e.projectRoot)===`local-only`||e.freshProject===!0?`local-only`:`shared`;return e.isTTY??process.stdout.isTTY?(e.promptFn??Vo)(t):t}var Uo=class extends Error{constructor(e){super(e),this.name=`ContentDirError`}},Wo=class extends Error{constructor(e){super(`A dev MCP entry is written to project config only, never to user-level editor config, so --scope ${e} is not supported with --dev-mcp or OK_CHANNEL=dev. Re-run with --scope project or without --scope.`),this.name=`DevMcpScopeError`}};const Go=`A dev build registers OpenKnowledge MCP in project config only, never in user-level editor config. Run \`${h} init --dev-mcp\` in the project, or set OK_CHANNEL=stable.`;function Ko(e){if(e===void 0||e===!0)return new Set(Re);if(e===!1)return new Set;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);return new Set(de.filter(e=>t.includes(e)))}function qo(e,t,n){let r=P(n,e),i;try{i=ot(r)}catch(e){let t=e.code;throw t===`ENOENT`?new Uo(`--content-dir path does not exist: ${r}`):new Uo(`--content-dir path is not accessible (${t??`unknown error`}): ${r}`)}if(!i.isDirectory())throw new Uo(`--content-dir must be a directory: ${r}`);let a=Jo(t),o=Jo(r),s=N(a,o);if(s.startsWith(`..`)||Ye(s))throw new Uo(`--content-dir must be inside the project root (${t}); got ${r}`);return s===``?`.`:s}function Jo(e){try{return it(e)}catch{return e}}const Yo=`open-knowledge-ui`;function Xo(e,t,n){try{let r=e.detectPath?.(t,n)??j(e.configPath(t,n));return L(r)}catch{return!1}}function Zo(e,t,n){try{let r=P(j(e.configPath(t,n))),i=P(e.detectPath?.(t,n)??r);return i===r||r.startsWith(i+F)}catch{return!1}}function Qo(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=n.pruneOnly===!0;if(s&&(e.format===`file`||!L(o)))return{editorId:e.id,label:e.label,action:`skipped-flag`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}};let c=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0||Zo(e,t,r);if(!i&&c&&!Xo(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{Da(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return es(e,o,a,n,{isProjectScope:i!==void 0});let l;try{l=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{s||tt(j(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let u={action:`written`},d;try{De(`${o}.lock`,()=>{let t=_o(o).writePath;if(s||tt(j(t),{recursive:!0}),e.format===`toml`){let r=No(ai(),t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}if(e.format===`yaml`){let r=Io(t,e.topLevelKey,a,l,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason);return}let r=Mo(t,e.topLevelKey,a,l,e.serverMapSubKey,n.replaceEntry===!0,n.pruneOnly===!0);u.action=r.kind,r.kind===`declined`&&(u.declineReason=r.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){d=e instanceof Error?e:Error(String(e))}return d?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:d.message,...i===void 0?{}:{configScope:`project`}}:u.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:u.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:u.action===`unchanged`?`skipped-flag`:u.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const $o={pi:co};function es(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=$o[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{tt(j(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{De(`${t}.lock`,()=>{let e=null;try{e=R(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}T(t,c,e===null?void 0:{mode:Wa(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}function ts(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!L(n)))return{editorId:e.id,label:e.label,path:n}}async function ns(e){let t=oa(e.editors).filter(e=>e.scope===`global`);if(le())return t.map(t=>({editorId:t.id,label:t.label,action:`failed`,configPath:t.configPath(``,e.home),serverName:t.serverName(``),error:Go}));let n={mode:`published`,skipAvailabilityCheck:!0,...e.replaceEntry===!0?{replaceEntry:!0}:{},...e.pruneOnly===!0?{pruneOnly:!0}:{}};return t.map(t=>Qo(t,``,n,e.home))}function rs(e,t,n,r){let i=as(e,t,n,r);return i.kind===`present`?i.entry:null}function is(e,t,n,r){let i=jo(e,t,r);if(!A(i))return{kind:`no-entry`};let a=i[n];return A(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function as(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!L(i))return{kind:`absent`};try{if(ot(i).size>To)return{kind:`decline`,reason:`oversize`}}catch(e){return{kind:`decline`,reason:Ba(e)}}let a;try{a=R(i,`utf-8`)}catch(e){return{kind:`decline`,reason:Ba(e)}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:so(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=ai().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return is(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,Kr.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:is(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=bo(a);return s?xo(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:is(Ie(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}async function os(e={}){let t=P(e.cwd??process.cwd()),n=fo(t,{homeDir:e.home}),r=n.projectRoot;if(Ce(r,e.home??z()))throw new ye(r);if(Le(r))throw new fe(r);let i=!L(M(r,`.ok`)),a=n.gitRootPromoted?N(r,t):void 0,o=e.contentDir===void 0?n.defaultContentDir:qo(e.contentDir,r,t);n.ancestorPromoted?console.log(`[ok] Opened existing project at ${r}`):n.gitRootPromoted&&i&&o===`.`&&process.stderr.write(`${O(`[ok] Content scope promoted to the git repo root: ${r}`)}\n Ran in ${a}/, but .ok/ lives at the git root (one .ok/ per git repo),\n so the whole repo is now the content scope. To narrow it, re-run with\n \`${C()} init --content-dir .\`, or set content.dir: ${a} in .ok/config.yml.\n`);let s={mode:e.devMcp?`dev`:`published`},l=e.devMcp===!0||le();if(l&&e.mcp!==!1&&e.scope&&e.scope!==`project`)throw new Wo(e.scope);let u=await Ae(r),d;try{d=me(r,{contentDir:o})}catch(t){let i=$.claude.configPath(r,e.home);return{projectRoot:r,contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:u.didInit,rootGitignoreCreated:!1,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDirRequested:e.contentDir,contentScaffoldFailed:!0,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${t instanceof Error?t.message:String(t)}`,sharing:{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:!1}}}let f=d.created.includes(Ue),p=!1;if(u.didInit)try{p=pe(r)===`created`}catch(e){console.warn(`[ok] Skipping .gitignore seed at ${r}: ${e instanceof Error?e.message:String(e)}`)}try{Fe(r)===`removed`&&console.warn(`[ok] Removed the OpenKnowledge project-skill lines from .gitignore. The skill is ordinary project content now — commit it if your team wants it on clone.`)}catch(e){console.warn(`[ok] Skipping project-skill .gitignore cleanup at ${r}: ${e instanceof Error?e.message:String(e)}`)}let m=await Bo({scope:l?`project`:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),h=e.editors??fs(r,e.home),g=e.editors??h,_=oa(h),v=oa(g),y=e.mcp===!1||m===null,b=Array.from(new Map([..._,...y?[]:v].map(e=>[e.id,e])).values()),x=_.filter(t=>Xo(t,r,e.home)),S=[],ee=[],te=new Set;for(let t of b){if(y){let n=``;try{n=t.configPath(r,e.home)}catch{}S.push({editorId:t.id,label:t.label,action:`skipped-flag`,configPath:n,serverName:t.serverName(r)});continue}if(Lo(m)&&_.includes(t)&&t.scope===`global`&&S.push(Qo(t,r,s,e.home)),Ro(m)&&v.includes(t)&&t.projectConfigPath){let n=t.projectConfigPath(r),i=Qo(t,r,s,e.home,n);S.push(i),(i.action===`written`||i.action===`overwritten`)&&te.add(n)}}let ne=new Set;for(let t of v){let n=t.projectSkillPath?.(r);!n||ne.has(n)||(ne.add(n),ee.push(Ra(t,r,{home:e.home})))}let re=La(r,v.map(e=>e.id));re&&ee.push(re);let ie=ee.filter(e=>e.action===`written`||e.action===`overwritten`).map(e=>e.editorId);if(ie.length>0){let t=e.home??z();Ne({source:c,skills:[Me.project],agents:ie,scope:r},{home:t,enabled:je(t).enabled})}let ae=!y&&m!==null&&Ro(m)?v.filter(e=>!e.projectConfigPath&&!e.projectSkillPath).map(e=>e.label):void 0,oe=y?[]:x.map(e=>ts(e,r)).filter(e=>e!==void 0).filter(e=>!te.has(e.path)),se=e.installUserSkill??be,ce=e.home??z(),ue=Ko(e.skills),ge=typeof e.skills!=`string`,w=!1,ve=!1,xe=!1,Se=!1,Te=!1,Ee=!1,De=!1,ke=[];for(let t of de){if(!ue.has(t))continue;if(w=!0,ge){let e=await he(ce,Me[t]).then(e=>({ok:!0,value:e}),()=>({ok:!1}));if(!e.ok){ke.push({bundleId:t,result:`decision-read-failed`}),De=!0;continue}if(e.value===!1){ke.push({bundleId:t,result:`opted-out`}),Ee=!0;continue}}await _e(ce,Me[t],!0).catch(()=>{});let n=await se({home:e.home,bundleId:t,force:!0});ke.push({bundleId:t,result:n}),n===`installed`?ve=!0:n===`failed`?xe=!0:n===`no-hosts`?Te=!0:Se=!0}let Pe=xe?`failed`:De?`decision-read-failed`:ve?`installed`:w&&Se?`skip-current`:w&&Te?`no-hosts`:Ee?`opted-out`:`declined`,Ie=ve?we(ce).map(e=>e.editorId):[],Re=je(ce).enabled&&!Oe(),T=y?`skipped-flag`:`skipped-missing`,ze=S.find(e=>e.editorId===`claude`)??S[0]??{action:T,configPath:$.claude.configPath(r,e.home)},Be=await ss({projectRoot:r,desiredMode:await Ho({sharing:e.sharing,projectRoot:r,isTTY:e.isTTY,freshProject:i,promptFn:e.sharingPromptFn}),explicitFlag:e.sharing});return{projectRoot:r,contentCreated:d.created,contentUpdated:d.updated,contentSkipped:d.skipped,editors:S,projectSkills:ee,legacyProjectConfigs:oe,skillInstall:Pe,skillBundles:ke,skillsRequested:e.skills,skillHosts:Ie,skillInstallsCounted:Re,didGitInit:u.didInit,rootGitignoreCreated:p,gitRootPromoted:n.gitRootPromoted,promotedFromDir:a,contentDir:f?o:void 0,contentDirRequested:e.contentDir,contentScaffoldFailed:!1,mcpAction:ze.action,mcpPath:ze.configPath,mcpError:`error`in ze?ze.error:void 0,projectScopeUnsupportedLabels:ae,sharing:Be}}async function ss(e){let{projectRoot:t,desiredMode:n,explicitFlag:r}=e,i=pa(t);if(i===`no-git`)return{kind:`no-exclude`,reason:`no-git`,localOnlyRequested:r===`local-only`};let a=la(t);if(n===`local-only`){let e=da(t,a);if(e.kind===`refused-tracked`){let t=e;return{kind:`refused-tracked`,tracked:t.tracked,remediation:t.remediation}}return e.kind===`no-exclude`?{kind:`no-exclude`,reason:e.reason,localOnlyRequested:r===`local-only`}:cs(t,e,`add`)}if(i===`shared`)return{kind:`applied`,mode:`shared`,action:`noop`,appended:[],alreadyPresent:[],removed:[]};let o=fa(t,a);return o.kind===`no-exclude`?{kind:`no-exclude`,reason:o.reason,localOnlyRequested:!1}:cs(t,o,`remove`)}function cs(e,t,n){let r=pa(e);return n===`add`?{kind:`applied`,mode:r,action:t.appended.length>0?`added`:t.removed.length>0?`cleaned`:`noop`,appended:t.appended,alreadyPresent:t.alreadyPresent,removed:t.removed}:{kind:`applied`,mode:r,action:`removed`,appended:[],alreadyPresent:[],removed:t.removed}}function ls(e){switch(e){case`permission-denied`:return`permission denied; check file and parent-directory permissions`;case`unresolved-symlink`:return`could not resolve the path or symlink; check permissions and symlink cycles`;case`not-a-file`:return`config path is not a regular file`;case`disappeared`:return`config disappeared while being read; retry to check its current state`;case`unreadable`:return`could not read the config file; check that the path is accessible`;case`unparseable`:return`config could not be parsed`;case`oversize`:return`config too large to edit safely`;case`duplicate-container`:return`duplicate server block`;case`no-native-writer`:return`no format-preserving writer available`;case void 0:return`config not readable`;default:throw Error(`unhandled MCP decline reason: ${e}`)}}function us(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`);e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`),e.rootGitignoreCreated&&n.push(`Seeded .gitignore at ${t}/.gitignore (.DS_Store)`);let c=M(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(k(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(k(`Content already present at ${c}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0){if(n.push(k(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`)}else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(k(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(k(`MCP server configuration:`));for(let r of e.editors){let e=r.configPath.startsWith(t)?N(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),i=r.serverName===f()?``:` (${r.serverName})`,a=r.configScope===`project`?` (project)`:``,o=`${r.label}${a}`,s=` `.repeat(Math.max(1,20-o.length)),c=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${o}${s}${e} ${D(`registered`)}${i}${c}`);break;case`overwritten`:n.push(` ${o}${s}${e} ${D(`updated`)}${i}${c}`);break;case`skipped-missing`:n.push(` ${o}${s}${e} config root missing; skipped`);break;case`failed`:n.push(` ${o}${s}${e} ${He(`FAILED`)}: ${r.error}`);break;case`declined`:n.push(` ${o}${s}${e} left unchanged (${ls(r.declineReason)})`);break;case`skipped-flag`:break;default:r.action}}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}let r=s.dev.mcpServerName;e.editors.some(e=>e.serverName===r&&(e.action===`written`||e.action===`overwritten`))&&n.push(` The ${r} entry runs this checkout on this machine only; keep it out of commits.`)}if(e.projectSkills.length>0){n.push(``),n.push(k(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?N(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${D(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${D(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`skipped-prerequisite`:n.push(` ${e}${i}OpenKnowledge MCP is not configured; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${He(`FAILED`)}: ${r.error}`)}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${N(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall===`declined`)n.push(``),n.push(k(`User-global skills:`)),typeof e.skillsRequested==`string`?(n.push(` ${E(`none installed — --skills "${e.skillsRequested}" names no known skill bundle (known: ${de.join(`, `)})`)}`),n.push(` ${E(`No user-global skill was installed or removed.`)}`)):(n.push(` ${E(`none installed — skipped for this run (--no-skills)`)}`),n.push(` ${E(`No user-global skill was installed or removed; any already on this`)}`),n.push(` ${E(`machine are untouched. Run init without the flag to install them:`)}`),n.push(` ${E(` ${C()} init`)}`),n.push(` ${E(`--no-skills covers user-global skills only, not project-local skills.`)}`));else if(e.skillInstall){n.push(``),n.push(k(`User-global skills:`));let t=e.skillBundles??[],r=Math.max(0,...t.map(e=>Me[e.bundleId].length));for(let i of t){let t=Me[i.bundleId].padEnd(r);switch(i.result){case`installed`:{let r=(e.skillHosts??[]).map(e=>X[e]??e),i=r.length>0?r.join(`, `):`the shared ~/.agents store`;n.push(` ${t} ${D(`installed for ${i}`)}`);break}case`skip-current`:n.push(` ${t} ${D(`already installed at current version`)}`);break;case`no-hosts`:n.push(` ${t} ${E(`skipped — no supported agent host detected in your home directory`)}`);break;case`failed`:n.push(` ${O(`${t} install failed`)}`);break;case`opted-out`:n.push(` ${t} ${E(`not installed — turned off on this machine; reinstall with ${C()} init --skills ${i.bundleId} or Settings → Skills Studio`)}`);break;case`decision-read-failed`:n.push(` ${O(`${t} not installed — could not read whether it is turned off on this machine; rerun ${C()} init once ${l(v)} is readable`)}`);break;default:i.result}}e.skillInstallsCounted&&t.some(e=>e.result===`installed`)&&(n.push(` ${E(`Counted on skills.sh (skill name + source repo, once per machine).`)}`),n.push(` ${E(`Opt out: DO_NOT_TRACK=1, or Settings → User → Preferences.`)}`)),t.some(e=>e.result===`failed`)&&n.push(` ${O(`Retry with: ${C()} repair-skills`)}`)}e.contentDirRequested!==void 0&&e.contentDir===void 0&&!e.contentScaffoldFailed?(n.push(``),n.push(O(`⚠ --content-dir ${e.contentDirRequested} ignored — .ok/config.yml already exists`)),n.push(` Edit .ok/config.yml → content.dir directly to change the content scope.`)):e.contentDir!==void 0&&e.contentDir!==`.`?(n.push(``),n.push(`Content scope set to ${e.contentDir}/ (content.dir in .ok/config.yml).`)):e.gitRootPromoted&&e.contentDir===`.`&&e.contentDirRequested===void 0&&(n.push(``),n.push(O(`⚠ Content scope promoted to the git repo root`)),n.push(` .ok/ was initialized at ${t} because it contains a .git folder (one .ok/ per git repo),`),n.push(` not the sub-folder you ran \`${C()} init\` in${e.promotedFromDir?` (${e.promotedFromDir})`:``}. The whole repo is now the content scope.`),e.promotedFromDir&&(n.push(` To scope to just that sub-folder, re-run \`${C()} init --content-dir .\` from there, or set`),n.push(` content.dir: ${e.promotedFromDir} in .ok/config.yml.`))),e.preview?(n.push(``),n.push(We(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),n.push(``),n.push(...hs(e.sharing,t));let u=e=>[`${e}- ${Ve(`${C()} seed --list-packs`)} — browse the starter packs`,`${e}- ${Ve(`${C()} seed`)} — scaffold an empty repo`];if(r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${D(`✓`)} ${k(`Next steps:`)}`),n.push(` 1. Open your editor (${Ve(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`);let i=3;e.contentScaffoldFailed||(n.push(` ${i++}. (Optional) scaffold the starter knowledge-base structure:`),n.push(...u(` `))),n.push(` ${i}. Ask your agent to capture a source, research a topic, or build a wiki —`),n.push(` the procedures ship as skills alongside the MCP tools.`)}else e.contentScaffoldFailed||(n.push(``),n.push(`${k(`Next steps:`)} (optional) scaffold the starter knowledge-base structure:`),n.push(...u(` `)));return n.join(`
691
691
  `)}function ds(e,t){return{projectRoot:e.projectRoot,gitRootPromoted:e.gitRootPromoted,promotedFromDir:e.promotedFromDir??null,contentDir:t.contentDir,contentDirRequested:e.contentDirRequested??null,contentDirApplied:e.contentDir!==void 0,contentFileCount:t.contentFileCount,previewError:e.previewWarning??null,didGitInit:e.didGitInit,mcpAction:e.mcpAction,editors:e.editors.map(e=>({editorId:e.editorId,label:e.label,action:e.action,configPath:e.configPath,scope:e.configScope===`project`?`project`:`user`}))}}function fs(e,t){let n=[];for(let r of si)r!==`claude-desktop`&&Xo($[r],e,t)&&n.push(r);return n}function ps(){let e={log:console.log,info:console.info,debug:console.debug},t=(...e)=>{process.stderr.write(`${e.map(e=>typeof e==`string`?e:ct(e)).join(` `)}\n`)};return console.log=t,console.info=t,console.debug=t,()=>{console.log=e.log,console.info=e.info,console.debug=e.debug}}function ms(){return new Et(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry (node + packages/cli/dist/cli.mjs, debug logging) in project config only, as the dev channel unless OK_CHANNEL is set`).option(`--content-dir <dir>`,`Limit content to <dir> instead of the whole project. <dir> is interpreted relative to your current directory (e.g. "." = the folder you run the command in), then saved to .ok/config.yml as content.dir.`).option(`--json`,`Emit a structured JSON summary to stdout (diagnostics stay on stderr)`).option(`--skills <ids>`,`Install only the named user-global skill bundles (comma list: discovery,write-skill)`).option(`--no-skills`,`Do not install any user-global skill bundles`).addOption(new Ot(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).addOption(new Ot(`--shared`,`Commit OK config alongside content (the default for fresh repos)`).conflicts(`localOnly`)).addOption(new Ot(`--local-only`,`Keep OK config out of git via .git/info/exclude (per-clone, not committed)`).conflicts(`shared`)).action(async e=>{let t=process.cwd();e.devMcp&&p(process.env);let n=e.shared?`shared`:e.localOnly?`local-only`:void 0,r=e.json?ps():null;try{let r;try{r=await os({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope,sharing:n,contentDir:e.contentDir,skills:e.skills})}catch(e){if(e instanceof Uo||e instanceof Wo||e instanceof ye||e instanceof fe){process.stderr.write(`${e.message}\n`),process.exitCode=64;return}if(e instanceof ve||e instanceof Be){process.stderr.write(`${e.message}\n`),process.exitCode=78;return}if(e instanceof Te){process.stderr.write(`open-knowledge could not initialize a git repo for this project. Re-run, or run 'git init' yourself in the project folder.
692
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-DyylMkNo.mjs`),{resolveContentDir:s}=await import(`./dist-DyVcFCkj.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-C9hE3xLw.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(ds(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${us(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function hs(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${D(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${D(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${D(`local-only`)} — already excluded; nothing to do.`):n.push(` ${D(`local-only`)}`):e.action===`removed`?n.push(` ${D(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${D(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
692
+ `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}let i=r.contentDir??`.`,a=null,{loadConfig:o}=await import(`./loader-B9K4PBZ0.mjs`),{resolveContentDir:s}=await import(`./dist-D9qVgnke.mjs`),c;try{c=o(r.projectRoot).config,i=c.content.dir}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}if(c)try{let{previewContent:e}=await import(`./preview-CMz5OZc2.mjs`),t=s(c,r.projectRoot);r.preview=e({projectDir:r.projectRoot,contentDir:t}),a=r.preview.totalCount}catch(e){r.previewWarning=e instanceof Error?e.message:String(e)}e.json?process.stdout.write(`${JSON.stringify(ds(r,{contentDir:i,contentFileCount:a}),null,2)}\n`):process.stdout.write(`${us(r,r.projectRoot)}\n`),(r.editors.some(e=>e.action===`failed`)||r.mcpAction===`failed`)&&(process.exitCode=1)}finally{r?.()}})}function hs(e,t){let n=[];switch(e.kind){case`applied`:return n.push(k(`Sharing mode:`)),e.mode===`local-only`?e.action===`added`?(n.push(` ${D(`local-only`)} — appended ${e.appended.length} path(s) to ${k(`${t}/.git/info/exclude`)} (per-clone, not committed).`),e.removed.length>0&&n.push(` cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`)):e.action===`cleaned`?n.push(` ${D(`local-only`)} — already excluded; cleared ${e.removed.length} stale entry(s) left by an older version: ${e.removed.join(`, `)}.`):e.action===`noop`&&e.alreadyPresent.length>0?n.push(` ${D(`local-only`)} — already excluded; nothing to do.`):n.push(` ${D(`local-only`)}`):e.action===`removed`?n.push(` ${D(`shared`)} — removed OK paths from ${k(`${t}/.git/info/exclude`)}; commit the files to share with teammates.`):n.push(` ${D(`shared`)} — OK config will be committed alongside content.`),n;case`refused-tracked`:n.push(O(`Sharing mode: switch to local-only deferred`));for(let t of e.remediation.split(`
693
693
  `))n.push(t.length>0?` ${t}`:``);return n.push(` Re-run ${Ve(`${C()} config-sharing unshare`)} after resolving to complete the switch.`),n;case`no-exclude`:if(e.localOnlyRequested)n.push(O(`Sharing mode: --local-only requested but no git repo found — option ignored`)),n.push(` Run ${Ve(`git init`)} (or open this folder via OK Desktop, which can scaffold a repo) and then ${Ve(`${C()} config-sharing unshare`)}.`);else if(e.reason===`no-git`)return[];else n.push(O(`Sharing mode unavailable: ${e.reason}.`));return n}}export{Z as $,Ua as A,Ra as B,_o as C,Rt as Ct,io as D,oo as E,Ot as Et,Aa as F,la as G,ya as H,Da as I,fa as J,ha as K,Oa as L,Va as M,Ba as N,$a as O,Ea as P,ci as Q,za as R,Zo as S,H as St,co as T,wt as Tt,ma as U,da as V,ua as W,X,si as Y,$ as Z,Ho as _,hr as _t,ss as a,Ti as at,Qo as b,fn as bt,fs as c,Wi as ct,ms as d,oi as dt,Bi as et,Xo as f,ai as ft,qo as g,Zr as gt,Bo as h,Jr as ht,$o as i,Si as it,Ga as j,Wa as k,us as l,ta as lt,Ko as m,Yr as mt,Wo as n,Vi as nt,ds as o,Ui as ot,rs as p,Y as pt,pa as q,Yo as r,Hi as rt,as as s,Q as st,Uo as t,zi as tt,hs as u,ki as ut,os as v,ir as vt,fo as w,Et as wt,ns as x,dn as xt,ko as y,hn as yt,ja as z};
@@ -0,0 +1 @@
1
+ import"./dist-G9AKZ6QI.mjs";import{v as e}from"./init-Blx_yRFH.mjs";export{e as runInit};
@@ -1 +1 @@
1
- import{Xo as e,qo as t,ts as n}from"./dist-DRgSOIS6.mjs";import{N as r,j as i,k as a}from"./init-Bfl6NStv.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-GRJ8XNYy.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:r(e)}}let g=[],_=e(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=t(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=i(h,[`configurations`,y]);return x?(n(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
1
+ import{Xo as e,qo as t,ts as n}from"./dist-G9AKZ6QI.mjs";import{N as r,j as i,k as a}from"./init-Blx_yRFH.mjs";import{t as o}from"./is-object-BGze3w87.mjs";import{t as s}from"./removal-file-path-Ca2hpj-C.mjs";import{join as c}from"node:path";import{readFileSync as l}from"node:fs";const u={allowTrailingComma:!0,disallowComments:!1};function d(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function f(o){let f=s(c(o,`.claude`,`launch.json`));if(f.kind!==`ready`)return f;let m=f.path,h;try{h=l(m,`utf-8`)}catch(e){return{kind:`declined`,reason:r(e)}}let g=[],_=e(h,g,u)??void 0;if(g.some(e=>!d(e,h))||_?.type!==`object`)return{kind:`declined`,reason:`unparseable`};let v=t(_).configurations;if(!Array.isArray(v))return{kind:`not-present`};let y=v.findIndex(p);if(y===-1)return{kind:`not-present`};let{text:b,changed:x}=i(h,[`configurations`,y]);return x?(n(m,b,{mode:a(m)}),{kind:`removed`}):{kind:`not-present`}}function p(e){if(!o(e))return!1;let t=e;if(t.name!==`open-knowledge-ui`||!Array.isArray(t.runtimeArgs))return!1;let n=t.runtimeArgs;return t.runtimeExecutable===`/bin/sh`?n.length===3&&n[0]===`-l`&&n[1]===`-c`&&typeof n[2]==`string`&&/^# ok-ui-v[1-9]\d*$/.test(n[2].split(/\r?\n/,1)[0]??``):t.runtimeExecutable===`npx`?m.some(e=>h(n,e)):t.runtimeExecutable===`powershell`&&n.length===4&&n[0]===`-NoProfile`&&n[1]===`-NonInteractive`&&n[2]===`-Command`&&typeof n[3]==`string`&&/^# ok-ui-win-v[1-9]\d*$/.test(n[3].split(/\r?\n/,1)[0]??``)}const m=[[`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge`,`ui`],[`-y`,`@inkeep/open-knowledge@latest`,`ui`]];function h(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}export{f as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./loader-BKb_bmT0.mjs";export{e as loadConfig};